text:
namespace YanZhiwei.DotNet2.Utilities.WinForm.Core
{
    using System;

    /// <summary>
    /// 彩色控制台输出
    /// </summary>
    /// 时间:2016/9/2 17:27
    /// 备注:
    public class ColorConsole
    {
        #region Methods

        /// <summary>
        /// 写入一行错误信息【红色】
        /// </summary>
        /// <param name="text">文本</param>
        /// 时间:2016/9/2 17:29
        /// 备注:
        public static void WriteError(string text)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(text);
            Console.ResetColor();
        }

        /// <summary>
        /// 写入一行信息【绿色】
        /// </summary>
        /// <param name="text">文本</param>
        /// 时间:2016/9/2 17:29
        /// 备注:
        public static void WriteInfo(string text)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(text);
            Console.ResetColor();
        }

        /// <summary>
        /// 写入一行
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="color">文本颜色</param>
        /// 时间:2016/9/2 17:28
        /// 备注:
        public static void WriteLine(string text, ConsoleColor color)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = color;
            Console.WriteLine(text);
            Console.ResetColor();
        }

        /// <summary>
        /// 写入一行警告信息【红色】
        /// </summary>
        /// <param name="text">文本</param>
        /// 时间:2016/9/2 17:30
        /// 备注:
        public static void WriteWarn(string text)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(text);
            Console.ResetColor();
        }

        #endregion Methods
    }
}


text:
![Logo](https://www.kokoro-ko.de/uploads/default/original/1X/c425edbe738ac1f92e584cfb94305d1570042f45.png)

# discourse-kokoro-box

This plugin for Discourse uses the discourse-api to decorate the cooked-posts. Primary usage is for properly embedding Anime- and Manga-Links in Discourse posts and parsing them into better looking iframes. Using these base attributes (Caution: Some attributes might not be filled for every site-type):

#### Anime:
- Episodes
- Status
- Rating
- Release

#### Manga:
- Volumes
- Chapters
- Status
- Release
- Rating

#### Supported sites:
- [Myanimelist.net](https://myanimelist.net/) for Anime, Manga
- [AnimeNewsNetwork](http://www.animenewsnetwork.com/) for Anime, Manga

## Installation

Add the plugin's repository URL to your container's `app.yml` file, for example:

```yml
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/Machigatta/discourse-kokoro-box.git
```

Rebuild the container:

```sh
cd /var/discourse
./launcher rebuild app
```

## License

[MIT License](LICENSE).

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/fragment_map_search"
        android:title="@string/search"
        android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
        app:showAsAction="always"/>

    <item
        android:id="@+id/fragment_map_undo"
        android:title="@string/undo"
        android:icon="@drawable/ic_action_undo"
        app:showAsAction="always"/>

    <item
        android:id="@+id/fragment_map_clear"
        android:title="@string/clear"
        app:showAsAction="never"/>

    <item
        android:id="@+id/fragment_map_help"
        android:title="@string/help"
        app:showAsAction="never"/>
</menu>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using BootstrapMvcSample.Controllers;
using NavigationRoutes;

namespace BootstrapMvcSample
{
    public class ExampleLayoutsRouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapNavigationRoute<HomeController>("Automatic Scaffolding", c => c.Index());

            routes.MapNavigationRoute<ExampleLayoutsController>("Example Layouts", c => c.Starter())
                  .AddChildRoute<ExampleLayoutsController>("Marketing", c => c.Marketing())
                  .AddChildRoute<ExampleLayoutsController>("Fluid", c => c.Fluid())
                  .AddChildRoute<ExampleLayoutsController>("Sign In", c => c.SignIn())
                ;
        }
    }
}


text:
#include "config.h"
#include "DocumentFragment.h"

#include "Document.h"
#include "HTMLDocumentParser.h"
#include "NewXMLDocumentParser.h"
#include "Page.h"
#include "Settings.h"
#include "XMLDocumentParser.h"

namespace WebCore {

DocumentFragment::DocumentFragment(Document* document, ConstructionType constructionType)
    : ContainerNode(document, constructionType)
{
    ASSERT(document);
}

PassRefPtr<DocumentFragment> DocumentFragment::create(Document* document)
{
    return adoptRef(new DocumentFragment(document));
}

String DocumentFragment::nodeName() const
{
    return "#document-fragment";
}

Node::NodeType DocumentFragment::nodeType() const
{
    return DOCUMENT_FRAGMENT_NODE;
}

bool DocumentFragment::childTypeAllowed(NodeType type) const
{
    switch (type) {
        case ELEMENT_NODE:
        case PROCESSING_INSTRUCTION_NODE:
        case COMMENT_NODE:
        case TEXT_NODE:
        case CDATA_SECTION_NODE:
        case ENTITY_REFERENCE_NODE:
            return true;
        default:
            return false;
    }
}

PassRefPtr<Node> DocumentFragment::cloneNode(bool deep)
{
    RefPtr<DocumentFragment> clone = create(document());
    if (deep)
        cloneChildNodes(clone.get());
    return clone.release();
}

void DocumentFragment::parseHTML(const String& source, Element* contextElement, FragmentScriptingPermission scriptingPermission)
{
    HTMLDocumentParser::parseDocumentFragment(source, this, contextElement, scriptingPermission);
}

bool DocumentFragment::parseXML(const String& source, Element* contextElement, FragmentScriptingPermission scriptingPermission)
{
#if ENABLE(NEW_XML)
    return NewXMLDocumentParser::parseDocumentFragment(source, this, contextElement, scriptingPermission);
#else
    return XMLDocumentParser::parseDocumentFragment(source, this, contextElement, scriptingPermission);
#endif
}

}


text:
title: "Réunion de vision de GT Location"
date:  2016-03-07 16:54
layout: post
category: ["vidéo"]
tags: ["GT Location", "Michel Sarrat", "Christophe Le Buhan"]
embed_youtube: jaUkSx8EKTs
illustration: /images/jaUkSx8EKTs.jpg
---

Compte rendu vidéo de 5 minutes de la réunion de vision de GT Location du 15 février 2014.


text:
const mongoose = require('mongoose');
const request = require('request');
const Movie = require('./movies');

const CharacterSchema = new mongoose.Schema({
	name: String,
	movie: [String]
})

module.exports = mongoose.model('Character', CharacterSchema);


text:
package com.intellij.psi;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.PackageDirectoryCache;
import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.psi.impl.file.PsiPackageImpl;
import com.intellij.psi.search.EverythingGlobalScope;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.NonClasspathDirectoriesScope;
import com.intellij.util.ArrayUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.messages.MessageBusConnection;
import consulo.java.module.extension.JavaModuleExtension;
import consulo.psi.PsiPackageManager;

/**
 * @author peter
 */
public abstract class NonClasspathClassFinder extends PsiElementFinder
{
	private static final EverythingGlobalScope ALL_SCOPE = new EverythingGlobalScope();
	protected final Project myProject;
	private volatile PackageDirectoryCache myCache;
	private final PsiManager myManager;
	private final String[] myFileExtensions;
	private PsiPackageManager myPackageManager;

	public NonClasspathClassFinder(@Nonnull Project project, @Nonnull String... fileExtensions)
	{
		myProject = project;
		myPackageManager = PsiPackageManager.getInstance(myProject);
		myManager = PsiManager.getInstance(myProject);
		myFileExtensions = ArrayUtil.append(fileExtensions, "class");
		final MessageBusConnection connection = project.getMessageBus().connect(project);
		connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener()
		{
			@Override
			public void after(@Nonnull List<? extends VFileEvent> events)
			{
				clearCache();
			}
		});
		LowMemoryWatcher.register(this::clearCache, project);
	}

	@Nonnull
	protected PackageDirectoryCache getCache(@Nullable GlobalSearchScope scope)
	{
		PackageDirectoryCache cache = myCache;
		if(cache == null)
		{
			myCache = cache = createCache(calcClassRoots());
		}
		return cache;
	}

	@Nonnull
	protected static PackageDirectoryCache createCache(@Nonnull final List<VirtualFile> roots)
	{
		final MultiMap<String, VirtualFile> map = MultiMap.create();
		map.putValues("", roots);
		return new PackageDirectoryCache(map);
	}

	public void clearCache()
	{
		myCache = null;
	}

	protected List<VirtualFile> getClassRoots(@Nullable GlobalSearchScope scope)
	{
		return getCache(scope).getDirectoriesByPackageName("");
	}

	public List<VirtualFile> getClassRoots()
	{
		return getClassRoots(ALL_SCOPE);
	}

	@Override
	public PsiClass findClass(@Nonnull final String qualifiedName, @Nonnull GlobalSearchScope scope)
	{
		final Ref<PsiClass> result = Ref.create();
		processDirectories(StringUtil.getPackageName(qualifiedName), scope, dir ->
		{
			VirtualFile virtualFile = findChild(dir, StringUtil.getShortName(qualifiedName), myFileExtensions);
			final PsiFile file = virtualFile == null ? null : myManager.findFile(virtualFile);
			if(file instanceof PsiClassOwner)
			{
				final PsiClass[] classes = ((PsiClassOwner) file).getClasses();
				if(classes.length == 1)
				{
					result.set(classes[0]);
					return false;
				}
			}
			return true;
		});
		return result.get();
	}

	protected abstract List<VirtualFile> calcClassRoots();

	@Nonnull
	@Override
	public PsiClass[] getClasses(@Nonnull PsiJavaPackage psiPackage, @Nonnull GlobalSearchScope scope)
	{
		final List<PsiClass> result = ContainerUtil.newArrayList();
		processDirectories(psiPackage.getQualifiedName(), scope, dir ->
		{
			for(final VirtualFile file : dir.getChildren())
			{
				if(!file.isDirectory() && ArrayUtil.contains(file.getExtension(), myFileExtensions))
				{
					final PsiFile psi = myManager.findFile(file);
					if(psi instanceof PsiClassOwner)
					{
						ContainerUtil.addAll(result, ((PsiClassOwner) psi).getClasses());
					}
				}
			}
			return true;
		});
		return result.toArray(new PsiClass[result.size()]);
	}

	@Nonnull
	@Override
	public Set<String> getClassNames(@Nonnull PsiJavaPackage psiPackage, @Nonnull GlobalSearchScope scope)
	{
		final Set<String> result = new HashSet<>();
		processDirectories(psiPackage.getQualifiedName(), scope, dir ->
		{
			for(final VirtualFile file : dir.getChildren())
			{
				if(!file.isDirectory() && ArrayUtil.contains(file.getExtension(), myFileExtensions))
				{
					result.add(file.getNameWithoutExtension());
				}
			}
			return true;
		});
		return result;
	}

	@Override
	public PsiJavaPackage findPackage(@Nonnull String qualifiedName)
	{
		final CommonProcessors.FindFirstProcessor<VirtualFile> processor = new CommonProcessors.FindFirstProcessor<>();
		processDirectories(qualifiedName, ALL_SCOPE, processor);
		return processor.getFoundValue() != null ? createPackage(qualifiedName) : null;
	}

	private PsiPackageImpl createPackage(String qualifiedName)
	{
		return new PsiPackageImpl(myManager, myPackageManager, JavaModuleExtension.class, qualifiedName);
	}

	@Override
	public boolean processPackageDirectories(@Nonnull final PsiJavaPackage psiPackage, @Nonnull GlobalSearchScope scope, @Nonnull final Processor<PsiDirectory> consumer, boolean
			includeLibrarySources)
	{
		return processDirectories(psiPackage.getQualifiedName(), scope, dir ->
		{
			final PsiDirectory psiDirectory = psiPackage.getManager().findDirectory(dir);
			return psiDirectory == null || consumer.process(psiDirectory);
		});
	}

	private boolean processDirectories(@Nonnull String qualifiedName, @Nonnull final GlobalSearchScope scope, @Nonnull final Processor<VirtualFile> processor)
	{
		return ContainerUtil.process(getCache(scope).getDirectoriesByPackageName(qualifiedName), file -> !scope.contains(file) || processor.process(file));
	}

	@Nonnull
	@Override
	public PsiJavaPackage[] getSubPackages(@Nonnull PsiJavaPackage psiPackage, @Nonnull GlobalSearchScope scope)
	{
		final String pkgName = psiPackage.getQualifiedName();
		final Set<String> names = getCache(scope).getSubpackageNames(pkgName);
		if(names.isEmpty())
		{
			return super.getSubPackages(psiPackage, scope);
		}

		List<PsiJavaPackage> result = new ArrayList<>();
		for(String name : names)
		{
			result.add(createPackage(pkgName.isEmpty() ? name : pkgName + "." + name));
		}
		return result.toArray(new PsiJavaPackage[result.size()]);
	}

	@Nonnull
	@Override
	public PsiClass[] findClasses(@Nonnull String qualifiedName, @Nonnull GlobalSearchScope scope)
	{
		final PsiClass psiClass = findClass(qualifiedName, scope);
		return psiClass == null ? PsiClass.EMPTY_ARRAY : new PsiClass[]{psiClass};
	}

	@Nonnull
	public static GlobalSearchScope addNonClasspathScope(@Nonnull Project project, @Nonnull GlobalSearchScope base)
	{
		GlobalSearchScope scope = base;
		for(PsiElementFinder finder : Extensions.getExtensions(EP_NAME, project))
		{
			if(finder instanceof NonClasspathClassFinder)
			{
				scope = scope.uniteWith(NonClasspathDirectoriesScope.compose(((NonClasspathClassFinder) finder).getClassRoots()));
			}
		}
		return scope;
	}

	public PsiManager getPsiManager()
	{
		return myManager;
	}

	@Nullable
	private static VirtualFile findChild(@Nonnull VirtualFile root, @Nonnull String relPath, @Nonnull String[] extensions)
	{
		VirtualFile file = null;
		for(String extension : extensions)
		{
			file = root.findChild(relPath + '.' + extension);
			if(file != null)
			{
				break;
			}
		}
		return file;
	}
}


text:
/*
 * Support and FAQ: visit Atmel Support
 */

#include "supc.h"

/// @cond 0
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/// @endcond

    /**
     * \defgroup sam_drivers_supc_group Supply Controller (SUPC)
     *
     * Driver for the SUPC (Supply Controller). This driver provides access to the main
     * features of the Supply Controller.
     *
     * @{
     */

#if (!SAMG)
    /**
     * \brief Switch off the voltage regulator to put the device in backup mode.
     *
     * \param p_supc Pointer to a SUPC instance.
     */
    void supc_enable_backup_mode(Supc *p_supc)
{
    p_supc->SUPC_CR = SUPC_CR_KEY_PASSWD | SUPC_CR_VROFF;
    __WFE();
    __WFI();
}

/**
 * \brief Enable the internal voltage regulator.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_voltage_regulator(Supc *p_supc)
{
#if (SAM3U || SAM3XA)
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_VDDIORDYONREG));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_VDDIORDYONREG;
#else
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_ONREG));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_ONREG;
#endif
}

/**
 * \brief Disable the internal voltage regulator to supply VDDCORE with an external supply.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_voltage_regulator(Supc *p_supc)
{
#if (SAM3U || SAM3XA)
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_VDDIORDYONREG));
#else
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_ONREG));
#endif
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr;
}
#endif

/**
 * \brief Switch slow clock source selection to external 32k (Xtal or Bypass) oscillator.
 * This function disables the PLLs.
 *
 * \note Switching sclk back to 32krc is only possible by shutting down the VDDIO power supply.
 *
 * \param ul_bypass 0 for Xtal, 1 for bypass.
 */
void supc_switch_sclk_to_32kxtal(Supc *p_supc, uint32_t ul_bypass)
{
    /* Set Bypass mode if required */
    if (ul_bypass == 1) {
        p_supc->SUPC_MR |= SUPC_MR_KEY_PASSWD | SUPC_MR_OSCBYPASS;
    } else {
        p_supc->SUPC_MR &= ~(SUPC_MR_KEY_PASSWD | SUPC_MR_OSCBYPASS);
    }

    p_supc->SUPC_CR |= SUPC_CR_KEY_PASSWD | SUPC_CR_XTALSEL;
}

/**
 * \brief Enable the core brownout detector.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_brownout_detector(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BODDIS));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr;
}

/**
 * \brief Disable the core brownout detector.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_brownout_detector(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BODDIS));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_BODDIS;
}

/**
 * \brief Enable the assertion of core reset signal when a brownout detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_brownout_reset(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BODRSTEN));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_BODRSTEN;
}

/**
 * \brief Disable the assertion of core reset signal when a brownout detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_brownout_reset(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BODRSTEN));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr;
}

/**
 * \brief Set Supply monitor threshold.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param ul_threshold Supply monitor threshold (between 1.9V and 3.4V).
 */
void supc_set_monitor_threshold(Supc *p_supc, uint32_t ul_threshold)
{
    uint32_t ul_smmr = p_supc->SUPC_SMMR & (~SUPC_SMMR_SMTH_Msk);
    p_supc->SUPC_SMMR = ul_smmr | (SUPC_SMMR_SMTH_Msk & ul_threshold);
}

/**
 * \brief Set Supply monitor sampling period.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param ul_period Supply monitor sampling period.
 */
void supc_set_monitor_sampling_period(Supc *p_supc, uint32_t ul_period)
{
    uint32_t ul_smmr = p_supc->SUPC_SMMR & (~SUPC_SMMR_SMSMPL_Msk);
    p_supc->SUPC_SMMR = ul_smmr | (SUPC_SMMR_SMSMPL_Msk & ul_period);
}

/**
 * \brief Enable the assertion of the core reset signal when a supply monitor detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_monitor_reset(Supc *p_supc)
{
    p_supc->SUPC_SMMR |= SUPC_SMMR_SMRSTEN;
}

/**
 * \brief Disable the assertion of core reset signal when a supply monitor detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_monitor_reset(Supc *p_supc)
{
    p_supc->SUPC_SMMR &= ~SUPC_SMMR_SMRSTEN;
}

/**
 * \brief Enable the assertion of SUPC interrupt signal when a supply monitor detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_monitor_interrupt(Supc *p_supc)
{
    p_supc->SUPC_SMMR |= SUPC_SMMR_SMIEN;
}

/**
 * \brief Disable the assertion of SUPC interrupt signal when a supply monitor detection occurs.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_monitor_interrupt(Supc *p_supc)
{
    p_supc->SUPC_SMMR &= ~SUPC_SMMR_SMIEN;
}

#if (!(SAMG51 || SAMG53 || SAMG54))
/**
 * \brief Set system controller wake up mode.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param ul_mode Bitmask of wake up mode (please refer to datasheet for more details).
 */
void supc_set_wakeup_mode(Supc *p_supc, uint32_t ul_mode)
{
    p_supc->SUPC_WUMR = ul_mode;
}

/**
 * \brief Set system controller wake up inputs.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param ul_inputs Bitmask of wake-up inputs that can force wake up of
 * the core power supply.
 * \param ul_transition Bitmask of level transition of the wake-up inputs.
 * 1 means a high-to-low level transition forces the wake up of core power supply.
 * 0 means a low-to-high level transition forces the wake up of core power supply.
 */
void supc_set_wakeup_inputs(Supc *p_supc, uint32_t ul_inputs,
                            uint32_t ul_transition)
{
    p_supc->SUPC_WUIR = ul_inputs | ul_transition;
}
#endif

/**
 * \brief Get supply controller status.
 *
 * \param p_supc Pointer to a SUPC instance.
 *
 * \return The status of supply controller.
 */
uint32_t supc_get_status(Supc *p_supc)
{
    return p_supc->SUPC_SR;
}

#if (SAM4C || SAM4CP || SAM4CM)
/**
 * \brief Enable Backup Area Power-On Reset.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_enable_backup_power_on_reset(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BUPPOREN));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_BUPPOREN;
}

/**
 * \brief Disable Backup Area Power-On Reset.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_disable_backup_power_on_reset(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BUPPOREN));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr;
}
/**
 * \brief Get SLCD power mode.
 *
 * \param p_supc Pointer to a SUPC instance.
 *
 * \return The mode of SLCDC.
 */
enum slcdc_power_mode supc_get_slcd_power_mode(Supc *p_supc)
{
    return (enum slcdc_power_mode)(p_supc->SUPC_MR & SUPC_MR_LCDMODE_Msk);
}

/**
 * \brief Set SLCD power mode.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param mode The mode of SLCDC.
 */
void supc_set_slcd_power_mode(Supc *p_supc, enum slcdc_power_mode mode)
{
    enum slcdc_power_mode pre_mode;
    uint32_t tmp;

    pre_mode = supc_get_slcd_power_mode(p_supc);

    if ((pre_mode == SLCDC_POWER_MODE_LCDON_EXTVR) &&
            (mode == SLCDC_POWER_MODE_LCDON_INVR)) {
        return;
    } else if ((pre_mode == SLCDC_POWER_MODE_LCDON_INVR) &&
               (mode == SLCDC_POWER_MODE_LCDON_EXTVR)) {
        return;
    }
    tmp = p_supc->SUPC_MR;
    tmp &= ~SUPC_MR_LCDMODE_Msk;
    tmp |=  SUPC_MR_KEY_PASSWD | mode;
    p_supc->SUPC_MR = tmp;

    if (mode == SLCDC_POWER_MODE_LCDOFF) {
        while(supc_get_status(p_supc) & SUPC_SR_LCDS_ENABLED);
    } else {
        while(!(supc_get_status(p_supc) & SUPC_SR_LCDS_ENABLED));
    }
}

/**
 * \brief Set LCD Voltage Regulator Output.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param vol  The voltage of Regulator Output.
 */
void supc_set_slcd_vol(Supc *p_supc, uint32_t vol)
{
    uint32_t tmp= p_supc->SUPC_MR;
    tmp &= ~SUPC_MR_LCDVROUT_Msk;
    tmp |=  SUPC_MR_KEY_PASSWD |  SUPC_MR_LCDVROUT(vol);
    p_supc->SUPC_MR = tmp;

}
#endif

#if SAMG54
/**
 * \brief Set the internal voltage regulator to use factory trim value.
 *
 * \param p_supc Pointer to a SUPC instance.
 */
void supc_set_regulator_trim_factory(Supc *p_supc)
{
    uint32_t ul_mr = p_supc->SUPC_MR &
                     (~(SUPC_MR_VRVDD_Msk | SUPC_MR_VDDSEL_USER_VRVDD));
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr;
}

/**
 * \brief Set the internal voltage regulator trim value.
 *
 * \param p_supc Pointer to a SUPC instance.
 * \param value the trim value.
 *
 * \note For the trim value in 96M PLL, please read the value in flash unique identifier area.
 */
void supc_set_regulator_trim_user(Supc *p_supc, uint32_t value)
{
    uint32_t ul_mr = p_supc->SUPC_MR & (~SUPC_MR_VRVDD_Msk);
    p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_VDDSEL_USER_VRVDD
                      | SUPC_MR_VRVDD(value);
}

#endif

#if (SAMV70 || SAMV71 || SAME70 || SAMS70)
/**
 * \brief SRAM On In Backup Mode.
 *
 * \param p_supc Pointer to a SUPC instance.
 *
 */
void supc_backup_sram_on(Supc *p_supc)
{
    p_supc->SUPC_MR |= (SUPC_MR_KEY_PASSWD | SUPC_MR_BKUPRETON);
}

/**
 * \brief SRAM Off In Backup Mode.
 *
 * \param p_supc Pointer to a SUPC instance.
 *
 */
void supc_backup_sram_off(Supc *p_supc)
{
    p_supc->SUPC_MR &= (~(SUPC_MR_KEY_PASSWD | SUPC_MR_BKUPRETON));
}
#endif

//@}

/// @cond 0
/**INDENT-OFF**/
#ifdef __cplusplus
}
#endif
/**INDENT-ON**/
/// @endcond


text:
/*
 * Watchdog functions and macros.
 */
#ifndef _WATCHDOG_H_
#define _WATCHDOG_H_

#if !defined(__ASSEMBLY__)
/*
 * Reset the watchdog timer, always returns 0
 *
 * This function is here since it is shared between board_f() and board_r(),
 * and the legacy arch/<arch>/board.c code.
 */
int init_func_watchdog_reset(void);
#endif

#if defined(CONFIG_SYS_GENERIC_BOARD) && \
	(defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG))
#define INIT_FUNC_WATCHDOG_INIT	init_func_watchdog_init,
#define INIT_FUNC_WATCHDOG_RESET	init_func_watchdog_reset,
#else
#define INIT_FUNC_WATCHDOG_INIT
#define INIT_FUNC_WATCHDOG_RESET
#endif

#if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
#  error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
#endif

/*
 * Hardware watchdog
 */
#ifdef CONFIG_HW_WATCHDOG
	#if defined(__ASSEMBLY__)
		#define WATCHDOG_RESET bl hw_watchdog_reset
	#else
		extern void hw_watchdog_reset(void);

		#define WATCHDOG_RESET hw_watchdog_reset
	#endif /* __ASSEMBLY__ */
#else
	/*
	 * Maybe a software watchdog?
	 */
	#if defined(CONFIG_WATCHDOG)
		#if defined(__ASSEMBLY__)
			#define WATCHDOG_RESET bl watchdog_reset
		#else
			extern void watchdog_reset(void);

			#define WATCHDOG_RESET watchdog_reset
		#endif
	#else
		/*
		 * No hardware or software watchdog.
		 */
		#if defined(__ASSEMBLY__)
			#define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
		#else
			#define WATCHDOG_RESET() {}
		#endif /* __ASSEMBLY__ */
	#endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
#endif /* CONFIG_HW_WATCHDOG */

/*
 * Prototypes from $(CPU)/cpu.c.
 */

/* MPC 8xx */
#if (defined(CONFIG_8xx) || defined(CONFIG_MPC860)) && !defined(__ASSEMBLY__)
	void reset_8xx_watchdog(volatile immap_t *immr);
#endif

/* MPC 5xx */
#if defined(CONFIG_5xx) && !defined(__ASSEMBLY__)
	void reset_5xx_watchdog(volatile immap_t *immr);
#endif

/* MPC 5xxx */
#if defined(CONFIG_MPC5xxx) && !defined(__ASSEMBLY__)
	void reset_5xxx_watchdog(void);
#endif

/* AMCC 4xx */
#if defined(CONFIG_4xx) && !defined(__ASSEMBLY__)
	void reset_4xx_watchdog(void);
#endif

#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
	void hw_watchdog_init(void);
#endif

#if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
	void init_85xx_watchdog(void);
#endif
#endif /* _WATCHDOG_H_ */


text:
// flow-typed signature: 7599962227fef4d3bdae790a031cdfcc
// flow-typed version: <<STUB>>/eslint-config-bunchtogether_v^1.0.12/flow_v0.54.1

/**
 * This is an autogenerated libdef stub for:
 *
 *   'eslint-config-bunchtogether'
 *
 * Fill this stub out by replacing all the `any` types.
 *
 * Once filled out, we encourage you to share your work with the
 * community by sending a pull request to:
 * https://github.com/flowtype/flow-typed
 */

declare module 'eslint-config-bunchtogether' {
  declare module.exports: any;
}

/**
 * We include stubs for each file inside this npm package in case you need to
 * require those files directly. Feel free to delete any files that aren't
 * needed.
 */
declare module 'eslint-config-bunchtogether/rules/best-practices' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/browser' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/errors' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/es6' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/flowtype' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/imports' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/jsx-ally' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/mocha' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/node' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/react' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/strict' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/style' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/rules/variables' {
  declare module.exports: any;
}

declare module 'eslint-config-bunchtogether/test/test-base' {
  declare module.exports: any;
}

// Filename aliases
declare module 'eslint-config-bunchtogether/index' {
  declare module.exports: $Exports<'eslint-config-bunchtogether'>;
}
declare module 'eslint-config-bunchtogether/index.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether'>;
}
declare module 'eslint-config-bunchtogether/rules/best-practices.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/best-practices'>;
}
declare module 'eslint-config-bunchtogether/rules/browser.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/browser'>;
}
declare module 'eslint-config-bunchtogether/rules/errors.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/errors'>;
}
declare module 'eslint-config-bunchtogether/rules/es6.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/es6'>;
}
declare module 'eslint-config-bunchtogether/rules/flowtype.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/flowtype'>;
}
declare module 'eslint-config-bunchtogether/rules/imports.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/imports'>;
}
declare module 'eslint-config-bunchtogether/rules/jsx-ally.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/jsx-ally'>;
}
declare module 'eslint-config-bunchtogether/rules/mocha.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/mocha'>;
}
declare module 'eslint-config-bunchtogether/rules/node.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/node'>;
}
declare module 'eslint-config-bunchtogether/rules/react.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/react'>;
}
declare module 'eslint-config-bunchtogether/rules/strict.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/strict'>;
}
declare module 'eslint-config-bunchtogether/rules/style.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/style'>;
}
declare module 'eslint-config-bunchtogether/rules/variables.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/rules/variables'>;
}
declare module 'eslint-config-bunchtogether/test/test-base.js' {
  declare module.exports: $Exports<'eslint-config-bunchtogether/test/test-base'>;
}


text:
using System;
using Rothko.UI.Interfaces.Components;
using System.Collections.Generic;

namespace Rothko.UI.Interfaces.Services
{
	public interface IAnimationService
	{
		void Update(IAnimatable gameObject, double totalMillisecondsEllapsed);
		void Update(IEnumerable<IAnimatable> gameObjects, double totalMillisecondsEllapsed);

		int GetCurrentAnimationIDAsset(IAnimatable gameObject);
	}
}


text:
using System;
using System.IO;
using System.Collections;
using System.Reflection;
using NUnit.Framework;

namespace NUnitLite.Runner
{
    /// <summary>
    /// A version of TextUI that outputs to the console.
    /// If you use it on a device without a console like
    /// PocketPC or SmartPhone you won't see anything!
    ///
    /// Call it from your Main like this:
    ///   new ConsoleUI().Execute(args);
    /// </summary>
    public class ConsoleUI : TextUI
    {
#if NETCF_1_0
        public ConsoleUI() : base(ConsoleWriter.Out) { }
#else
        public ConsoleUI() : base(Console.Out) { }
#endif
    }

    /// <summary>
    /// A version of TextUI that writes to a file.
    ///
    /// Call it from your Main like this:
    ///   new FileUI(filePath).Execute(args);
    /// </summary>
    public class FileUI : TextUI
    {
        public FileUI(string path) : base(new StreamWriter(path)) { }
    }

    /// <summary>
    /// A version of TextUI that displays to debug.
    ///
    /// Call it from your Main like this:
    ///   new DebugUI().Execute(args);
    /// </summary>
    public class DebugUI : TextUI
    {
        public DebugUI() : base(DebugWriter.Out) { }
    }

    public class TcpUI : TextUI
    {
        public TcpUI(string hostName, int port) : base( new TcpWriter(hostName, port) ) { }

        public TcpUI(string hostName) : this(hostName, 9000) { }

        public TcpUI() : this("localhost", 9000) { }
    }

    /// <summary>
    /// TextUI is a general purpose class that runs tests and
    /// outputs to a TextWriter.
    ///
    /// Call it from your Main like this:
    ///   new TextUI(textWriter).Execute(args);
    /// </summary>
    public class TextUI
    {
        private CommandLineOptions options;
        private int reportCount = 0;

        private ArrayList assemblies = new ArrayList();

        private TextWriter writer;

        private TestRunner runner = new TestRunner();

        #region Constructors
        public TextUI(TextWriter writer)
        {
            this.writer = writer;
        }
        #endregion

        #region Public Methods
        /// <summary>
        /// Execute a test run based on the aruments passed
        /// from Main.
        /// </summary>
        /// <param name="args">An array of arguments</param>
        public void Execute(string[] args)
        {
            // NOTE: This must be directly called from the
            // test assembly in order for the mechanism to work.
            Assembly callingAssembly = Assembly.GetCallingAssembly();

            this.options = ProcessArguments( args );

            if (!options.Help && !options.Error)
            {
                if (options.Wait && !(this is ConsoleUI))
                    writer.WriteLine("Ignoring /wait option - only valid for Console");

                try
                {
                    foreach (string name in options.Parameters)
                        assemblies.Add(Assembly.Load(name));

                    if (assemblies.Count == 0)
                        assemblies.Add(callingAssembly);

                    foreach (Assembly assembly in assemblies)
                        if (options.TestCount == 0)
                            Run(assembly);
                        else
                            Run(assembly, options.Tests);
                }
                catch (TestRunnerException ex)
                {
                    writer.WriteLine(ex.Message);
                }
                catch (FileNotFoundException ex)
                {
                    writer.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    writer.WriteLine(ex.ToString());
                }
                finally
                {
                    if (options.Wait && this is ConsoleUI)
                    {
                        Console.WriteLine("Press Enter key to continue . . .");
                        Console.ReadLine();
                    }
                }
            }
        }

        public void Run(Assembly assembly)
        {
            ReportResults( runner.Run(assembly) );
        }

        public void Run(Assembly assembly, string[] tests)
        {
            ReportResults( runner.Run(assembly, tests) );
        }

        private void ReportResults( TestResult result )
        {
            ResultSummary summary = new ResultSummary(result);

            writer.WriteLine("{0} Tests : {1} Errors, {2} Failures, {3} Not Run",
                summary.TestCount, summary.ErrorCount, summary.FailureCount, summary.NotRunCount);

            if (summary.ErrorCount + summary.FailureCount > 0)
                PrintErrorReport(result);

            if (summary.NotRunCount > 0)
                PrintNotRunReport(result);
        }
        #endregion

        #region Helper Methods
        private CommandLineOptions ProcessArguments(string[] args)
        {
            this.options = new CommandLineOptions();
            options.Parse(args);

            if (!options.Nologo)
                WriteCopyright();

            if (options.Help)
                writer.Write(options.HelpText);
            else if (options.Error)
                writer.WriteLine(options.ErrorMessage);

            return options;
        }

        private void WriteCopyright()
        {
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            System.Version version = executingAssembly.GetName().Version;

#if NETCF_1_0
            writer.WriteLine("NUnitLite version {0}", version.ToString() );
            writer.WriteLine("Copyright 2007, Charlie Poole");
#else
            object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
            AssemblyProductAttribute productAttr = (AssemblyProductAttribute)objectAttrs[0];

            objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            AssemblyCopyrightAttribute copyrightAttr = (AssemblyCopyrightAttribute)objectAttrs[0];

            writer.WriteLine(String.Format("{0} version {1}", productAttr.Product, version.ToString(3)));
            writer.WriteLine(copyrightAttr.Copyright);
#endif
            writer.WriteLine();

            string clrPlatform = Type.GetType("Mono.Runtime", false) == null ? ".NET" : "Mono";
            writer.WriteLine("Runtime Environment -");
            writer.WriteLine("    OS Version: {0}", Environment.OSVersion);
            writer.WriteLine("  {0} Version: {1}", clrPlatform, Environment.Version);
            writer.WriteLine();
        }

        private void PrintErrorReport(TestResult result)
        {
            reportCount = 0;
            writer.WriteLine();
            writer.WriteLine("Errors and Failures:");
            PrintErrorResults(result);
        }

        private void PrintErrorResults(TestResult result)
        {
            if (result.Results.Count > 0)
                foreach (TestResult r in result.Results)
                    PrintErrorResults(r);
            else if (result.IsError || result.IsFailure)
            {
                writer.WriteLine();
                writer.WriteLine("{0}) {1} ({2})", ++reportCount, result.Test.Name, result.Test.FullName);
                if (options.ListProperties)
                    PrintTestProperties(result.Test);
                writer.WriteLine(result.Message);
#if !NETCF_1_0
                writer.WriteLine(result.StackTrace);
#endif
            }
        }

        private void PrintNotRunReport(TestResult result)
        {
            reportCount = 0;
            writer.WriteLine();
            writer.WriteLine("Errors and Failures:");
            PrintNotRunResults(result);
        }

        private void PrintNotRunResults(TestResult result)
        {
            if (result.Results != null)
                foreach (TestResult r in result.Results)
                    PrintNotRunResults(r);
            else if (result.ResultState == ResultState.NotRun)
            {
                writer.WriteLine();
                writer.WriteLine("{0}) {1} ({2}) : {3}", ++reportCount, result.Test.Name, result.Test.FullName, result.Message);
                if (options.ListProperties)
                    PrintTestProperties(result.Test);
            }
        }

        private void PrintTestProperties(ITest test)
        {
            foreach (DictionaryEntry entry in test.Properties)
                writer.WriteLine("  {0}: {1}", entry.Key, entry.Value);
        }
        #endregion
    }
}


text:
package net.groupbuy.service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.persistence.LockModeType;

import net.groupbuy.Page;
import net.groupbuy.Pageable;
import net.groupbuy.dao.CouponCodeDao;
import net.groupbuy.dao.MemberDao;
import net.groupbuy.entity.Coupon;
import net.groupbuy.entity.CouponCode;
import net.groupbuy.entity.Member;
import net.groupbuy.service.CouponCodeService;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

/**
 * Service - 优惠码
 *
 * @author SHOP++ Team
 * @version 3.0
 */
@Service("couponCodeServiceImpl")
public class CouponCodeServiceImpl extends BaseServiceImpl<CouponCode, Long> implements CouponCodeService {

	@Resource(name = "couponCodeDaoImpl")
	private CouponCodeDao couponCodeDao;
	@Resource(name = "memberDaoImpl")
	private MemberDao memberDao;

	@Resource(name = "couponCodeDaoImpl")
	public void setBaseDao(CouponCodeDao couponCodeDao) {
		super.setBaseDao(couponCodeDao);
	}

	@Transactional(readOnly = true)
	public boolean codeExists(String code) {
		return couponCodeDao.codeExists(code);
	}

	@Transactional(readOnly = true)
	public CouponCode findByCode(String code) {
		return couponCodeDao.findByCode(code);
	}

	public CouponCode build(Coupon coupon, Member member) {
		return couponCodeDao.build(coupon, member);
	}

	public List<CouponCode> build(Coupon coupon, Member member, Integer count) {
		return couponCodeDao.build(coupon, member, count);
	}

	public CouponCode exchange(Coupon coupon, Member member) {
		Assert.notNull(coupon);
		Assert.notNull(member);

		memberDao.lock(member, LockModeType.PESSIMISTIC_WRITE);
		member.setPoint(member.getPoint() - coupon.getPoint());
		memberDao.merge(member);

		return couponCodeDao.build(coupon, member);
	}

	@Transactional(readOnly = true)
	public Page<CouponCode> findPage(Member member, Pageable pageable) {
		return couponCodeDao.findPage(member, pageable);
	}

	@Transactional(readOnly = true)
	public Long count(Coupon coupon, Member member, Boolean hasBegun, Boolean hasExpired, Boolean isUsed) {
		return couponCodeDao.count(coupon, member, hasBegun, hasExpired, isUsed);
	}

}


text:
package opentracing_test

import (
	"testing"

	"github.com/opentracing/opentracing-go"
	"github.com/opentracing/opentracing-go/mocktracer"
	"golang.org/x/net/context"
	"google.golang.org/grpc/metadata"

	kitot "github.com/go-kit/kit/tracing/opentracing"
	"github.com/go-kit/kit/transport/grpc"
)

func TestTraceGRPCRequestRoundtrip(t *testing.T) {
	tracer := mocktracer.New()

	// Initialize the ctx with a Span to inject.
	beforeSpan := tracer.StartSpan("to_inject").(*mocktracer.MockSpan)
	defer beforeSpan.Finish()
	beforeSpan.SetBaggageItem("baggage", "check")
	beforeCtx := opentracing.ContextWithSpan(context.Background(), beforeSpan)

	var toGRPCFunc grpc.RequestFunc = kitot.ToGRPCRequest(tracer, nil)
	md := metadata.Pairs()
	// Call the RequestFunc.
	afterCtx := toGRPCFunc(beforeCtx, &md)

	// The Span should not have changed.
	afterSpan := opentracing.SpanFromContext(afterCtx)
	if beforeSpan != afterSpan {
		t.Errorf("Should not swap in a new span")
	}

	// No spans should have finished yet.
	if want, have := 0, len(tracer.FinishedSpans); want != have {
		t.Errorf("Want %v span(s), found %v", want, have)
	}

	// Use FromGRPCRequest to verify that we can join with the trace given MD.
	var fromGRPCFunc grpc.RequestFunc = kitot.FromGRPCRequest(tracer, "joined", nil)
	joinCtx := fromGRPCFunc(afterCtx, &md)
	joinedSpan := opentracing.SpanFromContext(joinCtx).(*mocktracer.MockSpan)

	if joinedSpan.SpanID == beforeSpan.SpanID {
		t.Error("SpanID should have changed", joinedSpan.SpanID, beforeSpan.SpanID)
	}

	// Check that the parent/child relationship is as expected for the joined span.
	if want, have := beforeSpan.SpanID, joinedSpan.ParentID; want != have {
		t.Errorf("Want ParentID %q, have %q", want, have)
	}
	if want, have := "joined", joinedSpan.OperationName; want != have {
		t.Errorf("Want %q, have %q", want, have)
	}
	if want, have := "check", joinedSpan.BaggageItem("baggage"); want != have {
		t.Errorf("Want %q, have %q", want, have)
	}
}


text:
title: Travel Profile v2
layout: reference

redirect_from:
  - /api-reference/travel-profile/00-profile-services.html
---

The Travel Profile service consists of a set of resources that provide travel profile functionality customized in specific ways for developers, travel suppliers, and travel management companies (TMCs).

### [Profile v2](./v2.profile-resource.html)

These web services can be used to retrieve travel profile information for a specified user, or a list of travel profile summaries.

Available to Developers, travel suppliers, and TMCs.

### [Loyalty Program v1](./v1.loyalty-program-resource.html)

This web service can be used to update loyalty information for the user as entered in Concur.

Available to Travel suppliers and TMCs.

### [Company Notification v1](./v1.notification-company-resource.html)

A subscription to a notification when any user in the Concur company changes the specified features of their Concur account or data. Currently supports notifications for the following events: Itinerary change (create or update), Travel Profile basic information change. To obtain notifications, the Concur users must grant access to their travel profile using the [Web authorization flow](/api-reference/authentication/authorization-pre-2017.html).

Available to Travel suppliers.

### [User Notification v1](./v1.notification-user-resource.html)

A subscription to a notification when the Concur user changes the specified features of their Concur account or data. Currently supports notifications for the following events: Itinerary change (create or update), or Travel Profile basic information change. This functionality is restricted to Travel Suppliers or TMCs (Travel Management Companies) who have registered with Concur. To obtain notifications, the Concur users must grant access to their travel profile using the [Web authorization flow](/api-reference/authentication/authorization-pre-2017.html).

Available to Travel suppliers.

##  Configuration

The developer should email [ConcurConnectTech@concur.com](mailto:ConcurConnectTech@concur.com) and ask to be registered as a supplier. The Travel Profile API verifies that the request is coming from a registered supplier before allowing access to the full information.

Travel supplier or TMC partner applications must complete the [Concur application review process](/manage-apps/app-certification.html) before they can access production user data. Suppliers can only update Loyalty Program information for the programs that they manage. TMCs can access all the user's Travel Profile data, regardless of vendor.


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;

namespace FCS_Lit_Manager
{
    public partial class FormSidebar : Form
    {
        LitManager _lm;
        public string _folderPath = "";
        bool _isTagLoading = false;
        string _tagtoEdit = "";

        public FormSidebar()
        {
            InitializeComponent();

            try
            {
                dgvFiles.Sort(dgvFiles.Columns[1], ListSortDirection.Ascending);
                _lm = new LitManager();
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while loading...");
            }
        }

        private void setTspStsLblTxt(string text)
        {
            ((FCS_Lit_Manager.Form1)this.SplitContainer2.FindForm()).setTspStsLblTxt(text);
        }

        private void FormSidebar_Load(object sender, EventArgs e)
        {

        }

        public Control getNewFolderPage()
        {
            return this.SplitContainer2;
        }

        //--FOLDER n FILES....................................................................................
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            try
            {
                Boolean isFolderExist = false;

                if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    _folderPath = folderBrowserDialog1.SelectedPath;

                    string[] curFolders = FCS_Lit_Manager.Properties.Settings.Default.LastFolder.Split(',');

                    for(int x=0; x< curFolders.Length;x++)
                    {
                        if(curFolders[x]==_folderPath)
                        {
                            isFolderExist = true;
                        }
                    }

                    if (!isFolderExist)
                    {
                        FCS_Lit_Manager.Properties.Settings.Default.LastFolder = FCS_Lit_Manager.Properties.Settings.Default.LastFolder + "," + _folderPath;
                        FCS_Lit_Manager.Properties.Settings.Default.Save();

                        LoadFolder();
                    }
                    else
                    {
                        setTspStsLblTxt("Folder is already opened.");
                    }
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while loading files...");
            }
        }

        public void LoadFolder()
        {

            if (_folderPath != "init" || _folderPath != "")
            {
                string[] folder = _folderPath.Split('\\');
                txtFolder.Text = folder[folder.Length - 1];
                toolTipFolder.SetToolTip(txtFolder, _folderPath);

                _isTagLoading = true;
                _lm.loadFolder(_folderPath, dgvFiles, lstAllTags);
                _isTagLoading = false;

                ((FCS_Lit_Manager.Form1)this.SplitContainer2.FindForm()).updateTabPageOnBrowse(_folderPath);
            }
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            _isTagLoading = true;
            _lm.loadFolder(_folderPath, dgvFiles, lstAllTags);
            _isTagLoading = false;
        }

        //SET / UNSET TAG TO FILE----------------------------------
        private void btnSetTag_Click(object sender, EventArgs e)
        {
            try
            {
                string tag = "";

                if (lstAllTags.SelectedItems.Count > 0)
                {
                    tag = lstAllTags.SelectedItems[0].Text;
                }
                else
                {
                    setTspStsLblTxt("Select tag to set...");
                    return;
                }

                //--------------
                if (_lm.setTag(tag, dgvFiles.SelectedRows[0].Cells[1].Value.ToString()))
                {
                    dgvFiles.SelectedRows[0].Cells[2].Value = _lm.loadTagsOfFile(dgvFiles.SelectedRows[0].Cells[1].Value.ToString());
                    setTspStsLblTxt("Tag was set successfully...");
                }
                else
                {
                    setTspStsLblTxt("Error while setting tag...");
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while trying setting tag...");
            }
        }

        private void btnUnsetTag_Click(object sender, EventArgs e)
        {
            try
            {
                string tag = "";

                if (lstAllTags.SelectedItems.Count > 0)
                {
                    tag = lstAllTags.SelectedItems[0].Text;
                }
                else
                {
                    setTspStsLblTxt("Select tag to un-set...");
                    return;
                }

                //----------------------
                if (_lm.unsetTag(tag, dgvFiles.SelectedRows[0].Cells[1].Value.ToString()))
                {
                    dgvFiles.SelectedRows[0].Cells[2].Value = _lm.loadTagsOfFile(dgvFiles.SelectedRows[0].Cells[1].Value.ToString());
                    setTspStsLblTxt("Tag was unset successfully...");
                }
                else
                {
                    setTspStsLblTxt("Error while unsetting the tag...");
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while trying unsetting tag...");
            }
        }

        //CHANGE AND / OR OPERATOR---------------------------------------
        private void rdoAndOr_CheckedChanged(object sender, EventArgs e)
        {
            if (lstAllTags.CheckedItems.Count > 0)
            { loadFiles(); }
        }

        //LOADING------------------
        private void loadFiles()
        {
            setTspStsLblTxt("Loading...");

            int selectedRowIndex = 0;
            string selectedRowFileName = "";
            DataGridViewColumn sortCol = dgvFiles.SortedColumn;
            ListSortDirection sortDirection = ListSortDirection.Ascending;

            if (dgvFiles.SelectedRows.Count > 0)
            {
                selectedRowIndex = dgvFiles.SelectedRows[0].Index;
                selectedRowFileName = dgvFiles.SelectedRows[0].Cells[1].Value.ToString();
                sortCol = dgvFiles.SortedColumn;

                if (dgvFiles.SortOrder == System.Windows.Forms.SortOrder.Ascending)
                {
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    sortDirection = ListSortDirection.Descending;
                }
            }

            dgvFiles.Rows.Clear();

            if (lstAllTags.CheckedItems.Count == 0)
            {
                _lm.loadAllFiles(dgvFiles);
            }
            else
            {
                string[] tags = new string[lstAllTags.CheckedItems.Count];

                int count = 0;
                foreach (ListViewItem item in lstAllTags.CheckedItems)
                { tags[count] = item.Text; count++; }

                string mode = "";
                if (rdoAnd.Checked) { mode = "AND"; } else { mode = "OR"; }

                _lm.loadFilteredFiles(dgvFiles, tags, mode);
            }

            _lm.loadTagsOfFiles(dgvFiles);

            //----------------------------
            dgvFiles.Sort(sortCol, sortDirection);

            //Find the selected row
            for (int x = 0; x < dgvFiles.Rows.Count; x++)
            {
                if (dgvFiles.Rows[x].Cells[1].Value.ToString() == selectedRowFileName)
                {
                    selectedRowIndex = x;
                    break;
                }
            }

            if (dgvFiles.Rows.Count > 0)
            {
                dgvFiles[0, selectedRowIndex].Selected = true;
                dgvFiles.FirstDisplayedScrollingRowIndex = selectedRowIndex;
            }

            setTspStsLblTxt("Loaded.");
        }

        //OPEN FILE FOR READ-----------------------------------------
        private void dgvFiles_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                setTspStsLblTxt("Loading....");

                if (e.RowIndex < 0)
                {
                    return;
                }

                //--------------------------------------------------------
                if (dgvFiles["File", e.RowIndex].Value.ToString() != "")
                {

                    string path = _folderPath + "\\" + dgvFiles["File", e.RowIndex].Value.ToString();
                    ((FCS_Lit_Manager.Form1)this.SplitContainer2.FindForm()).OpenPDF(path);

                    setTspStsLblTxt("File loaded succcessfully...");
                }

                if (((DataGridView)sender).Columns[e.ColumnIndex] is DataGridViewButtonColumn)
                {
                    System.Diagnostics.Process.Start(@_folderPath + "\\" + dgvFiles["File", e.RowIndex].Value.ToString());

                    setTspStsLblTxt("File opened succcessfully...");
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while loading the file...");
            }
        }

        //SERCH FOR FILE-------------------------------------------
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            if (txtSearch.Text.Trim() == "")
            {
                dgvFiles.Rows.OfType<DataGridViewRow>().ToList().ForEach(row => { row.Visible = true; });
                return;
            }

            for (int x = 0; x < dgvFiles.Rows.Count; x++)
            {
                if (dgvFiles.Rows[x].Cells[1].Value.ToString().ToUpper().Contains(txtSearch.Text.Trim().ToUpper()))
                {
                    dgvFiles.Rows[x].Visible = true;
                }
                else
                {
                    dgvFiles.Rows[x].Visible = false;
                }
            }
        }

        //--TAGS...................................................................................................
        private void btnAddTag_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtAddTag.Text.Trim() == "")
                {
                    setTspStsLblTxt("Enter tag to add...");
                    return;
                }

                ListViewItem item = lstAllTags.FindItemWithText(txtAddTag.Text.Trim());

                if (item != null && lstAllTags.Items.Contains(item))
                {
                    setTspStsLblTxt("Tag already exists...");
                    return;
                }

                //-----------------------------
                if (_lm.saveTag(txtAddTag.Text.Trim()))
                {
                    lstAllTags.Items.Add(txtAddTag.Text);
                    setTspStsLblTxt("Tag is added...");
                    txtAddTag.Text = "";
                }
                else
                {
                    setTspStsLblTxt("Error while adding tag...");
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while adding tag...");
            }
        }

        private void btnRemoveTag_Click(object sender, EventArgs e)
        {
            try
            {
                if (lstAllTags.SelectedItems.Count > 0)
                {
                    if (_lm.deleteTag(lstAllTags.SelectedItems[0].Text))
                    {
                        lstAllTags.SelectedItems[0].Remove();
                        setTspStsLblTxt("Tag is removed...");
                    }
                    else
                    {
                        setTspStsLblTxt("Error while removing tag...");
                    }
                }
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while removing tag...");
            }
        }

        //CHECK TAG
        private void lstAllTags_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            if (!_isTagLoading)
            {
                loadFiles();
            }
        }

        private void lstAllTags_BeforeLabelEdit(object sender, LabelEditEventArgs e)
        {
            try
            {
                _tagtoEdit = lstAllTags.SelectedItems[0].Text.ToString();
            }
            catch (Exception er)
            {
                setTspStsLblTxt("Error while editing...");
            }
        }

        private void lstAllTags_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            try
            {
                if (_tagtoEdit == e.Label.ToString())
                {
                    return;
                }

                ListViewItem item = lstAllTags.FindItemWithText(e.Label.ToString().Trim());

                if (item != null && lstAllTags.Items.Contains(item))
                {
                    e.CancelEdit = true;
                    setTspStsLblTxt("Tag already exists...");
                    return;
                }

                if (_lm.updateTag(_tagtoEdit, e.Label.ToString().Trim()))
                {
                    setTspStsLblTxt("Updated successfully...");
                }
                else
                {
                    setTspStsLblTxt("Error while updating...");
                }
            }
            catch (Exception er)
            {
                return;
            }
        }
    }

    //==LIT MANAGER CLASS==================================================================================================
    class LitManager
    {
        string _folder = "";
        SqlConnection _con;
        SqlCommand _cmd;
        SqlDataReader _reader;

        public LitManager()
        {
            _con = new SqlConnection();
            _cmd = new SqlCommand();
        }

        //TAGS---------------------------------------------------------------------------------
        public void loadAllTags(ListView lstAllTags)
        {
            try
            {
                lstAllTags.Items.Clear();

                _con.Open();
                _cmd.CommandText = "select tagName from LitManTags order by tagName";
                _cmd.Connection = _con;

                _reader = _cmd.ExecuteReader();

                DataTable dt = new DataTable();
                dt.Load(_reader);

                foreach (DataRow row in dt.Rows)
                {
                    lstAllTags.Items.Add(row[0].ToString());
                }

                _con.Close();
            }
            catch (Exception er)
            {
                _con.Close();
            }
        }

        public bool saveTag(string tagName)
        {
            try
            {
                _con.Open();
                _cmd.CommandText = "INSERT INTO LitManTags(TagName) VALUES ('" + tagName + "')";
                _cmd.Connection = _con;
                _cmd.ExecuteNonQuery();
                _con.Close();

                return true;
            }
            catch (Exception er)
            {
                _con.Close();
                return false;
            }
        }

        public bool updateTag(string oldName, string newName)
        {
            try
            {
                _con.Open();
                _cmd.Connection = _con;

                _cmd.CommandText = "UPDATE LitManTags SET TagName = '" + newName +
                    "' WHERE (TagName = '" + oldName + "'); ";
                _cmd.ExecuteNonQuery();

                _cmd.CommandText = "UPDATE FilesTags SET TagName = '" + newName +
                    "' WHERE (TagName = '" + oldName + "'); ";
                _cmd.ExecuteNonQuery();

                _con.Close();

                return true;
            }
            catch (Exception er)
            {
                _con.Close();
                return false;
            }
        }

        public bool deleteTag(string tagName)
        {
            try
            {
                _con.Open();
                _cmd.CommandText = "delete from LitManTags where TagName='" + tagName + "'";
                _cmd.Connection = _con;
                _cmd.ExecuteNonQuery();
                _con.Close();

                return true;
            }
            catch (Exception er)
            {
                _con.Close();
                return false;
            }
        }

        //FILES---------------------------------------------------------------------------------
        public void loadFolder(string folder, DataGridView dgvFiles, ListView lstAllTags)
        {
            this._folder = folder;

            if (!File.Exists(_folder + "\\LitManDB.mdf"))
            {
                File.Copy(Application.StartupPath + "\\LitManDB.mdf", _folder + "\\LitManDB.mdf");
            }

            _con.ConnectionString = @"Data Source= (LocalDB)\MSSQLLocalDB;" +
                "AttachDbFilename=" + _folder + "\\LitManDB.mdf;" +
                "Integrated Security=True";

            loadAllFiles(dgvFiles);
            loadAllTags(lstAllTags);
            loadTagsOfFiles(dgvFiles);
        }

        public void loadAllFiles(DataGridView dgvFiles)
        {
            DirectoryInfo dinfo = new DirectoryInfo(_folder);
            FileInfo[] Files = dinfo.GetFiles("*.pdf");

            dgvFiles.Rows.Clear();

            int count = 0;
            foreach (FileInfo file in Files)
            {
                dgvFiles.Rows.Add();
                dgvFiles["File", count].Value = file.Name;
                count++;
            }
        }

        public void loadFilteredFiles(DataGridView dgvFiles, string[] tags, string mode)
        {
            try
            {
                if (mode == "OR")
                {
                    string whereClouse = "";

                    for (int x = 0; x < tags.Length; x++)
                    {
                        whereClouse += "TagName='" + tags[x] + "' " + mode + " ";
                    }

                    whereClouse = whereClouse.Substring(0, whereClouse.Length - 3);

                    _con.Open();
                    _cmd.CommandText = "select distinct FileName from FilesTags where " + whereClouse;
                    _cmd.Connection = _con;
                    _reader = _cmd.ExecuteReader();

                    int count = 0;
                    while (_reader.Read())
                    {
                        dgvFiles.Rows.Add();
                        dgvFiles["File", count].Value = _reader[0].ToString();
                        count++;
                    }
                }

                if (mode == "AND")
                {
                    _con.Open();
                    _cmd.Connection = _con;

                    var listMain = new string[tags.Length][];

                    for (int x = 0; x < tags.Length; x++)
                    {
                        _cmd.CommandText = "select distinct FileName from FilesTags where TagName='" + tags[x] + "'";

                        using (_reader = _cmd.ExecuteReader())
                        {
                            DataTable dt = new DataTable();
                            dt.Load(_reader);

                            var listSub = new string[dt.Rows.Count];
                            int rowNum = 0;

                            _reader = _cmd.ExecuteReader();
                            while (_reader.Read())
                            {
                                listSub[rowNum] = _reader[0].ToString();
                                rowNum++;
                            }

                            listMain[x] = listSub;
                        }

                        _reader.Close();
                    }

                    //GET INTERSECT
                    if (tags.Length > 1)
                    {
                        var l2Lookup = new HashSet<string>(listMain[1]);
                        var interList = listMain[0].Where(l2Lookup.Contains);

                        for (int x = 1; x < tags.Length - 1; x++)
                        {
                            l2Lookup = new HashSet<string>(listMain[x + 1]);
                            var temp = listMain[x].Where(l2Lookup.Contains);
                            interList.Union(temp);
                        }

                        int count = 0;
                        foreach (var value in interList)
                        {
                            dgvFiles.Rows.Add();
                            dgvFiles["File", count].Value = value.ToString();
                            count++;
                        }
                    }
                    else
                    {
                        for (int x = 0; x < listMain[0].Length; x++)
                        {
                            dgvFiles.Rows.Add();
                            dgvFiles["File", x].Value = listMain[0][x].ToString();
                        }
                    }
                }

                _con.Close();
            }
            catch (Exception er)
            {
                _con.Close();
            }
        }

        public void loadTagsOfFiles(DataGridView dgvFiles)
        {
            string tagList = "";

            try
            {
                if (_con.State != ConnectionState.Open) { _con.Open(); }
                _cmd.Connection = _con;

                for (int x = 0; x < dgvFiles.Rows.Count; x++)
                {
                    _cmd.CommandText = "select distinct TagName, FileName from FilesTags";
                    _reader = _cmd.ExecuteReader();

                    DataTable dt = new DataTable();
                    dt.Load(_reader);

                    IEnumerable<DataRow> productsQuery = from dtColumn in dt.AsEnumerable() select dtColumn;
                    IEnumerable<DataRow> largeProducts = productsQuery.Where(p => p.Field<string>("FileName") == dgvFiles["File", x].Value.ToString());

                    foreach (DataRow product in largeProducts)
                    {
                        tagList += product.Field<string>("TagName") + " | ";
                    }

                    dgvFiles["Tags", x].Value = tagList;
                    tagList = "";
                }

                _con.Close();
            }
            catch (Exception er)
            {
                _con.Close();
            }
        }

        public string loadTagsOfFile(string fileName)
        {
            string tagList = "";

            try
            {
                _con.Open();
                _cmd.Connection = _con;

                _cmd.CommandText = "select distinct TagName from FilesTags where FileName='" + fileName + "'";
                _reader = _cmd.ExecuteReader();

                DataTable dt = new DataTable();
                dt.Load(_reader);

                foreach (DataRow row in dt.Rows)
                {
                    tagList += row[0].ToString() + " | ";
                }

                _con.Close();
            }
            catch (Exception er)
            {
                _con.Close();
            }

            return tagList;
        }

        public bool setTag(string tagName, string fileName)
        {
            try
            {
                _con.Open();
                _cmd.CommandText = "INSERT INTO FilesTags(FileName,TagName) VALUES ('" + fileName +
                    "','" + tagName + "')";
                _cmd.Connection = _con;
                _cmd.ExecuteNonQuery();
                _con.Close();

                return true;
            }
            catch (Exception er)
            {
                _con.Close();
                return false;
            }
        }

        public bool unsetTag(string tagName, string fileName)
        {
            try
            {
                _con.Open();
                _cmd.CommandText = "delete from FilesTags where TagName='" + tagName +
                    "' AND fileName='" + fileName + "'";
                _cmd.Connection = _con;
                _cmd.ExecuteNonQuery();
                _con.Close();

                return true;
            }
            catch (Exception er)
            {
                _con.Close();
                return false;
            }
        }

    }
}


text:
"""Heat exception subclasses"""

import functools
import urlparse
import sys
from heat.openstack.common import exception

OpenstackException = exception.OpenstackException
NotFound = exception.NotFound
Error = exception.Error
InvalidContentType = exception.InvalidContentType

class RedirectException(Exception):
    def __init__(self, url):
        self.url = urlparse.urlparse(url)

class KeystoneError(Exception):
    def __init__(self, code, message):
        self.code = code
        self.message = message

    def __str__(self):
        return "Code: %s, message: %s" % (self.code, self.message)

def wrap_exception(notifier=None, publisher_id=None, event_type=None,
                   level=None):
    """This decorator wraps a method to catch any exceptions that may
    get thrown. It logs the exception as well as optionally sending
    it to the notification system.
    """
    # TODO(sandy): Find a way to import nova.notifier.api so we don't have
    # to pass it in as a parameter. Otherwise we get a cyclic import of
    # nova.notifier.api -> nova.utils -> nova.exception :(
    # TODO(johannes): Also, it would be nice to use
    # utils.save_and_reraise_exception() without an import loop
    def inner(f):
        def wrapped(*args, **kw):
            try:
                return f(*args, **kw)
            except Exception as e:
                # Save exception since it can be clobbered during processing
                # below before we can re-raise
                exc_info = sys.exc_info()

                if notifier:
                    payload = dict(args=args, exception=e)
                    payload.update(kw)

                    # Use a temp vars so we don't shadow
                    # our outer definitions.
                    temp_level = level
                    if not temp_level:
                        temp_level = notifier.ERROR

                    temp_type = event_type
                    if not temp_type:
                        # If f has multiple decorators, they must use
                        # functools.wraps to ensure the name is
                        # propagated.
                        temp_type = f.__name__

                    notifier.notify(publisher_id, temp_type, temp_level,
                                    payload)

                # re-raise original exception since it may have been clobbered
                raise exc_info[0], exc_info[1], exc_info[2]

        return functools.wraps(f)(wrapped)
    return inner

class MissingCredentialError(OpenstackException):
    message = _("Missing required credential: %(required)s")

class BadAuthStrategy(OpenstackException):
    message = _("Incorrect auth strategy, expected \"%(expected)s\" but "
                "received \"%(received)s\"")

class AuthBadRequest(OpenstackException):
    message = _("Connect error/bad request to Auth service at URL %(url)s.")

class AuthUrlNotFound(OpenstackException):
    message = _("Auth service at URL %(url)s not found.")

class AuthorizationFailure(OpenstackException):
    message = _("Authorization failed.")

class NotAuthenticated(OpenstackException):
    message = _("You are not authenticated.")

class Forbidden(OpenstackException):
    message = _("You are not authorized to complete this action.")

#NOTE(bcwaldon): here for backwards-compatability, need to deprecate.
class NotAuthorized(Forbidden):
    message = _("You are not authorized to complete this action.")

class Invalid(OpenstackException):
    message = _("Data supplied was not valid: %(reason)s")

class AuthorizationRedirect(OpenstackException):
    message = _("Redirecting to %(uri)s for authorization.")

class ClientConfigurationError(OpenstackException):
    message = _("There was an error configuring the client.")

class MultipleChoices(OpenstackException):
    message = _("The request returned a 302 Multiple Choices. This generally "
                "means that you have not included a version indicator in a "
                "request URI.\n\nThe body of response returned:\n%(body)s")

class LimitExceeded(OpenstackException):
    message = _("The request returned a 413 Request Entity Too Large. This "
                "generally means that rate limiting or a quota threshold was "
                "breached.\n\nThe response body:\n%(body)s")

    def __init__(self, *args, **kwargs):
        self.retry_after = (int(kwargs['retry']) if kwargs.get('retry')
                            else None)
        super(LimitExceeded, self).__init__(*args, **kwargs)

class ServiceUnavailable(OpenstackException):
    message = _("The request returned a 503 ServiceUnavilable. This "
                "generally occurs on service overload or other transient "
                "outage.")

    def __init__(self, *args, **kwargs):
        self.retry_after = (int(kwargs['retry']) if kwargs.get('retry')
                            else None)
        super(ServiceUnavailable, self).__init__(*args, **kwargs)

class RequestUriTooLong(OpenstackException):
    message = _("The URI was too long.")

class ServerError(OpenstackException):
    message = _("The request returned 500 Internal Server Error"
                "\n\nThe response body:\n%(body)s")

class MaxRedirectsExceeded(OpenstackException):
    message = _("Maximum redirects (%(redirects)s) was exceeded.")

class InvalidRedirect(OpenstackException):
    message = _("Received invalid HTTP redirect.")

class NoServiceEndpoint(OpenstackException):
    message = _("Response from Keystone does not contain a Heat endpoint.")

class RegionAmbiguity(OpenstackException):
    message = _("Multiple 'image' service matches for region %(region)s. This "
                "generally means that a region is required and you have not "
                "supplied one.")

class UserParameterMissing(OpenstackException):
    message = _("The Parameter (%(key)s) was not provided.")

class UnknownUserParameter(OpenstackException):
    message = _("The Parameter (%(key)s) was not defined in template.")

class InvalidTemplateAttribute(OpenstackException):
    message = _("The Referenced Attribute (%(resource)s %(key)s)"
                " is incorrect.")

class InvalidTemplateReference(OpenstackException):
    message = _("The specified reference (%(resource)s %(key)s)"
                " is incorrect.")

class UserKeyPairMissing(OpenstackException):
    message = _("The Key (%(key_name)s) could not be found.")

class FlavorMissing(OpenstackException):
    message = _("The Flavor ID (%(flavor_id)s) could not be found.")

class ImageNotFound(OpenstackException):
    message = _("The Image (%(image_name)s) could not be found.")

class NoUniqueImageFound(OpenstackException):
    message = _("Multiple images were found with name (%(image_name)s).")

class InvalidTenant(OpenstackException):
    message = _("Searching Tenant %(target)s "
                "from Tenant %(actual)s forbidden.")

class StackNotFound(OpenstackException):
    message = _("The Stack (%(stack_name)s) could not be found.")

class StackExists(OpenstackException):
    message = _("The Stack (%(stack_name)s) already exists.")

class StackValidationFailed(OpenstackException):
    message = _("%(message)s")

class ResourceNotFound(OpenstackException):
    message = _("The Resource (%(resource_name)s) could not be found "
                "in Stack %(stack_name)s.")

class ResourceTypeNotFound(OpenstackException):
    message = _("The Resource Type (%(type_name)s) could not be found.")

class ResourceNotAvailable(OpenstackException):
    message = _("The Resource (%(resource_name)s) is not available.")

class PhysicalResourceNotFound(OpenstackException):
    message = _("The Resource (%(resource_id)s) could not be found.")

class WatchRuleNotFound(OpenstackException):
    message = _("The Watch Rule (%(watch_name)s) could not be found.")

class ResourceFailure(OpenstackException):
    message = _("%(exc_type)s: %(message)s")

    def __init__(self, exception, resource, action=None):
        if isinstance(exception, ResourceFailure):
            exception = getattr(exception, 'exc', exception)
        self.exc = exception
        self.resource = resource
        self.action = action
        exc_type = type(exception).__name__
        super(ResourceFailure, self).__init__(exc_type=exc_type,
                                              message=str(exception))

class NotSupported(OpenstackException):
    message = _("%(feature)s is not supported.")

class ResourcePropertyConflict(OpenstackException):
    message = _('Cannot define the following properties at the same time: %s.')

    def __init__(self, *args):
        self.message = self.message % ", ".join(args)
        super(ResourcePropertyConflict, self).__init__()

class HTTPExceptionDisguise(Exception):
    """Disguises HTTP exceptions so they can be handled by the webob fault
    application in the wsgi pipeline.
    """

    def __init__(self, exception):
        self.exc = exception
        self.tb = sys.exc_info()[2]


text:
<?php

namespace Ddeboer\DataImport\Tests\Source;

use Ddeboer\DataImport\Source\StreamSource;

/**
 * @author Markus Bachmann <markus.bachmann@bachi.biz>
 */
class StreamSourceTest extends \PHPUnit_Framework_TestCase
{
    public function testGetFilename()
    {
        $fixture = __DIR__.'/../Fixtures/data_cr_breaks.csv';

        $source = new StreamSource($fixture);
        $this->assertEquals(new \SplFileObject($fixture), $source->getFile());
    }

    /**
     * @expectedException Ddeboer\DataImport\Exception\SourceNotFoundException
     */
    public function testInvalidFilename()
    {
        $fixture = 'notworking://test.csv';

        $source = new StreamSource($fixture);
        $source->getFile();
    }
}


text:
title: Pseudo-Classes
module: topic-10
permalink: /topic-10/pseudo-classes/
---

A **pseudo-class** can be added to an element to style it _only_ during certin conditions. Additional CSS rules can be applied to the page so that when an an event is triggered (like clicking on something), the element visually changes for users.

This is the same technology that allows browsers to alter the appearance of links when you hover over them, click them, or after you have visited them.

The pseudo-classes usually attached to links are:
- `:link` (default, an unvisited link)
- `:visited` (how the link looks after being visited)

Like pseudo-elements, pseudo-classes are appended after a CSS selector.

  CSS

```css
a:link {}
a:visited {}
```

The web was built with links, for links, on links. They are fundamental to the infrastructure of any site. If you have a large amount of links, it is considered good practice to help visitors track their progress by setting the unvisited and visited style to your links.

NOTE: You can also style links using their element selector (`a {}`), although it is more generalized than `a:link`.

### "Why would I style links?"

Links are ugly, or rather, their default styling - while functional - is not usually aesthetically-pleasing. Browser defaults don't often mesh with site designs, and most designers will style links to better fit the pallet of the site.

IMPORTANT: A word of caution, however. While default link styling isn't the most attractive, it is rooted in internet culture and user experience. Styling that is too far removed form the norm can be disorienting and unpopular, as Google found out with its "black link" experiment in 2016.

In the example below, the link should turn to gray after you visit it (it will open in a new tab/window).


text:
@interface MockVolume : NSObject

@property (copy) NSString *type;

- (NSDictionary*)properties;

@end

@implementation MockVolume

@synthesize type;

- (NSDictionary*)properties
{
    return @{VMVolumeLocal:[NSNumber numberWithBool:1],
             VMVolumeType: self.type,
             VMVolumeMountURL:[NSURL fileURLWithPath:@"/"]};
}

@end

@interface VolumeManagerTester : VolumeManager

@property (atomic, weak) NSDictionary* volumes;

- (void)iterateMountedVolumes:(void (^)(MockVolume *volume))getVolume;

@end

@implementation VolumeManagerTester

- (void)iterateMountedVolumes:(void (^)(MockVolume *))getVolume
{
    for (NSString *type in self.volumes) {
        for (int i = 0; i < [[self.volumes objectForKey:type] intValue]; i++) {
            NSLog(@"Adding %@", type);
            MockVolume *volume = [[MockVolume alloc] init];
            volume.type = type;
            getVolume(volume);
        }
    }
}

@end

@interface VolumeManagerTests : XCTestCase

@property (nonatomic, strong) NSDictionary *testVolumes;
@property (nonatomic, strong) VolumeManagerTester *manager;

@end

@implementation VolumeManagerTests

@synthesize testVolumes, manager;

- (void)setUp
{
    [super setUp];

    self.manager = [[VolumeManagerTester alloc] init];
    self.testVolumes = @{@"autofs": [NSNumber numberWithInt:3],
                         @"hfs": [NSNumber numberWithInt:1]};
    manager.volumes = self.testVolumes;

    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown
{
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testMountedVolumesForType
{
    XCTAssertEqual(3UL, [[manager mountedVolumesForType:@"autofs"] count], @"Incorrect volume count");
    for (NSDictionary *volume in [manager mountedVolumesForType:@"autofs"]) {
        XCTAssertEqual(@"autofs", [volume objectForKey:VMVolumeType], @"Incorrect volume type");
    }
    XCTAssertEqual(1UL, [[manager mountedVolumesForType:@"hfs"] count], @"Incorrect volume count");
    XCTAssertEqual(0UL, [[manager mountedVolumesForType:@"blah"] count], @"Incorrect volume count");

    NSDictionary *emptyVolumes = @{};
    manager.volumes = emptyVolumes;
    XCTAssertEqual(0UL, [[manager mountedVolumesForType:@"autofs"] count], @"Incorrect volume count");
    XCTAssertEqual(0UL, [[manager mountedVolumesForType:@"hfs"] count], @"Incorrect volume count");
}

- (void)testMountedVolumes
{
    XCTAssertEqual(4UL, [[manager mountedVolumes] count], @"Incorrect volume count");
    size_t autofs_count = 0;
    size_t hfs_count = 0;
    for (NSDictionary *volume in [manager mountedVolumes]) {
        if ([[volume objectForKey:VMVolumeType] isEqualToString:@"autofs"]) {
            autofs_count++;
        } else if ([[volume objectForKey:VMVolumeType] isEqualToString:@"hfs"]) {
            hfs_count++;
        }
    }
    XCTAssertEqual(3UL, autofs_count, @"Incorrect volume count");
    XCTAssertEqual(1UL, hfs_count, @"Incorrect volume count");

    NSDictionary *emptyVolumes = @{};
    manager.volumes = emptyVolumes;
    XCTAssertEqual(0UL, [[manager mountedVolumes] count], @"Incorrect volume count");
}

- (void)testMountedVolumesByType
{
    XCTAssertEqual(2UL, [[manager mountedVolumesByType] count], @"Incorrect type count");
    size_t autofs_count = 0;
    size_t hfs_count = 0;
    NSDictionary *volumesByType = [manager mountedVolumesByType];
    for (NSString *type in volumesByType) {
        if ([type isEqualToString:@"autofs"]) {
            autofs_count = [[volumesByType objectForKey:@"autofs"] count];
        } else if ([type isEqualToString:@"hfs"]) {
            hfs_count = [[volumesByType objectForKey:@"hfs"] count];
        }
    }
    XCTAssertEqual(3UL, autofs_count, @"Incorrect volume count");
    XCTAssertEqual(1UL, hfs_count, @"Incorrect volume count");

    NSDictionary *emptyVolumes = @{};
    manager.volumes = emptyVolumes;
    XCTAssertEqual(0UL, [[manager mountedVolumesByType] count], @"Incorrect volume count");
}

@end


text:
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="language" content="en" />
        <link href="./assets/8067b7df/css/bootstrap.css" rel="stylesheet">
<link href="./assets/96d031ef/style.css" rel="stylesheet">

    <title>Yii Framework 2.0 API Documentation</title>

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w442-collapse">Toggle navigation

</button>Yii Framework 2.0 API Documentation

Class reference

    <input id="searchbox" type="text" class="form-control" placeholder="Search">

lajax\translatemanager
Component
Module

lajax\translatemanager\bundles
FrontendTranslationAsset
FrontendTranslationPluginAsset
LanguageAsset
LanguageItemPluginAsset
LanguagePluginAsset
TranslateAsset
TranslateManagerAsset
TranslatePluginAsset
TranslationPluginAsset

lajax\translatemanager\controllers
LanguageController

lajax\translatemanager\controllers\actions
ChangeStatusAction
DialogAction
ListAction
MessageAction
OptimizerAction
SaveAction
ScanAction
TranslateAction

lajax\translatemanager\helpers
Language

lajax\translatemanager\models
Language
LanguageSource
LanguageTranslate

lajax\translatemanager\models\searches
LanguageSearch
LanguageSourceSearch

lajax\translatemanager\services
Generator
Optimizer
Scanner

lajax\translatemanager\services\scanners
ScannerDatabase
ScannerFile
ScannerJavaScriptFunction
ScannerPhpArray
ScannerPhpFunction

lajax\translatemanager\widgets
ToggleTranslate

Class Reference

    <colgroup>
        <col class="col-package" />
        <col class="col-class" />
        <col class="col-description" />
    </colgroup>

        Class
        Description

        lajax\translatemanager\Component
        Initialisation of the front end interactive translation tool.

        lajax\translatemanager\Module
        This is the main module class for the TranslateManager module.

        lajax\translatemanager\bundles\FrontendTranslationAsset
        FrontendTranslation asset bundle

        lajax\translatemanager\bundles\FrontendTranslationPluginAsset
        FrontendTranslation Plugin asset bundle

        lajax\translatemanager\bundles\LanguageAsset
        Language asset bundle

        lajax\translatemanager\bundles\LanguageItemPluginAsset
        LanguageItem Plugin asset bundle

        lajax\translatemanager\bundles\LanguagePluginAsset
        Language Plugin asset bundle

        lajax\translatemanager\bundles\TranslateAsset
        Translation asset bundle

        lajax\translatemanager\bundles\TranslateManagerAsset
        TranslateManager asset bundle

        lajax\translatemanager\bundles\TranslatePluginAsset
        Trasnslation Plugin asset bundle

        lajax\translatemanager\bundles\TranslationPluginAsset
        Translation Plugin asset bundle

        lajax\translatemanager\controllers\LanguageController
        Controller for managing multilinguality.

        lajax\translatemanager\controllers\actions\ChangeStatusAction
        Class that modifies the state of a language.

        lajax\translatemanager\controllers\actions\DialogAction
        Class for creating front end translation dialoge box

        lajax\translatemanager\controllers\actions\ListAction
        Class that creates a list of languages.

        lajax\translatemanager\controllers\actions\MessageAction
        Class for returning messages in the given language

        lajax\translatemanager\controllers\actions\OptimizerAction
        Class for optimizing language database.

        lajax\translatemanager\controllers\actions\SaveAction
        Class for saving translations.

        lajax\translatemanager\controllers\actions\ScanAction
        Class for detecting language elements.

        lajax\translatemanager\controllers\actions\TranslateAction
        This class facilitates the listing of language elements to be translated.

        lajax\translatemanager\helpers\Language
        Language helper.

        lajax\translatemanager\models\Language
        This is the model class for table "language".

        lajax\translatemanager\models\LanguageSource
        This is the model class for table "language_source".

        lajax\translatemanager\models\LanguageTranslate
        This is the model class for table "language_translate".

        lajax\translatemanager\models\searches\LanguageSearch
        LanguageSearch represents the model behind the search form about common\models\Language.

        lajax\translatemanager\models\searches\LanguageSourceSearch
        LanguageSourceSearch represents the model behind the search form about common\models\LanguageSource.

        lajax\translatemanager\services\Generator
        Generator class for producing JavaScript files containing language elements.

        lajax\translatemanager\services\Optimizer
        Optimizer class for optimizing database tables

        lajax\translatemanager\services\Scanner
        Scanner class for scanning project, detecting new language elements

        lajax\translatemanager\services\scanners\ScannerDatabase
        Detecting existing language elements in database.

        lajax\translatemanager\services\scanners\ScannerFile
        Class for processing PHP and JavaScript files.

        lajax\translatemanager\services\scanners\ScannerJavaScriptFunction
        Class for processing JavaScript files.

        lajax\translatemanager\services\scanners\ScannerPhpArray
        Class for processing PHP files.

        lajax\translatemanager\services\scanners\ScannerPhpFunction
        Class for processing PHP files.

        lajax\translatemanager\widgets\ToggleTranslate
        Widget that displays button for switching to translating mode.

Page generated on Sun, 08 Feb 2015 17:17:44 +0000

    Powered by Yii Framework


text:
<?php
namespace Phoreman\Console\Command;

use Phoreman\Procfile;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Export
 */
class ExportCommand extends Command
{

  protected function configure()
  {
      $this->setName('export')
           ->setDescription('export command NOT IMPLEMENTED And probably never will. Use foreman')
            ->setHelp('is used to export your application to another process management format.');
  }

  protected function execute(InputInterface $input, OutputInterface $output)
  {

      $output->writeln('NOT IMPLEMENTED');
  }
}


text:
<?php namespace System\Support\Filters;

use Less_Parser;
use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;

/**
 * Less.php Compiler Filter
 * Class used to compiled stylesheet less files, not using leafo!
 *
 * @package october/support
 *
 */
class LessCompiler implements FilterInterface
{

    public function filterLoad(AssetInterface $asset)
    {
        $parser = new Less_Parser();

        // CSS Rewriter will take care of this
        $parser->SetOption('relativeUrls', false);

        $parser->parseFile($asset->getSourceRoot() . '/' . $asset->getSourcePath());
        $asset->setContent($parser->getCss());
    }

    public function filterDump(AssetInterface $asset)
    {
    }

}


text:
package love.cq.domain;

import java.util.Arrays;

public class Value {
	private String keyword;
	private String[] paramers = new String[0];

	public Value(String keyword, String... paramers) {
		this.keyword = keyword;
		if (paramers != null) {
			this.paramers = paramers;
		}
	}

	public Value(String temp) {
		String[] strs = temp.split(TAB);
		this.keyword = strs[0];
		if (strs.length > 1) {
			this.paramers = Arrays.copyOfRange(strs, 1, strs.length);
		}
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public String[] getParamers() {
		return paramers;
	}

	public void setParamers(String[] paramers) {
		this.paramers = paramers;
	}

	private static final String TAB = "\t";

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(keyword);
		for (int i = 0; i < paramers.length; i++) {
			sb.append(TAB);
			sb.append(paramers[i]);
		}
		return sb.toString();
	}

}