text:
using System;
using System.Threading.Tasks;
using static System.Console;

namespace ErrorHandling
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Usage();
                return;
            }

            switch (args[0].ToLower())
            {
                case "-donthandle":
                    DontHandle();
                    break;
                case "-handle":
                    HandleOneError();
                    break;
                case "-two":
                    StartTwoTasks();
                    break;
                case "-twop":
                    StartTwoTasksParallel();
                    break;
                case "-agg":
                    ShowAggregatedException();
                    break;
                default:
                    Usage();
                    break;
            }

            ReadLine();
        }

        public static void Usage()
        {
            WriteLine("Usage: ErrorHandling Command");
            WriteLine();
            WriteLine("Commands:");
            WriteLine("\t-donthandle\t\tcall async methods with exceptions not caught");
            WriteLine("\t-two\t\tstart two tasks");
            WriteLine("\t-twop\t\tstart two tasks parallel");
            WriteLine("\t-agg\t\taggregated exception");
            WriteLine("\t");
        }

        private static async void ShowAggregatedException()
        {
            Task taskResult = null;
            try
            {
                Task t1 = ThrowAfter(2000, "first");
                Task t2 = ThrowAfter(1000, "second");
                await (taskResult = Task.WhenAll(t1, t2));
            }
            catch (Exception ex)
            {
                // just display the exception information of the first task that is awaited within WhenAll
                WriteLine($"handled {ex.Message}");
                foreach (var ex1 in taskResult.Exception.InnerExceptions)
                {
                    WriteLine($"inner exception {ex1.Message} from task {ex1.Source}");
                }
            }
        }

        private async static void StartTwoTasksParallel()
        {
            Task t1 = null;
            try
            {
                t1 = ThrowAfter(2000, "first");
                Task t2 = ThrowAfter(1000, "second");
                await Task.WhenAll(t1, t2);
            }
            catch (Exception ex)
            {
                // just display the exception information of the first task that is awaited within WhenAll
                WriteLine($"handled {ex.Message}");
            }
        }

        private static async void StartTwoTasks()
        {
            try
            {
                await ThrowAfter(2000, "first");
                await ThrowAfter(1000, "second"); // the second call is not invoked because the first method throws an exception
            }
            catch (Exception ex)
            {
                WriteLine("handled {0}", ex.Message);
            }
        }

        private static void DontHandle()
        {
            try
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                ThrowAfter(200, "first");
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                              // Exception is not caught because the exception is assigned to the task which is not awaited
            }
            catch (Exception ex)
            {
                WriteLine(ex.Message);
            }
        }

        private static async void HandleOneError()
        {
            try
            {
                await ThrowAfter(2000, "first");
            }
            catch (Exception ex)
            {
                WriteLine($"handled {ex.Message}");
            }
        }

        static async Task ThrowAfter(int ms, string message)
        {
            await Task.Delay(ms);
            throw new Exception(message);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

    <!--

        Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at

           http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    -->

    <persistence-unit name="booking-hibernate" transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

        <!-- Only used when transaction-type=JTA -->
        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=booking)</jta-data-source>

        <!-- Only used when transaction-type=RESOURCE_LOCAL -->
        <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=booking)</non-jta-data-source>
        <class>org.apache.karaf.examples.jpa.Booking</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
        </properties>
    </persistence-unit>

</persistence>

redpajama_set_name: RedPajamaGithub


text:
package com.jetbrains.python.psi.impl;

import com.intellij.lang.ASTNode;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.psi.PyElementVisitor;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.psi.PyYieldExpression;
import com.jetbrains.python.psi.types.PyType;
import com.jetbrains.python.psi.types.TypeEvalContext;
import org.jetbrains.annotations.NotNull;

/**
 * @author yole
 */
public class PyYieldExpressionImpl extends PyElementImpl implements PyYieldExpression {
  public PyYieldExpressionImpl(ASTNode astNode) {
    super(astNode);
  }

  protected void acceptPyVisitor(PyElementVisitor pyVisitor) {
    pyVisitor.visitPyYieldExpression(this);
  }

  @Override
  public PyExpression getExpression() {
    final PyExpression[] expressions = PsiTreeUtil.getChildrenOfType(this, PyExpression.class);
    return (expressions != null && expressions.length > 0) ? expressions[0] : null;
  }

  @Override
  public boolean isDelegating() {
    return getNode().findChildByType(PyTokenTypes.FROM_KEYWORD) != null;
  }

  @Override
  public PyType getType(@NotNull TypeEvalContext context, @NotNull TypeEvalContext.Key key) {
    final PyExpression e = getExpression();
    return e != null ? context.getType(e) : null;
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">
    <meta name="description" content="API documentation for the Rust `MutableByteVector` trait in crate `std`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, MutableByteVector">

    <title>std::slice::bytes::MutableByteVector - Rust</title>

    <link rel="stylesheet" type="text/css" href="../../../main.css">

    <link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">

std::<wbr>slice::<wbr>bytes

        <form class="search-form js-only">

                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press 'S' to search, '?' for more options..."
                       type="search">

        </form>

Trait std::<wbr>slice::<wbr>bytes::<wbr>MutableByteVector<wbr>Unstable
            [-] [+]
        [src]

pub trait MutableByteVector {
    fn set_memory(&mut self, value: u8);
}

A trait for operations on mutable [u8]s.

Required Methods

fn set_memory(&mut self, value: u8)

Sets all bytes of the receiver to the given value.

Implementors

impl MutableByteVector for [u8]

Keyboard shortcuts

?

Show this help dialog

S

Focus the search field

⇤

Move up in search results

⇥

Move down in search results

⏎

Go to active search result

Search tricks

                Prefix searches with a type followed by a colon (e.g.
                fn:) to restrict the search to a given type.

                Accepted types are: fn, mod,
                struct, enum,
                trait, typedef (or
                tdef).


text:
package com.google.googlejavaformat.java;

import static com.google.common.truth.Truth.assertThat;

import com.google.googlejavaformat.java.Main.ArgInfo;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * Tests for {@link Main}.
 */
@RunWith(JUnit4.class)
public class MainTest {

  @Rule public TemporaryFolder testFolder = new TemporaryFolder();

  @Test
  public void deduplicatesSamePath() throws Exception {
    StringWriter out = new StringWriter();
    StringWriter err = new StringWriter();

    Path testFile = testFolder.newFile("Foo.java").toPath();

    ArgInfo argInfo = ArgInfo.processArgs(testFile.toString(), testFile.toString());
    Main main = new Main(new PrintWriter(out, true), new PrintWriter(err, true));
    assertThat(main.constructFilesToFormat(argInfo).filesToFormat).hasSize(1);
  }

  @Test
  public void deduplicatesDifferentPathsThatResolveToSameCanonicalPath() throws Exception {
    StringWriter out = new StringWriter();
    StringWriter err = new StringWriter();

    Path testFile = testFolder.newFile("Foo.java").toPath();
    Path symlink =
        testFolder
            .getRoot()
            .toPath()
            .resolve("Bar.java");
    Files.createSymbolicLink(symlink, testFile);

    ArgInfo argInfo = ArgInfo.processArgs(testFile.toString(), symlink.toString());
    Main main = new Main(new PrintWriter(out, true), new PrintWriter(err, true));
    assertThat(main.constructFilesToFormat(argInfo).filesToFormat).hasSize(1);
  }
}


text:
package org.domeos.framework.api.controller.auth;

import org.domeos.basemodel.HttpResponseTemp;
import org.domeos.framework.api.consolemodel.auth.CollectionMember;
import org.domeos.framework.api.consolemodel.auth.CollectionMembers;
import org.domeos.framework.api.controller.ApiController;
import org.domeos.framework.api.model.collection.CollectionAuthorityMap;
import org.domeos.framework.api.model.collection.related.ResourceType;
import org.domeos.framework.api.service.auth.UserCollectionService;
import org.domeos.framework.engine.AuthUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by KaiRen on 2016/9/22.
 */
@Controller
@RequestMapping("/api")
public class CollectionController extends ApiController {
    @Autowired
    UserCollectionService userCollectionService;

    /**
     * Post body is
     * { "group_id":groupId, "user_id":userId, "role": "#roleType" }
     */
    @ResponseBody
    @RequestMapping(value = "/collection_members/single", method = RequestMethod.POST)
    public HttpResponseTemp<?> addCollectionMember(@RequestBody CollectionMember collectionMember) {
        int userId = AuthUtil.getUserId();
        return userCollectionService.addCollectionMember(userId, collectionMember);
    }

    @ResponseBody
    @RequestMapping(value = "/collection_members/single", method = RequestMethod.PUT)
    public HttpResponseTemp<?> modifyCollectionMember(@RequestBody CollectionMember collectionMember) {
        int userId = AuthUtil.getUserId();
        return userCollectionService.modifyCollectionMember(userId, collectionMember);
    }

    @ResponseBody
    @RequestMapping(value = "/collection_members/multiple", method = RequestMethod.POST)
    public HttpResponseTemp<?> addMultipleCollectionMembers(@RequestBody CollectionMembers collectionMembers) {
        int userId = AuthUtil.getUserId();
        return userCollectionService.addCollectionMembers(userId, collectionMembers);
    }

    @ResponseBody
    @RequestMapping(value = "/collection_members/{collectionId}/{resourceType}", method = RequestMethod.GET)
    public HttpResponseTemp<?> listCollectionMembers(@PathVariable int collectionId, @PathVariable ResourceType resourceType) {
        int userId = AuthUtil.getUserId();
        return userCollectionService.listCollectionMember(userId, collectionId, resourceType);
    }

    @ResponseBody
    @RequestMapping(value = "/collection_members/{collectionId}/{userId}/{resourceType}", method = RequestMethod.DELETE)
    public HttpResponseTemp<?> deleteCollectionMember(@PathVariable int collectionId,
                                                      @PathVariable int userId,
                                                      @PathVariable ResourceType resourceType) {
        int curUserId = AuthUtil.getUserId();
        CollectionAuthorityMap collectionAuthorityMap = new CollectionAuthorityMap();
        collectionAuthorityMap.setCollectionId(collectionId);
        collectionAuthorityMap.setUserId(userId);
        collectionAuthorityMap.setResourceType(resourceType);
        return userCollectionService.deleteCollectionMember(curUserId, collectionAuthorityMap);
    }

    @ResponseBody
    @RequestMapping(value = "/collections/{resourceType}", method = RequestMethod.GET)
    public HttpResponseTemp<?> listCollectionInfos(@PathVariable ResourceType resourceType) {
        int userId = AuthUtil.getUserId();
        return userCollectionService.listAllCollectionInfo(userId, resourceType);
    }
}


text:
package org.bboxdb.network.routing;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bboxdb.commons.InputParseException;
import org.bboxdb.commons.MathUtil;
import org.bboxdb.distribution.membership.BBoxDBInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RoutingHeader {

	/**
	 * Is this a routed or a direct package?
	 */
	protected boolean routedPackage;

	/**
	 * The hop of the package
	 */
	protected short hop;

	/**
	 * The hops for this package
	 */
	protected final List<RoutingHop> routingList = new ArrayList<>();

	/**
	 * The flag for direct packages
	 */
	public final static byte DIRECT_PACKAGE = 0x00;

	/**
	 * The flag for routed packages
	 */
	public final static byte ROUTED_PACKAGE = 0x01;

	/**
	 * The separator char for the host / hop list
	 */
	public final static String SEPARATOR_CHAR_HOST = ";";

	/**
	 * The separator char for the region
	 */
	public final static String SEPARATOR_CHAR_REGION = ",";

	/**
	 * The separator char for the flags
	 */
	public final static String SEPARATOR_CHAR_FLAGS = ":";

	/**
	 * The Logger
	 */
	private final static Logger logger = LoggerFactory.getLogger(RoutingHeader.class);

	public RoutingHeader(final boolean routedPackage) {
		this.routedPackage = routedPackage;
	}

	public RoutingHeader(final short hop, final List<RoutingHop> routingList) {
		this.routedPackage = true;
		this.hop = hop;
		this.routingList.addAll(routingList);
	}

	public RoutingHeader(final short hop, final String routingList) {
		this.routedPackage = true;
		this.hop = hop;
		setRoutingList(routingList);
	}

	@Override
	public String toString() {
		return "RoutingHeader [routedPackage=" + routedPackage + ", hop=" + hop + ", routingList=" + routingList + "]";
	}

	/**
	 * Is this a routed or a direct package
	 * @return
	 */
	public boolean isRoutedPackage() {
		return routedPackage;
	}

	/**
	 * Get the current hop
	 * @return
	 */
	public short getHop() {
		return hop;
	}

	/**
	 * Set the current hop
	 * @param hop
	 */
	public void setHop(final short hop) {

		if(hop >= routingList.size()) {
			throw new IllegalArgumentException("Try to set hop : " + hop + " of an routing list of: " + routingList);
		}

		this.hop = hop;
	}

	/**
	 * Set the hop to the next position
	 * @return
	 */
	public boolean dispatchToNextHop() {
		if(hop < routingList.size() - 1) {
			hop++;
			return true;
		}

		return false;
	}

	/**
	 * Reached the package the last hop
	 * @return
	 */
	public boolean reachedFinalInstance() {

		if(routingList.isEmpty()) {
			return true;
		}

		return hop == routingList.size() - 1;
	}

	/**
	 * Get the next receiver of the package
	 * @return
	 */
	public RoutingHop getRoutingHop() {

		assert (hop < routingList.size()) : "Unable to return hop " + hop
			+ ", total hops " + routingList.size();

		return routingList.get(hop);
	}

	/**
	 * Get the list with hops
	 * @return
	 */
	public List<RoutingHop> getRoutingList() {
		return routingList;
	}

	/**
	 * Set the list with hops (as string list)
	 * @param stringRoutingList
	 */
	public void setRoutingList(final String stringRoutingList) {

		routingList.clear();

		// Routing list is empty
		if(stringRoutingList == null || stringRoutingList.length() == 0) {
			return;
		}

		final String[] hostParts = stringRoutingList.split(SEPARATOR_CHAR_HOST);

		for(final String hostPart : hostParts) {
			try {
				final String[] regionParts = hostPart.split(SEPARATOR_CHAR_REGION);

				if(regionParts.length < 2) {
					logger.error("Unable to determine region from: " + hostPart);
				}

				final BBoxDBInstance distributedInstance = new BBoxDBInstance(regionParts[0]);
				final Map<Long, EnumSet<DistributionRegionHandlingFlag>> distributionRegions = new HashMap<>();

				for(int i = 1; i < regionParts.length; i++) {
					final String region = regionParts[i];

					final String[] regionAndFlags = region.split(SEPARATOR_CHAR_FLAGS);

					final long distributionRegion = MathUtil.tryParseLong(regionAndFlags[0], () -> "Unable to parse: " + regionAndFlags[0]);
					final int flagsAsInt = MathUtil.tryParseInt(regionAndFlags[1], () -> "Unable to parse: " + regionAndFlags[1]);

					final EnumSet<DistributionRegionHandlingFlag> flags = DistributionRegionHandlingFlag.fromValue(flagsAsInt);

					distributionRegions.put(distributionRegion, flags);
				}

				final RoutingHop routingHop = new RoutingHop(distributedInstance, distributionRegions);
				routingList.add(routingHop);

			} catch(IllegalArgumentException | InputParseException e) {
				logger.warn("Unable to parse as distributed instance: " + hostPart);
			}
		}
	}

	/**
	 * Get the hop list as string list
	 * @return
	 */
	public String getRoutingListAsString() {

		final StringBuilder sb = new StringBuilder();

		for(final RoutingHop routingHop : routingList) {

			if(sb.length() != 0) {
				sb.append(SEPARATOR_CHAR_HOST);
			}

			sb.append(routingHop.getDistributedInstance().getStringValue());

			for(Map.Entry<Long, EnumSet<DistributionRegionHandlingFlag>> region : routingHop.getDistributionRegions().entrySet()) {
				sb.append(SEPARATOR_CHAR_REGION);
				sb.append(region.getKey());
				sb.append(SEPARATOR_CHAR_FLAGS);
				sb.append(DistributionRegionHandlingFlag.toValue(region.getValue()));
			}

		}

		return sb.toString();
	}

	/**
	 * Get the hop count
	 * @return
	 */
	public int getHopCount() {
		return routingList.size();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + hop;
		result = prime * result + (routedPackage ? 1231 : 1237);
		result = prime * result + ((routingList == null) ? 0 : routingList.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RoutingHeader other = (RoutingHeader) obj;
		if (hop != other.hop)
			return false;
		if (routedPackage != other.routedPackage)
			return false;
		if (routingList == null) {
			if (other.routingList != null)
				return false;
		} else if (!routingList.equals(other.routingList))
			return false;
		return true;
	}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bot. Gall. (Paris), Edn 2 2: 779 (1830)

#### Original name
Sistotrema dermatodon Pers.

### Remarks
null


text:
{% extends "my_ummeli_base.html" %}

{% block content %}

Home »
        My Ummeli
        » My Connections
        » {{ other_user_node.name }}

Connections

        {% if connections %}
            {% for node, is_connected, is_already_requested, is_request_received in connections %}

                {% if node.user_id == user.pk %}
                    {{ node.name }}
                    (me)
                {% else %}
                    {{ node.name }}
                    {% if node.primary_skill %} {{node.primary_skill}}{% endif %}
                {% endif %}

            {% endfor %}
        {% else %}

0 connections.

        {% endif %}

← Back

{% endblock %}


text:
const connection = require("./connection.js");

var orm = {
	all: function(table, cb){
		var queryString = "SELECT * FROM " + table + ";";
		console.log(queryString);

		connection.query(queryString, function(err, result){
			if(err) throw(err);
			cb(result);
		});
	},

	update: function(table, condition, cb){
		var queryString = "UPDATE " + table + " SET devoured = true WHERE id=" + condition + ";";
    	console.log(queryString);

		connection.query(queryString, function(err, result){
			if(err) throw(err);
			cb(result)
		});
	},

	create: function(table, val, cb){
		var queryString = "INSERT INTO " + table + " (burger_name, devoured) VALUES ('" + val + "', FALSE);"
		//INSERT INTO burgers_db.burgers (burger_name, devoured) VALUES ('burgerito', FALSE);
	    console.log(queryString);

		connection.query(queryString, function(err, result){
			if(err) throw(err);
			cb(result);
		});
	}
}

module.exports = orm;

// // Helper function to convert object key/value pairs to SQL syntax
// function objToSql(ob) {
//   var arr = [];

//   // loop through the keys and push the key/value as a string int arr
//   for (var key in ob) {
//     var value = ob[key];
//     // check to skip hidden properties
//     if (Object.hasOwnProperty.call(ob, key)) {
//       // if string with spaces, add quotations (Lana Del Grey => 'Lana Del Grey')
//       if (typeof value === "string" && value.indexOf(" ") >= 0) {
//         value = "'" + value + "'";
//       }
//       // e.g. {name: 'Lana Del Grey'} => ["name='Lana Del Grey'"]
//       // e.g. {sleepy: true} => ["sleepy=true"]
//       arr.push(key + "=" + value);
//     }
//   }

//   // translate array of strings to a single comma-separated string
//   return arr.toString();
// };

// 	}*/


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Trudy Imp. S. -Peterburgsk. Bot. Sada 7:547. 1880

#### Original name
null

### Remarks
null


text:
package overtjaguar.powerconverters.rpmodule.power;

import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockPowerConverterRedPower extends ItemBlock
{
	public ItemBlockPowerConverterRedPower(int id)
	{
		super(id);
		setHasSubtypes(true);
		setMaxDamage(0);
	}

	@Override
	public int getMetadata(int i)
	{
		return i;
	}

	@Override
	public int getIconFromDamage(int i)
	{
		return 0;
	}

	@Override
	public String getItemNameIS(ItemStack itemstack)
	{
		int md = itemstack.getItemDamage();
		if(md == 0) return "rp2Consumer";
		if(md == 1) return "rp2Producer";
		return "unknown";
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
    public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        for (int i = 0; i <= 1; i++)
        {
            par3List.add(new ItemStack(par1, 1, i));
        }
    }
}


text:
namespace Hefezopf.SharePoint.Shared {
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using System;
    using System.ComponentModel;
    using System.Runtime.InteropServices;

    [Guid("7A9E3FB8-A52B-4C68-9731-486517B68E56")]
    public class HefezopfSPWindowsServiceInstanceDeploymentJobDefinition : SPAdministrationServiceJobDefinition {
        internal const string ModeProvision = "Provision";
        internal const string ModeUnprovision = "Unprovision";
        [Persisted]
        private HefezopfSPWindowsServiceInstance _Instance;
        [Persisted]
        private string _Mode;

        /// Gets the displayname.
        public override string DisplayName => SPResource.GetString("CertificateStoreDeploymentJobTitle", new object[]
            {
                this._Instance.DisplayName
            });

        /// Constructor.
        [EditorBrowsable(EditorBrowsableState.Never)]
        public HefezopfSPWindowsServiceInstanceDeploymentJobDefinition()
        {
        }

        /// Contstructor.
        public HefezopfSPWindowsServiceInstanceDeploymentJobDefinition(
            HefezopfSPWindowsServiceInstance instance,
            HefezopfSPWindowsService service,
            SPServer server,
            SPJobLockType lockType,
            string mode)
            : base(HefezopfSPWindowsServiceInstanceDeploymentJobDefinition.NameFromParams(instance), service, server, SPJobLockType.None)
        {
            this._Instance = instance;
            this._Mode = mode;
            base.Schedule = new SPOneTimeSchedule(System.DateTime.Now);
        }

        /// Calculate a name.
        public static string NameFromParams(HefezopfSPWindowsServiceInstance instance) => "job-hefezopf-deploy" + instance.Name;

        /// Update or delete.
        public override void Update()
        {
            SPTimerService timerService = base.Farm.TimerService;
            if (null != timerService && !base.WasCreated)
            {
                HefezopfSPWindowsServiceInstanceDeploymentJobDefinition value = timerService.JobDefinitions.GetValue<HefezopfSPWindowsServiceInstanceDeploymentJobDefinition>(HefezopfSPWindowsServiceInstanceDeploymentJobDefinition.NameFromParams(this._Instance));
                if (null != value)
                {
                    value.Delete();
                }
            }
            base.Update();
        }

        /// Call Un-Provision.
        public override void Execute(System.Guid targetInstanceId)
        {
            if (string.IsNullOrEmpty(this._Mode)) { this._Mode = ModeProvision; }
            if (string.Equals(this._Mode, ModeProvision))
            {
                this._Instance.ProvisionInternal();
            }
            if (string.Equals(this._Mode, ModeUnprovision))
            {
                this._Instance.UnprovisionInternal();
            }
        }
    }
}


text:
package service

// public method
func GetGreeting() string {
	return "Hello, " + getUsername()
}

// private method
func getUsername() string {
	return "User"
}


text:
package ru.job4j.actions;

/**
 * The interface ExecuteAction.
 * This interface description a simple action.
 *
 * @author Alexander Mezgin
 * @version 1.0
 * @since 19.02.2017
 */
public interface ExecuteAction {

    /**
     * This method execute an action.
     */
    void execute();
}


text:
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/macutils.h"
#include "webrtc/base/macwindowpicker.h"
#include "webrtc/base/windowpicker.h"

#if !defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
#error Only for WEBRTC_MAC && !WEBRTC_IOS
#endif

namespace rtc {

bool IsLeopardOrLater() {
  return GetOSVersionName() >= kMacOSLeopard;
}

// Test that this works on new versions and fails acceptably on old versions.
TEST(MacWindowPickerTest, TestGetWindowList) {
  MacWindowPicker picker, picker2;
  WindowDescriptionList descriptions;
  if (IsLeopardOrLater()) {
    EXPECT_TRUE(picker.Init());
    EXPECT_TRUE(picker.GetWindowList(&descriptions));
    EXPECT_TRUE(picker2.GetWindowList(&descriptions));  // Init is optional
  } else {
    EXPECT_FALSE(picker.Init());
    EXPECT_FALSE(picker.GetWindowList(&descriptions));
    EXPECT_FALSE(picker2.GetWindowList(&descriptions));
  }
}

// TODO: Add verification of the actual parsing, ie, add
// functionality to inject a fake get_window_array function which
// provide a pre-constructed list of windows.

}  // namespace rtc


text:
J2OBJC_INITIALIZED_DEFN(OrgLukhnosPortmobileFileStandardCopyOption)

OrgLukhnosPortmobileFileStandardCopyOption *OrgLukhnosPortmobileFileStandardCopyOption_ATOMIC_MOVE;

@implementation OrgLukhnosPortmobileFileStandardCopyOption

+ (OrgLukhnosPortmobileFileStandardCopyOption *)ATOMIC_MOVE {
  return OrgLukhnosPortmobileFileStandardCopyOption_ATOMIC_MOVE;
}

J2OBJC_IGNORE_DESIGNATED_BEGIN
- (instancetype)init {
  OrgLukhnosPortmobileFileStandardCopyOption_init(self);
  return self;
}
J2OBJC_IGNORE_DESIGNATED_END

+ (const J2ObjcClassInfo *)__metadata {
  static J2ObjcMethodInfo methods[] = {
    { NULL, NULL, 0x1, -1, -1, -1, -1, -1, -1 },
  };
  #pragma clang diagnostic push
  #pragma clang diagnostic ignored "-Wobjc-multiple-method-names"
  #pragma clang diagnostic ignored "-Wundeclared-selector"
  methods[0].selector = @selector(init);
  #pragma clang diagnostic pop
  static const J2ObjcFieldInfo fields[] = {
    { "ATOMIC_MOVE", "LOrgLukhnosPortmobileFileStandardCopyOption;", .constantValue.asLong = 0, 0x19, -1, 0, -1, -1 },
  };
  static const void *ptrTable[] = { &OrgLukhnosPortmobileFileStandardCopyOption_ATOMIC_MOVE };
  static const J2ObjcClassInfo _OrgLukhnosPortmobileFileStandardCopyOption = { "StandardCopyOption", "org.lukhnos.portmobile.file", ptrTable, methods, fields, 7, 0x1, 1, 1, -1, -1, -1, -1, -1 };
  return &_OrgLukhnosPortmobileFileStandardCopyOption;
}

+ (void)initialize {
  if (self == [OrgLukhnosPortmobileFileStandardCopyOption class]) {
    JreStrongAssignAndConsume(&OrgLukhnosPortmobileFileStandardCopyOption_ATOMIC_MOVE, new_OrgLukhnosPortmobileFileStandardCopyOption_init());
    J2OBJC_SET_INITIALIZED(OrgLukhnosPortmobileFileStandardCopyOption)
  }
}

@end

void OrgLukhnosPortmobileFileStandardCopyOption_init(OrgLukhnosPortmobileFileStandardCopyOption *self) {
  NSObject_init(self);
}

OrgLukhnosPortmobileFileStandardCopyOption *new_OrgLukhnosPortmobileFileStandardCopyOption_init() {
  J2OBJC_NEW_IMPL(OrgLukhnosPortmobileFileStandardCopyOption, init)
}

OrgLukhnosPortmobileFileStandardCopyOption *create_OrgLukhnosPortmobileFileStandardCopyOption_init() {
  J2OBJC_CREATE_IMPL(OrgLukhnosPortmobileFileStandardCopyOption, init)
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(OrgLukhnosPortmobileFileStandardCopyOption)


text:
using Rabbit.Kernel;
using Rabbit.Kernel.Extensions.Models;
using System.Collections.Generic;

namespace Rabbit.Components.Security.Permissions
{
    /// <summary>
    /// 一个抽象的许可提供程序。
    /// </summary>
    public interface IPermissionProvider : IDependency
    {
        /// <summary>
        /// 功能。
        /// </summary>
        Feature Feature { get; }

        /// <summary>
        /// 获取许可集合。
        /// </summary>
        /// <returns>许可集合。</returns>
        IEnumerable<Permission> GetPermissions();

        /// <summary>
        /// 获取默认的立体许可集合。
        /// </summary>
        /// <returns>立体许可集合。</returns>
        IEnumerable<PermissionStereotype> GetDefaultStereotypes();
    }
}


text:
(function() {
    'use strict';

    angular
        .module('assessoriaTorrellesApp')
        .controller('NotificationController', NotificationController);

    NotificationController.$inject = ['$scope', '$state', 'DataUtils', 'Notification', 'AlertService', 'pagingParams', 'paginationConstants'];

    function NotificationController ($scope, $state, DataUtils, Notification, AlertService, pagingParams, paginationConstants) {
        var vm = this;

        vm.loadPage = loadPage;
        vm.predicate = pagingParams.predicate;
        vm.reverse = pagingParams.ascending;
        vm.transition = transition;
        vm.itemsPerPage = paginationConstants.itemsPerPage;
        vm.openFile = DataUtils.openFile;
        vm.byteSize = DataUtils.byteSize;
        vm.notifications = [];
        vm.checked = [];

        loadAll();

        function loadAll () {
            Notification.byUser({
            }, onSuccess, onError);
            function onSuccess(data) {
                vm.notifications = data;
            }
            function onError(error) {
                AlertService.error(error.data.message);
            }
            $state.go($state.current);
        }

        vm.deleteNotifications = function deleteNotifications() {
            Notification.multipleDelete({"ids" : getAllChecked()}, reloadView(), console.log("Error"));
        };

        vm.setReadNotifications = function updateNotifications() {
            var checked = getAllNotificationsChecked();
            angular.forEach(checked, function (itm) {
                itm.seen = false;
            });
            Notification.multipleUpdate(checked, onSuccess, onError);
        };
        vm.setUnReadNotifications = function updateNotifications() {
            var checked = getAllNotificationsChecked();
            angular.forEach(checked, function (itm) {
                itm.seen = true;
            });
            Notification.multipleUpdate(checked, onSuccess, onError);
        };

        function onSuccess(data) {
            vm.notifications = data;
            $state.go($state.current);
            toastr.success("Notificaciones alteradas");
        }
        function onError(error) {
            AlertService.error(error.data.message);
            $state.go($state.current);
        }

        function loadPage (page) {
            vm.page = page;
            vm.transition();
        }

        function transition () {
            $state.transitionTo($state.$current, {
                page: vm.page,
                sort: vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc'),
                search: vm.currentSearch
            });
        }

        vm.toggleAll = function() {
            angular.forEach(vm.notifications, function(itm){ itm.selected = vm.isAllSelected; });

        };

        vm.optionToggled = function(){
            $scope.isAllSelected = vm.notifications.every(function(itm){ return itm.selected; })
        };

        function getAllChecked() {
            var allChecked = "";
            angular.forEach(vm.notifications, function (itm) {
                if (itm.selected){
                    if (allChecked == ""){
                        allChecked = itm.id;
                    }else{
                        allChecked = allChecked + "-" + itm.id;
                    }
                }
            });
            console.log(allChecked);
            return allChecked;

        }

        function getAllNotificationsChecked() {
            var allChecked = [];
            angular.forEach(vm.notifications, function (itm) {
                if (itm.selected){
                    allChecked.push(itm);
                }
            });
            return allChecked;
        }

        function reloadView(){
            $state.go($state.current, {}, {reload: true});
        }
    }
})();


text:
<?php

/**
 * @file
 * Definition of Drupal\system\Tests\Form\ElementsVerticalTabsTest.
 */

namespace Drupal\system\Tests\Form;

use Drupal\simpletest\WebTestBase;

/**
 * Test the vertical_tabs form element for expected behavior.
 */
class ElementsVerticalTabsTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('form_test');

  public static function getInfo() {
    return array(
      'name' => 'Vertical tabs form element type test',
      'description' => 'Test the vertical_tabs element for expected behavior',
      'group' => 'Form API',
    );
  }

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

    $this->admin_user = $this->drupalCreateUser(array('access vertical_tab_test tabs'));
    $this->web_user = $this->drupalCreateUser();
    $this->drupalLogin($this->admin_user);
  }

  /**
   * Ensures that vertical-tabs.js is included before collapse.js.
   *
   * Otherwise, collapse.js adds "SHOW" or "HIDE" labels to the tabs.
   */
  function testJavaScriptOrdering() {
    $this->drupalGet('form_test/vertical-tabs');
    $position1 = strpos($this->content, 'core/misc/vertical-tabs.js');
    $position2 = strpos($this->content, 'core/misc/collapse.js');
    $this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, 'vertical-tabs.js is included before collapse.js');
  }

  /**
   * Ensures that vertical tab markup is not shown if user has no tab access.
   */
  function testWrapperNotShownWhenEmpty() {
    // Test admin user can see vertical tabs and wrapper.
    $this->drupalGet('form_test/vertical-tabs');
    $wrapper = $this->xpath("//div[@class='vertical-tabs-panes']");
    $this->assertTrue(isset($wrapper[0]), 'Vertical tab panes found.');

    // Test wrapper markup not present for non-privileged web user.
    $this->drupalLogin($this->web_user);
    $this->drupalGet('form_test/vertical-tabs');
    $wrapper = $this->xpath("//div[@class='vertical-tabs-panes']");
    $this->assertFalse(isset($wrapper[0]), 'Vertical tab wrappers are not displayed to unprivileged users.');
  }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lab3_richardpadgett_ricardoromero;

/**
 *
 * @author ricky
 */
public class Ropa extends Productos{
    private String talla;

    public Ropa() {
        super();
    }

    public Ropa(String talla, int precio, String descripcion, String marca, int descuento) {
        super(precio, descripcion, marca, descuento);
        this.talla = talla;
    }

    public String getTalla() {
        return talla;
    }

    public void setTalla(String talla) {
        this.talla = talla;
    }

    @Override
    public String toString() {
        return "Ropa{" + "talla=" + talla + '}';
    }
}


text:
package de.sepe.tennis.remote.server;

import de.sepe.tennis.remote.*;

/**
 * Player.
 *
 * @author Sebastian Peters
 * @since 16.12.2003
 */
public class Player extends PlayerView {

    /**
     * Constructor.
     *
     * @param name the name
     */
    public Player(String name) {
        super(name);
    }
}


text:
- enable tests for PHP 5.6
- remove HHVM from allowed failures

## v1.1.22 (2014-04-06)

- fix #19: don't call ini_set() when not required and gain compat with PHP5.6

## v1.1.21 (2014-03-26)

- fix #18 u::wordwrap() now relies on native behavior

## v1.1.20 (2014-03-01)
## v1.1.19 (2014-03-01)

- fix mb_regex_encoding() being disabled on some hosting providers

## v1.1.18 (2014-02-02)

- require PCRE>=7.3, the first that correctly checks UTF-8 validity
- enable HHVM on Travis CI

## v1.1.17 (2014-01-02)

- enable Travis CI and SensioLabsInsight
- add shims for mb_check_encoding, mb_detect_encoding, mb_detect_order,
  mb_language and mb_encoding_aliases
- mbstring shim fix: alias UTF8 to UTF-8
- more tests

## v1.1.16 (2013-12-06)

- fix $_FILES bootup filtering
- fix mbstring shim behavior with invalid utf8 strings

## v1.1.15 (2013-11-23)

- u::toAscii() is now locale sensitive and allows a substitution character
- use LSB for more extension openness
- handle null for mb_substr() shim length as in PHP 5.4.8
- fix casts to string
- fix mbstring MB_CASE_TITLE shim on edge case
- small optimizations
- add a changelog

## v1.1.14 (2013-11-04)

- set default_charset to UTF-8 at bootup
- remove bootup PCRE warning
- fix iconv internal_encoding shim
- fix bootup dependencies
- add tests for normalizers consts
- readme update

## v1.1.13 (2013-10-11)

- new u::filter(): normalizes to UTF-8 NFC, converting from CP-1252 when needed
- new u::json_decode(), u::filter_input() and u::filter_input_array() for NFC safeness
- reference Unicode 6.3
- more tests
- readme update

## v1.1.12 (2013-10-03)

- new Patchwork\TurkishUtf8 class extends Patchwork\Utf8 with Turkish specifics
- expose Patchwork\Utf8\Bootup::filterString() for UF-8 NFC strings normalization
- normalize inputs EOL to work around https://bugs.php.net/65732
- update composer.json

## v1.1.11 (2013-08-19)

- updates related to PHP bugs 52211 and 61860
- fixes and tests for iconv shim
- fixes and tests for mbstring shim

## v1.1.10 (2013-08-13)

- update .gitattributes export-ignore
- fixes and tests for intl::grapheme_extract() shim
- fixes and tests for iconv shim
- fixes and tests for mbstring shim

## v1.1.9 (2013-08-04)

- know that PHP bug 61860 has been fixed in 5.5.1
- fix intl::grapheme_strlen() shim on edge case
- fix case sensitive encoding checks for mbstring shim
- some more fixes, tests and optimizations

## v1.1.8 since v1.1.0 (2013-05-24)

- filter leading combining chars in inputs for NFC safeness
- fixes, tests and optimizations
- readme update

## v1.1.0 (2013-04-18)

- PSR-0 autoloading and explicit bootup configuration is now required

## v1.0.6 since v1.0.0 (2013-04-22)

- add extra characters for ASCII transliterations
- move bootup stages in namespaced functions for greater modularity
- NFC normalization for autoglobal inputs
- better setlocale() initialization
- fix fatal error caused by multiple bootup inclusion
- fix bootup

## v1.0.0 (2012-10-15)

- first official release of a work started in 2007
- Apache v2.0 / GPL v2.0 dual-licensed
- PHP portability implementations for mbstring, iconv, intl grapheme_*() and utf8_encode/decode()
- Unicode compliant and portable Normalizer
- grapheme clusters aware UTF-8 handling string functions replica
- PHP runtime environment configuration for UTF-8
- extra functions for UTF-8 validity checks, transliterations and case folding
- covered by unit tests


text:
import createDialog from './dialog.js'
import content from './about.htm'

export default function () {
  return createDialog(content)
}


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta name="description" content="GitHub Feed Reader for OS X" />
  <meta name="author" content="Katsuma Tanaka" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />

  <title>PopHub - GitHub Feed Reader for OS X</title>

  <link rel="icon" sizes="16x16 24x24 32x32 48x48 64x64 128x128 256x256" href="assets/img/favicon.ico" />

  <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600" rel="stylesheet" type="text/css" />

    <link href="assets/css/style.css" rel="stylesheet" />

PopHub

GitHub Feed Reader for OS X

      Requirements: OS X 10.9 or later

Created by Katsuma Tanaka

Photo by D. Sharon Pruitt


text:
<?php
/*
 * This file is part of NeutronTeamMemberBundle
 *
 * (c) Nikolay Georgiev <azazen09@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
namespace Neutron\Plugin\TeamMemberBundle\Entity;

use Neutron\Plugin\TeamMemberBundle\Model\TeamMemberOverviewInterface;

use Neutron\Plugin\TeamMemberBundle\Model\TeamMemberInterface;

use Neutron\Plugin\TeamMemberBundle\Model\TeamMemberReferenceInterface;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\MappedSuperclass
 */
class AbstractTeamMemberReference implements TeamMemberReferenceInterface
{
    /**
     * @var integer
     *
     * @ORM\Id @ORM\Column(name="id", type="integer")
     *
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var integer
     *
     * @ORM\Column(type="integer", name="position", length=10, nullable=true, unique=false)
     */
    protected $position = 0;

    /**
     * @ORM\ManyToOne(targetEntity="Neutron\Plugin\TeamMemberBundle\Model\TeamMemberInterface")
     * @ORM\JoinColumn(onDelete="CASCADE")
     */
    protected $inversed;

    /**
     * @ORM\ManyToOne(targetEntity="Neutron\Plugin\TeamMemberBundle\Model\TeamMemberOverviewInterface", inversedBy="references")
     * @ORM\JoinColumn(onDelete="CASCADE")
     */
    protected $teamMemberOverview;

    public function getId ()
    {
        return $this->id;
    }

	public function getPosition ()
    {
        return $this->position;
    }

	public function setPosition ($position)
    {
        $this->position = $position;
    }

	public function getInversed ()
    {
        return $this->inversed;
    }

	public function setInversed ($inversed)
    {
        if (!$inversed instanceof TeamMemberInterface){
            throw new \InvalidArgumentException('Reference must be instance of TeamMemberInterface');
        }

        $this->inversed = $inversed;
    }

	public function getTeamMemberOverview ()
    {
        return $this->teamMemberOverview;
    }

	public function setTeamMemberOverview (TeamMemberOverviewInterface $teamMemberOverview)
    {
        $this->teamMemberOverview = $teamMemberOverview;
    }

    public function getLabel()
    {
        return $this->inversed->getName();
    }

}


text:
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.rt.execution.junit;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

public class ComparisonFailureData {
  private static final String ASSERTION_CLASS_NAME = "java.lang.AssertionError";
  private static final String ASSERTION_FAILED_CLASS_NAME = "junit.framework.AssertionFailedError";

  public static final String OPENTEST4J_ASSERTION = "org.opentest4j.AssertionFailedError";

  private final String myExpected;
  private final String myActual;
  private final String myFilePath;
  private final String myActualFilePath;

  private static final Map<String, Field> EXPECTED = new HashMap<>();
  private static final Map<String, Field> ACTUAL = new HashMap<>();

  static {
    try {
      init("junit.framework.ComparisonFailure");
      init("org.junit.ComparisonFailure");
    }
    catch (Throwable ignored) { }
  }

  private static void init(String exceptionClassName) throws NoSuchFieldException, ClassNotFoundException {
    Class<?> exceptionClass = Class.forName(exceptionClassName, false, ComparisonFailureData.class.getClassLoader());
    final Field expectedField = exceptionClass.getDeclaredField("fExpected");
    expectedField.setAccessible(true);
    EXPECTED.put(exceptionClassName, expectedField);

    final Field actualField = exceptionClass.getDeclaredField("fActual");
    actualField.setAccessible(true);
    ACTUAL.put(exceptionClassName, actualField);
  }

  public ComparisonFailureData(String expected, String actual) {
    this(expected, actual, null);
  }

  public ComparisonFailureData(String expected, String actual, String filePath) {
    this(expected, actual, filePath, null);
  }

  public ComparisonFailureData(String expected, String actual, String filePath, String actualFilePath) {
    myExpected = expected;
    myActual = actual;
    myFilePath = filePath != null ? new File(filePath).getAbsolutePath() : null;
    myActualFilePath = actualFilePath != null ? new File(actualFilePath).getAbsolutePath() : null;
  }

  public static void registerSMAttributes(ComparisonFailureData notification,
                                          String trace,
                                          String failureMessage,
                                          Map attrs,
                                          Throwable throwable) {
    registerSMAttributes(notification, trace, failureMessage, attrs, throwable, "Comparison Failure: ", "expected:<");
  }

  public static void registerSMAttributes(ComparisonFailureData notification, String trace,
                                          String failureMessage,
                                          Map attrs,
                                          Throwable throwable,
                                          String comparisonFailurePrefix,
                                          final String expectedPrefix) {

    final int failureIdx = failureMessage != null ? trace.indexOf(failureMessage) : -1;
    final int failureMessageLength = failureMessage != null ? failureMessage.length() : 0;
    String details = failureIdx > -1 ? trace.substring(failureIdx + failureMessageLength) : trace;

    if (notification != null) {
      final int expectedIdx = trace.indexOf(expectedPrefix);
      final String comparisonFailureMessage;
      if (expectedIdx > 0) {
        comparisonFailureMessage = trace.substring(0, expectedIdx);
      }
      else if (failureIdx > -1) {
        comparisonFailureMessage = trace.substring(0, failureIdx + failureMessageLength);
      }
      else {
        comparisonFailureMessage = (failureMessageLength > 0 ? failureMessage + "\n" : "") + comparisonFailurePrefix;
      }
      if (!attrs.containsKey("message")) {
        attrs.put("message", comparisonFailureMessage);
      }

      final String filePath = notification.getFilePath();
      final String actualFilePath = notification.getActualFilePath();
      final String expected = notification.getExpected();
      final String actual = notification.getActual();

      int fullLength = (filePath == null && expected != null ? expected.length() : 0) +
                       (actualFilePath == null && actual != null ? actual.length() : 0) +
                       details.length() +
                       comparisonFailureMessage.length() + 100;
      if (filePath != null) {
        attrs.put("expectedFile", filePath);
      }
      else {
        writeDiffSide(attrs, "expected", expected, fullLength);
      }

      if (actualFilePath != null) {
        attrs.put("actualFile", actualFilePath);
      }
      else {
        writeDiffSide(attrs, "actual", actual, fullLength);
      }
    }
    else {
      Throwable throwableCause = null;
      try {
        throwableCause = throwable.getCause();
      }
      catch (Throwable ignored) {}

      if (!isAssertionError(throwable.getClass()) && !isAssertionError(throwableCause != null ? throwableCause.getClass() : null)) {
        attrs.put("error", "true");
      }
      attrs.put("message", failureIdx > -1 ? trace.substring(0, failureIdx + failureMessageLength)
                                           : failureMessage != null ? failureMessage : "");
    }
    attrs.put("details", details);
  }

  private static void writeDiffSide(Map attrs, final String expectedOrActualPrefix, final String text, int fullLength) {
    String property = System.getProperty("idea.test.cyclic.buffer.size");

    int threshold;
    try {
      threshold = Integer.parseInt(property);
    }
    catch (NumberFormatException ignored) {
      threshold = -1;
    }

    if (threshold > 0 && fullLength > threshold) {
      try {
        //noinspection SSBasedInspection
        File tempFile = File.createTempFile(expectedOrActualPrefix, "");
        OutputStream stream = new FileOutputStream(tempFile);
        try {
          stream.write(text.getBytes(StandardCharsets.UTF_8), 0, text.length());
        }
        finally {
          stream.close();
        }
        attrs.put(expectedOrActualPrefix + "File", tempFile.getAbsolutePath());
        attrs.put(expectedOrActualPrefix + "IsTempFile", "true");
        return;
      }
      catch (Throwable ignored) {}
    }
    attrs.put(expectedOrActualPrefix, text);
  }

  public static boolean isAssertionError(Class throwableClass) {
    if (throwableClass == null) return false;
    final String throwableClassName = throwableClass.getName();
    if (throwableClassName.equals(ASSERTION_CLASS_NAME) ||
        throwableClassName.equals(ASSERTION_FAILED_CLASS_NAME) ||
        throwableClassName.equals(OPENTEST4J_ASSERTION)) {
      return true;
    }
    return isAssertionError(throwableClass.getSuperclass());
  }

  public String getFilePath() {
    return myFilePath;
  }

  public String getActualFilePath() {
    return myActualFilePath;
  }

  public String getExpected() {
    return myExpected;
  }

  public String getActual() {
    return myActual;
  }

  public static ComparisonFailureData create(Throwable assertion) {
    if (assertion instanceof FileComparisonData) {
      final FileComparisonData comparisonFailure = (FileComparisonData)assertion;
      String actual = comparisonFailure.getActualStringPresentation();
      String expected = comparisonFailure.getExpectedStringPresentation();
      if (actual != null && expected != null) {
        return new ComparisonFailureData(expected, actual, comparisonFailure.getFilePath(), comparisonFailure.getActualFilePath());
      }
    }

    if (assertion instanceof FileComparisonFailure) {
      final FileComparisonFailure comparisonFailure = (FileComparisonFailure)assertion;
      String actual = comparisonFailure.getActual();
      String expected = comparisonFailure.getExpected();
      if (actual != null && expected != null) {
        return new ComparisonFailureData(expected, actual, comparisonFailure.getFilePath(), comparisonFailure.getActualFilePath());
      }
    }

    ComparisonFailureData commonAssertion = createCommonAssertion(assertion);
    if (commonAssertion != null) return commonAssertion;

    try {
      return new ComparisonFailureData(getExpected(assertion), getActual(assertion));
    }
    catch (Throwable e) {
      return null;
    }
  }

  /** @noinspection SSBasedInspection*/
  private static ComparisonFailureData createCommonAssertion(Throwable assertion) {
    try {
      Class assertionClass = assertion.getClass();
      if (assertionClass.getName().equals(OPENTEST4J_ASSERTION)) {
        Class[] parameterTypes = new Class[0];
        Object[] args = new Object[0];
        if (((Boolean)assertionClass.getDeclaredMethod("isExpectedDefined", parameterTypes).invoke(assertion, args)).booleanValue() &&
            ((Boolean)assertionClass.getDeclaredMethod("isActualDefined", parameterTypes).invoke(assertion, args)).booleanValue()) {

          Object expected = assertionClass.getDeclaredMethod("getExpected", parameterTypes).invoke(assertion, args);
          Object expectedString = expected.getClass().getDeclaredMethod("getStringRepresentation", parameterTypes).invoke(expected, args);

          Object actual = assertionClass.getDeclaredMethod("getActual", parameterTypes).invoke(assertion, args);
          Object actualString = actual.getClass().getDeclaredMethod("getStringRepresentation", parameterTypes).invoke(actual, args);
          return new ComparisonFailureData((String)expectedString, (String)actualString);
        }
      }
    }
    catch (Throwable e) {
      return null;
    }
    return null;
  }

  public static String getActual(Throwable assertion) throws IllegalAccessException, NoSuchFieldException {
     return get(assertion, ACTUAL, "fActual");
   }

   public static String getExpected(Throwable assertion) throws IllegalAccessException, NoSuchFieldException {
     return get(assertion, EXPECTED, "fExpected");
   }

   private static String get(final Throwable assertion, final Map<String, Field> staticMap, final String fieldName) throws IllegalAccessException, NoSuchFieldException {
     String actual;
     Class<? extends Throwable> assertionClass = assertion.getClass();
     Field actualField = staticMap.get(assertionClass.getName());
     if (actualField != null) {
       actual = (String)actualField.get(assertion);
     }
     else {
       Field field = assertionClass.getDeclaredField(fieldName);
       field.setAccessible(true);
       actual = (String)field.get(assertion);
     }
     return actual;
   }
}


text:
package org.mercycorps.translationcards.activity.addTranslation;

import org.mercycorps.translationcards.R;
import org.mercycorps.translationcards.activity.translations.TranslationsActivity;

import butterknife.OnClick;

public class GetStartedActivity extends AddTranslationActivity {

    @Override
    public void inflateView() {
        setContentView(R.layout.activity_card_get_started);
    }

    @Override
    public void setBitmapsForActivity() {
        setBitmap(R.id.get_started_image, R.drawable.get_started_image);
    }

    @OnClick(R.id.get_started_button)
    public void getStartedButtonClick() {
            startNextActivity(GetStartedActivity.this, EnterSourcePhraseActivity.class);
    }

    @OnClick(R.id.get_started_back)
    public void getStartedBackButtonClicked() {
        startNextActivity(GetStartedActivity.this, TranslationsActivity.class);
    }

}


text:
[![Build Status](https://travis-ci.org/FastFlowDebate/FastFlow.svg?branch=master)](https://travis-ci.org/FastFlowDebate/FastFlow)
[![Build status](https://ci.appveyor.com/api/projects/status/cg72fv9in3fe9gvk/branch/master?svg=true)](https://ci.appveyor.com/project/Zarkoix/fastflow/branch/master)
[![Dependancy Status](https://david-dm.org/FastFlowDebate/FastFlow.svg)](https://david-dm.org)

Debate organization suite for empowering debaters to directly leverage their research in round

## Current Features:

Cards:

* Searchable by author and sTags (searchable tags, not to be confused with a cards tag line)
* Organized by sTag in the card manager
* Add notes to cards
* Show what other files reference the card (For example do you use it in blocks or speeches)

Speeches:

* Write speeches in a simple, organized manner
* Mark speeches as aff or neg to make locating them easier

Flowing:

* Create organized flows
* Save and manage flows
* Mark individual cards as important you can easily refer to them in speeches

## Planned Features:

Speeches:

* Speech documents help you present by using telling you how long it would take to present, know exactly how much you can have in your rebuttal
* Every file you refer to is only one quick away, show your opponents evidence they request at lightspeed
* Spellcheck?
* Tell FastFlow how your speech should be preflowed as you write it

Blocks:

* Quickly select which responses you want to read in rebuttal and move them to a speech document or flow
* Mark responses as turns, delinks, mitigation, or indicts

Flowing:

* Add cards to your flow, and they'll automatically display the bolded text for easy reference
* Autocorrect taglines to streamline flowing
* [LONG TERM] Based on contention name allow you to one-click add your blocks to your flow

## Installation:
Make sure you have NodeJS installed

*in /fastflow*

    npm run setup

## Running

* in one terminal tab

    npm run watch

* in second terminal tab

    npm run start

## Contribution

* A branch will have to pass the build check (Travis-CI) before being considered for merge

* Update this README with any installation/building changes.


text:
define(
"dojox/atom/widget/nls/pt/FeedViewerEntry", //begin v1.x content
({
	deleteButton: "[Excluir]"
})
//end v1.x content
);


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE
 module
 PUBLIC
 "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN"
 "https://raw.githubusercontent.com/gwtproject/gwt/master/distro-source/core/src/gwt-module.dtd">
<module rename-to='Steem'>
	<source path='' />
</module>


text:
layout: posts_by_category
category: nginx
permalink: /categories/nginx/
---


text:
var grunt = require('grunt');

exports.beml = {
  defaultOptions: function(test) {
    var actual = grunt.file.read('tmp/default_options.html');
    var expected = grunt.file.read('test/expected/default_options.html');
    test.equal(actual, expected, 'should describe what the default behavior is.');

    test.done();
  },
  customOptions: function(test) {
    var actual = grunt.file.read('tmp/custom_options.html');
    var expected = grunt.file.read('test/expected/custom_options.html');
    test.equal(actual, expected, 'should describe what the custom option(s) behavior is.');

    test.done();
  },
};


text:
using UnityEngine;
using System.Collections;

public static class VectorExtensions {

	public static Vector2 XY (this Vector3 v) {
		return new Vector2 (v.x, v.y);
	}

	public static Vector3 to3 (this Vector2 v) {
		return new Vector3 (v.x, v.y, 0f);
	}

	public static Vector2 Rotate(this Vector2 v, float degrees) {
		Vector3 v3 = Quaternion.AngleAxis(degrees, Vector3.back) * v;
		return v3.XY();
	}

	public static void LookAt2D (this Transform t, Vector2 target) {
		Vector2 direction = target.to3() - t.position;
		float rot_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
		t.rotation = Quaternion.Euler(0f, 0f, rot_z - 90);
	}

}


text:
package net.techreadiness.persistence.domain;

import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;

@StaticMetamodel(OrgPartDO.class)
public abstract class OrgPartDO_ {

	public static volatile SingularAttribute<OrgPartDO, ScopeDO> scope;
	public static volatile ListAttribute<OrgPartDO, OrgPartExtDO> orgPartExts;
	public static volatile SingularAttribute<OrgPartDO, Long> orgPartId;
	public static volatile SingularAttribute<OrgPartDO, OrgDO> org;

}


text:
from django.contrib import admin
from django.forms.models import modelform_factory
from django.http import HttpResponse, HttpResponseForbidden
import json

from .models import *
from .forms import AttachmentInline

class TemporaryAdmin(admin.ModelAdmin):
    list_display = ('id', 'created', 'modified')
    fields = ('id', 'created', 'modified')
    readonly_fields = ('id', 'created', 'modified')
    inlines = (AttachmentInline,)

class AttachmentAdmin(admin.ModelAdmin):
    list_display = ('__str__', 'content_object', 'created', 'modified')
    list_filter = ('content_type',)
    fields = ('id', 'created', 'modified', 'content_type', 'object_id', 'file')
    readonly_fields = ('id', 'created', 'modified')

    def add_view(self, request, form_url='', extra_context=None):
        if not self.has_add_permission(request):
            raise PermissionDenied

        if request.method == 'POST' and \
          request.META.get('HTTP_ACCEPT') == 'application/json':

        # if request.method == 'POST':
            AttachmentForm = modelform_factory(Attachment, exclude=[])
            form = AttachmentForm(request.POST, request.FILES)
            if form.is_valid():
                attachment = form.save(commit=False)

                if all(k in request.POST for k in ('content_type', 'object_id')):
                    attachment.content_type = ContentType.objects.get_for_id(request.POST['content_type'])
                    attachment.object_id = request.POST['object_id']
                attachment.save()

                return HttpResponse(json.dumps({
                    'id': attachment.id,
                    'content_type': attachment.content_type.pk,
                    'object_id': attachment.object_id,
                }), content_type='application/json')
            else:
                return HttpResponseForbidden(json.dumps({
                    'errors': form.errors
                }), content_type='application/json')
        else:
            return super().add_view(
                request,
                form_url,
                extra_context=extra_context
            )

admin.site.register(Temporary, TemporaryAdmin)
admin.site.register(Attachment, AttachmentAdmin)


text:
package com.elibom.jogger.middleware.router.interceptor;

import com.elibom.jogger.http.Request;
import com.elibom.jogger.http.Response;

/**
 * Performs tasks before or after the controller is called. Use cases include:
 *
 *

 *
Check authentication and authorization of the request.

 *
Log the time taken by the request.

 *
Open a database connection before the controller is called and then close it.

 *

 *
 * Interceptors must be thread-safe as Jogger only uses one instance for all the requests.
 *
 * @author German Escobar
 */
public interface Interceptor {

	/**
	 * This method is called when a matching request is received. Implementations of this method are responsible of
	 * calling the {@link InterceptorExecution#proceed()} method to continue with the execution of the request unless it
	 * actually wants to stop the execution (in which case it should set the response in the controller)
	 *
	 * @param request
	 * @param response
	 * @param execution
	 *
	 * @throws Exception
	 */
	void intercept(Request request, Response response, InterceptorExecution execution) throws Exception;

}


text:
<?php

declare(strict_types=1);

namespace Symplify\NeonToYamlConverter;

use Nette\Utils\Strings;
use Symplify\PackageBuilder\Strings\StringFormatConverter;
use Symplify\SmartFileSystem\SmartFileInfo;

final class ArrayParameterCollector
{
    /**
     * @var string[]
     */
    private $parametersToReplace = [];

    /**
     * @var StringFormatConverter
     */
    private $stringFormatConverter;

    public function __construct(StringFormatConverter $stringFormatConverter)
    {
        $this->stringFormatConverter = $stringFormatConverter;
    }

    /**
     * @return string[]
     */
    public function getParametersToReplace(): array
    {
        return $this->parametersToReplace;
    }

    /**
     * @param SmartFileInfo[] $fileInfos
     */
    public function collectFromFiles(array $fileInfos): void
    {
        foreach ($fileInfos as $fileInfo) {
            $content = $fileInfo->getContents();
            $matches = Strings::matchAll($content, '#%(?<param_name>\w+\.\w+)%#');

            foreach ($matches as $match) {
                $oldKey = $match['param_name'];
                $newKey = $this->stringFormatConverter->camelCaseToUnderscore($oldKey);

                $this->parametersToReplace[$oldKey] = $newKey;
            }
        }
    }

    public function matchParameterToReplace(string $key): ?string
    {
        return $this->parametersToReplace[$key] ?? null;
    }
}


text:
describe ManageIQ::Providers::Azure::CloudManager::Vm do
  let(:ems) { FactoryGirl.create(:ems_azure) }
  let(:host) { FactoryGirl.create(:host, :ext_management_system => ems) }
  let(:vm) { FactoryGirl.create(:vm_azure, :ext_management_system => ems, :host => host) }
  let(:power_state_on)  { "VM running" }
  let(:power_state_off) { "VM deallocated" }
  let(:power_state_suspended) { "VM stopping" }

  context "#is_available?" do
    context("with :start") do
      let(:state) { :start }
      include_examples "Vm operation is available when not powered on"
    end

    context("with :stop") do
      let(:state) { :stop }
      include_examples "Vm operation is available when powered on"
    end
  end

  context "reset" do
    it "does not support the reset operation" do
      expect(vm.supports_reset?).to be_falsy
      expect(vm.unsupported_reason(:reset)).to eql("Hard reboot not supported on Azure")
    end
  end
end


text:
* Initial version release
* Production images stored in S3

## v0.2.0

* Enable Offline Compression for JS/CSS in production
* Add Sharethis to product detail page
* Add Google Analytics
* Generate and display thumbnails on the homepage

## v0.3

* Replace Amazon S3 with Cloudinary for Image Storage


text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>

    <copyright>
      <year>2007</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>

    <title>erts_alloc_config</title>
    <prepared>Rickard Green</prepared>
    <docno>1</docno>
    <date>07-05-30</date>
    <rev>1</rev>
    <file>erts_alloc_config.sgml</file>

  <module>erts_alloc_config</module>
  <modulesummary>Configuration tool for erts_alloc</modulesummary>
  <description>
    <note>

<c>erts_alloc_config</c> is currently an experimental
        tool and might be subject to backward incompatible
        changes.

    </note>

<seealso marker="erts:erts_alloc">erts_alloc(3)</seealso> is an
      Erlang Run-Time System internal memory allocator library.
      <c>erts_alloc_config</c> is intended to be used to aid creation
      of an <seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>
      configuration that is suitable for a limited number of runtime
      scenarios. The configuration that <c>erts_alloc_config</c>
      produce is intended as a suggestion, and may need to be
      adjusted manually.

The configuration is created based on information about a number
      of runtime scenarios. It is obviously impossible to foresee every
      runtime scenario that can occur. The important scenarios are
      those that cause maximum or minimum load on specific memory
      allocators. Load in this context is total size of memory blocks
      allocated.

The current implementation of <c>erts_alloc_config</c> concentrate
      on configuration of multi-block carriers. Information gathered
      when a runtime scenario is saved is mainly current and maximum use
      of multi-block carriers. If a parameter that change the use of
      multi-block carriers is changed, a previously generated
      configuration is invalid and <c>erts_alloc_config</c> needs
      to be run again. It is mainly the single block carrier threshold
      that effects the use of multi-block carriers, but other
      single-block carrier parameters might as well. If another value of
      a single block carrier parameter than the default is desired, use
      the desired value when running <c>erts_alloc_config</c>.

A configuration is created in the following way:

    <list type="bulleted">
      <item>

Pass the <seealso marker="erts:erts_alloc#Mea">+Mea config</seealso>
	   command-line flag to the Erlang runtime system you are going
	   to use for creation of the allocator configuration. It will
	   disable features that prevent <c>erts_alloc_config</c> from
	   doing its job. Note, you should not use this flag
	   when using the created configuration. Also note that it is
	   important that you use the same
	   <seealso marker="erts:erl#+S">amount of schedulers</seealso>
	   when creating the configuration as you are going the use on
	   the system using the configuration.

      </item>
      <item>

Run your applications with different scenarios (the more
          the better) and save information about each scenario by calling
          <seealso marker="#save_scenario/0">save_scenario/0</seealso>.
          It may be hard to know when the applications are at an (for
          <c>erts_alloc_config</c>) important runtime scenario. A good
          approach may therefore be to call
          <seealso marker="#save_scenario/0">save_scenario/0</seealso>
          repeatedly, e.g. once every tenth second. Note that it is
          important that your applications reach the runtime scenarios
          that are important for <c>erts_alloc_config</c> when you are
          saving scenarios; otherwise, the configuration may perform
          bad.

      </item>
      <item>

When you have covered all scenarios, call
          <seealso marker="#make_config/1">make_config/1</seealso>
          in order to create a configuration. The configuration is
          written to a file that you have chosen. This configuration
          file can later be read by an Erlang runtime-system at
          startup. Pass the command line argument
          <seealso marker="erts:erl#args_file">-args_file FileName</seealso>
          to the <seealso marker="erts:erl">erl(1)</seealso> command.

      </item>
      <item>

The configuration produced by <c>erts_alloc_config</c> may
          need to be manually adjusted as already stated. Do not modify the
          file produced by <c>erts_alloc_config</c>; instead, put your
          modifications in another file and load this file after the
          file produced by <c>erts_alloc_config</c>. That is, put the
          <seealso marker="erts:erl#args_file">-args_file FileName</seealso>
          argument that reads your modification file later on the
          command-line than the
          <seealso marker="erts:erl#args_file">-args_file FileName</seealso>
          argument that reads the configuration file produced by
          <c>erts_alloc_config</c>. If a memory allocation parameter
          appear multiple times, the last version of will be used, i.e.,
          you can override parameters in the configuration file produced
          by <c>erts_alloc_config</c>. Doing it this way simplifies
          things when you want to rerun <c>erts_alloc_config</c>.

      </item>
    </list>
    <note>

The configuration created by <c>erts_alloc_config</c> may
        perform bad, ever horrible, for runtime scenarios that are very
        different from the ones saved when creating the
        configuration. You are, therefore, advised to rerun
        <c>erts_alloc_config</c> if the applications run when the
        configuration was made are changed, or if the load on the
        applications have changed since the configuration was made. You
        are also advised to rerun <c>erts_alloc_config</c> if the Erlang
        runtime system used is changed.

    </note>

<c>erts_alloc_config</c> saves information about runtime scenarios
      and performs computations in a server that is automatically
      started. The server register itself under the name
      <c>'__erts_alloc_config__'</c>.

  </description>
  <funcs>
    <func>
      <name>save_scenario() -> ok | {error, Error}</name>
      <fsummary>Saves information about current runtime scenario</fsummary>
      <type>
        <v>Error = term()</v>
      </type>
      <desc>

<c>save_scenario/0</c> saves information about the current
          runtime scenario. This information will later be used when
          <seealso marker="#make_config/0">make_config/0</seealso>,
          or <seealso marker="#make_config/1">make_config/1</seealso>
          is called.

The first time <c>save_scenario/0</c> is called a server
          will be started. This server will save runtime scenarios. All
          saved scenarios can be removed by calling
          <seealso marker="#make_config/0">stop/0</seealso>.

      </desc>
    </func>
    <func>
      <name>make_config() -> ok | {error, Error}</name>
      <fsummary>Creates an erts_alloc configuration</fsummary>
      <type>
        <v>Error = term()</v>
      </type>
      <desc>

This is the same as calling
          <seealso marker="#make_config/1">make_config(group_leader())</seealso>.

      </desc>
    </func>
    <func>
      <name>make_config(FileNameOrIODev) -> ok | {error, Error}</name>
      <fsummary>Creates an erts_alloc configuration</fsummary>
      <type>
        <v>FileNameOrIODev = string() | io_device()</v>
        <v>Error = term()</v>
      </type>
      <desc>

<c>make_config/1</c> uses the information previously saved by
          <seealso marker="#save_scenario/0">save_scenario/0</seealso>
          in order to produce an <c>erts_alloc</c> configuration. At
          least one scenario have had to be saved. All scenarios
          previously saved will be used when creating the
          configuration.

If <c>FileNameOrIODev</c> is a <c>string()</c>,
          <c>make_config/1</c> will use <c>FileNameOrIODev</c> as a
          filename. A file named <c>FileNameOrIODev</c> is created and
          the configuration will be written to that file. If
          <c>FileNameOrIODev</c> is an
          <seealso marker="stdlib:io">io_device()</seealso> (see the
          documentation of the module
          <seealso marker="stdlib:io">io</seealso>), the configuration
          will be written to the io device.

      </desc>
    </func>
    <func>
      <name>stop() -> ok | {error, Error}</name>
      <fsummary></fsummary>
      <type>
        <v>Error = term()</v>
      </type>
      <desc>

Stops the server that saves runtime scenarios.

      </desc>
    </func>
  </funcs>

    <title>See Also</title>

<seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>,
      <seealso marker="erts:erl">erl(1)</seealso>,
      <seealso marker="stdlib:io">io(3)</seealso>

</erlref>


text:
Given a digit string, return all possible letter combinations that the number could represent.

A mapping of digit to letters (just like on the telephone buttons) is given below.

![img](http://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Telephone-keypad2.svg/200px-Telephone-keypad2.svg.png)

```
Input:Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
```
Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.

#### 思路([代码](https://github.com/sherlockyb/LeetCode/blob/master/src/main/java/org/sherlockyb/leetcode/math/LetterCombinationOfPhoneNumber/Solution.java))

题目常规,简单的排列组合,唯一需要注意的地方就是容易忽略像"22"这种自身与自身的组合以及包含1或0时的处理。


text:
<?php

namespace Winnerpicker\Instagram\Contracts;

interface EndpointContract
{
    /**
     * Возвращает начальный URL эндпоинта.
     *
     * @return string
     */
    public function endpointUrl(): string;

    /**
     * Выполняет API-запрос для текущего эндпоинта.
     *
     * @return mixed
     */
    public function makeRequest();

    /**
     * Возвращет инстанс API-ответа.
     *
     * @return \Winnerpicker\Instagram\Contracts\Api\ApiResponseContract
     */
    public function apiResponse();
}


text: Docker MariaDB Galera 10.0 (GlusterFS)


text:
<?php

namespace Kunstmaan\AdminBundle\EventListener;

use Kunstmaan\AdminBundle\FlashMessages\FlashTypes;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\RouterInterface as Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Translation\TranslatorInterface;

/**
 * PasswordCheckListener to check if the user has to change his password.
 */
class PasswordCheckListener
{
    /**
     * @var AuthorizationCheckerInterface
     */
    private $authorizationChecker;

    /**
     * @var TokenStorageInterface
     */
    private $tokenStorage;

    /**
     * @var Router
     */
    private $router;

    /**
     * @var Session
     */
    private $session;

    /**
     * @var TranslatorInterface
     */
    private $translator;

    /**
     * @param AuthorizationCheckerInterface $authorizationChecker
     * @param TokenStorageInterface         $tokenStorage
     * @param Router                        $router
     * @param Session                       $session
     * @param TranslatorInterface           $translator
     */
    public function __construct(AuthorizationCheckerInterface $authorizationChecker, TokenStorageInterface $tokenStorage, Router $router, Session $session, TranslatorInterface $translator)
    {
        $this->authorizationChecker = $authorizationChecker;
        $this->tokenStorage = $tokenStorage;
        $this->router = $router;
        $this->session = $session;
        $this->translator = $translator;
    }

    /**
     * @param GetResponseEvent $event
     **/
    public function onKernelRequest(GetResponseEvent $event)
    {
        $url = $event->getRequest()->getRequestUri();
        if ($this->tokenStorage->getToken() && $this->isAdminRoute($url)) {
            $route = $event->getRequest()->get('_route');
            if ($this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED') && 'fos_user_change_password' !== $route) {
                $user = $this->tokenStorage->getToken()->getUser();
                if (false === $user->isPasswordChanged()) {
                    $response = new RedirectResponse($this->router->generate('fos_user_change_password'));
                    $this->session->getFlashBag()->add(
                        FlashTypes::ERROR,
                        $this->translator->trans('kuma_admin.password_check.flash.error')
                    );
                    $event->setResponse($response);
                }
            }
        }
    }

    /**
     * @param string $url
     *
     * @return bool
     */
    private function isAdminRoute($url)
    {
        preg_match('/^\/(app_(.*)\.php\/)?([a-zA-Z_-]{2,5}\/)?admin\/(.*)/', $url, $matches);

        // Check if path is part of admin area
        if (0 === count($matches)) {
            return false;
        }

        if (false !== strpos($url, '/admin/preview')) {
            return false;
        }

        return true;
    }
}


text:
layout: page
title: "Post to the Blog"
subheadline: ""
show_meta: false
teaser: ''
permalink: "/posting/"
---

##Method 1: Regular Poster

If you think you will be a regular poster here, then please follow this method as you will be able to do all of this yourself and readily access your previous posts and make new ones.

In order to post to the blog, you first need to have a github account and be added as a member of the team4405 organization by one of the administrators. Once you are added, go to [prose.io](http://prose.io/) and click "Authorize on Github." This may ask you to log in to your github account, but once you are in, you will then see a list of all you github repositories. Click on "team4405.github.io" and there you will see a list of all the posts on the blog. You can click the "New File" button to create a new post.

When you are finished writing your post, on the right hand side of the page, click "save", and then click on "Meta Data." Here you can enter some detail about your post such as who wrote it and a Title and Subtitle. If you are are ready for the world to see it, check the box that says "Published" and your post will be put on the website in a few moments.

##Method 2: Feature Article

If you are not a regular poster to the blog or are writing a feature article, please use this method.

To get your post to the blog, simply fill out the form below and we will post it for you. If the form doesn't work, please just send all of the information that the form asks you in an email to [software@team4405.com](mailto:software@team4405.com) and we will get back with you.

<form class="form-horizontal" action="http://formspree.io/software@team4405.com" method="POST">
<fieldset>

<legend>Submit a Post</legend>

  Title

  <input id="title" name="title" type="text" placeholder="Post Title" class="form-control input-md" required="">

  Teaser

  <input id="teaser" name="teaser" type="text" placeholder="Short Intro to your Post" class="form-control input-md">

  Subheadline

  <input id="subheadline" name="subheadline" type="text" placeholder="Subtitle for you Post" class="form-control input-md">

  Your Name

  <input id="author" name="author" type="text" placeholder="First Name" class="form-control input-md">

  Slelct a Category

    <select id="catagories" name="catagories" class="form-control">
      <option value="championship">Championship</option>
      <option value="event">Event</option>
      <option value="announcement">Announcement</option>
      <option value="technical">Technical</option>
    </select>

  Choose your Tags

    <select id="tags" name="tags" class="form-control" multiple="multiple">
      <option value="announcement">Announcement</option>
      <option value="district">District</option>
      <option value="championship">Championship</option>
      <option value="mechanical">Mechanical</option>
      <option value="electrical">Electrical</option>
      <option value="software">Software</option>
    </select>

  Blog Post

    <textarea class="form-control" name="post" id="post" rows="10" cols="80">post text here...</textarea>

  Do you want a header image?

      <input type="checkbox" name="header-image" id="header-image-0" value="yes">
      Yes

  Header Image Upload

    <input id="image" name="image" class="input-file" type="file">

  Header Image Caption

  <input id="image-caption" name="image-caption" type="text" placeholder="caption" class="form-control input-md">

  Caption URL

  <input id="caption-link" name="caption-link" type="text" placeholder="http://" class="form-control input-md">

    <button id="" name="" class="btn btn-success">Submit</button>

</fieldset>
<input type="hidden" name="_next" value="#" />
<input type="hidden" name="_subject" value="New Blog Post from Team4405.com!" />
</form>


text:
namespace net {
namespace {

typedef std::map<const char*, int> CountersMap;

class TestNetworkDelegateImpl : public NetworkDelegateImpl {
 public:
  TestNetworkDelegateImpl(CountersMap* layered_network_delegate_counters)
      : layered_network_delegate_counters_(layered_network_delegate_counters) {}

  ~TestNetworkDelegateImpl() override {}

  // NetworkDelegateImpl implementation:
  int OnBeforeURLRequest(URLRequest* request,
                         const CompletionCallback& callback,
                         GURL* new_url) override {
    IncrementAndCompareCounter("on_before_url_request_count");
    return OK;
  }

  int OnBeforeSendHeaders(URLRequest* request,
                          const CompletionCallback& callback,
                          HttpRequestHeaders* headers) override {
    IncrementAndCompareCounter("on_before_send_headers_count");
    return OK;
  }

  void OnBeforeSendProxyHeaders(URLRequest* request,
                                const ProxyInfo& proxy_info,
                                HttpRequestHeaders* headers) override {
    IncrementAndCompareCounter("on_before_send_proxy_headers_count");
  }

  void OnSendHeaders(URLRequest* request,
                     const HttpRequestHeaders& headers) override {
    IncrementAndCompareCounter("on_send_headers_count");
  }

  int OnHeadersReceived(
      URLRequest* request,
      const CompletionCallback& callback,
      const HttpResponseHeaders* original_response_headers,
      scoped_refptr<HttpResponseHeaders>* override_response_headers,
      GURL* allowed_unsafe_redirect_url) override {
    IncrementAndCompareCounter("on_headers_received_count");
    return OK;
  }

  void OnBeforeRedirect(URLRequest* request,
                        const GURL& new_location) override {
    IncrementAndCompareCounter("on_before_redirect_count");
  }

  void OnResponseStarted(URLRequest* request) override {
    IncrementAndCompareCounter("on_response_started_count");
  }

  void OnNetworkBytesReceived(URLRequest* request,
                              int64_t bytes_received) override {
    IncrementAndCompareCounter("on_network_bytes_received_count");
  }

  void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) override {
    IncrementAndCompareCounter("on_network_bytes_sent_count");
  }

  void OnCompleted(URLRequest* request, bool started) override {
    IncrementAndCompareCounter("on_completed_count");
  }

  void OnURLRequestDestroyed(URLRequest* request) override {
    IncrementAndCompareCounter("on_url_request_destroyed_count");
  }

  void OnPACScriptError(int line_number, const base::string16& error) override {
    IncrementAndCompareCounter("on_pac_script_error_count");
  }

  AuthRequiredResponse OnAuthRequired(URLRequest* request,
                                      const AuthChallengeInfo& auth_info,
                                      const AuthCallback& callback,
                                      AuthCredentials* credentials) override {
    IncrementAndCompareCounter("on_auth_required_count");
    return NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
  }

  bool OnCanGetCookies(const URLRequest& request,
                       const CookieList& cookie_list) override {
    IncrementAndCompareCounter("on_can_get_cookies_count");
    return false;
  }

  bool OnCanSetCookie(const URLRequest& request,
                      const std::string& cookie_line,
                      CookieOptions* options) override {
    IncrementAndCompareCounter("on_can_set_cookie_count");
    return false;
  }

  bool OnCanAccessFile(const URLRequest& request,
                       const base::FilePath& path) const override {
    IncrementAndCompareCounter("on_can_access_file_count");
    return false;
  }

  bool OnCanEnablePrivacyMode(
      const GURL& url,
      const GURL& first_party_for_cookies) const override {
    IncrementAndCompareCounter("on_can_enable_privacy_mode_count");
    return false;
  }

  bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
      const URLRequest& request,
      const GURL& target_url,
      const GURL& referrer_url) const override {
    IncrementAndCompareCounter(
        "on_cancel_url_request_with_policy_violating_referrer_header_count");
    return false;
  }

 private:
  void IncrementAndCompareCounter(const char* counter_name) const {
    ++counters_[counter_name];
    EXPECT_EQ((*layered_network_delegate_counters_)[counter_name],
              counters_[counter_name]);
  }

  mutable CountersMap counters_;
  mutable CountersMap* layered_network_delegate_counters_;

  DISALLOW_COPY_AND_ASSIGN(TestNetworkDelegateImpl);
};

class TestLayeredNetworkDelegate : public LayeredNetworkDelegate {
 public:
  TestLayeredNetworkDelegate(scoped_ptr<NetworkDelegate> network_delegate,
                             CountersMap* counters)
      : LayeredNetworkDelegate(std::move(network_delegate)),
        context_(true),
        counters_(counters) {
    context_.Init();
  }

  ~TestLayeredNetworkDelegate() override {}

  void CallAndVerify() {
    scoped_refptr<AuthChallengeInfo> auth_challenge(new AuthChallengeInfo());
    scoped_ptr<URLRequest> request =
        context_.CreateRequest(GURL(), IDLE, &delegate_);
    scoped_ptr<HttpRequestHeaders> request_headers(new HttpRequestHeaders());
    scoped_refptr<HttpResponseHeaders> response_headers(
        new HttpResponseHeaders(""));
    TestCompletionCallback completion_callback;

    EXPECT_EQ(OK, OnBeforeURLRequest(request.get(),
                                     completion_callback.callback(), NULL));
    EXPECT_EQ(OK, OnBeforeSendHeaders(NULL, completion_callback.callback(),
                                      request_headers.get()));
    OnBeforeSendProxyHeaders(NULL, ProxyInfo(), request_headers.get());
    OnSendHeaders(NULL, *request_headers);
    OnNetworkBytesSent(request.get(), 42);
    EXPECT_EQ(OK, OnHeadersReceived(NULL, completion_callback.callback(),
                                    response_headers.get(), NULL, NULL));
    OnResponseStarted(request.get());
    OnNetworkBytesReceived(request.get(), 42);
    OnCompleted(request.get(), false);
    OnURLRequestDestroyed(request.get());
    OnPACScriptError(0, base::string16());
    EXPECT_EQ(
        NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION,
        OnAuthRequired(request.get(), *auth_challenge, AuthCallback(), NULL));
    EXPECT_FALSE(OnCanGetCookies(*request, CookieList()));
    EXPECT_FALSE(OnCanSetCookie(*request, std::string(), NULL));
    EXPECT_FALSE(OnCanAccessFile(*request, base::FilePath()));
    EXPECT_FALSE(OnCanEnablePrivacyMode(GURL(), GURL()));
    EXPECT_FALSE(OnCancelURLRequestWithPolicyViolatingReferrerHeader(
        *request, GURL(), GURL()));
  }

 protected:
  void OnBeforeURLRequestInternal(URLRequest* request,
                                  const CompletionCallback& callback,
                                  GURL* new_url) override {
    ++(*counters_)["on_before_url_request_count"];
    EXPECT_EQ(1, (*counters_)["on_before_url_request_count"]);
  }

  void OnBeforeSendHeadersInternal(URLRequest* request,
                                   const CompletionCallback& callback,
                                   HttpRequestHeaders* headers) override {
    ++(*counters_)["on_before_send_headers_count"];
    EXPECT_EQ(1, (*counters_)["on_before_send_headers_count"]);
  }

  void OnBeforeSendProxyHeadersInternal(URLRequest* request,
                                        const ProxyInfo& proxy_info,
                                        HttpRequestHeaders* headers) override {
    ++(*counters_)["on_before_send_proxy_headers_count"];
    EXPECT_EQ(1, (*counters_)["on_before_send_proxy_headers_count"]);
  }

  void OnSendHeadersInternal(URLRequest* request,
                             const HttpRequestHeaders& headers) override {
    ++(*counters_)["on_send_headers_count"];
    EXPECT_EQ(1, (*counters_)["on_send_headers_count"]);
  }

  void OnHeadersReceivedInternal(
      URLRequest* request,
      const CompletionCallback& callback,
      const HttpResponseHeaders* original_response_headers,
      scoped_refptr<HttpResponseHeaders>* override_response_headers,
      GURL* allowed_unsafe_redirect_url) override {
    ++(*counters_)["on_headers_received_count"];
    EXPECT_EQ(1, (*counters_)["on_headers_received_count"]);
  }

  void OnBeforeRedirectInternal(URLRequest* request,
                                const GURL& new_location) override {
    ++(*counters_)["on_before_redirect_count"];
    EXPECT_EQ(1, (*counters_)["on_before_redirect_count"]);
  }

  void OnResponseStartedInternal(URLRequest* request) override {
    ++(*counters_)["on_response_started_count"];
    EXPECT_EQ(1, (*counters_)["on_response_started_count"]);
  }

  void OnNetworkBytesReceivedInternal(URLRequest* request,
                                      int64_t bytes_received) override {
    ++(*counters_)["on_network_bytes_received_count"];
    EXPECT_EQ(1, (*counters_)["on_network_bytes_received_count"]);
  }

  void OnNetworkBytesSentInternal(URLRequest* request,
                                  int64_t bytes_sent) override {
    ++(*counters_)["on_network_bytes_sent_count"];
    EXPECT_EQ(1, (*counters_)["on_network_bytes_sent_count"]);
  }

  void OnCompletedInternal(URLRequest* request, bool started) override {
    ++(*counters_)["on_completed_count"];
    EXPECT_EQ(1, (*counters_)["on_completed_count"]);
  }

  void OnURLRequestDestroyedInternal(URLRequest* request) override {
    ++(*counters_)["on_url_request_destroyed_count"];
    EXPECT_EQ(1, (*counters_)["on_url_request_destroyed_count"]);
  }

  void OnPACScriptErrorInternal(int line_number,
                                const base::string16& error) override {
    ++(*counters_)["on_pac_script_error_count"];
    EXPECT_EQ(1, (*counters_)["on_pac_script_error_count"]);
  }

  void OnAuthRequiredInternal(URLRequest* request,
                              const AuthChallengeInfo& auth_info,
                              const AuthCallback& callback,
                              AuthCredentials* credentials) override {
    ++(*counters_)["on_auth_required_count"];
    EXPECT_EQ(1, (*counters_)["on_auth_required_count"]);
  }

  void OnCanGetCookiesInternal(const URLRequest& request,
                               const CookieList& cookie_list) override {
    ++(*counters_)["on_can_get_cookies_count"];
    EXPECT_EQ(1, (*counters_)["on_can_get_cookies_count"]);
  }

  void OnCanSetCookieInternal(const URLRequest& request,
                              const std::string& cookie_line,
                              CookieOptions* options) override {
    ++(*counters_)["on_can_set_cookie_count"];
    EXPECT_EQ(1, (*counters_)["on_can_set_cookie_count"]);
  }

  void OnCanAccessFileInternal(const URLRequest& request,
                               const base::FilePath& path) const override {
    ++(*counters_)["on_can_access_file_count"];
    EXPECT_EQ(1, (*counters_)["on_can_access_file_count"]);
  }

  void OnCanEnablePrivacyModeInternal(
      const GURL& url,
      const GURL& first_party_for_cookies) const override {
    ++(*counters_)["on_can_enable_privacy_mode_count"];
    EXPECT_EQ(1, (*counters_)["on_can_enable_privacy_mode_count"]);
  }

  void OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal(
      const URLRequest& request,
      const GURL& target_url,
      const GURL& referrer_url) const override {
    ++(*counters_)
        ["on_cancel_url_request_with_policy_"
         "violating_referrer_header_count"];
    EXPECT_EQ(1, (*counters_)
                     ["on_cancel_url_request_with_policy_"
                      "violating_referrer_header_count"]);
  }

 private:
  TestURLRequestContext context_;
  TestDelegate delegate_;
  mutable CountersMap* counters_;

  DISALLOW_COPY_AND_ASSIGN(TestLayeredNetworkDelegate);
};

}  // namespace

class LayeredNetworkDelegateTest : public testing::Test {
 public:
  LayeredNetworkDelegateTest() {
    scoped_ptr<TestNetworkDelegateImpl> test_network_delegate(
        new TestNetworkDelegateImpl(&layered_network_delegate_counters));
    test_network_delegate_ = test_network_delegate.get();
    layered_network_delegate_ = scoped_ptr<TestLayeredNetworkDelegate>(
        new TestLayeredNetworkDelegate(std::move(test_network_delegate),
                                       &layered_network_delegate_counters));
  }

  CountersMap layered_network_delegate_counters;
  TestNetworkDelegateImpl* test_network_delegate_;
  scoped_ptr<TestLayeredNetworkDelegate> layered_network_delegate_;
};

TEST_F(LayeredNetworkDelegateTest, VerifyLayeredNetworkDelegateInternal) {
  layered_network_delegate_->CallAndVerify();
}

}  // namespace net


text:
These are the supporting libraries that are required for the sensorgate python script.

Install the latest versions of these modules:

* pyserial-2.5
* simplejson-2.6.1
* XBee-2.1.0
 * originally from google code: https://code.google.com/p/python-xbee/
 * also on github at: https://github.com/TinajaLabs/python-xbee


text: from pyface.i_python_shell import *


text:
A simple react hamburger push menu

To run example on your local machine

```
  git clone https://github.com/kadharmfn/react-simple-hamburger.git
```
  and navigate to
  react-simple-hamburger

 ```
  npm install
  npm start
  ```

 now check your localhost:8080


text:
import { OrmMetadata } from '../orm-metadata';

export function endpoint(entityEndpoint) {
  return function (target) {
    OrmMetadata.forTarget(target).put('endpoint', entityEndpoint);
  };
}