text:
// <copyright company="Aspose Pty Ltd">
//   Copyright (C) 2011-2021 GroupDocs. All Rights Reserved.
// </copyright>

namespace GroupDocs.Metadata.Examples.CSharp.AdvancedUsage.ManagingMetadataForSpecificFormats.BusinessCard
{
    using System;
    using Formats.BusinessCard;

    /// <summary>
    /// This example shows how to use vCard property filters.
    /// </summary>
    public static class VCardFilterCardProperties
    {
        public static void Run()
        {
            using (Metadata metadata = new Metadata(Constants.InputVcf))
            {
                var root = metadata.GetRootPackage<VCardRootPackage>();

                foreach (var vCard in root.VCardPackage.Cards)
                {
                    // Print most preferred work phone numbers and work emails
                    var filtered = vCard.FilterWorkTags().FilterPreferred();
                    PrintArray(filtered.CommunicationRecordset.Telephones);
                    PrintArray(filtered.CommunicationRecordset.Emails);
                }
            }
        }

        private static void PrintArray(string[] values)
        {
            if (values != null)
            {
                foreach (string value in values)
                {
                    Console.WriteLine(value);
                }
            }
        }
    }
}


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public enum eEndPointsMode { AUTO, AUTOCLOSED, EXPLICIT }
public enum eWrapMode { ONCE, LOOP }
public delegate void OnEndCallback();

public class SplineInterpolator : MonoBehaviour
{
	eEndPointsMode mEndPointsMode = eEndPointsMode.AUTO;

	internal class SplineNode
	{
		internal Vector3 Point;
		internal Quaternion Rot;
		internal float Time;
		internal Vector2 EaseIO;

		internal SplineNode(Vector3 p, Quaternion q, float t, Vector2 io) { Point = p; Rot = q; Time = t; EaseIO = io; }
		internal SplineNode(SplineNode o) { Point = o.Point; Rot = o.Rot; Time = o.Time; EaseIO = o.EaseIO; }
	}

	List<SplineNode> mNodes = new List<SplineNode>();
	string mState = "";
	bool mRotations;

	OnEndCallback mOnEndCallback;

	void Awake()
	{
		Reset();
	}

	public void StartInterpolation(OnEndCallback endCallback, bool bRotations, eWrapMode mode)
	{
		if (mState != "Reset")
			throw new System.Exception("First reset, add points and then call here");

		mState = mode == eWrapMode.ONCE ? "Once" : "Loop";
		mRotations = bRotations;
		mOnEndCallback = endCallback;

		SetInput();
	}

	public void Reset()
	{
		mNodes.Clear();
		mState = "Reset";
		mCurrentIdx = 1;
		mCurrentTime = 0;
		mRotations = false;
		mEndPointsMode = eEndPointsMode.AUTO;
	}

	public void AddPoint(Vector3 pos, Quaternion quat, float timeInSeconds, Vector2 easeInOut)
	{
		if (mState != "Reset")
			throw new System.Exception("Cannot add points after start");

		mNodes.Add(new SplineNode(pos, quat, timeInSeconds, easeInOut));
	}

	void SetInput()
	{
		if (mNodes.Count < 2)
			throw new System.Exception("Invalid number of points");

		if (mRotations)
		{
			for (int c = 1; c < mNodes.Count; c++)
			{
				SplineNode node = mNodes[c];
				SplineNode prevNode = mNodes[c - 1];

				// Always interpolate using the shortest path -> Selective negation
				if (Quaternion.Dot(node.Rot, prevNode.Rot) < 0)
				{
					node.Rot.x = -node.Rot.x;
					node.Rot.y = -node.Rot.y;
					node.Rot.z = -node.Rot.z;
					node.Rot.w = -node.Rot.w;
				}
			}
		}

		if (mEndPointsMode == eEndPointsMode.AUTO)
		{
			mNodes.Insert(0, mNodes[0]);
			mNodes.Add(mNodes[mNodes.Count - 1]);
		}
		else if (mEndPointsMode == eEndPointsMode.EXPLICIT && (mNodes.Count < 4))
			throw new System.Exception("Invalid number of points");
	}

	void SetExplicitMode()
	{
		if (mState != "Reset")
			throw new System.Exception("Cannot change mode after start");

		mEndPointsMode = eEndPointsMode.EXPLICIT;
	}

	public void SetAutoCloseMode(float joiningPointTime)
	{
		if (mState != "Reset")
			throw new System.Exception("Cannot change mode after start");

		mEndPointsMode = eEndPointsMode.AUTOCLOSED;

		mNodes.Add(new SplineNode(mNodes[0] as SplineNode));
		mNodes[mNodes.Count - 1].Time = joiningPointTime;

		Vector3 vInitDir = (mNodes[1].Point - mNodes[0].Point).normalized;
		Vector3 vEndDir = (mNodes[mNodes.Count - 2].Point - mNodes[mNodes.Count - 1].Point).normalized;
		float firstLength = (mNodes[1].Point - mNodes[0].Point).magnitude;
		float lastLength = (mNodes[mNodes.Count - 2].Point - mNodes[mNodes.Count - 1].Point).magnitude;

		SplineNode firstNode = new SplineNode(mNodes[0] as SplineNode);
		firstNode.Point = mNodes[0].Point + vEndDir * firstLength;

		SplineNode lastNode = new SplineNode(mNodes[mNodes.Count - 1] as SplineNode);
		lastNode.Point = mNodes[0].Point + vInitDir * lastLength;

		mNodes.Insert(0, firstNode);
		mNodes.Add(lastNode);
	}

	float mCurrentTime;
	int mCurrentIdx = 1;

	void Update()
	{

        if (mState == "Reset" || mState == "Stopped" || mNodes.Count < 4)
			return;

		mCurrentTime += Time.deltaTime;

		// We advance to next point in the path
		if (mCurrentTime >= mNodes[mCurrentIdx + 1].Time)
		{
			if (mCurrentIdx < mNodes.Count - 3)
			{
				mCurrentIdx++;
			}
			else
			{
				if (mState != "Loop")
				{
					mState = "Stopped";

					// We stop right in the end point
					transform.position = mNodes[mNodes.Count - 2].Point;

					if (mRotations)
						transform.rotation = mNodes[mNodes.Count - 2].Rot;

					// We call back to inform that we are ended
					if (mOnEndCallback != null)
						mOnEndCallback();
				}
				else
				{
					mCurrentIdx = 1;
					mCurrentTime = 0;
				}
			}
		}

		if (mState != "Stopped")
		{
			// Calculates the t param between 0 and 1
			float param = (mCurrentTime - mNodes[mCurrentIdx].Time) / (mNodes[mCurrentIdx + 1].Time - mNodes[mCurrentIdx].Time);

			// Smooth the param
			param = MathUtils.Ease(param, mNodes[mCurrentIdx].EaseIO.x, mNodes[mCurrentIdx].EaseIO.y);

			transform.position = GetHermiteInternal(mCurrentIdx, param);

			if (mRotations)
			{
				transform.rotation = GetSquad(mCurrentIdx, param);
			}
		}
	}

	Quaternion GetSquad(int idxFirstPoint, float t)
	{
		Quaternion Q0 = mNodes[idxFirstPoint - 1].Rot;
		Quaternion Q1 = mNodes[idxFirstPoint].Rot;
		Quaternion Q2 = mNodes[idxFirstPoint + 1].Rot;
		Quaternion Q3 = mNodes[idxFirstPoint + 2].Rot;

		Quaternion T1 = MathUtils.GetSquadIntermediate(Q0, Q1, Q2);
		Quaternion T2 = MathUtils.GetSquadIntermediate(Q1, Q2, Q3);

		return MathUtils.GetQuatSquad(t, Q1, Q2, T1, T2);
	}

	public Vector3 GetHermiteInternal(int idxFirstPoint, float t)
	{
		float t2 = t * t;
		float t3 = t2 * t;

		Vector3 P0 = mNodes[idxFirstPoint - 1].Point;
		Vector3 P1 = mNodes[idxFirstPoint].Point;
		Vector3 P2 = mNodes[idxFirstPoint + 1].Point;
		Vector3 P3 = mNodes[idxFirstPoint + 2].Point;

		float tension = 0.5f;	// 0.5 equivale a catmull-rom

		Vector3 T1 = tension * (P2 - P0);
		Vector3 T2 = tension * (P3 - P1);

		float Blend1 = 2 * t3 - 3 * t2 + 1;
		float Blend2 = -2 * t3 + 3 * t2;
		float Blend3 = t3 - 2 * t2 + t;
		float Blend4 = t3 - t2;

		return Blend1 * P1 + Blend2 * P2 + Blend3 * T1 + Blend4 * T2;
	}

	public Vector3 GetHermiteAtTime(float timeParam)
	{
		if (timeParam >= mNodes[mNodes.Count - 2].Time)
			return mNodes[mNodes.Count - 2].Point;

		int c;
		for (c = 1; c < mNodes.Count - 2; c++)
		{
			if (mNodes[c].Time > timeParam)
				break;
		}

		int idx = c - 1;
		float param = (timeParam - mNodes[idx].Time) / (mNodes[idx + 1].Time - mNodes[idx].Time);
		param = MathUtils.Ease(param, mNodes[idx].EaseIO.x, mNodes[idx].EaseIO.y);

		return GetHermiteInternal(idx, param);
	}
}

redpajama_set_name: RedPajamaGithub


text:
#pragma once

#include <cstdint>

#include "controls/control.hpp"

namespace ts
{
  namespace stage
  {
    class Stage;

    namespace messages
    {
      struct StageLoaded
      {
        const Stage* stage_ptr;
      };

      struct ControlUpdate
      {
        std::uint32_t stage_time;
        std::uint16_t controllable_id;
        controls::ControlsMask controls_mask;
      };
    }
  }
}


text:
package io.grpc;

import javax.annotation.Nullable;

/**
 * {@link Status} in RuntimeException form, for propagating Status information via exceptions.
 *
 * @see StatusException
 */
public class StatusRuntimeException extends RuntimeException {

  private static final long serialVersionUID = 1950934672280720624L;
  private final Status status;
  private final Metadata trailers;

  public StatusRuntimeException(Status status) {
    this(status, null);
  }

  /**
   * Constructs the exception with both a status and trailers.
   */
  @ExperimentalApi
  public StatusRuntimeException(Status status, @Nullable Metadata trailers) {
    super(Status.formatThrowableMessage(status), status.getCause());
    this.status = status;
    this.trailers = trailers;
  }

  /**
   * Returns the status code as a {@link Status} object.
   */
  public final Status getStatus() {
    return status;
  }

  /**
   * Returns the received trailers.
   */
  @ExperimentalApi
  public final Metadata getTrailers() {
    return trailers;
  }
}


text:
using FatturaElettronica.Common;
using FatturaElettronica.Tabelle;
using FatturaElettronica.Validators;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tests
{
    [TestClass]
    public class IdFiscaleValidator
        : BaseClass<IdFiscaleIVA, IdFiscaleIVAValidator>
    {

        [TestMethod]
        public void IdPaeseIsRequired()
        {
            AssertRequired(x => x.IdPaese);
        }
        [TestMethod]
        public void IdPaeseOnlyAcceptsTableValues()
        {
            AssertOnlyAcceptsTableValues<IdPaese>(x => x.IdPaese);
        }
        [TestMethod]
        public void IdCodiceIsRequired()
        {
            AssertRequired(x => x.IdCodice);
        }
        [TestMethod]
        public void IdCodiceMinMaxLength()
        {
            AssertMinMaxLength(x => x.IdCodice, 1, 28);
        }
    }
}


text:
<?php

namespace Chamilo\Libraries\Console\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Translation\Translator;

/**
 * Abstract base for a command in chamilo. Includes the translator
 *
 * @author Sven Vanpoucke - Hogeschool Gent
 */
abstract class ChamiloCommand extends Command
{
    /**
     * The translator
     *
     * @var \Symfony\Component\Translation\Translator
     */
    protected $translator;

    /**
     * Constructor
     *
     * @param Translator $translator
     */
    public function __construct(Translator $translator)
    {
        $this->translator = $translator;

        parent::__construct();
    }
}


text:
BASEDIR=$(dirname $0)
watchify ${BASEDIR}/js/clusterrunner_timeline_main.js -v -d -o ${BASEDIR}/clusterrunner_timeline.js


text:
@implementation RORequestParam
@synthesize method = _method;
@synthesize format = _format;
@synthesize apiVersion = _apiVersion;
@synthesize apiKey = _apiKey;
@synthesize sessionKey = _sessionKey;
@synthesize callID = _callID;
@synthesize sig = _sig;
@synthesize xn_ss = _xn_ss;

-(id)init
{
	if (self = [super init]) {
		self.format = [NSString stringWithFormat:@"JSON"];
		self.apiVersion = kSDKversion;
		self.xn_ss = [NSString stringWithFormat:@"1"];
	}

	return self;
}

-(NSMutableDictionary*)requestParamToDictionary
{
	NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:self.format,@"format",
																						self.apiVersion,@"v",
																						self.method,@"method",
																						self.apiKey,@"api_key",
																						self.sessionKey,@"session_key",
																						self.callID,@"call_id",
																						self.xn_ss,@"xn_ss",nil];

	if (self.sig != nil && ![self.sig isEqualToString:@""]) {
		[dictionary setObject:self.sig forKey:@"sig"];
	}

	[self addParamToDictionary:dictionary];

	return dictionary;
}

-(void)addParamToDictionary:(NSMutableDictionary*)dictionary
{
	return;
}

-(ROResponse*)requestResultToResponse:(id)result
{
	id responseObject = nil;
	if (![result isKindOfClass:[NSArray class]]) {
		if ([result objectForKey:@"error"] != nil) {
			responseObject = [ROError errorWithOAuthResult:result];
			return [ROResponse responseWithError:responseObject];
		}
	}

	return [ROResponse responseWithRootObject:result];
}

-(void)dealloc
{
	self.method = nil;
	self.format = nil;
	self.apiVersion = nil;
	self.apiKey = nil;
	self.sessionKey = nil;
	self.callID = nil;
	self.sig = nil;
	self.xn_ss = nil;
	[super dealloc];
}

@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace KitchenTimer
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new KitchenTimer());
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace DCarbone\PHPConsulAPI\Operator;

use DCarbone\Go\Time;
use DCarbone\PHPConsulAPI\AbstractModel;
use DCarbone\PHPConsulAPI\Transcoding;

/**
 * Class SerfMember
 */
class SerfMember extends AbstractModel
{
    protected const FIELDS = [
        self::FIELD_RTT => [
            Transcoding::FIELD_UNMARSHAL_CALLBACK => Transcoding::UNMARSHAL_DURATION,
        ],
    ];

    private const FIELD_RTT = 'RTT';

    /** @var string */
    public string $ID = '';
    /** @var string */
    public string $Name = '';
    /** @var string */
    public string $Addr = '';
    /** @var int */
    public int $Port = 0;
    /** @var string */
    public string $Datacenter = '';
    /** @var string */
    public string $Role = '';
    /** @var string */
    public string $Build = '';
    /** @var int */
    public int $Protocol = 0;
    /** @var string */
    public string $Status = '';
    /** @var \DCarbone\Go\Time\Duration */
    public Time\Duration $RTT;

    /**
     * SerfMember constructor.
     * @param array|null $data
     */
    public function __construct(?array $data = [])
    {
        parent::__construct($data);
        if (!isset($this->RTT)) {
            $this->RTT = new Time\Duration(0);
        }
    }

    /**
     * @return string
     */
    public function getID(): string
    {
        return $this->ID;
    }

    /**
     * @param string $ID
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setID(string $ID): self
    {
        $this->ID = $ID;
        return $this;
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->Name;
    }

    /**
     * @param string $Name
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setName(string $Name): self
    {
        $this->Name = $Name;
        return $this;
    }

    /**
     * @return string
     */
    public function getAddr(): string
    {
        return $this->Addr;
    }

    /**
     * @param string $Addr
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setAddr(string $Addr): self
    {
        $this->Addr = $Addr;
        return $this;
    }

    /**
     * @return int
     */
    public function getPort(): int
    {
        return $this->Port;
    }

    /**
     * @param int $Port
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setPort(int $Port): self
    {
        $this->Port = $Port;
        return $this;
    }

    /**
     * @return string
     */
    public function getDatacenter(): string
    {
        return $this->Datacenter;
    }

    /**
     * @param string $Datacenter
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setDatacenter(string $Datacenter): self
    {
        $this->Datacenter = $Datacenter;
        return $this;
    }

    /**
     * @return string
     */
    public function getRole(): string
    {
        return $this->Role;
    }

    /**
     * @param string $Role
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setRole(string $Role): self
    {
        $this->Role = $Role;
        return $this;
    }

    /**
     * @return string
     */
    public function getBuild(): string
    {
        return $this->Build;
    }

    /**
     * @param string $Build
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setBuild(string $Build): self
    {
        $this->Build = $Build;
        return $this;
    }

    /**
     * @return int
     */
    public function getProtocol(): int
    {
        return $this->Protocol;
    }

    /**
     * @param int $Protocol
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setProtocol(int $Protocol): self
    {
        $this->Protocol = $Protocol;
        return $this;
    }

    /**
     * @return string
     */
    public function getStatus(): string
    {
        return $this->Status;
    }

    /**
     * @param string $Status
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setStatus(string $Status): self
    {
        $this->Status = $Status;
        return $this;
    }

    /**
     * @return \DCarbone\Go\Time\Duration
     */
    public function getRTT(): Time\Duration
    {
        return $this->RTT;
    }

    /**
     * @param \DCarbone\Go\Time\Duration $RTT
     * @return \DCarbone\PHPConsulAPI\Operator\SerfMember
     */
    public function setRTT(Time\Duration $RTT): self
    {
        $this->RTT = $RTT;
        return $this;
    }
}


text:
[![GitHub license](https://img.shields.io/github/license/teetime-framework/TeeTime.svg)](https://github.com/teetime-framework/TeeTime/blob/master/LICENSE.txt)
[![Javadocs](https://javadoc.io/badge/net.sourceforge.teetime/teetime.svg?color=blue)](https://javadoc.io/doc/net.sourceforge.teetime/teetime)

# TeeTime

This project contains the Java reference implementation of the Pipe-and-Filter framework TeeTime.

Informations on how to use it can be found on http://teetime-framework.github.io.

## Getting Started

- [Wiki](https://teetime-framework.github.io/wiki/home.html)
- [Source Code Examples](https://github.com/teetime-framework/TeeTime/tree/master/src/test/java/teetime/examples)

## How to Add TeeTime as Dependency to Your Project?

Please visit the download section on our website: http://teetime-framework.github.io/download.html

## Build TeeTime by Yourself

TeeTime requires an existing Maven and JDK installation.

Simply execute "mvn install" and you are good to go!


text:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using DataLayer;
using MonoMac.AppKit;
using MonoMac.Foundation;

namespace AnalyticsVisualization
{
	internal sealed class VisualizationDataSource : NSTableViewDataSource
	{
		public VisualizationDataSource(IEnumerable<Region> regions)
		{
			_regions = regions.ToList().AsReadOnly();
		}

		public override int GetRowCount(NSTableView tableView)
		{
			return _regions.Count;
		}

		public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row)
		{
			if (tableColumn.HeaderCell.StringValue == "Region")
				return new NSString(_regions[row].Name);
			if (tableColumn.HeaderCell.StringValue == "Mac Users")
				return new NSNumber(_regions[row].MacUsers);

			return new NSNumber(_regions[row].WindowsUsers);
		}

		readonly ReadOnlyCollection<Region> _regions;
	}
}


text:
Ruby-static-checker (a simple Ruby bugfinding tool)
===================================================

It drives me crazy that my most common bug in Ruby is a name
error. Maybe I typo a variable, or maybe I rename a class name in
every location except for one, or maybe a cosmic ray flips a bit in my
source before I commit. These are all mistakes that would be caught in
a more static language like C or Java.

As ruby-static-checker shows, there's no inherent reason we can't have
a static checker to help catch these sorts of bugs. Because Ruby is so
dynamic, it is impossible to write a checker with 100% accuracy
(you'll always be able to write byzantine programs that do crazy
method redefinitions at runtime). But given a reasonable codebase, you
should be able to write a tool to find name errors with a reasonable
amount of certainty.

Ruby-static-checker is a static bugfinding tool for
Ruby. Ruby-static-checker's goal is to provide a simple set of sanity
checks (starting with name error detection) for existing codebases
without requiring any additional programmer work. This means you
should be able to, without modifying your application, run

```shell
ruby-static-checker /path/to/mainfile.rb
```

And have the static analysis Just Work.

Note that we don't actually completely achieve this
goal. Ruby-static-checker does require your codebase to load all
required code but not execute the program if loaded as a library (use
something like "main if $0 == __FILE__" to get this property). You
can't have everything.

What does it do?
----------------

At the moment, ruby-static-checker just searches for name errors in
your code. It's possible I'll make it do other things in the future.

Ruby-static-checker can find bugs like in the following (contrived) example:

```ruby
class A
  def self.foo
    baz = 1
    # Whoops, typod 'baz'!
    puts bas
  end
end
```

The output of this should be (yes, I know, this output could be way better):

```shell
gdb@fire-hazard:~$ ruby-static-checker /path/to/a.rb
Possible name error while calling A.bas
```

The current implementation is very barebones. It does have some false
positives (and given the dynamic nature of Ruby, there's basically
always going to be some false rate in either direction) but I've
already used it to find real bugs.

How does it work?
-----------------

Magic!

Well, really, how does it work?
-------------------------------

Ruby-static-checker requires the path you give it, thus loading its
code into memory. Any load-time class and method generation and any
requires are carried out. We then iterate over all newly created
classes, analyzing the ASTs of their methods (using the most excellent
ParseTree library).

This has the benefit that we don't need to statically determine what
the requires graph will look like. Obviously people can always require
more files at runtime, but that's relatively rare so we don't try to
address that case.

Are there any other static analysis tools for Ruby out there?
-------------------------------------------------------------

Yes. Some of the cooler ones are druby, reek, and roodi.

Limitations
-----------

Tested on Ruby 1.8. I added handling of AST nodes as I encountered
them in actual code, so it's likely there are some more esoteric nodes
that I missed.

I'd love to contribute. Are patches welcome?
--------------------------------------------

Glad to hear it! Patches are indeed most welcome. Just open a pull
request on Github.


text:
package com.bibabo.resolver;

import com.bibabo.entity.MovieCoverInfo;
import com.bibabo.entity.QQListInfoResult;
import com.bibabo.entity.SummaryInfo;
import com.bibabo.framework.utils.JSONUtils;
import com.bibabo.framework.utils.LogUtils;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.reactivestreams.Publisher;

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

import io.reactivex.Flowable;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Function;

/**
 * vip电影内容解析
 * https://v.qq.com/x/cover/2xxul4n2j8y0rxi/a0024c3w6lf.html?new=1
 *
 * @param <T>
 */
public class VipVideoHtmlResolver<T, F> implements Function<T, Publisher<F>> {
    @Override
    public Publisher<F> apply(@NonNull T source) throws Exception {
        String htmlString = String.valueOf(source);
        String beginStr = "var COVER_INFO = ";
        String endStr = "COLUMN_INFO";
        htmlString = htmlString.substring(htmlString.indexOf(beginStr) + beginStr.length(), htmlString.indexOf(endStr) - 4);
        MovieCoverInfo result = JSONUtils.fromJsonString(htmlString, MovieCoverInfo.class);
        return Flowable.just((F) result);
    }

}


text:
/*
 * main.css for wobmail
 * File that should contain all common css for wobmail
 * Jonny Meijer 2008-04-13
 */

body {
	background-color: #F9F9F9;
	font-family: Arial, sans-serif;
	font-size: 10pt;
}

table {
	font-family: Arial, sans-serif;
	font-size: 10pt;
}

div.XWMlistOperations {
	padding: 3px;
}

input.XWMsubmitButton {
	background-color: #FFAE0E;
	border: 1px solid #666;
	color: black;
	font-weight: bold;
}

table.XWMmessageList {
	background-color: white;
	border: 1px solid #999999;
	width: 100%;
	border-spacing: 0px;
}

table.XWMmessageList tr.XWMlistRowDark {
	background-color: #F9F9F9;
}

table.XWMmessageList tr.XWMlistRowLight {
	background-color: white;
}

table.XWMmessageList tr.XWMlistRowLightSelected {
	background-color: #FFFFCC;
}

table.XWMmessageList tr.XWMheaderListRow th {
	background-image: url("/wobmail/images/listTitleBg.gif");
	background-repeat: repeat-x;
	border-bottom: 1px solid #999999;
	font: bold 8pt Arial, sans-serif;
	height: 15px;
	text-align: left;
}

table.XWMmessageList td {
	padding: 2px;
	font: 10pt Arial, sans-serif;
}

table.XWMmessageList tr:hover td {
	background-color: #CCCCCC;
}


text:
package exporter

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFileStatsReader_Read(t *testing.T) {
	a := assert.New(t)

	uri := "file://" + sampleUwsgiStatsFileName

	reader, err := NewStatsReader(uri, someTimeout)
	a.NoError(err)

	_, ok := reader.(*fileStatsReader)
	a.True(ok)

	uwsgiStats, err := reader.Read()
	a.NoError(err)

	a.Equal(uwsgiStats.Version, "2.0.12")
}


text:
package cc.redpen.validator.sentence;

import cc.redpen.RedPen;
import cc.redpen.RedPenException;
import cc.redpen.config.Configuration;
import cc.redpen.config.Symbol;
import cc.redpen.config.ValidatorConfiguration;
import cc.redpen.model.Document;
import cc.redpen.parser.DocumentParser;
import cc.redpen.parser.LineOffset;
import cc.redpen.parser.SentenceExtractor;
import cc.redpen.validator.BaseValidatorTest;
import cc.redpen.validator.ValidationError;
import org.junit.Test;

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

import static cc.redpen.config.SymbolType.*;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;

public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {

    public SymbolWithSpaceValidatorTest() {
        super("SymbolWithSpace");
    }

    @Test
    public void testNotNeedSpace() throws RedPenException {
        Document document = prepareSimpleDocument("I like apple/orange");

        config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(SLASH, '/'))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(0, errors.get(document).size());
    }

    @Test
    public void testNeedAfterSpace() throws RedPenException {
        Document document = prepareSimpleDocument("I like her:yes it is");

        config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(COLON, ':', "", false, true))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
        assertEquals("Need whitespace after symbol \":\".", errors.get(document).get(0).getMessage());
        assertEquals(10, errors.get(document).get(0).getStartPosition().get().offset);
    }

    @Test
    public void testDoNotNeedAfterSpaceAtTheEndOfSentence() throws RedPenException {
        Document document = prepareSimpleDocument("Hello (world).");

        config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(RIGHT_PARENTHESIS, ')', "", false, true))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(0, errors.get(document).size());
    }

    @Test
    public void testNeedBeforeSpace() throws RedPenException {
        Document document = prepareSimpleDocument("I like her(Nancy) very much.");

        config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(LEFT_PARENTHESIS, '(', "", true, false))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
        assertEquals("Need whitespace before symbol \"(\".", errors.get(document).get(0).getMessage());
        assertEquals(10, errors.get(document).get(0).getStartPosition().get().offset);
    }

    @Test
    public void testNeedSpaceInMultiplePosition() throws RedPenException {
        Document document = prepareSimpleDocument("I like her(Nancy)very much.");

        config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(LEFT_PARENTHESIS, '(', "", true, false))
                .addSymbol(new Symbol(RIGHT_PARENTHESIS, ')', "", false, true))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(2, errors.get(document).size());
        assertEquals(asList("Need whitespace after symbol \")\".", "Need whitespace before symbol \"(\"."),
          errors.get(document).stream().map(ValidationError::getMessage).sorted().collect(toList()));
    }

    @Test
    public void testReturnOnlyOneForHitBothBeforeAndAfter() throws RedPenException {
        Document document = prepareSimpleDocument("I like 1*10.");

        Configuration config = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .addSymbol(new Symbol(ASTERISK, '*', "", true, true))
                .build();

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
        assertEquals("Need whitespace before and after symbol \"*\".", errors.get(document).get(0).getMessage());
    }

    @Test
    public void testErrorBeforePosition() throws RedPenException {
        String sampleText = "I like her(Nancy) very much.";
        Configuration configuration = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .build();
        DocumentParser parser = DocumentParser.MARKDOWN;
        List<Document> documents = new ArrayList<>();
        Document document  = parser.parse(
                sampleText, new SentenceExtractor(configuration.getSymbolTable()),
                configuration.getTokenizer());
        documents.add(document);

        RedPen redPen = new RedPen(configuration);
        List<ValidationError> errors = redPen.validate(documents).get(documents.get(0));
        assertEquals(1, errors.size());
        assertEquals("SymbolWithSpace", errors.get(0).getValidatorName());
        assertEquals(new LineOffset(1, 10), errors.get(0).getStartPosition().get());
        assertEquals(new LineOffset(1, 11), errors.get(0).getEndPosition().get());
    }

    @Test
    public void testErrorAfterPosition() throws RedPenException {
        String sampleText = "I like her (Nancy)very much.";
        Configuration configuration = Configuration.builder()
                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                .build();
        DocumentParser parser = DocumentParser.MARKDOWN;
        List<Document> documents = new ArrayList<>();
        Document document  = parser.parse(
                sampleText, new SentenceExtractor(configuration.getSymbolTable()),
                configuration.getTokenizer());
        documents.add(document);

        RedPen redPen = new RedPen(configuration);
        List<ValidationError> errors = redPen.validate(documents).get(documents.get(0));
        assertEquals(1, errors.size());
        assertEquals("SymbolWithSpace", errors.get(0).getValidatorName());
        assertEquals(new LineOffset(1, 17), errors.get(0).getStartPosition().get());
        assertEquals(new LineOffset(1, 18), errors.get(0).getEndPosition().get());
    }
}


text:
module TestRail
  class Client
    # Methods for the Results API
    # Use the following API methods to request details about test results and to add new test results.
    #
    # @see http://docs.gurock.com/testrail-api2/reference-results
    module Results
      #
      # Returns a list of test results for a test.
      #
      # @param [Integer, String] test_id  The ID of the test
      # @return a list of test results for a test
      # @see http://docs.gurock.com/testrail-api2/reference-results#get_results
      def results(test_id)
        get("get_results/#{test_id}")
      end

      #
      # Returns a list of test results for a test run and case combination.
      # The difference to get_results is that this method expects a test run + test case instead of a test. In TestRail,
      # tests are part of a test run and the test cases are part of the related test suite.
      # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
      # You can therefore think of a test as an "instance" of a test case which can have test results, comments and a test status.
      # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
      #
      # This method uses the same response format as get_results.
      #
      # :run_id	The ID of the test run
      # :case_id	The ID of the test case
      #
      def results_for_case(run_id, case_id)
        get("get_results_for_case/#{run_id}/#{case_id}")
      end

      #
      # Returns a list of test results for a test run.
      #
      # :run_id	The ID of the test run
      #
      def results_for_run(run_id)
        get("get_results_for_run/#{run_id}")
      end

      # TODO: add custom fields docs
      #
      # Adds a new test result, comment or assigns a test.
      # It's recommended to use #add_results instead if you plan to add results for multiple tests.
      #
      # @param [Integer, String] test_id  The ID of the test the result should be added to
      # @param data [Hash]: Optional query data
      # @option data [Integer, String] :status_id The ID of the test status. The built-in system statuses have the
      # following IDs:
      # 1 Passed
      # 2 Blocked
      # 3 Untested (not allowed when adding a result)
      # 4 Retest
      # 5 Failed
      # You can get a full list of system and custom statuses via #TestRail#Client#Statuses#get_statuses.
      # @option data [String] :comment The comment / description for the test result
      # @option data [String] :version The version or build you tested against
      # @option data [String] :elapsed The time it took to execute the test, e.g. "30s" or "1m 45s"
      # @option data [Array<Integer>, Array<String>] :defects A comma-separated list of defects to link to the test result
      # @option data [Integer, String] :assignedto_id The ID of a user the test should be assigned to
      # @return the new test result using the same response format as get_results, but with a single result instead of a list of results.
      # @see http://docs.gurock.com/testrail-api2/reference-results#add_result
      def add_result(test_id, data = {})
        post("add_result/#{test_id}", body: data.to_json)
      end

      #
      # Adds a new test result, comment or assigns a test (for a test run and case combination).
      # It's recommended to use add_results_for_cases instead if you plan to add results for multiple test cases.
      # The difference to add_result is that this method expects a test run + test case instead of a test.
      # In TestRail, tests are part of a test run and the test cases are part of the related test suite.
      # So, when you create a new test run, TestRail creates a test for each test case found in the test suite of the run.
      # You can therefore think of a test as an "instance" of a test case which can have test results, comments and a test status.
      # Please also see TestRail's getting started guide for more details about the differences between test cases and tests.
      #
      # This method supports the same POST fields as add_result.
      #
      # :run_id   The ID of the test run
      # :case_id  The ID of the test case
      #
      def add_result_for_case(run_id, case_id, data = {})
        post("add_result_for_case/#{run_id}/#{case_id}", body: data.to_json)
      end

      #
      # Adds a new test result, comment or assigns a test.
      # It's recommended to use add_results instead if you plan to add results for multiple tests.
      #
      # :run_id	The ID of the test run
      #
      def add_results(run_id, data = {})
        post("add_results/#{run_id}", body: data.to_json)
      end

      #
      # Adds one or more new test results, comments or assigns one or more tests (using the case IDs).
      # Ideal for test automation to bulk-add multiple test results in one step.
      #
      # :run_id The ID of the test run the results should be added to
      #
      def add_results_for_cases(run_id, data = {})
        post("add_results_for_cases/#{run_id}", body: data.to_json)
      end
    end
  end
end


text:
package com.mcleodmoores.starling.client.marketdata;

import com.opengamma.util.NamedInstance;

/**
 * Class to represent an entity that provides data to a data source.  Examples might be Barclays as a provider to Bloomberg as
 * a data source.
 */
public final class DataProvider implements NamedInstance {
  /**
   * Default value.
   */
  public static final DataProvider DEFAULT = DataProvider.of("DEFAULT");
  /** The data provider name */
  private final String _providerName;

  /**
   * Restricted constructor.
   * @param providerName  the provider name, not null
   */
  private DataProvider(final String providerName) {
    _providerName = providerName;
  }

  /**
   * Public factory method for looking up instances of DataProvider by name, or creating new instances if they don't exist.
   * @param providerName  the name of the data provider, not null
   * @return an existing instance if one already available or a new instance if one not available, not null
   */
  public static DataProvider of(final String providerName) {
    return DataProviderFactory.INSTANCE.of(providerName);
  }

  /**
   * Package protected parse method, used by factory to create instances.  Do not call except from Factory.
   * Specifically, this method will create new instances rather than returning existing instances.
   * @param providerName  the name of the provider
   * @return an instance.
   */
  static DataProvider parse(final String providerName) {
    return new DataProvider(providerName);
  }

  /**
   * @return the name of the data provider
   */
  @Override
  public String getName() {
    return _providerName;
  }

  @Override
  public boolean equals(final Object other) {
    if (other == this) {
      return true;
    }
    if (!(other instanceof DataProvider)) { // remember instanceof handles null...
      return false;
    }
    final DataProvider dataField = (DataProvider) other;
    return _providerName.equals(dataField._providerName);
  }

  @Override
  public int hashCode() {
    return _providerName.hashCode();
  }

  @Override
  public String toString() {
    return getName();
  }
}