text:
using namespace Concurrency;
using namespace Platform;
using namespace SDKTemplate;
using namespace Windows::Devices::Custom;
using namespace Windows::Storage::Streams;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;

DeviceIO::DeviceIO()
{
    InitializeComponent();
}

void DeviceIO::DeviceIOGet_Click(Platform::Object^ sender, RoutedEventArgs^ e)
{
    CustomDevice^ fx2Device = DeviceList::Current->GetSelectedDevice();
    if (fx2Device == nullptr)
    {
        rootPage->NotifyUser("Fx2 device not connected or accessible", NotifyType::ErrorMessage);
        return;
    }

    auto outputBuffer = ref new Buffer(1);

    // The I/O control codes and their meanings are defined by the device.
    create_task(fx2Device->SendIOControlAsync(
        Fx2Driver::GetSevenSegmentDisplay,
        nullptr,
        outputBuffer
    )).then([this, outputBuffer](task<unsigned int> result)
    {
        try
        {
            result.get();

            byte* data = GetArrayFromBuffer(outputBuffer);

            rootPage->NotifyUser(
                "The segment display value is " + Fx2Driver::SevenSegmentToDigit(data[0]),
                NotifyType::StatusMessage
            );
        }
        catch (InvalidArgumentException^)
        {
            rootPage->NotifyUser("The segment display value is not yet initialized", NotifyType::StatusMessage);
        }
        catch (Exception^ exception)
        {
            rootPage->NotifyUser(exception->Message, NotifyType::ErrorMessage);
        }
    });
}

void DeviceIO::DeviceIOSet_Click(Object^ sender, RoutedEventArgs^ e)
{
    CustomDevice^ fx2Device = DeviceList::Current->GetSelectedDevice();
    if (fx2Device == nullptr)
    {
        rootPage->NotifyUser("Fx2 device not connected or accessible", NotifyType::ErrorMessage);
        return;
    }

    byte val = (byte)(DeviceIOSegmentInput->SelectedIndex + 1);

    auto inputBuffer = ref new Buffer(1);
    byte* data = GetArrayFromBuffer(inputBuffer);
    data[0] = Fx2Driver::DigitToSevenSegment(val);
    inputBuffer->Length = 1;

    // The I/O control codes and their meanings are defined by the device.
    create_task(fx2Device->SendIOControlAsync(
        Fx2Driver::SetSevenSegmentDisplay,
        inputBuffer,
        nullptr
    )).then([this, val](task<unsigned int> result)
    {
        try
        {
            result.get();

            rootPage->NotifyUser("The segment display is set to " + val.ToString(), NotifyType::StatusMessage);
        }
        catch (Exception^ exception)
        {
            rootPage->NotifyUser(exception->Message, NotifyType::ErrorMessage);
            return;
        }
    });
}


text:
package nodeup

import (
	"bytes"
	"encoding/json"
	"fmt"
	"strings"
	"text/template"

	"k8s.io/apimachinery/pkg/util/sets"
	api "k8s.io/kops/pkg/apis/kops"
	"k8s.io/kops/pkg/apis/nodeup"
	"k8s.io/kops/upup/pkg/fi"
	"k8s.io/kops/upup/pkg/fi/loader"
	"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
	"k8s.io/kops/util/pkg/vfs"

	"k8s.io/klog"
)

type Loader struct {
	Builders []fi.ModelBuilder

	config  *nodeup.Config
	cluster *api.Cluster

	assets *fi.AssetStore
	tasks  map[string]fi.Task

	tags              sets.String
	TemplateFunctions template.FuncMap
}

func NewLoader(config *nodeup.Config, cluster *api.Cluster, assets *fi.AssetStore, tags sets.String) *Loader {
	l := &Loader{}
	l.assets = assets
	l.tasks = make(map[string]fi.Task)
	l.config = config
	l.cluster = cluster
	l.TemplateFunctions = make(template.FuncMap)
	l.tags = tags

	return l
}

func (l *Loader) executeTemplate(key string, d string) (string, error) {
	t := template.New(key)

	funcMap := make(template.FuncMap)
	for k, fn := range l.TemplateFunctions {
		funcMap[k] = fn
	}
	t.Funcs(funcMap)

	context := l.cluster.Spec

	_, err := t.Parse(d)
	if err != nil {
		return "", fmt.Errorf("error parsing template %q: %v", key, err)
	}

	t.Option("missingkey=zero")

	var buffer bytes.Buffer
	err = t.ExecuteTemplate(&buffer, key, context)
	if err != nil {
		return "", fmt.Errorf("error executing template %q: %v", key, err)
	}

	return buffer.String(), nil
}

func ignoreHandler(i *loader.TreeWalkItem) error {
	return nil
}

// Build is responsible for running the build tasks for nodeup
func (l *Loader) Build(baseDir vfs.Path) (map[string]fi.Task, error) {
	// First pass: load options
	tw := &loader.TreeWalker{
		DefaultHandler: ignoreHandler,
		Contexts: map[string]loader.Handler{
			"files":    ignoreHandler,
			"disks":    ignoreHandler,
			"packages": ignoreHandler,
			"services": ignoreHandler,
			"users":    ignoreHandler,
		},
		Tags: l.tags,
	}

	err := tw.Walk(baseDir)
	if err != nil {
		return nil, err
	}

	// Second pass: load everything else
	tw = &loader.TreeWalker{
		DefaultHandler: l.handleFile,
		Contexts: map[string]loader.Handler{
			"files":    l.handleFile,
			"disks":    l.newTaskHandler("disk/", nodetasks.NewMountDiskTask),
			"packages": l.newTaskHandler("package/", nodetasks.NewPackage),
			"services": l.newTaskHandler("service/", nodetasks.NewService),
			"users":    l.newTaskHandler("user/", nodetasks.NewUserTask),
		},
		Tags: l.tags,
	}

	err = tw.Walk(baseDir)
	if err != nil {
		return nil, err
	}

	for _, builder := range l.Builders {
		context := &fi.ModelBuilderContext{
			Tasks: l.tasks,
		}
		err := builder.Build(context)
		if err != nil {
			return nil, err
		}
		l.tasks = context.Tasks
	}

	// If there is a package task, we need an update packages task
	for _, t := range l.tasks {
		if _, ok := t.(*nodetasks.Package); ok {
			klog.Infof("Package task found; adding UpdatePackages task")
			l.tasks["UpdatePackages"] = nodetasks.NewUpdatePackages()
			break
		}
	}
	if l.tasks["UpdatePackages"] == nil {
		klog.Infof("No package task found; won't update packages")
	}

	return l.tasks, nil
}

type TaskBuilder func(name string, contents string, meta string) (fi.Task, error)

func (l *Loader) newTaskHandler(prefix string, builder TaskBuilder) loader.Handler {
	return func(i *loader.TreeWalkItem) error {
		contents, err := i.ReadString()
		if err != nil {
			return err
		}
		name := i.Name
		if strings.HasSuffix(name, ".template") {
			name = strings.TrimSuffix(name, ".template")
			expanded, err := l.executeTemplate(name, contents)
			if err != nil {
				return fmt.Errorf("error executing template %q: %v", i.RelativePath, err)
			}

			contents = expanded
		}

		task, err := builder(name, contents, i.Meta)
		if err != nil {
			return fmt.Errorf("error building %s for %q: %v", i.Name, i.Path, err)
		}
		key := prefix + i.RelativePath

		if task != nil {
			l.tasks[key] = task
		}
		return nil
	}
}

func (l *Loader) handleFile(i *loader.TreeWalkItem) error {
	var task *nodetasks.File
	defaultFileType := nodetasks.FileType_File

	if strings.HasSuffix(i.RelativePath, ".template") {
		contents, err := i.ReadString()
		if err != nil {
			return err
		}

		// TODO: Use template resource here to defer execution?
		destPath := "/" + strings.TrimSuffix(i.RelativePath, ".template")
		name := strings.TrimSuffix(i.Name, ".template")
		expanded, err := l.executeTemplate(name, contents)
		if err != nil {
			return fmt.Errorf("error executing template %q: %v", i.RelativePath, err)
		}

		task, err = nodetasks.NewFileTask(name, fi.NewStringResource(expanded), destPath, i.Meta)
		if err != nil {
			return fmt.Errorf("error building task %q: %v", i.RelativePath, err)
		}
	} else if strings.HasSuffix(i.RelativePath, ".asset") {
		contents, err := i.ReadBytes()
		if err != nil {
			return err
		}

		destPath := "/" + strings.TrimSuffix(i.RelativePath, ".asset")
		name := strings.TrimSuffix(i.Name, ".asset")

		def := &nodetasks.AssetDefinition{}
		err = json.Unmarshal(contents, def)
		if err != nil {
			return fmt.Errorf("error parsing json for asset %q: %v", name, err)
		}

		asset, err := l.assets.Find(name, def.AssetPath)
		if err != nil {
			return fmt.Errorf("error trying to locate asset %q: %v", name, err)
		}
		if asset == nil {
			return fmt.Errorf("unable to locate asset %q", name)
		}

		task, err = nodetasks.NewFileTask(i.Name, asset, destPath, i.Meta)
		if err != nil {
			return fmt.Errorf("error building task %q: %v", i.RelativePath, err)
		}
	} else {
		var err error
		var contents fi.Resource
		if vfs.IsDirectory(i.Path) {
			defaultFileType = nodetasks.FileType_Directory
		} else {
			contents = fi.NewVFSResource(i.Path)
		}
		task, err = nodetasks.NewFileTask(i.Name, contents, "/"+i.RelativePath, i.Meta)
		if err != nil {
			return fmt.Errorf("error building task %q: %v", i.RelativePath, err)
		}
	}

	if task.Type == "" {
		task.Type = defaultFileType
	}

	klog.V(2).Infof("path %q -> task %v", i.Path, task)

	if task != nil {
		key := "file/" + i.RelativePath
		l.tasks[key] = task
	}

	return nil
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_
#define _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_ 1

#include <thrift/lib/cpp/transport/TRpcTransport.h>
#include <thrift/lib/cpp/transport/TTransportException.h>
#include <memory>

namespace apache { namespace thrift { namespace transport {

/**
 * Server transport framework. A server needs to have some facility for
 * creating base transports to read/write from.
 *
 */
class TServerTransport {
 public:
  virtual ~TServerTransport() {}

  /**
   * Starts the server transport listening for new connections. Prior to this
   * call most transports will not return anything when accept is called.
   *
   * @throws TTransportException if we were unable to listen
   */
  virtual void listen() {}

  /**
   * Gets a new dynamically allocated transport object and passes it to the
   * caller. Note that it is the explicit duty of the caller to free the
   * allocated object. The returned TRpcTransport object must always be in the
   * opened state. nullptr should never be returned, instead an Exception should
   * always be thrown.
   *
   * @return A new TRpcTransport object
   * @throws TTransportException if there is an error
   */
  std::shared_ptr<TRpcTransport> accept() {
    std::shared_ptr<TRpcTransport> result = acceptImpl();
    if (result == nullptr) {
      throw TTransportException("accept() may not return nullptr");
    }
    return result;
  }

  /**
   * For "smart" TServerTransport implementations that work in a multi
   * threaded context this can be used to break out of an accept() call.
   * It is expected that the transport will throw a TTransportException
   * with the interrupted error code.
   */
  virtual void interrupt() {}

  /**
   * Closes this transport such that future calls to accept will do nothing.
   */
  virtual void close() = 0;

  /**
   * Get the address on which this transport is listening.
   *
   * Should only be called after calling listen().  May raise
   * TTransportException on error.
   *
   * @param address The server's address will be stored in the folly::SocketAddress
   *                pointed to by this argument.
   */
  virtual void getAddress(folly::SocketAddress* address) = 0;

 protected:
  TServerTransport() {}

  /**
   * Subclasses should implement this function for accept.
   *
   * @return A newly allocated TRpcTransport object
   * @throw TTransportException If an error occurs
   */
  virtual std::shared_ptr<TRpcTransport> acceptImpl() = 0;

};

}}} // apache::thrift::transport

#endif // #ifndef _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_


text:
<?php

namespace IzBundle\Service;

use AppBundle\Filter\FilterInterface;
use IzBundle\Entity\Project;
use Knp\Component\Pager\Pagination\PaginationInterface;

interface ProjectDaoInterface
{
    /**
     * @param int             $page
     * @param FilterInterface $filter
     *
     * @return PaginationInterface
     */
    public function findAll($page = null, FilterInterface $filter = null);

    /**
     * @param int $id
     *
     * @return Project
     */
    public function find($id);

    /**
     * @param Project $entity
     */
    public function create(Project $entity);

    /**
     * @param Project $entity
     */
    public function update(Project $entity);

    /**
     * @param Project $entity
     */
    public function delete(Project $entity);
}


text:
module PolybiusSquare
  VERSION = "0.1.1"
end


text:
Verifiable_Computation
======================


text:
<!DOCTYPE html>
<html class="">
<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <meta name="generator" content="Fepper Front End Prototyper (http://fepper.io)">

  <!-- Disable cache -->
  <meta http-equiv="cache-control" content="max-age=0">
  <meta http-equiv="cache-control" content="no-cache">
  <meta http-equiv="expires" content="0">
  <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
  <meta http-equiv="pragma" content="no-cache">

  <!-- Begin Pattern Lab (Required for Pattern Lab to run properly) -->
<link rel="stylesheet" href="../../webserved/pattern.css">
<script src="../../node_modules/mousetrap/mousetrap.min.js"></script>
<script src="../../annotations/annotations.js"></script>
<!-- End Pattern Lab -->

  <link rel="stylesheet" href="../../_styles/bld/style.css" media="all">
</head>
<body class="">
    foo        foo      foo    foo
<!-- Begin Pattern Lab (Required for Pattern Lab to run properly) -->
<script type="text/json" id="sg-pattern-data-footer" class="sg-pattern-data">
  {"lineage":[],"lineageExists":false,"lineageR":[],"lineageRExists":false,"missingPartials":[],"patternDesc":"","patternExtension":".mustache","patternName":"Dot Notation","patternPartial":"test1-dot-notation","patternState":"","portReloader":35729,"portServer":3000}
</script>

<script>
  // LiveReload.
  if (location.protocol !== 'file:') {
    const reloader = document.createElement('script');

    reloader.setAttribute('src', location.protocol + '//' + location.hostname + ':35729/livereload.js');
    document.body.appendChild(reloader);
  }
</script>

<script src="../../node_modules/fepper-ui/scripts/pattern/index.js" type="module"></script>
<!-- End Pattern Lab -->

  <script src="../../_scripts/src/variables.styl" type="text/javascript"></script>
</body>
</html>


text:
ES5Harness.registerTest({
    id: "15.2.3.6-4-273",

    path: "TestCases/chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-273.js",

    description: "Object.defineProperty - 'O' is an Array, 'name' is an array index named property, name is accessor property and 'desc' is accessor descriptor, test updating multiple attribute values of 'name' (15.4.5.1 step 4.c)",

    test: function testcase() {

        var arrObj = [];

        function setFunc(value) {
            arrObj.setVerifyHelpProp = value;
        }
        function getFunc() {
            return 12;
        }
        Object.defineProperty(arrObj, "1", {
            get: function () {
                return 6;
            },
            set: setFunc,
            enumerable: true,
            configurable: true
        });

        Object.defineProperty(arrObj, "1", {
            get: getFunc,
            enumerable: false,
            configurable: false
        });
        return accessorPropertyAttributesAreCorrect(arrObj, "1", getFunc, setFunc, "setVerifyHelpProp", false, false);
    },

    precondition: function prereq() {
        return fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays();
    }
});


text:
class PrefRegistrySimple;
class PrefService;
class GURL;

namespace ntp_snippets {

// Provides content suggestions from the Physical Web Service.
class PhysicalWebPageSuggestionsProvider
    : public ContentSuggestionsProvider,
      public physical_web::PhysicalWebListener {
 public:
  PhysicalWebPageSuggestionsProvider(
      ContentSuggestionsProvider::Observer* observer,
      physical_web::PhysicalWebDataSource* physical_web_data_source,
      PrefService* pref_service);
  ~PhysicalWebPageSuggestionsProvider() override;

  // ContentSuggestionsProvider implementation.
  CategoryStatus GetCategoryStatus(Category category) override;
  CategoryInfo GetCategoryInfo(Category category) override;
  void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
  void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
                            const ImageFetchedCallback& callback) override;
  void Fetch(const Category& category,
             const std::set<std::string>& known_suggestion_ids,
             const FetchDoneCallback& callback) override;
  void ClearHistory(
      base::Time begin,
      base::Time end,
      const base::Callback<bool(const GURL& url)>& filter) override;
  void ClearCachedSuggestions(Category category) override;
  void GetDismissedSuggestionsForDebugging(
      Category category,
      const DismissedSuggestionsCallback& callback) override;
  void ClearDismissedSuggestionsForDebugging(Category category) override;

  static void RegisterProfilePrefs(PrefRegistrySimple* registry);

 private:
  friend class PhysicalWebPageSuggestionsProviderTest;

  // Updates the |category_status_| and notifies the |observer_|, if necessary.
  void NotifyStatusChanged(CategoryStatus new_status);

  // Manually requests all physical web pages and updates the suggestions.
  void FetchPhysicalWebPages();

  // Returns at most |max_count| ContentSuggestions with IDs not in
  // |excluded_ids| and sorted by distance (the closest first). Dismissed
  // suggestions are excluded automatically (no need to add them to
  // |excluded_ids|) and pruned. The raw pages are obtained from Physical Web
  // data source.
  std::vector<ContentSuggestion> GetMostRecentPhysicalWebPagesWithFilter(
      int max_count,
      const std::set<std::string>& excluded_ids);

  // Converts an Physical Web page to a ContentSuggestion.
  ContentSuggestion ConvertPhysicalWebPage(
      const base::DictionaryValue& page) const;

  // PhysicalWebListener implementation.
  void OnFound(const GURL& url) override;
  void OnLost(const GURL& url) override;
  void OnDistanceChanged(const GURL& url, double distance_estimate) override;

  // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding
  // to the given |page_id| and deletes it from the dismissed IDs list, if
  // necessary.
  void InvalidateSuggestion(const std::string& page_id);

  // Reads dismissed IDs from Prefs.
  std::set<std::string> ReadDismissedIDsFromPrefs() const;

  // Writes |dismissed_ids| into Prefs.
  void StoreDismissedIDsToPrefs(const std::set<std::string>& dismissed_ids);

  CategoryStatus category_status_;
  const Category provided_category_;
  physical_web::PhysicalWebDataSource* physical_web_data_source_;
  PrefService* pref_service_;

  DISALLOW_COPY_AND_ASSIGN(PhysicalWebPageSuggestionsProvider);
};

}  // namespace ntp_snippets

#endif  // COMPONENTS_NTP_SNIPPETS_PHYSICAL_WEB_PAGES_PHYSICAL_WEB_PAGE_SUGGESTIONS_PROVIDER_H_


text:
package psidev.psi.mi.jami.enricher.listener;

import psidev.psi.mi.jami.enricher.listener.EnricherListener;
import psidev.psi.mi.jami.listener.PublicationChangeListener;
import psidev.psi.mi.jami.model.Publication;

/**
 * An extension of the PublicationChangeListener
 * with specific methods related to the process of enriching.
 * Each method will be fired after the change has been made to the publication.
 *
 * @author Gabriel Aldam (galdam@ebi.ac.uk)
 * @since 31/07/13

 */
public interface PublicationEnricherListener
        extends EnricherListener<Publication>, PublicationChangeListener{
}


text:
import React, {PropTypes} from 'react';
import {Radio} from 'react-bootstrap';

const Answer = ({id, answerText, checked, group, changeFunction}) => {
	return (
		<li>
			<Radio id={id} checked={checked} name={group} onChange={changeFunction}>
				{answerText}
			</Radio>
		</li>
	);
};

Answer.propTypes = {
	id: PropTypes.number.isRequired,
	answerText: PropTypes.string.isRequired,
	group: PropTypes.string.isRequired,
	changeFunction: PropTypes.func.isRequired,
	checked: PropTypes.bool
};

Answer.defaultProps = {
	checked: false
};

export default Answer;


text:
package io.fundrequest.platform.twitter;

import io.fundrequest.core.request.fund.FundService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.social.twitter.api.Twitter;
import org.springframework.social.twitter.api.impl.TwitterTemplate;
import org.thymeleaf.ITemplateEngine;

@Configuration
@ConditionalOnProperty(name = "io.fundrequest.notifications.twitter.enabled", havingValue = "true")
public class TwitterConfig {

    @Bean
    public Twitter tweetOnFundTwitterTemplate(@Value("${io.fundrequest.notifications.twitter.tweet-on-fund.consumerKey}") final String consumerKey,
                                              @Value("${io.fundrequest.notifications.twitter.tweet-on-fund.consumerSecret}") final String consumerSecret,
                                              @Value("${io.fundrequest.notifications.twitter.tweet-on-fund.accessToken}") final String accessToken,
                                              @Value("${io.fundrequest.notifications.twitter.tweet-on-fund.accessTokenSecret}") final String accessTokenSecret) {

        return new TwitterTemplate(consumerKey, consumerSecret, accessToken, accessTokenSecret);
    }

    @Bean
    public TweetRequestFundedHandler tweetRequestFundedHandler(final Twitter tweetOnFundTwitterTemplate,
                                                               final ITemplateEngine githubTemplateEngine,
                                                               final FundService fundService,
                                                               @Value("${io.fundrequest.platform.base-path}") final String platformBasePath) {
        return new TweetRequestFundedHandler(tweetOnFundTwitterTemplate, githubTemplateEngine, fundService, platformBasePath);
    }
}


text:
<?php

namespace OCA\DAV\CardDAV;

use OCP\Constants;
use OCP\IAddressBook;
use OCP\IURLGenerator;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader;
use Sabre\VObject\UUIDUtil;

class AddressBookImpl implements IAddressBook {

	/** @var CardDavBackend */
	private $backend;

	/** @var array */
	private $addressBookInfo;

	/** @var AddressBook */
	private $addressBook;

	/** @var IURLGenerator */
	private $urlGenerator;

	/**
	 * AddressBookImpl constructor.
	 *
	 * @param AddressBook $addressBook
	 * @param array $addressBookInfo
	 * @param CardDavBackend $backend
	 * @param IUrlGenerator $urlGenerator
	 */
	public function __construct(
			AddressBook $addressBook,
			array $addressBookInfo,
			CardDavBackend $backend,
			IURLGenerator $urlGenerator) {
		$this->addressBook = $addressBook;
		$this->addressBookInfo = $addressBookInfo;
		$this->backend = $backend;
		$this->urlGenerator = $urlGenerator;
	}

	/**
	 * @return string defining the technical unique key
	 * @since 5.0.0
	 */
	public function getKey() {
		return $this->addressBookInfo['id'];
	}

	/**
	 * In comparison to getKey() this function returns a human readable (maybe translated) name
	 *
	 * @return mixed
	 * @since 5.0.0
	 */
	public function getDisplayName() {
		return $this->addressBookInfo['{DAV:}displayname'];
	}

	/**
	 * @param string $pattern which should match within the $searchProperties
	 * @param array $searchProperties defines the properties within the query pattern should match
	 * @param array $options - for future use. One should always have options!
	 * @param int $limit
	 * @param int $offset
	 * @return array an array of contacts which are arrays of key-value-pairs
	 * @since 5.0.0
	 */
	public function search($pattern, $searchProperties, $options, $limit = null, $offset = null) {
		$results = $this->backend->searchEx($this->getKey(), $pattern, $searchProperties, $options, $limit, $offset);

		$vCards = [];
		foreach ($results as $result) {
			$vCards[] = $this->vCard2Array($result['uri'], $this->readCard($result['carddata']));
		}

		return $vCards;
	}

	/**
	 * @param array $properties this array if key-value-pairs defines a contact
	 * @return array an array representing the contact just created or updated
	 * @since 5.0.0
	 */
	public function createOrUpdate($properties) {
		$update = false;
		if (!isset($properties['URI'])) { // create a new contact
			$uid = $this->createUid();
			$uri = $uid . '.vcf';
			$vCard = $this->createEmptyVCard($uid);
		} else { // update existing contact
			$uri = $properties['URI'];
			$vCardData = $this->backend->getCard($this->getKey(), $uri);
			$vCard = $this->readCard($vCardData['carddata']);
			$update = true;
		}

		foreach ($properties as $key => $value) {
			$vCard->$key = $vCard->createProperty($key, $value);
		}

		if ($update) {
			$this->backend->updateCard($this->getKey(), $uri, $vCard->serialize());
		} else {
			$this->backend->createCard($this->getKey(), $uri, $vCard->serialize());
		}

		return $this->vCard2Array($uri, $vCard);
	}

	/**
	 * @return mixed
	 * @since 5.0.0
	 */
	public function getPermissions() {
		$permissions = $this->addressBook->getACL();
		$result = 0;
		foreach ($permissions as $permission) {
			switch ($permission['privilege']) {
				case '{DAV:}read':
					$result |= Constants::PERMISSION_READ;
					break;
				case '{DAV:}write':
					$result |= Constants::PERMISSION_CREATE;
					$result |= Constants::PERMISSION_UPDATE;
					break;
				case '{DAV:}all':
					$result |= Constants::PERMISSION_ALL;
					break;
			}
		}

		return $result;
	}

	/**
	 * @param object $id the unique identifier to a contact
	 * @return bool successful or not
	 * @since 5.0.0
	 */
	public function delete($id) {
		$uri = $this->backend->getCardUri($id);
		return $this->backend->deleteCard($this->addressBookInfo['id'], $uri);
	}

	/**
	 * read vCard data into a vCard object
	 *
	 * @param string $cardData
	 * @return VCard
	 */
	protected function readCard($cardData) {
		return  Reader::read($cardData);
	}

	/**
	 * create UID for contact
	 *
	 * @return string
	 */
	protected function createUid() {
		do {
			$uid = $this->getUid();
			$contact = $this->backend->getContact($this->getKey(), $uid . '.vcf');
		} while (!empty($contact));

		return $uid;
	}

	/**
	 * getUid is only there for testing, use createUid instead
	 */
	protected function getUid() {
		return UUIDUtil::getUUID();
	}

	/**
	 * create empty vcard
	 *
	 * @param string $uid
	 * @return VCard
	 */
	protected function createEmptyVCard($uid) {
		$vCard = new VCard();
		$vCard->UID = $uid;
		return $vCard;
	}

	/**
	 * create array with all vCard properties
	 *
	 * @param string $uri
	 * @param VCard $vCard
	 * @return array
	 */
	protected function vCard2Array($uri, VCard $vCard) {
		$result = [
			'URI' => $uri,
		];

		foreach ($vCard->children() as $property) {
			$result[$property->name] = $property->getValue();
			if ($property->name === 'PHOTO' && $property->getValueType() === 'BINARY') {
				$url = $this->urlGenerator->getAbsoluteURL(
					$this->urlGenerator->linkTo('', 'remote.php') . '/dav/');
				$url .= \implode('/', [
					'addressbooks',
					\substr($this->addressBookInfo['principaluri'], 11), //cut off 'principals/'
					$this->addressBookInfo['uri'],
					$uri
				]) . '?photo';

				$result['PHOTO'] = 'VALUE=uri:' . $url;
			} else {
				$result[$property->name] = $property->getValue();
			}
		}
		if ($this->addressBookInfo['principaluri'] === 'principals/system/system') {
			$result['isSystemBook'] = true;
			if ($this->addressBookInfo['uri'] === 'system') {
				$result['isLocalSystemBook'] = true;
			} else {
				$result['isFederatedSystemBook'] = true;
			}
		}
		return $result;
	}
}


text:
"""
Django settings for mycontactsync project.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'euh_c0o5@2w2s*1^1862mvoz!-y4yh%^pif+f#47%vjay+@9)6'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'mycontactsync.urls'

WSGI_APPLICATION = 'mycontactsync.wsgi.application'

# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/

STATIC_URL = '/static/'


text:
package com.github.davols.dasftp;

/**
 * Created by davols on 07.06.14.
 */
public abstract class TaskResult {
    private boolean failed = false;
    private String failedReason = null;

    public String getFailedReason() {
        return failedReason;
    }

    public void setFailedReason(String failedReason) {
        if (failedReason != null) {
            this.failed = true;
        }
        this.failedReason = failedReason;

    }

    public boolean hasFailed() {
        return failed;
    }

}


text:
@interface ZONavigationBarView : UIView

@property(nonatomic,strong) UIButton    *backBtn;

@property(nonatomic,strong) UILabel     *titleLabel;

@end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<title>Font Face Demo</title>
	<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8">

Font-face Demo for the Ballpark Font

Ballpark Weiner - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using l2pvp;

namespace l2pvp
{

    public partial class BuffForm : Form
    {
        protected Client c;
        protected GameServer gs;

        public BuffForm(Client _c, GameServer _gs)
        {
            c = _c;
            gs = _gs;
            InitializeComponent();

            c.doafterskill.Clear();
            c.doonskill.Clear();

            foreach (skillmap s in gs.skills.Values)
            {
                cbOn.Items.Add(s);
                cbAfter.Items.Add(s);
            }

        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                c.doonskill.Clear();

                foreach (ListViewItem item in listView1.Items)
                {
                    evtSkill s = (evtSkill)item.Tag;
                    c.doonskill.Add(s.evt.id, s);
                }

                c.doafterskill.Clear();

                foreach (ListViewItem item in listView2.Items)
                {
                    evtSkill s = (evtSkill)item.Tag;
                    c.doafterskill.Add(s.evt.id, s);
                }

                this.Hide();

            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString(), "Error in setting buffs");
                Console.WriteLine("Error in setting buffs {0}", ex.ToString());
                this.Hide();
            }

        }
        public void populateskilllist_d(List<skill> skilllist)
        {
            try
            {
                if (this.InvokeRequired)
                    Invoke(new poplist(populateskilllist), new object[] { skilllist });
                else
                    populateskilllist(skilllist);
            }
            catch
            {
            }
        }

        public delegate void poplist(List<skill> skilllist);

        public void populateskilllist(List<skill> skilllist)
        {
            cbBuffOn.Items.Clear();
            cbBuffAfter.Items.Clear();

            foreach (skill i in skilllist)
            {
                //found skill
                cbBuffAfter.Items.Add(i);
                cbBuffOn.Items.Add(i);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string fname = textBox1.Text;
            fname = "dance-" + fname;
            saveConfig(fname);
        }

        public void saveConfig(string fname)
        {
            try
            {
                StreamWriter writefile = new StreamWriter(new FileStream(fname, FileMode.Create), Encoding.UTF8);
                foreach (ListViewItem i in listView1.Items)
                {
                    evtSkill s = (evtSkill)i.Tag;
                    writefile.WriteLine("On, {0}, {1}", s.evt.id, s.act.id);

                }
                foreach (ListViewItem i2 in listView2.Items)
                {
                    evtSkill s = (evtSkill)i2.Tag;
                    writefile.WriteLine("After, {0}, {1}", s.evt.id, s.act.id);
                }

                writefile.Flush();
                writefile.Close();
            }
            catch
            {

            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string fname = textBox1.Text;
            fname = "dance-" + fname;
            loadConfig(fname);
        }

        public void loadConfig(string fname)
        {
            StreamReader readfile;
            try
            {

                readfile = new StreamReader(new FileStream(fname, FileMode.Open), Encoding.UTF8);
                if (readfile == null)
                    return;
            }
            catch
            {
                MessageBox.Show("couldn't open file {0} for reading", fname);
                return;
            }
            string line;
            int on = 0, after = 0;
            listView1.Items.Clear();
            listView2.Items.Clear();

            while ((line = readfile.ReadLine()) != null)
            {
                char[] sep = new char[1];
                sep[0] = ',';
                char[] trim = new char[1];
                trim[0] = ' ';
                string[] split = line.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                if (split[0] == "On" && on < 6)
                {
                    if (split[1] == "null" || split[2] == "null")
                    {

                    }
                    else
                    {
                        uint evtid = Convert.ToUInt32(split[1].TrimStart(trim));
                        uint actid = Convert.ToUInt32(split[2].TrimStart(trim));

                        skillmap evt = gs.skills[evtid];
                        skill act = null;
                        foreach (skill sk in c.skilllist)
                        {
                            if (actid == sk.id)
                            {
                                act = sk;
                                break;
                            }
                        }
                        if (act == null)
                            continue;

                        evtSkill s = new evtSkill();
                        s.evt = evt;
                        s.act = act;

                        ListViewItem item = new ListViewItem(evt.name);
                        item.SubItems.Add(act.name);
                        item.Tag = s;
                        listView1.Items.Add(item);
                    }
                }
                else if (split[0] == "After" && after < 6)
                {
                    if (split[1] == "null" || split[2] == "null")
                    {

                    }
                    else
                    {
                        uint evtid = Convert.ToUInt32(split[1].TrimStart(trim));
                        uint actid = Convert.ToUInt32(split[2].TrimStart(trim));

                        skillmap evt = gs.skills[evtid];
                        skill act = null;
                        foreach (skill sk in c.skilllist)
                        {
                            if (actid == sk.id)
                            {
                                act = sk;
                                break;
                            }
                        }
                        if (act == null)
                            continue;

                        evtSkill s = new evtSkill();
                        s.evt = evt;
                        s.act = act;

                        ListViewItem item = new ListViewItem(evt.name);
                        item.SubItems.Add(act.name);
                        item.Tag = s;
                        listView2.Items.Add(item);
                    }
                }

            }
            readfile.Close();

            c.doonskill.Clear();

            foreach (ListViewItem item in listView1.Items)
            {
                evtSkill s = (evtSkill)item.Tag;
                c.doonskill.Add(s.evt.id, s);
            }

            c.doafterskill.Clear();

            foreach (ListViewItem item in listView2.Items)
            {
                evtSkill s = (evtSkill)item.Tag;
                c.doafterskill.Add(s.evt.id, s);
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //Add for onbuff
            skillmap evt = (skillmap)cbOn.SelectedItem;
            if (evt == null)
                return;
            skill act = (skill)cbBuffOn.SelectedItem;
            if (act == null)
                return;

            if (c.doonskill.ContainsKey(evt.id))
            {
                MessageBox.Show("Cannot have multiple skills launch from one skill");
                return;
            }

            evtSkill s = new evtSkill();
            s.evt = evt;
            s.act = act;

            ListViewItem item = new ListViewItem(evt.name);
            item.SubItems.Add(act.name);
            item.Tag = s;
            listView1.Items.Add(item);

            //c.doonskill.Add(s.evt.id, s);
        }

        private void cbON_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            //delete for onbuff
            ListView.SelectedListViewItemCollection ic = listView1.SelectedItems;
            foreach (ListViewItem i in ic)
            {
                listView1.Items.Remove(i);
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            skillmap evt = (skillmap)cbAfter.SelectedItem;
            if (evt == null)
                return;
            skill act = (skill)cbBuffAfter.SelectedItem;
            if (act == null)
                return;

            if (c.doafterskill.ContainsKey(evt.id))
            {
                MessageBox.Show("Cannot have multiple skills launch from one skill");
                return;
            }

            evtSkill s = new evtSkill();
            s.evt = evt;
            s.act = act;

            ListViewItem item = new ListViewItem(evt.name);
            item.SubItems.Add(act.name);
            item.Tag = s;
            listView2.Items.Add(item);

        }

        private void button5_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection ic = listView2.SelectedItems;
            foreach (ListViewItem i in ic)
            {
                listView2.Items.Remove(i);
            }
        }

        public void loadconfig_d(string fname)
        {
            if (this.InvokeRequired)
                Invoke(new loadconfig(loadConfig), new object[] { fname });
            else
                loadConfig(fname);
        }

        public delegate void loadconfig(string fname);
    }

    public class skillmap
    {
        public uint id;
        public string name;
        public override string ToString()
        {
            return name;
        }
    }

    public class evtSkill
    {
        public skillmap evt;
        public skill act;
        public System.Threading.ManualResetEvent mre;
        public bool succeed = false;
        public evtSkill()
        {
            mre = new System.Threading.ManualResetEvent(false);
        }
    }
}


text:
package com.cloud.storage.upload;

import com.cloud.agent.api.storage.UploadAnswer;
import com.cloud.agent.api.storage.UploadProgressCommand.RequestType;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;

public abstract class UploadActiveState extends UploadState {

    public UploadActiveState(final UploadListener ul) {
        super(ul);
    }

    @Override
    public String handleAnswer(final UploadAnswer answer) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("handleAnswer, answer status=" + answer.getUploadStatus() + ", curr state=" + getName());
        }
        switch (answer.getUploadStatus()) {
            case UPLOAD_IN_PROGRESS:
                getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
                return Status.UPLOAD_IN_PROGRESS.toString();
            case UPLOADED:
                getUploadListener().scheduleImmediateStatusCheck(RequestType.PURGE);
                getUploadListener().cancelTimeoutTask();
                return Status.UPLOADED.toString();
            case NOT_UPLOADED:
                getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
                return Status.NOT_UPLOADED.toString();
            case UPLOAD_ERROR:
                getUploadListener().cancelStatusTask();
                getUploadListener().cancelTimeoutTask();
                return Status.UPLOAD_ERROR.toString();
            case UNKNOWN:
                getUploadListener().cancelStatusTask();
                getUploadListener().cancelTimeoutTask();
                return Status.UPLOAD_ERROR.toString();
            default:
                return null;
        }
    }

    @Override
    public String handleAbort() {
        return Status.ABANDONED.toString();
    }

    @Override
    public String handleTimeout(final long updateMs) {
        if (s_logger.isTraceEnabled()) {
            getUploadListener().logTrace("handleTimeout, updateMs=" + updateMs + ", curr state= " + getName());
        }
        String newState = getName();
        if (updateMs > 5 * UploadListener.STATUS_POLL_INTERVAL) {
            newState = Status.UPLOAD_ERROR.toString();
            getUploadListener().logDebug("timeout: transitioning to upload error state, currstate=" + getName());
        } else if (updateMs > 3 * UploadListener.STATUS_POLL_INTERVAL) {
            getUploadListener().cancelStatusTask();
            getUploadListener().scheduleImmediateStatusCheck(RequestType.GET_STATUS);
            getUploadListener().scheduleTimeoutTask(3 * UploadListener.STATUS_POLL_INTERVAL);
            getUploadListener().logDebug(getName() + " first timeout: checking again ");
        } else {
            getUploadListener().scheduleTimeoutTask(3 * UploadListener.STATUS_POLL_INTERVAL);
        }
        return newState;
    }

    @Override
    public String handleDisconnect() {

        return Status.UPLOAD_ERROR.toString();
    }

    @Override
    public void onEntry(final String prevState, final UploadEvent event, final Object evtObj) {
        super.onEntry(prevState, event, evtObj);

        if (event == UploadEvent.UPLOAD_ANSWER) {
            getUploadListener().setLastUpdated();
        }
    }

    @Override
    public void onExit() {
    }
}


text:
import React from 'react';
import { Route, Link, Switch } from 'react-router-dom';
import { BASICCOMPONENTS } from './basicComponents';
import { BOOKS } from './booksScreen';

export class AppComponent extends React.Component {
    constructor(props) {
        super();
    }

    componentDidMount() {
        console.log("componentDidMount:APP");
        let Loader = document.getElementById("loader");
        Loader.setAttribute("class", "hidden");
    }

    render() {
        return (

                    <Link to="/basic">Basic Components</Link>
                    <Link to="/books">Books</Link>

                    <Switch>
                        <Route exact path="/" component={BASICCOMPONENTS} />
                        <Route path="/basic" component={BASICCOMPONENTS} />
                        <Route exact path="/books" component={BOOKS} />
                        <Route path="/books/:filter" component={BOOKS} />
                    </Switch>

        )
    }
}


text:
package leap.orm.annotation.domain;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import leap.core.metamodel.ReservedMetaFieldName;
import leap.orm.annotation.Domain;
import leap.orm.annotation.meta.MetaName;

@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RUNTIME)
@Domain("orm.createdAt")
@MetaName(reserved=ReservedMetaFieldName.CREATED_AT)
public @interface CreatedAt {

}