text: - **BitSight Risk Category**

redpajama_set_name: RedPajamaGithub


text:
export default class SidebarMenuToggleController {

  constructor() {}

  $onInit() {
    this.isLoaded = true;
    console.log('sidebar menu controller chargé !');
  }

  toggle(){
    this.section.isOpen = !this.section.isOpen;
    if(this.section.isOpen){
      this.parent.content.focusSection(this.section.id);
    }
  }
}

SidebarMenuToggleController.$inject = [];


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd">

    <!-- Elastic search test node -->
    <elasticsearch:node-client id="client" local="true" cluster-name="#{T(java.util.UUID).randomUUID().toString()}"
                               path-data="target/elasticsearchTestData" path-home="src/test/resources/test-home-dir"
                               path-configuration="node-client-configuration.yml"/>

    <!-- ElasticSearch Jest Client -->
    <bean id="jestClient" factory-bean="jestClientFactory" factory-method="getObject" destroy-method="close" />

    <bean id="jestClientConfigBuilder" class="io.searchbox.client.config.HttpClientConfig.Builder">
        <constructor-arg type="java.lang.String" value="http://localhost:9200"/>
    </bean>

    <bean id="jestClientConfig" factory-bean="jestClientConfigBuilder" factory-method="build"/>

    <bean id="jestClientFactory" class="io.searchbox.client.JestClientFactory">
        <property name="httpClientConfig" ref="jestClientConfig"/>
    </bean>

    <!-- Elasticsearch Jest Template -->
    <bean id="jestElasticsearchTemplate" class="com.github.vanroy.springdata.jest.JestElasticsearchTemplate">
        <constructor-arg ref="jestClient"/>
    </bean>

</beans>


text: docker build -t ubirch/webserver:php7 -f webserver.dockerfile .


text:
using System;

namespace DeadLock
{
    class LockerB
    {
        public void MethodB()
        {
            lock (this)
            {
                Console.WriteLine("MethodB");
            }
        }
    }
}


text:
using System;
using System.IO;
using System.Linq;
using System.Runtime.Caching;
using System.Runtime.Serialization.Formatters;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Colo.Configuration;
using ProtoBuf;
using StackExchange.Redis;

namespace Colo.Redis
{
    /// <summary>
    /// Redis based cache provider (for use with services like Amazon ElastiCache and Microsoft Azure Cache)
    /// </summary>
    public class RedisCacheProvider : BaseCacheProvider
    {
        /// <summary>
        /// Not implemented
        /// </summary>
        protected override ObjectCache Cache
        {
            get { return null; }
        }

        protected ConnectionMultiplexer Connection { get; set; }

        protected int Database { get; set; }
        protected bool UseServerFlush { get; set; }

        private readonly IDatabase _cache;
        public RedisCacheProvider(ConnectionMultiplexer connection, int database = 0, bool useServerFlush = true)
        {
            if (connection == null) throw new ArgumentNullException("connection");

            Connection = connection;
            Database = database;

            _cache = Connection.GetDatabase(Database);
        }

        public override bool Clear()
        {
            var servers = Connection.GetEndPoints()
                .Select(x => Connection.GetServer(x));

            if (UseServerFlush)
            {
                Task.WaitAll(
                    servers.Select(x => x.FlushDatabaseAsync(Database)).ToArray()
                );
            }
            else
            {
                var db = Connection.GetDatabase(Database);

                // Get the keys from all endpoints, and select the distinct keys.
                var keys = servers.SelectMany(x => x.Keys()).Distinct().ToList();

                // Delete thekeys
                Parallel.ForEach(keys, x => db.KeyDeleteAsync(x).Wait());
            }

            return true;
        }

        /// <summary>
        /// Gets item from cached file
        /// T or Type must be a decorated with ProtoContract or this will not retrieve anything
        /// </summary>
        /// <typeparam name="T">Type of data to return</typeparam>
        /// <param name="key">name of the file</param>
        /// <param name="type">If T is a some form of enumeration, then type must be passed in.  It is the type of the enumeration. For example if T = List of int, type must be typeof(int).  If T is double or some other class type can be null</param>
        /// <returns></returns>
        public override T Get<T>(string key, Type type = null)
        {
            try
            {
                if (CachingSection.GetSection.UseCache)
                {
                    if (IsCacheable<T>(type) && IsSet(key))
                    {
                        return Deserialize<T>(_cache.StringGet(key));
                    }
                    return null;
                }
                return null;
            }
            catch
            {
                return null;
            }
        }

        /// <summary>
        /// Saves an object to the file based cache
        /// If T or type is not decorated with ProtoContract, cache will not save
        /// </summary>
        /// <typeparam name="T">type of the object to save</typeparam>
        /// <param name="key">filename</param>
        /// <param name="data">data to store</param>
        /// <param name="type">If T is a some form of enumeration, then type must be passed in.  It is the type of the enumeration. For example if T = List of int, type must be typeof(int).  If T is double or some other class type can be null</param>
        public override void Set<T>(string key, T data, Type type = null)
        {
            try
            {
                var cacheElement = GetCacheDefaults(data, type);
                if (CachingSection.GetSection.UseCache && cacheElement.Enabled)
                {
                    if (IsCacheable<T>(type))
                    {
                        var expiry = new TimeSpan(0, cacheElement.CacheLife, 0);
                        _cache.StringSet(key, Serialize(data), expiry);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Fail(ex.Message);
            }
        }

        public override bool IsSet(string key)
        {
            return _cache.KeyExists(key);
        }

        public override void Invalidate(string key)
        {
            // Expire the key in a second
            _cache.KeyExpire(key, new TimeSpan(0, 0, 1));
        }

        public override string GenerateCacheName(string data)
        {
            using (var md5 = MD5.Create())
            {
                var hash = md5.ComputeHash(Encoding.Default.GetBytes(data));

                return BitConverter.ToString(hash);
            }
        }

        private static bool IsCacheable<T>(Type type = null)
        {
            return ((type != null && DoesTypeHaveContract(type)) ||
                    (type == null && DoesTypeHaveContract(typeof(T))));
        }

        /// <summary>
        /// Checks to ensure the type supports ProtoBuf by having the protocontract attribute on the class
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private static bool DoesTypeHaveContract(Type type)
        {
            try
            {
                var hasContract = type.IsDefined(typeof(ProtoContractAttribute), false);

                if (!hasContract && !type.IsDefined(typeof(SuppressCachingWarningAttribute), false))
                {
                    System.Diagnostics.Trace.WriteLine(type.Name + " does not have protobuf attributes and can not be cached");
                }

                return hasContract;
            }
            catch
            {
                return false;
            }
        }

        static byte[] Serialize(object o)
        {
            if (o == null)
                return null;

            using (var memoryStream = new MemoryStream())
            {
                Serializer.Serialize(memoryStream, o);
                var objectDataAsStream = memoryStream.ToArray();
                return objectDataAsStream;
            }
        }

        static T Deserialize<T>(byte[] stream)
        {
            if (stream == null)
                return default(T);

            using (var memoryStream = new MemoryStream(stream))
            {
                var result = Serializer.Deserialize<T>(memoryStream);
                return result;
            }
        }
    }
}


text:
package com.example.valid;

public class Main4 {

	/**
	 * Valid.
	 *
	 * This is the most common form of the main method, except that it throws an
	 * exception. This is completely valid.
	 *
	 * Source: https://rationalpi.wordpress.com/2007/01/29/main-methods-in-java/
	 */
	public static void main(String[] args) throws Exception {
		System.out.println("Main4!");
	}

}


text:
interface I {
    int getSomething1();

    int getSomething2();

    int getSomething3();
    void setSomething3(int value);

    int getSomething4();
    void setSomething4(int value);

    int getSomething5();
    void setSomething5(int value);

    void setSomething6(int value);
}

interface I1 extends I {
    void setSomething1(int value);

    int getSomething6();
}

class B {
    public String getFromB1() {
        return "";
    }

    public String getFromB2() {
        return "";
    }

    public void setFromB2(String value) {
    }

    public String getFromB3() {
        return "";
    }

    public void setFromB3(String value) {
    }

    public String getFromB4() {
        return "";
    }

    public void setFromB4(String value) {
    }

    public void setFromB5(String value) {
    }
}

abstract class C extends B implements I {
    private final int mySomething1;
    private int mySomething6;

    C(int something1) {
        mySomething1 = something1;
    }

    @Override
    public int getSomething1() {
        return mySomething1;
    }

    @Override
    public int getSomething2() {
        return 0;
    }

    @Override
    public int getSomething3() {
        return 0;
    }

    @Override
    public void setSomething3(int value) {
    }

    @Override
    public int getSomething4() {
        return 0;
    }

    @Override
    public void setSomething5(int value) {

    }

    public int getSomething6() {
        return mySomething6;
    }

    @Override
    public void setSomething6(int value) {
        mySomething6 = value;
    }

    @Override
    public String getFromB1() {
        return super.getFromB1();
    }

    @Override
    public String getFromB2() {
        return super.getFromB2();
    }

    @Override
    public void setFromB2(String value) {
        super.setFromB2(value);
    }

    @Override
    public String getFromB3() {
        return super.getFromB3();
    }

    @Override
    public void setFromB4(String value) {
        super.setFromB4(value);
    }

    public String getFromB5() {
        return "";
    }

    @Override
    public void setFromB5(String value) {
        super.setFromB5(value);
    }
}


text:
package api

import java.text.MessageFormat

import scala.concurrent.Future

import org.codehaus.jackson.JsonNode

import play.api.libs.json.{JsObject, JsValue}
import play.api.libs.ws.WS
import play.api.Play.current
import play.api.libs.concurrent.Execution.Implicits.defaultContext

import models.{Source, AggregationRule, RoutingRule}

object ContentApi {

  type EntityRef = String

  def findEntity(host:String, uri: String, rules: List[RoutingRule]) : Option[EntityRef] =  {
    rules.sortBy(_.priority).flatMap(_.findContent(host, uri)).headOption
  }

  def aggregateEntityHttp(entityRef: EntityRef, sources: Map[String, Source], rules: List[AggregationRule]) : Future[JsValue] = {
    val fragments = rules.filter(_.content == entityRef).map { ar =>
      val url = sources(ar.source).url
      val target = ar.target
      WS.url(url).get.map { response => JsObject(Seq(target -> response.json)) }
    }
    val o = JsObject(Seq())
    val b = JsObject(Seq())

    Future.sequence[JsObject, List](fragments) .map { _.foldLeft(JsObject(Seq()))(_ ++ _) }
  }

  def aggregateEntity(ref: EntityRef, rules: List[AggregationRule]) : Option[JsonNode] = {
    import org.codehaus.jackson.map.ObjectMapper
    import org.codehaus.jackson.JsonNode

    val mapper = new ObjectMapper()

      Some(mapper.readValue("""{"firstname":"john"}""", classOf[JsonNode]))
  }

}


text:
/* DO NOT EDIT */
/* This file was generated from team_log_generated.stone */

package com.dropbox.core.v2.teamlog;

import com.dropbox.core.stone.StoneDeserializerLogger;
import com.dropbox.core.stone.StoneSerializers;
import com.dropbox.core.stone.StructSerializer;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;

import java.io.IOException;
import java.util.Arrays;

/**
 * Canceled a team merge request.
 */
public class TeamMergeRequestCanceledShownToPrimaryTeamDetails {
    // struct team_log.TeamMergeRequestCanceledShownToPrimaryTeamDetails (team_log_generated.stone)

    protected final String secondaryTeam;
    protected final String sentBy;

    /**
     * Canceled a team merge request.
     *
     * @param secondaryTeam  The secondary team name. Must not be {@code null}.
     * @param sentBy  The name of the secondary team admin who sent the request
     *     originally. Must not be {@code null}.
     *
     * @throws IllegalArgumentException  If any argument does not meet its
     *     preconditions.
     */
    public TeamMergeRequestCanceledShownToPrimaryTeamDetails(String secondaryTeam, String sentBy) {
        if (secondaryTeam == null) {
            throw new IllegalArgumentException("Required value for 'secondaryTeam' is null");
        }
        this.secondaryTeam = secondaryTeam;
        if (sentBy == null) {
            throw new IllegalArgumentException("Required value for 'sentBy' is null");
        }
        this.sentBy = sentBy;
    }

    /**
     * The secondary team name.
     *
     * @return value for this field, never {@code null}.
     */
    public String getSecondaryTeam() {
        return secondaryTeam;
    }

    /**
     * The name of the secondary team admin who sent the request originally.
     *
     * @return value for this field, never {@code null}.
     */
    public String getSentBy() {
        return sentBy;
    }

    @Override
    public int hashCode() {
        int hash = Arrays.hashCode(new Object [] {
            secondaryTeam,
            sentBy
        });
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        // be careful with inheritance
        else if (obj.getClass().equals(this.getClass())) {
            TeamMergeRequestCanceledShownToPrimaryTeamDetails other = (TeamMergeRequestCanceledShownToPrimaryTeamDetails) obj;
            return ((this.secondaryTeam == other.secondaryTeam) || (this.secondaryTeam.equals(other.secondaryTeam)))
                && ((this.sentBy == other.sentBy) || (this.sentBy.equals(other.sentBy)))
                ;
        }
        else {
            return false;
        }
    }

    @Override
    public String toString() {
        return Serializer.INSTANCE.serialize(this, false);
    }

    /**
     * Returns a String representation of this object formatted for easier
     * readability.
     *
     * <p> The returned String may contain newlines. </p>
     *
     * @return Formatted, multiline String representation of this object
     */
    public String toStringMultiline() {
        return Serializer.INSTANCE.serialize(this, true);
    }

    /**
     * For internal use only.
     */
    static class Serializer extends StructSerializer<TeamMergeRequestCanceledShownToPrimaryTeamDetails> {
        public static final Serializer INSTANCE = new Serializer();

        @Override
        public void serialize(TeamMergeRequestCanceledShownToPrimaryTeamDetails value, JsonGenerator g, boolean collapse) throws IOException, JsonGenerationException {
            if (!collapse) {
                g.writeStartObject();
            }
            g.writeFieldName("secondary_team");
            StoneSerializers.string().serialize(value.secondaryTeam, g);
            g.writeFieldName("sent_by");
            StoneSerializers.string().serialize(value.sentBy, g);
            if (!collapse) {
                g.writeEndObject();
            }
        }

        @Override
        public TeamMergeRequestCanceledShownToPrimaryTeamDetails deserialize(JsonParser p, boolean collapsed) throws IOException, JsonParseException {
            TeamMergeRequestCanceledShownToPrimaryTeamDetails value;
            String tag = null;
            if (!collapsed) {
                expectStartObject(p);
                tag = readTag(p);
            }
            if (tag == null) {
                String f_secondaryTeam = null;
                String f_sentBy = null;
                while (p.getCurrentToken() == JsonToken.FIELD_NAME) {
                    String field = p.getCurrentName();
                    p.nextToken();
                    if ("secondary_team".equals(field)) {
                        f_secondaryTeam = StoneSerializers.string().deserialize(p);
                    }
                    else if ("sent_by".equals(field)) {
                        f_sentBy = StoneSerializers.string().deserialize(p);
                    }
                    else {
                        skipValue(p);
                    }
                }
                if (f_secondaryTeam == null) {
                    throw new JsonParseException(p, "Required field \"secondary_team\" missing.");
                }
                if (f_sentBy == null) {
                    throw new JsonParseException(p, "Required field \"sent_by\" missing.");
                }
                value = new TeamMergeRequestCanceledShownToPrimaryTeamDetails(f_secondaryTeam, f_sentBy);
            }
            else {
                throw new JsonParseException(p, "No subtype found that matches tag: \"" + tag + "\"");
            }
            if (!collapsed) {
                expectEndObject(p);
            }
            StoneDeserializerLogger.log(value, value.toStringMultiline());
            return value;
        }
    }
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**path** | **str** | Path is the URL path of the request | [optional]
**verb** | **str** | Verb is the standard HTTP verb | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)