text:
layout: post
title:  "Interviewing data: US budget and NASA facilities"
date:   2017-04-15
author: Jingnan Huo
---
# Interviewing data – U.S. Federal budget from 2000 – 2016; NASA

## Introducing the Dataset

The Congressional Budget Office's data on US Federal Budget from 2000-2016 shows the U.S. federal government's revenue source, and where it spends its money. All the data are numerical and are chronological.

## Major finding

**Social security seems to be having funding trouble**

Surplus on of social security has been declining since 2008, while its mandatory outlay is steadily growing and remains the biggest expenditure amongst mandatory outlays. With an aging population, the outlay will further increase while the surplus will not significantly increase.
The trend is corroborated by [CBO's report](mailto:https://www.cbo.gov/publication/52298) saying that the Social Security Trust Fund could be insolvent at 2029 if it pays out at the current rate, and when that happens, benefits would have to take a 29 percent cut in 2030 to keep it from going.

![](https://cloud.githubusercontent.com/assets/26884424/25079635/20d0bfe6-230c-11e7-80fe-7c92f98b6d48.png)

Social Security surplus has seen a steadily declining trend since 2008
![](https://cloud.githubusercontent.com/assets/26884424/25079642/2dac3560-230c-11e7-80fc-52cec6748a0a.png)

**Public debt rises consistently despite ups and downs in total deficit**

While the federal deficit has been through ups and downs before the financial crisis, took a plunge during the crisis and has since slowly recovered, the amount of debt being held by the public seemed to have largely ignored the economic cycle.
![](https://cloud.githubusercontent.com/assets/26884424/25079641/289bc6da-230c-11e7-8924-5cc00a42d878.png)

Debt held by the public makes up 77 percent of GDP now, more than double from the 35.3 percent in 2007. It could be a reflection of government stimulus measures (issuing lots of government bonds) after the crisis, and it also raises the question of how the government is going to pay back all this debt.
![](https://cloud.githubusercontent.com/assets/26884424/25079644/30b064a2-230c-11e7-9d94-c6bc5697d2c8.png)

**Corporate tax income has increased since crisis, and while payroll taxes is gaining weight as a revenue source, individual income tax remains the largest revenue source.**

![](https://cloud.githubusercontent.com/assets/26884424/25079647/34fb22ea-230c-11e7-8e9f-b2d3c554590d.png)

Link to the dataset and the charts is [here](https://docs.google.com/spreadsheets/d/1O41zR845E1UrDIj0MCf-wJkUeObsuKotNAUXtEqwVFI/edit?usp=sharing)

The dataset is a slice of Congressional Budget Office's latest [historical budget data](https://www.cbo.gov/sites/default/files/recurringdata/51134-2017-01-historicalbudgetdata.xlsx)

# Interviewing the dataset of Aerospace Technical Facility Inventory

The dataset from NASA shows information of technical facilities as distributed in different geolocations around the country belonging to different departments.

The pivot table shows that NASA, unsurprisingly, owns the most of these facilities (397 out of 439), followed by Intelstat (17) and the Department of Energy (12)

The state that has the most number of facilities is Alabama (136), where NASA's Marshall Space Flight Center is, followed by California (83), Virginia (60), Ohio (35) and Maryland (32). There are two facilities in Washington, DC.

In terms of cities, apart from Marshall Space Flight Center, Virginia's Hampton has the most facilities (50), followed by California's Pasadena (39), Maryland's Greenbelt (32) and Ohio's Cleveland (31) .

Pivot tables used to reveal these findings are [here](https://docs.google.com/spreadsheets/d/1qx-Xc79W0qRwG0P8blMVr5haYKeTTpDsA-u24U9zUgk/edit?usp=sharing)

Original dataset is [here](http://open.nasa.gov/datasets/NASA_Labs_Facilities.xlsx)


text:
The most important control interface in angr is the SimulationManager, which allows you to control symbolic execution over groups of states simultaneously, applying search strategies to explore a program's state space.
Here, you'll learn how to use it.

Simulation managers let you wrangle multiple states in a slick way.
States are organized into "stashes", which you can step forward, filter, merge, and move around as you wish.
This allows you to, for example, step two different stashes of states at different rates, then merge them together.
The default stash for most operations is the `active` stash, which is where your states get put when you initialize a new simulation manager.

### Stepping

The most basic capability of a simulation manager is to step forward all states in a given stash by one basic block.
You do this with `.step()`.

```python
>>> import angr
>>> proj = angr.Project('examples/fauxware/fauxware', auto_load_libs=False)
>>> state = proj.factory.entry_state()
>>> simgr = proj.factory.simgr(state)
>>> simgr.active
[<SimState @ 0x400580>]

>>> simgr.step()
>>> simgr.active
[<SimState @ 0x400540>]
```

Of course, the real power of the stash model is that when a state encounters a symbolic branch condition, both of the successor states appear in the stash, and you can step both of them in sync.
When you don't really care about controlling analysis very carefully and you just want to step until there's nothing left to step, you can just use the `.run()` method.

```python
# Step until the first symbolic branch
>>> while len(simgr.active) == 1:
...    simgr.step()

>>> simgr
<SimulationManager with 2 active>
>>> simgr.active
[<SimState @ 0x400692>, <SimState @ 0x400699>]

# Step until everything terminates
>>> simgr.run()
>>> simgr
<SimulationManager with 3 deadended>
```

We now have 3 deadended states!
When a state fails to produce any successors during execution, for example, because it reached an `exit` syscall, it is removed from the active stash and placed in the `deadended` stash.

### Stash Management

Let's see how to work with other stashes.

To move states between stashes, use `.move()`,  which takes `from_stash` (optional, default "active"), `to_stash`, and `filter_func` (optional, default is to move everything).
For example, let's move everything that has a certain string in its output:

```python
>>> simgr.move(from_stash='deadended', to_stash='authenticated', filter_func=lambda s: 'Welcome' in s.posix.dumps(1))
>>> simgr
<SimulationManager with 2 authenticated, 1 deadended>
```

We were able to just create a new stash named "authenticated" just by asking for states to be moved to it.
All the states in this stash have "Welcome" in their stdout, which is a fine metric for now.

Each stash is just a list, and you can index into or iterate over the list to access each of the individual states, but there are some alternate methods to access the states too.
If you prepend the name of a stash with `one_`, you will be given the first state in the stash.
If you prepend the name of a stash with `mp_`, you will be given a [mulpyplexed](https://github.com/zardus/mulpyplexer) version of the stash.

```python
>>> for s in simgr.deadended + simgr.authenticated:
...     print hex(s.addr)
0x1000030
0x1000078
0x1000078

>>> simgr.one_deadended
<SimState @ 0x1000030>
>>> simgr.mp_authenticated
MP([<SimState @ 0x1000078>, <SimState @ 0x1000078>])
>>> simgr.mp_authenticated.posix.dumps(0)
MP(['\x00\x00\x00\x00\x00\x00\x00\x00\x00SOSNEAKY\x00',
    '\x00\x00\x00\x00\x00\x00\x00\x00\x00S\x80\x80\x80\x80@\x80@\x00'])
```

Of course, `step`, `run`, and any other method that operates on a single stash of paths can take a `stash` argument, specifying which stash to operate on.

There are lots of fun tools that the simulation manager provides you for managing your stashes.
We won't go into the rest of them for now, but you should check out the API documentation. TODO: link

## Stash types

You can use stashes for whatever you like, but there are a few stashes that will be used to categorize some special kinds of states.
These are:

| Stash | Description |
|-------|-------------|
| active     | This stash contains the states that will be stepped by default, unless an alternate stash is specified. |
| deadended     | A state goes to the deadended stash when it cannot continue the execution for some reason, including no more valid instructions, unsat state of all of its successors, or an invalid instruction pointer. |
| pruned        | When using `LAZY_SOLVES`, states are not checked for satisfiability unless absolutely necessary. When a state is found to be unsat in the presence of `LAZY_SOLVES`, the state hierarchy is traversed to identify when, in its history, it initially became unsat. All states that are descendants of that point (which will also be unsat, since a state cannot become un-unsat) are pruned and put in this stash. |
| unconstrained | If the `save_unconstrained` option is provided to the SimulationManager constructor, states that are determined to be unconstrained (i.e., with the instruction pointer controlled by user data or some other source of symbolic data) are placed here. |
| unsat | If the `save_unsat` option is provided to the SimulationManager constructor, states that are determined to be unsatisfiable (i.e., they have constraints that are contradictory, like the input having to be both "AAAA" and "BBBB" at the same time) are placed here. |

There is another list of states that is not a stash: `errored`.
If, during execution, an error is raised, then the state will be wrapped in an `ErrorRecord` object, which contains the state and the error it raised, and then the record will be inserted into `errored`.
You can get at the state as it was at the beginning of the execution tick that caused the error with `record.state`, you can see the error that was raised with `record.error`, and you can launch a debug shell at the site of the error with `record.debug()`.
This is an invaluable debugging tool!

### Simple Exploration

An extremely common operation in symbolic execution is to find a state that reaches a certain address, while discarding all states that go through another address.
Simulation manager has a shortcut for this pattern, the `.explore()` method.

When launching `.explore()` with a `find` argument, execution will run until a state is found that matches the find condition, which can be the address of an instruction to stop at, a list of addresses to stop at, or a function which takes a state and returns whether it meets some criteria.
When any of the states in the active stash match the `find` condition, they are placed in the `found` stash, and execution terminates.
You can then explore the found state, or decide to discard it and continue with the other ones.
You can also specify an `avoid` condition in the same format as `find`.
When a state matches the avoid condition, it is put in the `avoided` stash, and execution continues.
Finally, the `num_find` argument controls the number of states that should be found before returning, with a default of 1.
Of course, if you run out of states in the active stash before finding this many solutions, execution will stop anyway.

Let's look at a simple crackme [example](./examples.md#reverseme-modern-binary-exploitation---csci-4968):

First, we load the binary.
```python
>>> proj = angr.Project('examples/CSCI-4968-MBE/challenges/crackme0x00a/crackme0x00a')
```

Next, we create a SimulationManager.
```python
>>> simgr = proj.factory.simgr()
```

Now, we symbolically execute until we find a state that matches our condition (i.e., the "win" condition).
```python
>>> simgr.explore(find=lambda s: "Congrats" in s.posix.dumps(1))
<SimulationManager with 1 active, 1 found>
```

Now, we can get the flag out of that state!
```python
>>> s = simgr.found[0]
>>> print s.posix.dumps(1)
Enter password: Congrats!

>>> flag = s.posix.dumps(0)
>>> print(flag)
g00dJ0B!
```

Pretty simple, isn't it?

Other examples can be found by browsing the [examples](./examples.md).

## Exploration Techniques

angr ships with several pieces of canned functionality that let you customize the behavior of a simulation manager, called _exploration techniques_.
The archetypical exploration technique is depth-first search, which puts all active paths except one in a stash called `deferred`, and whenever `active` goes empty, pops a state out of `deferred` and continues.

To use an exploration technique, call `simgr.use_technique(tech)`, where tech is an instance of an ExplorationTechnique subclass.
angr's built-in exploration techniques can be found under `angr.exploration_techniques`.

Here's a quick overview of some of the built-in ones:

- TODO

You can also write your own exploration techniques!
This will be covered in a later chapter.

redpajama_set_name: RedPajamaGithub


text:
set +e
set -x
SYSTEM=`uname -s`
if [ -z ${BRANCH} ]; then
    BRANCH="develop"
fi

if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    PADDLE_ROOT="$(cd "$PWD/../" && pwd )"
fi
CURDIR=`pwd`
cd $PADDLE_ROOT
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    cp $PADDLE_ROOT/paddle/scripts/paddle_build.sh $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    git remote | grep upstream
    if [ $? != 0 ]; then
        git remote add upstream https://github.com/PaddlePaddle/Paddle.git
    fi
    git fetch upstream ${BRANCH}
fi
CURBRANCH=`git rev-parse --abbrev-ref HEAD`
echo $CURBRANCH
if [ `git branch | grep 'prec_added_ut'` ];then
    git branch -D 'prec_added_ut'
fi
git checkout -b prec_added_ut upstream/${BRANCH}
git branch
mkdir prec_build
cd prec_build
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    bash $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh cmake_gen_in_current_dir >prebuild.log 2>&1
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    bash $PADDLE_ROOT/win_cmake.sh >prec_build.log 2>&1
fi
# remove line ended with .exe to get correct deleted_ut list
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' | sed '/\.exe$/d' | grep 'test' > $PADDLE_ROOT/br-ut
#UNITTEST_DEV.spec is used for checking changes of unnitests between pr and paddle_develop in the later step
spec_path_dev=${PADDLE_ROOT}/paddle/fluid/UNITTEST_DEV.spec
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' > ${spec_path_dev}
cd $PADDLE_ROOT/build
spec_path_pr=${PADDLE_ROOT}/paddle/fluid/UNITTEST_PR.spec
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' > ${spec_path_pr}
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' | sed '/\.exe$/d' | grep 'test' > $PADDLE_ROOT/pr-ut
cd $PADDLE_ROOT
grep -F -x -v -f br-ut pr-ut > $PADDLE_ROOT/added_ut
if [[ "$SYSTEM" == 'Linux' ]];then
    sort pr-ut |uniq -d > $PADDLE_ROOT/duplicate_ut
fi
echo "New-UT:"
cat $PADDLE_ROOT/added_ut
rm -rf prec_build
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    rm $PADDLE_ROOT/br-ut $PADDLE_ROOT/pr-ut $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    # get the deleted ut list in windows, will be used in check_change_of_unittest.sh
    grep -F -x -v -f pr-ut br-ut > $PADDLE_ROOT/deleted_ut
    rm $PADDLE_ROOT/br-ut $PADDLE_ROOT/pr-ut $PADDLE_ROOT/win_cmake.sh
fi
git checkout -f $CURBRANCH
echo $CURBRANCH
git branch -D prec_added_ut
cd $CURDIR


text:
package com.github.anba.es6draft.compiler;

import static com.github.anba.es6draft.semantics.StaticSemantics.*;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.objectweb.asm.Type;

import com.github.anba.es6draft.ast.*;
import com.github.anba.es6draft.compiler.Code.MethodCode;
import com.github.anba.es6draft.compiler.CodeGenerator.FunctionName;
import com.github.anba.es6draft.compiler.InstructionVisitor.MethodDesc;
import com.github.anba.es6draft.compiler.InstructionVisitor.MethodType;
import com.github.anba.es6draft.compiler.InstructionVisitor.Variable;
import com.github.anba.es6draft.runtime.EnvironmentRecord;
import com.github.anba.es6draft.runtime.ExecutionContext;
import com.github.anba.es6draft.runtime.LexicalEnvironment;
import com.github.anba.es6draft.runtime.internal.CompatibilityOption;
import com.github.anba.es6draft.runtime.types.Undefined;
import com.github.anba.es6draft.runtime.types.builtins.ExoticArguments;
import com.github.anba.es6draft.runtime.types.builtins.FunctionObject;

/**
 *
9 Ordinary and Exotic Objects Behaviours

 *
9.2 ECMAScript Function Objects

 *

 *
9.2.13 Function Declaration Instantiation
 *

 */
final class FunctionDeclarationInstantiationGenerator extends
        DeclarationBindingInstantiationGenerator {
    private static final class Methods {
        // class: Arrays
        static final MethodDesc Arrays_asList = MethodDesc.create(MethodType.Static, Types.Arrays,
                "asList", Type.getMethodType(Types.List, Types.Object_));

        // class: ExecutionContext
        static final MethodDesc ExecutionContext_getVariableEnvironment = MethodDesc.create(
                MethodType.Virtual, Types.ExecutionContext, "getVariableEnvironment",
                Type.getMethodType(Types.LexicalEnvironment));

        // class: ExoticArguments
        static final MethodDesc ExoticArguments_CreateMappedArgumentsObject = MethodDesc.create(
                MethodType.Static, Types.ExoticArguments, "CreateMappedArgumentsObject", Type
                        .getMethodType(Types.ExoticArguments, Types.ExecutionContext,
                                Types.FunctionObject, Types.Object_, Types.String_,
                                Types.LexicalEnvironment));

        static final MethodDesc ExoticArguments_CreateStrictArgumentsObject = MethodDesc.create(
                MethodType.Static, Types.ExoticArguments, "CreateStrictArgumentsObject",
                Type.getMethodType(Types.ExoticArguments, Types.ExecutionContext, Types.Object_));

        static final MethodDesc ExoticArguments_CreateLegacyArgumentsObject = MethodDesc.create(
                MethodType.Static, Types.ExoticArguments, "CreateLegacyArgumentsObject", Type
                        .getMethodType(Types.ExoticArguments, Types.ExecutionContext,
                                Types.FunctionObject, Types.Object_, Types.String_,
                                Types.LexicalEnvironment));

        static final MethodDesc ExoticArguments_CreateLegacyArgumentsObjectFrom = MethodDesc
                .create(MethodType.Static, Types.ExoticArguments, "CreateLegacyArgumentsObject",
                        Type.getMethodType(Types.ExoticArguments, Types.ExecutionContext,
                                Types.FunctionObject, Types.Object_, Types.ExoticArguments));

        // FunctionObject
        static final MethodDesc FunctionObject_setLegacyArguments = MethodDesc.create(
                MethodType.Virtual, Types.FunctionObject, "setLegacyArguments",
                Type.getMethodType(Type.VOID_TYPE, Types.ExoticArguments));

        // class: List
        static final MethodDesc List_iterator = MethodDesc.create(MethodType.Interface, Types.List,
                "iterator", Type.getMethodType(Types.Iterator));
    }

    private static final int EXECUTION_CONTEXT = 0;
    private static final int FUNCTION = 1;
    private static final int ARGUMENTS = 2;

    private static final class FunctionDeclInitMethodGenerator extends ExpressionVisitor {
        FunctionDeclInitMethodGenerator(MethodCode method, FunctionNode node) {
            super(method, false, IsStrict(node), false, false);
        }

        @Override
        public void begin() {
            super.begin();
            setParameterName("cx", EXECUTION_CONTEXT, Types.ExecutionContext);
            setParameterName("function", FUNCTION, Types.FunctionObject);
            setParameterName("arguments", ARGUMENTS, Types.Object_);
        }
    }

    FunctionDeclarationInstantiationGenerator(CodeGenerator codegen) {
        super(codegen);
    }

    void generate(FunctionNode function) {
        MethodCode method = codegen.newMethod(function, FunctionName.Init);
        ExpressionVisitor mv = new FunctionDeclInitMethodGenerator(method, function);

        mv.lineInfo(function);
        mv.begin();
        mv.enterScope(function);
        generate(function, mv);
        mv.exitScope();
        mv.end();
    }

    private void generate(FunctionNode function, ExpressionVisitor mv) {
        Variable<ExecutionContext> context = mv.getParameter(EXECUTION_CONTEXT,
                ExecutionContext.class);

        Variable<LexicalEnvironment> env = mv.newVariable("env", LexicalEnvironment.class);
        mv.loadExecutionContext();
        mv.invoke(Methods.ExecutionContext_getVariableEnvironment);
        mv.store(env);

        Variable<EnvironmentRecord> envRec = mv.newVariable("envRec", EnvironmentRecord.class);
        getEnvironmentRecord(env, mv);
        mv.store(envRec);

        Variable<Undefined> undef = mv.newVariable("undef", Undefined.class);
        mv.loadUndefined();
        mv.store(undef);

        boolean hasParameters = !function.getParameters().getFormals().isEmpty();
        Variable<Iterator<?>> iterator = null;
        if (hasParameters) {
            iterator = uncheckedCast(mv.newVariable("iterator", Iterator.class));
            mv.loadParameter(ARGUMENTS, Object[].class);
            mv.invoke(Methods.Arrays_asList);
            mv.invoke(Methods.List_iterator);
            mv.store(iterator);
        }

        Set<String> bindings = new HashSet<>();
        /* step 1 */
        // RuntimeInfo.Function code = func.getCode();
        /* step 2 */
        boolean strict = IsStrict(function);
        boolean legacy = !strict && codegen.isEnabled(CompatibilityOption.FunctionPrototype);
        /* step 3 */
        FormalParameterList formals = function.getParameters();
        /* step 4 */
        List<String> parameterNames = BoundNames(formals);
        /* step 5 */
        List<StatementListItem> varDeclarations = VarScopedDeclarations(function);
        /* step 6 */
        List<Declaration> functionsToInitialise = new ArrayList<>();
        /* steps 7-8 */
        boolean argumentsObjectNeeded;
        if (function instanceof ArrowFunction || function instanceof GeneratorComprehension) {
            // => [[ThisMode]] of func is lexical
            argumentsObjectNeeded = false;
        } else {
            argumentsObjectNeeded = true;
        }
        /* step 9 */
        for (StatementListItem item : reverse(varDeclarations)) {
            if (item instanceof FunctionDeclaration || item instanceof GeneratorDeclaration) {
                Declaration d = (Declaration) item;
                String fn = BoundName(d);
                if ("arguments".equals(fn)) {
                    argumentsObjectNeeded = false;
                }
                boolean alreadyDeclared = bindings.contains(fn);
                if (!alreadyDeclared) {
                    bindings.add(fn);
                    functionsToInitialise.add(d);
                    createMutableBinding(envRec, fn, false, mv);
                }
            }
        }
        /* step 10 */
        for (String paramName : parameterNames) {
            boolean alreadyDeclared = bindings.contains(paramName);
            if (!alreadyDeclared) {
                if ("arguments".equals(paramName)) {
                    argumentsObjectNeeded = false;
                }
                bindings.add(paramName);
                createMutableBinding(envRec, paramName, false, mv);
                // stack: [undefined] -> []
                mv.load(undef);
                initialiseBinding(envRec, paramName, mv);
            }
        }
        /* steps 11-12 */
        if (argumentsObjectNeeded) {
            bindings.add("arguments");
            if (strict) {
                createImmutableBinding(envRec, "arguments", mv);
            } else {
                createMutableBinding(envRec, "arguments", false, mv);
            }
        }
        /* step 13 */
        Set<String> varNames = VarDeclaredNames(function);
        /* step 14 */
        for (String varName : varNames) {
            boolean alreadyDeclared = bindings.contains(varName);
            if (!alreadyDeclared) {
                bindings.add(varName);
                createMutableBinding(envRec, varName, false, mv);
                // FIXME: spec bug (partially reported in Bug 1420)
                mv.load(undef);
                initialiseBinding(envRec, varName, mv);
            }
        }
        /* step 15 */
        List<Declaration> lexDeclarations = LexicallyScopedDeclarations(function);
        /* step 16 */
        for (Declaration d : lexDeclarations) {
            assert !(d instanceof GeneratorDeclaration);
            for (String dn : BoundNames(d)) {
                if (d.isConstDeclaration()) {
                    createImmutableBinding(envRec, dn, mv);
                } else {
                    createMutableBinding(envRec, dn, false, mv);
                }
            }
        }
        /* step 17 */
        for (Declaration f : functionsToInitialise) {
            String fn = BoundName(f);
            // stack: [] -> [fo]
            if (f instanceof GeneratorDeclaration) {
                InstantiateGeneratorObject(context, env, (GeneratorDeclaration) f, mv);
            } else {
                InstantiateFunctionObject(context, env, (FunctionDeclaration) f, mv);
            }
            // stack: [fo] -> []
            // setMutableBinding(envRec, fn, false, mv);
            initialiseBinding(envRec, fn, mv);
        }
        /* steps 18-20 */
        if (hasParameters) {
            BindingInitialisation(function, iterator, mv);
        }
        /* step 21 */
        if (argumentsObjectNeeded) {
            // stack: [] -> [ao]
            if (strict) {
                CreateStrictArgumentsObject(mv);
            } else {
                CreateMappedArgumentsObject(env, formals, mv);
            }
            if (legacy) {
                Variable<ExoticArguments> argumentsObj = mv.newVariable("argumentsObj",
                        ExoticArguments.class);
                mv.store(argumentsObj);
                CreateLegacyArguments(argumentsObj, mv);
                mv.load(argumentsObj);
            }
            // stack: [ao] -> []
            initialiseBinding(envRec, "arguments", mv);
        } else if (legacy) {
            // stack: [] -> []
            CreateLegacyArguments(env, formals, mv);
        }
        /* step 22 */
        mv.areturn();
    }

    private void BindingInitialisation(FunctionNode node, Variable<Iterator<?>> iterator,
            ExpressionVisitor mv) {
        // stack: [] -> []
        new BindingInitialisationGenerator(codegen).generate(node, iterator, mv);
    }

    private void CreateMappedArgumentsObject(Variable<LexicalEnvironment> env,
            FormalParameterList formals, ExpressionVisitor mv) {
        mv.loadExecutionContext();
        mv.loadParameter(FUNCTION, FunctionObject.class);
        mv.loadParameter(ARGUMENTS, Object[].class);
        newStringArray(mv, mappedNames(formals));
        mv.load(env);
        mv.invoke(Methods.ExoticArguments_CreateMappedArgumentsObject);
    }

    private void CreateStrictArgumentsObject(ExpressionVisitor mv) {
        mv.loadExecutionContext();
        mv.loadParameter(ARGUMENTS, Object[].class);
        mv.invoke(Methods.ExoticArguments_CreateStrictArgumentsObject);
    }

    private void CreateLegacyArguments(Variable<LexicalEnvironment> env,
            FormalParameterList formals, ExpressionVisitor mv) {
        // function.setLegacyArguments(<legacy-arguments>)
        mv.loadParameter(FUNCTION, FunctionObject.class);
        {
            // CreateLegacyArgumentsObject(cx, function, arguments, formals, scope)
            mv.loadExecutionContext();
            mv.loadParameter(FUNCTION, FunctionObject.class);
            mv.loadParameter(ARGUMENTS, Object[].class);
            newStringArray(mv, mappedNames(formals));
            mv.load(env);
            mv.invoke(Methods.ExoticArguments_CreateLegacyArgumentsObject);
        }
        mv.invoke(Methods.FunctionObject_setLegacyArguments);
    }

    private void CreateLegacyArguments(Variable<ExoticArguments> argumentsObj, ExpressionVisitor mv) {
        // function.setLegacyArguments(<legacy-arguments>)
        mv.loadParameter(FUNCTION, FunctionObject.class);
        {
            // CreateLegacyArgumentsObject(cx, function, arguments, argumentsObj)
            mv.loadExecutionContext();
            mv.loadParameter(FUNCTION, FunctionObject.class);
            mv.loadParameter(ARGUMENTS, Object[].class);
            mv.load(argumentsObj);
            mv.invoke(Methods.ExoticArguments_CreateLegacyArgumentsObjectFrom);
        }
        mv.invoke(Methods.FunctionObject_setLegacyArguments);
    }

    private String[] mappedNames(FormalParameterList formals) {
        List<FormalParameter> list = formals.getFormals();
        int numberOfNonRestFormals = NumberOfParameters(formals);
        assert numberOfNonRestFormals <= list.size();

        Set<String> mappedNames = new HashSet<>();
        String[] names = new String[numberOfNonRestFormals];
        for (int index = numberOfNonRestFormals - 1; index >= 0; --index) {
            assert list.get(index) instanceof BindingElement;
            BindingElement formal = (BindingElement) list.get(index);
            if (formal.getBinding() instanceof BindingIdentifier) {
                String name = ((BindingIdentifier) formal.getBinding()).getName();
                if (!mappedNames.contains(name)) {
                    mappedNames.add(name);
                    names[index] = name;
                }
            }
        }
        return names;
    }

    private void newStringArray(InstructionVisitor mv, String[] strings) {
        mv.newarray(strings.length, Types.String);
        int index = 0;
        for (String string : strings) {
            mv.astore(index++, string);
        }
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    private static final Variable<Iterator<?>> uncheckedCast(Variable<Iterator> o) {
        return (Variable<Iterator<?>>) (Variable<?>) o;
    }
}


text:
class PermalinkConstraint

  def matches?(request)
#    Permalink.where(url: Permalink.normalize_url(request.fullpath)).exists?
  end

end


text:
std::string ngraph::serialize(std::shared_ptr<ngraph::Function> func, size_t indent)
{
    throw std::runtime_error("serializer disabled in build");
}

void ngraph::serialize(const std::string& path,
                       std::shared_ptr<ngraph::Function> func,
                       size_t indent)
{
    throw std::runtime_error("serializer disabled in build");
}

void ngraph::serialize(std::ostream& out, std::shared_ptr<ngraph::Function> func, size_t indent)
{
    throw std::runtime_error("serializer disabled in build");
}

std::shared_ptr<ngraph::Function> ngraph::deserialize(std::istream& in)
{
    throw std::runtime_error("serializer disabled in build");
}

std::shared_ptr<ngraph::Function> ngraph::deserialize(const std::string& str)
{
    throw std::runtime_error("serializer disabled in build");
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Purchasing extends CI_Controller {
	function __construct() {
		parent::__construct();
		if(!$this->session->userdata('logged_in_clinic')) redirect(base_url());
		$this->load->library('template_apotek');
		$this->load->model('apotek/purchasing_model');
	}

	public function index()
	{
		if($this->session->userdata('logged_in_clinic'))
		{
			$data['daftarlist'] = $this->purchasing_model->select_all()->result();
			$this->template_apotek->display('apotek/purchasing_view', $data);
		} else {
			$this->session->sess_destroy();
			redirect(base_url());
		}
	}

	public function adddata() {
		$data['listSuplier'] 	= $this->purchasing_model->select_suplier()->result();
		$data['listObat'] 		= $this->purchasing_model->select_obat()->result();

		$ID_Purchase			= $this->uri->segment(4);
		if (empty($ID_Purchase) || $ID_Purchase == '') {
			$data['KodePO'] 	= $this->purchasing_model->getkodeunik();
			$data['Total']		= 0;
		} else {
			$CekPO 				= $this->purchasing_model->check_purchase($ID_Purchase)->row();
			$data['KodePO'] 	= $CekPO->purchase_no;
			$Total 				= $this->purchasing_model->select_total($ID_Purchase)->row();
			$data['Total']		= $Total->total; // Total PO
		}
		$data['listItem'] 		= $this->purchasing_model->select_item($ID_Purchase)->result();
		$this->template_apotek->display('apotek/purchasing_add_view', $data);
	}

	public function savedataitem() {
		$ID_Purchase			= $this->uri->segment(4);

		if (empty($ID_Purchase) || $ID_Purchase == '') {
			// Insert Baru ke Purchase
			$CodePO = $this->purchasing_model->getkodeunik(); //Cek lagi jika ada 2 PO lewat Jaringan
			$data = array(
				'purchase_no'				=> $CodePO,
		   		'purchase_date' 			=> date('Y-m-d'),
		   		'purchase_date_update' 		=> date('Y-m-d'),
		   		'purchase_time_update' 		=> date('Y-m-d H:i:s'),
		   		'user_username' 			=> trim($this->session->userdata('username')),
		   		'purchase_status' 			=> 0
			);

			$this->db->insert('clinic_purchase', $data);
			$id = $this->db->insert_id();
		} else {
			$id = $ID_Purchase;
		}

		// Insert Item
		// Cek jika ada Item yang Sama dimasukkan
		$CodeObat = trim($this->input->post('code'));
		$CekItem  = $this->purchasing_model->check_item($CodeObat)->row();
		if (count($CekItem) > 0) { // Jika Ada, Maka Update Item
			$Qty = $CekItem->purc_detail_qty;
			$Sub = $CekItem->purc_detail_subtotal;

			$SubTotal 	= intval(str_replace(",", "", $this->input->post('subtotal')));

			$data = array(
					'purc_detail_qty'			=> ($Qty + $this->input->post('qty')),
					'purc_detail_subtotal'		=> ($Sub + $SubTotal),
			   		'purc_detail_date_update' 	=> date('Y-m-d'),
			   		'purc_detail_time_update' 	=> date('Y-m-d H:i:s')
			);

			$this->db->where('obat_code', $CodeObat);
			$this->db->where('purchase_id', $id);
			$this->db->update('clinic_purchase_detail', $data);
		} else {
			// Konversi String ke Integer
			$Harga 		= intval(str_replace(",", "", $this->input->post('harga')));
			$SubTotal 	= intval(str_replace(",", "", $this->input->post('subtotal')));

			$data = array(
					'purchase_id'				=> $id,
					'obat_code'					=> trim($this->input->post('code')),
					'purc_detail_name'			=> trim($this->input->post('name')),
					'purc_detail_qty'			=> $this->input->post('qty'),
					'purc_detail_satuan'		=> trim($this->input->post('satuan')),
					'purc_detail_harga'			=> $Harga,
					'purc_detail_subtotal'		=> $SubTotal,
			   		'purc_detail_date_update' 	=> date('Y-m-d'),
			   		'purc_detail_time_update' 	=> date('Y-m-d H:i:s')
			);

			$this->db->insert('clinic_purchase_detail', $data);
		}

		// Update Total Purchase
		$Total 		= $this->purchasing_model->select_total($ID_Purchase)->row();
		$TotalPO	= $Total->total; // Total PO

		$data = array(
			'purchase_total'			=> $TotalPO,
		   	'purchase_date_update' 		=> date('Y-m-d'),
		   	'purchase_time_update' 		=> date('Y-m-d H:i:s'),
		   	'user_username' 			=> trim($this->session->userdata('username'))
		);

		$this->db->where('purchase_id', $id);
		$this->db->update('clinic_purchase', $data);
		// Redirect ke Halaman Adddata
		redirect(site_url('apotek/purchasing/adddata/'.$id));
	}

	public function savedataitemedit() {
		$ID_Purchase			= $this->uri->segment(4);
		// Insert Item
		// Cek jika ada Item yang Sama dimasukkan
		$CodeObat = trim($this->input->post('code'));
		$CekItem  = $this->purchasing_model->check_item($CodeObat)->row();
		if (count($CekItem) > 0) { // Jika Ada, Maka Update Item
			$Qty = $CekItem->purc_detail_qty;
			$Sub = $CekItem->purc_detail_subtotal;

			$SubTotal 	= intval(str_replace(",", "", $this->input->post('subtotal')));

			$data = array(
					'purc_detail_qty'			=> ($Qty + $this->input->post('qty')),
					'purc_detail_subtotal'		=> ($Sub + $SubTotal),
			   		'purc_detail_date_update' 	=> date('Y-m-d'),
			   		'purc_detail_time_update' 	=> date('Y-m-d H:i:s')
			);

			$this->db->where('obat_code', $CodeObat);
			$this->db->where('purchase_id', $ID_Purchase);
			$this->db->update('clinic_purchase_detail', $data);
		} else {
			// Konversi String ke Integer
			$Harga 		= intval(str_replace(",", "", $this->input->post('harga')));
			$SubTotal 	= intval(str_replace(",", "", $this->input->post('subtotal')));

			$data = array(
					'purchase_id'				=> $ID_Purchase,
					'obat_code'					=> trim($this->input->post('code')),
					'purc_detail_name'			=> trim($this->input->post('name')),
					'purc_detail_qty'			=> $this->input->post('qty'),
					'purc_detail_satuan'		=> trim($this->input->post('satuan')),
					'purc_detail_harga'			=> $Harga,
					'purc_detail_subtotal'		=> $SubTotal,
			   		'purc_detail_date_update' 	=> date('Y-m-d'),
			   		'purc_detail_time_update' 	=> date('Y-m-d H:i:s')
			);

			$this->db->insert('clinic_purchase_detail', $data);
		}

		// Update Total Purchase
		$Total 		= $this->purchasing_model->select_total($ID_Purchase)->row();
		$TotalPO	= $Total->total; // Total PO

		$data = array(
			'purchase_total'			=> $TotalPO,
		   	'purchase_date_update' 		=> date('Y-m-d'),
		   	'purchase_time_update' 		=> date('Y-m-d H:i:s'),
		   	'user_username' 			=> trim($this->session->userdata('username'))
		);

		$this->db->where('purchase_id', $ID_Purchase);
		$this->db->update('clinic_purchase', $data);

		// Redirect ke Halaman EditData
		redirect(site_url('apotek/purchasing/editdata/'.$ID_Purchase));
	}

	public function editdata($ID_Purchase) {
		$data['listSuplier'] 	= $this->purchasing_model->select_suplier()->result();
		$data['listObat'] 		= $this->purchasing_model->select_obat()->result();
		$data['detail'] 		= $this->purchasing_model->select_by_id($ID_Purchase)->row();
		$data['listItem'] 		= $this->purchasing_model->select_item($ID_Purchase)->result();
		$Total 					= $this->purchasing_model->select_total($ID_Purchase)->row();
		$data['Total']			= $Total->total; // Total PO
		$this->template_apotek->display('apotek/purchasing_edit_view', $data);
	}

	public function updatedataitem() {
		$this->purchasing_model->update_data_item();
		$this->session->set_flashdata('notification','Data Item Tersimpan.');
		redirect(site_url('apotek/purchasing/adddata/'.$this->uri->segment(4)));
	}

	public function updatedataitemedit() {
		$this->purchasing_model->update_data_item();
		$this->session->set_flashdata('notification','Data Item Tersimpan.');
		redirect(site_url('apotek/purchasing/editdata/'.$this->uri->segment(4)));
	}

	public function updatedata() {
		$this->purchasing_model->update_data();
		$this->session->set_flashdata('notification','Data Purchase Tersimpan.');
		redirect(site_url('apotek/purchasing'));
	}

	public function deletedata($kode) {
		$kode = $this->security->xss_clean($this->uri->segment(4));

		if ($kode == null) {
			redirect(site_url('apotek/purchasing'));
		} else {
			$this->purchasing_model->delete_data($kode);
			$this->session->set_flashdata('notification','Hapus Data Purchase Sukses.');
			redirect(site_url('apotek/purchasing'));
		}
	}

	public function deletedataitem($kode) {
		$kode = $this->security->xss_clean($this->uri->segment(5));

		if ($kode == null) {
			redirect(site_url('apotek/purchasing/adddata/'.$this->uri->segment(4)));
		} else {
			$this->purchasing_model->delete_data_item($kode);
			$this->session->set_flashdata('notification','Hapus Item Sukses.');
			redirect(site_url('apotek/purchasing/adddata/'.$this->uri->segment(4)));
		}
	}

	public function deletedataitemedit($kode) {
		$kode = $this->security->xss_clean($this->uri->segment(5));

		if ($kode == null) {
			redirect(site_url('apotek/purchasing/adddata/'.$this->uri->segment(4)));
		} else {
			$this->purchasing_model->delete_data_item($kode);
			$this->session->set_flashdata('notification','Hapus Item Sukses.');
			redirect(site_url('apotek/purchasing/editdata/'.$this->uri->segment(4)));
		}
	}
}
/* Location: ./application/controller/apotek/Purchasing.php */


text:
/**
 *
 */
package se.mah.elis.data;

/**
 * The ElectricitySample interface encapsulates electricity usage data from
 * sensors with electricity-sampling capabilities. While SI units are mostly
 * used, support for watt hours is also available, since that unit is widely
 * used by electric utilities.
 *
 * @author "Johan Holmberg, Malmö University"
 * @since 1.0
 */
public interface ElectricitySample extends Sample {

	/**
	 * Gets the currently measured current in amperes.
	 *
	 * @return The currently measured current in amperes, given as a double.
	 * @since 1.0
	 */
	double getCurrentCurrent();

	/**
	 * Gets the currently measured voltage in volts.
	 *
	 * @return The currently measured voltage in volts, given as a double.
	 * @since 1.0
	 */
	double getCurrentVoltage();

	/**
	 * Gets the currently measured power consumption in watts.
	 *
	 * @return The currently measured power consumption in watts, given as a
	 * 		   double.
	 * @since 1.0
	 */
	double getCurrentPower();

	/**
	 * Gets the highest measured current in the sample in amperes.
	 *
	 * @return The highest measured current in amperes, given as a double.
	 * @since 1.0
	 */
	double getMaxCurrent();

	/**
	 * Gets the highest measured voltage in the sample in Volts.
	 *
	 * @return The highest measured current in Volts, given as a double.
	 * @since 1.0
	 */
	double getMaxVoltage();

	/**
	 * Gets the highest measured power usage in the sample in watts.
	 *
	 * @return The highest measured power usage in watts, given as a double.
	 * @since 1.0
	 */
	double getMaxPower();

	/**
	 * Gets the lowest measured current in the sample in amperes.
	 *
	 * @return The lowest measured current in amperes, given as a double.
	 * @since 1.0
	 */
	double getMinCurrent();

	/**
	 * Gets the lowest measured voltage in the sample in volts.
	 *
	 * @return The lowest measured current in volts, given as a double.
	 * @since 1.0
	 */

	double getMinVoltage();

	/**
	 * Gets the lowest measured power usage in the sample in watts.
	 *
	 * @return The lowest measured power usage in watts, given as a double.
	 * @since 1.0
	 */
	double getMinPower();

	/**
	 * Gets the mean current in the sample in amperes.
	 *
	 * @return The mean current in amperes, given as a double.
	 * @since 1.0
	 */
	double getMeanCurrent();

	/**
	 * Gets the mean voltage in the sample in volts.
	 *
	 * @return The mean voltage in volts, given as a double.
	 * @since 1.0
	 */
	double getMeanVoltage();

	/**
	 * Gets the mean power usage in the sample in watts.
	 *
	 * @return The mean power usage in watts, given as a double.
	 * @since 1.0
	 */
	double getMeanPower();

	/**
	 * Gets the total energy usage during the sample in joules.
	 *
	 * @return The total energy usage in joules, given as a double.
	 * @since 1.0
	 */
	double getTotalEnergyUsageInJoules();

	/**
	 * Gets the total energy usage during the sample in watt hours (Wh).
	 *
	 * @return The total energy usage in watt hours, given as a double.
	 * @since 1.0
	 */
	double getTotalEnergyUsageInWh();
}


text:
/*
 * color_cyan.h
 * Declares a class that represents the color cyan
 * Created by Andrew Davis
 * Created on 7/18/2017
 * Open source (MIT license)
 */

//disallow reinclusion
#ifndef CPP_CUR_COLOR_CYAN_H
#define CPP_CUR_COLOR_CYAN_H

//includes
#include "enum_color.h"
#include "color.h"

//namespace declaration
namespace cppcurses {
	//class declaration
	class color_cyan final : public color
	{
		//public fields and methods
		public:
			//first constructor - uses the current color
			color_cyan();

			//second constructor - modifies the color
			color_cyan(short nr, short ng, short nb);

			//destructor
			~color_cyan();

			//copy constructor
			color_cyan(const color_cyan& cc);

			//move constructor
			color_cyan(color_cyan&& cc);

			//assignment operator
			color_cyan& operator=(const color_cyan& src);

			//move operator
			color_cyan& operator=(color_cyan&& src);

		//no private fields or methods
	};
}

#endif


text:
module Bulldog
  module Attachment
    class Video < Base
      handle :video
      include HasDimensions

      #
      # Return the duration of the named style, as an
      # ActiveSupport::Duration.
      #
      # This runs ffmpeg for, and only for, the original style.
      #
      # +style_name+ defaults to the attribute's #default_style.
      #
      def duration(style_name)
        from_examination :@original_duration
      end

      #
      # Return the video tracks of the named style, as an array of
      # VideoTrack objects.
      #
      # Each VideoTrack has:
      #
      #  * <tt>#duration</tt> - the duration of the video track.
      #  * <tt>#dimensions</tt> - the [width, height] of the video
      #    track.
      #
      def video_tracks(style_name=nil)
        style_name ||= reflection.default_style
        if style_name.equal?(:original)
          from_examination :@original_video_tracks
        else
          style = reflection.styles[style_name]
          video_tracks(:original).map do |video_track|
            dimensions = resize_dimensions(dimensions(:original), style)
            VideoTrack.new(:dimensions => dimensions)
          end
        end
      end

      #
      # Return the video tracks of the named style, as an array of
      # AudioTrack objects.
      #
      # AudioTrack objects do not yet have any useful methods.
      #
      def audio_tracks(style_name=nil)
        examine
        @original_audio_tracks
      end

      storable_attribute :duration, :per_style => true, :memoize => true

      def unload
        super
        instance_variables.grep(/@original_/).each do |name|
          instance_variable_set(name, nil)
        end
      end

      protected  # ---------------------------------------------------

      #
      # Return the default processor class to use for this attachment.
      #
      def default_processor_type
        :ffmpeg
      end

      #
      # Overridden to round down to multiples of 2, as required by
      # some codecs.
      #
      def resize_dimensions(original_dimensions, style)
        dimensions = super
        dimensions.map!{|i| i &= -2}
      end

      private  # -----------------------------------------------------

      #
      # Read the original image metadata with ffmpeg.
      #
      def run_examination
        if stream.missing?
          set_defaults
          false
        else
          output = `ffmpeg -i #{stream.path} 2>&1`
          # ffmpeg exits nonzero - don't bother checking status.
          parse_output(output)
          true
        end
      end

      def set_defaults
        @original_duration = 0
        @original_width = 2
        @original_height = 2
        @original_audio_tracks = []
        @original_video_tracks = []
      end

      def parse_output(output)
        result = false
        set_defaults
        io = StringIO.new(output)
        while (line = io.gets)
          case line
          when /^Input #0, (.*?), from '(?:.*)':$/
            result = true
            duration = nil
          when /^  Duration: (\d+):(\d+):(\d+)\.(\d+)/
            duration = $1.to_i.hours + $2.to_i.minutes + $3.to_i.seconds
          when /Stream #(?:.*?): Video: /
            if $' =~ /(\d+)x(\d+)/
              dimensions = [$1.to_i, $2.to_i]
            end
            @original_video_tracks << VideoTrack.new(:dimensions => dimensions, :duration => duration)
          when /Stream #(?:.*?): Audio: (.*?)/
            @original_audio_tracks << AudioTrack.new(:duration => duration)
          end
        end
        if (track = @original_video_tracks.first)
          @original_width, @original_height = *track.dimensions
        end
        if (track = @original_video_tracks.first || @original_audio_tracks.first)
          @original_duration = track.duration
        end
        result
      end

      class Track
        def initialize(attributes={})
          attributes.each do |name, value|
            send("#{name}=", value)
          end
        end

        attr_accessor :duration
      end

      class VideoTrack < Track
        attr_accessor :dimensions
      end

      class AudioTrack < Track
      end
    end
  end
end


text:
#include "musicindicator.h"
#include "musicserviceproxy.h"

#define SERVICE "com.meego.app.music"

#include <QDBusReply>
#include <QDBusConnectionInterface>

MusicIndicator::MusicIndicator(QObject *parent) : QObject(parent) , m_innerMI(0)
{

    m_serviceWatcher = new QDBusServiceWatcher(SERVICE,
                                               QDBusConnection::sessionBus(),
                                               QDBusServiceWatcher::WatchForRegistration |
                                               QDBusServiceWatcher::WatchForUnregistration,
                                               this);
    connect(m_serviceWatcher, SIGNAL(serviceRegistered(const QString &)),
            this, SLOT(serviceRegistered()));
    connect(m_serviceWatcher, SIGNAL(serviceUnregistered(const QString &)),
            this, SLOT(serviceUnregistered()));

    QDBusReply<bool> registered= QDBusConnection::sessionBus().interface()->isServiceRegistered(SERVICE);
    if (registered.isValid())
    {
        if (registered.value())
        {
            serviceRegistered();
        };
    }
}

MusicIndicator::~MusicIndicator()
{
}

QString MusicIndicator::state() const
{
    if (innerIsValid())
    {
        return m_innerMI->state();
    }
    else
    {
        return "stopped";
    }
}

bool MusicIndicator::innerIsValid() const
{
    if (m_innerMI)
    {
        if (m_innerMI->isValid())
        {
            return true;
        }
    }
    return false;
}

void MusicIndicator::serviceRegistered()
{
    m_innerMI = new MusicServiceProxy(SERVICE, "/com/meego/app/music",
                                      QDBusConnection::sessionBus(), this);
    if (!m_innerMI->isValid())
    {
        QDBusError err = m_innerMI->lastError();
        qWarning() << "Failed to register for music events: " << err.message();
        serviceUnregistered();
    }
    else
    {
        connect(m_innerMI, SIGNAL(stateChanged()), this, SIGNAL(stateChanged()));
        emit stateChanged();
    }
}

void MusicIndicator::serviceUnregistered()
{
    if (m_innerMI)
    {
        m_innerMI->deleteLater();
    }
    m_innerMI = NULL;
    emit stateChanged();
}


text:
/*
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVFILTER_HERMITE_H
#define AVFILTER_HERMITE_H

static inline double hermite_interpolation(double x, double x0, double x1,
                                    double p0, double p1,
                                    double m0, double m1)
{
    double width = x1 - x0;
    double t = (x - x0) / width;
    double t2, t3;
    double ct0, ct1, ct2, ct3;

    m0 *= width;
    m1 *= width;

    t2 = t*t;
    t3 = t2*t;
    ct0 = p0;
    ct1 = m0;

    ct2 = -3 * p0 - 2 * m0 + 3 * p1 - m1;
    ct3 = 2 * p0 + m0  - 2 * p1 + m1;

    return ct3 * t3 + ct2 * t2 + ct1 * t + ct0;
}

#endif /* AVFILTER_HERMITE_H */


text:
qe::core::Component::Component()
    : quark_object_(nullptr)
{

}

qe::core::Component::~Component()
{
}


text:
scikit-video
============

Video Processing SciKit *BETA*

Video processing algorithms, including I/O, quality metrics, temporal filtering, motion/object detection, motion estimation...

This is intended as a companion to scikit-image, containing all the algorithms which deal with *video*.  There is a certain degree of overlap between image and video algorithms, for example a PSNR quality metric could be applied to pairs of images or pairs of video frames just as well.  However, other algorithms are video-specific, for example a temporal denoise.  This is the future home of the video-specific algorithms, as well as some of the algorithms which are not strictly video specific but are usually seen in a video context.

This also has some overlap with OpenCV.  Roughly, the algorithms implemented here would be easier to hack on, and more research-oriented.  Rather than building on top of a C/C++ framework, this will stay Python all the way, using whichever combinaiton of Numba/Theano/etc seems best for performance.  This should add flexibility and better future ability to use GPU compute.

The project milestones are roughly:

- Add skeleton project from scikit-example - DONE
- Add video I/O by wrapping ffmpeg/avconv (similar to kanryu/pipeffmpeg) - DONE
- Add video metrics (from aizvorski/video-quality) - DONE
- More contributions roll in :)


text:
package org.apache.parquet.schema;

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

import org.apache.parquet.Preconditions;
import org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName;
import org.apache.parquet.schema.Type.ID;

/**
 * This class provides fluent builders that produce Parquet schema Types.
 *

 * The most basic use is to build primitive types:
 *

 *   Types.required(INT64).named("id");
 *   Types.optional(INT32).named("number");
 *

 *

 * The {@link #required(PrimitiveTypeName)} factory method produces a primitive
 * type builder, and the {@link PrimitiveBuilder#named(String)} builds the
 * {@link PrimitiveType}. Between {@code required} and {@code named}, other
 * builder methods can be used to add type annotations or other type metadata:
 *

 *   Types.required(BINARY).as(UTF8).named("username");
 *   Types.optional(FIXED_LEN_BYTE_ARRAY).length(20).named("sha1");
 *

 *

 * Optional types are built using {@link #optional(PrimitiveTypeName)} to get
 * the builder.
 *

 * Groups are built similarly, using {@code requiredGroup()} (or the optional
 * version) to return a group builder. Group builders provide {@code required}
 * and {@code optional} to add primitive types, which return primitive builders
 * like the versions above.
 *

 *   // This produces:
 *   // required group User {
 *   //   required int64 id;
 *   //   optional binary email (UTF8);
 *   // }
 *   Types.requiredGroup()
 *            .required(INT64).named("id")
 *            .required(BINARY).as(UTF8).named("email")
 *        .named("User")
 *

 *

 * When {@code required} is called on a group builder, the builder it returns
 * will add the type to the parent group when it is built and {@code named} will
 * return its parent group builder (instead of the type) so more fields can be
 * added.
 *

 * Sub-groups can be created using {@code requiredGroup()} to get a group
 * builder that will create the group type, add it to the parent builder, and
 * return the parent builder for more fields.
 *

 *   // required group User {
 *   //   required int64 id;
 *   //   optional binary email (UTF8);
 *   //   optional group address {
 *   //     required binary street (UTF8);
 *   //     required int32 zipcode;
 *   //   }
 *   // }
 *   Types.requiredGroup()
 *            .required(INT64).named("id")
 *            .required(BINARY).as(UTF8).named("email")
 *            .optionalGroup()
 *                .required(BINARY).as(UTF8).named("street")
 *                .required(INT32).named("zipcode")
 *            .named("address")
 *        .named("User")
 *

 *

 * Message types are built using {@link #buildMessage()} and function just like
 * group builders.
 *

 *   // message User {
 *   //   required int64 id;
 *   //   optional binary email (UTF8);
 *   //   optional group address {
 *   //     required binary street (UTF8);
 *   //     required int32 zipcode;
 *   //   }
 *   // }
 *   Types.buildMessage()
 *            .required(INT64).named("id")
 *            .required(BINARY).as(UTF8).named("email")
 *            .optionalGroup()
 *                .required(BINARY).as(UTF8).named("street")
 *                .required(INT32).named("zipcode")
 *            .named("address")
 *        .named("User")
 *

 *

 * These builders enforce consistency checks based on the specifications in
 * the parquet-format documentation. For example, if DECIMAL is used to annotate
 * a FIXED_LEN_BYTE_ARRAY that is not long enough for its maximum precision,
 * these builders will throw an IllegalArgumentException:
 *

 *   // throws IllegalArgumentException with message:
 *   // "FIXED(4) is not long enough to store 10 digits"
 *   Types.required(FIXED_LEN_BYTE_ARRAY).length(4)
 *        .as(DECIMAL).precision(10)
 *        .named("badDecimal");
 *

 */
public class Types {
  private static final int NOT_SET = 0;

  /**
   * A base builder for {@link Type} objects.
   *
   * @param
 The type that this builder will return from
   *          {@link #named(String)} when the type is built.
   */
  public abstract static class Builder<T extends Builder, P> {
    protected final P parent;
    protected final Class<? extends P> returnClass;

    protected Type.Repetition repetition = null;
    protected OriginalType originalType = null;
    protected Type.ID id = null;
    private boolean repetitionAlreadySet = false;

    /**
     * Construct a type builder that returns a "parent" object when the builder
     * is finished. The {@code parent} will be returned by
     * {@link #named(String)} so that builders can be chained.
     *
     * @param parent a non-null object to return from {@link #named(String)}
     */
    protected Builder(P parent) {
      Preconditions.checkNotNull(parent, "Parent cannot be null");
      this.parent = parent;
      this.returnClass = null;
    }

    /**
     * Construct a type builder that returns the {@link Type} that was built
     * when the builder is finished. The {@code returnClass} must be the
     * expected {@code Type} class.
     *
     * @param returnClass a {@code Type} to return from {@link #named(String)}
     */
    protected Builder(Class
 returnClass) {
      Preconditions.checkArgument(Type.class.isAssignableFrom(returnClass),
          "The requested return class must extend Type");
      this.returnClass = returnClass;
      this.parent = null;
    }

    protected abstract T self();

    protected final T repetition(Type.Repetition repetition) {
      Preconditions.checkArgument(!repetitionAlreadySet,
          "Repetition has already been set");
      Preconditions.checkNotNull(repetition, "Repetition cannot be null");
      this.repetition = repetition;
      this.repetitionAlreadySet = true;
      return self();
    }

    /**
     * Adds a type annotation ({@link OriginalType}) to the type being built.
     *

     * Type annotations are used to extend the types that parquet can store, by
     * specifying how the primitive types should be interpreted. This keeps the
     * set of primitive types to a minimum and reuses parquet's efficient
     * encodings. For example, strings are stored as byte arrays (binary) with
     * a UTF8 annotation.
     *
     * @param type an {@code OriginalType}
     * @return this builder for method chaining
     */
    public T as(OriginalType type) {
      this.originalType = type;
      return self();
    }

    /**
     * adds an id annotation to the type being built.
     *

     * ids are used to capture the original id when converting from models using ids (thrift, protobufs)
     *
     * @param id the id of the field
     * @return this builder for method chaining
     */
    public T id(int id) {
      this.id = new ID(id);
      return self();
    }

    abstract protected Type build(String name);

    /**
     * Builds a {@link Type} and returns the parent builder, if given, or the
     * {@code Type} that was built. If returning a parent object that is a
     * GroupBuilder, the constructed type will be added to it as a field.
     *

     * Note: Any configuration for this type builder should be done
     * before calling this method.
     *
     * @param name a name for the constructed type
     * @return the parent {@code GroupBuilder} or the constructed {@code Type}
     */
    public P named(String name) {
      Preconditions.checkNotNull(name, "Name is required");
      Preconditions.checkNotNull(repetition, "Repetition is required");

      Type type = build(name);
      if (parent != null) {
        // if the parent is a GroupBuilder, add type to it
        if (GroupBuilder.class.isAssignableFrom(parent.getClass())) {
          GroupBuilder.class.cast(parent).addField(type);
        }
        return parent;
      } else {
        // no parent indicates that the Type object should be returned
        // the constructor check guarantees that returnClass is a Type
        return returnClass.cast(type);
      }
    }

  }

  /**
   * A builder for {@link PrimitiveType} objects.
   *
   * @param
 The type that this builder will return from
   *          {@link #named(String)} when the type is built.
   */
  public static class PrimitiveBuilder
 extends Builder<PrimitiveBuilder
, P> {
    private static final long MAX_PRECISION_INT32 = maxPrecision(4);
    private static final long MAX_PRECISION_INT64 = maxPrecision(8);
    private final PrimitiveTypeName primitiveType;
    private int length = NOT_SET;
    private int precision = NOT_SET;
    private int scale = NOT_SET;

    private PrimitiveBuilder(P parent, PrimitiveTypeName type) {
      super(parent);
      this.primitiveType = type;
    }

    private PrimitiveBuilder(Class
 returnType, PrimitiveTypeName type) {
      super(returnType);
      this.primitiveType = type;
    }

    @Override
    protected PrimitiveBuilder
 self() {
      return this;
    }

    /**
     * Adds the length for a FIXED_LEN_BYTE_ARRAY.
     *
     * @param length an int length
     * @return this builder for method chaining
     */
    public PrimitiveBuilder
 length(int length) {
      this.length = length;
      return this;
    }

    /**
     * Adds the precision for a DECIMAL.
     *

     * This value is required for decimals and must be less than or equal to
     * the maximum number of base-10 digits in the underlying type. A 4-byte
     * fixed, for example, can store up to 9 base-10 digits.
     *
     * @param precision an int precision value for the DECIMAL
     * @return this builder for method chaining
     */
    public PrimitiveBuilder
 precision(int precision) {
      this.precision = precision;
      return this;
    }

    /**
     * Adds the scale for a DECIMAL.
     *

     * This value must be less than the maximum precision of the type and must
     * be a positive number. If not set, the default scale is 0.
     *

     * The scale specifies the number of digits of the underlying unscaled
     * that are to the right of the decimal point. The decimal interpretation
     * of values in this column is: {@code value*10^(-scale)}.
     *
     * @param scale an int scale value for the DECIMAL
     * @return this builder for method chaining
     */
    public PrimitiveBuilder
 scale(int scale) {
      this.scale = scale;
      return this;
    }

    @Override
    protected PrimitiveType build(String name) {
      if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitiveType) {
        Preconditions.checkArgument(length > 0,
            "Invalid FIXED_LEN_BYTE_ARRAY length: " + length);
      }

      DecimalMetadata meta = decimalMetadata();

      // validate type annotations and required metadata
      if (originalType != null) {
        switch (originalType) {
          case UTF8:
          case JSON:
          case BSON:
            Preconditions.checkState(
                primitiveType == PrimitiveTypeName.BINARY,
                originalType.toString() + " can only annotate binary fields");
            break;
          case DECIMAL:
            Preconditions.checkState(
                (primitiveType == PrimitiveTypeName.INT32) ||
                (primitiveType == PrimitiveTypeName.INT64) ||
                (primitiveType == PrimitiveTypeName.BINARY) ||
                (primitiveType == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY),
                "DECIMAL can only annotate INT32, INT64, BINARY, and FIXED"
            );
            if (primitiveType == PrimitiveTypeName.INT32) {
              Preconditions.checkState(
                  meta.getPrecision() <= MAX_PRECISION_INT32,
                  "INT32 cannot store " + meta.getPrecision() + " digits " +
                      "(max " + MAX_PRECISION_INT32 + ")");
            } else if (primitiveType == PrimitiveTypeName.INT64) {
              Preconditions.checkState(
                  meta.getPrecision() <= MAX_PRECISION_INT64,
                  "INT64 cannot store " + meta.getPrecision() + " digits " +
                  "(max " + MAX_PRECISION_INT64 + ")");
            } else if (primitiveType == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
              Preconditions.checkState(
                  meta.getPrecision() <= maxPrecision(length),
                  "FIXED(" + length + ") cannot store " + meta.getPrecision() +
                  " digits (max " + maxPrecision(length) + ")");
            }
            break;
          case DATE:
          case TIME_MILLIS:
          case UINT_8:
          case UINT_16:
          case UINT_32:
          case INT_8:
          case INT_16:
          case INT_32:
            Preconditions.checkState(primitiveType == PrimitiveTypeName.INT32,
                originalType.toString() + " can only annotate INT32");
            break;
          case TIMESTAMP_MILLIS:
          case UINT_64:
          case INT_64:
            Preconditions.checkState(primitiveType == PrimitiveTypeName.INT64,
                originalType.toString() + " can only annotate INT64");
            break;
          case INTERVAL:
            Preconditions.checkState(
                (primitiveType == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) &&
                (length == 12),
                "INTERVAL can only annotate FIXED_LEN_BYTE_ARRAY(12)");
            break;
          case ENUM:
            Preconditions.checkState(
                primitiveType == PrimitiveTypeName.BINARY,
                "ENUM can only annotate binary fields");
            break;
          default:
            throw new IllegalStateException(originalType + " can not be applied to a primitive type");
        }
      }

      return new PrimitiveType(repetition, primitiveType, length, name, originalType, meta, id);
    }

    private static long maxPrecision(int numBytes) {
      return Math.round(                      // convert double to long
          Math.floor(Math.log10(              // number of base-10 digits
              Math.pow(2, 8 * numBytes - 1) - 1)  // max value stored in numBytes
          )
      );
    }

    protected DecimalMetadata decimalMetadata() {
      DecimalMetadata meta = null;
      if (OriginalType.DECIMAL == originalType) {
        Preconditions.checkArgument(precision > 0,
            "Invalid DECIMAL precision: " + precision);
        Preconditions.checkArgument(scale >= 0,
            "Invalid DECIMAL scale: " + scale);
        Preconditions.checkArgument(scale <= precision,
            "Invalid DECIMAL scale: cannot be greater than precision");
        meta = new DecimalMetadata(precision, scale);
      }
      return meta;
    }
  }

  /**
   * A builder for {@link GroupType} objects.
   *
   * @param
 The type that this builder will return from
   *          {@link #named(String)} when the type is built.
   */
  public static class GroupBuilder
 extends Builder<GroupBuilder
, P> {
    protected final List<Type> fields;

    private GroupBuilder(P parent) {
      super(parent);
      this.fields = new ArrayList<Type>();
    }

    private GroupBuilder(Class
 returnType) {
      super(returnType);
      this.fields = new ArrayList<Type>();
    }

    @Override
    protected GroupBuilder
 self() {
      return this;
    }

    public PrimitiveBuilder<GroupBuilder
> primitive(
        PrimitiveTypeName type, Type.Repetition repetition) {
      return new PrimitiveBuilder<GroupBuilder
>(this, type)
          .repetition(repetition);
    }

    /**
     * Returns a {@link PrimitiveBuilder} for the required primitive type
     * {@code type}.
     *
     * @param type a {@link PrimitiveTypeName}
     * @return a primitive builder for {@code type} that will return this
     *          builder for additional fields.
     */
    public PrimitiveBuilder<GroupBuilder
> required(
        PrimitiveTypeName type) {
      return new PrimitiveBuilder<GroupBuilder
>(this, type)
          .repetition(Type.Repetition.REQUIRED);
    }

    /**
     * Returns a {@link PrimitiveBuilder} for the optional primitive type
     * {@code type}.
     *
     * @param type a {@link PrimitiveTypeName}
     * @return a primitive builder for {@code type} that will return this
     *          builder for additional fields.
     */
    public PrimitiveBuilder<GroupBuilder
> optional(
        PrimitiveTypeName type) {
      return new PrimitiveBuilder<GroupBuilder
>(this, type)
          .repetition(Type.Repetition.OPTIONAL);
    }

    /**
     * Returns a {@link PrimitiveBuilder} for the repeated primitive type
     * {@code type}.
     *
     * @param type a {@link PrimitiveTypeName}
     * @return a primitive builder for {@code type} that will return this
     *          builder for additional fields.
     */
    public PrimitiveBuilder<GroupBuilder
> repeated(
        PrimitiveTypeName type) {
      return new PrimitiveBuilder<GroupBuilder
>(this, type)
          .repetition(Type.Repetition.REPEATED);
    }

    public GroupBuilder<GroupBuilder
> group(Type.Repetition repetition) {
      return new GroupBuilder<GroupBuilder
>(this)
          .repetition(repetition);
    }

    /**
     * Returns a {@link GroupBuilder} to build a required sub-group.
     *
     * @return a group builder that will return this builder for additional
     *          fields.
     */
    public GroupBuilder<GroupBuilder
> requiredGroup() {
      return new GroupBuilder<GroupBuilder
>(this)
          .repetition(Type.Repetition.REQUIRED);
    }

    /**
     * Returns a {@link GroupBuilder} to build an optional sub-group.
     *
     * @return a group builder that will return this builder for additional
     *          fields.
     */
    public GroupBuilder<GroupBuilder
> optionalGroup() {
      return new GroupBuilder<GroupBuilder
>(this)
          .repetition(Type.Repetition.OPTIONAL);
    }

    /**
     * Returns a {@link GroupBuilder} to build a repeated sub-group.
     *
     * @return a group builder that will return this builder for additional
     *          fields.
     */
    public GroupBuilder<GroupBuilder
> repeatedGroup() {
      return new GroupBuilder<GroupBuilder
>(this)
          .repetition(Type.Repetition.REPEATED);
    }

    /**
     * Adds {@code type} as a sub-field to the group configured by this builder.
     *
     * @return this builder for additional fields.
     */
    public GroupBuilder
 addField(Type type) {
      fields.add(type);
      return this;
    }

    /**
     * Adds {@code types} as sub-fields of the group configured by this builder.
     *
     * @return this builder for additional fields.
     */
    public GroupBuilder
 addFields(Type... types) {
      for (Type type : types) {
        fields.add(type);
      }
      return this;
    }

    @Override
    protected GroupType build(String name) {
      Preconditions.checkState(!fields.isEmpty(),
          "Cannot build an empty group");
      return new GroupType(repetition, name, originalType, fields, id);
    }
  }

  public static class MessageTypeBuilder extends GroupBuilder<MessageType> {
    private MessageTypeBuilder() {
      super(MessageType.class);
      repetition(Type.Repetition.REQUIRED);
    }

    /**
     * Builds and returns the {@link MessageType} configured by this builder.
     *

     * Note: All primitive types and sub-groups should be added before
     * calling this method.
     *
     * @param name a name for the constructed type
     * @return the final {@code MessageType} configured by this builder.
     */
    @Override
    public MessageType named(String name) {
      Preconditions.checkNotNull(name, "Name is required");
      return new MessageType(name, fields);
    }
  }

  /**
   * Returns a builder to construct a {@link MessageType}.
   *
   * @return a {@link MessageTypeBuilder}
   */
  public static MessageTypeBuilder buildMessage() {
    return new MessageTypeBuilder();
  }

  public static GroupBuilder<GroupType> buildGroup(
      Type.Repetition repetition) {
    return new GroupBuilder<GroupType>(GroupType.class).repetition(repetition);
  }

  /**
   * Returns a builder to construct a required {@link GroupType}.
   *
   * @return a {@link GroupBuilder}
   */
  public static GroupBuilder<GroupType> requiredGroup() {
    return new GroupBuilder<GroupType>(GroupType.class)
        .repetition(Type.Repetition.REQUIRED);
  }

  /**
   * Returns a builder to construct an optional {@link GroupType}.
   *
   * @return a {@link GroupBuilder}
   */
  public static GroupBuilder<GroupType> optionalGroup() {
    return new GroupBuilder<GroupType>(GroupType.class)
        .repetition(Type.Repetition.OPTIONAL);
  }

  /**
   * Returns a builder to construct a repeated {@link GroupType}.
   *
   * @return a {@link GroupBuilder}
   */
  public static GroupBuilder<GroupType> repeatedGroup() {
    return new GroupBuilder<GroupType>(GroupType.class)
        .repetition(Type.Repetition.REPEATED);
  }

  public static PrimitiveBuilder<PrimitiveType> primitive(
      PrimitiveTypeName type, Type.Repetition repetition) {
    return new PrimitiveBuilder<PrimitiveType>(PrimitiveType.class, type)
        .repetition(repetition);
  }

  /**
   * Returns a builder to construct a required {@link PrimitiveType}.
   *
   * @param type a {@link PrimitiveTypeName} for the constructed type
   * @return a {@link PrimitiveBuilder}
   */
  public static PrimitiveBuilder<PrimitiveType> required(
      PrimitiveTypeName type) {
    return new PrimitiveBuilder<PrimitiveType>(PrimitiveType.class, type)
        .repetition(Type.Repetition.REQUIRED);
  }

  /**
   * Returns a builder to construct an optional {@link PrimitiveType}.
   *
   * @param type a {@link PrimitiveTypeName} for the constructed type
   * @return a {@link PrimitiveBuilder}
   */
  public static PrimitiveBuilder<PrimitiveType> optional(
      PrimitiveTypeName type) {
    return new PrimitiveBuilder<PrimitiveType>(PrimitiveType.class, type)
        .repetition(Type.Repetition.OPTIONAL);
  }

  /**
   * Returns a builder to construct a repeated {@link PrimitiveType}.
   *
   * @param type a {@link PrimitiveTypeName} for the constructed type
   * @return a {@link PrimitiveBuilder}
   */
  public static PrimitiveBuilder<PrimitiveType> repeated(
      PrimitiveTypeName type) {
    return new PrimitiveBuilder<PrimitiveType>(PrimitiveType.class, type)
        .repetition(Type.Repetition.REPEATED);
  }

}


text:
declare module "cuid" {
  declare type cuid = {
    slug: () => string,
    fingerprint: () => string
  } & (() => string);

  declare module.exports: cuid;
}


text:
package com.sdw.soft.test;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;

@ActiveProfiles("mysql")
@ContextConfiguration(locations = {"classpath*:/context/spring-*.xml"})
public class SpringTestCase extends AbstractTransactionalJUnit4SpringContextTests {
	protected final Logger logger = LoggerFactory.getLogger(this.getClass());

	protected DataSource dataSource;

	@PersistenceContext
	protected EntityManager entityManager;

	@Override
	@Autowired
	public void setDataSource(DataSource dataSource) {
		super.setDataSource(dataSource);
		this.dataSource = dataSource;
	}
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>T880565936687693825</title>
  <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
  <link rel="stylesheet" href="/style.css">
  <link rel="stylesheet" href="/custom.css">

	<link rel="shortcut icon" href="https://micro.blog/joeduvall4/favicon.png" type="image/x-icon" />
  <link rel="alternate" type="application/rss+xml" title="Joe Duvall" href="http://micro.blog.joe.duvall.me/feed.xml" />
  <link rel="alternate" type="application/json" title="Joe Duvall" href="http://micro.blog.joe.duvall.me/feed.json" />
  <link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" />

  <link rel="me" href="https://micro.blog/joeduvall4" />

  <link rel="authorization_endpoint" href="https://indieauth.com/auth" />
  <link rel="token_endpoint" href="https://tokens.indieauth.com/token" />
  <link rel="micropub" href="https://micro.blog/micropub" />
  <link rel="webmention" href="https://micro.blog/webmention" />
  <link rel="subscribe" href="https://micro.blog/users/follow" />

    Joe Duvall

    <time class="dt-published" datetime="2017-06-29 16:17:34 -0700">29 Jun 2017</time>

"The iPhone changed the world. There is no way to overstate it." —Daring Fireball

Happy 10th, iPhone! 🎊


text:
module SwitchProxy
  class Cli < Thor

    option :on, :type => :boolean
    desc "turn", "toggle console proxy on/off, default (no option) is off"
    def turn
      if options[:on]
        ProxySetter.new.add_proxy
        puts set_color "proxy on", :black, :on_white
      else
        ProxySetter.new.remove_proxy
        puts set_color "proxy off", :red, :on_white
      end
    end

    desc "edit", "edit configurations. toggle on/off is required"
    def edit
      SwitchProxy.configure { |config| }
      system("#{SwitchProxy.configuration.editor} #{ENV['HOME']}/.switch_proxy")
    end
  end
end


text:
package com.github.tangr1.lego.auth.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.acls.AclPermissionEvaluator;
import org.springframework.security.acls.domain.*;
import org.springframework.security.acls.jdbc.BasicLookupStrategy;
import org.springframework.security.acls.jdbc.JdbcAclService;
import org.springframework.security.acls.jdbc.JdbcMutableAclService;
import org.springframework.security.acls.jdbc.LookupStrategy;
import org.springframework.security.acls.model.*;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.sql.DataSource;

@Configuration
@EnableWebMvc
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {

    private static final Logger logger = LoggerFactory.getLogger(WebMvcConfiguration.class);

    @Autowired
    private DataSource dataSource;
    @Autowired
    private RedisConnectionFactory redisConnectionFactory;

    @Bean
    public TokenStore tokenStore() {
        return new RedisTokenStore(redisConnectionFactory);
    }

    @Bean
    public AclService aclService() {
        return new JdbcAclService(dataSource, lookupStrategy());
    }

    @Bean
    public MutableAclService mutableAclService() {
        JdbcMutableAclService jdbcMutableAclService = new JdbcMutableAclService(dataSource, lookupStrategy(), aclCache());
        jdbcMutableAclService.setClassIdentityQuery("SELECT @@IDENTITY");
        jdbcMutableAclService.setSidIdentityQuery("SELECT @@IDENTITY");
        return jdbcMutableAclService;
    }

    @Bean
    public LookupStrategy lookupStrategy() {
        return new BasicLookupStrategy(dataSource, aclCache(), aclAuthorizationStrategy(), auditLogger());
    }

    @Bean
    public AclCache aclCache() {
        return new SpringCacheBasedAclCache(cache(), permissionGrantingStrategy(), aclAuthorizationStrategy());
    }

    @Bean
    public Cache cache() {
        return new ConcurrentMapCache("acl");
    }

    @Bean
    public PermissionGrantingStrategy permissionGrantingStrategy() {
        return new DefaultPermissionGrantingStrategy(auditLogger());
    }

    @Bean
    public AclAuthorizationStrategy aclAuthorizationStrategy() {
        return new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_ADMIN"));
    }

    @Bean
    public AuditLogger auditLogger() {
        return (boolean granted, AccessControlEntry ace) -> System.out.println(granted + " " + ace);
    }

    @Bean
    public PermissionEvaluator permissionEvaluator() {
        return new AclPermissionEvaluator(aclService());
    }
}


text:
<ion-tabs>
    <ion-tab-bar color="primary" slot="bottom">
        <ion-tab-button tab="general">
            <ion-icon name="cog"></ion-icon>
            <ion-label>General</ion-label>
        </ion-tab-button>

        <ion-tab-button tab="security">
            <ion-icon name="lock"></ion-icon>
            <ion-label>Security</ion-label>
        </ion-tab-button>
    </ion-tab-bar>
</ion-tabs>


text:
namespace zipkin4net.Annotation
{
    public sealed class ServerRecv : IAnnotation
    {
        internal ServerRecv()
        {
        }

        public override string ToString()
        {
            return GetType().Name;
        }

        public void Accept(IAnnotationVisitor visitor)
        {
            visitor.Visit(this);
        }
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.contentwarehouse.v1.model;

/**
 * LINT.IfChange(ArgPath) Given a FunctionCall and an Argument somewhere in it, an ArgPath is a list
 * of name-index pairs that uniquely determines the path down to that Argument. For each pair, the
 * |index|, starting from zero, distinguishes between "sibling" (i.e. belonging to the same sub-
 * FunctionCall) Arguments with the same name. For example, given the following FunctionCall:
 * A(X=D(W=5), Z=B(Z=6), Z=C(Y=7)) The path to the Z=6 argument is {{"Z", 0}, {"Z", 0}} It's the
 * first of two Z "siblings" under A, then the only Z under B. The path to the Y=7 argument is
 * {{"Z", 1}, {"Y", 0}} It's the second of two Z "siblings" under A, then the only Y under C. The
 * path to the Z=B(...) argument is {{"Z", 0}} It's the first of two Z "siblings" under A.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the contentwarehouse API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class KnowledgeAnswersIntentQueryArgPathComponent extends com.google.api.client.json.GenericJson {

  /**
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String argName;

  /**
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer index;

  /**
   * @return value or {@code null} for none
   */
  public java.lang.String getArgName() {
    return argName;
  }

  /**
   * @param argName argName or {@code null} for none
   */
  public KnowledgeAnswersIntentQueryArgPathComponent setArgName(java.lang.String argName) {
    this.argName = argName;
    return this;
  }

  /**
   * @return value or {@code null} for none
   */
  public java.lang.Integer getIndex() {
    return index;
  }

  /**
   * @param index index or {@code null} for none
   */
  public KnowledgeAnswersIntentQueryArgPathComponent setIndex(java.lang.Integer index) {
    this.index = index;
    return this;
  }

  @Override
  public KnowledgeAnswersIntentQueryArgPathComponent set(String fieldName, Object value) {
    return (KnowledgeAnswersIntentQueryArgPathComponent) super.set(fieldName, value);
  }

  @Override
  public KnowledgeAnswersIntentQueryArgPathComponent clone() {
    return (KnowledgeAnswersIntentQueryArgPathComponent) super.clone();
  }

}


text:
/**
 *
 */
package com.forgedui.model.titanium.ios;

import com.forgedui.model.titanium.TitaniumUIElement;
import com.forgedui.model.titanium.annotations.SupportedPlatform;

/**
 * @AutoGenerated
 */
@SupportedPlatform(platforms = { "iphone", "ipad" })
public class AdView extends TitaniumUIElement {

	protected String getObjectName() {
		return "Titanium.UI.iOS.AdView";
	}

}