text:
import os.path
import time

import webob
import webob.dec
import webob.exc

from neutron.agent.linux import dhcp
from neutron.agent.linux import utils
from neutron.tests.common import machine_fixtures
from neutron.tests.common import net_helpers
from neutron.tests.functional.agent.l3 import framework
from neutron.tests.functional.agent.linux import helpers

METADATA_REQUEST_TIMEOUT = 60
METADATA_REQUEST_SLEEP = 5

class MetadataFakeProxyHandler(object):

    def __init__(self, status):
        self.status = status

    @webob.dec.wsgify()
    def __call__(self, req):
        return webob.Response(status=self.status)

class MetadataL3AgentTestCase(framework.L3AgentTestFramework):

    SOCKET_MODE = 0o644

    def _create_metadata_fake_server(self, status):
        server = utils.UnixDomainWSGIServer('metadata-fake-server')
        self.addCleanup(server.stop)

        # NOTE(cbrandily): TempDir fixture creates a folder with 0o700
        # permissions but metadata_proxy_socket folder must be readable by all
        # users
        self.useFixture(
            helpers.RecursivePermDirFixture(
                os.path.dirname(self.agent.conf.metadata_proxy_socket), 0o555))
        server.start(MetadataFakeProxyHandler(status),
                     self.agent.conf.metadata_proxy_socket,
                     workers=0, backlog=4096, mode=self.SOCKET_MODE)

    def _query_metadata_proxy(self, machine):
        url = 'http://%(host)s:%(port)s' % {'host': dhcp.METADATA_DEFAULT_IP,
                                            'port': dhcp.METADATA_PORT}
        cmd = 'curl', '--max-time', METADATA_REQUEST_TIMEOUT, '-D-', url
        i = 0
        CONNECTION_REFUSED_TIMEOUT = METADATA_REQUEST_TIMEOUT // 2
        while i <= CONNECTION_REFUSED_TIMEOUT:
            try:
                raw_headers = machine.execute(cmd)
                break
            except RuntimeError as e:
                if 'Connection refused' in str(e):
                    time.sleep(METADATA_REQUEST_SLEEP)
                    i += METADATA_REQUEST_SLEEP
                else:
                    self.fail('metadata proxy unreachable '
                              'on %s before timeout' % url)

        if i > CONNECTION_REFUSED_TIMEOUT:
            self.fail('Timed out waiting metadata proxy to become available')
        return raw_headers.splitlines()[0]

    def test_access_to_metadata_proxy(self):
        """Test access to the l3-agent metadata proxy.

        The test creates:
         * A l3-agent metadata service:
           * A router (which creates a metadata proxy in the router namespace),
           * A fake metadata server
         * A "client" namespace (simulating a vm) with a port on router
           internal subnet.

        The test queries from the "client" namespace the metadata proxy on
        http://169.254.169.254 and asserts that the metadata proxy added
        the X-Forwarded-For and X-Neutron-Router-Id headers to the request
        and forwarded the http request to the fake metadata server and the
        response to the "client" namespace.
        """
        router_info = self.generate_router_info(enable_ha=False)
        router = self.manage_router(self.agent, router_info)
        self._create_metadata_fake_server(webob.exc.HTTPOk.code)

        # Create and configure client namespace
        router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
        br_int = framework.get_ovs_bridge(
            self.agent.conf.ovs_integration_bridge)

        machine = self.useFixture(
            machine_fixtures.FakeMachine(
                br_int,
                net_helpers.increment_ip_cidr(router_ip_cidr),
                router_ip_cidr.partition('/')[0]))

        # Query metadata proxy
        firstline = self._query_metadata_proxy(machine)

        # Check status code
        self.assertIn(str(webob.exc.HTTPOk.code), firstline.split())

class UnprivilegedUserMetadataL3AgentTestCase(MetadataL3AgentTestCase):
    """Test metadata proxy with least privileged user.

    The least privileged user has uid=65534 and is commonly named 'nobody' but
    not always, that's why we use its uid.
    """

    SOCKET_MODE = 0o664

    def setUp(self):
        super(UnprivilegedUserMetadataL3AgentTestCase, self).setUp()
        self.agent.conf.set_override('metadata_proxy_user', '65534')
        self.agent.conf.set_override('metadata_proxy_watch_log', False)

class UnprivilegedUserGroupMetadataL3AgentTestCase(MetadataL3AgentTestCase):
    """Test metadata proxy with least privileged user/group.

    The least privileged user has uid=65534 and is commonly named 'nobody' but
    not always, that's why we use its uid.
    Its group has gid=65534 and is commonly named 'nobody' or 'nogroup', that's
    why we use its gid.
    """

    SOCKET_MODE = 0o666

    def setUp(self):
        super(UnprivilegedUserGroupMetadataL3AgentTestCase, self).setUp()
        self.agent.conf.set_override('metadata_proxy_user', '65534')
        self.agent.conf.set_override('metadata_proxy_group', '65534')
        self.agent.conf.set_override('metadata_proxy_watch_log', False)


text:
User.create!(login: 'gustavo', password: '123456', password_confirmation: '123456')
User.create!(login: 'bernardo', password: 'bernardo123', password_confirmation: 'bernardo123')

redpajama_set_name: RedPajamaGithub


text:
'use strict';

// Unit test cases


text:
{% extends 'base.html' %}
{% load render_table from django_tables2 %}

{% block content %}

User {{ object }}

            Edit User
            Delete User

                <legend>Stats</legend>

Name

{{ object.first_name }} {{ object.last_name }}

Status

{{ object.is_active|yesno:"Active,Disabled" }}

User Level

{{ object.group_strigify }}

Theme

{{ object.template|default:"Default" }}

Last Sign In

{{ object.last_login }}

                <fieldset>
                    <legend>Recent Deployments</legend>
                    {% render_table deployment_table %}
                </fieldset>

{% endblock content %}


text:
package com.person.camel.beans;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.dataformat.JsonLibrary;

public class RestToBeanRouter extends RouteBuilder {

    @Override
    public void configure() throws Exception {

        from ("cxfrs://bean://rsServer")
                .multicast()
                .parallelProcessing()
                .aggregationStrategy(new ResultAggregator())
                .beanRef("restServiceImpl", "getJsonResponseResult")
                .end()
                .marshal().json(JsonLibrary.Jackson)
                .to("log://camelLogger?level=DEBUG");
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Chicago</title>
    <meta name="description" content="" />

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

    <link rel="shortcut icon" href="https://lichengzhu.github.io/blog/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//lichengzhu.github.io/blog/themes/casper/assets/css/screen.css?v=1486484557270" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://lichengzhu.github.io/blog/2017/02/05/Where-it-begins.html" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="Licheng's blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Chicago" />
    <meta property="og:description" content="Before I became a UX person, I spent a good chunk of my life in Chicago, specifically at University of Chicago. But if you ask me to give it a Facebook status, it will for sure be "it's complicated." Chicago is perhaps the most prolific and rewarding intellectual adventure" />
    <meta property="og:url" content="https://lichengzhu.github.io/blog/2017/02/05/Where-it-begins.html" />
    <meta property="article:tag" content="Life" />
    <meta property="article:tag" content=" UX" />

    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Chicago" />
    <meta name="twitter:description" content="Before I became a UX person, I spent a good chunk of my life in Chicago, specifically at University of Chicago. But if you ask me to give it a Facebook status, it will for sure be "it's complicated." Chicago is perhaps the most prolific and rewarding intellectual adventure" />
    <meta name="twitter:url" content="https://lichengzhu.github.io/blog/2017/02/05/Where-it-begins.html" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="Licheng's blog" href="https://lichengzhu.github.io/blog/rss/" />

Chicago

                <time class="post-date" datetime="2017-02-05">05 February 2017</time>  on Life,  UX

Before I became a UX person, I spent a good chunk of my life in Chicago, specifically at University of Chicago. But if you ask me to give it a Facebook status, it will for sure be "it's complicated."

Chicago is perhaps the most prolific and rewarding intellectual adventure of my life, as well as most socially and mentally messed up one. I gained my academic identity as a computational sociologist along with my obsession with organizational and social network theories. What I lost was my power to go on as an academic. In countless days, when I walked out from Regenstein Library at 3:30 A.M., I took a deep breath of south Chicago's winter air, and rejoiced that at least I survived the another day. I secretly swore to myself: If I was going to write another word, another single freaking word, I would smash my expensive laptop to the wall, and get a good cry in the library's hall way. But who I am kidding? There are always more writing and reading, and I will predictably get hyped about new knowledge and my research, my deep deep pride, until 3:30 next morning.

I forget the exact scene where I was brainwashed into the realm of social networks and computational sociology, but I am sure it must be in Professor Padgett's class — my advisor, a clever brain, that I own much to. I don't know if it was because of my constant bombardment of questions in his class — he actually more than once asked me to stop — or my effort to explain my concept of non-linearity in aggregated social emotions with my broken English, he did not say no to my request of adviorship. Contrarily, he simply raised his pen and said "Do I sign here?" before I even finished my sentence.

Funny, I think even till now he can not remember my name. "Hey, it's you"  becomes our version of "hey dude" as the conversation starter. Yet I haven't regretted any seconds I spent with him. Through him, I have come to realize that I have been always thinking like a complex system scholar. Vocabularies such as "emergence", "self-organze system" and "complexity" entered my journey and later dominated my time at Chicago. We used to joke about his influence over me was comparable of how he was effected by James March and that he was "sweet-talked" by Harrison White. Of course, I was not even close to what he had accomplished when he encountered his intellectual Muse — in this case Muses— but, I know, my life was forever changed.

Yet, among all great treasures I found at Chicago, I acquired one thing I took sincerely to my heart. Something not only transformed but also transcended me, a scholar or not, that one has to be true to himself.

I recall the moments I wore my gloomy face in his office, being upset by my parents' marriage issue or simply feeling lost. He pointed out directly that I was not happy, and needed to stop doing whatever "stupid" things that made me feel underachieved. To my surprise, he shared his personal stories about his family and his marriage, which, at the time, sounded like twilight zone of academia to me. He taught me to severe the cord to my pain and focus on whatever I have on hands. Looking back, I was not sure if my eyes turned wet, but I was clear about his message: I need to take care of myself.

Maybe I was right about his subtext, or maybe I was wrong. After all, it was the first time in my life to exchange deep  feelings with any professors, and I never dreamed it would happen at UChicago. I was always trained to think like a scientist, to separate emotions from facts, and to step back from research subjects. As a social scientist, unfortunately, that "subject" is the life around me. I did not anticipate someday I will give a tight hug to what I have left behind, and that makes me feel alive more than ever. My advisor not only taught me how to think, but also how to live --- as a academic, a professional, or someone who doesn’t need to fit into any categories. This, is the ultimately project I have completed at Chicago.

I guess I am truly lucky, for I have studied under a brilliant advisor, and also two incredible recommenders. Professor Edward Laumann, who taught the first-ever sociology class in my life, introduced me to the wonderful world of social networks, organizational studies and sociology of emotions. Whenever I was stuck with my papers, he offered amazingly informative guidance. I even developed an thought that all graduate schools should replace formal classes with office hours and random chat. Talking about out-class interactions, I have to admit I was completely charmed by Professor James Evans for his research, his jokes and his qurky outfit. No one than he has made me think that doing computational sociology is cool. He made me want to talk about my research at dinner table, and brag about it in a birthday party.

Now, I want to stop here. Not only because Starbucks is closing, but also because I don’t want to give you an impression that my time at UChicago is everything that defines me. I tell my story because Chicago has an irreplaceable place in my heart, and now, I am ready to move on.

                licheng's Picture

licheng

Computational sociologist. Research fanatic. HCI and data fanboy. Part-time theory lover. Addicted to root beer.

                    https://www.facebook.com/zhulicheng

Share this post

                    Twitter

                    Facebook

                    Google+

Licheng's blog © 2017

Proudly published with HubPress


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

#if Q8
using QuantumType = System.Byte;
#elif Q16
using QuantumType = System.UInt16;
#elif Q16HDRI
using QuantumType = System.Single;
#else
#error Not implemented!
#endif

namespace ImageMagick
{
    [System.CodeDom.Compiler.GeneratedCode("Magick.NET.FileGenerator", "")]
    public sealed partial class Drawables
    {
        /// <summary>
        /// Applies the DrawableAffine operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="scaleX">The X coordinate scaling element.</param>
        /// <param name="scaleY">The Y coordinate scaling element.</param>
        /// <param name="shearX">The X coordinate shearing element.</param>
        /// <param name="shearY">The Y coordinate shearing element.</param>
        /// <param name="translateX">The X coordinate of the translation element.</param>
        /// <param name="translateY">The Y coordinate of the translation element.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Affine(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY)
        {
            _drawables.Add(new DrawableAffine(scaleX, scaleY, shearX, shearY, translateX, translateY));
            return this;
        }

        /// <summary>
        /// Applies the DrawableAlpha operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="paintMethod">The paint method to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Alpha(double x, double y, PaintMethod paintMethod)
        {
            _drawables.Add(new DrawableAlpha(x, y, paintMethod));
            return this;
        }

        /// <summary>
        /// Applies the DrawableArc operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="startX">The starting X coordinate of the bounding rectangle.</param>
        /// <param name="startY">The starting Y coordinate of thebounding rectangle.</param>
        /// <param name="endX">The ending X coordinate of the bounding rectangle.</param>
        /// <param name="endY">The ending Y coordinate of the bounding rectangle.</param>
        /// <param name="startDegrees">The starting degrees of rotation.</param>
        /// <param name="endDegrees">The ending degrees of rotation.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Arc(double startX, double startY, double endX, double endY, double startDegrees, double endDegrees)
        {
            _drawables.Add(new DrawableArc(startX, startY, endX, endY, startDegrees, endDegrees));
            return this;
        }

        /// <summary>
        /// Applies the DrawableBezier operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Bezier(params PointD[] coordinates)
        {
            _drawables.Add(new DrawableBezier(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawableBezier operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Bezier(IEnumerable<PointD> coordinates)
        {
            _drawables.Add(new DrawableBezier(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawableBorderColor operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="color">The color of the border.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> BorderColor(IMagickColor<QuantumType> color)
        {
            _drawables.Add(new DrawableBorderColor(color));
            return this;
        }

        /// <summary>
        /// Applies the DrawableCircle operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="originX">The origin X coordinate.</param>
        /// <param name="originY">The origin Y coordinate.</param>
        /// <param name="perimeterX">The perimeter X coordinate.</param>
        /// <param name="perimeterY">The perimeter Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Circle(double originX, double originY, double perimeterX, double perimeterY)
        {
            _drawables.Add(new DrawableCircle(originX, originY, perimeterX, perimeterY));
            return this;
        }

        /// <summary>
        /// Applies the DrawableClipPath operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="clipPath">The ID of the clip path.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> ClipPath(string clipPath)
        {
            _drawables.Add(new DrawableClipPath(clipPath));
            return this;
        }

        /// <summary>
        /// Applies the DrawableClipRule operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="fillRule">The rule to use when filling drawn objects.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> ClipRule(FillRule fillRule)
        {
            _drawables.Add(new DrawableClipRule(fillRule));
            return this;
        }

        /// <summary>
        /// Applies the DrawableClipUnits operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="units">The clip path units.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> ClipUnits(ClipPathUnit units)
        {
            _drawables.Add(new DrawableClipUnits(units));
            return this;
        }

        /// <summary>
        /// Applies the DrawableColor operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="paintMethod">The paint method to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Color(double x, double y, PaintMethod paintMethod)
        {
            _drawables.Add(new DrawableColor(x, y, paintMethod));
            return this;
        }

        /// <summary>
        /// Applies the DrawableComposite operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="offset">The offset from origin.</param>
        /// <param name="image">The image to draw.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Composite(IMagickGeometry offset, IMagickImage<QuantumType> image)
        {
            _drawables.Add(new DrawableComposite(offset, image));
            return this;
        }

        /// <summary>
        /// Applies the DrawableComposite operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="image">The image to draw.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Composite(double x, double y, IMagickImage<QuantumType> image)
        {
            _drawables.Add(new DrawableComposite(x, y, image));
            return this;
        }

        /// <summary>
        /// Applies the DrawableComposite operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="offset">The offset from origin.</param>
        /// <param name="compose">The algorithm to use.</param>
        /// <param name="image">The image to draw.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Composite(IMagickGeometry offset, CompositeOperator compose, IMagickImage<QuantumType> image)
        {
            _drawables.Add(new DrawableComposite(offset, compose, image));
            return this;
        }

        /// <summary>
        /// Applies the DrawableComposite operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="compose">The algorithm to use.</param>
        /// <param name="image">The image to draw.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Composite(double x, double y, CompositeOperator compose, IMagickImage<QuantumType> image)
        {
            _drawables.Add(new DrawableComposite(x, y, compose, image));
            return this;
        }

        /// <summary>
        /// Applies the DrawableDensity operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="density">The vertical and horizontal resolution.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Density(double density)
        {
            _drawables.Add(new DrawableDensity(density));
            return this;
        }

        /// <summary>
        /// Applies the DrawableDensity operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="pointDensity">The vertical and horizontal resolution.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Density(PointD pointDensity)
        {
            _drawables.Add(new DrawableDensity(pointDensity));
            return this;
        }

        /// <summary>
        /// Applies the DrawableEllipse operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="originX">The origin X coordinate.</param>
        /// <param name="originY">The origin Y coordinate.</param>
        /// <param name="radiusX">The X radius.</param>
        /// <param name="radiusY">The Y radius.</param>
        /// <param name="startDegrees">The starting degrees of rotation.</param>
        /// <param name="endDegrees">The ending degrees of rotation.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Ellipse(double originX, double originY, double radiusX, double radiusY, double startDegrees, double endDegrees)
        {
            _drawables.Add(new DrawableEllipse(originX, originY, radiusX, radiusY, startDegrees, endDegrees));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFillColor operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="color">The color to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> FillColor(IMagickColor<QuantumType> color)
        {
            _drawables.Add(new DrawableFillColor(color));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFillOpacity operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="opacity">The opacity.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> FillOpacity(Percentage opacity)
        {
            _drawables.Add(new DrawableFillOpacity(opacity));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFillPatternUrl operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="url">Url specifying pattern ID (e.g. "#pattern_id").</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> FillPatternUrl(string url)
        {
            _drawables.Add(new DrawableFillPatternUrl(url));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFillRule operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="fillRule">The rule to use when filling drawn objects.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> FillRule(FillRule fillRule)
        {
            _drawables.Add(new DrawableFillRule(fillRule));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFont operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="family">The font family or the full path to the font file.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Font(string family)
        {
            _drawables.Add(new DrawableFont(family));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFont operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="family">The font family or the full path to the font file.</param>
        /// <param name="style">The style of the font.</param>
        /// <param name="weight">The weight of the font.</param>
        /// <param name="stretch">The font stretching type.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
        {
            _drawables.Add(new DrawableFont(family, style, weight, stretch));
            return this;
        }

        /// <summary>
        /// Applies the DrawableFontPointSize operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="pointSize">The point size.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> FontPointSize(double pointSize)
        {
            _drawables.Add(new DrawableFontPointSize(pointSize));
            return this;
        }

        /// <summary>
        /// Applies the DrawableGravity operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="gravity">The gravity.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Gravity(Gravity gravity)
        {
            _drawables.Add(new DrawableGravity(gravity));
            return this;
        }

        /// <summary>
        /// Applies the DrawableLine operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="startX">The starting X coordinate.</param>
        /// <param name="startY">The starting Y coordinate.</param>
        /// <param name="endX">The ending X coordinate.</param>
        /// <param name="endY">The ending Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Line(double startX, double startY, double endX, double endY)
        {
            _drawables.Add(new DrawableLine(startX, startY, endX, endY));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePath operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="paths">The paths to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Path(params IPath[] paths)
        {
            _drawables.Add(new DrawablePath(paths));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePath operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="paths">The paths to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Path(IEnumerable<IPath> paths)
        {
            _drawables.Add(new DrawablePath(paths));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePoint operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Point(double x, double y)
        {
            _drawables.Add(new DrawablePoint(x, y));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePolygon operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Polygon(params PointD[] coordinates)
        {
            _drawables.Add(new DrawablePolygon(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePolygon operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Polygon(IEnumerable<PointD> coordinates)
        {
            _drawables.Add(new DrawablePolygon(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePolyline operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Polyline(params PointD[] coordinates)
        {
            _drawables.Add(new DrawablePolyline(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePolyline operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Polyline(IEnumerable<PointD> coordinates)
        {
            _drawables.Add(new DrawablePolyline(coordinates));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePopClipPath operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PopClipPath()
        {
            _drawables.Add(new DrawablePopClipPath());
            return this;
        }

        /// <summary>
        /// Applies the DrawablePopGraphicContext operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PopGraphicContext()
        {
            _drawables.Add(new DrawablePopGraphicContext());
            return this;
        }

        /// <summary>
        /// Applies the DrawablePopPattern operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PopPattern()
        {
            _drawables.Add(new DrawablePopPattern());
            return this;
        }

        /// <summary>
        /// Applies the DrawablePushClipPath operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="clipPath">The ID of the clip path.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PushClipPath(string clipPath)
        {
            _drawables.Add(new DrawablePushClipPath(clipPath));
            return this;
        }

        /// <summary>
        /// Applies the DrawablePushGraphicContext operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PushGraphicContext()
        {
            _drawables.Add(new DrawablePushGraphicContext());
            return this;
        }

        /// <summary>
        /// Applies the DrawablePushPattern operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="id">The ID of the pattern.</param>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> PushPattern(string id, double x, double y, double width, double height)
        {
            _drawables.Add(new DrawablePushPattern(id, x, y, width, height));
            return this;
        }

        /// <summary>
        /// Applies the DrawableRectangle operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="upperLeftX">The upper left X coordinate.</param>
        /// <param name="upperLeftY">The upper left Y coordinate.</param>
        /// <param name="lowerRightX">The lower right X coordinate.</param>
        /// <param name="lowerRightY">The lower right Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Rectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY)
        {
            _drawables.Add(new DrawableRectangle(upperLeftX, upperLeftY, lowerRightX, lowerRightY));
            return this;
        }

        /// <summary>
        /// Applies the DrawableRotation operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="angle">The angle.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Rotation(double angle)
        {
            _drawables.Add(new DrawableRotation(angle));
            return this;
        }

        /// <summary>
        /// Applies the DrawableRoundRectangle operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="upperLeftX">The upper left X coordinate.</param>
        /// <param name="upperLeftY">The upper left Y coordinate.</param>
        /// <param name="lowerRightX">The lower right X coordinate.</param>
        /// <param name="lowerRightY">The lower right Y coordinate.</param>
        /// <param name="cornerWidth">The corner width.</param>
        /// <param name="cornerHeight">The corner height.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> RoundRectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY, double cornerWidth, double cornerHeight)
        {
            _drawables.Add(new DrawableRoundRectangle(upperLeftX, upperLeftY, lowerRightX, lowerRightY, cornerWidth, cornerHeight));
            return this;
        }

        /// <summary>
        /// Applies the DrawableScaling operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">Horizontal scale factor.</param>
        /// <param name="y">Vertical scale factor.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Scaling(double x, double y)
        {
            _drawables.Add(new DrawableScaling(x, y));
            return this;
        }

        /// <summary>
        /// Applies the DrawableSkewX operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="angle">The angle.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> SkewX(double angle)
        {
            _drawables.Add(new DrawableSkewX(angle));
            return this;
        }

        /// <summary>
        /// Applies the DrawableSkewY operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="angle">The angle.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> SkewY(double angle)
        {
            _drawables.Add(new DrawableSkewY(angle));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeColor operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="color">The color to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeColor(IMagickColor<QuantumType> color)
        {
            _drawables.Add(new DrawableStrokeColor(color));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeDashArray operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="dash">An array containing the dash information.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeDashArray(params double[] dash)
        {
            _drawables.Add(new DrawableStrokeDashArray(dash));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeDashOffset operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="offset">The dash offset.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeDashOffset(double offset)
        {
            _drawables.Add(new DrawableStrokeDashOffset(offset));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeLineCap operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="lineCap">The line cap.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeLineCap(LineCap lineCap)
        {
            _drawables.Add(new DrawableStrokeLineCap(lineCap));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeLineJoin operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="lineJoin">The line join.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeLineJoin(LineJoin lineJoin)
        {
            _drawables.Add(new DrawableStrokeLineJoin(lineJoin));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeMiterLimit operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="miterlimit">The miter limit.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeMiterLimit(int miterlimit)
        {
            _drawables.Add(new DrawableStrokeMiterLimit(miterlimit));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeOpacity operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="opacity">The opacity.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeOpacity(Percentage opacity)
        {
            _drawables.Add(new DrawableStrokeOpacity(opacity));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokePatternUrl operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="url">Url specifying pattern ID (e.g. "#pattern_id").</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokePatternUrl(string url)
        {
            _drawables.Add(new DrawableStrokePatternUrl(url));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeWidth operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> StrokeWidth(double width)
        {
            _drawables.Add(new DrawableStrokeWidth(width));
            return this;
        }

        /// <summary>
        /// Applies the DrawableText operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <param name="value">The text to draw.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Text(double x, double y, string value)
        {
            _drawables.Add(new DrawableText(x, y, value));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextAlignment operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="alignment">Text alignment.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextAlignment(TextAlignment alignment)
        {
            _drawables.Add(new DrawableTextAlignment(alignment));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextDecoration operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="decoration">The text decoration.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextDecoration(TextDecoration decoration)
        {
            _drawables.Add(new DrawableTextDecoration(decoration));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextDirection operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="direction">Direction to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextDirection(TextDirection direction)
        {
            _drawables.Add(new DrawableTextDirection(direction));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextEncoding operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="encoding">Encoding to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextEncoding(Encoding encoding)
        {
            _drawables.Add(new DrawableTextEncoding(encoding));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextInterlineSpacing operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="spacing">Spacing to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextInterlineSpacing(double spacing)
        {
            _drawables.Add(new DrawableTextInterlineSpacing(spacing));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextInterwordSpacing operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="spacing">Spacing to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextInterwordSpacing(double spacing)
        {
            _drawables.Add(new DrawableTextInterwordSpacing(spacing));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextKerning operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="kerning">Kerning to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextKerning(double kerning)
        {
            _drawables.Add(new DrawableTextKerning(kerning));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextUnderColor operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="color">The color to use.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> TextUnderColor(IMagickColor<QuantumType> color)
        {
            _drawables.Add(new DrawableTextUnderColor(color));
            return this;
        }

        /// <summary>
        /// Applies the DrawableTranslation operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Translation(double x, double y)
        {
            _drawables.Add(new DrawableTranslation(x, y));
            return this;
        }

        /// <summary>
        /// Applies the DrawableViewbox operation to the <see cref="Drawables" />.
        /// </summary>
        /// <param name="upperLeftX">The upper left X coordinate.</param>
        /// <param name="upperLeftY">The upper left Y coordinate.</param>
        /// <param name="lowerRightX">The lower right X coordinate.</param>
        /// <param name="lowerRightY">The lower right Y coordinate.</param>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> Viewbox(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY)
        {
            _drawables.Add(new DrawableViewbox(upperLeftX, upperLeftY, lowerRightX, lowerRightY));
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeAntialias operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> DisableStrokeAntialias()
        {
            _drawables.Add(DrawableStrokeAntialias.Disabled);
            return this;
        }

        /// <summary>
        /// Applies the DrawableStrokeAntialias operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> EnableStrokeAntialias()
        {
            _drawables.Add(DrawableStrokeAntialias.Enabled);
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextAntialias operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> DisableTextAntialias()
        {
            _drawables.Add(DrawableTextAntialias.Disabled);
            return this;
        }

        /// <summary>
        /// Applies the DrawableTextAntialias operation to the <see cref="Drawables" />.
        /// </summary>
        /// <returns>The <see cref="Drawables" /> instance.</returns>
        public IDrawables<QuantumType> EnableTextAntialias()
        {
            _drawables.Add(DrawableTextAntialias.Enabled);
            return this;
        }

    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using beRemote.Core.Common.EventSystem.Events;

namespace beRemote.Core.Common.EventSystem.Handler
{
    public abstract class beRemoteBaseEventListener
    {
        public abstract void DoWork(object o, beRemoteEventArgs e);
    }
}


text:
package mm.model;

public class WorkPlace {

	private int id;
	private String company;
	private String area;
	private int areaId;
	private String city;
	private int cityId;
	private String address;

	public WorkPlace(int id, String company, String area, String city, String address, int areaId, int cityId) {
		super();
		this.id = id;
		this.company = company;
		this.area = area;
		this.city = city;
		this.address = address;
		this.setAreaId(areaId);
		this.setCityId(cityId);
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getCompany() {
		return company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	@Override
	public String toString() {
		return "WorkPlace [id=" + id + ", company=" + company + ", area=" + area + ", city=" + city + ", address="
				+ address + "]";
	}
	public int getAreaId() {
		return areaId;
	}
	public void setAreaId(int areaId) {
		this.areaId = areaId;
	}
	public int getCityId() {
		return cityId;
	}
	public void setCityId(int cityId) {
		this.cityId = cityId;
	}

}


text:
from __future__ import print_function

import errno
import os
import platform
import subprocess
import sys
import unittest

import mock

import tox_pyenv

try:
    unicode
except NameError:
    unicode = str

def touni(s, enc='utf8', err='strict'):
    if isinstance(s, bytes):
        return s.decode(enc, err)
    else:
        return unicode(s or ("" if s is None else s))

class MockTestenvConfig(object):
    def __init__(self, basepython):
        self.basepython = basepython
        self.tox_pyenv_fallback = True

class TestToxPyenvNoPyenv(unittest.TestCase):

    def setUp(self):
        def _mock_popen_func(cmd, *args, **kw):
            if all(x in cmd for x in ['which', '*TEST*']):
                raise OSError(errno.ENOENT, 'No such file or directory')
            self.fail('Unexpected call to Popen')
            # return self.popen_patcher.temp_original(*args, **kw)
        self.popen_patcher = mock.patch.object(
            tox_pyenv.subprocess, 'Popen', autospec=True,
            side_effect=_mock_popen_func,
        )
        self.popen_patcher.start()
        self.warning_patcher = mock.patch.object(
            tox_pyenv.LOG, 'warning', autospec=True,
        )
        self.warning_patcher.start()

    def tearDown(self):
        self.popen_patcher.stop()
        self.warning_patcher.stop()

    def test_logs_if_no_pyenv_binary(self):
        mock_test_env_config = MockTestenvConfig('*TEST*')
        tox_pyenv.tox_get_python_executable(mock_test_env_config)
        expected_popen = [
            mock.call(
                [mock.ANY, 'which', '*TEST*'],
                stderr=-1, stdout=-1,
                universal_newlines=True
            )
        ]
        self.assertEqual(
            tox_pyenv.subprocess.Popen.call_args_list,
            expected_popen
        )
        expected_warn = [
            mock.call("pyenv doesn't seem to be installed, you "
                      "probably don't want this plugin installed either.")
        ]
        self.assertEqual(tox_pyenv.LOG.warning.call_args_list, expected_warn)

class TestThings(unittest.TestCase):

    def test_the_answer(self):

        self.assertEqual(42, 42)

    def test_is_precisely_correct_version(self):

        toxenvname = 'TOX_%s' % os.environ['TOX_ENV_NAME'].upper().strip()
        expected_string = os.environ[toxenvname].strip(' "\'')
        print('\n\nTOX ENV NAME: %s' % toxenvname)
        if platform.python_implementation() == 'PyPy':
            actual_list = [str(_).strip() for _ in sys.pypy_version_info[:3]]
            expected_string = expected_string.split('-')[1].strip(' "\'')
            print('\nExpected version for this tox env: PyPy %s'
                  % expected_string)
            print('Actual version for this tox env: PyPy %s'
                  % '.'.join(actual_list))
        else:
            print('\nExpected version for this tox env: Python %s'
                  % expected_string)
            print('Actual version for this tox env: Python %s'
                  % platform.python_version())
            actual_list = list(platform.python_version_tuple())
        expected_list = expected_string.split('.')

        print('\n\nPYTHON VERSION (verbose)')
        print('*************************')
        print(sys.version)
        print('\n')
        self.assertEqual(actual_list, expected_list)

    def test_what_python(self):

        print('\nwhich python')
        subprocess.call('which python', stderr=subprocess.STDOUT, shell=True)
        print('\ntype python')
        subprocess.call('type python', stderr=subprocess.STDOUT, shell=True)
        print('\nwhereis python')
        subprocess.call('whereis python', stderr=subprocess.STDOUT, shell=True)
        print('\n')

if __name__ == '__main__':

    unittest.main(verbosity=3)


text:
#region Apache License Version 2.0

#endregion Apache License Version 2.0

using SF.Sys.Annotations;
using SF.Sys.Entities.Models;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace SF.Auth.IdentityServices.Models
{

	/// <summary>
	/// 角色
	/// </summary>
	[EntityObject]
	public class Role: ObjectEntityBase<string>
	{
		/// <summary>
		/// 系统角色
		/// </summary>
		/// <remarks>用于支持系统业务,不能删除</remarks>
		[TableVisible]
		public bool IsSysRole { get; set; }
	}

	public class RoleEditable : Role
	{
		/// <summary>
		/// 凭证
		/// </summary>
		public IEnumerable<ClaimValue> Claims { get; set; }

		/// <summary>
		/// 角色授权
		/// </summary>
		[EntityIdent(typeof(Grant))]
		public IEnumerable<long> Grants { get; set; }

	}
	public class UserRole
	{

		/// <summary>
		/// 类型ID
		/// </summary>
		[EntityIdent(typeof(Role), nameof(RoleName))]
		[Key]
		public string RoleId { get; set; }

		/// <summary>
		/// 类型
		/// </summary>
		[Ignore]
		public string RoleName { get; set; }

	}

}


text:
class Bulb < ActiveRecord::Base

  default_scope :conditions => {:name => 'defaulty' }

  belongs_to :car

end


text:
/*
 * File:   client.h
 * Author: peter
 *
 * Created on March 20, 2016, 4:57 PM
 */

#ifndef CLIENT_H
#define	CLIENT_H
#include <cstdlib>
#include <stdio.h>
#include <string>
#include <vector>

class Client{

    std::string username;
    std::string hash;
    std::string salt;

    //friends not supported yet
    //std::vector<std::string> friends;

public:

    Client(std::string username, std::string hash, std::string salt);

    //NOT SUPPORTED YET
    //void add_friend(std::string name);

    std::string get_username();
    std::string get_hash();
    std::string get_salt();

};

#endif	/* CLIENT_H */


text:
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import './print_preview_shared_css.js';
import './settings_section.js';
import '../strings.m.js';
import './settings_select.js';

import {assert} from 'chrome://resources/js/assert.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {DpiCapability, DpiOption, SelectOption} from '../data/cdd.js';

import {SettingsMixin} from './settings_mixin.js';

type LabelledDpiOption = DpiOption&SelectOption;
export type LabelledDpiCapability = {
  option: LabelledDpiOption[],
};

const PrintPreviewDpiSettingsElementBase = SettingsMixin(PolymerElement);

export class PrintPreviewDpiSettingsElement extends
    PrintPreviewDpiSettingsElementBase {
  static get is() {
    return 'print-preview-dpi-settings';
  }

  static get template() {
    return html`{__html_template__}`;
  }

  static get properties() {
    return {
      capability: Object,

      disabled: Boolean,

      capabilityWithLabels_: {
        type: Object,
        computed: 'computeCapabilityWithLabels_(capability)',
      },
    };
  }

  static get observers() {
    return [
      'onDpiSettingChange_(settings.dpi.*, capabilityWithLabels_.option)',
    ];
  }

  capability: DpiCapability;
  disabled: boolean;
  private capabilityWithLabels_: DpiCapability;

  /**
   * Adds default labels for each option.
   */
  private computeCapabilityWithLabels_(): LabelledDpiCapability|null {
    if (this.capability === undefined) {
      return null;
    }

    const result =
        JSON.parse(JSON.stringify(this.capability)) as LabelledDpiCapability;
    this.capability.option.forEach((dpiOption, index) => {
      const hDpi = dpiOption.horizontal_dpi || 0;
      const vDpi = dpiOption.vertical_dpi || 0;
      if (hDpi > 0 && vDpi > 0 && hDpi !== vDpi) {
        result.option[index].name = loadTimeData.getStringF(
            'nonIsotropicDpiItemLabel', hDpi.toLocaleString(),
            vDpi.toLocaleString());
      } else {
        result.option[index].name = loadTimeData.getStringF(
            'dpiItemLabel', (hDpi || vDpi).toLocaleString());
      }
    });
    return result;
  }

  private onDpiSettingChange_() {
    if (this.capabilityWithLabels_ === null ||
        this.capabilityWithLabels_ === undefined) {
      return;
    }

    const dpiValue = this.getSettingValue('dpi') as DpiOption;
    for (const option of assert(this.capabilityWithLabels_.option)) {
      const dpiOption = option as LabelledDpiOption;
      if (dpiValue.horizontal_dpi === dpiOption.horizontal_dpi &&
          dpiValue.vertical_dpi === dpiOption.vertical_dpi &&
          dpiValue.vendor_id === dpiOption.vendor_id) {
        this.shadowRoot!.querySelector('print-preview-settings-select')!
            .selectValue(JSON.stringify(option));
        return;
      }
    }

    const defaultOption =
        this.capabilityWithLabels_.option.find(o => !!o.is_default) ||
        this.capabilityWithLabels_.option[0];
    this.setSetting('dpi', defaultOption);
  }
}

declare global {
  interface HTMLElementTagNameMap {
    'print-preview-dpi-settings': PrintPreviewDpiSettingsElement;
  }
}

customElements.define(
    PrintPreviewDpiSettingsElement.is, PrintPreviewDpiSettingsElement);


text:
package iso20022

// Identification of a data set.
type DataSetIdentification6 struct {

	// Name of the data set.
	Name *Max256Text `xml:"Nm,omitempty"`

	// Category of data set.
	Type *DataSetCategory9Code `xml:"Tp"`

	// Version of the data set.
	Version *Max256Text `xml:"Vrsn,omitempty"`

	// Date and time of creation of the data set.
	CreationDateTime *ISODateTime `xml:"CreDtTm,omitempty"`
}

func (d *DataSetIdentification6) SetName(value string) {
	d.Name = (*Max256Text)(&value)
}

func (d *DataSetIdentification6) SetType(value string) {
	d.Type = (*DataSetCategory9Code)(&value)
}

func (d *DataSetIdentification6) SetVersion(value string) {
	d.Version = (*Max256Text)(&value)
}

func (d *DataSetIdentification6) SetCreationDateTime(value string) {
	d.CreationDateTime = (*ISODateTime)(&value)
}


text:
import {
	Android,
	Config,
	Project,
	ProjectSettings,
	Simulator,
	UrlUtils
} from 'xdl'

import chalk from 'chalk'
import indent from 'indent-string'
import qr from 'qrcode-terminal'
import minimist from 'minimist'
import log from '../util/log'
import clearConsole from '../util/clearConsole'

import packager from '../util/packager'

Config.validation.reactNativeVersionWarnings = false
Config.developerTool = 'crna'
Config.offline = true

const args = minimist(process.argv.slice(2), {
	boolean: ['reset-cache', 'interactive'],
	default: { interactive: true }
})
let dev = true

const options = {}
if (args['reset-cache']) {
	options.reset = true
	log('Asking packager to reset its cache...')
}

let isInteractive = false
const { stdin } = process
if (args.interactive && typeof stdin.setRawMode === 'function') {
	stdin.setRawMode(true)
	stdin.resume()
	stdin.setEncoding('utf8')
	stdin.on('data', handleKeypress)
	isInteractive = true
}

packager.run(onReady, options, isInteractive)

function onReady() {
	log(chalk.green('Packager started!\n'))
	printServerInfo()
}

// print a nicely formatted message with setup information
async function printServerInfo() {
	const settings = await ProjectSettings.readPackagerInfoAsync(process.cwd())
	// who knows why qrcode-terminal takes a callback instead of just returning a string
	const address = await UrlUtils.constructManifestUrlAsync(process.cwd())
	qr.generate(address, qrCode => {
		log(
			`To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.

${indent(qrCode, 2)}

Or enter this address in the Expo app's search bar:

  ${chalk.underline(chalk.cyan(address))}

Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit ${chalk.underline(
				chalk.cyan('https://expo.io')
			)}.

Logs from serving your app will appear here. Press Ctrl+C at any time to stop.`
		)
		printUsage()
	})
}

function printUsage() {
	if (!isInteractive) {
		return
	}
	const { dim, bold } = chalk
	const devMode = dev ? 'development' : 'production'
	const iosInfo =
		process.platform === 'win32'
			? dim('.')
			: `${dim(`, or`)} i ${dim(`to open iOS emulator.`)}`
	log(
		`
 ${dim(`\u203A Press`)} a ${dim(`to open Android device or emulator`)}${iosInfo}
 ${dim(`\u203A Press`)} q ${dim(`to display QR code.`)}
 ${dim(`\u203A Press`)} r ${dim(`to restart packager, or`)} R ${dim(
			`to restart packager and clear cache.`
		)}
 ${dim(`\u203A Press`)} d ${dim(
			`to toggle development mode. (current mode: ${bold(
				devMode
			)}${chalk.reset.dim(')')}`
		)}
`
	)
}

const CTRL_C = '\u0003'
const CTRL_D = '\u0004'

async function handleKeypress(key) {
	switch (key) {
		case CTRL_C:
		case CTRL_D:
			process.emit('SIGINT')
			return
		case 'a': {
			clearConsole()
			log.withTimestamp('Starting Android...')
			const { success, error } = await Android.openProjectAsync(
				process.cwd()
			)
			if (!success) {
				log(chalk.red(error.message))
			}
			printUsage()
			return
		}
		case 'i': {
			clearConsole()
			log.withTimestamp('Starting iOS...')
			const localAddress = await UrlUtils.constructManifestUrlAsync(
				process.cwd(),
				{
					hostType: 'localhost'
				}
			)
			const {
				success,
				msg
			} = await Simulator.openUrlInSimulatorSafeAsync(localAddress)
			if (!success) {
				log(chalk.red(msg))
			}
			printUsage()
			return
		}
		case 'q':
			clearConsole()
			await printServerInfo()
			return
		case 'r':
		case 'R': {
			clearConsole()
			const reset = key === 'R'
			if (reset) {
				log.withTimestamp('Asking packager to reset its cache...')
			}
			log.withTimestamp('Restarting packager...')
			Project.startAsync(process.cwd(), { reset })
			return
		}
		case 'd':
			clearConsole()
			dev = !dev
			await ProjectSettings.setAsync(process.cwd(), { dev })
			log(
				`Packager now running in ${chalk.bold(
					dev ? 'development' : 'production'
				)}${chalk.reset(` mode.`)}

Please close and reopen the project in the Expo app for the
change to take effect.`
			)
			printUsage()
			return
	}
}


text:
class StubgemMultiplatform
  VERSION = '1.0.0'
end


text:
package com.facebook.buck.d;

import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.step.AbstractTestStep;
import com.google.common.collect.ImmutableList;
import java.nio.file.Path;
import java.util.Optional;

/**
 * Runs a D test command, remembering its exit code and streaming its output to a given output file.
 */
public class DTestStep extends AbstractTestStep {

  private static final String NAME = "d test";

  public DTestStep(
      ProjectFilesystem filesystem,
      ImmutableList<String> command,
      Path exitCode,
      Optional<Long> testRuleTimeoutMs,
      Path output) {
    super(
        NAME,
        filesystem,
        Optional.empty(),
        command,
        Optional.empty(),
        exitCode,
        testRuleTimeoutMs,
        output);
  }

  @Override
  public boolean equals(Object o) {
    return (o instanceof DTestStep) && super.equals(o);
  }

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


text:
var argv = require('minimist')(process.argv.slice(2));

var l = require('./utils/log').l;

var mongoPort = argv.p || argv['mongo-port'] || 3001;
var mongoHost = argv.h || argv['mongo-host'] || 'localhost';
var mongoDb = argv.d || argv['mongo-db'] || 'meteor';
var mongoUrl = argv.u || argv['mongo-url'] || ('mongodb://' + mongoHost + ':' + mongoPort + '/' + mongoDb);
var meteorUrl = argv.m || argv['meteor-url'];
if (meteorUrl) {
  var sh = require('shelljs');
  var o = sh.exec('meteor mongo -U ' + meteorUrl);
  if (o.code) {
    l.error("Couldn't get Mongo URL for Meteor server:", meteorUrl);
  } else {
    mongoUrl = o.output.trim();
  }
}

if (!mongoUrl.match(/^mongodb:\/\//)) {
  mongoUrl = 'mongodb://' + mongoUrl;
}

var Server = require('./server').Server;
new Server(mongoUrl);


text:
<?php

/**
 * PHPUnit test case
 */
require_once 'PHPUnit/Framework/TestCase.php';

/**
 * @package    Zend_Db
 * @subpackage UnitTests
 */
abstract class Zend_Db_Adapter_Skip_CommonTest extends PHPUnit_Framework_TestCase
{
    abstract public function getDriver();

    public function setUp()
    {
        $driver = $this->getDriver();
        $this->markTestSkipped("Testing Zend_Db_Adapter_$driver is not enabled in TestConfiguration.php");
    }

    public function testAdapter()
    {
        // this is here only so we have at least one test
    }
}

class Zend_Db_Adapter_Skip_Db2Test extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Db2';
    }
}

class Zend_Db_Adapter_Skip_OracleTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Oracle';
    }
}

class Zend_Db_Adapter_Skip_FirebirdTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Firebird';
    }
}

class Zend_Db_Adapter_Skip_MysqliTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Mysqli';
    }
}

class Zend_Db_Adapter_Skip_Pdo_MssqlTest extends Zend_Db_Adapter_Skip_CommonTest
{
    function getDriver()
    {
        return 'Pdo_Mssql';
    }
}

class Zend_Db_Adapter_Skip_Pdo_MysqlTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Pdo_Mysql';
    }
}

class Zend_Db_Adapter_Skip_Pdo_OciTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Pdo_Oci';
    }
}

class Zend_Db_Adapter_Skip_Pdo_FirebirdTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Pdo_Firebird';
    }
}

class Zend_Db_Adapter_Skip_Pdo_PgsqlTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Pdo_Pgsql';
    }
}

class Zend_Db_Adapter_Skip_Pdo_SqliteTest extends Zend_Db_Adapter_Skip_CommonTest
{
    public function getDriver()
    {
        return 'Pdo_Sqlite';
    }
}


text:
Set-ExecutionPolicy RemoteSigned
# Install chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

# Install nvidia drivers
geforce-game-ready-driver

# Install usual applications
choco install appname -y

# Update applications
choco update all -y


text:
class VizExample3 : public Vizlet
{

public:
	VizExample3();
	virtual ~VizExample3();

	static DWORD __stdcall CreateInstance(CFreeFrameGLPlugin **ppInstance);

	std::string processJson(std::string meth, cJSON *jsonparams, const char *id);
	void processCursor(VizCursor* c, int downdragup);
	bool processDraw();

private:
	// Put private things here.
	SpriteVizParams* m_params;
	std::string m_spriteparams;
};

#endif


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.operator.scalar;

import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.type.StandardTypes;
import com.facebook.presto.type.ColorType;
import com.facebook.presto.type.SqlType;
import com.google.common.annotations.VisibleForTesting;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;

import java.awt.Color;

import static com.facebook.presto.operator.scalar.StringFunctions.upper;
import static com.facebook.presto.spi.StandardErrorCode.INTERNAL_ERROR;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.facebook.presto.util.Failures.checkCondition;
import static java.lang.String.format;
import static java.nio.charset.StandardCharsets.UTF_8;

public final class ColorFunctions
{
    private static final String ANSI_RESET = "\u001b[0m";

    private static final Slice RENDERED_TRUE = render(Slices.copiedBuffer("\u2713", UTF_8), color(Slices.copiedBuffer("green", UTF_8)));
    private static final Slice RENDERED_FALSE = render(Slices.copiedBuffer("\u2717", UTF_8), color(Slices.copiedBuffer("red", UTF_8)));

    public enum SystemColor
    {
        BLACK(0, "black"),
        RED(1, "red"),
        GREEN(2, "green"),
        YELLOW(3, "yellow"),
        BLUE(4, "blue"),
        MAGENTA(5, "magenta"),
        CYAN(6, "cyan"),
        WHITE(7, "white");

        private final int index;
        private final String name;

        SystemColor(int index, String name)
        {
            this.index = index;
            this.name = name;
        }

        private int getIndex()
        {
            return index;
        }

        public String getName()
        {
            return name;
        }

        public static SystemColor valueOf(int index)
        {
            for (SystemColor color : values()) {
                if (index == color.getIndex()) {
                    return color;
                }
            }
            throw new PrestoException(INTERNAL_ERROR, "Invalid color index: " + index);
        }
    }

    private ColorFunctions() {}

    @ScalarFunction
    @SqlType(ColorType.NAME)
    public static long color(@SqlType(StandardTypes.VARCHAR) Slice color)
    {
        int rgb = parseRgb(color);

        if (rgb != -1) {
            return rgb;
        }

        // encode system colors (0-15) as negative values, offset by one
        try {
            SystemColor systemColor = SystemColor.valueOf(upper(color).toString(UTF_8));
            int index = systemColor.getIndex();
            return -(index + 1);
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid color: '%s'", color.toString(UTF_8)), e);
        }
    }

    @ScalarFunction
    @SqlType(ColorType.NAME)
    public static long rgb(@SqlType(StandardTypes.BIGINT) long red, @SqlType(StandardTypes.BIGINT) long green, @SqlType(StandardTypes.BIGINT) long blue)
    {
        checkCondition(red >= 0 && red <= 255, INVALID_FUNCTION_ARGUMENT, "red must be between 0 and 255");
        checkCondition(green >= 0 && green <= 255, INVALID_FUNCTION_ARGUMENT, "green must be between 0 and 255");
        checkCondition(blue >= 0 && blue <= 255, INVALID_FUNCTION_ARGUMENT, "blue must be between 0 and 255");

        return (red << 16) | (green << 8) | blue;
    }

    /**
     * Interpolate a color between lowColor and highColor based the provided value
     *

     * The value is truncated to the range [low, high] if it's outside.
     * Color must be a valid rgb value of the form #rgb
     */
    @ScalarFunction
    @SqlType(ColorType.NAME)
    public static long color(
            @SqlType(StandardTypes.DOUBLE) double value,
            @SqlType(StandardTypes.DOUBLE) double low,
            @SqlType(StandardTypes.DOUBLE) double high,
            @SqlType(ColorType.NAME) long lowColor,
            @SqlType(ColorType.NAME) long highColor)
    {
        return color((value - low) * 1.0 / (high - low), lowColor, highColor);
    }

    /**
     * Interpolate a color between lowColor and highColor based on the provided value
     *

     * The value is truncated to the range [0, 1] if necessary
     * Color must be a valid rgb value of the form #rgb
     */
    @ScalarFunction
    @SqlType(ColorType.NAME)
    public static long color(@SqlType(StandardTypes.DOUBLE) double fraction, @SqlType(ColorType.NAME) long lowColor, @SqlType(ColorType.NAME) long highColor)
    {
        checkCondition(lowColor >= 0, INVALID_FUNCTION_ARGUMENT, "lowColor not a valid RGB color");
        checkCondition(highColor >= 0, INVALID_FUNCTION_ARGUMENT, "highColor not a valid RGB color");

        fraction = Math.min(1, fraction);
        fraction = Math.max(0, fraction);

        return interpolate((float) fraction, lowColor, highColor);
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice render(@SqlType(StandardTypes.VARCHAR) Slice value, @SqlType(ColorType.NAME) long color)
    {
        StringBuilder builder = new StringBuilder(value.length());

        // color
        builder.append(ansiColorEscape(color))
                .append(value.toString(UTF_8))
                .append(ANSI_RESET);

        return Slices.copiedBuffer(builder.toString(), UTF_8);
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice render(@SqlType(StandardTypes.BIGINT) long value, @SqlType(ColorType.NAME) long color)
    {
        return render(Slices.copiedBuffer(Long.toString(value), UTF_8), color);
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice render(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(ColorType.NAME) long color)
    {
        return render(Slices.copiedBuffer(Double.toString(value), UTF_8), color);
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice render(@SqlType(StandardTypes.BOOLEAN) boolean value)
    {
        return value ? RENDERED_TRUE : RENDERED_FALSE;
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice bar(@SqlType(StandardTypes.DOUBLE) double percent, @SqlType(StandardTypes.BIGINT) long width)
    {
        return bar(percent, width, rgb(255, 0, 0), rgb(0, 255, 0));
    }

    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice bar(
            @SqlType(StandardTypes.DOUBLE) double percent,
            @SqlType(StandardTypes.BIGINT) long width,
            @SqlType(ColorType.NAME) long lowColor,
            @SqlType(ColorType.NAME) long highColor)
    {
        long count = (int) (percent * width);
        count = Math.min(width, count);
        count = Math.max(0, count);

        StringBuilder builder = new StringBuilder();

        for (int i = 0; i < count; i++) {
            float fraction = (float) (i * 1.0 / (width - 1));

            int color = interpolate(fraction, lowColor, highColor);

            builder.append(ansiColorEscape(color))
                    .append('\u2588');
        }
        // reset
        builder.append(ANSI_RESET);

        // pad to force column to be the requested width
        for (long i = count; i < width; ++i) {
            builder.append(' ');
        }

        return Slices.copiedBuffer(builder.toString(), UTF_8);
    }

    private static int interpolate(float fraction, long lowRgb, long highRgb)
    {
        float[] lowHsv = Color.RGBtoHSB(getRed(lowRgb), getGreen(lowRgb), getBlue(lowRgb), null);
        float[] highHsv = Color.RGBtoHSB(getRed(highRgb), getGreen(highRgb), getBlue(highRgb), null);

        float h = fraction * (highHsv[0] - lowHsv[0]) + lowHsv[0];
        float s = fraction * (highHsv[1] - lowHsv[1]) + lowHsv[1];
        float v = fraction * (highHsv[2] - lowHsv[2]) + lowHsv[2];

        return Color.HSBtoRGB(h, s, v) & 0xFF_FF_FF;
    }

    /**
     * Convert the given color (rgb or system) to an ansi-compatible index (for use with ESC[38;5;<value>m)
     */
    private static int toAnsi(int red, int green, int blue)
    {
        // rescale to 0-5 range
        red = red * 6 / 256;
        green = green * 6 / 256;
        blue = blue * 6 / 256;

        return 16 + red * 36 + green * 6 + blue;
    }

    private static String ansiColorEscape(long color)
    {
        return "\u001b[38;5;" + toAnsi(color) + 'm';
    }

    /**
     * Convert the given color (rgb or system) to an ansi-compatible index (for use with ESC[38;5;<value>m)
     */
    private static int toAnsi(long color)
    {
        if (color >= 0) { // an rgb value encoded as in Color.getRGB
            return toAnsi(getRed(color), getGreen(color), getBlue(color));
        }
        else {
            return (int) (-color - 1);
        }
    }

    @VisibleForTesting
    static int parseRgb(Slice color)
    {
        if (color.length() != 4 || color.getByte(0) != '#') {
            return -1;
        }

        int red = Character.digit((char) color.getByte(1), 16);
        int green = Character.digit((char) color.getByte(2), 16);
        int blue = Character.digit((char) color.getByte(3), 16);

        if (red == -1 || green == -1 || blue == -1) {
            return -1;
        }

        // replicate the nibbles to turn a color of the form #rgb => #rrggbb (css semantics)
        red = (red << 4) | red;
        green = (green << 4) | green;
        blue = (blue << 4) | blue;

        return (int) rgb(red, green, blue);
    }

    @VisibleForTesting
    static int getRed(long color)
    {
        checkCondition(color >= 0, INVALID_FUNCTION_ARGUMENT, "color is not a valid rgb value");

        return (int) ((color >>> 16) & 0xff);
    }

    @VisibleForTesting
    static int getGreen(long color)
    {
        checkCondition(color >= 0, INVALID_FUNCTION_ARGUMENT, "color is not a valid rgb value");

        return (int) ((color >>> 8) & 0xff);
    }

    @VisibleForTesting
    static int getBlue(long color)
    {
        checkCondition(color >= 0, INVALID_FUNCTION_ARGUMENT, "color is not a valid rgb value");

        return (int) (color & 0xff);
    }
}


text:
module Game.Dink.Files.SaveDat where

import Control.Monad

import qualified Data.ByteString.Lazy as BS

import Data.Binary
import Data.Binary.Get
import Data.Binary.Put

import Data.Char

import qualified Data.Array.IArray as A
import qualified Data.Map as M

import CStructUtil

data DinkSave = Save { save_version :: Int
                     , save_info :: String
                     , save_minutes :: Int
                     , save_x :: Int
                     , save_y :: Int
                     , save_die :: Int
                     , save_size :: Int
                     , save_defense :: Int
                     , save_dir :: Int
                     , save_pframe :: Int
                     , save_pseq :: Int
                     , save_seq :: Int
                     , save_frame :: Int
                     , save_strength :: Int
                     , save_base_walk :: Int
                     , save_base_idle :: Int
                     , save_base_hit :: Int
                     , save_que :: Int
                     , save_magic :: A.Array Int Magic
                     , save_items :: A.Array Int Item
                     , save_spmap :: A.Array Int (A.Array Int EditorInfo, Int)  -- [769], [100]
                     , save_buttons :: A.Array Int Int
                     , save_varman :: M.Map String VarInfo
                     , save_last_talk :: Int
                     , save_mouse :: Int
                     , save_last_map :: Int
                     , save_mapdat :: String
                     , save_dinkdat :: String
                     , save_palette :: String
                     , save_tiles :: A.Array Int String
                     , save_funcs :: M.Map String Func
                     }
  deriving (Show)

instance Binary DinkSave where
  get = do
    version <- getInt
    info <- getString 196
    [min,x,y,die,size,def,dir,pfr,pseq,seq,fr,str,base_walk,base_idle,base_hit,que] <- replicateM 16 getInt
    (_:magic') <- replicateM 9 get
    (_:items') <- replicateM 17 get
    let magic = A.array (1,8) $ zip [1..] magic'
        items = A.array (1,16) $ zip [1..] items'
    skip (3*4)
    spMap <- getSpMap
    button' <- replicateM 10 getInt
    let buttons = A.array (1,10) $ zip [1..] button'
    varman <- getVarMan
    skip (3*4)
    [last_talk,mouse] <- replicateM 2 getInt
    skip 4
    last_map <- getInt
    mapdat <- getString 50
    dinkdat <- getString 50
    palette <- getString 50
    tiles' <- replicateM 42 $ getString 50
    let tiles = A.array (1,42) $ zip [1..] tiles'
    funcs <- getFuncs
    skip 750
    return $ Save version info min x y die size def dir pfr pseq seq fr str base_walk base_idle base_hit que magic items spMap buttons varman last_talk mouse last_map mapdat dinkdat palette tiles funcs

data EditorInfo = EditorInfo { editor_type :: Int    -- in-file as char
                             , editor_seq :: Int     -- in-file as short
                             , editor_frame :: Int   -- in-file as char
                             }
  deriving (Show)

getSpMap :: Get (A.Array Int (A.Array Int EditorInfo, Int))
getSpMap = fmap (A.array (1,768) . zip [1..] . tail) $ replicateM 769 getEditorInfo

getEditorInfo :: Get (A.Array Int EditorInfo, Int)
getEditorInfo = do
  (_:types) <- fmap (map fromIntegral) $ replicateM 100 getWord8
  (_:seqs) <- fmap (map fromIntegral) $ replicateM 100 getWord16le
  (_:frames) <- fmap (map fromIntegral) $ replicateM 100 getWord8
  last <- getInt
  let arr = A.array (1,99) $ zip [1..] $ zipWith3 EditorInfo types seqs frames
  return (arr, last)

data VarInfo = VarInfo { var_val :: Int
                       , var_scope :: Int
                       , var_active :: Bool
                       }
  deriving (Show)

getVarMan :: Get (M.Map String VarInfo)
getVarMan = do
  vars <- replicateM 100 $ do
    val <- getInt
    name <- getString 20
    scope <- getInt
    active <- getInt
    return $ (name,VarInfo val scope (toBool active))
  return $ M.fromList vars

data Func = Func { func_file :: String
                 , func_func :: String
                 }
  deriving (Show)

getFuncs :: Get (M.Map String Func)
getFuncs = do
  funcs <- replicateM 100 $ do
    file <- getString 10
    func <- getString 20
    return (func,Func file func)
  return $ M.fromList funcs

type Magic = Item
data Item = Item { item_active :: Bool
                 , item_name :: String
                 , item_seq :: Int
                 , item_frame :: Int
                 }
  deriving (Show)

instance Binary Item where
  get = do
    act <- getInt
    name <- getString 10
    seq <- getInt
    fr <- getInt
    return $ Item (toBool act) name seq fr

toBool 0 = False
toBool _ = True


text:
namespace Helpful.TextParser.Fluent.Interface
{
    public interface IPositionedDescriptor
    {
        IPositionedPositionDescriptor<TClass> MapTo<TClass>(string tag) where TClass : class;

        IPositionedPropertiesOnlyDescriptor<TClass> MapTo<TClass>() where TClass : class;
    }
}


text:
.forecast-view {
    top: 20%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10%;
    flex-direction: column;
}

.forecast-summary, .forecast-indexes {
    max-width: 50%;
    display: flex;
    flex-direction: row;
}

.forecast-summary p {
    text-align: center;
    font-weight: bold;
    margin-right: 0.1em;
}

.forecast-summary canvas {
    margin-right: 0.7em;
}

.forecast-details {
    max-width: 50%;
    font-weight: normal;
    color: #222222;
    margin-top: 2em;
}

.forecast-indexes {
    font-size: 0.6em;
    margin-top: 2em;
    color: #000000;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.forecast-indexes .index:not(:last-child) {
    margin-right: 1em;
}

.forecast-indexes .value {
    color: #888888;
}


text:
module Nutils
  module Errors

    # Error that is raised when no partial rules file can be found in any
    # directory provided.
    class NoRulesFileFound < ::Nanoc::Errors::NoRulesFileFound

      # @param [String] filename The file name not found.
      def initialize(filename)
        super("No file found in any directory provided for #{filename}".make_compatible_with_env)
      end

    end

  end
end


text:
using UnityEngine;
using System.Collections;

// NOTES: This class is used by the dfSprite examples to provide properties
// that can easily be bound to controls.

[AddComponentMenu( "Daikon Forge/Examples/Sprites/Sprite Properties" )]
public class SpriteProperties : MonoBehaviour
{

	public Texture2D blankTexture;
	public dfSprite sprite;

	#region Unity events

	void Awake()
	{
		if( sprite == null )
		{
			sprite = GetComponent<dfSprite>();
		}
		ShowBorders = true;
		this.useGUILayout = false;
	}

	void Start() { }

	void OnGUI()
	{

		if( !ShowBorders || blankTexture == null )
			return;

		var screenRect = sprite.GetScreenRect();
		var borders = sprite.SpriteInfo.border;

		var x = screenRect.x;
		var y = screenRect.y;
		var width = screenRect.width;
		var height = screenRect.height;

		var left = borders.left;
		var right = borders.right;
		var top = borders.top;
		var bottom = borders.bottom;

		if( sprite.Flip.IsSet( dfSpriteFlip.FlipHorizontal ) )
		{
			left = borders.right;
			right = borders.left;
		}

		if( sprite.Flip.IsSet( dfSpriteFlip.FlipVertical ) )
		{
			top = borders.bottom;
			bottom = borders.top;
		}

		// NOTE: I've been meaning to add some immediate-mode drawing functions
		// for things like lines and overlay sprites, but that will have to wait
		// until V2 for now.
		//
		// I could easily have chosen to draw the lines using Sprites, but I
		// think it's kind of illuminating to show how the code below increases
		// the draw call currentIndex by 4 just to draw some simple lines using
		// Unity GUI :)

		GUI.color = new Color( 0.5f, 0.5f, 0.5f, 0.5f );
		GUI.DrawTexture( new Rect( x - 10, y + top, width + 20, 1 ), blankTexture );
		GUI.DrawTexture( new Rect( x - 10, y + height - bottom, width + 20, 1 ), blankTexture );
		GUI.DrawTexture( new Rect( x + left, y - 10, 1, height + 20 ), blankTexture );
		GUI.DrawTexture( new Rect( x + width - right, y - 10, 1, height + 20 ), blankTexture );

	}

	#endregion

	#region Public properties

	public bool ShowBorders { get; set; }

	public float PatternScaleX
	{
		// Isolate X and Y components for easy property binding
		get { return ( (dfTiledSprite)sprite ).TileScale.x; }
		set
		{
			var tile = sprite as dfTiledSprite;
			tile.TileScale = new Vector2( value, tile.TileScale.y );
		}
	}

	public float PatternScaleY
	{
		// Isolate X and Y components for easy property binding
		get { return ( (dfTiledSprite)sprite ).TileScale.y; }
		set
		{
			var tile = sprite as dfTiledSprite;
			tile.TileScale = new Vector2( tile.TileScale.x, value );
		}
	}

	public float PatternOffsetX
	{
		// Isolate X and Y components for easy property binding
		get { return ( (dfTiledSprite)sprite ).TileScroll.x; }
		set
		{
			var tile = sprite as dfTiledSprite;
			tile.TileScroll = new Vector2( value, tile.TileScroll.y );
		}
	}

	public float PatternOffsetY
	{
		// Isolate X and Y components for easy property binding
		get { return ( (dfTiledSprite)sprite ).TileScroll.y; }
		set
		{
			var tile = sprite as dfTiledSprite;
			tile.TileScroll = new Vector2( tile.TileScroll.x, value );
		}
	}

	public int FillOrigin
	{
		// Data conversion for design-time property binding
		get { return (int)( (dfRadialSprite)sprite ).FillOrigin; }
		set { ( (dfRadialSprite)sprite ).FillOrigin = (dfPivotPoint)value; }
	}

	public bool FillVertical
	{
		get { return sprite.FillDirection == dfFillDirection.Vertical; }
		set
		{
			if( value )
				sprite.FillDirection = dfFillDirection.Vertical;
			else
				sprite.FillDirection = dfFillDirection.Horizontal;
		}
	}

	public bool FlipHorizontal
	{
		get { return sprite.Flip.IsSet( dfSpriteFlip.FlipHorizontal ); }
		set { sprite.Flip = sprite.Flip.SetFlag( dfSpriteFlip.FlipHorizontal, value ); }
	}

	public bool FlipVertical
	{
		get { return sprite.Flip.IsSet( dfSpriteFlip.FlipVertical ); }
		set { sprite.Flip = sprite.Flip.SetFlag( dfSpriteFlip.FlipVertical, value ); }
	}

	#endregion

}


text:
self.addEventListener('message',
    function(event) {
        var job = event.data;
        if (typeof(job) == "string") {
            job = JSON.parse(job);
        }

        var jobId = job.jobId;
        try {
            var result = invokeFunction(job.name, job.parameters);
            // check whether the result is a promise.
            if (typeof(result) == "function" || typeof(result) == "object" && typeof(result.then) == "function") {
                result.then(function(realResult) {
                    postMessage(
                        {
                            jobId: jobId,
                            result: realResult
                        }
                    );
                })
                .catch(function(ex) {
                    postMessage(
                        {
                            jobId: jobId,
                            error: true
                        }
                    )
                });
            }
            else {
                postMessage({
                    jobId: jobId,
                    result: result
                });
            }
        }
        catch(ex) {
            postMessage({
                jobId: jobId,
                error: true
            });
        }
    }
);

function invokeFunction(name, parameters) {
    if (name == "TEST") {
        return test.apply(null, parameters);
    }
    else if (name == "TEST_PROMISE") {
        return test_promise.apply(null, parameters);
    }
    else if (name == "TEST_ERROR") {
        return test_error.apply(null, parameters);
    }
    else if (name == "TEST_ERROR_PROMISE") {
        return test_error_promise.apply(null, parameters);
    }
    else {
        throw new Error("not supported");
    }
}

function test(n) {
    var ret = 0;
    for (var i = 0; i < n; i++) {
        ret += Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(50))))))))));
        for (var l = 0; l < n; l++) {
            ret -= Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(Math.tan(Math.atan(50))))))))));
        }
    }
    return ret;
}

function test_promise(n) {
    return new Promise(function(resolve, reject) {
        setTimeout(function() {
            resolve(test(n));
        }, 1000);
    });
}

function test_error(n) {
    throw new Error();
}

function test_error_promise(n) {
    return Promise.reject(new Error());
}


text:
using System.ComponentModel.DataAnnotations.Schema;

namespace LocalLingua.Data.DomainModels
{
    public class MessageNotification
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        public string Receiver { get; set; }
        public bool Seen { get; set; }
        public string Author { get; set; }
        public int SelectedConversationId { get; set; }
    }
}