text:
<?php

namespace RiakClientTest\Core\Transport\Proto;

use RiakClientTest\TestCase;
use Riak\Client\ProtoBuf\RpbListKeysResp;

class ProtoStreamIteratorIteratorTest extends TestCase
{
    /**
     * @var \Riak\Client\Core\Transport\Proto\ProtoStreamIterator
     */
    private $iterator;

    /**
     * @var \Riak\Client\Core\Transport\Proto\ProtoStreamIteratorIterator
     */
    private $instance;

    protected function setUp()
    {
        parent::setUp();

        $this->iterator = $this->getMock('Riak\Client\Core\Transport\Proto\ProtoStreamIterator', [], [], '', false);
        $this->instance = $this->getMockForAbstractClass('Riak\Client\Core\Transport\Proto\ProtoStreamIteratorIterator', [$this->iterator]);
    }

    public function testIsDone()
    {
        $message = new RpbListKeysResp();

        $this->assertFalse($this->invokeMethod($this->instance, 'isDone'));

        $message->done = false;
        $this->setPropertyValue($this->instance, 'message', $message);

        $this->assertFalse($this->invokeMethod($this->instance, 'isDone'));

        $message->done = true;
        $this->setPropertyValue($this->instance, 'message', $message);

        $this->assertTrue($this->invokeMethod($this->instance, 'isDone'));
    }

    public function testReadNextWhenIsNotDone()
    {
        if (defined('HHVM_VERSION')) {
            $this->markTestSkipped('HHVM Fail to invoke readNext( WTF !!).');
        }

        $message = new RpbListKeysResp();

        $this->iterator->expects($this->once())
            ->method('current')
            ->willReturn($message);

        $this->instance->expects($this->once())
            ->method('extract')
            ->willReturn('value')
            ->with($this->equalTo($message));

        $this->assertEquals('value', $this->invokeMethod($this->instance, 'readNext'));
    }

    public function testReadNextWhenIsDone()
    {
        $message = new RpbListKeysResp();

        $message->done = true;
        $this->setPropertyValue($this->instance, 'message', $message);

        $this->assertNull($this->invokeMethod($this->instance, 'readNext'));
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace swift {

/// A utility to correct the nesting of stack allocating/deallocating
/// instructions.
///
/// This utility is useful for optimizations which create stack allocations
/// without caring about correct nesting with existing allocations. This may
/// result in code like
/// \code
///   %1 = alloc_stack
///     ...
///   %2 = alloc_stack
///     ...
///   dealloc_stack %1
///     ...
///   dealloc_stack %2
/// \endcode
///
/// The StackNesting utility is able to correct the code:
/// \code
///   %1 = alloc_stack
///     ...
///   %2 = alloc_stack
///     ...
///   dealloc_stack %2
///   dealloc_stack %1
/// \endcode
///
class StackNesting {

  typedef SmallBitVector BitVector;

  /// Data stored for each block (actually for each block which is not dead).
  struct BlockInfo {

    /// Back-link to the block.
    SILBasicBlock *Block;

    /// The cached list of successors.
    llvm::SmallVector<BlockInfo *, 8> Successors;

    /// The list of stack allocating/deallocating instructions in the block.
    llvm::SmallVector<SILInstruction *, 8> StackInsts;

    /// The bit-set of alive stack locations at the block entry.
    BitVector AliveStackLocsAtEntry;

    /// The bit-set of alive stack locations at the block exit.
    BitVector AliveStackLocsAtExit;

    BlockInfo(SILBasicBlock *Block) : Block(Block) { }
  };

  /// Data stored for each stack location (= allocation).
  ///
  /// Each stack location is allocated by a single allocation instruction.
  struct StackLoc {
    StackLoc(SingleValueInstruction *Alloc) : Alloc(Alloc) { }

    /// Back-link to the allocation instruction.
    SingleValueInstruction *Alloc;

    /// Bit-set which represents all alive locations at this allocation.
    /// It obviously includes this location itself. And it includes all "outer"
    /// locations which surround this location.
    BitVector AliveLocs;
  };

  /// Mapping from stack allocations (= locations) to bit numbers.
  llvm::DenseMap<SingleValueInstruction *, unsigned> StackLoc2BitNumbers;

  /// The list of stack locations. The index into this array is also the bit
  /// number in the bit-sets.
  llvm::SmallVector<StackLoc, 8> StackLocs;

  /// Block data for all (non-dead) blocks.
  std::vector<BlockInfo> BlockInfos;

public:

  /// The possible return values of correctStackNesting().
  enum class Changes {
    /// No changes are made.
    None,

    /// Only instructions were inserted or deleted.
    Instructions,

    /// Instructions were inserted or deleted and new blocks were inserted.
    CFG
  };

  StackNesting() { }

  /// Performs correction of stack nesting by moving stack-deallocation
  /// instructions down the control flow.
  ///
  /// Returns the status of what changes were made.
  Changes correctStackNesting(SILFunction *F);

  /// For debug dumping.
  void dump() const;

  static void dumpBits(const BitVector &Bits);

private:
  /// Initializes the data structures.
  void setup(SILFunction *F);

  /// Solves the dataflow problem.
  ///
  /// Returns true if there is a nesting of locations in any way, which can
  /// potentially in the wrong order.
  bool solve();

  /// Insert deallocation instructions for all locations which are alive before
  /// the InsertionPoint (AliveBefore) but not alive after the InsertionPoint
  /// (AliveAfter).
  ///
  /// Returns true if any deallocations were inserted.
  bool insertDeallocs(const BitVector &AliveBefore, const BitVector &AliveAfter,
                      SILInstruction *InsertionPoint,
                      Optional<SILLocation> Location);

  /// Reeturns the location bit number for a stack allocation instruction.
  int bitNumberForAlloc(SILInstruction *AllocInst) {
    assert(AllocInst->isAllocatingStack());
    return StackLoc2BitNumbers[cast<SingleValueInstruction>(AllocInst)];
  }

  /// Reeturns the location bit number for a stack deallocation instruction.
  int bitNumberForDealloc(SILInstruction *DeallocInst) {
    assert(DeallocInst->isDeallocatingStack());
    auto *AllocInst = cast<SingleValueInstruction>(DeallocInst->getOperand(0));
    return bitNumberForAlloc(AllocInst);
  }

  /// Insert deallocations at block boundaries.
  Changes insertDeallocsAtBlockBoundaries();

  /// Modifies the SIL to end up with a correct stack nesting.
  ///
  /// Returns the status of what changes were made.
  bool adaptDeallocs();
};

} // end namespace swift

#endif // SWIFT_SILOPTIMIZER_UTILS_STACKNESTING_H


text:
CenterMarket
============

this is nanjing  CenterMarket's App


text:
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __DETECTOR_H__
#define __DETECTOR_H__

#include <zxing/common/Counted.h>
#include <zxing/common/DetectorResult.h>
#include <zxing/common/BitMatrix.h>
#include <zxing/qrcode/detector/AlignmentPattern.h>
#include <zxing/common/PerspectiveTransform.h>
#include <zxing/ResultPointCallback.h>
#include <zxing/qrcode/detector/FinderPatternInfo.h>

namespace zxing {

class DecodeHints;

namespace qrcode {

class Detector : public Counted {
private:
  Ref<BitMatrix> image_;
  Ref<ResultPointCallback> callback_;

protected:
  Ref<BitMatrix> getImage() const;
  Ref<ResultPointCallback> getResultPointCallback() const;

  static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);
  static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
                              float moduleSize);
  float calculateModuleSize(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft);
  float calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPoint> otherPattern);
  float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY);
  float sizeOfBlackWhiteBlackRun(int fromX, int fromY, int toX, int toY);
  Ref<AlignmentPattern> findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY,
      float allowanceFactor);
  Ref<DetectorResult> processFinderPatternInfo(Ref<FinderPatternInfo> info);
public:
  virtual Ref<PerspectiveTransform> createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <
      ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension);

  Detector(Ref<BitMatrix> image);
  Ref<DetectorResult> detect(DecodeHints const& hints);

};
}
}

#endif // __DETECTOR_H__


text:
using System.Threading;
using System.Threading.Tasks;
using CompaniesHouse.Response.Insolvency;

namespace CompaniesHouse
{
    public interface ICompaniesHouseCompanyInsolvencyInformationClient
    {
        Task<CompaniesHouseClientResponse<CompanyInsolvencyInformation>> GetCompanyInsolvencyInformationAsync(string companyNumber, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
using System;
using Zombus.Configuration.Settings;

namespace Zombus.LargeMessages.Azure.Configuration.Settings
{
    public class AzureBlobStorageContainerUriSetting : Setting<Uri> { }
}


text:
Submitted writeup for the SEED packet sniffing challenge is in 'full-writeup.pdf'. You can find images for the writeups and the source code in the `imgs` and `src` folder.

There's also an extensive writeup of part 1 in `part-1-writeup.md`.

This will be the last commit.


text:
package org.guernsey.internal;

import com.lexicalscope.fluentreflection.FluentMethod;
import org.guernsey.GuernseyServlet;
import org.guernsey.annotation.GET;
import org.guernsey.annotation.Path;

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

import static com.lexicalscope.fluentreflection.FluentReflection.object;
import static com.lexicalscope.fluentreflection.ReflectionMatchers.annotatedWith;

public class RestMethodFactory {

    private String basePath;
    private Map<String, RestMethod> getMethods;

    public <T extends GuernseyServlet> RestMethodFactory(T servlet) {
        this.basePath = PathUtils.getPath(object(servlet).annotation(Path.class));
        this.getMethods = initGetMethods(servlet, this.basePath);
    }

    public Map<String, RestMethod> getGETMethods() {
        return getMethods;
    }

    static Map<String, RestMethod> initGetMethods(Object object, String basePath) {
        Map<String, RestMethod> methods = new HashMap<String, RestMethod>();
        for (FluentMethod method : object(object).methods(annotatedWith(GET.class))) {
            RestMethod restMethod = new RestMethod(basePath, method);
            methods.put(restMethod.getPath(), restMethod);
        }
        return methods;
    }

}


text:
using System;
using System.Net;

namespace System.Net
{
    public class WebHelper
    {
        public static string LoadUrl(string url)
        {
            using (var web = new WebClient())
            {
                try
                {
                    return web.DownloadString(url);
                }
                catch (WebException ex)
                {
                    ex.Data.Add("Url", url);
                    throw;
                }
            }
        }
    }
}


text:
package jsat.classifiers.linear;

import java.util.*;
import java.util.concurrent.ExecutorService;
import jsat.SingleWeightVectorModel;
import jsat.classifiers.*;
import jsat.classifiers.calibration.BinaryScoreClassifier;
import jsat.exceptions.FailedToFitException;
import jsat.linear.DenseVector;
import jsat.linear.IndexValue;
import jsat.linear.Vec;
import jsat.parameters.Parameter;
import jsat.parameters.Parameterized;
import jsat.regression.BaseUpdateableRegressor;
import jsat.regression.RegressionDataSet;
import jsat.regression.UpdateableRegressor;

/**
 * This provides an implementation of Sparse Truncated Gradient Descent for
 * L1 regularized linear classification and regression on sparse data
 * sets.
 *

 * Unlike normal L1 regression, regularization is controlled by the
 * {@link #setGravity(double) gravity} parameter, but other parameters
 * contribute to the level of sparsity.
 *

 * See: Langford, J., Li, L., & Zhang, T. (2009). Sparse online learning via
 * truncated gradient. The Journal of Machine Learning Research, 10,
 * 777–801. Retrieved from
 * here
 * @author Edward Raff
 */
public class STGD extends BaseUpdateableClassifier implements UpdateableRegressor, BinaryScoreClassifier, Parameterized, SingleWeightVectorModel
{
    private Vec w;

    private int K;
    private double learningRate;
    private double threshold;
    private double gravity;

    private int time;
    private int[] t;

    /**
     * Creates a new STGD learner
     * @param K the regularization frequency
     * @param learningRate the learning rate to use
     * @param threshold the regularization threshold
     * @param gravity the regularization parameter
     */
    public STGD(int K, double learningRate, double threshold, double gravity)
    {
        setK(K);
        setLearningRate(learningRate);
        setThreshold(threshold);
        setGravity(gravity);
    }

    /**
     * Copy constructor
     * @param toCopy the object to copy
     */
    protected STGD(STGD toCopy)
    {
        if(toCopy.w != null)
            this.w = toCopy.w.clone();
        this.K = toCopy.K;
        this.learningRate = toCopy.learningRate;
        this.threshold = toCopy.threshold;
        this.gravity = toCopy.gravity;
        this.time = toCopy.time;
        if(toCopy.t != null)
            this.t = Arrays.copyOf(toCopy.t, toCopy.t.length);
    }

    /**
     * Sets the frequency of applying the {@link #setGravity(double) gravity}
     * parameter to the weight vector. This value must be positive, and the
     * gravity will be applied every K updates.  Increasing this value
     * encourages greater sparsity.
     *
     * @param K the frequency to apply regularization in [1, Infinity )
     */
    public void setK(int K)
    {
        if(K < 1)
            throw new IllegalArgumentException("K must be positive, not " + K);
        this.K = K;
    }

    /**
     * Returns the frequency of regularization application
     * @return the frequency of regularization application
     */
    public int getK()
    {
        return K;
    }

    /**
     * Sets the learning rate to use
     * @param learningRate the learning rate > 0.
     */
    public void setLearningRate(double learningRate)
    {
        if(Double.isInfinite(learningRate) || Double.isNaN(learningRate) || learningRate <= 0)
            throw new IllegalArgumentException("Learning rate must be positive, not " + learningRate);
        this.learningRate = learningRate;
    }

    /**
     * Returns the learning rate to use
     * @return  the learning rate to use
     */
    public double getLearningRate()
    {
        return learningRate;
    }

    /**
     * Sets the threshold for a coefficient value to avoid regularization. While
     * a coefficient reaches this magnitude, regularization will not be applied.
     * @param threshold the coefficient regularization threshold in
     * ( 0, Infinity ]
     */
    public void setThreshold(double threshold)
    {
        if(Double.isNaN(threshold) || threshold <= 0)
            throw new IllegalArgumentException("Threshold must be positive, not " + threshold);
        this.threshold = threshold;
    }

    /**
     * Returns the coefficient threshold parameter
     * @return the coefficient threshold parameter
     */
    public double getThreshold()
    {
        return threshold;
    }

    /**
     * Sets the gravity regularization parameter that "weighs down" the
     * coefficient values. Larger gravity values impose stronger regularization,
     * and encourage greater sparsity.
     *
     * @param gravity the regularization parameter in ( 0, Infinity )
     */
    public void setGravity(double gravity)
    {
        if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
            throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
        this.gravity = gravity;
    }

    /**
     * Returns the regularization parameter
     * @return the regularization parameter
     */
    public double getGravity()
    {
        return gravity;
    }

    @Override
    public Vec getRawWeight()
    {
        return w;
    }

    @Override
    public double getBias()
    {
        return 0;
    }

    @Override
    public Vec getRawWeight(int index)
    {
        if(index < 1)
            return getRawWeight();
        else
            throw new IndexOutOfBoundsException("Model has only 1 weight vector");
    }

    @Override
    public double getBias(int index)
    {
        if (index < 1)
            return getBias();
        else
            throw new IndexOutOfBoundsException("Model has only 1 weight vector");
    }

    @Override
    public int numWeightsVecs()
    {
        return 1;
    }

    @Override
    public STGD clone()
    {
        return new STGD(this);
    }

    @Override
    public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)
    {
        if(predicting.getNumOfCategories() != 2)
            throw new FailedToFitException("STGD supports only binary classification");
        setUp(categoricalAttributes, numericAttributes);
    }

    @Override
    public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes)
    {
        if(numericAttributes < 1)
            throw new FailedToFitException("STGD requires numeric features");
        w = new DenseVector(numericAttributes);
        t = new int[numericAttributes];
    }

    @Override
    public void train(RegressionDataSet dataSet, ExecutorService threadPool)
    {
        train(dataSet);
    }

    @Override
    public void train(RegressionDataSet dataSet)
    {
        BaseUpdateableRegressor.trainEpochs(dataSet, this, getEpochs());
    }

    private static double T(double v_j, double a, double theta)
    {
        if(v_j >= 0 && v_j <= theta)
            return Math.max(0, v_j-a);
        else if(v_j <= 0 && v_j >= -theta)
            return Math.min(0, v_j+a);
        else
            return v_j;
    }

    @Override
    public void update(DataPoint dataPoint, int targetClass)
    {
        time++;
        final Vec x = dataPoint.getNumericalValues();
        final int y = targetClass*2-1;
        final int yHat = (int) Math.signum(w.dot(x));
        if(yHat == y)//Not part of the described algorithm (using signum), but needed
            return;
        performUpdate(x, y, yHat);
    }

    @Override
    public void update(DataPoint dataPoint, final double y)
    {
        time++;
        final Vec x = dataPoint.getNumericalValues();
        final double yHat = w.dot(x);
        performUpdate(x, y, yHat);
    }

    /**
     * Performs the sparse update of the weight vector
     * @param x the input vector
     * @param y the true value
     * @param yHat the predicted value
     */
    private void performUpdate(final Vec x, final double y, final double yHat)
    {
        for(IndexValue iv : x)
        {
            final int j = iv.getIndex();
            w.set(j,
                    T(w.get(j)+2*learningRate*(y-yHat)*iv.getValue(),
                    ((time-t[j])/K)*gravity*learningRate,
                    threshold));

            t[j] += ((time-t[j])/K)*K;
        }
    }

    @Override
    public CategoricalResults classify(DataPoint data)
    {
        CategoricalResults cr = new CategoricalResults(2);
        if(getScore(data) > 0)
            cr.setProb(1, 1.0);
        else
            cr.setProb(0, 1.0);
        return cr;
    }

    @Override
    public double regress(DataPoint data)
    {
        return getScore(data);
    }

    @Override
    public boolean supportsWeightedData()
    {
        return false;
    }

    @Override
    public double getScore(DataPoint dp)
    {
        return w.dot(dp.getNumericalValues());
    }

    @Override
    public List<Parameter> getParameters()
    {
        return Parameter.getParamsFromMethods(this);
    }

    @Override
    public Parameter getParameter(String paramName)
    {
        return Parameter.toParameterMap(getParameters()).get(paramName);
    }
}


text:
import os
from os.path import splitext, sep as filesep, join as pjoin, relpath
from hashlib import sha1

from distutils.command.build_ext import build_ext
from distutils.command.sdist import sdist
from distutils.version import LooseVersion

def derror_maker(klass, msg):
    """ Decorate distutils class to make run method raise error """
    class K(klass):
        def run(self):
            raise RuntimeError(msg)
    return K

def stamped_pyx_ok(exts, hash_stamp_fname):
    """ Check for match of recorded hashes for pyx, corresponding c files

    Parameters
    ----------
    exts : sequence of ``Extension``
        distutils ``Extension`` instances, in fact only need to contain a
        ``sources`` sequence field.
    hash_stamp_fname : str
        filename of text file containing hash stamps

    Returns
    -------
    tf : bool
        True if there is a corresponding c file for each pyx or py file in
        `exts` sources, and the hash for both the (pyx, py) file *and* the c
        file match those recorded in the file named in `hash_stamp_fname`.
    """
    # Calculate hashes for pyx and c files.  Check for presence of c files.
    stamps = {}
    for mod in exts:
        for source in mod.sources:
            base, ext = splitext(source)
            if not ext in ('.pyx', '.py'):
                continue
            source_hash = sha1(open(source, 'rb').read()).hexdigest()
            c_fname = base + '.c'
            try:
                c_file = open(c_fname, 'rb')
            except IOError:
                return False
            c_hash = sha1(c_file.read()).hexdigest()
            stamps[source_hash] = source
            stamps[c_hash] = c_fname
    # Read stamps from hash_stamp_fname; check in stamps dictionary
    try:
        stamp_file = open(hash_stamp_fname, 'rt')
    except IOError:
        return False
    for line in stamp_file:
        if line.startswith('#'):
            continue
        fname, hash = [e.strip() for e in line.split(',')]
        if not hash in stamps:
            return False
        # Compare path made canonical for \/
        fname = fname.replace(filesep, '/')
        if not stamps[hash].replace(filesep, '/') == fname:
            return False
        stamps.pop(hash)
    # All good if we found all hashes we need
    return len(stamps) == 0

def cyproc_exts(exts, cython_min_version,
                hash_stamps_fname = 'pyx-stamps',
                build_ext=build_ext):
    """ Process sequence of `exts` to check if we need Cython.  Return builder

    Parameters
    ----------
    exts : sequence of distutils ``Extension``
        If we already have good c files for any pyx or py sources, we replace
        the pyx or py files with their compiled up c versions inplace.
    cython_min_version : str
        Minimum cython version neede for compile
    hash_stamps_fname : str, optional
        filename with hashes for pyx/py and c files known to be in sync. Default
        is 'pyx-stamps'
    build_ext : distutils command
        default build_ext to return if not cythonizing.  Default is distutils
        ``build_ext`` class

    Returns
    -------
    builder : ``distutils`` ``build_ext`` class or similar
        Can be ``build_ext`` input (if we have good c files) or cython
        ``build_ext`` if we have a good cython, or a class raising an informative
        error on ``run()``
    need_cython : bool
        True if we need Cython to build extensions, False otherwise.
    """
    if stamped_pyx_ok(exts, hash_stamps_fname):
        # Replace pyx with c files, use standard builder
        for mod in exts:
            sources = []
            for source in mod.sources:
                base, ext = splitext(source)
                if ext in ('.pyx', '.py'):
                    sources.append(base + '.c')
                else:
                    sources.append(source)
            mod.sources = sources
        return build_ext, False
    # We need cython
    try:
        from Cython.Compiler.Version import version as cyversion
    except ImportError:
        return derror_maker(build_ext,
                            'Need cython>={0} to build extensions '
                            'but cannot import "Cython"'.format(
                            cython_min_version)), True
    if LooseVersion(cyversion) >= cython_min_version:
        from Cython.Distutils import build_ext as extbuilder
        return extbuilder, True
    return derror_maker(build_ext,
                        'Need cython>={0} to build extensions'
                        'but found cython version {1}'.format(
                        cython_min_version, cyversion)), True

def build_stamp(pyxes, include_dirs=()):
    """ Cythonize files in `pyxes`, return pyx, C filenames, hashes

    Parameters
    ----------
    pyxes : sequence
        sequence of filenames of files on which to run Cython
    include_dirs : sequence
        Any extra include directories in which to find Cython files.

    Returns
    -------
    pyx_defs : dict
        dict has key, value pairs of <pyx_filename>, <pyx_info>, where
        <pyx_info> is a dict with key, value pairs of "pyx_hash", <pyx file SHA1
        hash>; "c_filename", <c filemane>; "c_hash", <c file SHA1 hash>.
    """
    pyx_defs = {}
    from Cython.Compiler.Main import compile
    from Cython.Compiler.CmdLine import parse_command_line
    includes = sum([['--include-dir', d] for d in include_dirs], [])
    for source in pyxes:
        base, ext = splitext(source)
        pyx_hash = sha1(open(source, 'rt').read()).hexdigest()
        c_filename = base + '.c'
        options, sources = parse_command_line(includes + [source])
        result = compile(sources, options)
        if result.num_errors > 0:
            raise RuntimeError('Cython failed to compile ' + source)
        c_hash = sha1(open(c_filename, 'rt').read()).hexdigest()
        pyx_defs[source] = dict(pyx_hash=pyx_hash,
                                c_filename=c_filename,
                                c_hash=c_hash)
    return pyx_defs

def write_stamps(pyx_defs, stamp_fname='pyx-stamps'):
    """ Write stamp information in `pyx_defs` to filename `stamp_fname`

    Parameters
    ----------
    pyx_defs : dict
        dict has key, value pairs of <pyx_filename>, <pyx_info>, where
        <pyx_info> is a dict with key, value pairs of "pyx_hash", <pyx file SHA1
        hash>; "c_filename", <c filemane>; "c_hash", <c file SHA1 hash>.
    stamp_fname : str
        filename to which to write stamp information
    """
    with open(stamp_fname, 'wt') as stamp_file:
        stamp_file.write('# SHA1 hashes for pyx files and generated c files\n')
        stamp_file.write('# Auto-generated file, do not edit\n')
        for pyx_fname, pyx_info in pyx_defs.items():
            stamp_file.write('%s, %s\n' % (pyx_fname,
                                           pyx_info['pyx_hash']))
            stamp_file.write('%s, %s\n' % (pyx_info['c_filename'],
                                           pyx_info['c_hash']))

def find_pyx(root_dir):
    """ Recursively find files with extension '.pyx' starting at `root_dir`

    Parameters
    ----------
    root_dir : str
        Directory from which to search for pyx files.

    Returns
    -------
    pyxes : list
        list of filenames relative to `root_dir`
    """
    pyxes = []
    for dirpath, dirnames, filenames in os.walk(root_dir):
        for filename in filenames:
            if not filename.endswith('.pyx'):
                continue
            base = relpath(dirpath, root_dir)
            pyxes.append(pjoin(base, filename))
    return pyxes

def get_pyx_sdist(sdist_like=sdist, hash_stamps_fname='pyx-stamps',
                  include_dirs=()):
    """ Add pyx->c conversion, hash recording to sdist command `sdist_like`

    Parameters
    ----------
    sdist_like : sdist command class, optional
        command that will do work of ``distutils.command.sdist.sdist``.  By
        default we use the distutils version
    hash_stamps_fname : str, optional
        filename to which to write hashes of pyx / py and c files.  Default is
        ``pyx-stamps``
    include_dirs : sequence
        Any extra include directories in which to find Cython files.

    Returns
    -------
    modified_sdist : sdist-like command class
        decorated `sdist_like` class, for compiling pyx / py files to c, putting
        the .c files in the the source archive, and writing hashes for these
        into the file named from `hash_stamps_fname`
    """
    class PyxSDist(sdist_like):
        """ Custom distutils sdist command to generate .c files from pyx files.

        Running the command object ``obj.run()`` will compile the pyx / py files
        in any extensions, into c files, and add them to the list of files to
        put into the source archive, as well as the usual behavior of distutils
        ``sdist``.  It will also take the sha1 hashes of the pyx / py and c
        files, and store them in a file ``pyx-stamps``, and put this file in the
        release tree.  This allows someone who has the archive to know that the
        pyx and c files that they have are the ones packed into the archive, and
        therefore they may not need Cython at install time.  See
        ``cython_process_exts`` for the build-time command.
        """

        def make_distribution(self):
            """ Compile pyx to c files, add to sources, stamp sha1s """
            pyxes = []
            for mod in self.distribution.ext_modules:
                for source in mod.sources:
                    base, ext = splitext(source)
                    if ext in ('.pyx', '.py'):
                        pyxes.append(source)
            self.pyx_defs = build_stamp(pyxes, include_dirs)
            for pyx_fname, pyx_info in self.pyx_defs.items():
                self.filelist.append(pyx_info['c_filename'])
            sdist_like.make_distribution(self)

        def make_release_tree(self, base_dir, files):
            """ Put pyx stamps file into release tree """
            sdist_like.make_release_tree(self, base_dir, files)
            stamp_fname = pjoin(base_dir, hash_stamps_fname)
            write_stamps(self.pyx_defs, stamp_fname)

    return PyxSDist

def build_stamp_source(root_dir=None, stamp_fname='pyx-stamps',
                       include_dirs=None):
    """ Build cython c files, make stamp file in source tree `root_dir`

    Parameters
    ----------
    root_dir : None or str, optional
        Directory from which to find ``.pyx`` files.  If None, use current
        working directory.
    stamp_fname : str, optional
        Filename for stamp file we will write
    include_dirs : None or sequence
        Any extra Cython include directories
    """
    if root_dir is None:
        root_dir = os.getcwd()
    if include_dirs is None:
        include_dirs = [pjoin(root_dir, 'src')]
    pyxes = find_pyx(root_dir)
    pyx_defs = build_stamp(pyxes, include_dirs=include_dirs)
    write_stamps(pyx_defs, stamp_fname)


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="HandheldFriendly" content="true" />
  <link rel="shortcut icon" href="https://www.epa.gov/sites/all/themes/epa/favicon.ico" type="image/vnd.microsoft.icon" />
  <meta name="MobileOptimized" content="width" />
  <meta http-equiv="cleartype" content="on" />
  <meta http-equiv="ImageToolbar" content="false" />
  <meta name="viewport" content="width=device-width" />
  <meta name="version" content="20161218" />

  <meta name="DC.description" content="" />
  <meta name="DC.title" content="" />
  <title>
  A Low-Cost, High-Temperature Mercury Sorbent for Coal-Fired

Power Plants|

  Research Project Database | Grantee Research Project | ORD | US EPA</title>

  <meta name="keywords" content="" />
  <link rel="shortlink" href="" />
  <link rel="canonical" href="" />
  <meta name="DC.creator" content="" />
  <meta name="DC.language" content="en" />
  <meta name="DC.Subject.epachannel" content="" />
  <meta name="DC.type" content="" />
  <meta name="DC.date.created" content="" />
  <meta name="DC.date.modified" content="2017-01-26" />

  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/misc/ui/jquery.ui.autocomplete.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/themes/epa/css/lib/jquery.ui.theme.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/libraries/template2/s.css" media="all" />

	<link rel="alternate" type="application/atom+xml" title="EPA.gov All Press Releases" href="https://www.epa.gov/newsreleases/search/rss" />
	<link rel="alternate" type="application/atom+xml" title="EPA.gov Headquarters Press Releases" href="https://www.epa.gov/newsreleases/search/rss/field_press_office/headquarters" />
	<link rel="alternate" type="application/atom+xml" title="Greenversations, EPA's Blog" href="https://blog.epa.gov/blog/feed/" />

Jump to main content

  <hgroup class="site-name-and-slogan">

US EPA

United States Environmental Protection Agency

  </hgroup>
  <form class="epa-search" method="get" action="https://search.epa.gov/epasearch/epasearch">
    Search
    <input class="form-text" placeholder="Search EPA.gov" name="querytext" id="search-box" value=""/>
    <button class="epa-search-button" id="search-button" type="submit" title="Search">Search</button>
    <input type="hidden" name="fld" value="" />
    <input type="hidden" name="areaname" value="" />
    <input type="hidden" name="areacontacts" value="" />
    <input type="hidden" name="areasearchurl" value="" />
    <input type="hidden" name="typeofsearch" value="epa" />
    <input type="hidden" name="result_template" value="2col.ftl" />
    <input type="hidden" name="filter" value="sample4filt.hts" />
  </form>

Contact Us

Project Research Results

Final Report

2000 Progress Report

SBIR Phase I

                              | 2001 Progress Report

                              | Final Report

Related Information

Research Grants

P3: Student Design Competition

Research Fellowships

Small Business Innovation Research (SBIR)

Grantee Research Project Results Search

      A Low-Cost, High-Temperature Mercury Sorbent for Coal-Fired

Power Plants

    EPA Contract Number: 68D01075

    Title: A Low-Cost, High-Temperature Mercury Sorbent for Coal-Fired

Power Plants

    Investigators:
     Nelson, Sid

    Small Business:

      Sorbent Technologies Corporation

    	EPA Contact:

           Manager, SBIR Program

        Phase: II

      Project Period:
      September 1, 2001 through
        September 1, 2003

        Project Amount:

          $225,000

      RFA:
      Small Business Innovation Research (SBIR) - Phase II (2001)

          Recipients Lists

      Research Category:

          Air Quality and Air Toxics
          ,
          SBIR - Air Pollution
          ,
          Small Business Innovation Research (SBIR)

Description:

      	The results of the Phase I project increase the likelihood that the project's
new technology will make a major contribution to a healthier world environment.
First, the U.S. EPA is introducing mercury-control standards on power plants
requiring significant emission reductions from over 1,000 utility coal-fired
boilers. A regulatory timetable has now been set, which will lead to the
installation of mercury control technologies on these units. Second, an analysis
of the measurements supplied in response to EPA's mercury Information Collection
Request reveals that the biggest part of the U.S. utility problem is the
emission of the elemental form of mercury, which current controls do not
capture.

During the Phase I project, two discoveries were made that help demonstrate
the feasibility of Sorbent Technologies' new duct-injection sorbent approach.
First, the new elemental-mercury sorbents were found to work through a
chemisorption process. Project experiments showed this to be responsible for
high sorbent stability and surprisingly good high-temperature performance.
Powdered activated carbons (PACs), the best sorbents currently available,
capture mercury primarily through a weak physical adsorption. In fixed-bed
experiments at representative utility flue-gas temperatures, the new sorbents
demonstrated elemental-mercury capacities ten (10) times higher than typical
PACs. With the new technology, it may be possible to achieve net mercury-removal
costs that are one-tenth that of current technologies.

The second discovery was that the sorbents can be made from commercially
available substrate many times smaller than PACs. This would relieve the
bulk-gas mass-transfer limitations that many believe inherently constrain PACs
from achieving high performance under economical conditions.

The stage is now set for continued Phase II laboratory and duct-injection
pilot-plant testing on simulated coal-combustion gases at Sorbent Technologies'
existing facilities. Also in Phase II, materials scientists at The Pennsylvania
State University will join the effort to better understand and exploit the
increased performance of the new sorbents. In addition, an excellent site has
been located that will allow inexpensive duct-injection testing on actual flue
gases from a number of problem coals. Outside equity investments for the Phase
II Commercialization Option have already been received, enabling the addition of this last task to the Phase II project. Production of the new sorbent has
already been scaled up to 40-lb quantities for such testing.

Supplemental Keywords:

      small business, SBIR, air pollution, mercury, coal-fired boilers, powdered activated carbon, PAC, flue gases, EPA., RFA, Scientific Discipline, Air, Toxics, Waste, particulate matter, Chemical Engineering, air toxics, Environmental Chemistry, HAPS, VOCs, Hazardous Waste, exploratory air chemistry and physics, Incineration/Combustion, Engineering, Hazardous, 33/50, Engineering,  Chemistry,  & Physics, Environmental Engineering, Nox, particulates, mercury, coal fired utility boiler , pollution control technologies, simulated coal combustion, emissions, Sulfur dioxide, powdered activated carbon (PAC), PAC, sorbents, combustion, mercury & mercury compounds, Mercury Compounds, mercury recovery, Volatile Organic Compounds (VOCs), coal fired power plants, coal combustion, air emissions, removal

Progress and Final Reports:

                2000 Progress Report

                Final Report

SBIR Phase I:

              A Low-Cost, High-Temperature Mercury Sorbent for Coal-Fired Power Plants

               | 2001 Progress Report

               | Final Report

Top of Page

 The perspectives, information and conclusions conveyed in research project abstracts, progress reports, final reports, journal abstracts and journal publications convey the viewpoints of the principal investigator and may not represent the views and policies of ORD and EPA.  Conclusions drawn by the principal investigators have not been reviewed by the Agency.

Main menu

Environmental Topics

Laws & Regulations

About EPA

Discover.

Accessibility

EPA Administrator

Budget & Performance

Contracting

Grants

No FEAR Act Data

Privacy and Security

Connect.

Data.gov

Inspector General

Jobs

Newsroom

Open Government

Regulations.gov

Subscribe

USA.gov

White House

Ask.

Contact Us

Hotlines

FOIA Requests

Frequent Questions

Follow.

Facebook

Twitter

YouTube

Flickr

Instagram

Last updated on Thursday, January 26, 2017


text:
namespace chrome {

namespace {

std::unique_ptr<install_static::PrimaryInstallDetails> MakeDetails(
    ScopedChannelOverride::Channel channel) {
  auto details = std::make_unique<install_static::PrimaryInstallDetails>();

  switch (channel) {
    case ScopedChannelOverride::Channel::kExtendedStable:
      details->set_mode(
          &install_static::kInstallModes[install_static::STABLE_INDEX]);
      details->set_channel_origin(install_static::ChannelOrigin::kPolicy);
      details->set_channel_override(L"extended");
      details->set_is_extended_stable_channel(true);
      break;
    case ScopedChannelOverride::Channel::kStable:
      details->set_mode(
          &install_static::kInstallModes[install_static::STABLE_INDEX]);
      break;
    case ScopedChannelOverride::Channel::kBeta:
      details->set_mode(
          &install_static::kInstallModes[install_static::BETA_INDEX]);
      details->set_channel(L"beta");
      break;
    case ScopedChannelOverride::Channel::kDev:
      details->set_mode(
          &install_static::kInstallModes[install_static::DEV_INDEX]);
      details->set_channel(L"dev");
      break;
    case ScopedChannelOverride::Channel::kCanary:
      details->set_mode(
          &install_static::kInstallModes[install_static::CANARY_INDEX]);
      details->set_channel(L"canary");
      break;
  }

  return details;
}

}  // namespace

ScopedChannelOverride::ScopedChannelOverride(Channel channel)
    : scoped_install_details_(MakeDetails(channel)) {}

ScopedChannelOverride::~ScopedChannelOverride() = default;

}  // namespace chrome


text:
function add(teacher){
	console.log('Add teacher:' + teacher);
}

exports.add = add;


text:
#include "../../SDL_internal.h"

#if SDL_AUDIO_DRIVER_JACK

#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "SDL_jackaudio.h"
#include "SDL_loadso.h"
#include "../../thread/SDL_systhread.h"

static jack_client_t * (*JACK_jack_client_open) (const char *, jack_options_t, jack_status_t *, ...);
static int (*JACK_jack_client_close) (jack_client_t *);
static void (*JACK_jack_on_shutdown) (jack_client_t *, JackShutdownCallback, void *);
static int (*JACK_jack_activate) (jack_client_t *);
static int (*JACK_jack_deactivate) (jack_client_t *);
static void * (*JACK_jack_port_get_buffer) (jack_port_t *, jack_nframes_t);
static int (*JACK_jack_port_unregister) (jack_client_t *, jack_port_t *);
static void (*JACK_jack_free) (void *);
static const char ** (*JACK_jack_get_ports) (jack_client_t *, const char *, const char *, unsigned long);
static jack_nframes_t (*JACK_jack_get_sample_rate) (jack_client_t *);
static jack_nframes_t (*JACK_jack_get_buffer_size) (jack_client_t *);
static jack_port_t * (*JACK_jack_port_register) (jack_client_t *, const char *, const char *, unsigned long, unsigned long);
static jack_port_t * (*JACK_jack_port_by_name) (jack_client_t *, const char *);
static const char * (*JACK_jack_port_name) (const jack_port_t *);
static const char * (*JACK_jack_port_type) (const jack_port_t *);
static int (*JACK_jack_connect) (jack_client_t *, const char *, const char *);
static int (*JACK_jack_set_process_callback) (jack_client_t *, JackProcessCallback, void *);

static int load_jack_syms(void);

#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC

static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC;
static void *jack_handle = NULL;

/* !!! FIXME: this is copy/pasted in several places now */
static int
load_jack_sym(const char *fn, void **addr)
{
    *addr = SDL_LoadFunction(jack_handle, fn);
    if (*addr == NULL) {
        /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
        return 0;
    }

    return 1;
}

/* cast funcs to char* first, to please GCC's strict aliasing rules. */
#define SDL_JACK_SYM(x) \
    if (!load_jack_sym(#x, (void **) (char *) &JACK_##x)) return -1

static void
UnloadJackLibrary(void)
{
    if (jack_handle != NULL) {
        SDL_UnloadObject(jack_handle);
        jack_handle = NULL;
    }
}

static int
LoadJackLibrary(void)
{
    int retval = 0;
    if (jack_handle == NULL) {
        jack_handle = SDL_LoadObject(jack_library);
        if (jack_handle == NULL) {
            retval = -1;
            /* Don't call SDL_SetError(): SDL_LoadObject already did. */
        } else {
            retval = load_jack_syms();
            if (retval < 0) {
                UnloadJackLibrary();
            }
        }
    }
    return retval;
}

#else

#define SDL_JACK_SYM(x) JACK_##x = x

static void
UnloadJackLibrary(void)
{
}

static int
LoadJackLibrary(void)
{
    load_jack_syms();
    return 0;
}

#endif /* SDL_AUDIO_DRIVER_JACK_DYNAMIC */

static int
load_jack_syms(void)
{
    SDL_JACK_SYM(jack_client_open);
    SDL_JACK_SYM(jack_client_close);
    SDL_JACK_SYM(jack_on_shutdown);
    SDL_JACK_SYM(jack_activate);
    SDL_JACK_SYM(jack_deactivate);
    SDL_JACK_SYM(jack_port_get_buffer);
    SDL_JACK_SYM(jack_port_unregister);
    SDL_JACK_SYM(jack_free);
    SDL_JACK_SYM(jack_get_ports);
    SDL_JACK_SYM(jack_get_sample_rate);
    SDL_JACK_SYM(jack_get_buffer_size);
    SDL_JACK_SYM(jack_port_register);
    SDL_JACK_SYM(jack_port_by_name);
    SDL_JACK_SYM(jack_port_name);
    SDL_JACK_SYM(jack_port_type);
    SDL_JACK_SYM(jack_connect);
    SDL_JACK_SYM(jack_set_process_callback);
    return 0;
}

static void
jackShutdownCallback(void *arg)  /* JACK went away; device is lost. */
{
    SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
    SDL_OpenedAudioDeviceDisconnected(this);
    SDL_SemPost(this->hidden->iosem);  /* unblock the SDL thread. */
}

// !!! FIXME: implement and register these!
//typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg)
//typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg)

static int
jackProcessPlaybackCallback(jack_nframes_t nframes, void *arg)
{
    SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
    jack_port_t **ports = this->hidden->sdlports;
    const int total_channels = this->spec.channels;
    const int total_frames = this->spec.samples;
    int channelsi;

    if (!SDL_AtomicGet(&this->enabled)) {
        /* silence the buffer to avoid repeats and corruption. */
        SDL_memset(this->hidden->iobuffer, '\0', this->spec.size);
    }

    for (channelsi = 0; channelsi < total_channels; channelsi++) {
        float *dst = (float *) JACK_jack_port_get_buffer(ports[channelsi], nframes);
        if (dst) {
            const float *src = ((float *) this->hidden->iobuffer) + channelsi;
            int framesi;
            for (framesi = 0; framesi < total_frames; framesi++) {
                *(dst++) = *src;
                src += total_channels;
            }
        }
    }

    SDL_SemPost(this->hidden->iosem);  /* tell SDL thread we're done; refill the buffer. */
    return 0;  /* success */
}

/* This function waits until it is possible to write a full sound buffer */
static void
JACK_WaitDevice(_THIS)
{
    if (SDL_AtomicGet(&this->enabled)) {
        if (SDL_SemWait(this->hidden->iosem) == -1) {
            SDL_OpenedAudioDeviceDisconnected(this);
        }
    }
}

static Uint8 *
JACK_GetDeviceBuf(_THIS)
{
    return (Uint8 *) this->hidden->iobuffer;
}

static int
jackProcessCaptureCallback(jack_nframes_t nframes, void *arg)
{
    SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
    if (SDL_AtomicGet(&this->enabled)) {
        jack_port_t **ports = this->hidden->sdlports;
        const int total_channels = this->spec.channels;
        const int total_frames = this->spec.samples;
        int channelsi;

        for (channelsi = 0; channelsi < total_channels; channelsi++) {
            const float *src = (const float *) JACK_jack_port_get_buffer(ports[channelsi], nframes);
            if (src) {
                float *dst = ((float *) this->hidden->iobuffer) + channelsi;
                int framesi;
                for (framesi = 0; framesi < total_frames; framesi++) {
                    *dst = *(src++);
                    dst += total_channels;
                }
            }
        }
    }

    SDL_SemPost(this->hidden->iosem);  /* tell SDL thread we're done; new buffer is ready! */
    return 0;  /* success */
}

static int
JACK_CaptureFromDevice(_THIS, void *buffer, int buflen)
{
    SDL_assert(buflen == this->spec.size);  /* we always fill a full buffer. */

    /* Wait for JACK to fill the iobuffer */
    if (SDL_SemWait(this->hidden->iosem) == -1) {
        return -1;
    }

    SDL_memcpy(buffer, this->hidden->iobuffer, buflen);
    return buflen;
}

static void
JACK_FlushCapture(_THIS)
{
    SDL_SemWait(this->hidden->iosem);
}

static void
JACK_CloseDevice(_THIS)
{
    if (this->hidden->client) {
        JACK_jack_deactivate(this->hidden->client);

        if (this->hidden->sdlports) {
            const int channels = this->spec.channels;
            int i;
            for (i = 0; i < channels; i++) {
                JACK_jack_port_unregister(this->hidden->client, this->hidden->sdlports[i]);
            }
            SDL_free(this->hidden->sdlports);
        }

        JACK_jack_client_close(this->hidden->client);
    }

    if (this->hidden->iosem) {
        SDL_DestroySemaphore(this->hidden->iosem);
    }

    SDL_free(this->hidden->iobuffer);
    SDL_free(this->hidden);
}

static int
JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
{
    /* Note that JACK uses "output" for capture devices (they output audio
        data to us) and "input" for playback (we input audio data to them).
        Likewise, SDL's playback port will be "output" (we write data out)
        and capture will be "input" (we read data in). */
    const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput;
    const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput;
    const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback;
    const char *sdlportstr = iscapture ? "input" : "output";
    const char **devports = NULL;
    int *audio_ports;
    jack_client_t *client = NULL;
    jack_status_t status;
    int channels = 0;
    int ports = 0;
    int i;

    /* Initialize all variables that we clean on shutdown */
    this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof (*this->hidden));
    if (this->hidden == NULL) {
        return SDL_OutOfMemory();
    }

    /* !!! FIXME: we _still_ need an API to specify an app name */
    client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
    this->hidden->client = client;
    if (client == NULL) {
        return SDL_SetError("Can't open JACK client");
    }

    devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags);
    if (!devports || !devports[0]) {
        return SDL_SetError("No physical JACK ports available");
    }

    while (devports[++ports]) {
        /* spin to count devports */
    }

    /* Filter out non-audio ports */
    audio_ports = SDL_calloc(ports, sizeof *audio_ports);
    for (i = 0; i < ports; i++) {
        const jack_port_t *dport = JACK_jack_port_by_name(client, devports[i]);
        const char *type = JACK_jack_port_type(dport);
        const int len = SDL_strlen(type);
        /* See if type ends with "audio" */
        if (len >= 5 && !SDL_memcmp(type+len-5, "audio", 5)) {
            audio_ports[channels++] = i;
        }
    }
    if (channels == 0) {
        return SDL_SetError("No physical JACK ports available");
    }

    /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */

    /* Jack pretty much demands what it wants. */
    this->spec.format = AUDIO_F32SYS;
    this->spec.freq = JACK_jack_get_sample_rate(client);
    this->spec.channels = channels;
    this->spec.samples = JACK_jack_get_buffer_size(client);

    SDL_CalculateAudioSpec(&this->spec);

    this->hidden->iosem = SDL_CreateSemaphore(0);
    if (!this->hidden->iosem) {
        return -1;  /* error was set by SDL_CreateSemaphore */
    }

    this->hidden->iobuffer = (float *) SDL_calloc(1, this->spec.size);
    if (!this->hidden->iobuffer) {
        return SDL_OutOfMemory();
    }

    /* Build SDL's ports, which we will connect to the device ports. */
    this->hidden->sdlports = (jack_port_t **) SDL_calloc(channels, sizeof (jack_port_t *));
    if (this->hidden->sdlports == NULL) {
        return SDL_OutOfMemory();
    }

    for (i = 0; i < channels; i++) {
        char portname[32];
        SDL_snprintf(portname, sizeof (portname), "sdl_jack_%s_%d", sdlportstr, i);
        this->hidden->sdlports[i] = JACK_jack_port_register(client, portname, JACK_DEFAULT_AUDIO_TYPE, sdlportflags, 0);
        if (this->hidden->sdlports[i] == NULL) {
            return SDL_SetError("jack_port_register failed");
        }
    }

    if (JACK_jack_set_process_callback(client, callback, this) != 0) {
        return SDL_SetError("JACK: Couldn't set process callback");
    }

    JACK_jack_on_shutdown(client, jackShutdownCallback, this);

    if (JACK_jack_activate(client) != 0) {
        return SDL_SetError("Failed to activate JACK client");
    }

    /* once activated, we can connect all the ports. */
    for (i = 0; i < channels; i++) {
        const char *sdlport = JACK_jack_port_name(this->hidden->sdlports[i]);
        const char *srcport = iscapture ? devports[audio_ports[i]] : sdlport;
        const char *dstport = iscapture ? sdlport : devports[audio_ports[i]];
        if (JACK_jack_connect(client, srcport, dstport) != 0) {
            return SDL_SetError("Couldn't connect JACK ports: %s => %s", srcport, dstport);
        }
    }

    /* don't need these anymore. */
    JACK_jack_free(devports);
    SDL_free(audio_ports);

    /* We're ready to rock and roll. :-) */
    return 0;
}

static void
JACK_Deinitialize(void)
{
    UnloadJackLibrary();
}

static int
JACK_Init(SDL_AudioDriverImpl * impl)
{
    if (LoadJackLibrary() < 0) {
        return 0;
    } else {
        /* Make sure a JACK server is running and available. */
        jack_status_t status;
        jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
        if (client == NULL) {
            UnloadJackLibrary();
            return 0;
        }
        JACK_jack_client_close(client);
    }

    /* Set the function pointers */
    impl->OpenDevice = JACK_OpenDevice;
    impl->WaitDevice = JACK_WaitDevice;
    impl->GetDeviceBuf = JACK_GetDeviceBuf;
    impl->CloseDevice = JACK_CloseDevice;
    impl->Deinitialize = JACK_Deinitialize;
    impl->CaptureFromDevice = JACK_CaptureFromDevice;
    impl->FlushCapture = JACK_FlushCapture;
    impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
    impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
    impl->HasCaptureSupport = SDL_TRUE;

    return 1;   /* this audio target is available. */
}

AudioBootStrap JACK_bootstrap = {
    "jack", "JACK Audio Connection Kit", JACK_Init, 0
};

#endif /* SDL_AUDIO_DRIVER_JACK */

/* vi: set ts=4 sw=4 expandtab: */


text:
external help file: Microsoft.Azure.Commands.ResourceManager.Automation.dll-Help.xml
ms.assetid: 920C028B-0471-43EB-9123-C444289FD845
online version:
schema: 2.0.0
---

# Set-AzureRmAutomationRunbook

## SYNOPSIS
Modifies a runbook.

## SYNTAX

```
Set-AzureRmAutomationRunbook [-Name] <String> [-Description <String>] [-Tags <IDictionary>]
 [-LogProgress <Boolean>] [-LogVerbose <Boolean>] [-ResourceGroupName] <String>
 [-AutomationAccountName] <String> [<CommonParameters>]
```

## DESCRIPTION
The **Set-AzureRmAutomationRunbook** cmdlet modifies the configuration of an Azure Automation runbook in APS.

## EXAMPLES

### Example 1: Enable verbose logging for a runbook
```
PS C:\>Set-AzureRmAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbook02" -LogVerbose $True -ResourceGroupName "ResourceGroup01"
```

This command enables verbose logging for the jobs of the specified runbook in the Azure Automation account named Contoso17.

## PARAMETERS

### -AutomationAccountName
Specifies the name of the Automation account in which this cmdlet modifies a runbook.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Description
Specifies a description for the runbook.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -LogProgress
Specifies whether the runbook logs progress.

```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -LogVerbose
Specifies whether logging includes detailed information.

```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Name
Specifies the name of the runbook that this cmdlet modifies.

```yaml
Type: String
Parameter Sets: (All)
Aliases: RunbookName

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ResourceGroupName
Specifies the name of the resource group for which this cmdlet modifies a runbook.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Tags
Specifies a dictionary of tags to replace the current tags of the modified runbook.

```yaml
Type: IDictionary
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### Microsoft.Azure.Commands.Automation.Model.Runbook

## NOTES

## RELATED LINKS

[Export-AzureRmAutomationRunbook](./Export-AzureRMAutomationRunbook.md)

[Get-AzureRmAutomationRunbook](./Get-AzureRMAutomationRunbook.md)

[Import-AzureRmAutomationRunbook](./Import-AzureRMAutomationRunbook.md)

[New-AzureRmAutomationRunbook](./New-AzureRMAutomationRunbook.md)

[New-AzureRmAutomationRunbook](./New-AzureRMAutomationRunbook.md)

[Publish-AzureRmAutomationRunbook](./Publish-AzureRMAutomationRunbook.md)

[Remove-AzureRmAutomationRunbook](./Remove-AzureRMAutomationRunbook.md)

[Start-AzureRmAutomationRunbook](./Start-AzureRMAutomationRunbook.md)