text:
package hath

import (
	"bytes"
	"crypto/sha1"
	"encoding/binary"
	"encoding/hex"
	"errors"
	"fmt"
	"io"
	"math/big"
	"path"
	"sort"
	"strconv"
	"strings"
	"time"

	"github.com/dineshappavoo/basex"
)

const (
	keyStampEnd  = "hotlinkthis"
	prefixLenght = 2
	// HashSize is length of sha1 hash in bytes
	HashSize             = 20
	sizeBytes            = 4
	resolutionBytes      = 2
	fileBytes            = 38
	keyStampLength       = 10
	staticRangeBytes     = 2
	staticRangeHexLength = 4
	staticRangeDelimiter = ";"

	// file size limitations
	size10MB = 1024 * 1024 * 10
	// FileMaximumSize is maximum image size in hath
	FileMaximumSize = size10MB
)

// FileType represents file format of image
type FileType byte

// StaticRange is prefix for static ranges assigned to user
type StaticRange [staticRangeBytes]byte

func (s StaticRange) String() string {
	return hex.EncodeToString(s[:])
}

// ParseStaticRange parses hex string static range start
func ParseStaticRange(s string) (r StaticRange, err error) {
	if len(s) != staticRangeHexLength {
		return r, io.ErrUnexpectedEOF
	}
	b, err := hex.DecodeString(s)
	if err != nil {
		return r, err
	}
	copy(r[:], b[:])
	return r, err
}

// StaticRanges contain ranges
type StaticRanges map[StaticRange]bool

// Contains returns true if file f is in static ranges
func (s StaticRanges) Contains(f File) bool {
	return s[f.Range()]
}

// Add static range
func (s StaticRanges) Add(r StaticRange) {
	s[r] = true
}

// Remove static range
func (s StaticRanges) Remove(r StaticRange) {
	delete(s, r)
}

// Count of static ranges
func (s StaticRanges) Count() int {
	return len(s)
}

func (s StaticRanges) String() string {
	var elems []string
	for k := range s {
		elems = append(elems, k.String())
	}
	sort.Strings(elems)
	return strings.Join(elems, staticRangeDelimiter)
}

func (f FileType) String() string {
	if f == JPG {
		return "jpg"
	}
	if f == PNG {
		return "png"
	}
	if f == GIF {
		return "gif"
	}
	return "tmp"
}

const (
	// JPG image
	JPG FileType = iota
	// PNG image
	PNG
	// GIF animation
	GIF
	// UnknownImage is not supported format
	UnknownImage
)

var (
	// ContentTypes is map of file types to content types
	ContentTypes = map[FileType]string{
		JPG:          "image/jpeg",
		PNG:          "image/png",
		GIF:          "image/gif",
		UnknownImage: "application/octet-stream",
	}
)

var (
	// ErrFileTypeUnknown when FileType is UnknownImage
	ErrFileTypeUnknown = errors.New("hath => file type unknown")
	// ErrHashBadLength when hash size is not HashSize
	ErrHashBadLength = errors.New("hath => hash of image has bad length")
)

// ParseFileType returns FileType from string
func ParseFileType(t string) FileType {
	switch strings.ToLower(t) {
	case "jpg", "jpeg":
		return JPG
	case "png":
		return PNG
	case "gif":
		return GIF
	default:
		return UnknownImage
	}
}

// File is hath file representation
// total 20 + 4 + 2 + 2 + 1 + 8 + 1 = 38 bytes
// in memory = 56 bytes
type File struct {
	Hash [HashSize]byte `json:"hash"` // 20 byte
	Type FileType       `json:"type"` // 1 byte
	// Static files should never be removed
	Static bool  `json:"static"` // 1 byte
	Size   int64 `json:"size"`   // 4 byte (maximum size 4095mb)
	Width  int   `json:"width"`  // 2 byte
	Height int   `json:"height"` // 2 byte
	// LastUsage is Unix timestamp
	LastUsage int64 `json:"last_usage"` // 8 byte (can be optimized)
}

// ContentType of image
func (f File) ContentType() string {
	switch f.Type {
	case JPG:
		return "image/jpeg"
	case PNG:
		return "image/png"
	case GIF:
		return "image/gif"
	default:
		return "application/octet-stream"
	}
}

// Range returns static range of file
func (f File) Range() (r StaticRange) {
	copy(r[:], f.Hash[:staticRangeBytes])
	return r
}

// InRange returns true if file is in static range r
func (f File) InRange(r StaticRange) bool {
	return bytes.Equal(r[:], f.Hash[:staticRangeBytes])
}

// Bytes serializes file info into byte array
func (f File) Bytes() []byte {
	var result [fileBytes]byte
	var buff [8]byte
	cursor := 0

	// writing hash
	copy(result[cursor:HashSize], f.Hash[:])
	cursor += HashSize

	// writing type
	result[cursor] = byte(f.Type)
	cursor++

	// writing static
	if f.Static {
		result[cursor] = 255
	}
	cursor++

	// Size is 64bit, or 8 byte
	// little endian is 1111111111000000000
	// we want only first right 4 byte
	binary.LittleEndian.PutUint64(buff[:], uint64(f.Size))
	copy(result[cursor:cursor+sizeBytes], buff[:sizeBytes])
	cursor += sizeBytes

	// writing height
	binary.LittleEndian.PutUint64(buff[:], uint64(f.Height))
	copy(result[cursor:cursor+resolutionBytes], buff[:resolutionBytes])
	cursor += resolutionBytes

	// writing width
	binary.LittleEndian.PutUint64(buff[:], uint64(f.Width))
	copy(result[cursor:cursor+resolutionBytes], buff[:resolutionBytes])
	cursor += resolutionBytes

	// writing time
	binary.LittleEndian.PutUint64(buff[:], uint64(f.LastUsage))
	copy(result[cursor:cursor+8], buff[:])
	cursor += 8
	return result[:]
}

// FileFromBytes deserializes byte slice into file
func FileFromBytes(result []byte) (f File, err error) {
	return f, FileFromBytesTo(result, &f)
}

// FileFromBytesTo deserializes byte slice into file by pointer
func FileFromBytesTo(result []byte, f *File) error {
	if len(result) != fileBytes {
		return ErrFileInconsistent
	}
	var buff [8]byte
	cursor := 0
	// reading hash
	copy(f.Hash[:], result[cursor:HashSize])
	cursor += HashSize

	// reading type
	f.Type = FileType(result[cursor])
	cursor++

	// reading static
	f.Static = result[cursor] == 255
	cursor++

	// Size is 64bit, or 8 byte
	// little endian is 1111111111000000000
	// we want only first right 4 byte
	copy(buff[:sizeBytes], result[cursor:cursor+sizeBytes])
	f.Size = int64(binary.LittleEndian.Uint64(buff[:]))
	cursor += sizeBytes

	// reading height
	buff = [8]byte{} // buffer reset
	copy(buff[:resolutionBytes], result[cursor:cursor+resolutionBytes])
	f.Height = int(binary.LittleEndian.Uint64(buff[:]))
	cursor += resolutionBytes

	// reading width
	buff = [8]byte{} // buffer reset
	copy(buff[:resolutionBytes], result[cursor:cursor+resolutionBytes])
	f.Width = int(binary.LittleEndian.Uint64(buff[:]))
	cursor += resolutionBytes

	// reading time
	buff = [8]byte{} // buffer reset
	copy(buff[:], result[cursor:cursor+8])
	f.LastUsage = int64(binary.LittleEndian.Uint64(buff[:]))

	return nil
}

func (f File) indexKey() []byte {
	timeBytes := make([]byte, 8)
	binary.BigEndian.PutUint64(timeBytes, uint64(f.LastUsage))
	elems := [][]byte{
		timeBytes,
		f.Hash[:],
	}
	return bytes.Join(elems, nil)
}

// LastUsageBefore returns true, if last usage occured before deadline t
func (f File) LastUsageBefore(t time.Time) bool {
	return t.Unix() < f.LastUsage
}

// Dir is first prefixLenght chars of file hash
func (f File) Dir() string {
	return f.HexID()[:prefixLenght]
}

// Path returns relative path to file
func (f File) Path() string {
	return path.Join(f.Dir(), f.String())
}

// Use sets LastUsage to current time
func (f *File) Use() {
	f.LastUsage = time.Now().Unix()
}

// HexID returns hex representation of hash
func (f File) HexID() string {
	return fmt.Sprintf("%x", f.Hash)
}

// SetHash sets hash from string
func (f *File) SetHash(s string) error {
	hash, err := hex.DecodeString(s)
	if err != nil {
		return err
	}
	if len(hash) != HashSize {
		return ErrHashBadLength
	}
	copy(f.Hash[:], hash[:HashSize])
	return nil
}

// Buffer creates buffer with size of file
func (f *File) Buffer() *bytes.Buffer {
	return bytes.NewBuffer(make([]byte, 0, f.Size))
}

// FileFromID generates new File from provided ID
func FileFromID(fileid string) (f File, err error) {
	elems := strings.Split(fileid, keyStampDelimiter)
	if len(elems) != 5 {
		return f, io.ErrUnexpectedEOF
	}
	if err = f.SetHash(elems[0]); err != nil {
		return
	}
	f.Size, err = strconv.ParseInt(elems[1], 10, 64)
	if err != nil {
		return
	}
	f.Width, err = strconv.Atoi(elems[2])
	if err != nil {
		return
	}
	f.Height, err = strconv.Atoi(elems[3])
	if err != nil {
		return
	}
	f.Type = ParseFileType(elems[4])
	f.LastUsage = time.Now().Unix()
	return f, err
}

func (f File) String() string {
	elems := []string{
		f.HexID(),
		sInt64(f.Size),
		strconv.Itoa(f.Width),
		strconv.Itoa(f.Height),
		f.Type.String(),
	}
	return strings.Join(elems, keyStampDelimiter)
}

// KeyStamp generates file key for provided timestamp
func (f File) KeyStamp(key string, timestamp int64) string {
	elems := []string{
		sInt64(timestamp),
		f.String(),
		key,
		keyStampEnd,
	}
	toHash := strings.Join(elems, keyStampDelimiter)
	hash := sha1.Sum([]byte(toHash))
	return fmt.Sprintf("%x", hash)[:keyStampLength]
}

// Basex returns basex representation of hash
func (f File) Basex() string {
	d := f.ByteID()
	n := big.NewInt(0)
	n.SetBytes(d)
	s, _ := basex.Encode(n.String())
	return s
}

// Marshal serializes file info
func (f File) Marshal() ([]byte, error) {
	return f.Bytes(), nil
}

// UnmarshalFile deserializes file info fron byte array
func UnmarshalFile(data []byte) (f File, err error) {
	return f, FileFromBytesTo(data, &f)
}

// UnmarshalFileTo deserializes file info fron byte array by pointer
func UnmarshalFileTo(data []byte, f *File) error {
	return FileFromBytesTo(data, f)
}

// ByteID returns []byte for file hash
func (f File) ByteID() []byte {
	return f.Hash[:]
}


text:
A LaTeX template designed to meet the requirements of the University of Denver for a PhD Dissertation. It uses modern LaTeX with KOMA-Script's scrreprt as a basis.

*Note*: This is an unofficial template and not supported by the university. It is up to you to ensure that your work meets the university guidelines.

By Graduate Studies rules, you need to specify a style guide to follow for your dissertation. They suggest APA, MLA, or Turabian, none of which are directly applicable to Computer Science or Mathematics. Some reasonable alternatives are:
* [IEEE](https://www.computer.org/portal/web/publications/styleguide) - Refers to the Chicago Manual of Style for issues not addressed in their guide
* [SIAM](http://www.siam.org/journals/auth-info.php) - Refers to the Chicago Manual of Style for issues not addressed in their guide
* [AMS](http://www.ams.org/publications/authors/tex/author-handbook) - Most of their guides concern using their LaTeX classes, but they do have information about formatting equations and so forth.

Where applicable this template attempts to conform to (in order):
1. Graduate Studies formatting rules
2. IEEE
3. SIAM
4. Chicago Manual of Style

Most questions of style are not questions that apply to this template, but of the document regarding precise punctuation usage, word choice, etc.

Note that the library has an online license to the Chicago Manual of Style.

Other resources:
* [Mathematics into Type](http://www.ams.org/publications/authors/authors) (free PDF linked from this page)  Detailed AMS guide to formatting mathematics including things like spacing between symbols

LaTeX package dependencies of the template:
* KOMA-Script
* etoolbox
* lineno - used to put line numbers in the margin when in draft mode
* setspace - sets up double line spacing. Use the environment \begin{singlespace}...\end{singlespace} if single spacing is needed
* hyperref
* geometry
* [amsmath](http://www.ams.org/publications/authors/tex/amslatex) - Lots of helpful math stuff
* [amsthm](https://www.ctan.org/pkg/amsthm)
* [amssymb](https://www.ctan.org/pkg/amsfonts) - Part of amsfonts
* [cleveref](https://www.ctan.org/pkg/cleveref) - Simple, nice, inter-document cross references
* [algorithmicx](https://www.ctan.org/pkg/algorithmicx) - Provides a nice environment to typeset algorithms. Use the algpseudocode layout (with just \usepackage{algopseudocode}, no need for \usepackage{algorithmicx}). This should be your choice for pseudocode.
* [imakeidx](https://www.ctan.org/pkg/imakeidx) - Allows for multiple indices if desired. Index generation can be disabled
* [idxlayout](https://www.ctan.org/pkg/idxlayout) - Controls the layout

Recommended LaTeX packages and tools:
* [latexmk](http://personal.psu.edu/jcc8//software/latexmk-jcc/) - A Perl script which manages building the document. It will automatically call LaTeX the correct number of times as well as associated tools such as biber and xindy.
* [listings](https://www.ctan.org/pkg/listings) - Typesets source code well. Best for actual source code, otherwise use algpseudocode.
* [PGF/TikZ](https://www.ctan.org/pkg/pgf) - Creates nice figures. See [TeXample.net](http://www.texample.net/tikz/) for example figures to use as a basis.

Links:
* [Official DU Information](http://www.du.edu/currentstudents/graduates/graduationinformation.html)

redpajama_set_name: RedPajamaGithub


text:
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const visit = require('unist-util-visit');
const is = require('hast-util-is-element');

/**
 * Find pre-rendered marble diagrams and override their <img> `src` attributes in docs.
 * You need to run `npm run tests2png` in rxjs root to generate marble diagrams into `tmp/docs/img`
 */
module.exports = function embedMarbleDiagramsPostProcessor(log) {
  const service = {
    marbleImagesPath: null,
    marbleImagesOutputPath: null,
    marbleImagesOutputWebPath: null,
    process: () => {
      return (tree) => {
        visit(tree, node => {
          if (is(node, 'img')) {
            const props = node.properties;
            const src = props.src;
            const expectedImgPath = `${service.marbleImagesPath}/${src}`;
            if (fs.existsSync(expectedImgPath)) {
              const operator = path.basename(src, path.extname(src));
              const filename = path.basename(expectedImgPath);
              const targetPath = `${service.marbleImagesOutputPath}/${filename}`;

              mkdirp.sync(path.dirname(targetPath));
              fs.copyFileSync(expectedImgPath, targetPath);

              props.src = `${service.marbleImagesOutputWebPath}/${filename}`;
              props.width = '100%';
              if (!props.alt) {
                props.alt = `${operator} marble diagram`;
              }

              log.debug(`Found ${expectedImgPath} and copying it to ${targetPath}`);
            }
          }
        });
      };
    },
  };

  return service;
};


text:
<?php declare(strict_types=1);
namespace Mfn\PHP\Analyzer\Analyzers\Tools;

use Mfn\PHP\Analyzer\File;
use PhpParser\Node\Stmt\Class_ as PhpParserClass;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Use_;

/**
 * Represent a class
 *
 * Use getInterfaces() to get the parent class or getInterfaces() to access the
 * interfaces.
 */
class ParsedClass extends ParsedObject implements Class_
{

    /** @var PhpParserClass */
    protected $node;
    /**
     * Full qualified parent name
     * @var NULL|string
     */
    private $fqParent;
    /** @var NULL|ParsedClass */
    private $parent;
    /**
     * The key is the fqn
     * @var ParsedInterface[]
     */
    private $implements = [];
    /** @var ParsedMethod[] */
    private $methods;

    /**
     * @param string $namespace
     * @param Use_[] $uses
     * @param PhpParserClass $class
     * @param File $file
     */
    public function __construct($namespace, array $uses, PhpParserClass $class, File $file)
    {
        $this->namespace = $namespace;
        $this->file = $file;
        $this->node = $class;
        $this->uses = $uses;
        $this->fqn = join('\\', array_filter([$namespace, $class->name]));
        $this->resolveNames();
        if (null === $this->fqParent && isset($class->extends)) {
            throw new \RuntimeException(
                'Something is amiss, resolved parent name and actual parent differ in ' .
                $file->getSplFile()->getRealPath() . ':' . $class->getLine()
            );
        }
        if (count($this->implements) !== count($class->implements)) {
            throw new \RuntimeException(
                'Something is amiss, resolved ' . count($this->implements) .
                ' interface(s) but found ' . count($class->implements) .
                ' actual interface(s) in ' .
                $file->getSplFile()->getRealPath() . ':' . $class->getLine()
            );
        }
    }

    /**
     * The "names" presented in "parent" and "interfaces" may not be fully
     * qualified; this steps resolved this
     */
    private function resolveNames()
    {
        if (isset($this->node->extends)) {
            $this->fqParent = $this->resolveName($this->node->extends);
        }
        foreach ($this->node->implements as $name) {
            $this->implements[$this->resolveName($name)] = null;
        }
    }

    /**
     * @return ParsedMethod[]
     */
    public function getMethods(): array
    {
        if (null === $this->methods) {
            $this->methods = array_map(
                function (ClassMethod $method) {
                    return new ParsedMethod($this, $method);
                },
                $this->node->getMethods()
            );
        }
        return $this->methods;
    }

    public function getParent(): ?Class_
    {
        return $this->parent;
    }

    public function setParent(Class_ $parent): Class_
    {
        if ($parent->getName() !== $this->fqParent) {
            throw new \RuntimeException(
                'Expected class ' . $this->fqParent . ' but got ' . $parent->getName()
                . ' instead'
            );
        }
        $this->parent = $parent;
        return $this;
    }

    /**
     * @return Interface_[]
     */
    public function getInterfaces(): array
    {
        return array_values($this->implements);
    }

    /**
     * @param Interface_ $interface
     * @return $this
     */
    public function addInterface(Interface_ $interface): HasInterfaces
    {
        if (!array_key_exists($interface->getName(), $this->implements)) {
            throw new \RuntimeException(
                'Class ' . $this->fqn . ' is not supposed to have the interface ' .
                $interface->getName()
            );
        }
        $this->implements[$interface->getName()] = $interface;
        return $this;
    }

    /**
     * @return NULL|string
     */
    public function getFqExtends(): ?string
    {
        return $this->fqParent;
    }

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

    /**
     * Return an string identifier for this kind of object; no harm using
     * something human readable like 'Class', etc.
     *
     * @return string
     */
    public function getKind(): string
    {
        return 'Class';
    }

    /**
     * It returns the same object as getNode() but it's explicit about it's type
     *
     * @return PhpParserClass
     */
    public function getClass(): PhpParserClass
    {
        return $this->node;
    }

    public function isInterface(): bool
    {
        return false;
    }

    public function isClass(): bool
    {
        return true;
    }
}


text:
/*
Theme Name: Museu Câmara Cascudo
Theme URI: http://mcc.ufrn.br
Author: Wendell P. Barreto
Author URI: http://mcc.betacast.com.br
Description:
Version: 1.0
Tags: blue, flat, responsive, onepage
*/


text:
#ifndef _RCPP_SGRAPH_HPP
#define _RCPP_SGRAPH_HPP

#include <Rcpp.h>
#include <unity/lib/gl_sgraph.hpp>

class RcppSGraph {

  public:
    // default constructor
    RcppSGraph();

    // constructor from an R external pointer
    RcppSGraph(SEXP sxptr);

    RcppSGraph(SEXP vertices, SEXP edges, const std::string& vid,
               const std::string& src_id, const std::string& dst_id);

    void load(std::string & file);

    void show();

    SEXP get();

    void save(const std::string & file);

    SEXP num_vertices();

    SEXP num_edges();

    SEXP get_edges();

    SEXP get_vertices();

    SEXP get_fields();

    SEXP get_vertex_fields();

    SEXP get_edge_fields();

    SEXP add_vertices(SEXP vertices, const std::string& vid_field);

    SEXP add_edges(SEXP edges, const std::string& src_field,
                   const std::string& dst_field);

    SEXP select_vertex_fields(const std::vector<std::string>& fields);

    SEXP select_edge_fields(const std::vector<std::string>& fields);

    SEXP select_fields(const std::vector<std::string>& fields);

  private:

    graphlab::gl_sgraph sgraph;

};

#endif


text:
set -euo pipefail

MAX_NUMBER_OF_RELEASES=200
ARTIFACTORY_URL="https://artifactory.yahooinc.com/artifactory"

# JFrog Cloud repo file
if [[ ! -f /etc/yum.repos.d/vespa.repo ]]; then
    cat << EOF > /etc/yum.repos.d/vespa.repo
[vespa-release-el8]
name=Vespa releases
baseurl=$ARTIFACTORY_URL/vespa/centos/8/release/\$basearch
gpgcheck=0
enabled=1
[vespa-release-el7]
name=Vespa releases
baseurl=$ARTIFACTORY_URL/vespa/centos/7/release/\$basearch
gpgcheck=0
enabled=1
EOF
fi

VERSIONS_TO_DELETE=$(dnf list --quiet --showduplicates --disablerepo='*' --enablerepo=vespa-release-el7,vespa-release-el8 vespa | awk '/[0-9].*\.[0-9].*\.[0-9].*/{print $2}' | sort -V | head -n -200 | grep -v "7.594.36")

RPMS_TO_DELETE=$(mktemp)
trap "rm -f $RPMS_TO_DELETE" EXIT

for VERSION in $VERSIONS_TO_DELETE; do
    curl -sSL -H "content-type:text/plain" -H "Authorization: Bearer $JFROG_API_TOKEN" \
         --data "items.find({ \"repo\": { \"\$eq\": \"vespa\" }, \"name\": {\"\$match\": \"vespa*$VERSION*\"}   }).include(\"repo\", \"path\", \"name\")" \
         "$ARTIFACTORY_URL/api/search/aql" \
        | jq -re ".results[]|\"$ARTIFACTORY_URL/\(.repo)/\(.path)/\(.name)\"" >> $RPMS_TO_DELETE
done

echo "Deleting the following RPMs:"
cat $RPMS_TO_DELETE

if [[ -n $SCREWDRIVER ]] && [[ -z $SD_PULL_REQUEST ]]; then
    for RPM in $(cat $RPMS_TO_DELETE); do
        curl -sSL -H "Authorization: Bearer $JFROG_API_TOKEN" -X DELETE $RPM
    done
fi


text:
layout: post
title: "Site preview - the holy grail of Drupal"
subtitle: "Also introducing a new module preview sync"
excerpt: "So recently I did a talk at DrupalSouth Melbourne on site preview solutions that exist within Drupal at present. I noticed that no one had managed to do a comparison between them as they stand at the moment, so I aimed to help out there."
header-img: "img/post-bg-01.jpg"
permalink: /article/site-preview-the-holy-grail-of-drupal/
permalink-disqus: /article/site-preview-the-holy-grail-of-drupal
author: "Sean Hamlin"
categories:
- tutorial
tags:
- drupal
- drupalplanet
- preview
- content-staging
---

## What is site preview

> The ability to see (and have selected others see) changes to content and layout that is not yet visible to the general public

So recently I did a talk at [DrupalSouth Melbourne](https://melbourne2015.drupal.org.au/session/site-preview-holy-grail-drupal) on site preview solutions that exist within Drupal at present. I noticed that no one had managed to do a comparison between them as they stand at the moment, so I aimed to help out there.

Solutions compared in the talk:

* Drupal 7 (stock)
* SPS
* CPS
* Zariz
* Live preview
* What is coming in Drupal 8

I also wanted to introduce the new solution that was developed for the Ministry of Health New Zealand, that aimed to solve site preview in an entirely different manner.

## Slides

Here are my [full slides](http://bit.ly/drupalsouthsitepreview) from the talk if you want to read about the above options in more detail.

## How preview sync is different

Instead of try to take over your production site, and pollute it with complex revisioning and access control, and altering your EFQ and views using magic, it instead works with your existing workflow (workbench_moderation integration is OOTB), and aims to be a lightweight solution.

Preview sync, takes a live snapshot (optimised) of your production database, and imports this to a separate dedicated preview environment. Then a number of actions take place, all of which are entirely alterable, so you can add your own tasks in, and remove tasks you don't need.

Example tasks in preview sync:

* environment switch to preview, this allows you to enable and disable modules, perform actions (e.g. redirecting email to a log). This is a powerful hook.
* publish the content currently in 'Needs Review', this allows your content approvers to see the content, including all surrounding content as if it was published on production, but in a safe and controlled environment
* re-index solr, if your site is largely driven by Apache Solr (which is not uncommon), this will allow the newly published content above to be inserted into the preview Solr index. This is a unique feature
* your task here, seriously, the task list is completely alterable, and any drush command can be remotely executed on the preview environment. Custom drush commands can be added. An example of which is the bundled workbench-moderation-publish drush command.

### Security

As all the complex access control is not needed on production (e.g. you are never sending un-published content to Solr), there is a huge security benefit to using preview sync. Access control to nodes is kept simple on production.

Also, as the preview environment is dedicated, you can lock down access, e.g. only allow access to your preview site from certain IPs. This way, your internal content approvers can still see the content, and no one else.

## Comments

If preview sync sounds like it could be useful to you, I am keen to know - please leave a comment below. I am also keen to hear if

* there is a missing feature that is needed for you to adopt preview sync
* key integrations with other contributed modules are missing


text:
<!DOCTYPE html>

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

<title>class CreateOfacSdns - Ofac</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

    Home
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Defined In

lib/generators/ofac_migration/build/templates/create_ofac_sdns.rb

Parent

ActiveRecord::Migration

Methods

::down

::up

Pages

README

Class and Module Index

OfacMigration

OfacMigration::Generators

OfacMigration::Generators::BuildGenerator

CreateOfacSdns

Object

Ofac

OfacMatch

OfacSdn

OfacSdnLoader

String

class CreateOfacSdns

Public Class Methods

          down()
          click to toggle source

# File lib/generators/ofac_migration/build/templates/create_ofac_sdns.rb, line 28
def self.down
  drop_table :ofac_sdns
end

          up()
          click to toggle source

# File lib/generators/ofac_migration/build/templates/create_ofac_sdns.rb, line 3
def self.up
  create_table :ofac_sdns do |t|
    t.text      :name
    t.string    :sdn_type
    t.string    :program
    t.string    :title
    t.string    :vessel_call_sign
    t.string    :vessel_type
    t.string    :vessel_tonnage
    t.string    :gross_registered_tonnage
    t.string    :vessel_flag
    t.string    :vessel_owner
    t.text      :remarks
    t.text      :address
    t.string    :city
    t.string    :country
    t.string    :address_remarks
    t.string    :alternate_identity_type
    t.text      :alternate_identity_name
    t.string    :alternate_identity_remarks
    t.timestamps
  end
  add_index :ofac_sdns, :sdn_type
end

[Validate]

Generated by RDoc 3.12.2.

Generated with the Darkfish Rdoc Generator 3.


text:
package org.kasource.commons.collection.builder;

import java.util.HashMap;
import java.util.Map;

/**
 * Map Builder. Allows population of map entries with method chaining.
 *
 * @code {
 *  Map<String, Object> map = new MapBuilder<String, Object>().put("A", 1).put("B", 2).build();
 * }
 * @author rikardwi
 *
 * @param <K>  Map key type
 * @param <V>  Map value type
 */
public class MapBuilder<K, V> {

    private Map<K, V> map;

    /**
     * Constructor. Uses the default map implementation (HashMap).
     **/
    public MapBuilder() {
        map = new HashMap<K, V>();
    }

    /**
     * Constructor.
     *
     * @param map Map to use.
     **/
    public MapBuilder(Map<K,V> map) {
        this.map = map;
    }

    /**
     * Puts a new entry into the map.
     *
     * @param key    Entry key
     * @param value  Entry value
     *
     * @return This builder
     **/
    public MapBuilder<K, V> put(K key, V value) {
        map.put(key, value);
        return this;
    }

    /**
     * Puts all entries from otherMap into the map.
     *
     * @param otherMap Map to populate entries from.
     *
     * @return This builder.
     **/
    public MapBuilder<K, V> putAll(Map<K, V> otherMap) {
        map.putAll(otherMap);
        return this;
    }

    /**
     * Returns the populated map.
     *
     * @return the populated map.
     **/
    public Map<K, V> build() {
        return map;
    }
}


text:
package org.wso2.carbon.streaming.integrator.core.internal.asyncapi;

import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.Selectors;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.streaming.integrator.core.internal.asyncapi.util.Constants;
import org.wso2.carbon.streaming.integrator.core.internal.asyncapi.util.Utils;
import org.wso2.carbon.streaming.integrator.core.internal.exception.ServiceCatalogueAPIServiceStubException;
import org.wso2.carbon.streaming.integrator.core.persistence.beans.AsyncAPIServiceCatalogueConfigs;
import org.yaml.snakeyaml.Yaml;

import java.util.Map;

public class AsyncAPIUndeployer implements Runnable {

    private final String hostAndPort;
    private final String username;
    private final String password;
    private final String asyncAPiKeyVersion;
    private final ServiceCatalogueApiHelper serviceCatalogueApiHelper;
    private final String zipDirectoryURI;

    private static final Logger log = LoggerFactory.getLogger(AsyncAPIUndeployer.class);

    public AsyncAPIUndeployer(AsyncAPIServiceCatalogueConfigs asyncAPIServiceCatalogueConfigs, String asyncAPIContent) {
        hostAndPort = asyncAPIServiceCatalogueConfigs.getHostname() + ":" + asyncAPIServiceCatalogueConfigs.getPort();
        username = asyncAPIServiceCatalogueConfigs.getUsername();
        password = asyncAPIServiceCatalogueConfigs.getPassword();
        serviceCatalogueApiHelper = new ServiceCatalogueApiHelper();
        Yaml yaml = new Yaml();
        Map<String, Object> map = yaml.load(asyncAPIContent);
        JSONObject asyncAPIJson = new JSONObject(map);
        String serviceKey = asyncAPIJson.getJSONObject(Constants.ASYNC_API_INFO).
                getString(Constants.ASYNC_API_TITLE).replaceAll(" ", "");
        String version = asyncAPIJson.getJSONObject(Constants.ASYNC_API_INFO).getString(Constants.ASYNC_API_VERSION);
        asyncAPiKeyVersion = serviceKey + "-" + version;
        zipDirectoryURI = Constants.SERVICE_DEF_DIRECTORY + asyncAPiKeyVersion;
    }

    @Override
    public void run() {
        String serviceUUID = getAsyncAPIUUIDinServiceCatalogue();
        if (serviceUUID != null) {
            try {
                serviceCatalogueApiHelper.deleteAsyncAPIDef(serviceUUID, hostAndPort, username, password);
                FileObject fileObject = Utils.getFileObject(zipDirectoryURI);
                fileObject.delete(Selectors.SELECT_ALL);
                log.info("Async api: " + asyncAPiKeyVersion +
                        " deleted from service catalog when undeploying Siddhi app");
            } catch (ServiceCatalogueAPIServiceStubException e) {
                log.error("Exception occurred when deleting async api: " +
                        asyncAPiKeyVersion + " when undeploying Siddhi app", e);
            } catch (FileSystemException e) {
                log.error("Exception occurred when deleting async api in the file system: " +
                        asyncAPiKeyVersion + " when undeploying Siddhi app", e);
            }
        }
    }

    public String getAsyncAPIUUIDinServiceCatalogue() {
        try {
            JSONObject apiMd5s = serviceCatalogueApiHelper.getKeyMd5s(hostAndPort, username, password, asyncAPiKeyVersion);
            if (log.isDebugEnabled() && apiMd5s != null) {
                log.info(" Retrieved Async API definition md5s: " + apiMd5s.toString());
            }
            if (apiMd5s != null) {
                JSONArray md5List = apiMd5s.getJSONArray("list");
                for (int i = 0; i < md5List.length(); i++) {
                    JSONObject apiKeyObject = md5List.getJSONObject(i);
                    if (apiKeyObject.getString("serviceKey").compareTo(asyncAPiKeyVersion) == 0) {
                        return apiKeyObject.getString("id");
                    }
                }
            }
            return null;
        } catch (ServiceCatalogueAPIServiceStubException e) {
            log.error("Exception occurred when getting checking for async api: " +
                    asyncAPiKeyVersion + " when undeploying Siddhi app", e);
            return null;
        }
    }
}


text:
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//----------------------------------------------------------------

namespace System.Activities.Presentation.Internal.PropertyEditing.Editors
{
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Globalization;
    using System.Windows;
    using System.Windows.Automation;
    using System.Runtime;
    sealed class FlagPanel : StackPanel
    {
        public static readonly DependencyProperty FlagStringProperty =
            DependencyProperty.Register("FlagString", typeof(string), typeof(FlagPanel), new PropertyMetadata(string.Empty));

        public static readonly DependencyProperty FlagTypeProperty = DependencyProperty.Register(
            "FlagType",
            typeof(Type),
            typeof(FlagPanel),
            new PropertyMetadata(null, new PropertyChangedCallback(OnFlagTypeChanged)));

        public Type FlagType
        {
            get { return (Type)GetValue(FlagTypeProperty); }
            set { SetValue(FlagTypeProperty, value); }
        }

        public string FlagString
        {
            get { return (string)GetValue(FlagStringProperty); }
            set { SetValue(FlagStringProperty, value); }
        }

        static void OnFlagTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            Type flagType = args.NewValue as Type;
            Fx.Assert(flagType == null || flagType.IsEnum, "FlagType should be null or enum");
            Fx.Assert(flagType == null || Attribute.IsDefined(flagType, typeof(FlagsAttribute)), "FlagType should be null or have flags attribute");

            if (flagType == null)
            {
                return;
            }

            int index = 0;
            FlagPanel panel = sender as FlagPanel;
            string[] flagNames = flagType.GetEnumNames();
            string zeroValueString = Enum.ToObject(flagType, 0).ToString();
            foreach (string flagName in flagNames)
            {
                if (zeroValueString.Equals("0") || !flagName.Equals(zeroValueString))
                {
                    CheckBox checkBox = new CheckBox();
                    panel.Children.Add(checkBox);
                    checkBox.Content = flagName;
                    checkBox.DataContext = panel;
                    checkBox.SetValue(AutomationProperties.AutomationIdProperty, flagName);
                    Binding binding = new Binding("FlagString");
                    binding.Mode = BindingMode.TwoWay;
                    binding.Converter = new CheckBoxStringConverter(index);
                    binding.ConverterParameter = panel;
                    checkBox.SetBinding(CheckBox.IsCheckedProperty, binding);
                    index++;
                }
            }
        }

        sealed class CheckBoxStringConverter : IValueConverter
        {
            int index;

            public CheckBoxStringConverter(int index)
            {
                this.index = index;
            }

            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                string str = (value as string).ToUpperInvariant();
                FlagPanel panel = parameter as FlagPanel;
                if (str.Contains((panel.Children[this.index] as CheckBox).Content.ToString().ToUpperInvariant()))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            {
                FlagPanel panel = parameter as FlagPanel;
                string str = string.Empty;
                for (int i = 0; i < panel.Children.Count; i++)
                {
                    if ((i != this.index && ((bool)(panel.Children[i] as CheckBox).IsChecked)) ||
                        (i == this.index && (bool)value))
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            str += ", ";
                        }
                        str += (panel.Children[i] as CheckBox).Content.ToString();
                    }
                }
                if (string.IsNullOrEmpty(str))
                {
                    Type flagType = panel.FlagType;
                    Fx.Assert(flagType != null && flagType.IsEnum, "FlagType should be enum");
                    Fx.Assert(Attribute.IsDefined(flagType, typeof(FlagsAttribute)), "FlagType should have flags attribute");

                    return Enum.ToObject(flagType, 0).ToString();
                }
                return str;
            }
        }
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('movies', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='movie',
            name='mdb_id',
            field=models.IntegerField(null=True, verbose_name='themoviedb id', blank=True),
        ),
    ]


text:
Sign in with Twitter button implementation for Windows Phone 8.1 released as Nuget library
You can use this NuGet for Windows Universal 8.1, but you should use Web Authentication Broker for Windows 8.1

### Features
 - Sign in with Twitter OAuth
 - Getting screen name and access token
 - Geting JSON of user details

### How to use

##### Step 1. Download TwitterAutherino using NuGet

Open the Package Manager Console and type in `Install-Package TwitterAutherino`

##### Step 2. Add code

Add `using TwitterAutherino;` and some button to your page. Subscribe to the button's Click event

```C#
   TwitterAuth twitterAuth;

        private async void TwitterButton_Click(object sender, RoutedEventArgs e)
        {
            //Create new TwitterAuth object with your consumer id and consumer secret
            twitterAuth = new TwitterAuth("YOUR_CONSUMER_ID", "YOUR_CONSUMER_SECRET");
            //Call GetRequestTokenAsync with the callback url you have set in your Twitter dashboard
            //The url below could be anything but make sure it's the same as in your Twitter dashboard
            await twitterAuth.GetRequestTokenAsync("http://twitter.com/mobile");
            //Subscribe to the GotRequestResponseKeypair event
            twitterAuth.GotRequestResponseKeypair += TwitterAuth_GotRequestResponseKeypair;
            //Where should the WebDialog flyout be placed? The good practice is to point it to the parent grid (often with the name "LayoutRoot"
            twitterAuth.ShowWebDialogFlyout(LayoutGrid);
        }

        private async void TwitterAuth_GotRequestResponseKeypair(object sender, System.EventArgs e)
        {
            var user = await twitterAuth.GetAccessTokenAsync();
            var response = await twitterAuth.GetUserDetailsAsync();
            await new MessageDialog(String.Format("Welcome {0}", user.ScreenName), "Registered with Twitter").ShowAsync();
        }
```

#####

### Incomnig features
 - Layout update of WebDialog
 - UserControl: Sign in with Twitter button

### Troubleshooting
##### Help! I've got exception 401 Unauthorized
Double check your date and time.


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="12dp">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

            <TextView
                android:text="Egbai Mmumene"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/textView7"
                android:textSize="28sp"
                android:layout_marginTop="8dp"
                android:layout_alignStart="@+id/textView8"
                android:layout_alignLeft="@+id/textView8"
                android:textAppearance="?android:textAppearanceLarge"
                />

        <RatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ratingBar2"
            android:layout_marginBottom="8dp"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_toRightOf="@+id/textView7"
            android:layout_alignBottom="@+id/textView7"
            android:layout_marginLeft="12dp"

            android:layout_centerHorizontal="true" />

        <TextView
            android:text="TextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textView8"
            android:textAppearance="?android:textAppearanceMedium"
            android:layout_below="@+id/textView7"
            android:textSize="24sp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:layout_marginLeft="16dp"/>
    </RelativeLayout>
</android.support.v7.widget.CardView>


text:
package info.ineighborhood.cardme.vcard.features;

/**
 *
 * @author Georges El-Haddad
 *

 * Aug 9, 2006
 *
 *
RFC 2426

 * 3.6.2 NOTE Type Definition
 *

 *
Type name: NOTE

 *
Type purpose: To specify supplemental information or a comment that is associated with the vCard.

 *
Type encoding: 8bit

 *
Type value: A single text value.

 *
Type special note: The type is based on the X.520 Description attribute.

 *

 *

 */
public interface NoteFeature extends TypeTools {

	/**
	 *
Returns the note.

	 *
	 * @return {@link String}
	 */
	public String getNote();

	/**
	 *
Sets the note.

	 *
	 * @param note
	 */
	public void setNote(String note);

	/**
	 *
Returns true if a note exists.

	 *
	 * @return boolean
	 */
	public boolean hasNote();

	/**
	 *
Returns a full copy of this object.

	 *
	 * @return {@link NoteFeature}
	 */
	public NoteFeature clone();
}


text:
@charset "UTF-8";
body {
 position: relative;
 font-family: "Helvetica Neue", "Lucida Grande", sans-serif;
 margin: 0;
 padding: 0;
}
	ul#viennadetails {
	 position: fixed;
	 top: 0px;
	 left: 0px;
	 width: 100%;
	 list-style-type:none;
	 padding: 3px 50px 2px 35px;
	 margin: 0;
	 border-bottom: 1px solid #999;
	 background: transparent url(pellucid.png);
	 background-repeat: repeat;
	}
		ul#viennadetails li {
		 display: inline;
		 /*color: #b24700;*/
	     color: #ff0059;
	     font-size: 16px;
		 font-weight: normal;
		 font-family: Optima, Georgia, Times, serif;
		}
		ul#viennadetails li.viennaauthor:before {
		 content: "~ ";
		}
		ul#viennadetails li.viennaenclosure:before {
		 content: "~ ";
		}
	h1#viennatitle {
	 font-size: 24px;
	 margin: 60px 35px 10px 35px;
	 padding: 0;
	 }
		 h1#viennatitle a {
	      color: #09f;
		  text-decoration: none;
		  padding: 0;
		 }
		 h1#viennatitle a:hover {
	      color: #09f;
		 }
	div#viennabody {
	 font-family: Optima, Georgia, Times, serif;
	 font-size: 16px;
	 font-weight: 500;
	 line-height: 22px;
	 letter-spacing: 0.05em;
	 width: 34em;
	 padding: 0;
	 margin: 0 17px 35px 35px;
	 overflow:auto;
	}
		div#viennabody a {
		 color: #0019ff;
		 text-decoration: none;
		}
		div#viennabody a:hover {
		 border-bottom: 1px dotted;
		}
	div#viennafeedlink {
	 position: fixed;
	 bottom: 0px;
	 left: 0px;
	 padding: 3px 0 0 35px;
	 margin: 0;
	 height: 20px;
	 width: 100%;
	 font-size: 14px;
	 border-top: 1px solid #999;
	 background: transparent url(pellucid.png);
	 background-repeat: repeat;
	}
		div#viennafeedlink a {
		 text-decoration: none;
		 color: #f60;
		 font-weight: normal;
		 padding: 0 0 0 19px;
		 background: url(feed-icon-16x16.png);
		 background-position: left;
		 background-repeat: no-repeat;
		}
	pre {
	 font-family: ProFont, monospace;
	 font-size: 12px;
	 font-weight: normal;
	}


text:
@interface LZCollectionFooter : UICollectionReusableView

@end


text:
package com.intellij.execution.application;

import com.intellij.execution.*;
import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.configurations.ConfigurationUtil;
import com.intellij.execution.impl.RunManagerImpl;
import com.intellij.execution.junit.JavaRuntimeConfigurationProducerBase;
import com.intellij.execution.junit.RuntimeConfigurationProducer;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.util.PsiMethodUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class ApplicationConfigurationProducer extends JavaRuntimeConfigurationProducerBase implements Cloneable {
  private PsiElement myPsiElement = null;
  public static final RuntimeConfigurationProducer PROTOTYPE = new ApplicationConfigurationProducer();

  public ApplicationConfigurationProducer() {
    super(ApplicationConfigurationType.getInstance());
  }

  public PsiElement getSourceElement() {
    return myPsiElement;
  }

  protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, final ConfigurationContext context) {
    location = JavaExecutionUtil.stepIntoSingleClass(location);
    if (location == null) return null;
    final PsiElement element = location.getPsiElement();
    if (!element.isPhysical()) return null;
    PsiElement currentElement = element;
    PsiMethod method;
    while ((method = findMain(currentElement)) != null) {
      final PsiClass aClass = method.getContainingClass();
      if (ConfigurationUtil.MAIN_CLASS.value(aClass)) {
        myPsiElement = method;
        return createConfiguration(aClass, context);
      }
      currentElement = method.getParent();
    }
    final PsiClass aClass = ApplicationConfigurationType.getMainClass(element);
    if (aClass == null) return null;
    myPsiElement = aClass;
    return createConfiguration(aClass, context);
  }

  private RunnerAndConfigurationSettings createConfiguration(final PsiClass aClass, final ConfigurationContext context) {
    final Project project = aClass.getProject();
    RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(project, context);
    final ApplicationConfiguration configuration = (ApplicationConfiguration)settings.getConfiguration();
    configuration.MAIN_CLASS_NAME = JavaExecutionUtil.getRuntimeQualifiedName(aClass);
    configuration.setName(configuration.getGeneratedName());
    setupConfigurationModule(context, configuration);
    RunConfigurationExtension.patchCreatedConfiguration(configuration);
    return settings;
  }

  @Nullable
  private static PsiMethod findMain(PsiElement element) {
    PsiMethod method;
    while ((method = getContainingMethod(element)) != null)
      if (PsiMethodUtil.isMainMethod(method)) return method;
      else element = method.getParent();
    return null;
  }

  public int compareTo(final Object o) {
    return PREFERED;
  }

  @Override
  protected RunnerAndConfigurationSettings findExistingByElement(Location location,
                                                                 @NotNull RunnerAndConfigurationSettings[] existingConfigurations,
                                                                 ConfigurationContext context) {
    final PsiClass aClass = ApplicationConfigurationType.getMainClass(location.getPsiElement());
    if (aClass == null) {
      return null;
    }
    final Module predefinedModule =
      ((ApplicationConfiguration)((RunManagerImpl)RunManagerEx.getInstanceEx(location.getProject()))
        .getConfigurationTemplate(getConfigurationFactory())
        .getConfiguration()).getConfigurationModule().getModule();
    for (RunnerAndConfigurationSettings existingConfiguration : existingConfigurations) {
      final ApplicationConfiguration appConfiguration = (ApplicationConfiguration)existingConfiguration.getConfiguration();
      if (Comparing.equal(JavaExecutionUtil.getRuntimeQualifiedName(aClass), appConfiguration.MAIN_CLASS_NAME)) {
        if (Comparing.equal(location.getModule(), appConfiguration.getConfigurationModule().getModule())) {
          return existingConfiguration;
        }
        final Module configurationModule = appConfiguration.getConfigurationModule().getModule();
        if (Comparing.equal(location.getModule(), configurationModule)) return existingConfiguration;
        if (Comparing.equal(predefinedModule, configurationModule)) {
          return existingConfiguration;
        }
      }
    }
    return null;
  }
}


text:
package com.navercorp.pinpoint.common.server.bo.stat;

/**
 * @author Taejin Koo
 */
public interface AgentWarningStatDataPoint extends AgentStatDataPoint {
}


text:
publish -- Publish an assignment
================================

## SYNOPSIS

    npm publish <folder> [--tag <tag>]

## DESCRIPTION

Publishes an assignment to the registry so that it can be installed by name. See
[Guide: Anatomy of an Assignment](../guides/anatomy.md) for details on what's included in the published assignment, as
well as details on how the assignment is built.

* `<folder>`:
  A folder containing a .homework.json file

* `[--tag <tag>]`
  Registers the published package with the given tag, such that the class'
  assignments list can indicate this tag rather than the version number.
  By default, `homework publish` updates the `latest` tag.

Fails if the package name and version combination already exists in
the specified registry.

Once a package is published with a given name and version, that
specific name and version combination can never be used again, even if
it is removed with npm-unpublish(1).

# TODO

- Runs homework-validate to prevent duplicate names
- Which registry?

By default npm will publish to the public registry. This can be overridden by
specifying a different default registry or using a `npm-scope(7)` in the name
(see `package.json(5)`).

The following paths and files are necessary, so adding them to `.gitignore`
will prevent you from publishing your assignment.

* `.homework.json`
* `README.md`

- https://github.com/npm/node-tar

only works on master
bump version in json
publish to API, with SHA
detect difference between published version and the repo
git-archive

how to deal with "night before" publish without pull request?


text:
set(BACKENDS)
set(FSEVENT_BACKEND)

macro(try_this NAME VARIABLE SOURCE)
  set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/cmake/src)
  set(BACKENDS ${BACKENDS} ${NAME})

  try_run(${VARIABLE}_RUN ${VARIABLE}_COMPILE
    ${CMAKE_BINARY_DIR}
    ${SRC}/${SOURCE}
    OUTPUT_VARIABLE ${NAME}_OUTPUT)

  if(${VARIABLE}_COMPILE AND ${VARIABLE}_RUN EQUAL 0)
    set(${VARIABLE} YES)
    set(FSEVENT_BACKEND ${NAME})
  else()
    set(${VARIABLE} NO)
  endif()

  message(STATUS "${NAME}: ${${VARIABLE}}")
endmacro()

# Windows
try_this("ReadDirectoryChanges"
  HAVE_READ_DIRECTORY_CHANGES
  have_read_directory_changes.c)

# kqueue
try_this("kqueue"
  HAVE_KQUEUE
  have_kqueue.c)

# Linux
try_this("inotify"
  HAVE_INOTIFY
  have_inotify.c)

if(FSEVENT_BACKEND)
  message(STATUS "using '${FSEVENT_BACKEND}' backend")
else()
  message(SEND_ERROR "failed to find a proper backend")

  foreach(OUTPUT_VAR ${BACKENDS})
    message("=======================================")
    message("${OUTPUT_VAR}:\n${${OUTPUT_VAR}_OUTPUT}")
  endforeach()
endif()


text:
<?php
/*
Title: Custom Sections
Order: 60
Flow: Layout
*/


text:
layout: post
title: How to Take a Screenshot
date: 2016-07-14 13:49:00.000000000 +03:00
type: post
published: true
status: publish
categories:
- Basic Actions
tags: []
meta: /how-to-take-a-screenshot/
---

To take a screenshot on the Samsung S7, simultaneously press both the power button (found on the top right) and the home button (found on the bottom center of your device). A shutter sound as a quick flash on the screen will let you know the screenshot has been successfully taken. Screenshots are by default saved in the Gallery app or your Google Photos.

{: .center}
![S7 Screenshot](/assets/S7_BM.png){:width="350px"}

[Looking for your device?]( http://bluemaildevices.com)


text:
import { ACTIVITY_HOME } from '../common/constants';
import { DEFAULT_PROJECT_ID } from '../models/project';
import { RootState } from '../ui/redux/modules';
import * as entities from '../ui/redux/modules/entities';
import { GlobalState } from '../ui/redux/modules/global';

export const reduxStateForTest = async (global: Partial<GlobalState> = {}): Promise<RootState> => ({
  entities: entities.reducer(entities.initialEntitiesState, entities.initializeWith(await entities.allDocs())),
  global: {
    activeWorkspaceId: null,
    activeActivity: ACTIVITY_HOME,
    activeProjectId: DEFAULT_PROJECT_ID,
    dashboardSortOrder: 'modified-desc',
    isLoading: false,
    isLoggedIn: false,
    loadingRequestIds: {},
    ...global,
  },
});


text:
using UnityEngine;
using System.Collections;

public class TowerSelector : NetworkedObject
{
    public GameObject TowerPrefab;
    public GameObject Castle;
    public float MaxTowerDistance;

    private int iTowerCreatedIndex = 0; // for unique names
    public void StartCreating()
    {
        startCreating = true;
    }

    private bool startCreating;
    private Vector3 circleCenter;

    void Start()
    {
        InitializeNetwork();

        circleCenter = Castle.transform.position;
        startCreating = false;
    }

    protected override void SynchronizeState()
    {
        //  SendRPC("InstantiateEntityTower", RPCMode.Others, transform.gameObject.name, transform.position);
    }

    public void ServerCreateRequest(string strEntityName, Vector3 vPosition, Quaternion qRotation)
    {
        if (IsServer() == true)
        {
            Debug.LogError("Server (rts) cannot spawn Towen entities without taking gold etc please use StartCreating function");
            return;
        }

        GameObject instantiateObject = (GameObject)Instantiate(TowerPrefab, vPosition, qRotation);

        instantiateObject.transform.parent = transform;
        instantiateObject.name = strEntityName;
    }

    void Update()
    {
        if (startCreating)
        {
            if (Input.GetMouseButtonUp(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    if (Vector3.Distance(circleCenter, hit.point) < MaxTowerDistance)
                    {
                        GameObject instantiateObject = (GameObject)Instantiate(TowerPrefab, hit.point, TowerPrefab.transform.rotation);

                        instantiateObject.transform.parent = transform;
                        instantiateObject.name = instantiateObject.name + "Ins" + iTowerCreatedIndex;
                        iTowerCreatedIndex++;

                        SendRPC("InstantiateEntityTower", RPCMode.Others, instantiateObject.name, instantiateObject.transform.position,
                            instantiateObject.transform.rotation);

                    }
                    else
                    {
                        // tutaj jkis dzwięki czy coś że nie można postawić wierzyczki
                    }
                }

                startCreating = false;
            }

        }
    }
}


text:
#ifndef CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H
#define CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H

#include <cppunit/Portability.h>

CPPUNIT_NS_BEGIN

class TestFixture;

/*! \brief Abstract TestFixture factory (Implementation).
 *
 * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy.
 */
class TestFixtureFactory
{
public:
  //! Creates a new TestFixture instance.
  virtual TestFixture *makeFixture() =0;
};

/*! \brief Concret TestFixture factory (Implementation).
 *
 * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy.
 */
template<class TestFixtureType>
class ConcretTestFixtureFactory : public CPPUNIT_NS::TestFixtureFactory
{
  /*! \brief Returns a new TestFixture instance.
   * \return A new fixture instance. The fixture instance is returned by
   *         the TestFixtureFactory passed on construction. The actual type
   *         is that of the fixture on which the static method suite()
   *         was called.
   */
  TestFixture *makeFixture()
  {
    return new TestFixtureType();
  }
};

CPPUNIT_NS_END

#endif // CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H