text:
// @file bsonobj.h

#pragma once

#include <boost/noncopyable.hpp>
#include <boost/intrusive_ptr.hpp>
#include <set>
#include <list>
#include <vector>
#include "util/atomic_int.h"
#include "util/builder.h"
#include "stringdata.h"

namespace mongo {

    typedef std::set< BSONElement, BSONElementCmpWithoutField > BSONElementSet;
    typedef std::multiset< BSONElement, BSONElementCmpWithoutField > BSONElementMSet;

    /**
       C++ representation of a "BSON" object -- that is, an extended JSON-style
       object in a binary representation.

       See bsonspec.org.

       Note that BSONObj's have a smart pointer capability built in -- so you can
       pass them around by value.  The reference counts used to implement this
       do not use locking, so copying and destroying BSONObj's are not thread-safe
       operations.

     BSON object format:

     code
     <unsigned totalSize> {<byte BSONType><cstring FieldName><Data>}* EOO

     totalSize includes itself.

     Data:
     Bool:      <byte>
     EOO:       nothing follows
     Undefined: nothing follows
     OID:       an OID object
     NumberDouble: <double>
     NumberInt: <int32>
     String:    <unsigned32 strsizewithnull><cstring>
     Date:      <8bytes>
     Regex:     <cstring regex><cstring options>
     Object:    a nested object, leading with its entire size, which terminates with EOO.
     Array:     same as object
     DBRef:     <strlen> <cstring ns> <oid>
     DBRef:     a database reference: basically a collection name plus an Object ID
     BinData:   <int len> <byte subtype> <byte[len] data>
     Code:      a function (not a closure): same format as String.
     Symbol:    a language symbol (say a python symbol).  same format as String.
     Code With Scope: <total size><String><Object>
     \endcode
     */
    class BSONObj {
    public:

        /** Construct a BSONObj from data in the proper format.
         *  Use this constructor when something else owns msgdata's buffer
        */
        explicit BSONObj(const char *msgdata) {
            init(msgdata);
        }

        /** Construct a BSONObj from data in the proper format.
         *  Use this constructor when you want BSONObj to free(holder) when it is no longer needed
         *  BSONObj::Holder has an extra 4 bytes for a ref-count before the start of the object
        */
        class Holder;
        explicit BSONObj(Holder* holder) {
            init(holder);
        }

        explicit BSONObj(const Record *r);

        /** Construct an empty BSONObj -- that is, {}. */
        BSONObj();

        ~BSONObj() {
            _objdata = 0; // defensive
        }

        /**
           A BSONObj can use a buffer it "owns" or one it does not.

           OWNED CASE
           If the BSONObj owns the buffer, the buffer can be shared among several BSONObj's (by assignment).
           In this case the buffer is basically implemented as a shared_ptr.
           Since BSONObj's are typically immutable, this works well.

           UNOWNED CASE
           A BSONObj can also point to BSON data in some other data structure it does not "own" or free later.
           For example, in a memory mapped file.  In this case, it is important the original data stays in
           scope for as long as the BSONObj is in use.  If you think the original data may go out of scope,
           call BSONObj::getOwned() to promote your BSONObj to having its own copy.

           On a BSONObj assignment, if the source is unowned, both the source and dest will have unowned
           pointers to the original buffer after the assignment.

           If you are not sure about ownership but need the buffer to last as long as the BSONObj, call
           getOwned().  getOwned() is a no-op if the buffer is already owned.  If not already owned, a malloc
           and memcpy will result.

           Most ways to create BSONObj's create 'owned' variants.  Unowned versions can be created with:
           (1) specifying true for the ifree parameter in the constructor
           (2) calling BSONObjBuilder::done().  Use BSONObjBuilder::obj() to get an owned copy
           (3) retrieving a subobject retrieves an unowned pointer into the parent BSON object

           @return true if this is in owned mode
        */
        bool isOwned() const { return _holder.get() != 0; }

        /** assure the data buffer is under the control of this BSONObj and not a remote buffer
            @see isOwned()
        */
        BSONObj getOwned() const;

        /** @return a new full (and owned) copy of the object. */
        BSONObj copy() const;

        /** Readable representation of a BSON object in an extended JSON-style notation.
            This is an abbreviated representation which might be used for logging.
        */
        std::string toString( bool isArray = false, bool full=false ) const;
        void toString(StringBuilder& s, bool isArray = false, bool full=false ) const;

        /** Properly formatted JSON string.
            @param pretty if true we try to add some lf's and indentation
        */
        std::string jsonString( JsonStringFormat format = Strict, int pretty = 0 ) const;

        /** note: addFields always adds _id even if not specified */
        int addFields(BSONObj& from, std::set<std::string>& fields); /* returns n added */

        /** remove specified field and return a new object with the remaining fields.
            slowish as builds a full new object
         */
        BSONObj removeField(const StringData& name) const;

        /** returns # of top level fields in the object
           note: iterates to count the fields
        */
        int nFields() const;

        /** adds the field names to the fields set.  does NOT clear it (appends). */
        int getFieldNames(std::set<std::string>& fields) const;

        /** @return the specified element.  element.eoo() will be true if not found.
            @param name field to find. supports dot (".") notation to reach into embedded objects.
             for example "x.y" means "in the nested object in field x, retrieve field y"
        */
        BSONElement getFieldDotted(const char *name) const;
        /** @return the specified element.  element.eoo() will be true if not found.
            @param name field to find. supports dot (".") notation to reach into embedded objects.
             for example "x.y" means "in the nested object in field x, retrieve field y"
        */
        BSONElement getFieldDotted(const std::string& name) const {
            return getFieldDotted( name.c_str() );
        }

        /** Like getFieldDotted(), but expands arrays and returns all matching objects.
         *  Turning off expandLastArray allows you to retrieve nested array objects instead of
         *  their contents.
         */
        void getFieldsDotted(const StringData& name, BSONElementSet &ret, bool expandLastArray = true ) const;
        void getFieldsDotted(const StringData& name, BSONElementMSet &ret, bool expandLastArray = true ) const;

        /** Like getFieldDotted(), but returns first array encountered while traversing the
            dotted fields of name.  The name variable is updated to represent field
            names with respect to the returned element. */
        BSONElement getFieldDottedOrArray(const char *&name) const;

        /** Get the field of the specified name. eoo() is true on the returned
            element if not found.
        */
        BSONElement getField(const StringData& name) const;

        /** Get several fields at once. This is faster than separate getField() calls as the size of
            elements iterated can then be calculated only once each.
            @param n number of fieldNames, and number of elements in the fields array
            @param fields if a field is found its element is stored in its corresponding position in this array.
                   if not found the array element is unchanged.
         */
        void getFields(unsigned n, const char **fieldNames, BSONElement *fields) const;

        /** Get the field of the specified name. eoo() is true on the returned
            element if not found.
        */
        BSONElement operator[] (const char *field) const {
            return getField(field);
        }

        BSONElement operator[] (const std::string& field) const {
            return getField(field);
        }

        BSONElement operator[] (int field) const {
            StringBuilder ss;
            ss << field;
            std::string s = ss.str();
            return getField(s.c_str());
        }

        /** @return true if field exists */
        bool hasField( const char * name ) const { return !getField(name).eoo(); }
        /** @return true if field exists */
        bool hasElement(const char *name) const { return hasField(name); }

        /** @return "" if DNE or wrong type */
        const char * getStringField(const char *name) const;

        /** @return subobject of the given name */
        BSONObj getObjectField(const char *name) const;

        /** @return INT_MIN if not present - does some type conversions */
        int getIntField(const char *name) const;

        /** @return false if not present
            @see BSONElement::trueValue()
         */
        bool getBoolField(const char *name) const;

        /**
           sets element field names to empty string
           If a field in pattern is missing, it is omitted from the returned
           object.
        */
        BSONObj extractFieldsUnDotted(BSONObj pattern) const;

        /** extract items from object which match a pattern object.
            e.g., if pattern is { x : 1, y : 1 }, builds an object with
            x and y elements of this object, if they are present.
           returns elements with original field names
        */
        BSONObj extractFields(const BSONObj &pattern , bool fillWithNull=false) const;

        BSONObj filterFieldsUndotted(const BSONObj &filter, bool inFilter) const;

        BSONElement getFieldUsingIndexNames(const char *fieldName, const BSONObj &indexKey) const;

        /** arrays are bson objects with numeric and increasing field names
            @return true if field names are numeric and increasing
         */
        bool couldBeArray() const;

        /** @return the raw data of the object */
        const char *objdata() const {
            return _objdata;
        }
        /** @return total size of the BSON object in bytes */
        int objsize() const { return *(reinterpret_cast<const int*>(objdata())); }

        /** performs a cursory check on the object's size only. */
        bool isValid() const;

        /** @return if the user is a valid user doc
            criter: isValid() no . or $ field names
         */
        bool okForStorage() const;

        /** @return true if object is empty -- i.e.,  {} */
        bool isEmpty() const { return objsize() <= 5; }

        void dump() const;

        /** Alternative output format */
        std::string hexDump() const;

        /**wo='well ordered'.  fields must be in same order in each object.
           Ordering is with respect to the signs of the elements
           and allows ascending / descending key mixing.
           @return  <0 if l<r. 0 if l==r. >0 if l>r
        */
        int woCompare(const BSONObj& r, const Ordering &o,
                      bool considerFieldName=true) const;

        /**wo='well ordered'.  fields must be in same order in each object.
           Ordering is with respect to the signs of the elements
           and allows ascending / descending key mixing.
           @return  <0 if l<r. 0 if l==r. >0 if l>r
        */
        int woCompare(const BSONObj& r, const BSONObj &ordering = BSONObj(),
                      bool considerFieldName=true) const;

        bool operator<( const BSONObj& other ) const { return woCompare( other ) < 0; }
        bool operator<=( const BSONObj& other ) const { return woCompare( other ) <= 0; }
        bool operator>( const BSONObj& other ) const { return woCompare( other ) > 0; }
        bool operator>=( const BSONObj& other ) const { return woCompare( other ) >= 0; }

        /**
         * @param useDotted whether to treat sort key fields as possibly dotted and expand into them
         */
        int woSortOrder( const BSONObj& r , const BSONObj& sortKey , bool useDotted=false ) const;

        bool equal(const BSONObj& r) const;

        /** This is "shallow equality" -- ints and doubles won't match.  for a
           deep equality test use woCompare (which is slower).
        */
        bool binaryEqual(const BSONObj& r) const {
            int os = objsize();
            if ( os == r.objsize() ) {
                return (os == 0 || memcmp(objdata(),r.objdata(),os)==0);
            }
            return false;
        }

        /** @return first field of the object */
        BSONElement firstElement() const { return BSONElement(objdata() + 4); }

        /** faster than firstElement().fieldName() - for the first element we can easily find the fieldname without
            computing the element size.
        */
        const char * firstElementFieldName() const {
            const char *p = objdata() + 4;
            return *p == EOO ? "" : p+1;
        }

        BSONType firstElementType() const {
            const char *p = objdata() + 4;
            return (BSONType) *p;
        }

        /** Get the _id field from the object.  For good performance drivers should
            assure that _id is the first element of the object; however, correct operation
            is assured regardless.
            @return true if found
        */
        bool getObjectID(BSONElement& e) const;

        /** @return A hash code for the object */
        int hash() const {
            unsigned x = 0;
            const char *p = objdata();
            for ( int i = 0; i < objsize(); i++ )
                x = x * 131 + p[i];
            return (x & 0x7fffffff) | 0x8000000; // must be > 0
        }

        // Return a version of this object where top level elements of types
        // that are not part of the bson wire protocol are replaced with
        // string identifier equivalents.
        // TODO Support conversion of element types other than min and max.
        BSONObj clientReadable() const;

        /** Return new object with the field names replaced by those in the
            passed object. */
        BSONObj replaceFieldNames( const BSONObj &obj ) const;

        /** true unless corrupt */
        bool valid() const;

        /** @return an md5 value for this object. */
        std::string md5() const;

        bool operator==( const BSONObj& other ) const { return equal( other ); }
        bool operator!=(const BSONObj& other) const { return !operator==( other); }

        enum MatchType {
            Equality = 0,
            LT = 0x1,
            LTE = 0x3,
            GTE = 0x6,
            GT = 0x4,
            opIN = 0x8, // { x : { $in : [1,2,3] } }
            NE = 0x9,
            opSIZE = 0x0A,
            opALL = 0x0B,
            NIN = 0x0C,
            opEXISTS = 0x0D,
            opMOD = 0x0E,
            opTYPE = 0x0F,
            opREGEX = 0x10,
            opOPTIONS = 0x11,
            opELEM_MATCH = 0x12,
            opNEAR = 0x13,
            opWITHIN = 0x14,
            opMAX_DISTANCE=0x15
        };

        /** add all elements of the object to the specified vector */
        void elems(std::vector<BSONElement> &) const;
        /** add all elements of the object to the specified list */
        void elems(std::list<BSONElement> &) const;

        /** add all values of the object to the specified vector.  If type mismatches, exception.
            this is most useful when the BSONObj is an array, but can be used with non-arrays too in theory.

            example:
              bo sub = y["subobj"].Obj();
              std::vector<int> myints;
              sub.Vals(myints);
        */
        template <class T>
        void Vals(std::vector<T> &) const;
        /** add all values of the object to the specified list.  If type mismatches, exception. */
        template <class T>
        void Vals(std::list<T> &) const;

        /** add all values of the object to the specified vector.  If type mismatches, skip. */
        template <class T>
        void vals(std::vector<T> &) const;
        /** add all values of the object to the specified list.  If type mismatches, skip. */
        template <class T>
        void vals(std::list<T> &) const;

        friend class BSONObjIterator;
        typedef BSONObjIterator iterator;

        /** use something like this:
            for( BSONObj::iterator i = myObj.begin(); i.more(); ) {
                BSONElement e = i.next();
                ...
            }
        */
        BSONObjIterator begin() const;

        void appendSelfToBufBuilder(BufBuilder& b) const {
            verify( objsize() );
            b.appendBuf(reinterpret_cast<const void *>( objdata() ), objsize());
        }

#pragma pack(1)
        class Holder : boost::noncopyable {
        private:
            Holder(); // this class should never be explicitly created
            AtomicUInt refCount;
        public:
            char data[4]; // start of object

            void zero() { refCount.zero(); }

            // these are called automatically by boost::intrusive_ptr
            friend void intrusive_ptr_add_ref(Holder* h) { h->refCount++; }
            friend void intrusive_ptr_release(Holder* h) {
#if defined(_DEBUG) // cant use dassert or DEV here
                verify((int)h->refCount > 0); // make sure we haven't already freed the buffer
#endif
                if(--(h->refCount) == 0){
#if defined(_DEBUG)
                    unsigned sz = (unsigned&) *h->data;
                    verify(sz < BSONObjMaxInternalSize * 3);
                    memset(h->data, 0xdd, sz);
#endif
                    free(h);
                }
            }
        };
#pragma pack()

    BSONObj(const BSONObj &rO):
        _objdata(rO._objdata), _holder(rO._holder) {
        }

    BSONObj &operator=(const BSONObj &rRHS) {
        if (this != &rRHS) {
            _objdata = rRHS._objdata;
            _holder = rRHS._holder;
        }
        return *this;
    }

    private:
        const char *_objdata;
        boost::intrusive_ptr< Holder > _holder;

        void _assertInvalid() const;

        void init(Holder *holder) {
            _holder = holder; // holder is now managed by intrusive_ptr
            init(holder->data);
        }
        void init(const char *data) {
            _objdata = data;
            if ( !isValid() )
                _assertInvalid();
        }
    };

    std::ostream& operator<<( std::ostream &s, const BSONObj &o );
    std::ostream& operator<<( std::ostream &s, const BSONElement &e );

    StringBuilder& operator<<( StringBuilder &s, const BSONObj &o );
    StringBuilder& operator<<( StringBuilder &s, const BSONElement &e );

    struct BSONArray : BSONObj {
        // Don't add anything other than forwarding constructors!!!
        BSONArray(): BSONObj() {}
        explicit BSONArray(const BSONObj& obj): BSONObj(obj) {}
    };

}


text:
package org.eclipse.net4j.internal.util.om.pref;

import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.om.pref.OMPreferencesChangeEvent;

/**
 * @author Eike Stepper
 */
public final class PreferencesChangeEvent<T> extends Event implements OMPreferencesChangeEvent<T>
{
  private static final long serialVersionUID = 1L;

  private Preference<T> preference;

  private T oldValue;

  private T newValue;

  public PreferencesChangeEvent(Preference<T> preference, T oldValue, T newValue)
  {
    super(preference.getPreferences());
    this.preference = preference;
    this.oldValue = oldValue;
    this.newValue = newValue;
  }

  @Override
  public Preferences getSource()
  {
    return (Preferences)super.getSource();
  }

  public Preference<T> getPreference()
  {
    return preference;
  }

  public T getOldValue()
  {
    return oldValue;
  }

  public T getNewValue()
  {
    return newValue;
  }
}

redpajama_set_name: RedPajamaGithub


text:
#include <aws/cloudtrail/model/InsightSelector.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace CloudTrail
{
namespace Model
{

InsightSelector::InsightSelector() :
    m_insightType(InsightType::NOT_SET),
    m_insightTypeHasBeenSet(false)
{
}

InsightSelector::InsightSelector(JsonView jsonValue) :
    m_insightType(InsightType::NOT_SET),
    m_insightTypeHasBeenSet(false)
{
  *this = jsonValue;
}

InsightSelector& InsightSelector::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("InsightType"))
  {
    m_insightType = InsightTypeMapper::GetInsightTypeForName(jsonValue.GetString("InsightType"));

    m_insightTypeHasBeenSet = true;
  }

  return *this;
}

JsonValue InsightSelector::Jsonize() const
{
  JsonValue payload;

  if(m_insightTypeHasBeenSet)
  {
   payload.WithString("InsightType", InsightTypeMapper::GetNameForInsightType(m_insightType));
  }

  return payload;
}

} // namespace Model
} // namespace CloudTrail
} // namespace Aws


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="brainbits.transcoder.decoder.7z.executable">7z</parameter>
        <parameter key="brainbits.transcoder.decoder.7z.class">Brainbits\Transcoder\Decoder\SevenzDecoder</parameter>
        <parameter key="brainbits.transcoder.decoder.bzip2.class">Brainbits\Transcoder\Decoder\Bzip2Decoder</parameter>
        <parameter key="brainbits.transcoder.decoder.deflate.class">Brainbits\Transcoder\Decoder\DeflateDecoder</parameter>
        <parameter key="brainbits.transcoder.decoder.gzip.class">Brainbits\Transcoder\Decoder\GzipDecoder</parameter>
        <parameter key="brainbits.transcoder.decoder.null.class">Brainbits\Transcoder\Decoder\NullDecoder</parameter>
        <parameter key="brainbits.transcoder.decoder.resolver.class">Brainbits\Transcoder\Decoder\DecoderResolver</parameter>
    </parameters>

    <services>

        <service id="brainbits.transcoder.decoder.7z" class="%brainbits.transcoder.decoder.7z.class%">
            <argument>%brainbits.transcoder.decoder.7z.executable%</argument>
            <tag name="transcoder.decoder"/>
        </service>

        <service id="brainbits.transcoder.decoder.bzip2" class="%brainbits.transcoder.decoder.bzip2.class%">
            <tag name="transcoder.decoder"/>
        </service>

        <service id="brainbits.transcoder.decoder.deflate" class="%brainbits.transcoder.decoder.deflate.class%">
            <tag name="transcoder.decoder"/>
        </service>

        <service id="brainbits.transcoder.decoder.gzip" class="%brainbits.transcoder.decoder.gzip.class%">
            <tag name="transcoder.decoder"/>
        </service>

        <service id="brainbits.transcoder.decoder.null" class="%brainbits.transcoder.decoder.null.class%">
            <tag name="transcoder.decoder"/>
        </service>

        <service id="brainbits.transcoder.decoder.resolver" class="%brainbits.transcoder.decoder.resolver.class%">
            <argument type="collection" />
        </service>

    </services>

</container>


text:
<?php

declare(strict_types=1);

namespace Jose\Bundle\JoseFramework\DependencyInjection\Source\KeyManagement\JWKSource;

use Jose\Bundle\JoseFramework\DependencyInjection\Source\AbstractSource;
use Jose\Component\Core\JWK;
use Jose\Component\KeyManagement\JWKFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class KeyFile extends AbstractSource implements JWKSource
{
    public function createDefinition(ContainerBuilder $container, array $config): Definition
    {
        $definition = new Definition(JWK::class);
        $definition->setFactory([new Reference(JWKFactory::class), 'createFromKeyFile']);
        $definition->setArguments([$config['path'], $config['password'], $config['additional_values']]);
        $definition->addTag('jose.jwk');

        return $definition;
    }

    public function getKey(): string
    {
        return 'file';
    }

    public function addConfiguration(NodeDefinition $node): void
    {
        parent::addConfiguration($node);
        $node
            ->children()
            ->scalarNode('path')
            ->info('Path of the key file.')
            ->isRequired()
            ->end()
            ->scalarNode('password')
            ->info('Password used to decrypt the key (optional).')
            ->defaultNull()
            ->end()
            ->arrayNode('additional_values')
            ->info('Additional values to be added to the key.')
            ->defaultValue([])
            ->useAttributeAsKey('key')
            ->variablePrototype()
            ->end()
            ->end()
            ->end();
    }
}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* ServerVersionCommand.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using JetBrains.Annotations;

#endregion

namespace ManagedIrbis.Infrastructure.ClientCommands
{
    /// <summary>
    ///
    /// </summary>
    [PublicAPI]
    public class ServerVersionCommand
        : ClientCommand
    {
        #region Properties

        /// <summary>
        /// Result.
        /// </summary>
        [CanBeNull]
        public IrbisVersion Result { get; set; }

        #endregion

        #region ClientCommand members

        /// <inheritdoc cref="ClientCommand.Execute(ClientContext)" />
        public override void Execute
            (
                ClientContext context
            )
        {
            CreateQuery(context, CommandCode.ServerInfo);
            ServerResponse response = BaseExecute(context);
            CheckResponse(response);
            Result = IrbisVersion.ParseServerResponse(response);
        }

        #endregion
    }
}


text:
<?php

//initate orcid_login class
include('classes/orcid_login.class.php');

//add metatags
$head['meta']['title'] = "Nanodesk";
$head['meta']['description'] = "Nanodeks, publish nanopublications with ease";
$head['meta']['robots'] = "index, follow";

//add additional files
#$head['add_files'] = [['<style,script,custom>',"<file path>"]];

//$login->check_login();

// if( ! $login->get_login_info('id') )
// {
// 	$current_url = rawurlencode($_SERVER[REQUEST_URI]);
// 	header('Location: '.$login->login_url.'&next='.rawurlencode($current_url));
// }

?>


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenProtocolInterpreter.ParameterSet;
using System.Linq;

namespace MIDTesters.ParameterSet
{
    [TestClass]
    public class TestMid0016 :MidTester
    {
        [TestMethod]
        public void Mid0016Revision1()
        {
            string package = "00200016            ";
            var mid = _midInterpreter.Parse(package);

            Assert.AreEqual(typeof(Mid0016), mid.GetType());
            Assert.AreEqual(package, mid.Pack());
        }

        [TestMethod]
        public void Mid0016ByteRevision1()
        {
            string package = "00200016            ";
            byte[] bytes = GetAsciiBytes(package);
            var mid = _midInterpreter.Parse(bytes);

            Assert.AreEqual(typeof(Mid0016), mid.GetType());
            Assert.IsTrue(mid.PackBytes().SequenceEqual(bytes));
        }
    }
}


text:
package io.joynr.capabilities;

import java.util.Collection;
import java.util.Optional;

import joynr.types.DiscoveryEntryWithMetaInfo;
import joynr.types.DiscoveryError;

/**
 * Callback interface used by arbitrators to generate callbacks for capability
 * lookup.
 */
public interface CapabilitiesCallback {
    void processCapabilitiesReceived(Optional<Collection<DiscoveryEntryWithMetaInfo>> capabilities);

    void onError(Throwable e);

    void onError(DiscoveryError error);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Debugging with GDB: List of Supported Calls</title>

<meta name="description" content="Debugging with GDB: List of Supported Calls">
<meta name="keywords" content="Debugging with GDB: List of Supported Calls">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension" rel="up" title="File-I/O Remote Protocol Extension">
<link href="open.html#open" rel="next" title="open">
<link href="Console-I_002fO.html#Console-I_002fO" rel="prev" title="Console I/O">

Next: Protocol-specific Representation of Datatypes, Previous: Console I/O, Up: File-I/O Remote Protocol Extension   [Contents][Index]

E.13.7 List of Supported Calls

• open:

• close:

• read:

• write:

• lseek:

• rename:

• unlink:

• stat/fstat:

• gettimeofday:

• isatty:

• system:


text:
package com.swfarm.biz.wish.web;

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

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.swfarm.biz.product.bo.SkuLifeCyclePhases;
import com.swfarm.biz.product.bo.StockKeepingUnit;
import com.swfarm.biz.product.srv.ProductQueryService;
import com.swfarm.biz.wish.bo.WishProduct;
import com.swfarm.biz.wish.dto.SearchWishProductsCriteria;
import com.swfarm.biz.wish.srv.WishService;

public class BatchOfflineWishProductsController extends AbstractController {

	private WishService wishService;

	private ProductQueryService productQueryService;

	public void setWishService(WishService wishService) {
		this.wishService = wishService;
	}

	public void setProductQueryService(ProductQueryService productQueryService) {
		this.productQueryService = productQueryService;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		String[] productIdArr = req.getParameterValues("wishProductId");
		SearchWishProductsCriteria criteria = null;
		List<WishProduct> wishProducts = null;
		if (!ArrayUtils.isEmpty(productIdArr)) {
			criteria = new SearchWishProductsCriteria();
			List<String> productIds = new ArrayList<String>();
			for (int i = 0; i < productIdArr.length; i++) {
				Long productId = null;
				if (StringUtils.isNotEmpty(productIdArr[i])){
					productIds.add(productIdArr[i]);
				}
			}
			criteria.setProductIds(productIds);
			criteria.setIsOffline(false);
			wishProducts = this.wishService.searchWishProducts(criteria);
		}
		if (CollectionUtils.isNotEmpty(wishProducts)) {
			logger.warn("wishProducts size [" + wishProducts.size() + "]");
			for (Iterator<WishProduct> iter = wishProducts.iterator(); iter.hasNext();) {
				WishProduct wishProduct = iter.next();
				String accountNumber = wishProduct.getAccountNumber();
				this.wishService.disableProduct(wishProduct.getAccountNumber(), wishProduct);
				this.wishService.retrieveProduct(accountNumber, wishProduct);

				// 批量中止按钮:无论什么状态都可以下线。 批量中止变体按钮:清仓/暂停/停产/存档/休假状态的可以中止

				/*List skuArticleNumbers = wishProduct.getSkuArticleNumberList();
				String accountNumber = wishProduct.getAccountNumber();
				if (CollectionUtils.isNotEmpty(skuArticleNumbers)) {
					if (this.checkClearance(skuArticleNumbers) == true) {
						try {
							this.wishService.disableProduct(wishProduct.getAccountNumber(), wishProduct);
							this.wishService.retrieveProduct(accountNumber, wishProduct);
						} catch (Exception e) {
							logger.warn(e.getMessage(), e);
						}
					}
				}*/
			}
		}
		return new ModelAndView("redirect:/wish/search_wishproducts.shtml");
	}

	private Boolean checkClearance(List articleNumbers) {
		Boolean result = true;
		List stockKeepingUnits = this.productQueryService.findStockKeepingUnitsByArticleNumbers(articleNumbers);
		if (CollectionUtils.isNotEmpty(stockKeepingUnits)) {
			String[] normalPhases = new String[] { SkuLifeCyclePhases.getPhase(SkuLifeCyclePhases.PHASE_NEW)[0],
					SkuLifeCyclePhases.getPhase(SkuLifeCyclePhases.PHASE_NORMAL)[0] };
			String[] clearancePhases = new String[] {
					SkuLifeCyclePhases.getPhase(SkuLifeCyclePhases.PHASE_CLEARANCE)[0],
					SkuLifeCyclePhases.getPhase(SkuLifeCyclePhases.PHASE_STOP)[0] };
			for (Iterator iter = stockKeepingUnits.iterator(); iter.hasNext();) {
				StockKeepingUnit stockKeepingUnit = (StockKeepingUnit) iter.next();
				if (ArrayUtils.contains(normalPhases, stockKeepingUnit.getSkuLifeCyclePhase())) {
					result = false;
					break;
				}
			}
		} else {
			result = false;
		}
		return result;
	}

}


text:
package com.github.addon.metrics.decorator.timer;

import com.codahale.metrics.Counter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import com.github.addon.metrics.decorator.MaximumThresholdExceedingCounter;
import com.github.addon.metrics.decorator.MinimumThresholdExceedingCounter;
import com.github.addon.metrics.decorator.UpdateListener;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class TimerDecoratorBuilder {

    private final List<UpdateListener> listeners = new ArrayList<>();
    private final Timer timer;

    public TimerDecoratorBuilder(Timer timer) {
        this.timer = Objects.requireNonNull(timer);
    }

    public Timer build() {
        return new TimerDecorator(timer, listeners);
    }

    public Timer buildAndRegister(String name, MetricRegistry registry) {
        Timer timer = build();
        registry.register(name, timer);
        return timer;
    }

    public TimerDecoratorBuilder withMinimumThreshold(Counter exceedingCounter, Duration thresholdDuration) {
        listeners.add(new MinimumThresholdExceedingCounter(exceedingCounter, thresholdDuration.toNanos()));
        return this;
    }

    public TimerDecoratorBuilder withMaximumThreshold(Counter exceedingCounter, Duration thresholdDuration) {
        listeners.add(new MaximumThresholdExceedingCounter(exceedingCounter, thresholdDuration.toNanos()));
        return this;
    }

}


text:
layout: page
title: Dalton Swift Aerospace Conference
date: 2016-05-24
author: Melissa Vaughn
tags: weekly links, java
status: published
summary: Ut consequat risus non porttitor efficitur.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 04/16/2019
  endDate: 04/21/2019
  ctyhocn: CVGKYHX
  groupCode: DSAC
published: true
---
Nulla placerat felis iaculis malesuada condimentum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi scelerisque fermentum justo, nec porttitor nisi cursus a. Maecenas rhoncus rutrum ex, in luctus dui fermentum nec. Morbi finibus non justo et fermentum. Nulla eget justo a ipsum pellentesque sollicitudin. Phasellus hendrerit elit ligula, nec pharetra tellus rhoncus eget. Donec sollicitudin lacinia erat, et egestas dolor semper at. Mauris efficitur est vel dui dictum, non tincidunt risus mollis. In vulputate neque ut aliquam convallis. Nullam non mauris tristique, finibus massa ut, consequat leo.

* Sed vitae lacus non ipsum viverra dictum ut feugiat ex
* Quisque suscipit lorem venenatis magna tristique venenatis.

Praesent nec leo sed velit porta porttitor. Fusce metus nunc, pretium id congue non, molestie id neque. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam gravida non eros vel tempor. Duis et dictum lectus, non semper leo. Pellentesque sed tellus posuere, hendrerit dui sit amet, lacinia nunc. Sed lacinia commodo finibus. Phasellus iaculis auctor lobortis. In finibus augue at nisl euismod, sed pulvinar odio dictum. Donec semper magna ut convallis commodo. Cras rhoncus dolor eu leo tempus rutrum.


text:
package testcase;

import java.util.Arrays;

import annotations.MUTABLE;

public class AGT248_ParameterInstanceVariableArrayComponent_ThisInstanceVariableArrayComponent {

	@MUTABLE
	public Test test = new Test();

	public static void main(String[] args) {
		new AGT248_ParameterInstanceVariableArrayComponent_ThisInstanceVariableArrayComponent().foo();
	}

	public void foo(){
		System.out.println(test);
		test.bar(new Test());
		System.out.println(test);
	}

}

class Test {
	public Object[] f = new Object[]{ new Object() };

	public void bar(Test p){
		this.f[0] = p.f[0];
	}

	@Override
	public String toString() {
		return "Test [f=" + Arrays.toString(f) + "]";
	}
}


text:
*****
Numba
*****

.. image:: https://badges.gitter.im/numba/numba.svg
   :target: https://gitter.im/numba/numba?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
   :alt: Gitter

.. image:: https://img.shields.io/badge/discuss-on%20discourse-blue
   :target: https://numba.discourse.group/
   :alt: Discourse

.. image:: https://zenodo.org/badge/3659275.svg
   :target: https://zenodo.org/badge/latestdoi/3659275
   :alt: Zenodo DOI

A Just-In-Time Compiler for Numerical Functions in Python
#########################################################

Numba is an open source, NumPy-aware optimizing compiler for Python sponsored
by Anaconda, Inc.  It uses the LLVM compiler project to generate machine code
from Python syntax.

Numba can compile a large subset of numerically-focused Python, including many
NumPy functions.  Additionally, Numba has support for automatic
parallelization of loops, generation of GPU-accelerated code, and creation of
ufuncs and C callbacks.

For more information about Numba, see the Numba homepage:
https://numba.pydata.org

Supported Platforms
===================

* Operating systems and CPUs:

  - Linux: x86 (32-bit), x86_64, ppc64le (POWER8 and 9), ARMv7 (32-bit),
    ARMv8 (64-bit)
  - Windows: x86, x86_64
  - macOS: x86_64, (M1/Arm64, unofficial support only)
  - \*BSD: (unofficial support only)

* (Optional) Accelerators and GPUs:

  * NVIDIA GPUs (Kepler architecture or later) via CUDA driver on Linux, Windows,
    macOS (< 10.14)
  * AMD GPUs via ROCm driver on Linux

Dependencies
============

* Python versions: 3.7-3.9
* llvmlite 0.36.*
* NumPy >=1.15 (can build with 1.11 for ABI compatibility)

Optionally:

* SciPy >=1.0.0 (for ``numpy.linalg`` support)

Installing
==========

The easiest way to install Numba and get updates is by using the Anaconda
Distribution: https://www.anaconda.com/download

::

   $ conda install numba

For more options, see the Installation Guide: https://numba.readthedocs.io/en/stable/user/installing.html

Documentation
=============

https://numba.readthedocs.io/en/stable/index.html

Mailing Lists
=============

Join the Numba mailing list numba-users@continuum.io:
https://groups.google.com/a/continuum.io/d/forum/numba-users

Some old archives are at: http://librelist.com/browser/numba/

Continuous Integration
======================

.. image:: https://dev.azure.com/numba/numba/_apis/build/status/numba.numba?branchName=master
    :target: https://dev.azure.com/numba/numba/_build/latest?definitionId=1?branchName=master
    :alt: Azure Pipelines


text:
package com.fsck.k9.notification;

import com.fsck.k9.Account;

class NotificationIds {
    private static final int OFFSET_SEND_FAILED_NOTIFICATION = 0;
    private static final int OFFSET_CERTIFICATE_ERROR_INCOMING = 1;
    private static final int OFFSET_CERTIFICATE_ERROR_OUTGOING = 2;
    private static final int OFFSET_AUTHENTICATION_ERROR_INCOMING = 3;
    private static final int OFFSET_AUTHENTICATION_ERROR_OUTGOING = 4;
    private static final int OFFSET_FETCHING_MAIL = 5;
    private static final int OFFSET_NEW_MAIL_SUMMARY = 6;

    private static final int OFFSET_NEW_MAIL_STACKED = 7;

    private static final int NUMBER_OF_DEVICE_NOTIFICATIONS = 7;
    private static final int NUMBER_OF_STACKED_NOTIFICATIONS = NotificationData.MAX_NUMBER_OF_STACKED_NOTIFICATIONS;
    private static final int NUMBER_OF_NOTIFICATIONS_PER_ACCOUNT = NUMBER_OF_DEVICE_NOTIFICATIONS +
            NUMBER_OF_STACKED_NOTIFICATIONS;

    public static int getNewMailSummaryNotificationId(Account account) {
        return getBaseNotificationId(account) + OFFSET_NEW_MAIL_SUMMARY;
    }

    public static int getNewMailStackedNotificationId(Account account, int index) {
        if (index < 0 || index >= NUMBER_OF_STACKED_NOTIFICATIONS) {
            throw new IndexOutOfBoundsException("Invalid value: " + index);
        }

        return getBaseNotificationId(account) + OFFSET_NEW_MAIL_STACKED + index;
    }

    public static int getFetchingMailNotificationId(Account account) {
        return getBaseNotificationId(account) + OFFSET_FETCHING_MAIL;
    }

    public static int getSendFailedNotificationId(Account account) {
        return getBaseNotificationId(account) + OFFSET_SEND_FAILED_NOTIFICATION;
    }

    public static int getCertificateErrorNotificationId(Account account, boolean incoming) {
        int offset = incoming ? OFFSET_CERTIFICATE_ERROR_INCOMING : OFFSET_CERTIFICATE_ERROR_OUTGOING;
        return getBaseNotificationId(account) + offset;
    }

    public static int getAuthenticationErrorNotificationId(Account account, boolean incoming) {
        int offset = incoming ? OFFSET_AUTHENTICATION_ERROR_INCOMING : OFFSET_AUTHENTICATION_ERROR_OUTGOING;
        return getBaseNotificationId(account) + offset;
    }

    private static int getBaseNotificationId(Account account) {
        return account.getAccountNumber() * NUMBER_OF_NOTIFICATIONS_PER_ACCOUNT;
    }
}


text:
class HistoryRestorer
  def self.restore(folder)
    channels_json = File.read(folder + "channels.json")
    channels = Oj.load(channels_json)
    channels.each do |json_channel|
      puts "Restoring #{json_channel['name']}"
      channel = ChannelBuilder.build_from_json(json_channel)
      channel.save! if channel.new_record? || channel.changed?

      Dir.foreach(folder + json_channel["name"]) do |channel_file_name|
        next if (channel_file_name == ".") || (channel_file_name == "..")

        channel_json = File.read(folder + json_channel["name"] + channel_file_name)
        messages = Oj.load(channel_json)
        MessageAdder.add(messages, channel)
      end
      puts "Restoring for #{json_channel['name']} has finished"
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.mortbay.jetty.testing (Jetty Server Project 6.1.22 API)
</TITLE>

<META NAME="keywords" CONTENT="org.mortbay.jetty.testing package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../javadoc.css" TITLE="Style">

org.mortbay.jetty.testing

Classes

HttpTester

ServletTester


text:
pub mod tile;
pub mod game;
pub mod dungeon;
pub mod map;
pub mod ui;
pub mod texture_holder;
pub mod player;
pub mod util;
pub mod font_holder;
pub mod asset_holder;
pub mod actor;


text:
<?php

/*
 *This is a Frontcontroller: me-page
 *
*/

require __DIR__.'/config_with_app.php';

// Create services and inject into the app.
$di  = new \Anax\DI\CDIFactoryDefault();

$di->setShared('db', function() {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/database_sqlite.php');
    $db->connect();
    return $db;
});

$di->set('UsersController', function() use ($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);
    return $controller;
});

$di->set('CommentController', function() use ($di) {
    $controller = new \Anax\Comment\CommentController();
    $controller->setDI($di);
    return $controller;
});

$di->set('QuestionController', function() use ($di) {
    $controller = new \Anax\Question\QuestionController();
    $controller->setDI($di);
    return $controller;
});

$di->set('TagController', function() use ($di) {
    $controller = new \Anax\Tag\TagController();
    $controller->setDI($di);
    return $controller;
});

$di->set('AnswerController', function() use ($di) {
    $controller = new \Anax\Answer\AnswerController();
    $controller->setDI($di);
    return $controller;
});

$di->set('flash', function() {
    $flash = new \Todda\CFlashMessage\CFlashMessage();
    return $flash;
});

$app = new \Anax\Kernel\CAnax($di);

// Set Url-type
$app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN);

// Include navbar
$app->navbar->configure(ANAX_APP_PATH . 'config/navbar_me.php');

// Choose new config-file
$app->theme->configure(ANAX_APP_PATH . 'config/theme_me.php');

$app->router->add('', function() use ($app) {

    $app->theme->setTitle('Start');

    $content = $app->fileContent->get('start.md');
    $content = $app->textFilter->doFilter($content, 'shortcode, markdown');

    $app->views->add('me/page', [
        'content' => $content,
        ]);

	$app->dispatcher->forward([
		'controller' => 'question',
		'action'     => 'displayLatestQuestions',
    ]);

	$app->dispatcher->forward([
		'controller' => 'users',
		'action'     => 'displayMostActiveUsers',
    ]);

	$app->dispatcher->forward([
		'controller' => 'tag',
		'action'     => 'displayMostPopularTags',
    ]);

});

$app->router->add('comments', function() use ($app) {

    $app->theme->setTitle("Kommentarer");
    $app->views->add('comment/index');

    $app->dispatcher->forward([
        'controller' => 'comment',
        'action'     => 'view',
		'params'     => ['comments'],
    ]);

    $app->dispatcher->forward([
        'controller' => 'comment',
        'action'     => 'add',
		'params'     => ['comments'],
    ]);

});

$app->router->add('questions', function() use ($app) {

    $app->theme->setTitle("Questions");
    //$app->views->add('comment/index');

    $app->dispatcher->forward([
        'controller' => 'question',
        'action'     => 'view',
    ]);

});

$app->router->add('tags', function() use ($app) {

    $app->theme->setTitle("Tags");
    //$app->views->add('comment/index');

    $app->dispatcher->forward([
        'controller' => 'tag',
        'action'     => 'view',
    ]);

});

$app->router->add('users', function() use ($app) {

    $app->theme->setTitle("Users");
    $app->views->add('default/page', [
        'title' => "Användare",
        'content' => "Här finns alla alternativ för användarhantering.",
        'links' => [
            [
                'href' => $app->url->create('users/list'),
                'text' => "Visa alla användare",
            ],
            [
                'href' => $app->url->create('users/add'),
                'text' => "Lägg till användare",
            ],
            [
                'href' => $app->url->create('users/trash'),
                'text' => "Papperskorgen",
            ],
            [
                'href' => $app->url->create('users/active'),
                'text' => "Aktiverade",
            ],
            [
                'href' => $app->url->create('users/login'),
                'text' => "login",
            ],

        ],
    ]);

});

$app->router->add('about', function() use ($app) {

    $app->theme->setTitle('About');

    $content = $app->fileContent->get('about.md');
    $content = $app->textFilter->doFilter($content, 'shortcode, markdown');

    $app->views->add('me/page', [
        'content' => $content,
        ]);

});

$app->router->add('source', function() use ($app) {

    $app->theme->addStylesheet('css/source.css');
    $app->theme->setTitle("Källkod");

    $source = new \Mos\Source\CSource([
        'secure_dir' => '..',
        'base_dir' => '..',
        'add_ignore' => ['.htaccess'],
    ]);

    $app->views->add('me/source', [
        'content' => $source->View(),
    ]);

});

// SETUP TABLES (and insert default users to usertable)

$app->router->add('setup', function() use ($app) {

    //$app->db->setVerbose();

    $app->db->dropTableIfExists('tag')->execute();

    $app->db->createTable(
        'tag',
        [
                'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
                'tag' => ['varchar(50)'],
                'questionId' => ['integer'],
        ]
    )->execute();

	$app->db->dropTableIfExists('answer')->execute();

    $app->db->createTable(
        'answer',
        [
                'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
                'answer' => ['varchar(300)'],
                'questionId' => ['integer'],
				'userId' => ['integer'],
				'created' => ['datetime'],
        ]
    )->execute();

    $app->db->dropTableIfExists('comment')->execute();

	$app->db->createTable(
        'comment',
        [
                'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
                'content' => ['varchar(300)'],
                'created' => ['datetime'],
                'questionId' => ['integer'],
                'answerId' => ['integer'],
                'userId' => ['integer'],
        ]
    )->execute();

    $app->db->dropTableIfExists('question')->execute();

    $app->db->createTable(
        'question',
        [
                'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
                'title' => ['varchar(100)'],
                'content' => ['varchar(300)'],
                'created' => ['datetime'],
                'userId' => ['integer'],
        ]
	)->execute();

    $app->db->dropTableIfExists('user')->execute();

    $app->db->createTable(
        'user',
        [
            'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
            'acronym' => ['varchar(20)', 'unique', 'not null'],
            'email' => ['varchar(80)'],
            'name' => ['varchar(80)'],
            'password' => ['varchar(255)'],
            'created' => ['datetime'],
            'updated' => ['datetime'],
            'deleted' => ['datetime'],
            'active' => ['datetime'],
			'loggs' => ['integer'],
        ]
    )->execute();

    $app->db->insert(
        'user',
        ['acronym', 'email', 'name', 'password', 'created', 'active', 'loggs']
    );

    $now = gmdate('Y-m-d H:i:s');

    $app->db->execute([
        'admin',
        'admin@dbwebb.se',
        'Administrator',
        password_hash('admin', PASSWORD_DEFAULT),
        $now,
        $now,
		'1',
    ]);

    $app->db->execute([
        'doe',
        'doe@dbwebb.se',
        'John/Jane Doe',
        password_hash('doe', PASSWORD_DEFAULT),
        $now,
        $now,
		'1',
    ]);

    $app->response->redirect('users/list');

});

$app->router->handle();
$app->theme->render();


text:
package org.properssl.sslcertx.mariadb.jdbc;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;

import org.properssl.sslcertx.mariadb.jdbc.internal.SQLExceptionMapper;
import org.properssl.sslcertx.mariadb.jdbc.internal.common.QueryException;
import org.properssl.sslcertx.mariadb.jdbc.internal.mysql.MySQLColumnInformation;
import org.properssl.sslcertx.mariadb.jdbc.internal.mysql.MySQLProtocol;
/**
 *
 * @author vvaintroub
 */
public class MySQLServerSidePreparedStatement implements PreparedStatement{

    String sql;
    MySQLConnection connection;
    int statementId;
    MySQLResultSetMetaData metadata;
    MySQLColumnInformation parameterInfo[];

    private void prepare(String sql) throws SQLException {
        try {
            MySQLProtocol protocol = connection.getProtocol();
            MySQLProtocol.PrepareResult result;
            synchronized(protocol) {
                if (protocol.hasUnreadData()) {
                    throw new  SQLException("There is an open result set on the current connection, "+
                    "which must be closed prior to executing a query");
                }
                result = protocol.prepare(sql);
            }
            metadata = new MySQLResultSetMetaData(result.columns, protocol.datatypeMappingFlags);
            parameterInfo =  result.parameters;
            statementId = result.statementId;
        } catch (QueryException e) {
            SQLExceptionMapper.throwException(e, connection, this);
        }
    }
    public MySQLServerSidePreparedStatement(MySQLConnection connection,String sql) throws SQLException {
        this.connection = connection;
        this.sql = sql;
        prepare(sql);
    }

    @Override
    public ResultSet executeQuery() throws SQLException {

        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int executeUpdate() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNull(int parameterIndex, int sqlType) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBoolean(int parameterIndex, boolean x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setByte(int parameterIndex, byte x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setShort(int parameterIndex, short x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setInt(int parameterIndex, int x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setLong(int parameterIndex, long x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setFloat(int parameterIndex, float x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setDouble(int parameterIndex, double x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setString(int parameterIndex, String x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBytes(int parameterIndex, byte[] x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setDate(int parameterIndex, Date x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setTime(int parameterIndex, Time x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void clearParameters() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setObject(int parameterIndex, Object x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean execute() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void addBatch() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setRef(int parameterIndex, Ref x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBlob(int parameterIndex, Blob x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setClob(int parameterIndex, Clob x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setArray(int parameterIndex, Array x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ResultSetMetaData getMetaData() throws SQLException {
        return metadata;
    }

    @Override
    public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setURL(int parameterIndex, URL x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ParameterMetaData getParameterMetaData() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setRowId(int parameterIndex, RowId x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNString(int parameterIndex, String value) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNClob(int parameterIndex, NClob value) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setClob(int parameterIndex, Reader reader) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setNClob(int parameterIndex, Reader reader) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ResultSet executeQuery(String sql) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int executeUpdate(String sql) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void close() throws SQLException {
        try {
            connection.getProtocol().closePreparedStatement(statementId);
        } catch(QueryException e) {
            SQLExceptionMapper.throwException(e, connection, this);
        }
    }

    @Override
    public int getMaxFieldSize() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setMaxFieldSize(int max) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getMaxRows() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setMaxRows(int max) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setEscapeProcessing(boolean enable) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getQueryTimeout() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setQueryTimeout(int seconds) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void cancel() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public SQLWarning getWarnings() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void clearWarnings() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setCursorName(String name) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean execute(String sql) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ResultSet getResultSet() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getUpdateCount() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean getMoreResults() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setFetchDirection(int direction) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getFetchDirection() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setFetchSize(int rows) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getFetchSize() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getResultSetConcurrency() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getResultSetType() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void addBatch(String sql) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void clearBatch() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int[] executeBatch() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Connection getConnection() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean getMoreResults(int current) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ResultSet getGeneratedKeys() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int executeUpdate(String sql, String[] columnNames) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean execute(String sql, int[] columnIndexes) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean execute(String sql, String[] columnNames) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getResultSetHoldability() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isClosed() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setPoolable(boolean poolable) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isPoolable() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public <T> T unwrap(Class<T> iface) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isWrapperFor(Class<?> iface) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /* new JDK 7 methods */
    public void closeOnCompletion() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean isCloseOnCompletion() {
          throw new UnsupportedOperationException("Not supported yet.");
    }

}


text:
/**
 * Created by kun
 */
var express = require('express');
var userDB = require('../database/userDB');
var validator = require('validator');
var async = require('async');
var result = require("../result");
var router = express.Router();

router.post('/login', function (req, res) {
    var username = req.param("username");
    var password = req.param("password");
    userDB.getUserInfo(username, password, function (err, recordSet) {
        if (!err) {
            var data = null;
            if (recordSet.length > 0) {
                data = recordSet[0];
                res.status(200).json(result(true, data, ""));
            } else {
                res.status(200).json(result(false, data, "未找到用户"));
            }
        } else {
            console.error(err);
            res.status(200).json(result(false, null, "登录时发生异常"));
        }
    });
});

router.post("/register", function (req, res) {
    var username = req.param("username");
    var password = req.param("password");
    userDB.register(username, password, function (err, recordSet) {
        if (!err) {
            userDB.getUserInfo(username, password, function (err, recordSet) {
                res.status(200).json(result(true, null, null));
            });
        } else {
            console.error(err);
            res.status(200).json(result(false, null, "注册用户失败"))
        }
    });
});

router.post("/update", function (req, res) {
    var uid = req.param("uid");
    var name = req.param("name");
    var email = req.param("email");
    var company = req.param("company");
    var tel = req.param("tel");
    userDB.update(uid, name, email, company, tel, function (err, recordSet) {
        if (!err) {
            res.status(200).json(result(true, null, null));
        } else {
            console.error(err);
            res.status(200).json(result(false, null, "更新用户信息失败"));
        }
    });
});

/**
 * 获取未处理的任务数
 */
router.get('/todo', function (req, res) {
    var uid = req.param("uid");
    userDB.getToDoCount(uid, function (err, recordSet) {
        if (!err) {
            var data = {};
            if (recordSet.length > 0) {
                data.editor = recordSet[0].editor_todo;
                data.external = recordSet[1].editor_todo;
                data.ceditor = recordSet[2].editor_todo;
                data.author = recordSet[3].editor_todo;
            }
            res.status(200).json(result(true, data, null));
        } else {
            console.error(err);
            res.status(200).json(result(false, null, null));
        }
    });
});

router.get('/mailCount', function (req, res) {
    var uid = req.param("uid");
    var lastId = req.param("lastId") || 0;
    userDB.getEmailCount(uid, lastId, function (err, recordSet) {
        if (!err) {
            var result = [];
            if (recordSet.length > 0) {
                for (var i=0;i<recordSet.length;i++) {
                    result[i] = recordSet[i];
                }
            }
            res.status(200).json({result: true, data: result});
        } else {
            console.error(err);
            res.status(200).json({result: false, data: "发生异常"});
        }
    });
});

module.exports = router;


text:
/* eslint no-console: 0 */

'use strict';

/*
This example sends a pregenerated MIME message instead of generating a new one
*/

var nodemailer = require('../lib/nodemailer');

// Create a SMTP transporter object
var transporter = nodemailer.createTransport({
    service: 'Gmail',
    auth: {
        user: 'test.nodemailer@gmail.com',
        pass: 'Nodemailer123'
    },
    logger: true, // log to console
    debug: true // include SMTP traffic in the logs
});

console.log('SMTP Configured');

// Message object
var message = {

    // provide pregenerated message
    raw: 'Content-Type: text/plain\r\n' +
        'Subject: test message\r\n'+
        '\r\n'+
        'Hello world!',

    // smtp envelope needs to be set
    envelope: {
        from: 'test.nodemailer@gmail.com',
        to: 'receiver@example.com'
    }
};

console.log('Sending Mail');
transporter.sendMail(message, function (error, info) {
    if (error) {
        console.log('Error occurred');
        console.log(error.message);
        return;
    }
    console.log('Message sent successfully!');
    console.log('Server responded with "%s"', info.response);
});


text:
#ifndef _WEBRTC_EVERYWHERE_UTILS_H_
#define _WEBRTC_EVERYWHERE_UTILS_H_

#include "_Config.h"
#include "_Common.h"

#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"

#include <map>

class _EncryptCtx;

class WEBRTC_EVERYWHERE_API _Utils
{
public:
    _Utils();
    virtual ~_Utils();

public:
	static WeError Initialize(WeError(*InitializeAdditionals) (void) = NULL);
	static WeError DeInitialize(void);
    static WeError StartDebug(void);
    static WeError StopDebug(void);

	static std::string ToString(long val);

	static bool RaiseCallback(LONGLONG handle, _BrowserCallback* cb);
	static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

    static long UniqueId();
    static const _UniqueObject* UniqueObjFind(long id);
    static void UniqueObjAdd(const _UniqueObject* obj);
    static void UniqueObjRemove(long id);

	static int ArrayBytesCount(_ArrayType arrayType);
	static bool ArrayIsFloatingPoint(_ArrayType arrayType);

	static cpp11::shared_ptr<_File> FileConfigGet(bool write = false);
	static WeError FileConfigGetKeyAndIV(const unsigned char* &key_ptr, size_t &key_size, const unsigned char* &iv_ptr, size_t &iv_size);
	static WeError FileConfigChanged(cpp11::shared_ptr<_File> file, bool &changed);
	static WeError FileConfigTrustedWebsiteAdd(const char* protocol, const char* host);
	static WeError FileConfigTrustedWebsiteExist(const char* protocol, const char* host, bool &exists);

	static WeError ConvertToBase64(const void* in_ptr, size_t in_size, void **out_pptr, size_t *out_size_ptr, void* (*MemAllocFn)(size_t n) = NULL);
	static WeError ConvertToBMP(const void* rgb32_ptr, size_t width, size_t height, void** bmp_pptr, size_t *bmp_size_ptr);
#if WE_UNDER_WINDOWS
	static HRESULT MsgBoxGUMA(bool &accepted, const char* protocol, const char* host, HWND hwndParent /*= NULL*/);
	static HRESULT MsgBoxGUM(bool &accepted, const TCHAR* protocol, const TCHAR* host, HWND hwndParent = NULL);
#elif WE_UNDER_APPLE
    static WeError MsgBoxGUM(bool &accepted, const char* protocol, const char* host);
#endif

	static void SetUserAgent(const char* userAgent);
	static const char* GetUserAgent();

    static rtc::Thread* GetInitThread() { return  s_InitThread; }

private:
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable:4251)
#endif
    static webrtc::CriticalSectionWrapper* s_unique_objs_cs;
    static std::map<long, const _UniqueObject*> s_unique_objs;
	static _FTIME s_time_config_modif;
	static cpp11::shared_ptr<_EncryptCtx> s_encrypt_ctx;
	static std::string s_UserAgent;
    static rtc::Thread* s_InitThread;
#if _MSC_VER
#pragma warning(pop)
#endif
};

#endif /* _WEBRTC_EVERYWHERE_UTILS_H_ */


text:
'use strict'

var bump = require('npm-version-bump')
var pkgio = require('package-json-io')
var cli = require('../cli')
var argv = require('../argv')

exports.run = function () {
  var cmd = argv._[1]

  if (!cmd) return cli.done(new Error('No version bump command specified'))

  bump(process.cwd(), cmd, cli.getAndStoreLocation, aftercommit)

  function aftercommit (err) {
    if (err) return cli.done(err)
    pkgio.read(function (err, pkg) {
      if (err) return cli.done(err)
      console.log('v%s @ %s/%s', pkg.version, pkg.coordinates[0], pkg.coordinates[1])
      cli.done()
    })
  }
}

exports.desc = 'Bump the version and update the coordinates in a single commit'

exports.help = 'Usage:\n' +
  '  geopkg version (<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease) [options]\n' +
  '\n' +
  'Options:\n' +
  '  -i       Interactive mode: Modify the location by dragging a pin on a map.'


text:
import logging

__version__ = '0.1.7'

class DistlibException(Exception):
    pass

try:
    from logging import NullHandler
except ImportError: # pragma: no cover
    class NullHandler(logging.Handler):
        def handle(self, record): pass
        def emit(self, record): pass

logger = logging.getLogger(__name__)
logger.addHandler(NullHandler())


text:
package cip.byteinputlexer;

/**
 * DirectiveBuilders ...
 */
public interface DirectiveBuilders {
    public IncludeBuilder   getIncludeBuilder();
    public LineBuilder      getLineBuilder();
    public DirectiveBuilder getPragmaBuilder();
}


text:
package org.clebi067.mailer.configuration;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;

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

public class Oauth2UserAuthenticationConverter
    implements org.springframework.security.oauth2.provider.token.UserAuthenticationConverter {

  @Override
  public Map<String, ?> convertUserAuthentication(Authentication userAuthentication) {
    Map<String, Object> map = new HashMap<>();
    map.put("username", userAuthentication.getPrincipal().toString());
    return map;
  }

  @Override
  public Authentication extractAuthentication(Map<String, ?> map) {
    Authentication auth = new UsernamePasswordAuthenticationToken(map.get("username"), "N/A", null);
    return auth;
  }
}


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl\nsPILoadGroupInternal.idl
 */

#ifndef __gen_nsPILoadGroupInternal_h__
#define __gen_nsPILoadGroupInternal_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIChannel; /* forward declaration */

/* starting interface:    nsPILoadGroupInternal */
#define NS_PILOADGROUPINTERNAL_IID_STR "6ef2f8ac-9584-48f3-957a-0c94fff0c8c7"

#define NS_PILOADGROUPINTERNAL_IID \
  {0x6ef2f8ac, 0x9584, 0x48f3, \
    { 0x95, 0x7a, 0x0c, 0x94, 0xff, 0xf0, 0xc8, 0xc7 }}

class NS_NO_VTABLE nsPILoadGroupInternal : public nsISupports {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_PILOADGROUPINTERNAL_IID)

  /* void OnEndPageLoad (in nsIChannel aDefaultChannel); */
  NS_IMETHOD OnEndPageLoad(nsIChannel *aDefaultChannel) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsPILoadGroupInternal, NS_PILOADGROUPINTERNAL_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSPILOADGROUPINTERNAL \
  NS_IMETHOD OnEndPageLoad(nsIChannel *aDefaultChannel) override;

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSPILOADGROUPINTERNAL(_to) \
  NS_IMETHOD OnEndPageLoad(nsIChannel *aDefaultChannel) override { return _to OnEndPageLoad(aDefaultChannel); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSPILOADGROUPINTERNAL(_to) \
  NS_IMETHOD OnEndPageLoad(nsIChannel *aDefaultChannel) override { return !_to ? NS_ERROR_NULL_POINTER : _to->OnEndPageLoad(aDefaultChannel); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public nsPILoadGroupInternal
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSPILOADGROUPINTERNAL

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS(_MYCLASS_, nsPILoadGroupInternal)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* void OnEndPageLoad (in nsIChannel aDefaultChannel); */
NS_IMETHODIMP _MYCLASS_::OnEndPageLoad(nsIChannel *aDefaultChannel)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#endif /* __gen_nsPILoadGroupInternal_h__ */


text:
import os
import sys
import numpy as np
from osgeo import osr, gdal
import tempfile
import pytest
import unittest
import subprocess
import shutil
import tests.utils as test_utils
import rastercube.jgrid as jgrid
import rastercube.jgrid.utils as jgrid_utils
import rastercube.utils as utils
import rastercube.datasources.modis as modis
import rastercube.gdal_utils as gdal_utils
from numpy.testing import assert_array_equal

def assert_grids_same(root1, root2):
    """
    Asserts that two jgrids are the same (same header, same data). This assert
    that the two grids have the same x/y chunking, but NOT necessarily the
    same date chunking
    """
    h1 = jgrid.load(root1)
    h2 = jgrid.load(root2)

    assert np.all(h1.timestamps_ms == h2.timestamps_ms)
    assert np.all(h1.shape == h2.shape)
    assert h1.num_fracs == h2.num_fracs

    fracs1 = h1.list_available_fracnums()
    fracs2 = h2.list_available_fracnums()
    assert np.all(fracs1 == fracs2)

    for frac_num in fracs1:
        data1 = h1.load_frac_by_num(frac_num)
        data2 = h2.load_frac_by_num(frac_num)
        assert_array_equal(data1, data2)

@pytest.mark.usefixtures("setup_env")
def test_complete_ndvi_worldgrid(tempdir):
    """
    Note that this is a quite long test

    Tests the complete_ndvi_worldgrid script by comparing the following :
    - Create a worldgrid using all the ndvi_dates (4 dates) in the testdata
      (grid1)
    - Create a worldgrid with ndvi_dates.2.csv, then append the 2 other dates
      using complete_ndvi_worldgrid
        - Once with frac_ndates = 3 (grid2)
        - Once with frac_ndates = 2 (grid3)
    - Create a worldgrid with ndvi_dates.3.csv, then append the 1 other date
      using complete_ndvi_worldgrid
        - With frac_ndates = 2 (grid4)
        - With frac_ndates = 4 (grid5)
    All 5 grids should contain the exact same data
    """
    create_script = os.path.join(test_utils.get_rastercube_dir(),
                                 'scripts', 'create_ndvi_worldgrid.py')
    complete_script = os.path.join(test_utils.get_rastercube_dir(),
                                   'scripts', 'complete_ndvi_worldgrid.py')

    dates_csv = os.path.join(utils.get_data_dir(), '1_manual',
                             'ndvi_dates.csv')
    dates_csv_2 = os.path.join(utils.get_data_dir(), '1_manual',
                               'ndvi_dates.2.csv')
    dates_csv_3 = os.path.join(utils.get_data_dir(), '1_manual',
                               'ndvi_dates.3.csv')

    def create(rootdir, frac_ndates, dates_csv):
        print 'Creating in %s' % rootdir
        cmd = [
            sys.executable,
            create_script,
            '--tile=h29v07',
            '--noconfirm',
            '--worldgrid=%s' % rootdir,
            '--frac_ndates=%d' % frac_ndates,
            '--dates_csv=%s' % dates_csv,
            # speed things up
            '--test_limit_fractions=2'
        ]
        subprocess.check_call(cmd)

    def complete(rootdir, dates_csv):
        print 'Completing %s' % rootdir
        cmd = [
            sys.executable,
            complete_script,
            '--tile=h29v07',
            '--noconfirm',
            '--worldgrid=%s' % rootdir,
            '--dates_csv=%s' % dates_csv
        ]
        subprocess.check_call(cmd)

    roots = [os.path.join(tempdir, 'grid%d' % n) for n in range(5)]

    create(roots[0], frac_ndates=2, dates_csv=dates_csv)

    create(roots[1], frac_ndates=3, dates_csv=dates_csv_2)
    complete(roots[1], dates_csv)
    # Complete must be idempotent
    complete(roots[1], dates_csv)

    create(roots[2], frac_ndates=2, dates_csv=dates_csv_2)
    complete(roots[2], dates_csv)

    create(roots[3], frac_ndates=2, dates_csv=dates_csv_3)
    complete(roots[3], dates_csv)

    create(roots[4], frac_ndates=3, dates_csv=dates_csv_3)
    complete(roots[4], dates_csv)

    for i in range(1, 5):
        for dsname in ['ndvi', 'qa']:
            assert_grids_same(os.path.join(roots[0], dsname),
                              os.path.join(roots[i], dsname))


text:
#!/bin/bash

# Copyright 2015 The Bazel Authors. All rights reserved.
#
# 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.

set -eu

# This is a script which is installed instead of the real Bazel binary.
# It looks for a tools/bazel executable next to the containing WORKSPACE
# file and runs that. If that's not found, it runs the real Bazel binary which
# is installed next to this script as bazel-real.

# `readlink -f` that works on OSX too.
function get_realpath() {
    if [ "$(uname -s)" == "Darwin" ]; then
        local queue="$1"
        if [[ "${queue}" != /* ]] ; then
            # Make sure we start with an absolute path.
            queue="${PWD}/${queue}"
        fi
        local current=""
        while [ -n "${queue}" ]; do
            # Removing a trailing /.
            queue="${queue#/}"
            # Pull the first path segment off of queue.
            local segment="${queue%%/*}"
            # If this is the last segment.
            if [[ "${queue}" != */* ]] ; then
                segment="${queue}"
                queue=""
            else
                # Remove that first segment.
                queue="${queue#*/}"
            fi
            local link="${current}/${segment}"
            if [ -h "${link}" ] ; then
                link="$(readlink "${link}")"
                queue="${link}/${queue}"
                if [[ "${link}" == /* ]] ; then
                    current=""
                fi
            else
                current="${link}"
            fi
        done

        echo "${current}"
    else
        readlink -f "$1"
    fi
}

BAZEL_REAL="$(dirname "$(get_realpath "${BASH_SOURCE[0]}")")/bazel-real"
export BAZEL_REAL

WORKSPACE_DIR="${PWD}"
while [[ "${WORKSPACE_DIR}" != / ]]; do
    if [[ -e "${WORKSPACE_DIR}/WORKSPACE" ]]; then
      break;
    fi
    WORKSPACE_DIR="$(dirname "${WORKSPACE_DIR}")"
done
readonly WORKSPACE_DIR

if [[ -e "${WORKSPACE_DIR}/WORKSPACE" ]]; then
  readonly WRAPPER="${WORKSPACE_DIR}/tools/bazel"

  if [[ -x "${WRAPPER}" && ! -d "${WRAPPER}" ]]; then
    exec -a "$0" "${WRAPPER}" "$@"
  fi
fi

if [[ ! -x "${BAZEL_REAL}" ]]; then
    echo "Failed to find underlying Bazel executable at ${BAZEL_REAL}" >&2
    exit 1
fi

exec -a "$0" "${BAZEL_REAL}" "$@"


text:
%w[httpd pulp_workers pulp_celerybeat pulp_resource_manager].each do |svc|
  describe service(svc) do
    it { should be_installed }
    it { should be_enabled }
    it { should be_running }
  end
end


text:
<md-card-header class="power-card-header" ng-click="perk.expanded = !perk.expanded" layout="row">
  <md-card-avatar>

  </md-card-avatar>
  <md-card-header-text flex>
    {{::perk.name}}
  </md-card-header-text>
</md-card-header>
<md-card-content class="power-card-description" ng-if="perk.expanded">

Requirements

</md-card-content>
<md-card-actions layout="row" layout-align="end center">
  <md-button class="md-icon-button" aria-label="Delete" ng-click="ctrl.removePerk(perk, $event)">
    <md-icon>delete</md-icon>
    <md-tooltip>Delete this Perk</md-tooltip>
  </md-button>
</md-card-actions>


text:
package com.intel.analytics.bigdl.dllib.utils.tf.loaders

import com.intel.analytics.bigdl.dllib.tensor.Tensor
import com.intel.analytics.bigdl.dllib.utils.tf.Tensorflow.typeAttr
import com.intel.analytics.bigdl.dllib.utils.tf.TensorflowSpecHelper
import org.tensorflow.framework.{DataType, NodeDef}

class SignSpec extends TensorflowSpecHelper {
  "Sign" should "be correct for float tensor" in {
    val t = Tensor[Float](32, 32).rand()
    t.setValue(1, 1, -1)
    t.setValue(1, 2, -3)
    t.setValue(1, 4, -2)
    t.setValue(2, 2, Float.PositiveInfinity)
    t.setValue(2, 3, Float.NegativeInfinity)
    t.setValue(4, 5, Float.NaN)
    compare[Float](
      NodeDef.newBuilder()
        .setName("sign_test")
        .putAttr("T", typeAttr(DataType.DT_FLOAT))
        .setOp("Sign"),
      Seq(t),
      0
    )
  }
}


text:
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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.
  -->
<action name='user-action' xmlns="uri:oozie:workflow:0.3">
    <sub-workflow>
        <app-path>#USER_WF_PATH#</app-path>
        <propagate-configuration/>
    </sub-workflow>
    <ok to="succeeded-post-processing"/>
    <error to="failed-post-processing"/>
</action>


text:
$packageName = 'PSWindowsUpdate' # arbitrary name for the package, used in messages
$url = '{{DownloadUrl}}' # download url
$url64 = '{{DownloadUrl}}' # 64bit URL

try {
  $installDir = Join-Path $PSHome "Modules"

  Install-ChocolateyZipPackage "$packageName" "$url" "$installDir" "$url64"

  Write-ChocolateySuccess "$packageName"
} catch {
  Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
  throw
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 8: 495 (1889)

#### Original name
Belonidium fuscum (E. Müll. & Dennis) Raitv., 1970

### Remarks
null