text:
/

// Templates are defined here in order to avoid a dependency on C++ <type_traits> header file,
// or on compiler-specific contructs.
extern "C++" {
    template <size_t S>
    struct OBJC_ENUM_FLAG_INTEGER_FOR_SIZE;

    template <>
    struct OBJC_ENUM_FLAG_INTEGER_FOR_SIZE<1>
    {
        typedef char type;
    };

    template <>
    struct OBJC_ENUM_FLAG_INTEGER_FOR_SIZE<2>
    {
        typedef short type;
    };

    template <>
    struct OBJC_ENUM_FLAG_INTEGER_FOR_SIZE<4>
    {
        typedef int type;
    };

    // used as an approximation of std::underlying_type<T>
    template <class T>
    struct OBJC_ENUM_FLAG_SIZED_INTEGER
    {
        typedef typename OBJC_ENUM_FLAG_INTEGER_FOR_SIZE<sizeof(T)>::type type;
    };
}

#pragma push_macro("DEFINE_ENUM_FLAG_OPERATORS")
#undef DEFINE_ENUM_FLAG_OPERATORS
#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
extern "C++" { \
inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) | ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) &= ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a)); } \
inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) ^ ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) ^= ((OBJC_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); } \
}

// Override Win32 function calls
#pragma push_macro("GetCurrentThreadId")
#pragma push_macro("InterlockedIncrementNoFence")
#pragma push_macro("GetLastError")
#pragma push_macro("CopyMemory")
#pragma push_macro("ZeroMemory")
#pragma push_macro("FormatMessageW")
#pragma push_macro("OutputDebugStringW")
#pragma push_macro("InterlockedDecrementRelease")
#pragma push_macro("InterlockedCompareExchangePointer")

#define GetCurrentThreadId objc_getCurrentThreadId
#define InterlockedIncrementNoFence objc_interlockedIncrementNoFence
#define GetLastError objc_getLastError
#define CopyMemory objc_copyMemory
#define ZeroMemory objc_zeroMemory
#define FormatMessageW objc_formatMessageW
#define OutputDebugStringW objc_outputDebugStringW
#define InterlockedDecrementRelease objc_interlockedDecrementRelease
#define InterlockedCompareExchangePointer objc_interlockedCompareExchangePointer

#include "../objcrt/error-handling.h"

// Ignore some warnings in result.h
#if defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-noreturn"
#pragma clang diagnostic ignored "-Wunused-value"
#endif
#include "wil/result.h"
#if defined __clang__
#pragma clang diagnostic pop
#endif

// Pop all the temp Win32 function defines
#pragma pop_macro("GetCurrentThreadId")
#pragma pop_macro("InterlockedIncrementNoFence")
#pragma pop_macro("GetLastError")
#pragma pop_macro("CopyMemory")
#pragma pop_macro("ZeroMemory")
#pragma pop_macro("FormatMessageW")
#pragma pop_macro("OutputDebugStringW")
#pragma pop_macro("InterlockedDecrementRelease")
#pragma pop_macro("InterlockedCompareExchangePointer")

// Pop all the temp Win32 defines
#pragma pop_macro("PCWSTR")
#pragma pop_macro("PWSTR")
#pragma pop_macro("PCSTR")
#pragma pop_macro("PSTR")
#pragma pop_macro("ARRAYSIZE")
#pragma pop_macro("FORMAT_MESSAGE_IGNORE_INSERTS")
#pragma pop_macro("FORMAT_MESSAGE_FROM_STRING")
#pragma pop_macro("FORMAT_MESSAGE_FROM_HMODULE")
#pragma pop_macro("FORMAT_MESSAGE_FROM_SYSTEM")
#pragma pop_macro("FORMAT_MESSAGE_ARGUMENT_ARRAY")
#pragma pop_macro("FORMAT_MESSAGE_MAX_WIDTH_MASK")
#pragma pop_macro("LANG_NEUTRAL")
#pragma pop_macro("SUBLANG_DEFAULT")
#pragma pop_macro("MAKELANGID")
#pragma pop_macro("INVALID_HANDLE_VALUE")
#pragma pop_macro("FAST_FAIL_FATAL_APP_EXIT")
#pragma pop_macro("STATUS_NO_MEMORY")
#pragma pop_macro("DEFINE_ENUM_FLAG_OPERATORS")

#endif // __ERRORHANDLING_H


text:
package com.radiostream.player;

import android.media.MediaPlayer;

import javax.inject.Inject;

/**
 * Created by vitaly on 17/11/2016.
 */

public class MediaPlayerFactory {

    @Inject
    public MediaPlayerFactory() {
    }

    public MediaPlayer build() {
        return new MediaPlayer();
    }
}

redpajama_set_name: RedPajamaGithub


text:
//
// Generated file, do not edit! Created by nedtool 5.1 from inet/routing/pim/PIMPacket.msg.
//

#if defined(__clang__)
#  pragma clang diagnostic ignored "-Wreserved-id-macro"
#endif
#ifndef __INET_PIMPACKET_M_H
#define __INET_PIMPACKET_M_H

#include <omnetpp.h>

// nedtool version check
#define MSGC_VERSION 0x0501
#if (MSGC_VERSION!=OMNETPP_VERSION)
#    error Version mismatch! Probably this file was generated by an earlier version of nedtool: 'make clean' should help.
#endif

// dll export symbol
#ifndef INET_API
#  if defined(INET_EXPORT)
#    define INET_API  OPP_DLLEXPORT
#  elif defined(INET_IMPORT)
#    define INET_API  OPP_DLLIMPORT
#  else
#    define INET_API
#  endif
#endif

// cplusplus {{
#include "inet/networklayer/contract/ipv4/IPv4Address.h"

#define PIM_HEADER_LENGTH 4
#define ENCODED_UNICODE_ADDRESS_LENGTH 6 // IPv4 only
#define ENCODED_GROUP_ADDRESS_LENGTH   8 // IPv4 only
#define ENCODED_SOURCE_ADDRESS_LENGTH  8 // IPv4 only
// }}

namespace inet {

/**
 * Enum generated from <tt>inet/routing/pim/PIMPacket.msg:36</tt> by nedtool.
 *

 * enum PIMPacketType
 * {
 *
 *     Hello = 0;
 *     Register = 1;
 *     RegisterStop = 2;
 *     JoinPrune = 3;
 *     Bootstrap = 4;
 *     Assert = 5;
 *     Graft = 6;
 *     GraftAck = 7;
 *     CandidateRPAdvertisement = 8;
 *     StateRefresh = 9;
 * }
 *

 */
enum PIMPacketType {
    Hello = 0,
    Register = 1,
    RegisterStop = 2,
    JoinPrune = 3,
    Bootstrap = 4,
    Assert = 5,
    Graft = 6,
    GraftAck = 7,
    CandidateRPAdvertisement = 8,
    StateRefresh = 9
};

/**
 * Enum generated from <tt>inet/routing/pim/PIMPacket.msg:50</tt> by nedtool.
 *

 * enum PIMHelloOptionType
 * {
 *
 *     Holdtime = 1;
 *     LANPruneDelay = 2;
 *     DRPriority = 19;
 *     GenerationID = 20;
 *     StateRefreshCapable = 21;
 *     AddressList = 24;
 * }
 *

 */
enum PIMHelloOptionType {
    Holdtime = 1,
    LANPruneDelay = 2,
    DRPriority = 19,
    GenerationID = 20,
    StateRefreshCapable = 21,
    AddressList = 24
};

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:60</tt> by nedtool.
 *

 * class HelloOption
 * {
 *     short type \@enum(PIMHelloOptionType);
 * }
 *

 */
class INET_API HelloOption : public ::omnetpp::cObject
{
  protected:
    short type;

  private:
    void copy(const HelloOption& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const HelloOption&);

  public:
    HelloOption();
    HelloOption(const HelloOption& other);
    virtual ~HelloOption();
    HelloOption& operator=(const HelloOption& other);
    virtual HelloOption *dup() const override {return new HelloOption(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual short getType() const;
    virtual void setType(short type);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const HelloOption& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, HelloOption& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:65</tt> by nedtool.
 *

 * class HoldtimeOption extends HelloOption
 * {
 *     type = Holdtime;
 *     uint16_t holdTime;
 * }
 *

 */
class INET_API HoldtimeOption : public ::inet::HelloOption
{
  protected:
    uint16_t holdTime;

  private:
    void copy(const HoldtimeOption& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const HoldtimeOption&);

  public:
    HoldtimeOption();
    HoldtimeOption(const HoldtimeOption& other);
    virtual ~HoldtimeOption();
    HoldtimeOption& operator=(const HoldtimeOption& other);
    virtual HoldtimeOption *dup() const override {return new HoldtimeOption(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual uint16_t getHoldTime() const;
    virtual void setHoldTime(uint16_t holdTime);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const HoldtimeOption& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, HoldtimeOption& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:71</tt> by nedtool.
 *

 * class LANPruneDelayOption extends HelloOption
 * {
 *     type = LANPruneDelay;
 *     uint16_t propagationDelay;
 *     uint16_t overrideInterval;
 * }
 *

 */
class INET_API LANPruneDelayOption : public ::inet::HelloOption
{
  protected:
    uint16_t propagationDelay;
    uint16_t overrideInterval;

  private:
    void copy(const LANPruneDelayOption& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const LANPruneDelayOption&);

  public:
    LANPruneDelayOption();
    LANPruneDelayOption(const LANPruneDelayOption& other);
    virtual ~LANPruneDelayOption();
    LANPruneDelayOption& operator=(const LANPruneDelayOption& other);
    virtual LANPruneDelayOption *dup() const override {return new LANPruneDelayOption(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual uint16_t getPropagationDelay() const;
    virtual void setPropagationDelay(uint16_t propagationDelay);
    virtual uint16_t getOverrideInterval() const;
    virtual void setOverrideInterval(uint16_t overrideInterval);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const LANPruneDelayOption& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, LANPruneDelayOption& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:78</tt> by nedtool.
 *

 * class DRPriorityOption extends HelloOption
 * {
 *     type = DRPriority;
 *     uint32_t priority;
 * }
 *

 */
class INET_API DRPriorityOption : public ::inet::HelloOption
{
  protected:
    uint32_t priority;

  private:
    void copy(const DRPriorityOption& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const DRPriorityOption&);

  public:
    DRPriorityOption();
    DRPriorityOption(const DRPriorityOption& other);
    virtual ~DRPriorityOption();
    DRPriorityOption& operator=(const DRPriorityOption& other);
    virtual DRPriorityOption *dup() const override {return new DRPriorityOption(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual uint32_t getPriority() const;
    virtual void setPriority(uint32_t priority);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const DRPriorityOption& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, DRPriorityOption& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:84</tt> by nedtool.
 *

 * class GenerationIDOption extends HelloOption
 * {
 *     type = GenerationID;
 *     uint32_t generationID;
 * }
 *
 * //class AddressListOption extends HelloOption
 * //{
 * //    IPv4Address secondaryAddresses[];
 * //}
 *

 */
class INET_API GenerationIDOption : public ::inet::HelloOption
{
  protected:
    uint32_t generationID;

  private:
    void copy(const GenerationIDOption& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const GenerationIDOption&);

  public:
    GenerationIDOption();
    GenerationIDOption(const GenerationIDOption& other);
    virtual ~GenerationIDOption();
    GenerationIDOption& operator=(const GenerationIDOption& other);
    virtual GenerationIDOption *dup() const override {return new GenerationIDOption(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual uint32_t getGenerationID() const;
    virtual void setGenerationID(uint32_t generationID);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const GenerationIDOption& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, GenerationIDOption& obj) {obj.parsimUnpack(b);}

// cplusplus {{
 class HelloOption; typedef HelloOption *HelloOptionPtr;
// }}

/**
 * Struct generated from inet/routing/pim/PIMPacket.msg:98 by nedtool.
 */
struct INET_API EncodedAddress
{
    EncodedAddress();
    IPv4Address IPaddress;
    bool S;
    bool W;
    bool R;
};

// helpers for local use
void INET_API __doPacking(omnetpp::cCommBuffer *b, const EncodedAddress& a);
void INET_API __doUnpacking(omnetpp::cCommBuffer *b, EncodedAddress& a);

inline void doParsimPacking(omnetpp::cCommBuffer *b, const EncodedAddress& obj) { __doPacking(b, obj); }
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, EncodedAddress& obj) { __doUnpacking(b, obj); }

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:108</tt> by nedtool.
 *

 * // Record for Join/Prune message
 * // in structure it is not possible to use dynamic arrays, iit is needed to use class
 * class JoinPruneGroup
 * {
 *     IPv4Address groupAddress;
 *     EncodedAddress joinedSourceAddress[];
 *     EncodedAddress prunedSourceAddress[];
 * }
 *

 */
class INET_API JoinPruneGroup : public ::omnetpp::cObject
{
  protected:
    IPv4Address groupAddress;
    EncodedAddress *joinedSourceAddress; // array ptr
    unsigned int joinedSourceAddress_arraysize;
    EncodedAddress *prunedSourceAddress; // array ptr
    unsigned int prunedSourceAddress_arraysize;

  private:
    void copy(const JoinPruneGroup& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const JoinPruneGroup&);

  public:
    JoinPruneGroup();
    JoinPruneGroup(const JoinPruneGroup& other);
    virtual ~JoinPruneGroup();
    JoinPruneGroup& operator=(const JoinPruneGroup& other);
    virtual JoinPruneGroup *dup() const override {return new JoinPruneGroup(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual IPv4Address& getGroupAddress();
    virtual const IPv4Address& getGroupAddress() const {return const_cast<JoinPruneGroup*>(this)->getGroupAddress();}
    virtual void setGroupAddress(const IPv4Address& groupAddress);
    virtual void setJoinedSourceAddressArraySize(unsigned int size);
    virtual unsigned int getJoinedSourceAddressArraySize() const;
    virtual EncodedAddress& getJoinedSourceAddress(unsigned int k);
    virtual const EncodedAddress& getJoinedSourceAddress(unsigned int k) const {return const_cast<JoinPruneGroup*>(this)->getJoinedSourceAddress(k);}
    virtual void setJoinedSourceAddress(unsigned int k, const EncodedAddress& joinedSourceAddress);
    virtual void setPrunedSourceAddressArraySize(unsigned int size);
    virtual unsigned int getPrunedSourceAddressArraySize() const;
    virtual EncodedAddress& getPrunedSourceAddress(unsigned int k);
    virtual const EncodedAddress& getPrunedSourceAddress(unsigned int k) const {return const_cast<JoinPruneGroup*>(this)->getPrunedSourceAddress(k);}
    virtual void setPrunedSourceAddress(unsigned int k, const EncodedAddress& prunedSourceAddress);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const JoinPruneGroup& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, JoinPruneGroup& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:117</tt> by nedtool.
 *

 * ///////////////////////////////////////////////////////////////////////////////////////////////
 * // Header
 * packet PIMPacket
 * {
 *     short version = 2;
 *     short type \@enum(PIMPacketType);
 * }
 *

 */
class INET_API PIMPacket : public ::omnetpp::cPacket
{
  protected:
    short version;
    short type;

  private:
    void copy(const PIMPacket& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMPacket&);

  public:
    PIMPacket(const char *name=nullptr, short kind=0);
    PIMPacket(const PIMPacket& other);
    virtual ~PIMPacket();
    PIMPacket& operator=(const PIMPacket& other);
    virtual PIMPacket *dup() const override {return new PIMPacket(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual short getVersion() const;
    virtual void setVersion(short version);
    virtual short getType() const;
    virtual void setType(short type);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMPacket& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMPacket& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:125</tt> by nedtool.
 *

 * // Hello message
 * // DM, SM
 * packet PIMHello extends PIMPacket
 * {
 *     \@customize(true);
 *     type = Hello;
 *     abstract HelloOptionPtr options[];
 * }
 *

 *
 * PIMHello_Base is only useful if it gets subclassed, and PIMHello is derived from it.
 * The minimum code to be written for PIMHello is the following:
 *
 *

 * class INET_API PIMHello : public PIMHello_Base
 * {
 *   private:
 *     void copy(const PIMHello& other) { ... }

 *   public:
 *     PIMHello(const char *name=nullptr, short kind=0) : PIMHello_Base(name,kind) {}
 *     PIMHello(const PIMHello& other) : PIMHello_Base(other) {copy(other);}
 *     PIMHello& operator=(const PIMHello& other) {if (this==&other) return *this; PIMHello_Base::operator=(other); copy(other); return *this;}
 *     virtual PIMHello *dup() const override {return new PIMHello(*this);}
 *     // ADD CODE HERE to redefine and implement pure virtual functions from PIMHello_Base
 * };
 *

 *
 * The following should go into a .cc (.cpp) file:
 *
 *

 * Register_Class(PIMHello)
 *

 */
class INET_API PIMHello_Base : public ::inet::PIMPacket
{
  protected:

  private:
    void copy(const PIMHello_Base& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMHello_Base&);
    // make constructors protected to avoid instantiation
    PIMHello_Base(const char *name=nullptr, short kind=0);
    PIMHello_Base(const PIMHello_Base& other);
    // make assignment operator protected to force the user override it
    PIMHello_Base& operator=(const PIMHello_Base& other);

  public:
    virtual ~PIMHello_Base();
    virtual PIMHello_Base *dup() const override {throw omnetpp::cRuntimeError("You forgot to manually add a dup() function to class PIMHello");}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual void setOptionsArraySize(unsigned int size) = 0;
    virtual unsigned int getOptionsArraySize() const = 0;
    virtual HelloOptionPtr& getOptions(unsigned int k) = 0;
    virtual const HelloOptionPtr& getOptions(unsigned int k) const {return const_cast<PIMHello_Base*>(this)->getOptions(k);}
    virtual void setOptions(unsigned int k, const HelloOptionPtr& options) = 0;
};

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:134</tt> by nedtool.
 *

 * // Join/Prune message
 * // DM, SM
 * packet PIMJoinPrune extends PIMPacket
 * {
 *     type = JoinPrune;
 *     IPv4Address upstreamNeighborAddress;
 *     int holdTime;
 *     //int                numGroups;
 *     JoinPruneGroup joinPruneGroups[];
 * }
 *

 */
class INET_API PIMJoinPrune : public ::inet::PIMPacket
{
  protected:
    IPv4Address upstreamNeighborAddress;
    int holdTime;
    JoinPruneGroup *joinPruneGroups; // array ptr
    unsigned int joinPruneGroups_arraysize;

  private:
    void copy(const PIMJoinPrune& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMJoinPrune&);

  public:
    PIMJoinPrune(const char *name=nullptr, short kind=0);
    PIMJoinPrune(const PIMJoinPrune& other);
    virtual ~PIMJoinPrune();
    PIMJoinPrune& operator=(const PIMJoinPrune& other);
    virtual PIMJoinPrune *dup() const override {return new PIMJoinPrune(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual IPv4Address& getUpstreamNeighborAddress();
    virtual const IPv4Address& getUpstreamNeighborAddress() const {return const_cast<PIMJoinPrune*>(this)->getUpstreamNeighborAddress();}
    virtual void setUpstreamNeighborAddress(const IPv4Address& upstreamNeighborAddress);
    virtual int getHoldTime() const;
    virtual void setHoldTime(int holdTime);
    virtual void setJoinPruneGroupsArraySize(unsigned int size);
    virtual unsigned int getJoinPruneGroupsArraySize() const;
    virtual JoinPruneGroup& getJoinPruneGroups(unsigned int k);
    virtual const JoinPruneGroup& getJoinPruneGroups(unsigned int k) const {return const_cast<PIMJoinPrune*>(this)->getJoinPruneGroups(k);}
    virtual void setJoinPruneGroups(unsigned int k, const JoinPruneGroup& joinPruneGroups);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMJoinPrune& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMJoinPrune& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:145</tt> by nedtool.
 *

 * // Assert message
 * // DM, SM
 * packet PIMAssert extends PIMPacket
 * {
 *     type = Assert;
 *     IPv4Address groupAddress;
 *     IPv4Address sourceAddress;
 *     bool R;
 *     int metric;
 *     int metricPreference;
 * }
 *

 */
class INET_API PIMAssert : public ::inet::PIMPacket
{
  protected:
    IPv4Address groupAddress;
    IPv4Address sourceAddress;
    bool R;
    int metric;
    int metricPreference;

  private:
    void copy(const PIMAssert& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMAssert&);

  public:
    PIMAssert(const char *name=nullptr, short kind=0);
    PIMAssert(const PIMAssert& other);
    virtual ~PIMAssert();
    PIMAssert& operator=(const PIMAssert& other);
    virtual PIMAssert *dup() const override {return new PIMAssert(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual IPv4Address& getGroupAddress();
    virtual const IPv4Address& getGroupAddress() const {return const_cast<PIMAssert*>(this)->getGroupAddress();}
    virtual void setGroupAddress(const IPv4Address& groupAddress);
    virtual IPv4Address& getSourceAddress();
    virtual const IPv4Address& getSourceAddress() const {return const_cast<PIMAssert*>(this)->getSourceAddress();}
    virtual void setSourceAddress(const IPv4Address& sourceAddress);
    virtual bool getR() const;
    virtual void setR(bool R);
    virtual int getMetric() const;
    virtual void setMetric(int metric);
    virtual int getMetricPreference() const;
    virtual void setMetricPreference(int metricPreference);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMAssert& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMAssert& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:157</tt> by nedtool.
 *

 * // Graft message, only message send by unicast
 * // DM
 * packet PIMGraft extends PIMJoinPrune
 * {
 *     type = Graft;
 *     holdTime = 0;
 * }
 *

 */
class INET_API PIMGraft : public ::inet::PIMJoinPrune
{
  protected:

  private:
    void copy(const PIMGraft& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMGraft&);

  public:
    PIMGraft(const char *name=nullptr, short kind=0);
    PIMGraft(const PIMGraft& other);
    virtual ~PIMGraft();
    PIMGraft& operator=(const PIMGraft& other);
    virtual PIMGraft *dup() const override {return new PIMGraft(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMGraft& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMGraft& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:165</tt> by nedtool.
 *

 * // GraftAck message
 * // DM
 * packet PIMGraftAck extends PIMGraft
 * {
 *     type = GraftAck;
 * }
 *

 */
class INET_API PIMGraftAck : public ::inet::PIMGraft
{
  protected:

  private:
    void copy(const PIMGraftAck& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMGraftAck&);

  public:
    PIMGraftAck(const char *name=nullptr, short kind=0);
    PIMGraftAck(const PIMGraftAck& other);
    virtual ~PIMGraftAck();
    PIMGraftAck& operator=(const PIMGraftAck& other);
    virtual PIMGraftAck *dup() const override {return new PIMGraftAck(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMGraftAck& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMGraftAck& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:172</tt> by nedtool.
 *

 * // State Refresh message
 * // DM
 * packet PIMStateRefresh extends PIMPacket
 * {
 *     type = StateRefresh;
 *     IPv4Address groupAddress;
 *     IPv4Address sourceAddress;
 *     IPv4Address originatorAddress;
 *     int metric;
 *     int metricPreference;
 *     short maskLen;
 *     short ttl;
 *     bool P;
 *     int interval;
 * }
 *

 */
class INET_API PIMStateRefresh : public ::inet::PIMPacket
{
  protected:
    IPv4Address groupAddress;
    IPv4Address sourceAddress;
    IPv4Address originatorAddress;
    int metric;
    int metricPreference;
    short maskLen;
    short ttl;
    bool P;
    int interval;

  private:
    void copy(const PIMStateRefresh& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMStateRefresh&);

  public:
    PIMStateRefresh(const char *name=nullptr, short kind=0);
    PIMStateRefresh(const PIMStateRefresh& other);
    virtual ~PIMStateRefresh();
    PIMStateRefresh& operator=(const PIMStateRefresh& other);
    virtual PIMStateRefresh *dup() const override {return new PIMStateRefresh(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual IPv4Address& getGroupAddress();
    virtual const IPv4Address& getGroupAddress() const {return const_cast<PIMStateRefresh*>(this)->getGroupAddress();}
    virtual void setGroupAddress(const IPv4Address& groupAddress);
    virtual IPv4Address& getSourceAddress();
    virtual const IPv4Address& getSourceAddress() const {return const_cast<PIMStateRefresh*>(this)->getSourceAddress();}
    virtual void setSourceAddress(const IPv4Address& sourceAddress);
    virtual IPv4Address& getOriginatorAddress();
    virtual const IPv4Address& getOriginatorAddress() const {return const_cast<PIMStateRefresh*>(this)->getOriginatorAddress();}
    virtual void setOriginatorAddress(const IPv4Address& originatorAddress);
    virtual int getMetric() const;
    virtual void setMetric(int metric);
    virtual int getMetricPreference() const;
    virtual void setMetricPreference(int metricPreference);
    virtual short getMaskLen() const;
    virtual void setMaskLen(short maskLen);
    virtual short getTtl() const;
    virtual void setTtl(short ttl);
    virtual bool getP() const;
    virtual void setP(bool P);
    virtual int getInterval() const;
    virtual void setInterval(int interval);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMStateRefresh& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMStateRefresh& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:187</tt> by nedtool.
 *

 * // Register message
 * // SM
 * packet PIMRegister extends PIMPacket
 * {
 *     type = Register;
 *     bool B;
 *     bool N;
 * }
 *

 */
class INET_API PIMRegister : public ::inet::PIMPacket
{
  protected:
    bool B;
    bool N;

  private:
    void copy(const PIMRegister& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMRegister&);

  public:
    PIMRegister(const char *name=nullptr, short kind=0);
    PIMRegister(const PIMRegister& other);
    virtual ~PIMRegister();
    PIMRegister& operator=(const PIMRegister& other);
    virtual PIMRegister *dup() const override {return new PIMRegister(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual bool getB() const;
    virtual void setB(bool B);
    virtual bool getN() const;
    virtual void setN(bool N);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMRegister& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMRegister& obj) {obj.parsimUnpack(b);}

/**
 * Class generated from <tt>inet/routing/pim/PIMPacket.msg:196</tt> by nedtool.
 *

 * // Register-Stop message
 * // SM
 * packet PIMRegisterStop extends PIMPacket
 * {
 *     type = RegisterStop;
 *     IPv4Address groupAddress;
 *     IPv4Address sourceAddress;
 * }
 *

 */
class INET_API PIMRegisterStop : public ::inet::PIMPacket
{
  protected:
    IPv4Address groupAddress;
    IPv4Address sourceAddress;

  private:
    void copy(const PIMRegisterStop& other);

  protected:
    // protected and unimplemented operator==(), to prevent accidental usage
    bool operator==(const PIMRegisterStop&);

  public:
    PIMRegisterStop(const char *name=nullptr, short kind=0);
    PIMRegisterStop(const PIMRegisterStop& other);
    virtual ~PIMRegisterStop();
    PIMRegisterStop& operator=(const PIMRegisterStop& other);
    virtual PIMRegisterStop *dup() const override {return new PIMRegisterStop(*this);}
    virtual void parsimPack(omnetpp::cCommBuffer *b) const override;
    virtual void parsimUnpack(omnetpp::cCommBuffer *b) override;

    // field getter/setter methods
    virtual IPv4Address& getGroupAddress();
    virtual const IPv4Address& getGroupAddress() const {return const_cast<PIMRegisterStop*>(this)->getGroupAddress();}
    virtual void setGroupAddress(const IPv4Address& groupAddress);
    virtual IPv4Address& getSourceAddress();
    virtual const IPv4Address& getSourceAddress() const {return const_cast<PIMRegisterStop*>(this)->getSourceAddress();}
    virtual void setSourceAddress(const IPv4Address& sourceAddress);
};

inline void doParsimPacking(omnetpp::cCommBuffer *b, const PIMRegisterStop& obj) {obj.parsimPack(b);}
inline void doParsimUnpacking(omnetpp::cCommBuffer *b, PIMRegisterStop& obj) {obj.parsimUnpack(b);}

} // namespace inet

#endif // ifndef __INET_PIMPACKET_M_H


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

<title>RepairJobDesc (apache-cassandra API)</title>
<meta name="date" content="2014-11-05">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.repair

Class RepairJobDesc

java.lang.Object

org.apache.cassandra.repair.RepairJobDesc

public class RepairJobDesc
extends java.lang.Object

RepairJobDesc is used from various repair processes to distinguish one RepairJob to another.

Since:

2.0

Field Summary

Fields

Modifier and Type
Field and Description

java.lang.String
columnFamily

java.lang.String
keyspace

java.util.UUID
parentSessionId

Range<Token>
range

repairing range

static IVersionedSerializer<RepairJobDesc>
serializer

java.util.UUID
sessionId

RepairSession id

Constructor Summary

Constructors

Constructor and Description

RepairJobDesc(java.util.UUID parentSessionId,
             java.util.UUID sessionId,
             java.lang.String keyspace,
             java.lang.String columnFamily,
             Range<Token> range)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
equals(java.lang.Object o)

int
hashCode()

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

serializer

public static final IVersionedSerializer<RepairJobDesc> serializer

parentSessionId

public final java.util.UUID parentSessionId

sessionId

public final java.util.UUID sessionId

RepairSession id

keyspace

public final java.lang.String keyspace

columnFamily

public final java.lang.String columnFamily

range

public final Range<Token> range

repairing range

Constructor Detail

RepairJobDesc

public RepairJobDesc(java.util.UUID parentSessionId,
             java.util.UUID sessionId,
             java.lang.String keyspace,
             java.lang.String columnFamily,
             Range<Token> range)

Method Detail

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:

equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:

hashCode in class java.lang.Object

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2014 The Apache Software Foundation


text:
package com.vies.viesmachines.common.items.kits;

import java.util.List;

import javax.annotation.Nullable;

import com.vies.viesmachines.ViesMachines;
import com.vies.viesmachines.api.EnumsVM;
import com.vies.viesmachines.api.References;
import com.vies.viesmachines.common.entity.machines.EntityMachineBase;
import com.vies.viesmachines.common.items.ItemHelper;

import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ItemKitAmmo extends Item {

	private int repairItem;
	private EnumRarity rarity;
	private String procName;

	public ItemKitAmmo(String unlocalizedName, EnumRarity rarityIn, int durabilityItemIn)
	{
		this.setMaxStackSize(64);
		this.repairItem = durabilityItemIn;
		this.rarity = rarityIn;

		this.procName = "KitBombProc_" + this.rarity;

		ItemHelper.setItemName(this, unlocalizedName);
		this.setCreativeTab(ViesMachines.tabItems);
	}

	@Override
	public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
    {
		if (entity instanceof EntityMachineBase)
        {
			// If this machine has max ammo, ignore all below code:
			if (((EntityMachineBase) entity).getAmmoAmount() >= ((EntityMachineBase) entity).getMaxAmmoAmount())
        	{
				return true;
        	}

			// Heals the machine for 4 Ammo Amount:
			if(this.repairItem == 0)
			{
				((EntityMachineBase) entity).setAmmoAmount(((EntityMachineBase) entity).getAmmoAmount() + 4);

				if(!player.isCreative())
				{
					stack.shrink(1);
				}

				((EntityMachineBase) entity).setEventTrigger(EnumsVM.EventTrigger.AMMO_4.getMetadata());

		    	return true;
			}

			// Heals the machine for 16 Ammo Amount:
			if(this.repairItem == 1)
			{
				((EntityMachineBase) entity).setAmmoAmount(((EntityMachineBase) entity).getAmmoAmount() + 16);

				if(!player.isCreative())
				{
					stack.shrink(1);
				}

				((EntityMachineBase) entity).setEventTrigger(EnumsVM.EventTrigger.AMMO_16.getMetadata());

		    	return true;
			}

			// Heals the machine for 64 Ammo Amount:
			if(this.repairItem == 2)
			{
				((EntityMachineBase) entity).setAmmoAmount(((EntityMachineBase) entity).getAmmoAmount() + 64);

				if(!player.isCreative())
				{
					stack.shrink(1);
				}

				((EntityMachineBase) entity).setEventTrigger(EnumsVM.EventTrigger.AMMO_64.getMetadata());

		    	return true;
			}
        }
		else if(entity instanceof EntityLiving)
        {
			if (entity.getRidingEntity() != null)
			{
				if (entity.getRidingEntity() instanceof EntityMachineBase)
				{
					// If this machine hax max ammo, ignore all below code:
					if (((EntityMachineBase) entity.getRidingEntity()).getAmmoAmount() >= ((EntityMachineBase) entity.getRidingEntity()).getMaxAmmoAmount())
		        	{
						return true;
		        	}

					// Heals the machine for 4 Ammo Amount:
					if(this.repairItem == 0)
					{
						((EntityMachineBase) entity.getRidingEntity()).setAmmoAmount(((EntityMachineBase) entity.getRidingEntity()).getAmmoAmount() + 4);

						if(!player.isCreative())
						{
							stack.shrink(1);
						}

						((EntityMachineBase) entity.getRidingEntity()).setEventTrigger(EnumsVM.EventTrigger.AMMO_4.getMetadata());

				    	return true;
					}

					// Heals the machine for 16 Ammo Amount:
					if(this.repairItem == 1)
					{
						((EntityMachineBase) entity.getRidingEntity()).setAmmoAmount(((EntityMachineBase) entity.getRidingEntity()).getAmmoAmount() + 16);

						if(!player.isCreative())
						{
							stack.shrink(1);
						}

						((EntityMachineBase) entity.getRidingEntity()).setEventTrigger(EnumsVM.EventTrigger.AMMO_16.getMetadata());

				    	return true;
					}

					// Heals the machine for 64 Ammo Amount:
					if(this.repairItem == 2)
					{
						((EntityMachineBase) entity.getRidingEntity()).setAmmoAmount(((EntityMachineBase) entity.getRidingEntity()).getAmmoAmount() + 64);

						if(!player.isCreative())
						{
							stack.shrink(1);
						}

						((EntityMachineBase) entity.getRidingEntity()).setEventTrigger(EnumsVM.EventTrigger.AMMO_64.getMetadata());

				    	return true;
					}
				}
			}
        }
		else
		{
			return true;
		}

		return true;
    }

	@Override
    public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, net.minecraft.util.EnumHand hand)
    {
        if(entity.world.isRemote)
        {
            return false;
        }

        if(entity instanceof EntityMachineBase)
        {
        	return true;
        }

        return false;
    }

	@SideOnly(Side.CLIENT)
	@Override
	public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
    {
		TextFormatting color = TextFormatting.GOLD;

		if (this.rarity == EnumRarity.RARE)
		{
			color = TextFormatting.DARK_AQUA;
		}

		if (this.rarity == EnumRarity.EPIC)
		{
			color = TextFormatting.DARK_PURPLE;
		}

		tooltip.add(TextFormatting.DARK_GREEN + "================================");
		tooltip.add(color + References.Old_I18n.translateToLocal(this.getUnlocalizedName() + ".tt.1"));
		tooltip.add("");
		tooltip.add(TextFormatting.WHITE + References.Old_I18n.translateToLocal("viesmachines.leftclick") + " " + color + References.Old_I18n.translateToLocal(this.getUnlocalizedName() + ".tt.2"));
	}

	@Override
	public EnumRarity getRarity(ItemStack stack)
    {
		return this.rarity;
    }

    /** Return the name for this gem proc. */
	public String getGemProcName()
    {
        return this.procName.toString();
    }
}


text:
layout: post
title:  "Natas Level 11"
date:   2015-09-28 19:50
categories: natas wargame web overthewire
author: Leander
---
This is a solution guide to the Natas11 Level at [overthewire](http://natas11.natas.labs.overthewire.org). This write-up was created on 28 September 2015.

First connect to the website

http://natas11.natas.labs.overthewire.org

Enter the following as the username natas11 and password U82q5TCMMQ9xuFoI3dYX61s7OZD9JKoK

Let's begin first by clicking on view source and examining the code for this level.
{% highlight php linenos %}
<?php
$defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff");
function xor_encrypt($in) {
    $key = '<censored>';
    $text = $in;
    $outText = '';

    // Iterate through each character
    for($i=0;$i<strlen($text);$i++) {
    $outText .= $text[$i] ^ $key[$i % strlen($key)];}
    return $outText;
}

function loadData($def) {
    global $_COOKIE;
    $mydata = $def;
    if(array_key_exists("data", $_COOKIE)) {
    $tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true);
    if(is_array($tempdata) && array_key_exists("showpassword", $tempdata) && array_key_exists("bgcolor", $tempdata)) {
        if (preg_match('/^#(?:[a-f\d]{6})$/i', $tempdata['bgcolor'])) {
        $mydata['showpassword'] = $tempdata['showpassword'];
        $mydata['bgcolor'] = $tempdata['bgcolor'];
    }}}
    return $mydata;
}

function saveData($d) {
    setcookie("data", base64_encode(xor_encrypt(json_encode($d))));}

$data = loadData($defaultdata);

if(array_key_exists("bgcolor",$_REQUEST)) {
    if (preg_match('/^#(?:[a-f\d]{6})$/i', $_REQUEST['bgcolor'])) {
        $data['bgcolor'] = $_REQUEST['bgcolor'];}}
saveData($data);
?>

--snip--

<?php
if($data["showpassword"] == "yes") {
    print "The password for natas12 is <censored>
";}?>
{% endhighlight %}

This challenge is similar to the Natas8 level in that we are going to have to reverse an encryption routine. However, our first hint tells us that they used XOR to encrypt cookies. First, let's examine our code.

Line 2 tells us that we have default data

Lines 3 - 12 is the encryption mechanism

Lines 14-25 give us the restrictions for input into the background color box, and also the conditions which when met show us the flag

Lines 27 and 28 provides information on how the default data is saved as a cookie

Let's begin my looking at the encryption mechanism. We need a key, but don't have one. However, we do have the original data. Fortunately, the properties for XOR will allow us to recover the key. The original data xored with the key produces the ciphertext, but the original data xored with the ciphertext will also produce the key!

P = Data, K = Key, C = Ciphertext
P ^ K = C
P ^ C = K

Therefore we need to pass the original data to the xor function in place of the key and the cookie sitting in our browser as the input text. This will produce the key. After getting the key, place the real value for the key into the encryption function and pass it a slightly modified json encoded array. Both versions are shown together below inside one php script.

{% highlight php linenos %}
<?php
$defaultdata = json_encode(array( "showpassword"=>"yes", "bgcolor"=>"#ffffff"));
function xor_decrypt($in) {
  if ($in != ''){
  	$text = $in;
  	$key = json_encode(array( "showpassword"=>"no", "bgcolor"=>"#ffffff"));}
  else{
  	$text = json_encode(array( "showpassword"=>"yes", "bgcolor"=>"#ffffff"));
  	$key = "qw8J";}

  // Iterate through each character
  $outText = '';
  for($i=0;$i<strlen($text);$i++) {
    $outText .= $text[$i] ^ $key[$i % strlen($key)];
  }
return $outText;
}

print "Key is currently unknown.\n OriginalData ^ Key = CipherText\n\t";
print " so that also means,\n OriginalData ^ Ciphertext = Key\n Therefore the key will repeat itself: ";
print xor_decrypt(base64_decode("ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw="));
print "\nNow that we know the key lets create a new cookie to display the password: \n";
print base64_encode(xor_decrypt(""));
print "\n";
?>
{% endhighlight %}

After retrieving our newly created cookie, go back to the browser, update your cookie, and then receive the password for level 12.

Next Password: natas12:EDXp0pS26wLKHZy1rDBPUZk0RKfLGIR3


text:
package xyz.discretezoo.web

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import spray.json._
import xyz.discretezoo.web.db.ZooDB._

// collect your json format instances into a support trait:
trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {

  implicit val formatCount: RootJsonFormat[Count] = jsonFormat1(Count)

  implicit val formatParameter: RootJsonFormat[Parameter] = jsonFormat2(Parameter)
  implicit val formatSearchParameters: RootJsonFormat[SearchParameters] = jsonFormat3(SearchParameters)
  implicit val formatResultsParameters: RootJsonFormat[ResultsParameters] = jsonFormat4(ResultsParameters)

  implicit def formatSearchResults[T:JsonFormat]: RootJsonFormat[SearchResult[T]] =
    rootFormat(lazyFormat(jsonFormat2(SearchResult.apply[T])))

  implicit val formatGraphBooleanColumns: RootJsonFormat[GraphBooleanColumns] = jsonFormat18(GraphBooleanColumns)
  implicit val formatGraphNumericColumns: RootJsonFormat[GraphNumericColumns] = jsonFormat10(GraphNumericColumns)
  implicit val formatGraphIndexColumns: RootJsonFormat[GraphIndexColumns] = jsonFormat3(GraphIndexColumns)
  implicit val formatGraphAllColumns: RootJsonFormat[GraphAllColumns] = jsonFormat4(GraphAllColumns)

  implicit val formatManiplexBooleanColumns: RootJsonFormat[ManiplexBooleanColumns] = jsonFormat2(ManiplexBooleanColumns)
  implicit val formatManiplexNumericColumns: RootJsonFormat[ManiplexNumericColumns] = jsonFormat4(ManiplexNumericColumns)
  implicit val formatManiplexStringColumns: RootJsonFormat[ManiplexStringColumns] = jsonFormat1(ManiplexStringColumns)
  implicit val formatManiplexAllColumns: RootJsonFormat[ManiplexAllColumns] = jsonFormat3(ManiplexAllColumns)

}


text:
require "rails_helper"

RSpec.describe AdminNotifierMailer, type: :mailer do

  describe 'Email notification' do
  	let(:matrix) { SubmittedMatrix.new({submitter_name: "John Lennon and Paul McCartney",
                                      submitter_email: "paul@thebeatles.com",
                                      display_email: "false",
                                      name: "Help!",
                                      kind: "Other",
                                      notes: "Help, I need somebody.\nHelp, not just anybody.\nHelp, you know I need someone.\nHelp!",
                                      submitter_url: "www.google.com",
                                      submitter_confidentiality: "true",
                                      ip: "127.0.0.1"}) }
    let(:mail) { AdminNotifierMailer.send_matrix_submitted_email(matrix) }

    it 'renders the subject' do
      expect(mail.subject).to eq('[SuiteSparse Matrix Collection] New Matrix Submitted!')
    end

    it 'renders the sender email' do
      expect(mail.body.encoded)
        .to match(/.*paul@thebeatles\.com.*/)
    end
  end
end


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

using System.Collections.ObjectModel;
using System.Globalization;
using System.Management.Automation;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands
{
    /// <summary>
    /// Unit and functional tests for <see cref="GetFileTypeCommand"/>.
    /// </summary>
    [TestClass]
    public class GetFileTypeCommandTest : TestBase
    {
        [TestMethod]
        public void PathTest()
        {
            // Now invoke the cmdlet and check the file type property.
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            // Enumerate only example.ms* files.
            using (var p = CreatePipeline(@"get-msifiletype -path example.ms*"))
            {
                var objs = p.Invoke();

                CollectionAssert.Contains(objs, PSObject.AsPSObject("Package"));
                CollectionAssert.Contains(objs, PSObject.AsPSObject("Patch"));
                CollectionAssert.Contains(objs, PSObject.AsPSObject("Transform"));
            }

            // Enumerate all files without a filter.
            using (var p = CreatePipeline(@"get-msifiletype"))
            {
                var objs = p.Invoke();

                CollectionAssert.Contains(objs, PSObject.AsPSObject("Package"));
                CollectionAssert.Contains(objs, PSObject.AsPSObject("Patch"));
                CollectionAssert.Contains(objs, PSObject.AsPSObject("Transform"));
            }
        }

        [TestMethod]
        public void PassThruTest()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            using (var p = CreatePipeline(@"get-childitem -filter example.ms* | get-msifiletype -passthru"))
            {
                var objs = p.Invoke();

                Assert.AreNotEqual<int>(0, objs.Count);
                Assert.IsInstanceOfType(objs[0].BaseObject, typeof(System.IO.FileInfo));

                foreach (var obj in objs)
                {
                    Assert.IsNotNull(obj.Properties["MSIFileType"]);

                    var file = obj.BaseObject as System.IO.FileInfo;
                    switch (file.Extension)
                    {
                        case ".msi":
                            Assert.AreEqual<string>("Package", obj.GetPropertyValue<string>("MSIFileType"));
                            break;

                        case ".msp":
                            Assert.AreEqual<string>("Patch", obj.GetPropertyValue<string>("MSIFileType"));
                            break;

                        case ".mst":
                            Assert.AreEqual<string>("Transform", obj.GetPropertyValue<string>("MSIFileType"));
                            break;

                        default:
                            Assert.Fail("Unexpected extension {0}", file.Extension);
                            break;
                    }
                }
            }
        }

        [TestMethod]
        public void LiteralPathTest()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            // Test that a wildcard is not accepted.
            using (var p = CreatePipeline(@"get-msifiletype -literalpath example.*"))
            {
                Collection<PSObject> objs = null;
                try
                {
                    // Wrapped in a try-catch since the behavior changedin PSv3.
                    objs = p.Invoke();
                }
                catch
                {
                }

                Assert.AreEqual<int>(0, objs.Count);
            }

            // Test that a registry item path is not accepted.
            using (var p = CreatePipeline(@"get-childitem hkcu:\software | get-msifiletype"))
            {
                var objs = p.Invoke();
                Assert.AreNotEqual<int>(0, p.Error.Count);
            }

            // Test against example.msi specifically.
            using (var p = CreatePipeline(@"get-msifiletype -literalpath example.msi"))
            {
                var objs = p.Invoke();

                Assert.AreEqual<int>(1, objs.Count);
                CollectionAssert.Contains(objs, PSObject.AsPSObject("Package"));
            }
        }
    }
}


text:
<?//=link_tag('application/css/perfiles/main.css');?>

<?=link_tag('application/css/perfiles/principalperfiles.css')?>

Permisos

 Roles

 Módulos

  Modulos disponibles para los perfiles

                                  <form id='form_permisos' class='form_permisos' method="GET">
                                    <input type='hidden' name="recurso" value="Perfiles, recursos y permisos">
                                  </form>

  Perfiles del sistema

                               <form id='formnewperfil'>

                                            <input type="text" name='nuevoperfil' class="form-control" placeholder="Perfil standar" aria-describedby="basic-addon2">
                                            Nombre del perfil

                                          <img id="textareaperfil" class='newdescriptionicon' src="<?=base_url('application/img/general/notebook88.png')?>">

                                          Descripción

                                          <textarea  name='descripcion_perfil_nuevo' class='col-xs-12 col-sm-12 form-control input-lg p-text-area' placeholder='El perfil con acceso a todos los recursos '></textarea>

                                </form>

                                        + Nuevo perfil

                                  <form id='form_perfil' class='form_permiso' method="GET">
                                    <input type='hidden' name="recurso" value="Perfiles">
                                  </form>

  Modulos disponibles en la plataforma

                                      <form id='formnewrecurso'>

                                                  <input type="text" name='recursonombre' class="form-control" placeholder="Ayuda" aria-describedby="basic-addon2">
                                                  Nombre del modulo (recurso)

                                                <img class='newdescriptionicon' id='textarearecurso' src="<?=base_url('application/img/general/notebook88.png')?>">

                                              Descripción

                                              <textarea name='descripcionrecursotext' class='col-xs-12 col-sm-12 form-control input-lg p-text-area' placeholder='Nombre del recurso'></textarea>

                                      </form>

                                            + Nuevo recurso

                                    <form id='form_recursos' class='form_permiso' method="GET">
                                      <input type='hidden' name="recurso" value="Recursos">
                                    </form>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

<img class='danger_icon' src="<?=base_url('application/img/general/warning9.png')?>">Advertencia

Alerta

        Si elimina el permiso los perfiles dejarán de tener acceso a los diversos módulos

        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
        <button type="button" id='deleteconformbtnpermiso' class="btn btn-primary">Continuar</button>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

<img class='danger_icon' src="<?=base_url('application/img/general/warning9.png')?>">Advertencia

Alerta

        Si elimina el perfil también borrará los permisos que se hayan asignado al perfil previamente

        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
        <button type="button" id='deleteconformbtnperfil' class="btn btn-primary">Continuar</button>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

<img class='danger_icon' src="<?=base_url('application/img/general/warning9.png')?>">Advertencia

Alerta

        Si elimina el recurso también borrará los permisos que se hayan asignado al perfil previamente

        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
        <button type="button" id='deleteconformbtn' class="btn btn-primary">Continuar</button>


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/drive/file_system_util.h"

#include <string>

#include "base/basictypes.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_write_helper.h"
#include "chrome/browser/chromeos/drive/job_list.h"
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/url_constants.h"
#include "chromeos/chromeos_constants.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/escape.h"
#include "webkit/browser/fileapi/file_system_url.h"

using content::BrowserThread;

namespace drive {
namespace util {

namespace {

const char kDriveMountPointPath[] = "/special/drive";

const base::FilePath::CharType kDriveMyDriveMountPointPath[] =
    FILE_PATH_LITERAL("/special/drive/root");

const base::FilePath::CharType kDriveMyDriveRootPath[] =
    FILE_PATH_LITERAL("drive/root");

const base::FilePath::CharType kFileCacheVersionDir[] =
    FILE_PATH_LITERAL("v1");

const char kSlash[] = "/";
const char kEscapedSlash[] = "\xE2\x88\x95";

const base::FilePath& GetDriveMyDriveMountPointPath() {
  CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mydrive_mount_path,
      (kDriveMyDriveMountPointPath));
  return drive_mydrive_mount_path;
}

FileSystemInterface* GetFileSystem(Profile* profile) {
  DriveIntegrationService* integration_service =
      DriveIntegrationServiceFactory::GetForProfile(profile);
  return integration_service ? integration_service->file_system() : NULL;
}

FileWriteHelper* GetFileWriteHelper(Profile* profile) {
  DriveIntegrationService* integration_service =
      DriveIntegrationServiceFactory::GetForProfile(profile);
  return integration_service ? integration_service->file_write_helper() : NULL;
}

std::string ReadStringFromGDocFile(const base::FilePath& file_path,
                                   const std::string& key) {
  const int64 kMaxGDocSize = 4096;
  int64 file_size = 0;
  if (!file_util::GetFileSize(file_path, &file_size) ||
      file_size > kMaxGDocSize) {
    DLOG(INFO) << "File too large to be a GDoc file " << file_path.value();
    return std::string();
  }

  JSONFileValueSerializer reader(file_path);
  std::string error_message;
  scoped_ptr<base::Value> root_value(reader.Deserialize(NULL, &error_message));
  if (!root_value) {
    DLOG(INFO) << "Failed to parse " << file_path.value() << " as JSON."
               << " error = " << error_message;
    return std::string();
  }

  base::DictionaryValue* dictionary_value = NULL;
  std::string result;
  if (!root_value->GetAsDictionary(&dictionary_value) ||
      !dictionary_value->GetString(key, &result)) {
    DLOG(INFO) << "No value for the given key is stored in "
               << file_path.value() << ". key = " << key;
    return std::string();
  }

  return result;
}

}  // namespace

const base::FilePath& GetDriveGrandRootPath() {
  CR_DEFINE_STATIC_LOCAL(base::FilePath, grand_root_path,
      (util::kDriveGrandRootDirName));
  return grand_root_path;
}

const base::FilePath& GetDriveMyDriveRootPath() {
  CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_root_path,
      (util::kDriveMyDriveRootPath));
  return drive_root_path;
}

const base::FilePath& GetDriveMountPointPath() {
  CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mount_path,
      (base::FilePath::FromUTF8Unsafe(kDriveMountPointPath)));
  return drive_mount_path;
}

bool IsSpecialResourceId(const std::string& resource_id) {
  return resource_id == kDriveGrandRootSpecialResourceId ||
      resource_id == kDriveOtherDirSpecialResourceId;
}

ResourceEntry CreateMyDriveRootEntry(const std::string& root_resource_id) {
  ResourceEntry mydrive_root;
  mydrive_root.mutable_file_info()->set_is_directory(true);
  mydrive_root.set_resource_id(root_resource_id);
  mydrive_root.set_parent_resource_id(util::kDriveGrandRootSpecialResourceId);
  mydrive_root.set_title(util::kDriveMyDriveRootDirName);
  return mydrive_root;
}

ResourceEntry CreateOtherDirEntry() {
  ResourceEntry other_dir;
  other_dir.mutable_file_info()->set_is_directory(true);
  other_dir.set_resource_id(util::kDriveOtherDirSpecialResourceId);
  other_dir.set_parent_resource_id(util::kDriveGrandRootSpecialResourceId);
  other_dir.set_title(util::kDriveOtherDirName);
  return other_dir;
}

const std::string& GetDriveMountPointPathAsString() {
  CR_DEFINE_STATIC_LOCAL(std::string, drive_mount_path_string,
      (kDriveMountPointPath));
  return drive_mount_path_string;
}

GURL FilePathToDriveURL(const base::FilePath& path) {
  std::string url(base::StringPrintf("%s:%s",
                                     chrome::kDriveScheme,
                                     path.AsUTF8Unsafe().c_str()));
  return GURL(url);
}

base::FilePath DriveURLToFilePath(const GURL& url) {
  if (!url.is_valid() || url.scheme() != chrome::kDriveScheme)
    return base::FilePath();
  std::string path_string = net::UnescapeURLComponent(
      url.path(), net::UnescapeRule::NORMAL);
  return base::FilePath::FromUTF8Unsafe(path_string);
}

void MaybeSetDriveURL(Profile* profile, const base::FilePath& path, GURL* url) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

  if (!IsUnderDriveMountPoint(path))
    return;

  FileSystemInterface* file_system = GetFileSystem(profile);
  if (!file_system)
    return;

  *url = FilePathToDriveURL(util::ExtractDrivePath(path));
}

bool IsUnderDriveMountPoint(const base::FilePath& path) {
  return GetDriveMountPointPath() == path ||
         GetDriveMountPointPath().IsParent(path);
}

bool NeedsNamespaceMigration(const base::FilePath& path) {
  // Before migration, "My Drive" which was represented as "drive.
  // The user might use some path pointing a directory in "My Drive".
  // e.g. "drive/downloads_dir"
  // We changed the path for the "My Drive" to "drive/root", hence the user pref
  // pointing to the old path needs update to the new path.
  // e.g. "drive/root/downloads_dir"
  // If |path| already points to some directory in "drive/root", there's no need
  // to update it.
  return IsUnderDriveMountPoint(path) &&
         !(GetDriveMyDriveMountPointPath() == path ||
           GetDriveMyDriveMountPointPath().IsParent(path));
}

base::FilePath ConvertToMyDriveNamespace(const base::FilePath& path) {
  DCHECK(NeedsNamespaceMigration(path));

  // Need to migrate "/special/drive(.*)" to "/special/drive/root(.*)".
  // Append the relative path from "/special/drive".
  base::FilePath new_path(GetDriveMyDriveMountPointPath());
  GetDriveMountPointPath().AppendRelativePath(path, &new_path);
  DVLOG(1) << "Migrate download.default_directory setting from "
      << path.AsUTF8Unsafe() << " to " << new_path.AsUTF8Unsafe();
  DCHECK(!NeedsNamespaceMigration(new_path));
  return new_path;
}

base::FilePath ExtractDrivePath(const base::FilePath& path) {
  if (!IsUnderDriveMountPoint(path))
    return base::FilePath();

  base::FilePath drive_path = GetDriveGrandRootPath();
  GetDriveMountPointPath().AppendRelativePath(path, &drive_path);
  return drive_path;
}

base::FilePath ExtractDrivePathFromFileSystemUrl(
    const fileapi::FileSystemURL& url) {
  if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive)
    return base::FilePath();
  return ExtractDrivePath(url.path());
}

base::FilePath GetCacheRootPath(Profile* profile) {
  base::FilePath cache_base_path;
  chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path);
  base::FilePath cache_root_path =
      cache_base_path.Append(chromeos::kDriveCacheDirname);
  return cache_root_path.Append(kFileCacheVersionDir);
}

std::string EscapeCacheFileName(const std::string& filename) {
  // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape
  std::string escaped;
  for (size_t i = 0; i < filename.size(); ++i) {
    char c = filename[i];
    if (c == '%' || c == '.' || c == '/') {
      base::StringAppendF(&escaped, "%%%02X", c);
    } else {
      escaped.push_back(c);
    }
  }
  return escaped;
}

std::string UnescapeCacheFileName(const std::string& filename) {
  std::string unescaped;
  for (size_t i = 0; i < filename.size(); ++i) {
    char c = filename[i];
    if (c == '%' && i + 2 < filename.length()) {
      c = (HexDigitToInt(filename[i + 1]) << 4) +
           HexDigitToInt(filename[i + 2]);
      i += 2;
    }
    unescaped.push_back(c);
  }
  return unescaped;
}

std::string NormalizeFileName(const std::string& input) {
  DCHECK(IsStringUTF8(input));

  std::string output;
  if (!base::ConvertToUtf8AndNormalize(input, base::kCodepageUTF8, &output))
    output = input;
  ReplaceChars(output, kSlash, std::string(kEscapedSlash), &output);
  return output;
}

void ParseCacheFilePath(const base::FilePath& path,
                        std::string* resource_id,
                        std::string* md5) {
  DCHECK(resource_id);
  DCHECK(md5);

  // Extract up to one extension from the right.
  base::FilePath base_name = path.BaseName();
  base::FilePath::StringType extension = base_name.Extension();
  if (!extension.empty()) {
    // base::FilePath::Extension returns ".", so strip it.
    extension = UnescapeCacheFileName(extension.substr(1));
    base_name = base_name.RemoveExtension();
  }

  // The base_name here is already stripped of extensions in the loop above.
  *resource_id = UnescapeCacheFileName(base_name.value());
  *md5 = extension;
}

void PrepareWritableFileAndRun(Profile* profile,
                               const base::FilePath& path,
                               const OpenFileCallback& callback) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  DCHECK(!callback.is_null());
  if (IsUnderDriveMountPoint(path)) {
    FileWriteHelper* file_write_helper = GetFileWriteHelper(profile);
    if (!file_write_helper)
      return;
    base::FilePath remote_path(ExtractDrivePath(path));
    file_write_helper->PrepareWritableFileAndRun(remote_path, callback);
  } else {
    content::BrowserThread::GetBlockingPool()->PostTask(
        FROM_HERE, base::Bind(callback, FILE_ERROR_OK, path));
  }
}

void EnsureDirectoryExists(Profile* profile,
                           const base::FilePath& directory,
                           const FileOperationCallback& callback) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  DCHECK(!callback.is_null());
  if (IsUnderDriveMountPoint(directory)) {
    FileSystemInterface* file_system = GetFileSystem(profile);
    DCHECK(file_system);
    file_system->CreateDirectory(
        ExtractDrivePath(directory),
        true /* is_exclusive */,
        true /* is_recursive */,
        callback);
  } else {
    base::MessageLoopProxy::current()->PostTask(
        FROM_HERE, base::Bind(callback, FILE_ERROR_OK));
  }
}

FileError GDataToFileError(google_apis::GDataErrorCode status) {
  switch (status) {
    case google_apis::HTTP_SUCCESS:
    case google_apis::HTTP_CREATED:
    case google_apis::HTTP_NO_CONTENT:
      return FILE_ERROR_OK;
    case google_apis::HTTP_UNAUTHORIZED:
    case google_apis::HTTP_FORBIDDEN:
      return FILE_ERROR_ACCESS_DENIED;
    case google_apis::HTTP_NOT_FOUND:
      return FILE_ERROR_NOT_FOUND;
    case google_apis::HTTP_NOT_IMPLEMENTED:
      return FILE_ERROR_INVALID_OPERATION;
    case google_apis::GDATA_CANCELLED:
      return FILE_ERROR_ABORT;
    case google_apis::GDATA_NO_CONNECTION:
      return FILE_ERROR_NO_CONNECTION;
    default:
      return FILE_ERROR_FAILED;
  }
}

void ConvertResourceEntryToPlatformFileInfo(
    const PlatformFileInfoProto& entry,
    base::PlatformFileInfo* file_info) {
  file_info->size = entry.size();
  file_info->is_directory = entry.is_directory();
  file_info->is_symbolic_link = entry.is_symbolic_link();
  file_info->last_modified = base::Time::FromInternalValue(
      entry.last_modified());
  file_info->last_accessed = base::Time::FromInternalValue(
      entry.last_accessed());
  file_info->creation_time = base::Time::FromInternalValue(
      entry.creation_time());
}

void ConvertPlatformFileInfoToResourceEntry(
    const base::PlatformFileInfo& file_info,
    PlatformFileInfoProto* entry) {
  entry->set_size(file_info.size);
  entry->set_is_directory(file_info.is_directory);
  entry->set_is_symbolic_link(file_info.is_symbolic_link);
  entry->set_last_modified(file_info.last_modified.ToInternalValue());
  entry->set_last_accessed(file_info.last_accessed.ToInternalValue());
  entry->set_creation_time(file_info.creation_time.ToInternalValue());
}

void EmptyFileOperationCallback(FileError error) {
}

bool CreateGDocFile(const base::FilePath& file_path,
                    const GURL& url,
                    const std::string& resource_id) {
  std::string content = base::StringPrintf(
      "{\"url\": \"%s\", \"resource_id\": \"%s\"}",
      url.spec().c_str(), resource_id.c_str());
  return file_util::WriteFile(file_path, content.data(), content.size()) ==
      static_cast<int>(content.size());
}

bool HasGDocFileExtension(const base::FilePath& file_path) {
  return google_apis::ResourceEntry::ClassifyEntryKindByFileExtension(
      file_path) &
      google_apis::ResourceEntry::KIND_OF_HOSTED_DOCUMENT;
}

GURL ReadUrlFromGDocFile(const base::FilePath& file_path) {
  return GURL(ReadStringFromGDocFile(file_path, "url"));
}

std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path) {
  return ReadStringFromGDocFile(file_path, "resource_id");
}

}  // namespace util
}  // namespace drive


text:
#include "globals.hpp"

namespace mocc {
namespace global {
std::string case_name;
}
}


text:
<?xml version="1.0" encoding="UTF-8"?>

NEBUSAL- sodium chloride
PharmaCaribe

Nebusal 3%

DESCRIPTION

Sodium Chloride Inhalation Solution USP 3% 4 mL

For Respiratory Therapy

Not for parenteral administration.

4 mL, 60 Vials Sterile Unit-Dose Vial

Discard any unused portion of the contents of this single-use vial as well as any unused solution remaining in the nebulizer cup.

Internal contents sterile. External surface of vial not sterile.

INDICATIONS AND USAGE

The contents of these vials are used in conjunction with a nebulizer for the induction of sputum production where sputum production is indicated.

INSTRUCTIONS FOR USE SECTION

Hold vial gently twist and pull off top. Invert and squeeze to dispense prescribed volume into the nebulizer cup.

How Supplied

Single-use plastic vials containing 4ml solution in cartons of 60 vials.

WARNINGS

Not for injection or parenteral administration.

STORAGE

Store at room temperature 15° to 30° C (50° to 86°F). Avoid excessive heat and protect from freezing.

Sodium Chloride Inhalation Solution USP 3% 4 mL

PRODUCT CODE 50190-142-63

Rx Only

Manufactured by: Asept Pak, Inc. , Malone, NY 12953

Distributed by: PharmaCaribe LLC. , Punta Gorda, FL 33950

NEBUSAL

nebulizer (direct patient interface)

Product Information

Product Type
MEDICAL DEVICE
Item Code (Source)
NHRIC:50190-142

Active Ingredient/Active Moiety

Ingredient Name
Basis of Strength
Strength

SODIUM CHLORIDE (CHLORIDE ION and SODIUM CATION)
SODIUM CHLORIDE
120 mg  in 4 mL

Product Characteristics

number of times usable
1

Packaging

#
Item Code
Package Description
Marketing Start Date
Marketing End Date

1
NHRIC:50190-142-63
60  in 1 BOX

1

4 mL in 1 VIAL

Marketing Information

Marketing Category
Application Number or Monograph Citation
Marketing Start Date
Marketing End Date

exempt device
CAF
10/26/2011

Labeler - PharmaCaribe
							(011702541)

Registrant - PharmaCaribe (011702541)

Establishment

Name
Address
ID/FEI
Business Operations

PharmaCaribe

011702541
label

Revised: 9/2013

Document Id: 15d6e9ee-021b-4f44-9826-26b8a6b1035b

Set id: b4fd60c9-6fd9-430a-b4f6-0424b46bdbe1

Version: 1

Effective Time: 20130912

PharmaCaribe


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <link rel="stylesheet" href="../css/style1.css"/>

    <title>My Facets</title>

    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">

Home

My Facets

Add New Facet

Edit a Facet

History

                    <form id="facetSearch" method="get" action="./profileR.html">

Choose a Group:

                            <select id="group" name="groups">
                                <option value="gr1">Group 1</option>
                                <option value="gr2">Group 2</option>
                                <option value="gr3">MyStore</option>
                            </select>

Choose a Time Period:

From: <input type="text" id="Fdatepicker">

To: <input type="text" id="Tdatepicker">

Choose a Facet:

                            <select id="facet" name="facets">
                                <option value="fc1">Facet 1</option>
                                <option value="fc2">black_friday</option>
                                <option value="fc3">New arrival</option>
                            </select>

Choose Statistics:

Likes<input type="checkbox" name="stats" value="likes" checked>

Comments<input type="checkbox" name="stats" value="comments">

Posts<input type="checkbox" name="stats" value="posts" checked>

                        <input type="submit" value="Search" id="search"/>
                        <input type="submit" value="Reset" id="reset"/>
                    </form>

                    My Facets:

                        <form name="editFacet" class="_editF">
                            <input type="button" value="Delete" id="delF1" />
                            <input type="submit" value="Edit" id="editF1"/>
                        </form>

                        Facet 1

keyword 1

keyword 2

keyword 3

                        <form name="editFacet" class="_editF" method="get" action="./editfacetbf.html">
                            <input type="button" value="Delete" id="delF2" />
                            <input type="submit" value="Edit" id="editF2"/>
                        </form>

                        black_friday

offer

discount

outlet

deal

                        <form name="editFacet" class="_editF">
                            <input type="button" value="Delete" id="delF3" />
                            <input type="submit" value="Edit" id="editF3"/>
                        </form>

                        New arrival

new arrival

brand new

ship

Help

Privacy Policy

Supported by @Demokritos

Contact Info


text:
require 'aliyun/oss'

##
# Help initialize OSS Client. User can use it easily at any place in
# your rails application.
# @example
#   OSS.client.list_buckets
#   bucket = OSS.client.get_bucket('my-bucket')
#   bucket.list_objects
module OSS
  def self.client
    unless @client
      Aliyun::Common::Logging.set_log_file('./log/oss_sdk.log')

      @client = Aliyun::OSS::Client.new(
        endpoint:
          Rails.application.secrets.aliyun_oss['endpoint'],
        access_key_id:
          Rails.application.secrets.aliyun_oss['access_key_id'],
        access_key_secret:
          Rails.application.secrets.aliyun_oss['access_key_secret']
      )
    end

    @client
  end
end


text:
<html>
	<script type="text/javascript" src="textformatter.js"></script>

	<script>
		TextFormatter.setFormat('year', function (date) {
			return date.getFullYear();
		});

		var formattedText = TextFormatter.format('Current year: {0:year}. Full format: {0}', new Date());
		console.log(formattedText);
	</script>

</html>


text:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

#include "GameInventorySystem.h"
#include "GISInventoryBaseComponent.h"

#include "Widgets/GISLootContainerBaseWidget.h"

#include "GISItemData.h"

#include "Net/UnrealNetwork.h"
#include "Engine/ActorChannel.h"

#include "GISPickupActor.h"

AGISPickupActor::AGISPickupActor(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	bReplicates = true;
	bIsCurrentlyBeingLooted = false;
}

void AGISPickupActor::BeginPlay()
{
	//for (TSubclassOf<UGISItemData> Item : ItemToLootClass)
	//{
	//	UGISItemData* itemData = ConstructObject<UGISItemData>(Item, this);
	//	ItemToLoot.Add(itemData);
	//}
}
void AGISPickupActor::OpenLootWindow()
{

}
void AGISPickupActor::CloseLootWindow()
{

}
void AGISPickupActor::LootAllItems()
{
	//if (InteractingInventory.IsValid())
	//{
	//	InteractingInventory->LootAllItems(this);
	//}
}

void AGISPickupActor::LootSingleItem(int32 ItemIndexIn)
{
	//if (InteractingInventory.IsValid())
//	{
//		InteractingInventory->LootOneItem(ItemIndexIn, this);
//	}
}
//void AGISPickupActor::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty > & OutLifetimeProps) const
//{
//	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//
//	//DOREPLIFETIME(AGISPickupActor, ItemToLoot);
//}
bool AGISPickupActor::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

	//for (const UGISItemData* SlotItem : ItemToLoot)
	//{
	//	if (SlotItem)
	//	{
	//		WroteSomething |= Channel->ReplicateSubobject(const_cast<UGISItemData*>(SlotItem), *Bunch, *RepFlags);
	//	}
	//}
	return WroteSomething;
}
void AGISPickupActor::GetSubobjectsWithStableNamesForNetworking(TArray<UObject*>& Objs)
{
	//for (const UGISItemData* SlotItem : ItemToLoot)
	//	{
	//		if (SlotItem)
	//		{
	//			Objs.Add(const_cast<UGISItemData*>(SlotItem));
	//		}
	//	}
}

/** Called on the actor when a new subobject is dynamically created via replication */
void AGISPickupActor::OnSubobjectCreatedFromReplication(UObject *NewSubobject)
{
	Super::OnSubobjectCreatedFromReplication(NewSubobject);

	//UGISItemData* newItemData = Cast<UGISItemData>(NewSubobject);
	//if (newItemData)
	//{
	//	ItemToLoot.Add(newItemData);
	//}
}

/** Called on the actor when a new subobject is dynamically created via replication */
void AGISPickupActor::OnSubobjectDestroyFromReplication(UObject *NewSubobject)
{
	Super::OnSubobjectDestroyFromReplication(NewSubobject);
}


text:
THIS_DIR=$(dirname $0)

# remove driver
grep gdrdrv /proc/devices >/dev/null && sudo /sbin/rmmod gdrdrv

# insert driver
sudo /sbin/insmod src/gdrdrv/gdrdrv.ko dbg_enabled=0 info_enabled=0

# create device inodes
major=`fgrep gdrdrv /proc/devices | cut -b 1-4`
echo "INFO: driver major is $major"

# remove old inodes just in case
if [ -e /dev/gdrdrv ]; then
    sudo rm /dev/gdrdrv
fi

echo "INFO: creating /dev/gdrdrv inode"
sudo mknod /dev/gdrdrv c $major 0
sudo chmod a+w+r /dev/gdrdrv


text:
package com.yngvark.gridwalls.microservices.zombie.run_game;

import com.yngvark.communicate_through_named_pipes.output.OutputFileWriter;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.BlockingGameEventProducer;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.NetworkMsgListener;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.NetworkMsgListenerContext;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.Producer;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.ProducerContext;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.get_map_info.MapInfoReceiver;
import com.yngvark.gridwalls.microservices.zombie.run_game.produce_and_consume_msgs.move.ZombieMoverFactory;
import com.yngvark.gridwalls.microservices.zombie.run_game.serialize_msgs.Serializer;

import java.util.Random;
import java.util.concurrent.ScheduledExecutorService;

public class GameFactory {
    private final NetworkMsgListener networkMsgListener;
    private final Producer producer;

    public static GameFactory create(
            Sleeper sleeper,
            Random random,
            Serializer serializer,
            ScheduledExecutorService scheduledExecutorService) {
        MapInfoReceiver mapInfoReceiver = new MapInfoReceiver(
                serializer,
                new ZombieMoverFactory(
                        serializer,
                        sleeper,
                        random
                ),
                scheduledExecutorService
        );

        return new GameFactory(mapInfoReceiver, mapInfoReceiver);
    }

    private GameFactory(
            NetworkMsgListener networkMsgListener,
            Producer producer) {
        this.networkMsgListener = networkMsgListener;
        this.producer = producer;
    }

    public GameEventProducer create(OutputFileWriter outputFileWriter) {
        return new BlockingGameEventProducer(
                outputFileWriter,
                new ProducerContext(producer)
        );
    }

    public NetworkMessageListener createNetworkMessageListener() {
        return new NetworkMsgListenerContext(networkMsgListener);
    }

}


text:
layout: page
title: Cooke - Jordan Wedding
date: 2016-05-24
author: Brandon Mullen
tags: weekly links, java
status: published
summary: Aliquam pellentesque ullamcorper dolor, eget tristique enim.
banner: images/banner/people.jpg
booking:
  startDate: 11/16/2019
  endDate: 11/19/2019
  ctyhocn: STLDSHX
  groupCode: CJW
published: true
---
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam venenatis scelerisque arcu. Aenean venenatis dapibus ipsum, vel convallis dolor tempor id. Maecenas id ornare urna. Cras euismod neque eget nisi scelerisque, non pulvinar arcu consequat. Quisque interdum dictum viverra. Pellentesque scelerisque condimentum ligula sed finibus.
Nullam a odio sed purus elementum congue id non erat. In convallis fringilla justo vitae vestibulum. Fusce elementum condimentum magna, at hendrerit arcu consequat quis. Aenean ultrices enim enim, at vestibulum lorem accumsan eu. Curabitur et augue risus. Curabitur gravida pellentesque purus at feugiat. Duis sit amet ultricies ante. In blandit euismod nisi eu porta. Suspendisse blandit magna in elit gravida tincidunt. Donec bibendum, ligula at iaculis rutrum, lorem quam cursus metus, quis fermentum quam justo in magna. Nulla ullamcorper eros et ultrices vulputate. Aenean posuere cursus consectetur. Praesent in sapien blandit, sagittis leo sed, pulvinar enim. Nunc pulvinar mauris et lacinia maximus. Morbi sem sem, vestibulum non tristique ut, dictum a arcu.

1 Nunc a elit eu lectus porttitor vulputate.

Curabitur id arcu urna. Integer pharetra tempor enim, feugiat vulputate diam dapibus in. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer faucibus massa vitae odio rutrum, id consectetur diam pharetra. Quisque feugiat magna at urna vulputate tempus. Nam hendrerit diam id dui tincidunt, sit amet viverra libero pulvinar. Nunc a volutpat eros.


text:
package com.alexrwegener.dagger2byexamples.di;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;

@Scope @Retention(RetentionPolicy.RUNTIME) public @interface ScreenScope {
    Class<?> value();
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = getImplicitRoleForOl;

/**
 * Returns the implicit role for an ol tag.
 */
function getImplicitRoleForOl() {
  return 'list';
}


text:
'use strict';

var assert = require('assert');
var utils = require('./utils');

/**
 * Storage model for DHT items, which is serialized to JSON before being passed
 * to the storage adapter
 * @constructor
 * @param {String} key - Lookup key
 * @param {String} value - Stored value
 * @param {String} publisher - Original publisher's nodeID
 * @param {Number} timestamp - Optional UNIX timestamp of original publication
 */
function Item(key, value, publisher, timestamp) {
  if (!(this instanceof Item)) {
    return new Item(key, value, publisher, timestamp);
  }

  if (typeof key !== 'string') {
      throw new Error('Invalid key supplied');
  }
  //assert(typeof value === 'string', 'Value must be a string');
  if (!utils.isValidKey(publisher)) {
      throw new Error('Invalid publisher nodeID supplied');
  }

  if (timestamp) {
    assert(typeof timestamp === 'number', 'Invalid timestamp supplied');
    assert(Date.now() >= timestamp, 'Timestamp cannot be in the future');
  }

  this.key = key;
  this.value = value;
  this.publisher = publisher;
  this.timestamp = timestamp || Date.now();
}

module.exports = Item;


text:
package org.reasm.m68k.assembly.internal;

import javax.annotation.Nonnull;

final class IfBlockState {

    @Nonnull
    final DynamicSourceLocationIterator iterator;

    IfBlockState(@Nonnull DynamicSourceLocationIterator iterator) {
        this.iterator = iterator;
    }

}


text:
import unittest
import random
import axelrod

class TestRoundRobin(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.game = axelrod.Game()

    @classmethod
    def payoffs2scores(cls, payoffs):
        return [sum([pp for ipp, pp in enumerate(p) if ipp != ip])
                for ip, p in enumerate(payoffs)]

    @classmethod
    def get_test_outcome(cls, outcome, turns=10):

        # Extract the name of players from the outcome tupples,
        # and initiate the players by getting the classes from axelrod.
        names = [out[0] for out in outcome]
        players = [getattr(axelrod, n)() for n in names]

        # Do the actual game and build the expected outcome tuples.
        round_robin = axelrod.RoundRobin(
            players=players, game=cls.game, turns=turns)
        payoffs = round_robin.play()['payoff']
        scores = cls.payoffs2scores(payoffs)
        outcome = zip(names, scores)

        # The outcome is expected to be sort by score.
        return sorted(outcome, key=lambda k: k[1])

    def test_deterministic_cache(self):
        p1, p2, p3 = axelrod.Cooperator(), axelrod.Defector(), axelrod.Random()
        rr = axelrod.RoundRobin(players=[p1, p2, p3], game=self.game, turns=20)
        self.assertEquals(rr.deterministic_cache, {})
        rr.play()
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Defector, axelrod.Defector)]['scores'], (20, 20))
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Defector, axelrod.Defector)]['cooperation_rates'], (0, 0))
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Cooperator, axelrod.Cooperator)]['scores'], (60, 60))
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Cooperator, axelrod.Cooperator)]['cooperation_rates'], (20, 20))
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Cooperator, axelrod.Defector)]['scores'], (0, 100))
        self.assertEqual(rr.deterministic_cache[
            (axelrod.Cooperator, axelrod.Defector)]['cooperation_rates'], (20, 0))
        self.assertFalse(
            (axelrod.Random, axelrod.Random) in rr.deterministic_cache)

    def test_noisy_cache(self):
        p1, p2, p3 = axelrod.Cooperator(), axelrod.Defector(), axelrod.Random()
        rr = axelrod.RoundRobin(
            players=[p1, p2, p3], game=self.game, turns=20, noise=0.2)
        rr.play()
        self.assertEqual(rr.deterministic_cache, {})

    def test_calculate_score_for_mix(self):
        """Test that scores are calculated correctly."""
        P1 = axelrod.Defector()
        P1.history = ['C', 'C', 'D']
        P2 = axelrod.Defector()
        P2.history = ['C', 'D', 'D']
        round_robin = axelrod.RoundRobin(
            players=[P1, P2], game=self.game, turns=200)
        self.assertEqual(round_robin._calculate_scores(P1, P2), (4, 9))

    def test_calculate_score_for_all_cooperate(self):
        """Test that scores are calculated correctly."""
        P1 = axelrod.Player()
        P1.history = ['C', 'C', 'C']
        P2 = axelrod.Player()
        P2.history = ['C', 'C', 'C']
        round_robin = axelrod.RoundRobin(
            players=[P1, P2], game=self.game, turns=200)
        self.assertEqual(round_robin._calculate_scores(P1, P2), (9, 9))

    def test_calculate_score_for_all_defect(self):
        """Test that scores are calculated correctly."""
        P1 = axelrod.Player()
        P1.history = ['D', 'D', 'D']
        P2 = axelrod.Player()
        P2.history = ['D', 'D', 'D']
        round_robin = axelrod.RoundRobin(
            players=[P1, P2], game=self.game, turns=200)
        self.assertEqual(round_robin._calculate_scores(P1, P2), (3, 3))

    def test_round_robin_defector_v_cooperator(self):
        """Test round robin: the defector viciously punishes the cooperator."""
        outcome = [('Cooperator', 0), ('Defector', 50)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)

    def test_round_robin_defector_v_titfortat(self):
        """Test round robin: the defector does well against tit for tat."""
        outcome = [('TitForTat', 9), ('Defector', 14)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)

    def test_round_robin_cooperator_v_titfortat(self):
        """Test round robin: the cooperator does very well WITH tit for tat."""
        outcome = [('Cooperator', 30), ('TitForTat', 30)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)

    def test_round_robin_cooperator_v_titfortat_v_defector(self):
        """Test round robin: the defector dominates in this population."""
        outcome = [('Cooperator', 30), ('TitForTat', 39), ('Defector', 64)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)

    def test_round_robin_cooperator_v_titfortat_v_defector_v_grudger(self):
        """Test round robin: tit for tat does better this time around."""
        outcome = [
            ('Cooperator', 60),
            ('TitForTat', 69),
            ('Grudger', 69),
            ('Defector', 78)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)

    def test_round_robin_cooperator_v_titfortat_v_defector_v_grudger_v_go_by_majority(self):
        """Test round robin: Tit for tat is doing a lot better."""
        outcome = [
            ('Cooperator', 90),
            ('Defector', 92),
            ('Grudger', 99),
            ('GoByMajority', 99),
            ('TitForTat', 99)]
        self.assertEqual(self.get_test_outcome(outcome), outcome)


text:
middleware for express http response

## Installation

```bash
$ npm install express-json-response
```

## Quick Start

```javascript
var express = require('express'),
	expressResponse = require('express-json-response'),
    app;

app = express();
app.use(expressResponse());

app.get('/', function(req, res) {
	res.sendData({message: 'example'});
});

// Available methods
// 2xx Success
res.sendOk()
res.sendCreated()
res.sendData()
// 4xx Client Error
res.sendBadRequest()
res.sendUnauthorized()
res.sendForbidden()
res.sendNotFound()
res.sendMethodNotAllowed()
res.sendConflict()
// 5xx Server Error
res.sendServerError()
```

## Tests

  To run the test suite, first install the dependencies, then run `npm test`:

```bash
$ npm install
$ npm test
```

## License

  [MIT](LICENSE)


text:
import os
import datetime
import logging

from django.core.management.base import CommandError
from django.conf import settings

from elasticsearch import helpers

from olympia.amo import search as amo_search

from .models import Reindexing

log = logging.getLogger('z.es')

# shortcut functions
is_reindexing_amo = Reindexing.objects.is_reindexing_amo
flag_reindexing_amo = Reindexing.objects.flag_reindexing_amo
unflag_reindexing_amo = Reindexing.objects.unflag_reindexing_amo
get_indices = Reindexing.objects.get_indices

def index_objects(ids, model, search, index=None, transforms=None,
                  objects=None):
    if index is None:
        index = model._get_index()
    if objects is None:
        objects = model.objects

    indices = Reindexing.objects.get_indices(index)

    if transforms is None:
        transforms = []

    qs = objects.no_cache().filter(id__in=ids)
    for t in transforms:
        qs = qs.transform(t)

    bulk = []
    for ob in qs:
        data = search.extract(ob)
        for index in indices:
            bulk.append({
                "_source": data,
                "_id": ob.id,
                "_type": ob.get_mapping_type(),
                "_index": index
            })

    es = amo_search.get_es()
    return helpers.bulk(es, bulk)

def raise_if_reindex_in_progress(site):
    """Checks if the database indexation flag is on for the given site.

    If it's on, and if no "FORCE_INDEXING" variable is present in the env,
    raises a CommandError.
    """
    already_reindexing = Reindexing.objects._is_reindexing(site)
    if already_reindexing and 'FORCE_INDEXING' not in os.environ:
        raise CommandError("Indexation already occuring. Add a FORCE_INDEXING "
                           "variable in the environ to force it")

def timestamp_index(index):
    """Return index-YYYYMMDDHHMMSS with the current time."""
    return '%s-%s' % (index, datetime.datetime.now().strftime('%Y%m%d%H%M%S'))

def create_index(index, config=None):
    """Create an index if it's not present.

    Return the index name.

    Options:

    - index: name of the index.
    - config: if provided, used as the settings option for the
      ES calls.
    """
    es = amo_search.get_es()

    if settings.IN_TEST_SUITE:
        if not config:
            config = {}
        # Be nice to ES running on ci.mozilla.org
        config.update({
            'number_of_shards': 3,
            'number_of_replicas': 0
        })

    if not es.indices.exists(index):
        es.indices.create(index, body=config, ignore=400)

    return index