text:
package io.netty.handler.ssl;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.base64.Base64;
import io.netty.handler.codec.base64.Base64Dialect;
import io.netty.util.NetUtil;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.PlatformDependent;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import javax.net.ssl.SSLHandshakeException;

import static java.util.Arrays.asList;

/**
 * Constants for SSL packets.
 */
final class SslUtils {
    // See https://tools.ietf.org/html/rfc8446#appendix-B.4
    static final Set<String> TLSV13_CIPHERS = Collections.unmodifiableSet(new LinkedHashSet<>(
            asList("TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256",
                    "TLS_AES_128_GCM_SHA256", "TLS_AES_128_CCM_8_SHA256",
                    "TLS_AES_128_CCM_SHA256")));
    // Protocols
    static final String PROTOCOL_SSL_V2_HELLO = "SSLv2Hello";
    static final String PROTOCOL_SSL_V2 = "SSLv2";
    static final String PROTOCOL_SSL_V3 = "SSLv3";
    static final String PROTOCOL_TLS_V1 = "TLSv1";
    static final String PROTOCOL_TLS_V1_1 = "TLSv1.1";
    static final String PROTOCOL_TLS_V1_2 = "TLSv1.2";
    static final String PROTOCOL_TLS_V1_3 = "TLSv1.3";

    static final String INVALID_CIPHER = "SSL_NULL_WITH_NULL_NULL";

    /**
     * change cipher spec
     */
    static final int SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC = 20;

    /**
     * alert
     */
    static final int SSL_CONTENT_TYPE_ALERT = 21;

    /**
     * handshake
     */
    static final int SSL_CONTENT_TYPE_HANDSHAKE = 22;

    /**
     * application data
     */
    static final int SSL_CONTENT_TYPE_APPLICATION_DATA = 23;

    /**
     * HeartBeat Extension
     */
    static final int SSL_CONTENT_TYPE_EXTENSION_HEARTBEAT = 24;

    /**
     * the length of the ssl record header (in bytes)
     */
    static final int SSL_RECORD_HEADER_LENGTH = 5;

    /**
     * Not enough data in buffer to parse the record length
     */
    static final int NOT_ENOUGH_DATA = -1;

    /**
     * data is not encrypted
     */
    static final int NOT_ENCRYPTED = -2;

    static final String[] DEFAULT_CIPHER_SUITES;
    static final String[] DEFAULT_TLSV13_CIPHER_SUITES;
    static final String[] TLSV13_CIPHER_SUITES = { "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384" };

    static {
        if (PlatformDependent.javaVersion() >= 11) {
            DEFAULT_TLSV13_CIPHER_SUITES = TLSV13_CIPHER_SUITES;
        } else {
            DEFAULT_TLSV13_CIPHER_SUITES = EmptyArrays.EMPTY_STRINGS;
        }

        List<String> defaultCiphers = new ArrayList<>();
        // GCM (Galois/Counter Mode) requires JDK 8.
        defaultCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384");
        defaultCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256");
        defaultCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256");
        defaultCiphers.add("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384");
        defaultCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA");
        // AES256 requires JCE unlimited strength jurisdiction policy files.
        defaultCiphers.add("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA");
        // GCM (Galois/Counter Mode) requires JDK 8.
        defaultCiphers.add("TLS_RSA_WITH_AES_128_GCM_SHA256");
        defaultCiphers.add("TLS_RSA_WITH_AES_128_CBC_SHA");
        // AES256 requires JCE unlimited strength jurisdiction policy files.
        defaultCiphers.add("TLS_RSA_WITH_AES_256_CBC_SHA");

        Collections.addAll(defaultCiphers, DEFAULT_TLSV13_CIPHER_SUITES);

        DEFAULT_CIPHER_SUITES = defaultCiphers.toArray(new String[0]);
    }

    /**
     * Add elements from {@code names} into {@code enabled} if they are in {@code supported}.
     */
    static void addIfSupported(Set<String> supported, List<String> enabled, String... names) {
        for (String n: names) {
            if (supported.contains(n)) {
                enabled.add(n);
            }
        }
    }

    static void useFallbackCiphersIfDefaultIsEmpty(List<String> defaultCiphers, Iterable<String> fallbackCiphers) {
        if (defaultCiphers.isEmpty()) {
            for (String cipher : fallbackCiphers) {
                if (cipher.startsWith("SSL_") || cipher.contains("_RC4_")) {
                    continue;
                }
                defaultCiphers.add(cipher);
            }
        }
    }

    static void useFallbackCiphersIfDefaultIsEmpty(List<String> defaultCiphers, String... fallbackCiphers) {
        useFallbackCiphersIfDefaultIsEmpty(defaultCiphers, asList(fallbackCiphers));
    }

    /**
     * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
     */
    static SSLHandshakeException toSSLHandshakeException(Throwable e) {
        if (e instanceof SSLHandshakeException) {
            return (SSLHandshakeException) e;
        }

        return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
    }

    /**
     * Return how much bytes can be read out of the encrypted data. Be aware that this method will not increase
     * the readerIndex of the given {@link ByteBuf}.
     *
     * @param   buffer
     *                  The {@link ByteBuf} to read from. Be aware that it must have at least
     *                  {@link #SSL_RECORD_HEADER_LENGTH} bytes to read,
     *                  otherwise it will throw an {@link IllegalArgumentException}.
     * @return length
     *                  The length of the encrypted packet that is included in the buffer or
     *                  {@link #SslUtils#NOT_ENOUGH_DATA} if not enough data is present in the
     *                  {@link ByteBuf}. This will return {@link SslUtils#NOT_ENCRYPTED} if
     *                  the given {@link ByteBuf} is not encrypted at all.
     * @throws IllegalArgumentException
     *                  Is thrown if the given {@link ByteBuf} has not at least {@link #SSL_RECORD_HEADER_LENGTH}
     *                  bytes to read.
     */
    static int getEncryptedPacketLength(ByteBuf buffer, int offset) {
        int packetLength = 0;

        // SSLv3 or TLS - Check ContentType
        boolean tls;
        switch (buffer.getUnsignedByte(offset)) {
            case SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC:
            case SSL_CONTENT_TYPE_ALERT:
            case SSL_CONTENT_TYPE_HANDSHAKE:
            case SSL_CONTENT_TYPE_APPLICATION_DATA:
            case SSL_CONTENT_TYPE_EXTENSION_HEARTBEAT:
                tls = true;
                break;
            default:
                // SSLv2 or bad data
                tls = false;
        }

        if (tls) {
            // SSLv3 or TLS - Check ProtocolVersion
            int majorVersion = buffer.getUnsignedByte(offset + 1);
            if (majorVersion == 3) {
                // SSLv3 or TLS
                packetLength = unsignedShortBE(buffer, offset + 3) + SSL_RECORD_HEADER_LENGTH;
                if (packetLength <= SSL_RECORD_HEADER_LENGTH) {
                    // Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
                    tls = false;
                }
            } else {
                // Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
                tls = false;
            }
        }

        if (!tls) {
            // SSLv2 or bad data - Check the version
            int headerLength = (buffer.getUnsignedByte(offset) & 0x80) != 0 ? 2 : 3;
            int majorVersion = buffer.getUnsignedByte(offset + headerLength + 1);
            if (majorVersion == 2 || majorVersion == 3) {
                // SSLv2
                packetLength = headerLength == 2 ?
                        (shortBE(buffer, offset) & 0x7FFF) + 2 : (shortBE(buffer, offset) & 0x3FFF) + 3;
                if (packetLength <= headerLength) {
                    return NOT_ENOUGH_DATA;
                }
            } else {
                return NOT_ENCRYPTED;
            }
        }
        return packetLength;
    }

    // Reads a big-endian unsigned short integer from the buffer
    @SuppressWarnings("deprecation")
    private static int unsignedShortBE(ByteBuf buffer, int offset) {
        return buffer.order() == ByteOrder.BIG_ENDIAN ?
                buffer.getUnsignedShort(offset) : buffer.getUnsignedShortLE(offset);
    }

    // Reads a big-endian short integer from the buffer
    @SuppressWarnings("deprecation")
    private static short shortBE(ByteBuf buffer, int offset) {
        return buffer.order() == ByteOrder.BIG_ENDIAN ?
                buffer.getShort(offset) : buffer.getShortLE(offset);
    }

    private static short unsignedByte(byte b) {
        return (short) (b & 0xFF);
    }

    // Reads a big-endian unsigned short integer from the buffer
    private static int unsignedShortBE(ByteBuffer buffer, int offset) {
        return shortBE(buffer, offset) & 0xFFFF;
    }

    // Reads a big-endian short integer from the buffer
    private static short shortBE(ByteBuffer buffer, int offset) {
        return buffer.order() == ByteOrder.BIG_ENDIAN ?
                buffer.getShort(offset) : ByteBufUtil.swapShort(buffer.getShort(offset));
    }

    static int getEncryptedPacketLength(ByteBuffer[] buffers, int offset) {
        ByteBuffer buffer = buffers[offset];

        // Check if everything we need is in one ByteBuffer. If so we can make use of the fast-path.
        if (buffer.remaining() >= SSL_RECORD_HEADER_LENGTH) {
            return getEncryptedPacketLength(buffer);
        }

        // We need to copy 5 bytes into a temporary buffer so we can parse out the packet length easily.
        ByteBuffer tmp = ByteBuffer.allocate(5);

        do {
            buffer = buffers[offset++].duplicate();
            if (buffer.remaining() > tmp.remaining()) {
                buffer.limit(buffer.position() + tmp.remaining());
            }
            tmp.put(buffer);
        } while (tmp.hasRemaining());

        // Done, flip the buffer so we can read from it.
        tmp.flip();
        return getEncryptedPacketLength(tmp);
    }

    private static int getEncryptedPacketLength(ByteBuffer buffer) {
        int packetLength = 0;
        int pos = buffer.position();
        // SSLv3 or TLS - Check ContentType
        boolean tls;
        switch (unsignedByte(buffer.get(pos))) {
            case SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC:
            case SSL_CONTENT_TYPE_ALERT:
            case SSL_CONTENT_TYPE_HANDSHAKE:
            case SSL_CONTENT_TYPE_APPLICATION_DATA:
            case SSL_CONTENT_TYPE_EXTENSION_HEARTBEAT:
                tls = true;
                break;
            default:
                // SSLv2 or bad data
                tls = false;
        }

        if (tls) {
            // SSLv3 or TLS - Check ProtocolVersion
            int majorVersion = unsignedByte(buffer.get(pos + 1));
            if (majorVersion == 3) {
                // SSLv3 or TLS
                packetLength = unsignedShortBE(buffer, pos + 3) + SSL_RECORD_HEADER_LENGTH;
                if (packetLength <= SSL_RECORD_HEADER_LENGTH) {
                    // Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
                    tls = false;
                }
            } else {
                // Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
                tls = false;
            }
        }

        if (!tls) {
            // SSLv2 or bad data - Check the version
            int headerLength = (unsignedByte(buffer.get(pos)) & 0x80) != 0 ? 2 : 3;
            int majorVersion = unsignedByte(buffer.get(pos + headerLength + 1));
            if (majorVersion == 2 || majorVersion == 3) {
                // SSLv2
                packetLength = headerLength == 2 ?
                        (shortBE(buffer, pos) & 0x7FFF) + 2 : (shortBE(buffer, pos) & 0x3FFF) + 3;
                if (packetLength <= headerLength) {
                    return NOT_ENOUGH_DATA;
                }
            } else {
                return NOT_ENCRYPTED;
            }
        }
        return packetLength;
    }

    static void handleHandshakeFailure(ChannelHandlerContext ctx, Throwable cause, boolean notify) {
        // We have may haven written some parts of data before an exception was thrown so ensure we always flush.
        // See https://github.com/netty/netty/issues/3900#issuecomment-172481830
        ctx.flush();
        if (notify) {
            ctx.fireUserEventTriggered(new SslHandshakeCompletionEvent(cause));
        }
        ctx.close();
    }

    /**
     * Fills the {@link ByteBuf} with zero bytes.
     */
    static void zeroout(ByteBuf buffer) {
        if (!buffer.isReadOnly()) {
            buffer.setZero(0, buffer.capacity());
        }
    }

    /**
     * Fills the {@link ByteBuf} with zero bytes and releases it.
     */
    static void zerooutAndRelease(ByteBuf buffer) {
        zeroout(buffer);
        buffer.release();
    }

    /**
     * Same as {@link Base64#encode(ByteBuf, boolean)} but allows the use of a custom {@link ByteBufAllocator}.
     *
     * @see Base64#encode(ByteBuf, boolean)
     */
    static ByteBuf toBase64(ByteBufAllocator allocator, ByteBuf src) {
        ByteBuf dst = Base64.encode(src, src.readerIndex(),
                src.readableBytes(), true, Base64Dialect.STANDARD, allocator);
        src.readerIndex(src.writerIndex());
        return dst;
    }

    /**
     * Validate that the given hostname can be used in SNI extension.
     */
    static boolean isValidHostNameForSNI(String hostname) {
        return hostname != null &&
               hostname.indexOf('.') > 0 &&
               !hostname.endsWith(".") &&
               !NetUtil.isValidIpV4Address(hostname) &&
               !NetUtil.isValidIpV6Address(hostname);
    }

    /**
     * Returns {@code true} if the the given cipher (in openssl format) is for TLSv1.3, {@code false} otherwise.
     */
    static boolean isTLSv13Cipher(String cipher) {
        // See https://tools.ietf.org/html/rfc8446#appendix-B.4
        return TLSV13_CIPHERS.contains(cipher);
    }

    private SslUtils() {
    }
}


text:
ImportedBookmarkEntry::ImportedBookmarkEntry()
    : in_toolbar(false),
      is_folder(false) {}

ImportedBookmarkEntry::ImportedBookmarkEntry(
    const ImportedBookmarkEntry& other) = default;

ImportedBookmarkEntry::~ImportedBookmarkEntry() {}

bool ImportedBookmarkEntry::operator==(
    const ImportedBookmarkEntry& other) const {
  return (in_toolbar == other.in_toolbar &&
          is_folder == other.is_folder &&
          url == other.url &&
          path == other.path &&
          title == other.title &&
          creation_time == other.creation_time);
}

redpajama_set_name: RedPajamaGithub


text:
using Kentico.Kontent.Delivery.Abstractions;
using Newtonsoft.Json;
using System.Diagnostics;

namespace Kentico.Kontent.Delivery.SharedModels
{
    /// <inheritdoc/>
    [DebuggerDisplay("Name = {" + nameof(Name) + "}")]
    internal sealed class MultipleChoiceOption : IMultipleChoiceOption
    {
        /// <inheritdoc/>
        [JsonProperty("name")]
        public string Name { get; internal set; }

        /// <inheritdoc/>
        [JsonProperty("codename")]
        public string Codename { get; internal set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="MultipleChoiceOption"/> class with the specified JSON data.
        /// </summary>
        [JsonConstructor]
        public MultipleChoiceOption()
        {
        }
    }
}


text:
typedef NS_ENUM(uint32_t, NugCollectionUpdatesOption) {
  NugCollectionUpdatesOptionNone = 0
};

@interface NugCollectionUpdatesSectionMove : NSObject
@property (nonatomic, readonly) NSUInteger from;
@property (nonatomic, readonly) NSUInteger to;
+ (instancetype)moveFrom:(NSUInteger)from to:(NSUInteger)to;
@end

@interface NugCollectionUpdatesRowMove : NSObject
@property (nonatomic, strong, readonly) NSIndexPath * from;
@property (nonatomic, strong, readonly) NSIndexPath * to;
+ (instancetype)moveFrom:(NSIndexPath *)from to:(NSIndexPath *)to;
@end

@interface NugCollectionUpdates : NSObject

@property (nonatomic, strong, readonly) NSArray * indexPathsForInsertedRows;
@property (nonatomic, strong, readonly) NSArray * indexPathsForDeletedRows;
@property (nonatomic, strong, readonly) NSIndexSet * indexSetForInsertedSections;
@property (nonatomic, strong, readonly) NSIndexSet * indexSetForDeletedSections;
@property (nonatomic, strong, readonly) NSArray * sectionMoves;
@property (nonatomic, strong, readonly) NSArray * rowMoves;

+ (NugCollectionUpdates *)empty;
+ (NugCollectionUpdates *)updates:(NugCollectionUpdatesOption)options
                             from:(NugCollection *)from
                               to:(NugCollection *)to;
@end


text:
using Bridge.Test.NUnit;
using System;
using System.Reflection;

namespace Bridge.ClientTest.Batch3.BridgeIssues
{
    /// <summary>
    /// The tests here consists in ensuring non-nullable types receives their
    /// default values whenever assigned 'null' from reflection's SetValue().
    /// </summary>
    [TestFixture(TestNameFormat = "#3939 - {0}")]
    public class Bridge3939
    {
        /// <summary>
        /// Defines a class with different types of non-nullable variables
        /// through properties and fields.
        /// </summary>
        [Reflectable]
        public class Test
        {
            public int Int32Prop { get; set; } = 1;
            public int Int32Field = 2;
            public long Int64Prop { get; set; } = 3L;
            public long Int64Field = 4L;
            public float SingleProp { get; set; } = 5.1f;
            public float SingleField = 5.2f;
            public double DoubleProp { get; set; } = 6.1f;
            public double DoubleField = 6.2f;
            public decimal DecimalProp { get; set; } = 7.1m;
            public decimal DecimalField = 7.2m;
        }

        /// <summary>
        /// Tests by just inline-binding null to the variables and then
        /// checking the result against the type's default() value.
        /// </summary>
        [Test]
        public static void TestReflectionSetValue()
        {
            Test test = new Test();

            test.GetType().GetProperty("Int32Prop").SetValue(test, null);
            Assert.AreEqual(default(int), test.Int32Prop, "Int32 property gets default(int) when assigned \"null\" with reflection.");
            test.GetType().GetProperty("Int64Prop").SetValue(test, null);
            Assert.AreEqual(default(long), test.Int64Prop, "Int64 property gets default(long) when assigned \"null\" with reflection.");
            test.GetType().GetProperty("SingleProp").SetValue(test, null);
            Assert.AreEqual(default(float), test.SingleProp, "Single property gets default(float) when assigned \"null\" with reflection.");
            test.GetType().GetProperty("DoubleProp").SetValue(test, null);
            Assert.AreEqual(default(double), test.DoubleProp, "Double property gets default(double) when assigned \"null\" with reflection.");
            test.GetType().GetProperty("DecimalProp").SetValue(test, null);
            Assert.AreEqual(default(decimal), test.DecimalProp, "Decimal property gets default(decimal) when assigned \"null\" with reflection.");
        }
    }
}


text:
#ifndef __CYLINDERSENSOR_H3D
#define __CYLINDERSENSOR_H3D
//-------------------------------------------------------------------------
// Copyright (c) 1997-1998 Great Hill Corporation
// All Rights Reserved.
//-------------------------------------------------------------------------
// WARNING: THIS FILE WAS CREATED AUTOMATICALLY
//-------------------------------------------------------------------------
#include "PointingDeviceSensor.h"

/*----------------------------------------------------------------------
CLASS
	vrCylinderSensor

	This class corresponds to the CylinderSensor node in VRML.
	Further information
	about this class is available in any VRML related documentation.

DESCRIPTION

This node corresponds to the CylinderSensor node as defined in the VRML97
	specification.  Like all Node Classes this class is better described in the
	VRML97 Specification.  In particular, at this
	link.

NOTES

All node classes share certain aspects which are described here.

EXAMPLE CODE

	// None.

MEMBERS
----------------------------------------------------------------------*/
class LIBInterface vrCylinderSensor : public vrPointingDeviceSensor
{
protected:
	//<doc>------------------------------------------------------------
	//
Corresponds to the 'offset' exposedField.
	//
	// [default] 0.0
	//
	SFFloat             	m_Offset;

	//<doc>------------------------------------------------------------
	//
Corresponds to the 'diskAngle' exposedField.
	//
	// [default] 0.262
	//
	SFFloat             	m_DiskAngle;

	//<doc>------------------------------------------------------------
	//
Corresponds to the 'maxAngle' exposedField.
	//
	// [default] -1.0
	//
	SFFloat             	m_MaxAngle;

	//<doc>------------------------------------------------------------
	//
Corresponds to the 'minAngle' exposedField.
	//
	// [default] 0.0
	//
	SFFloat             	m_MinAngle;

	//<doc>------------------------------------------------------------
	//
Corresponds to the 'rotation' eventOut.
	//
	// [default] defRotation
	//
	SFRotation          	m_Rotation;

public:
	//<doc>------------------------------------------------------------
	//
Default constructor.
	//
	vrCylinderSensor(void);

	//<doc>------------------------------------------------------------
	//
Copy constructor.
	//
	vrCylinderSensor(const vrCylinderSensor& v);

	//<doc>------------------------------------------------------------
	//
Destructor.
	//
	virtual ~vrCylinderSensor(void);

	//<doc>------------------------------------------------------------
	//
Equals operator.
	//
	vrCylinderSensor& operator=(const vrCylinderSensor& v);

	//<doc>------------------------------------------------------------
	//
Returns an exact copy of the given node.
	//
	virtual SFNode Clone(void) const;

	//<doc>------------------------------------------------------------
	//
Set the value of the m_Offset member.
	//
	// [in] offset: The offset value.
	//
	void SetOffset(SFFloat offset);

	//<doc>------------------------------------------------------------
	//
Set the value of the m_DiskAngle member.
	//
	// [in] diskangle: The diskangle value.
	//
	void SetDiskAngle(SFFloat diskangle);

	//<doc>------------------------------------------------------------
	//
Set the value of the m_MaxAngle member.
	//
	// [in] maxangle: The maxangle value.
	//
	void SetMaxAngle(SFFloat maxangle);

	//<doc>------------------------------------------------------------
	//
Set the value of the m_MinAngle member.
	//
	// [in] minangle: The minangle value.
	//
	void SetMinAngle(SFFloat minangle);

	//<doc>------------------------------------------------------------
	//
Return the value of the m_Offset member.
	//
	SFFloat GetOffset(void) const;

	//<doc>------------------------------------------------------------
	//
Return the value of the m_DiskAngle member.
	//
	SFFloat GetDiskAngle(void) const;

	//<doc>------------------------------------------------------------
	//
Return the value of the m_MaxAngle member.
	//
	SFFloat GetMaxAngle(void) const;

	//<doc>------------------------------------------------------------
	//
Return the value of the m_MinAngle member.
	//
	SFFloat GetMinAngle(void) const;

	//<doc>------------------------------------------------------------
	//
Set the value of the m_Rotation member.
	//
	// [in] rotation: The rotation value.
	//
	void SetRotation(const SFRotation& rotation);

	//<doc>------------------------------------------------------------
	//
Return the value of the m_Rotation member.
	//
	SFRotation GetRotation(void) const;

	//<nodoc>------------------------------------------------------------
	//
Set the value of a field given the field's name and a value.
	//
Note: Error checking is done on 'fieldName' but cannot be done on 'val',
	//
      so make sure you send the correct type of data to this method.
	//
	// [in] fieldName: The name of the field to set (as specified in the VRML97 specification).
	// [in] val: Void pointer to a field of the type corresponding to fieldName.
	//
	virtual SFBool SetFieldValue(const SFString& fieldName, void *val);

	//<doc>------------------------------------------------------------
	//
Respond to a traversal by an arbitrary traverser.  Note: Normally, nodes just call t->Traverse(this)
	//
to have the traverser handle the traversal.  you may override this method in your derived class to
	//
handle traversals of node types.
	//
	// [in] trav: The vrTraverser requesting the traversal.
	//
	virtual void Traverse(vrTraverser *trav) const;

	//<doc>------------------------------------------------------------
	//
Receive an event during an event cascade or directly from caller.
	//
	// [in] event: The vrEvent to be processed.
	//
	virtual void ReceiveEventIn(vrEvent *event);

	//<doc>------------------------------------------------------------
	//
Returns TRUE if the node (or a particular field) is in it's default state.
	//
	// [in] fieldName: The field to check for default value.  NULL implies check all fields of this node.
	// [out] field: If non-NULL the value of the field will be returned in field.
	//
	virtual SFBool IsDefault(const SFString& fieldName=nullString, vrField *field=NULL) const;

	//<doc>------------------------------------------------------------
	//
Declare that this node may be runtime typed and dynamically created. [ DECLARE_NODE ]
	//
	DECLARE_NODE(vrCylinderSensor);

	//------------------------------------------------------------
	// hand coded functions
	virtual void PointerEvent(SFInt32 mode, const SFVec3f& pt, vrTraverser *t);
};

//----------------------------------------------------------------------
// exposedField sets and gets inlines
inline void vrCylinderSensor::SetOffset(SFFloat offset)
{
	m_Offset = offset;
}

inline void vrCylinderSensor::SetDiskAngle(SFFloat diskangle)
{
	m_DiskAngle = diskangle;
}

inline void vrCylinderSensor::SetMaxAngle(SFFloat maxangle)
{
	m_MaxAngle = maxangle;
}

inline void vrCylinderSensor::SetMinAngle(SFFloat minangle)
{
	m_MinAngle = minangle;
}

inline SFFloat vrCylinderSensor::GetOffset(void) const
{
	return m_Offset;
}

inline SFFloat vrCylinderSensor::GetDiskAngle(void) const
{
	return m_DiskAngle;
}

inline SFFloat vrCylinderSensor::GetMaxAngle(void) const
{
	return m_MaxAngle;
}

inline SFFloat vrCylinderSensor::GetMinAngle(void) const
{
	return m_MinAngle;
}

// eventOut sets and gets inlines
inline void vrCylinderSensor::SetRotation(const SFRotation& rotation)
{
	m_Rotation = rotation;
}

inline SFRotation vrCylinderSensor::GetRotation(void) const
{
	return m_Rotation;
}

inline void vrCylinderSensor::Traverse(vrTraverser *t) const
{
	t->Traverse(this);
}
#endif


text:
This example uses:

[`threejs`](https://threejs.org/): A lightweight, 3D library with a default WebGL renderer. The library also provides Canvas 2D, SVG and CSS3D renderers in the examples.
[`react-three-fiber`](https://github.com/pmndrs/react-three-fiber): A React renderer for Threejs on the web and react-native.
[`drei`](https://github.com/pmndrs/drei): A growing collection of useful helpers and abstractions for react-three-fiber.

## Preview

Preview the example live on [StackBlitz](http://stackblitz.com/):

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-three-js)

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-three-js&project-name=with-three-js&repository-name=with-three-js)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

```bash
npx create-next-app --example with-three-js with-three-js-app
# or
yarn create next-app --example with-three-js with-three-js-app
```

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).


text:
import path from 'path';
import {test as helpers} from 'yeoman-generator';
import assert from 'yeoman-assert';

describe('loader', () => {
  describe('with react', () => {
    before((done) => {
      helpers.run(path.join(__dirname, '../generators/app'))
        .withOptions({skipInstall: true})
        .withPrompts({
          includeReact: true
        })
        .on('end', done);
    });

    it('should have expected files', () => {
      assert.file([
        'app/styles/vendor/_loaders.scss',
        'app/scripts/components/loader.jsx'
      ]);
    });

    it('should load the stylesheet', () => {
      assert.fileContent('app/styles/app.scss', 'vendor/loaders');
    });
  });

  describe('without react', () => {
    before((done) => {
      helpers.run(path.join(__dirname, '../generators/app'))
        .withOptions({skipInstall: true})
        .withPrompts({
          includeReact: false
        })
        .on('end', done);
    });

    it('should do none of that stuff', () => {
      assert.noFile([
        ['app/styles/vendor/_loaders.scss'],
        ['app/scripts/components/loader.jsx']
      ]);
      assert.noFileContent('app/styles/app.scss', 'vendor/loaders');
    });
  });
});


text:
package studio.xmatrix.qqpvp.assistant.data.common.converter;

import android.arch.lifecycle.LiveData;
import android.support.annotation.NonNull;

import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.concurrent.atomic.AtomicBoolean;

import retrofit2.Call;
import retrofit2.CallAdapter;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import studio.xmatrix.qqpvp.assistant.data.common.ApiResponse;

public class LiveDataCallAdapterFactory extends CallAdapter.Factory {

    @Override
    public CallAdapter<?, ?> get(@NonNull Type returnType, @NonNull Annotation[] annotations, @NonNull Retrofit retrofit) {
        if (getRawType(returnType) != LiveData.class) {
            return null;
        }
        Type observableType = getParameterUpperBound(0, (ParameterizedType) returnType);
        Class<?> rawObservableType = getRawType(observableType);
        if (rawObservableType != ApiResponse.class) {
            throw new IllegalArgumentException("type must be a resource");
        }
        if (!(observableType instanceof ParameterizedType)) {
            throw new IllegalArgumentException("resource must be parameterized");
        }
        Type bodyType = getParameterUpperBound(0, (ParameterizedType) observableType);
        return new LiveDataCallAdapter<>(bodyType);
    }

    public static class LiveDataCallAdapter<R> implements CallAdapter<R, LiveData<ApiResponse<R>>> {

        private final Type responseType;

        LiveDataCallAdapter(Type responseType) {
            this.responseType = responseType;
        }

        @Override
        public Type responseType() {
            return responseType;
        }

        @Override
        public LiveData<ApiResponse<R>> adapt(@NonNull Call<R> call) {
            return new LiveData<ApiResponse<R>>() {
                AtomicBoolean started = new AtomicBoolean(false);

                @Override
                protected void onActive() {
                    super.onActive();
                    if (started.compareAndSet(false, true)) {
                        call.enqueue(new Callback<R>() {
                            @Override
                            public void onResponse(@NonNull Call<R> call, @NonNull Response<R> response) {
                                postValue(new ApiResponse<>(response));
                            }

                            @Override
                            public void onFailure(@NonNull Call<R> call, @NonNull Throwable throwable) {
                                postValue(new ApiResponse<>(throwable));
                            }
                        });
                    }
                }
            };
        }
    }
}


text:
var React = require('react');
var AdminLoginUI = require('../../ui/admin/AdminLogin');
var AdminHeader = require('../../ui/admin/AdminHeader');

var AdminLogin = React.createClass({
    contextTypes: {
        router: React.PropTypes.object.isRequired
    },
    getInitialState: function() {
        return ({
            authenticated: false,
            username: '',
            password: ''
        });
    },
    handleUpdateUsername: function(e) {
        this.setState({
            username: e.target.value
        });
    },
    handleUpdatePassword: function(e) {
        this.setState({
            password: e.target.value
        });
    },
    handleSubmitLogin: function(e) {
        e.preventDefault();
        var username = this.state.username;
        var password = this.state.password;
        var that = this;
        $.ajax({
            url: 'http://localhost:8124/check_admin',
            method: 'POST',
            data: {username: username, password: password},
            success: function(data) {
                if (data.status) {
                    //console.log(data);
                    that.setState({
                        authenticated: true,
                        username: username
                    });
                    that.context.router.push({
                        pathname: '/admin/login/list'
                    });
                } else {
                    alert('Credentials Wrong. \nTry Again!!!');
                }
            }
        });
    },
    render: function() {
        if (this.state.authenticated === false) {
            return (

                    <AdminLoginUI
                        onSubmitLogin = {this.handleSubmitLogin}
                        onUpdateUsername = {this.handleUpdateUsername}
                        onUpdatePassword = {this.handleUpdatePassword}
                        username = {this.state.username}
                        password = {this.state.password}
                    />

            );
        }
        return (

                <AdminHeader location={this.props.location.pathname} />
                {this.props.children}

        );
    }
});

module.exports = AdminLogin;


text:
package com.mistraltech.photocomp.config;

import com.mistraltech.photocomp.repository.CompetitionConfigRepository;
import com.mistraltech.photocomp.repository.DummyCompetitionConfigRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;

@Profile("!stub")
public class LiveRootConfig {
    @Bean
    public CompetitionConfigRepository competitionConfigRepository() {
        // Replace with real repository
        return new DummyCompetitionConfigRepository();
    }
}


text:
static char launchNotificationKey;
static char coldstartKey;
static char systemBackgroundKey;
NSString *const pushPluginApplicationDidBecomeActiveNotification = @"pushPluginApplicationDidBecomeActiveNotification";

@implementation AppDelegate (notification)

- (id) getCommandInstance:(NSString*)className
{
    return [self.viewController getCommandInstance:className];
}

// its dangerous to override a method from within a category.
// Instead we will use method swizzling. we set this up in the load call.
+ (void)load
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Class class = [self class];

        SEL originalSelector = @selector(init);
        SEL swizzledSelector = @selector(pushPluginSwizzledInit);

        Method original = class_getInstanceMethod(class, originalSelector);
        Method swizzled = class_getInstanceMethod(class, swizzledSelector);

        BOOL didAddMethod =
        class_addMethod(class,
                        originalSelector,
                        method_getImplementation(swizzled),
                        method_getTypeEncoding(swizzled));

        if (didAddMethod) {
            class_replaceMethod(class,
                                swizzledSelector,
                                method_getImplementation(original),
                                method_getTypeEncoding(original));
        } else {
            method_exchangeImplementations(original, swizzled);
        }
    });
}

- (AppDelegate *)pushPluginSwizzledInit
{
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
    center.delegate = self;

    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(pushPluginOnApplicationDidBecomeActive:)
                                                name:UIApplicationDidBecomeActiveNotification
                                              object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(pushPluginOnApplicationWillResignActive:)
                                                name:UIApplicationWillResignActiveNotification
                                              object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(pushPluginOnApplicationDidEnterBackground:)
                                                name:UIApplicationDidEnterBackgroundNotification
                                              object:nil];

    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(willPresentNotificationHandler:)
                                                name:@"WillPresentNotification"
                                              object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(didReceiveNotificationResponseHandler:)
                                                name:@"DidReceiveNotificationResponse"
                                              object:nil];

    // This actually calls the original init method over in AppDelegate. Equivilent to calling super
    // on an overrided method, this is not recursive, although it appears that way. neat huh?
    return [self pushPluginSwizzledInit];
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
    [pushHandler didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
    [pushHandler didFailToRegisterForRemoteNotificationsWithError:error];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    NSLog(@"didReceiveNotification with fetchCompletionHandler");

    // app is in the background or inactive, so only call notification callback if this is a silent push
    if (application.applicationState != UIApplicationStateActive) {

        NSLog(@"app in-active");

        // do some convoluted logic to find out if this should be a silent push.
        long silent = 0;
        id aps = [userInfo objectForKey:@"aps"];
        id contentAvailable = [aps objectForKey:@"content-available"];
        if ([contentAvailable isKindOfClass:[NSString class]] && [contentAvailable isEqualToString:@"1"]) {
            silent = 1;
        } else if ([contentAvailable isKindOfClass:[NSNumber class]]) {
            silent = [contentAvailable integerValue];
        }

        if (silent == 1) {
            NSLog(@"this should be a silent push");
            void (^safeHandler)(UIBackgroundFetchResult) = ^(UIBackgroundFetchResult result){
                dispatch_async(dispatch_get_main_queue(), ^{
                    completionHandler(result);
                });
            };

            PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];

            if (pushHandler.handlerObj == nil) {
                pushHandler.handlerObj = [NSMutableDictionary dictionaryWithCapacity:2];
            }

            id notId = [userInfo objectForKey:@"notId"];
            if (notId != nil) {
                NSLog(@"Push Plugin notId %@", notId);
                [pushHandler.handlerObj setObject:safeHandler forKey:notId];
            } else {
                NSLog(@"Push Plugin notId handler");
                [pushHandler.handlerObj setObject:safeHandler forKey:@"handler"];
            }

            pushHandler.notificationMessage = userInfo;
            pushHandler.isInline = NO;
            [pushHandler notificationReceived];
        } else {
            NSLog(@"just put it in the shade");
            //save it for later
            self.launchNotification = userInfo;
            completionHandler(UIBackgroundFetchResultNewData);
        }

    } else {
        completionHandler(UIBackgroundFetchResultNoData);
    }
}

- (void)checkUserHasRemoteNotificationsEnabledWithCompletionHandler:(nonnull void (^)(BOOL))completionHandler
{
    [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {

        switch (settings.authorizationStatus)
        {
            case UNAuthorizationStatusDenied:
            case UNAuthorizationStatusNotDetermined:
                completionHandler(NO);
                break;
            case UNAuthorizationStatusAuthorized:
                completionHandler(YES);
                break;
        }
    }];
}

- (void)pushPluginOnApplicationDidBecomeActive:(NSNotification *)notification {

    NSLog(@"active");

    NSString *firstLaunchKey = @"firstLaunchKey";
    NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"phonegap-plugin-push"];
    if (![defaults boolForKey:firstLaunchKey]) {
        NSLog(@"application first launch: remove badge icon number");
        [defaults setBool:YES forKey:firstLaunchKey];
        [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    }

    UIApplication *application = notification.object;

    PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
    if (pushHandler.clearBadge) {
        NSLog(@"PushPlugin clearing badge");
        //zero badge
        application.applicationIconBadgeNumber = 0;
    } else {
        NSLog(@"PushPlugin skip clear badge");
    }

    if (self.launchNotification) {
        pushHandler.isInline = NO; // [self.systemBackground boolValue];
        pushHandler.coldstart = [self.coldstart boolValue];
        pushHandler.notificationMessage = self.launchNotification;
        self.launchNotification = nil;
        self.coldstart = [NSNumber numberWithBool:NO];
        [pushHandler performSelectorOnMainThread:@selector(notificationReceived) withObject:pushHandler waitUntilDone:NO];
    }

    [[NSNotificationCenter defaultCenter] postNotificationName:pushPluginApplicationDidBecomeActiveNotification object:nil];
}

- (void)pushPluginOnApplicationWillResignActive:(NSNotification *)notification {
    self.systemBackground = [NSNumber numberWithBool:YES];
}

- (void)pushPluginOnApplicationDidEnterBackground:(NSNotification *)notification {
    self.systemBackground = [NSNumber numberWithBool:NO];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
    NSDictionary *data = @{@"notification": notification, @"completionHandler": completionHandler};
    [[NSNotificationCenter defaultCenter] postNotificationName:@"WillPresentNotification" object:nil userInfo:data];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void(^)(void))completionHandler
{
    NSDictionary *data = @{@"notificationResponse": response, @"completionHandler": completionHandler};
    [[NSNotificationCenter defaultCenter] postNotificationName:@"DidReceiveNotificationResponse" object:nil userInfo:data];
}

- (void)willPresentNotificationHandler:(NSNotification *)notification
{
    [self willPresentNotification:[notification.userInfo objectForKey:@"notification"] withCompletionHandler:[notification.userInfo objectForKey:@"completionHandler"]];
}

- (void)didReceiveNotificationResponseHandler:(NSNotification *)notification
{
    [self didReceiveNotificationResponse:[notification.userInfo objectForKey:@"notificationResponse"] withCompletionHandler:[notification.userInfo objectForKey:@"completionHandler"]];
}

- (void)willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
    NSLog( @"NotificationCenter Handle push from foreground" );
    UNNotificationRequest* toast = notification.request;

    if (![toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) {
        return;
    }

    // custom code to handle push while app is in the foreground
    PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
    pushHandler.notificationMessage = notification.request.content.userInfo;
    pushHandler.isInline = YES;
    [pushHandler notificationReceived];

    completionHandler(UNNotificationPresentationOptionNone);
}

- (void)didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler
{
    NSLog(@"Push Plugin didReceiveNotificationResponse: actionIdentifier %@, notification: %@", response.actionIdentifier, response.notification.request.content.userInfo);

    UNNotificationRequest* toast = response.notification.request;
    if (![toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) {
        return;
    }

    NSMutableDictionary *userInfo = [response.notification.request.content.userInfo mutableCopy];
    [userInfo setObject:response.actionIdentifier forKey:@"actionCallback"];
    NSLog(@"Push Plugin userInfo %@", userInfo);

    switch ([UIApplication sharedApplication].applicationState) {
        case UIApplicationStateActive:
        {
            PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
            pushHandler.notificationMessage = userInfo;
            pushHandler.isInline = NO;
            [pushHandler notificationReceived];
            completionHandler();
            break;
        }
        case UIApplicationStateInactive:
        {
            NSLog(@"coldstart");
            self.launchNotification = response.notification.request.content.userInfo;
            self.coldstart = [NSNumber numberWithBool:YES];
            completionHandler();
            break;
        }
        case UIApplicationStateBackground:
        {
            void (^safeHandler)(void) = ^(void){
                dispatch_async(dispatch_get_main_queue(), ^{
                    completionHandler();
                });
            };

            PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];

            if (pushHandler.handlerObj == nil) {
                pushHandler.handlerObj = [NSMutableDictionary dictionaryWithCapacity:2];
            }

            id notId = [userInfo objectForKey:@"notId"];
            if (notId != nil) {
                NSLog(@"Push Plugin notId %@", notId);
                [pushHandler.handlerObj setObject:safeHandler forKey:notId];
            } else {
                NSLog(@"Push Plugin notId handler");
                [pushHandler.handlerObj setObject:safeHandler forKey:@"handler"];
            }

            pushHandler.notificationMessage = userInfo;
            pushHandler.isInline = NO;

            [pushHandler performSelectorOnMainThread:@selector(notificationReceived) withObject:pushHandler waitUntilDone:NO];
        }
    }
}

// The accessors use an Associative Reference since you can't define a iVar in a category
// http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocAssociativeReferences.html
- (NSMutableArray *)launchNotification
{
    return objc_getAssociatedObject(self, &launchNotificationKey);
}

- (void)setLaunchNotification:(NSDictionary *)aDictionary
{
    objc_setAssociatedObject(self, &launchNotificationKey, aDictionary, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSNumber *)coldstart
{
    return objc_getAssociatedObject(self, &coldstartKey);
}

- (void)setColdstart:(NSNumber *)aNumber
{
    objc_setAssociatedObject(self, &coldstartKey, aNumber, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSNumber *)systemBackground
{
    return objc_getAssociatedObject(self, &systemBackgroundKey);
}

- (void)setSystemBackground:(NSNumber *)aNumber
{
    objc_setAssociatedObject(self, &systemBackgroundKey, aNumber, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)dealloc
{
    self.launchNotification = nil; // clear the association and release the object
    self.coldstart = nil;
    self.systemBackground = nil;
}

@end


text:
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class SolutionTest {
	private Solution solution;

	@Before
	public void setUp() {
		solution = new Solution();
	}

	@Test
	public void example1() {
		String s = "babad";

		String result = solution.longestPalindrome(s);

		Assert.assertEquals("bab", result);
	}

	@Test
	public void example2() {
		String s = "cbbd";

		String result = solution.longestPalindrome(s);

		Assert.assertEquals("bb", result);
	}
}