text:
from .defaults import argHandler #Import the default arguments
import os
from darkflow.net.build import TFNet

def cliHandler(args):
    FLAGS = argHandler()
    FLAGS.setDefaults()
    FLAGS.parseArgs(args)

    # make sure all necessary dirs exist
    def _get_dir(dirs):
        for d in dirs:
            this = os.path.abspath(os.path.join(os.path.curdir, d))
            if not os.path.exists(this): os.makedirs(this)
    _get_dir([FLAGS.imgdir, FLAGS.binary, FLAGS.backup,
             os.path.join(FLAGS.imgdir,'out'), FLAGS.summary])

    # fix FLAGS.load to appropriate type
    try: FLAGS.load = int(FLAGS.load)
    except: pass

    tfnet = TFNet(FLAGS)

    if FLAGS.demo:
        tfnet.camera()
        exit('Demo stopped, exit.')

    if FLAGS.train:
        print('Enter training ...'); tfnet.train()
        if not FLAGS.savepb:
            exit('Training finished, exit.')

    if FLAGS.savepb:
        print('Rebuild a constant version ...')
        tfnet.savepb(); exit('Done')

    tfnet.predict()


text:
<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/auto_color_7388a4_60" />
    <stroke android:width="@dimen/auto_dimen2_2" android:color="@color/auto_color_445976_60" />
    <corners android:radius="@dimen/auto_dimen2_500" />
</shape>

redpajama_set_name: RedPajamaGithub


text:
// Code generated by go-swagger; DO NOT EDIT.

package ipfs

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"io"
	"net/http"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/runtime/middleware"

	"github.com/jirwin/ipfs-archive/api/swagger/models"
)

// NewArchiveURLParams creates a new ArchiveURLParams object
// with the default values initialized.
func NewArchiveURLParams() ArchiveURLParams {
	var ()
	return ArchiveURLParams{}
}

// ArchiveURLParams contains all the bound params for the archive Url operation
// typically these are obtained from a http.Request
//
// swagger:parameters archiveUrl
type ArchiveURLParams struct {

	// HTTP Request Object
	HTTPRequest *http.Request

	/*The URL to archive
	  Required: true
	  In: body
	*/
	Body *models.ArchiveRequest
}

// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *ArchiveURLParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
	var res []error
	o.HTTPRequest = r

	if runtime.HasBody(r) {
		defer r.Body.Close()
		var body models.ArchiveRequest
		if err := route.Consumer.Consume(r.Body, &body); err != nil {
			if err == io.EOF {
				res = append(res, errors.Required("body", "body"))
			} else {
				res = append(res, errors.NewParseError("body", "body", "", err))
			}

		} else {
			if err := body.Validate(route.Formats); err != nil {
				res = append(res, err)
			}

			if len(res) == 0 {
				o.Body = &body
			}
		}

	} else {
		res = append(res, errors.Required("body", "body"))
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}


text:
package org.lttpp.eemory.oauth;

public interface CallbackHandler {

    public abstract void ready() throws Exception;

    public abstract String getCallbackURL();

    public abstract String getVerifier();

    public abstract void done();

}


text:
FOUNDATION_EXPORT double Pods_JSONSerializerCocoaTestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_JSONSerializerCocoaTestsVersionString[];


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/textfield_search_selected_holo_light" />
    <item android:drawable="@drawable/textfield_search_default_holo_light" />
</selector>


text:
package com.example.tetianapriadko.people.login;

public class Defaults {
    public static final String APPLICATION_ID = "9888B064-2CFF-D205-FFE9-147F33259E00";
    public static final String SECRET_KEY = "EFD6628B-F72C-FDBE-FFE7-4AEB8D665200";
    public static final String VERSION = "v1";
    public static final String SERVER_URL = "https://api.backendless.com";
}


text:
package org.datavec.spark.storage;

import com.google.common.io.Files;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.datavec.api.writable.*;
import org.datavec.spark.BaseSparkTest;
import org.junit.Test;
import org.nd4j.linalg.factory.Nd4j;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
 * Created by Alex on 30/05/2017.
 */
public class TestSparkStorageUtils extends BaseSparkTest {

    @Test
    public void testSaveRestoreMapFile() {
        List<List<Writable>> l = new ArrayList<>();
        l.add(Arrays.<org.datavec.api.writable.Writable>asList(new Text("zero"), new IntWritable(0),
                        new DoubleWritable(0), new NDArrayWritable(Nd4j.valueArrayOf(10, 0.0))));
        l.add(Arrays.<org.datavec.api.writable.Writable>asList(new Text("one"), new IntWritable(11),
                        new DoubleWritable(11.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 11.0))));
        l.add(Arrays.<org.datavec.api.writable.Writable>asList(new Text("two"), new IntWritable(22),
                        new DoubleWritable(22.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 22.0))));

        JavaRDD<List<Writable>> rdd = sc.parallelize(l);

        File f = Files.createTempDir();
        f.delete();
        f.deleteOnExit();
        String path = "file:///" + f.getAbsolutePath();

        SparkStorageUtils.saveMapFile(path, rdd);
        JavaPairRDD<Long, List<Writable>> restored = SparkStorageUtils.restoreMapFile(path, sc);

        Map<Long, List<Writable>> m = restored.collectAsMap();

        assertEquals(3, m.size());
        for (int i = 0; i < 3; i++) {
            assertEquals(l.get(i), m.get((long) i));
        }

        //Also test sequence file:
        f = Files.createTempDir();
        f.delete();
        f.deleteOnExit();
        path = "file:///" + f.getAbsolutePath();

        SparkStorageUtils.saveSequenceFile(path, rdd);
        List<List<Writable>> restored2 = SparkStorageUtils.restoreSequenceFile(path, sc).collect();

        //Sequence file loading + collect iteration order is not guaranteed (depends on number of partitions, etc)
        assertEquals(3, restored2.size());
        assertTrue(l.containsAll(restored2) && restored2.containsAll(l));
    }

    @Test
    public void testSaveRestoreMapFileSequences() {
        List<List<List<Writable>>> l = new ArrayList<>();
        l.add(Arrays.asList(
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("zero"), new IntWritable(0),
                                        new DoubleWritable(0), new NDArrayWritable(Nd4j.valueArrayOf(10, 0.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("one"), new IntWritable(1),
                                        new DoubleWritable(1.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 1.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("two"), new IntWritable(2),
                                        new DoubleWritable(2.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 2.0)))));

        l.add(Arrays.asList(
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Bzero"), new IntWritable(10),
                                        new DoubleWritable(10), new NDArrayWritable(Nd4j.valueArrayOf(10, 10.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Bone"), new IntWritable(11),
                                        new DoubleWritable(11.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 11.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Btwo"), new IntWritable(12),
                                        new DoubleWritable(12.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 12.0)))));

        l.add(Arrays.asList(
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Czero"), new IntWritable(20),
                                        new DoubleWritable(20), new NDArrayWritable(Nd4j.valueArrayOf(10, 20.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Cone"), new IntWritable(21),
                                        new DoubleWritable(21.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 21.0))),
                        Arrays.<org.datavec.api.writable.Writable>asList(new Text("Ctwo"), new IntWritable(22),
                                        new DoubleWritable(22.0), new NDArrayWritable(Nd4j.valueArrayOf(10, 22.0)))));

        JavaRDD<List<List<Writable>>> rdd = sc.parallelize(l);

        File f = Files.createTempDir();
        f.delete();
        f.deleteOnExit();
        String path = "file:///" + f.getAbsolutePath();

        SparkStorageUtils.saveMapFileSequences(path, rdd);
        JavaPairRDD<Long, List<List<Writable>>> restored = SparkStorageUtils.restoreMapFileSequences(path, sc);

        Map<Long, List<List<Writable>>> m = restored.collectAsMap();

        assertEquals(3, m.size());
        for (int i = 0; i < 3; i++) {
            assertEquals(l.get(i), m.get((long) i));
        }

        //Also test sequence file:
        f = Files.createTempDir();
        f.delete();
        f.deleteOnExit();
        path = "file:///" + f.getAbsolutePath();

        SparkStorageUtils.saveSequenceFileSequences(path, rdd);
        List<List<List<Writable>>> restored2 = SparkStorageUtils.restoreSequenceFileSequences(path, sc).collect();

        //Sequence file loading + collect iteration order is not guaranteed (depends on number of partitions, etc)
        assertEquals(3, restored2.size());
        assertTrue(l.containsAll(restored2) && restored2.containsAll(l));
    }

}


text:
require "spec_helper"
require "graphql/types/iso_8601_date_time"
describe GraphQL::Types::ISO8601DateTime do
  module DateTimeTest
    class DateTimeObject < GraphQL::Schema::Object
      field :year, Integer, null: false
      field :month, Integer, null: false
      field :day, Integer, null: false
      field :hour, Integer, null: false
      field :minute, Integer, method: :min, null: false
      field :second, Integer, method: :sec, null: false
      field :zone, String
      field :utc_offset, Integer, null: false
      field :iso8601, GraphQL::Types::ISO8601DateTime, null: false, method: :itself
    end

    class Query < GraphQL::Schema::Object
      field :parse_date, DateTimeObject do
        argument :date, GraphQL::Types::ISO8601DateTime
      end

      field :parse_date_time, DateTimeObject do
        argument :date, GraphQL::Types::ISO8601DateTime
      end

      field :parse_date_string, DateTimeObject do
        argument :date, GraphQL::Types::ISO8601DateTime
      end

      field :parse_date_time_string, DateTimeObject do
        argument :date, GraphQL::Types::ISO8601DateTime
      end

      field :invalid_date, DateTimeObject, null: false

      def parse_date(date:)
        # Resolve a Date object
        Date.parse(date.iso8601)
      end

      def parse_date_time(date:)
        # Resolve a Time object
        Time.parse(date.iso8601(3))
      end

      def parse_date_string(date:)
        # Resolve a Date string
        Date.parse(date.iso8601).iso8601
      end

      def parse_date_time_string(date:)
        # Resolve a DateTime string
        DateTime.parse(date.iso8601).iso8601
      end

      def invalid_date
        'abc'
      end
    end

    class Schema < GraphQL::Schema
      query(Query)
    end
  end

  describe "as an input" do

    def parse_date(date_str)
      query_str = <<-GRAPHQL
      query($date: ISO8601DateTime!){
        parseDateTime(date: $date) {
          year
          month
          day
          hour
          minute
          second
          zone
          utcOffset
        }
      }
      GRAPHQL
      full_res = DateTimeTest::Schema.execute(query_str, variables: { date: date_str })
      full_res["errors"] || full_res["data"]["parseDateTime"]
    end

    it "parses valid dates" do
      res = parse_date("2018-06-07T09:31:42-07:00")
      expected_res = {
        "year" => 2018,
        "month" => 6,
        "day" => 7,
        "hour" => 9,
        "minute" => 31,
        "second" => 42,
        "zone" => nil,
        "utcOffset" => -25200,
      }
      assert_equal(expected_res, res)
    end

    it "parses valid dates with a timezone" do
      res = parse_date("2018-06-07T09:31:42Z")
      expected_res = {
        "year" => 2018,
        "month" => 6,
        "day" => 7,
        "hour" => 9,
        "minute" => 31,
        "second" => 42,
        "zone" => "UTC",
        "utcOffset" => 0,
      }
      assert_equal(expected_res, res)
    end

    it "parses dates without times" do
      res = parse_date("2018-06-07")
      # It uses the system default timezone when none is given
      system_default_tz = Date.iso8601("2018-06-07").to_time.zone
      system_default_offset = Date.iso8601("2018-06-07").to_time.utc_offset
      expected_res = {
        "year" => 2018,
        "month" => 6,
        "day" => 7,
        "hour" => 0,
        "minute" => 0,
        "second" => 0,
        "zone" => system_default_tz,
        "utcOffset" => system_default_offset,
      }
      assert_equal(expected_res, res)
    end

    it "parses dates without times or dashes" do
      res = parse_date("20180827")
      # It uses the system default timezone when none is given
      system_default_tz = Date.iso8601("2018-08-27").to_time.zone
      system_default_offset = Date.iso8601("2018-08-27").to_time.utc_offset
      expected_res = {
        "year" => 2018,
        "month" => 8,
        "day" => 27,
        "hour" => 0,
        "minute" => 0,
        "second" => 0,
        "zone" => system_default_tz,
        "utcOffset" => system_default_offset,
      }
      assert_equal(expected_res, res)
    end

    it "rejects partial times" do
      expected_errors = ["Variable $date of type ISO8601DateTime! was provided invalid value"]
      assert_equal expected_errors, parse_date("2018-06-07T12:12").map { |e| e["message"] }
      assert_equal expected_errors, parse_date("2018-06-07T12").map { |e| e["message"] }
    end

    it "adds an error for invalid dates" do
      expected_errors = ["Variable $date of type ISO8601DateTime! was provided invalid value"]

      assert_equal expected_errors, parse_date("2018-99-07T99:31:42Z").map { |e| e["message"] }
      assert_equal expected_errors, parse_date("xyz").map { |e| e["message"] }
      assert_equal expected_errors, parse_date(nil).map { |e| e["message"] }
      assert_equal expected_errors, parse_date([1,2,3]).map { |e| e["message"] }
    end

    it "handles array inputs gracefully" do
      query_str = <<-GRAPHQL
        {
          parseDateTime(date: ["A", "B", "C"]) {
            year
          }
        }
      GRAPHQL

      res = DateTimeTest::Schema.execute(query_str)
      expected_message = "Argument 'date' on Field 'parseDateTime' has an invalid value ([\"A\", \"B\", \"C\"]). Expected type 'ISO8601DateTime!'."
      assert_equal expected_message, res["errors"].first["message"]
    end
  end

  describe "as an output" do
    let(:date_str) { "2010-02-02T22:30:30-06:00" }
    let(:date_str_midnight) { Time.parse(Date.parse(date_str).iso8601).iso8601 }
    let(:query_str) do
      <<-GRAPHQL
      query($date: ISO8601DateTime!){
        parseDate(date: $date) {
          iso8601
        }
        parseDateTime(date: $date) {
          iso8601
        }
        parseDateString(date: $date) {
          iso8601
        }
        parseDateTimeString(date: $date) {
          iso8601
        }
      }
      GRAPHQL
    end
    let(:full_res) { DateTimeTest::Schema.execute(query_str, variables: { date: date_str }) }

    it 'serializes a Date object as an ISO8601 DateTime string' do
      assert_equal date_str_midnight, full_res["data"]["parseDate"]["iso8601"]
    end

    it 'serializes a DateTime object as an ISO8601 DateTime string' do
      assert_equal date_str, full_res["data"]["parseDateTime"]["iso8601"]
    end

    it 'serializes a Date string as an ISO8601 DateTime string' do
      assert_equal date_str_midnight, full_res["data"]["parseDateString"]["iso8601"]
    end

    it 'serializes a DateTime string as an ISO8601 DateTime string' do
      assert_equal date_str, full_res["data"]["parseDateTimeString"]["iso8601"]
    end

    describe "with time_precision = 3 (i.e. 'with milliseconds')" do
      before do
        @tp = GraphQL::Types::ISO8601DateTime.time_precision
        GraphQL::Types::ISO8601DateTime.time_precision = 3
      end

      after do
        GraphQL::Types::ISO8601DateTime.time_precision = @tp
      end

      it "returns a string" do
        query_str = <<-GRAPHQL
        query($date: ISO8601DateTime!){
          parseDateTime(date: $date) {
            iso8601
          }
        }
        GRAPHQL

        date_str = "2010-02-02T22:30:30.123-06:00"
        full_res = DateTimeTest::Schema.execute(query_str, variables: { date: date_str })
        assert_equal date_str, full_res["data"]["parseDateTime"]["iso8601"]
      end
    end

    describe "with Date value" do
      it "raises an error" do
        query_str = <<-GRAPHQL
        query {
          invalidDate {
            iso8601
          }
        }
        GRAPHQL

        err = assert_raises(GraphQL::Error) do
          DateTimeTest::Schema.execute(query_str)
        end
        assert_equal err.message, 'An incompatible object (String) was given to GraphQL::Types::ISO8601DateTime. Make sure that only Times, Dates, DateTimes, and well-formatted Strings are used with this type. (no time information in "abc")'
      end
    end
  end

  describe "structure" do
    it "is in introspection" do
      introspection_res = DateTimeTest::Schema.execute <<-GRAPHQL
      {
        __type(name: "ISO8601DateTime") {
          name
          kind
        }
      }
      GRAPHQL

      expected_res = { "name" => "ISO8601DateTime", "kind" => "SCALAR"}
      assert_equal expected_res, introspection_res["data"]["__type"]
    end
  end
end


text:
<title>Playing Around With Guilloche Patterns</title>

Playing Around With Guilloche Patterns


text:
package com.in28minutes.web.common.form;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

public class ChangePasswordForm {

	@NotEmpty(message = "{update.currentPassword.required}")
	@Size(min = 6, message = "{update.currentPassword.size}")
	private String currentPassword;

	@NotEmpty(message = "{update.newPassword.required}")
	@Size(min = 6, message = "{update.newPassword.size}")
	private String newPassword;

	@NotEmpty(message = "{update.confirmationPassword.required}")
	@Size(min = 6, message = "{update.confirmationPassword.size}")
	private String confirmationPassword;

	public String getCurrentPassword() {
		return currentPassword;
	}

	public void setCurrentPassword(String currentPassword) {
		this.currentPassword = currentPassword;
	}

	public String getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}

	public String getConfirmationPassword() {
		return confirmationPassword;
	}

	public void setConfirmationPassword(String confirmationPassword) {
		this.confirmationPassword = confirmationPassword;
	}
}


text:
using System;

using AuxiliumLtd.CareTakerGazeController;

namespace AuxiliumLtd.CareTakerGazeController.UnitTest
{
    class Program
    {
        static GazeController gaze = null;

        static void Main(string[] args)
        {
            //  Setup EyeTrackerCore
            gaze = new GazeController(1366, 768, 22);
            gaze.Start();

            #region Setup regions

            //  Set up "blue" region
            gaze.AddRegion("blue", -133, 768, 240, 240, 1.2);
            gaze.Regions["blue"].GazeEnterRegion += RegionEnter;
            gaze.Regions["blue"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["blue"].GazeActivateRegion += RegionActivate;

            //  Set up "green" region
            gaze.AddRegion("green", 155, 768, 240, 240, 0.5);
            gaze.Regions["green"].GazeEnterRegion += RegionEnter;
            gaze.Regions["green"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["green"].GazeActivateRegion += RegionActivate;

            //  Set up "center" region
            gaze.AddRegion("center", 433, 820, 500, 200, 2);
            gaze.Regions["center"].GazeEnterRegion += RegionEnter;
            gaze.Regions["center"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["center"].GazeActivateRegion += RegionActivate;

            //  Set up "down" region
            gaze.AddRegion("down", 433, 708, 500, 100, 0.7);
            gaze.Regions["down"].GazeEnterRegion += RegionEnter;
            gaze.Regions["down"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["down"].GazeActivateRegion += RegionActivate;

            //  Set up "red" region
            gaze.AddRegion("red", 971, 768, 240, 240, 0.5);
            gaze.Regions["red"].GazeEnterRegion += RegionEnter;
            gaze.Regions["red"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["red"].GazeActivateRegion += RegionActivate;

            //  Set up "yellow" region
            gaze.AddRegion("yellow", 1259, 768, 240, 240, 2);
            gaze.Regions["yellow"].GazeEnterRegion += RegionEnter;
            gaze.Regions["yellow"].GazeLeaveRegion += RegionLeave;
            gaze.Regions["yellow"].GazeActivateRegion += RegionActivate;

            #endregion

            //  Loop
            Console.WriteLine("\n Eye Tracker is tracking ...");
            Console.WriteLine(" Top-left: {0}\n Bottom-left: {1}\n Top-right: {2}", gaze.DisplayArea.TopLeft, gaze.DisplayArea.BottomLeft, gaze.DisplayArea.TopRight);
            Console.WriteLine(" -----------------------------------------------------");

            while (Console.ReadKey().Key != ConsoleKey.Escape);    //  Loop until the esc-key has been pressed

            //  EyeTrackerCore dispose
            gaze.Kill();
        }

        private static void RegionEnter(object sender, GazeControllerEventArgs e)
        {
            Console.WriteLine(" Gaze entered the {0} region, time: {1} s", e.Region.Name, e.Region.TimeAccumulator.ToString());
        }

        private static void RegionLeave(object sender, GazeControllerEventArgs e)
        {
            Console.WriteLine(" Gaze left the {0} region, time: {1} s", e.Region.Name, e.Region.TimeAccumulator.ToString());
        }

        private static void RegionActivate(object sender, GazeControllerEventArgs e)
        {
            Console.WriteLine(" Activation of the {0} region was tiggered, it took: {1} s", e.Region.Name, e.Region.TimeAccumulator.ToString());
        }
    }
}


text:
package pl.rafalmag;

import java.util.Calendar;
import java.util.GregorianCalendar;

import javafx.animation.Animation;
import javafx.animation.FadeTransition;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Labeled;
import javafx.scene.effect.Glow;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;

/**
 * Note that this clock does not keep perfect time, but is close. It's main
 * purpose is to demonstrate various features of JavaFX.
 */
public class Clock extends Application {
	public static void main(String[] args) throws Exception {
		launch(args);
	}

	@Override
	public void start(final Stage stage) throws Exception {
		// construct the analogueClock pieces.
		final Circle face = new Circle(100, 100, 100);
		face.setId("face");
		final Label brand = new Label("LEGO clock");
		brand.setId("brand");
		brand.layoutXProperty().bind(
				face.centerXProperty()
						.subtract(brand.widthProperty().divide(2)));
		brand.layoutYProperty().bind(
				face.centerYProperty().add(face.radiusProperty().divide(2)));
		final Line hourHand = new Line(0, 0, 0, -50);
		hourHand.setTranslateX(100);
		hourHand.setTranslateY(100);
		hourHand.setId("hourHand");
		final Line minuteHand = new Line(0, 0, 0, -75);
		minuteHand.setTranslateX(100);
		minuteHand.setTranslateY(100);
		minuteHand.setId("minuteHand");
		final Circle spindle = new Circle(100, 100, 5);
		spindle.setId("spindle");
		Group ticks = new Group();
		for (int i = 0; i < 12; i++) {
			Line tick = new Line(0, -83, 0, -93);
			tick.setTranslateX(100);
			tick.setTranslateY(100);
			tick.getStyleClass().add("tick");
			tick.getTransforms().add(new Rotate(i * (360 / 12)));
			ticks.getChildren().add(tick);
		}
		final Group analogueClock = new Group(face, brand, ticks, spindle,
				hourHand, minuteHand);

		// construct the digitalClock pieces.
		final Label digitalClock = new Label();
		digitalClock.setId("digitalClock");

		// determine the starting time.
		Calendar calendar = GregorianCalendar.getInstance();
		double seedMinuteDegrees = (calendar.get(Calendar.MINUTE)) * (360 / 60)
				+ calendar.get(Calendar.HOUR) * 360;

		// define rotations to map the analogueClock to the current time.
		final Rotate minuteRotate = new Rotate(seedMinuteDegrees);
		final Rotate hourRotate = new Rotate();
		hourRotate.angleProperty()
				.bind(minuteRotate.angleProperty().divide(12));
		hourHand.getTransforms().add(hourRotate);
		minuteHand.getTransforms().add(minuteRotate);

		initAnimation(digitalClock);

		stage.initStyle(StageStyle.TRANSPARENT);

		initMouseEvents(analogueClock, stage);

		initHand(hourHand, minuteRotate, 12);
		initHand(minuteHand, minuteRotate, 1);

		// layout the scene.
		final VBox layout = new VBox();
		layout.getChildren().addAll(analogueClock, digitalClock);
		layout.setAlignment(Pos.CENTER);
		final Scene scene = new Scene(layout, Color.TRANSPARENT);
		scene.getStylesheets().add(getResource("/clock.css"));
		stage.setScene(scene);

		// drag(stage, layout, scene);

		// show the scene.
		stage.show();
	}

	private void initHand(final Line hand, final Rotate minuteRotate,
			final double toMinuteMultiplier) {
		final DoubleProperty lastMinuteHandAngleValue = new SimpleDoubleProperty(
				0);
		hand.setOnMousePressed(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				lastMinuteHandAngleValue
						.set(getMouseAngleRelativeToTarget(mouseEvent));
			}
		});
		hand.setOnMouseReleased(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				lastMinuteHandAngleValue
						.set(getMouseAngleRelativeToTarget(mouseEvent));
			}
		});
		hand.setOnMouseDragged(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				boolean clockwiseRotation = isClockwiseRotation(
						lastMinuteHandAngleValue, mouseEvent);
				double addAngle = clockwiseRotation ? 6 : -6;
				rotateMinute(minuteRotate, addAngle * toMinuteMultiplier);
				// TODO use logger
				System.out.println("Minute rotation: "
						+ minuteRotate.getAngle()
						+ (clockwiseRotation ? " (+)" : " (-)"));
			}

		});
	}

	private void rotateMinute(final Rotate minuteRotate, double addAngle) {
		minuteRotate
				.setAngle((minuteRotate.getAngle() + addAngle) % (360 * 12));
	}

	private double getMouseAngleRelativeToTarget(MouseEvent mouseEvent) {
		Point2D centre = ((Node) mouseEvent.getSource())
				.localToScene(new Point2D(0, 0));

		double x = mouseEvent.getSceneX() - centre.getX();
		double y = mouseEvent.getSceneY() - centre.getY();
		double angleForCoordinates = CordsToAngle
				.getAngleForFxCoordinates(x, y);
		return angleForCoordinates;
	}

	private void initMouseEvents(final Group analogueClock, Stage stage) {
		// add a glow effect whenever the mouse is positioned over the clock.
		final Glow glow = new Glow();
		analogueClock.setOnMouseEntered(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				analogueClock.setEffect(glow);
			}
		});
		analogueClock.setOnMouseExited(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				analogueClock.setEffect(null);
			}
		});

		// closeOnClick(analogueClock, stage);
	}

	private void closeOnClick(final Group analogueClock, final Stage stage) {
		// fade out the scene and shut it down when the mouse is clicked on the
		// clock.
		analogueClock.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent mouseEvent) {
				analogueClock.setMouseTransparent(true);
				FadeTransition fade = new FadeTransition(Duration.seconds(1.2),
						analogueClock);
				fade.setOnFinished(new EventHandler<ActionEvent>() {
					@Override
					public void handle(ActionEvent actionEvent) {
						stage.close();
					}
				});
				fade.setFromValue(1);
				fade.setToValue(0);
				fade.play();
			}
		});
	}

	private void initAnimation(final Labeled digitalClock) {
		// the digital clock updates once a second.
		final Timeline digitalTime = new Timeline(new KeyFrame(
				Duration.seconds(0), new EventHandler<ActionEvent>() {
					@Override
					public void handle(ActionEvent actionEvent) {
						Calendar calendar = GregorianCalendar.getInstance();
						String hourString = pad(2, '0',
								calendar.get(Calendar.HOUR) == 0 ? "12"
										: calendar.get(Calendar.HOUR) + "");
						String minuteString = pad(2, '0',
								calendar.get(Calendar.MINUTE) + "");
						String secondString = pad(2, '0',
								calendar.get(Calendar.SECOND) + "");
						String ampmString = calendar.get(Calendar.AM_PM) == Calendar.AM ? "AM"
								: "PM";
						digitalClock.setText(hourString + ":" + minuteString
								+ ":" + secondString + " " + ampmString);
					}
				}), new KeyFrame(Duration.seconds(1)));

		// time never ends.
		digitalTime.setCycleCount(Animation.INDEFINITE);

		// start the analogueClock.
		digitalTime.play();
	}

	private String pad(int fieldWidth, char padChar, String s) {
		StringBuilder sb = new StringBuilder();
		for (int i = s.length(); i < fieldWidth; i++) {
			sb.append(padChar);
		}
		sb.append(s);

		return sb.toString();
	}

	private boolean isClockwiseRotation(final DoubleProperty lastAngleValue,
			MouseEvent mouseEvent) {
		double angleForCoordinates = getMouseAngleRelativeToTarget(mouseEvent);
		double angleDiff = angleForCoordinates - lastAngleValue.get();
		lastAngleValue.set(angleForCoordinates);
		return angleDiff > 0;
	}

	static String getResource(String path) {
		return Clock.class.getResource(path).toExternalForm();
	}

}


text:
package org.elasticsearch.painless.node;

import org.elasticsearch.painless.DefBootstrap;
import org.elasticsearch.painless.Definition.Cast;
import org.elasticsearch.painless.Definition.Type;
import org.elasticsearch.painless.Globals;
import org.elasticsearch.painless.Locals;
import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.elasticsearch.painless.Operation;

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

/**
 * Represents an assignment with the lhs and rhs as child nodes.
 */
public final class EAssignment extends AExpression {

    private AExpression lhs;
    private AExpression rhs;
    private final boolean pre;
    private final boolean post;
    private Operation operation;

    private boolean cat = false;
    private Type promote = null;
    private Type shiftDistance; // for shifts, the RHS is promoted independently
    private Cast there = null;
    private Cast back = null;
    private Type DefType = null;

    public EAssignment(Location location, AExpression lhs, AExpression rhs, boolean pre, boolean post, Operation operation) {
        super(location);

        this.lhs = Objects.requireNonNull(lhs);
        this.rhs = rhs;
        this.pre = pre;
        this.post = post;
        this.operation = operation;
    }

    @Override
    void extractVariables(Set<String> variables) {
        lhs.extractVariables(variables);
        rhs.extractVariables(variables);
    }

    @Override
    void analyze(Locals locals) {
        analyzeLHS(locals);
        analyzeIncrDecr();

        if (operation != null) {
            analyzeCompound(locals);
        } else if (rhs != null) {
            analyzeSimple(locals);
        } else {
            throw new IllegalStateException("Illegal tree structure.");
        }

        DefType = locals.getDefinition().DefType;
    }

    private void analyzeLHS(Locals locals) {
        if (lhs instanceof AStoreable) {
            AStoreable lhs = (AStoreable)this.lhs;

            lhs.read = read;
            lhs.write = true;
            lhs.analyze(locals);
        } else {
            throw new IllegalArgumentException("Left-hand side cannot be assigned a value.");
        }
    }

    private void analyzeIncrDecr() {
        if (pre && post) {
            throw createError(new IllegalStateException("Illegal tree structure."));
        } else if (pre || post) {
            if (rhs != null) {
                throw createError(new IllegalStateException("Illegal tree structure."));
            }

            if (operation == Operation.INCR) {
                if (lhs.actual.clazz == double.class) {
                    rhs = new EConstant(location, 1D);
                } else if (lhs.actual.clazz == float.class) {
                    rhs = new EConstant(location, 1F);
                } else if (lhs.actual.clazz == long.class) {
                    rhs = new EConstant(location, 1L);
                } else {
                    rhs = new EConstant(location, 1);
                }

                operation = Operation.ADD;
            } else if (operation == Operation.DECR) {
                if (lhs.actual.clazz == double.class) {
                    rhs = new EConstant(location, 1D);
                } else if (lhs.actual.clazz == float.class) {
                    rhs = new EConstant(location, 1F);
                } else if (lhs.actual.clazz == long.class) {
                    rhs = new EConstant(location, 1L);
                } else {
                    rhs = new EConstant(location, 1);
                }

                operation = Operation.SUB;
            } else {
                throw createError(new IllegalStateException("Illegal tree structure."));
            }
        }
    }

    private void analyzeCompound(Locals locals) {
        rhs.analyze(locals);

        boolean shift = false;

        if (operation == Operation.MUL) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, rhs.actual, true);
        } else if (operation == Operation.DIV) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, rhs.actual, true);
        } else if (operation == Operation.REM) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, rhs.actual, true);
        } else if (operation == Operation.ADD) {
            promote = locals.getDefinition().caster.promoteAdd(lhs.actual, rhs.actual);
        } else if (operation == Operation.SUB) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, rhs.actual, true);
        } else if (operation == Operation.LSH) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, false);
            shiftDistance = locals.getDefinition().caster.promoteNumeric(rhs.actual, false);
            shift = true;
        } else if (operation == Operation.RSH) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, false);
            shiftDistance = locals.getDefinition().caster.promoteNumeric(rhs.actual, false);
            shift = true;
        } else if (operation == Operation.USH) {
            promote = locals.getDefinition().caster.promoteNumeric(lhs.actual, false);
            shiftDistance = locals.getDefinition().caster.promoteNumeric(rhs.actual, false);
            shift = true;
        } else if (operation == Operation.BWAND) {
            promote = locals.getDefinition().caster.promoteXor(lhs.actual, rhs.actual);
        } else if (operation == Operation.XOR) {
            promote = locals.getDefinition().caster.promoteXor(lhs.actual, rhs.actual);
        } else if (operation == Operation.BWOR) {
            promote = locals.getDefinition().caster.promoteXor(lhs.actual, rhs.actual);
        } else {
            throw createError(new IllegalStateException("Illegal tree structure."));
        }

        if (promote == null || (shift && shiftDistance == null)) {
            throw createError(new ClassCastException("Cannot apply compound assignment " +
                "[" + operation.symbol + "=] to types [" + lhs.actual + "] and [" + rhs.actual + "]."));
        }

        cat = operation == Operation.ADD && promote.clazz == String.class;

        if (cat) {
            if (rhs instanceof EBinary && ((EBinary)rhs).operation == Operation.ADD && rhs.actual.clazz == String.class) {
                ((EBinary)rhs).cat = true;
            }

            rhs.expected = rhs.actual;
        } else if (shift) {
            if (promote.dynamic) {
                // shifts are promoted independently, but for the def type, we need object.
                rhs.expected = promote;
            } else if (shiftDistance.clazz == long.class) {
                rhs.expected = locals.getDefinition().intType;
                rhs.explicit = true;
            } else {
                rhs.expected = shiftDistance;
            }
        } else {
            rhs.expected = promote;
        }

        rhs = rhs.cast(locals);

        there = locals.getDefinition().caster.getLegalCast(location, lhs.actual, promote, false, false);
        back = locals.getDefinition().caster.getLegalCast(location, promote, lhs.actual, true, false);

        this.statement = true;
        this.actual = read ? lhs.actual : locals.getDefinition().voidType;
    }

    private void analyzeSimple(Locals locals) {
        AStoreable lhs = (AStoreable)this.lhs;

        // If the lhs node is a def optimized node we update the actual type to remove the need for a cast.
        if (lhs.isDefOptimized()) {
            rhs.analyze(locals);

            if (rhs.actual.clazz == void.class) {
                throw createError(new IllegalArgumentException("Right-hand side cannot be a [void] type for assignment."));
            }

            rhs.expected = rhs.actual;
            lhs.updateActual(rhs.actual);
        // Otherwise, we must adapt the rhs type to the lhs type with a cast.
        } else {
            rhs.expected = lhs.actual;
            rhs.analyze(locals);
        }

        rhs = rhs.cast(locals);

        this.statement = true;
        this.actual = read ? lhs.actual : locals.getDefinition().voidType;
    }

    /**
     * Handles writing byte code for variable/method chains for all given possibilities
     * including String concatenation, compound assignment, regular assignment, and simple
     * reads.  Includes proper duplication for chained assignments and assignments that are
     * also read from.
     */
    @Override
    void write(MethodWriter writer, Globals globals) {
        writer.writeDebugInfo(location);

        // For the case where the assignment represents a String concatenation
        // we must, depending on the Java version, write a StringBuilder or
        // track types going onto the stack.  This must be done before the
        // lhs is read because we need the StringBuilder to be placed on the
        // stack ahead of any potential concatenation arguments.
        int catElementStackSize = 0;

        if (cat) {
            catElementStackSize = writer.writeNewStrings();
        }

        // Cast the lhs to a storeable to perform the necessary operations to store the rhs.
        AStoreable lhs = (AStoreable)this.lhs;
        lhs.setup(writer, globals); // call the setup method on the lhs to prepare for a load/store operation

        if (cat) {
            // Handle the case where we are doing a compound assignment
            // representing a String concatenation.

            writer.writeDup(lhs.accessElementCount(), catElementStackSize); // dup the top element and insert it
                                                                            // before concat helper on stack
            lhs.load(writer, globals);                                      // read the current lhs's value
            writer.writeAppendStrings(lhs.actual);                          // append the lhs's value using the StringBuilder

            rhs.write(writer, globals); // write the bytecode for the rhs

            if (!(rhs instanceof EBinary) || !((EBinary)rhs).cat) { // check to see if the rhs has already done a concatenation
                writer.writeAppendStrings(rhs.actual); // append the rhs's value since it's hasn't already
            }

            writer.writeToStrings(); // put the value for string concat onto the stack
            writer.writeCast(back);  // if necessary, cast the String to the lhs actual type

            if (lhs.read) {
                writer.writeDup(lhs.actual.type.getSize(), lhs.accessElementCount()); // if this lhs is also read
                                                                          // from dup the value onto the stack
            }

            lhs.store(writer, globals); // store the lhs's value from the stack in its respective variable/field/array
        } else if (operation != null) {
            // Handle the case where we are doing a compound assignment that
            // does not represent a String concatenation.

            writer.writeDup(lhs.accessElementCount(), 0); // if necessary, dup the previous lhs's value
                                                          // to be both loaded from and stored to
            lhs.load(writer, globals);                    // load the current lhs's value

            if (lhs.read && post) {
                writer.writeDup(lhs.actual.type.getSize(), lhs.accessElementCount()); // dup the value if the lhs is also
                                                                                // read from and is a post increment
            }

            writer.writeCast(there);    // if necessary cast the current lhs's value
                                        // to the promotion type between the lhs and rhs types
            rhs.write(writer, globals); // write the bytecode for the rhs

        // XXX: fix these types, but first we need def compound assignment tests.
        // its tricky here as there are possibly explicit casts, too.
        // write the operation instruction for compound assignment
            if (promote.dynamic) {
                writer.writeDynamicBinaryInstruction(
                    location, promote, DefType, DefType, operation, DefBootstrap.OPERATOR_COMPOUND_ASSIGNMENT);
            } else {
                writer.writeBinaryInstruction(location, promote, operation);
            }

            writer.writeCast(back); // if necessary cast the promotion type value back to the lhs's type

            if (lhs.read && !post) {
                writer.writeDup(lhs.actual.type.getSize(), lhs.accessElementCount()); // dup the value if the lhs is also
                                                                                // read from and is not a post increment
            }

            lhs.store(writer, globals); // store the lhs's value from the stack in its respective variable/field/array
        } else {
            // Handle the case for a simple write.

            rhs.write(writer, globals); // write the bytecode for the rhs rhs

            if (lhs.read) {
                writer.writeDup(lhs.actual.type.getSize(), lhs.accessElementCount()); // dup the value if the lhs is also read from
            }

            lhs.store(writer, globals); // store the lhs's value from the stack in its respective variable/field/array
        }
    }

    @Override
    public String toString() {
        List<Object> subs = new ArrayList<>();
        subs.add(lhs);
        if (rhs != null) {
            // Make sure "=" is in the symbol so this is easy to read at a glance
            subs.add(operation == null ? "=" : operation.symbol + "=");
            subs.add(rhs);
            return singleLineToString(subs);
        }
        subs.add(operation.symbol);
        if (pre) {
            subs.add("pre");
        }
        if (post) {
            subs.add("post");
        }
        return singleLineToString(subs);
    }
}


text:
http://webassembly.org/

https://www.w3.org/community/webassembly/

https://github.com/webassembly/


text:
namespace policy {

// Handles AutoLaunchProtocolsFromOrigins policy.
class AutoLaunchProtocolsPolicyHandler
    : public policy::SchemaValidatingPolicyHandler {
 public:
  static const char kProtocolNameKey[];
  static const char kOriginListKey[];

  explicit AutoLaunchProtocolsPolicyHandler(
      const policy::Schema& chrome_schema);

  AutoLaunchProtocolsPolicyHandler(const AutoLaunchProtocolsPolicyHandler&) =
      delete;
  AutoLaunchProtocolsPolicyHandler& operator=(
      const AutoLaunchProtocolsPolicyHandler&) = delete;

  ~AutoLaunchProtocolsPolicyHandler() override;

  // SchemaValidatingPolicyHandler:
  bool CheckPolicySettings(const PolicyMap& policies,
                           PolicyErrorMap* errors) override;
  void ApplyPolicySettings(const PolicyMap& policies,
                           PrefValueMap* prefs) override;
};

}  // namespace policy

#endif  // CHROME_BROWSER_EXTERNAL_PROTOCOL_AUTO_LAUNCH_PROTOCOLS_POLICY_HANDLER_H_


text:
layout: post
title: Seafood Paella
date: 2014-08-06 21:12:03.000000000 -04:00
categories: []
tags:
  - dinner
  - recipes
status: publish
type: post
published: true
meta:
  _edit_last: '1'
  _layout: inherit
  _post_restored_from: a:3:{s:20:"restored_revision_id";i:419;s:16:"restored_by_user";i:1;s:13:"restored_time";i:1408921200;}
  _thumbnail_id: '432'
image: /images/seafood_paella/seafood_paella_1.jpg
---

Seafood paella is one of the recipes I always make when friends/family come to visit, or for special occasions, or just for a special date night... any excuse we can find, we make it. Right now, it is probably my favorite recipe, even trumping my dad's chicken parm, which is really saying something.

{: .center}
![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_2.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_3.jpg)

Paella is a traditional Spanish dish of short-grain rice, saffron and good quality olive oil. The 3 most popular versions are seafood, vegetarian, or mixed meat and seafood. I love the seafood and mixed meat/seafood. I am posting the mixed because I find the seafood balances the spice of the chorizo and gives it a subtle rich flavor. If you aren't a sausage or spice fan, just omit it.

{: .center}
![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_4.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_5.jpg)

Note: You do not need to have a paella pan to make this recipe- for over a year I used a large, 2 inch deep skillet, and it turned out great each time. The paella pan just allows the bottom to crisp more evenly- and Dan loves the charred bottom.
Fun facts about paella:

The beginning mix of onion, garlic, parsley, and olive oil is called a soffritto. It smells like heaven.

Chorizo is a spanish sausage and can be found near the Italian sausage. If your grocery store doesn't have it, you can use hot Italian sausage as a substitute (though it is a bit spicier the Chorizo)

The toasted rice bottom is called socarrat.

If you can't find Spanish short grain rice- you can use Arborio rice (an Italian short grain, used for risotto)

Saffron is the most expensive spice in the world at $500-$5,000 dollars per pound. It is what provides the paella's yellow/orange coloring.

This is a before-and-after of the tomatoes and sofrita caramelizing together:

{: .center}
![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_6.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_7.jpg)

Toasting rice, the addition of chicken broth, and absorption of broth:

{: .center}
![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_8.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_9.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_10.jpg)

 Finally, the finished product:

{: .center}
![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_11.jpg) ![RD Eating - Seafood Paella](/images/seafood_paella/seafood_paella_12.jpg)

Because I made this for a special date night, I looked up what wines go well with seafood paella. We ended up with a Rueda and it paired amazingly. I'm generally not a fan of dry wines, but there was a slight saltiness to it that, when eaten with some of the seafood, made it seem like I was tasting the ocean!
What are some of your favorite seafood dishes? Let me know your thoughts below!

Seafood Paella

Recipe Type: Entree

Cuisine: Spanish

Author: Meagan

Prep time: <time itemprop="prepTime" datetime="PT15M">15 mins</time>

Cook time: <time itemprop="cookTime" datetime="PT50M">50 mins</time>

Total time: <time itemprop="totalTime" datetime="PT1H5M">1 hour 5 mins</time>

Serves: 4-6

Ingredients

3 Tbs extra-virgin olive oil

2 Spanish chorizo sausages, thickly sliced

1 Medium onion, diced

2 garlic cloves, minced

1/2 bunch flat-leaf parsley leaves, chopped, reserve some for garnish

2 Large tomatoes, diced

2 cups short grain Spanish rice

4 cups fat free, low sodium chicken broth, warmed

Generous pinch saffron threads

1/2 tsp salt

1 dozen littleneck clams or mussels, scrubbed

8 jumbo shrimp, peeled and de-veined

8 Largo scallops

1/2 Red pepper, sliced

1/2 cup sweet peas, frozen and thawed

Lemon wedges, for serving

Instructions

Heat oil in a paella pan over medium-high heat. Sauté the chorizo until browned, remove and reserve.

In the same pan, make a sofrito by sautéing the onions, garlic, and parsley. Cook for 2 or 3 minutes on a medium heat.

Reduce heat to medium. Add diced tomatoes and cook until the mixture caramelizes a bit and the flavors meld- about 10 minutes.

Fold in the rice and stir-fry to coat the grains, cook 2-3 minutes.

Pour in chicken broth and simmer for 15 minutes, gently stirring so the rice cooks evenly and absorbs 2/3 of the liquid.

Add chorizo, saffron and salt. Cook for 5 minutes.

Give the paella a good shake and let it simmer, without stirring, until the rice is al dente- about 15 minutes. During the last 10 minutes of cooking, when the rice is filling the pan, add the shrimp and scallops.

With 5 minutes remaining, add the mussels, peppers, and peas. Cover pan.

Uncover pan and test rice. Most to all liquid should be absorbed. Test temperature of scallops- they should be at 145 degrees F or higher.

Turn heat on high for 45 seconds to allow bottom to toast.

Let sit for 5 minutes then serve with parsley garnish and lemon.

3.2.1311


text:
'use strict'

const util = require('util')

function Unauthorized(message) {
  Error.captureStackTrace(this, this.constructor)

  this.name = this.constructor.name
  this.message = message
}

util.inherits(Unauthorized, Error)

module.exports = Unauthorized


text:
#include "Line.h"

namespace Visualization {

ITEM_COMMON_DEFINITIONS(Line, "item")

Line::Line(Item* parent, const LineStyle* style)
	: Super(parent, style)
{}

void Line::determineChildren(){}

void Line::updateGeometry(int availableWidth, int availableHeight)
{
	// If both height and width are specified, we'll get a fixed sized line along the longer of the two.
	// If only one is specified, this will be the fixed side of the line and the other side will stretch to fill all
	// available space.

	int w = 1;
	if (style()->width() ) w = style()->width();
	else if (availableWidth > 0) w = availableWidth;

	int h = 1;
	if (style()->height() ) h = style()->height();
	else if (availableHeight > 0) h = availableHeight;

	setSize(w, h);
}

void Line::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
	painter->setPen(style()->pen());
	// Note that we use the bounding box here an not the style on purpose. See updateGeometry().
	if (widthInLocal() > heightInLocal())
		painter->drawLine(QPointF(0, heightInLocal()/2.0), QPointF(widthInLocal(), heightInLocal()/2.0));
	else painter->drawLine(QPointF(widthInLocal()/2.0, 0), QPointF(widthInLocal()/2.0, heightInLocal()));
}

bool Line::sizeDependsOnParent() const
{
	return style()->width() == 0 || style()->height() == 0;
}

} /* namespace Visualization */


text:
.value-edit-object {
    display: inline-block;
}
.value-editor-button {
    color: black;
    /*background-color: #CCCCCC;*/
    /*padding: 7px 5px 8px 5px;*/
    font-size: 11px;
    cursor: pointer;
}

.value-editor-button:hover {
    /*background-color: #AAAAAA;*/
}
.write-reg-value-input {
    margin-top: -7px;
    margin-left: 1px;
}
.value-edit-controls {
    /*display: none;*/
    margin-top: -11px;
    margin-bottom: -7px;
}

.value-edit-controls .icon {
    /*padding: 11px 8px 7px 5px;*/
    padding: 5px 8px 10px 5px;
    background-color: #CCCCCC;
}
.value-editor-button .icon:hover {
    background-color: #AAAAAA;
}

.close-value-editor-button {
    margin-bottom: 1px;
    width: 20px;
}

.write-value-editor-button {
    margin-top: 1px;
}
.write-controls-holder {
    height: 24px;
    /*width: 70px;*/
    font-size: 22px;
    margin-left: -2px;
}

.write-controls-holder .write-confirm-msg {
    float: right;
    height: 30px;
}
.write-reg-value-input {
    margin-bottom: 0px !important;
    width: 120px;
    height:30px;
}
.write-confirm-msg {
    /*margin-top: -4px;*/
    display:none;
}

.active-register-info .read-mode .value-edit-controls {
	display:none;
}
.active-register-info .write-mode .value-display {
	display:none;
}

.active-register-info .direction-control-disabled .edit-register-button {
    display:none;
}
.active-register-info .direction-control-disabled .close-value-editor-button {
    display:none;
}

.active-register-info .edit-register-button {
    /*float:right;*/
    /*width: 10px;*/
    /*height: 10px;*/
    background-color: #CCCCCC;
    padding: 5px 5px 8px 5px;
    cursor: pointer;
    margin-top: -5px;
    margin-bottom: -5px;
}
.active-register-info .edit-register-button:hover {
    background-color: #AAAAAA;
}

.direction-control-disabled .register-value {
    padding-left: 28px;
}


text:
package org.apache.camel.component.mail;

import org.apache.camel.Endpoint;
import org.apache.camel.PollingConsumer;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.fail;

/**
 * Unit test for various invalid configurations etc.
 */
public class InvalidConfigurationTest extends CamelTestSupport {

    @Test
    public void testSMTPCanNotBeUsedForConsumingMails() throws Exception {
        Endpoint endpoint = context.getEndpoint("smtp://localhost?username=james");
        PollingConsumer consumer = endpoint.createPollingConsumer();
        try {
            consumer.start();
            fail("Should have thrown NoSuchProviderException as smtp protocol cannot be used for consuming mails");
        } catch (IllegalArgumentException e) {
            // expected
        }
    }

    @Test
    public void testSMTPSCanNotBeUsedForConsumingMails() throws Exception {
        Endpoint endpoint = context.getEndpoint("smtps://localhost?username=james");
        PollingConsumer consumer = endpoint.createPollingConsumer();
        try {
            consumer.start();
            fail("Should have thrown NoSuchProviderException as smtp protocol cannot be used for consuming mails");
        } catch (IllegalArgumentException e) {
            // expected
        }
    }

}


text:
import { getAsyncInjectors } from 'utils/asyncInjectors';

const errorLoading = (err) => {
  console.error('Dynamic page loading failed', err); // eslint-disable-line no-console
};

const loadModule = (cb) => (componentModule) => {
  cb(null, componentModule.default);
};

export default function createRoutes(store) {
  // Create reusable async injectors using getAsyncInjectors factory
  const { injectReducer, injectSagas } = getAsyncInjectors(store); // eslint-disable-line no-unused-vars

  return [
    {
      path: '/',
      name: 'home',
      getComponent(nextState, cb) {
        const importModules = Promise.all([
          import('containers/HomePage/reducer'),
          import('containers/HomePage/sagas'),

          import('containers/Communicate/reducer'),
          import('containers/Communicate/sagas'),

          import('containers/BusinessPage/reducer'),
          import('containers/BusinessPage/sagas'),

          import('containers/UserCenter/reducer'),
          import('containers/UserCenter/sagas'),

          import('containers/HomePage'),
        ]);

        const renderRoute = loadModule(cb);

        importModules.then(([
          reducer, sagas,
          communicateReducer, communicateSagas,
          businessReducer, businessSagas,
          userCenterReducer, userCenterSagas,
          component,
        ]) => {
          injectReducer('home', reducer.default);
          injectSagas(sagas.default);

          injectReducer('communicate', communicateReducer.default);
          injectSagas(communicateSagas.default);

          injectReducer('business', businessReducer.default);
          injectSagas(businessSagas.default);

          injectReducer('userCenter', userCenterReducer.default);
          injectSagas(userCenterSagas.default);

          renderRoute(component);
        });

        importModules.catch(errorLoading);
      },
      childRoutes: [
        {
          path: 'userSetting',
          name: 'userSettingPage',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/UserSettingPage/reducer'),
              import('containers/UserSettingPage/sagas'),
              import('containers/UserSettingPage'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([reducer, sagas, component]) => {
              injectReducer('userSettingPage', reducer.default);
              injectSagas(sagas.default);
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'userPrivacy',
          name: 'userPrivacy',
          getComponent(location, cb) {
            import('containers/UserPrivacy')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userBlackList',
          name: 'userBlackList',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/UserBlackList/reducer'),
              import('containers/UserBlackList/sagas'),
              import('containers/UserBlackList'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([reducer, sagas, component]) => {
              injectReducer('userBlackList', reducer.default);
              injectSagas(sagas.default);
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'resetMobile',
          name: 'resetMobile',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/ResetMobile'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([component]) => {
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'about',
          name: 'aboutPage',
          getComponent(location, cb) {
            import('containers/AboutPage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'feedBack',
          name: 'feedBackPage',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/FeedBackPage/reducer'),
              import('containers/FeedBackPage/sagas'),
              import('containers/FeedBackPage'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([reducer, sagas, component]) => {
              injectReducer('feedBackPage', reducer.default);
              injectSagas(sagas.default);
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'feedBackResult',
          name: 'feedBackResult',
          getComponent(location, cb) {
            import('containers/FeedBackResult')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userEdit',
          name: 'userEdit',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/UserEdit'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([component]) => {
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'userEditBasic',
          name: 'userEditBasic',
          getComponent(nextState, cb) {
            const importModules = Promise.all([
              import('containers/UserEditBasic'),
            ]);

            const renderRoute = loadModule(cb);

            importModules.then(([component]) => {
              renderRoute(component);
            });

            importModules.catch(errorLoading);
          },
        }, {
          path: 'userEditCompany',
          name: 'userEditCompany',
          getComponent(location, cb) {
            import('containers/UserEditCompany')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userEditIntro',
          name: 'userEditIntro',
          getComponent(location, cb) {
            import('containers/UserEditIntro')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userEditIdentity',
          name: 'userEditIdentity',
          getComponent(location, cb) {
            import('containers/UserEditIdentity')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userEditService',
          name: 'userEditService',
          getComponent(location, cb) {
            import('containers/UserEditService')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userEditPics',
          name: 'userEditPictures',
          getComponent(location, cb) {
            import('containers/UserEditPictures')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectAddress',
          name: 'selectAddress',
          getComponent(location, cb) {
            import('containers/SelectAddress')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userCenterVisitor',
          name: 'userCenterVisitor',
          getComponent(location, cb) {
            import('containers/UserCenterVisitor')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userCenterCollects',
          name: 'userCenterCollects',
          getComponent(location, cb) {
            import('containers/UserCenterCollects')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userAuthorize',
          name: 'userAuthorize',
          getComponent(location, cb) {
            import('containers/UserAuthorize')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userMoments',
          name: 'userMoments',
          getComponent(location, cb) {
            import('containers/UserMoments')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userAuthorizeFiles',
          name: 'userAuthorizeFiles',
          getComponent(location, cb) {
            import('containers/UserAuthorizeFiles')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userCommunicate',
          name: 'userCommunication',
          getComponent(location, cb) {
            import('containers/UserCommunication')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'momentDetail',
          name: 'momentDetail',
          getComponent(location, cb) {
            import('containers/MomentDetail')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userInfo',
          name: 'userInfo',
          getComponent(location, cb) {
            import('containers/UserInfo')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'businessPublish',
          name: 'businessPublish',
          getComponent(location, cb) {
            import('containers/BusinessPublish')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'businessPublishSupplier',
          name: 'businessPublishSupplier',
          getComponent(location, cb) {
            import('containers/BusinessPublishSupplier')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        },  {
          path: 'communicatePublish',
          name: 'communicatePublish',
          getComponent(location, cb) {
            import('containers/CommunicatePublish')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'businessSearch',
          name: 'businessSearch',
          getComponent(location, cb) {
            import('containers/BusinessSearch')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'guide',
          name: 'guidePage',
          getComponent(location, cb) {
            import('containers/GuidePage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'recentDemand',
          name: 'recentDemandPage',
          getComponent(location, cb) {
            import('containers/RecentDemandPage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'communicateSearch',
          name: 'communicateSearch',
          getComponent(location, cb) {
            import('containers/CommunicateSearch')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'complaintUser',
          name: 'complaintUser',
          getComponent(location, cb) {
            import('containers/ComplaintUser')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectFriend',
          name: 'selectFriend',
          getComponent(location, cb) {
            import('containers/SelectFriend')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectReward',
          name: 'selectReward',
          getComponent(location, cb) {
            import('containers/SelectReward')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectNumber',
          name: 'selectNumber',
          getComponent(location, cb) {
            import('containers/SelectNumber')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectUnits',
          name: 'selectUnits',
          getComponent(location, cb) {
            import('containers/SelectUnits')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectPrice',
          name: 'selectPrice',
          getComponent(location, cb) {
            import('containers/SelectPrice')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'editUser',
          name: 'editUserPage',
          getComponent(location, cb) {
            import('containers/EditUserPage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'editUserRemark',
          name: 'editUserRemark',
          getComponent(location, cb) {
            import('containers/EditUserRemark')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'userPointsRule',
          name: 'userPointsRule',
          getComponent(location, cb) {
            import('containers/UserPointsRule')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'addFriend',
          name: 'addFriendPage',
          getComponent(location, cb) {
            import('containers/AddFriendPage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'introducePublish',
          name: 'introducePublish',
          getComponent(location, cb) {
            import('containers/IntroducePublish')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'selectCharacterService',
          name: 'selectCharacterService',
          getComponent(location, cb) {
            import('containers/SelectCharacterService')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'businessRecommend',
          name: 'businessRecommend',
          getComponent(location, cb) {
            import('containers/BusinessRecommend')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        }, {
          path: 'service',
          name: 'serviceListPage',
          getComponent(location, cb) {
            import('containers/ServiceListPage')
              .then(loadModule(cb))
              .catch(errorLoading);
          },
        },
      ],
    }, {
      path: 'login',
      name: 'loginPage',
      getComponent(nextState, cb) {
        const importModules = Promise.all([
          import('containers/LoginPage/reducer'),
          import('containers/LoginPage/sagas'),
          import('containers/LoginPage'),
        ]);

        const renderRoute = loadModule(cb);

        importModules.then(([reducer, sagas, component]) => {
          injectReducer('loginPage', reducer.default);
          injectSagas(sagas.default);
          renderRoute(component);
        });

        importModules.catch(errorLoading);
      },
    }, {
      path: 'resetPassword',
      name: 'resetPassword',
      getComponent(nextState, cb) {
        const importModules = Promise.all([
          import('containers/ResetPassword'),
        ]);

        const renderRoute = loadModule(cb);

        importModules.then(([component]) => {
          renderRoute(component);
        });

        importModules.catch(errorLoading);
      },
    }, {
      path: 'preview',
      name: 'previewPage',
      getComponent(location, cb) {
        import('containers/PreviewPage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: 'loginPhone',
      name: 'loginPhonePage',
      getComponent(location, cb) {
        import('containers/LoginPhonePage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: 'register',
      name: 'registerPage',
      getComponent(location, cb) {
        import('containers/RegisterPage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: 'browser',
      name: 'browserPage',
      getComponent(location, cb) {
        import('containers/BrowserPage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: 'index.html',
      name: 'indexPage',
      getComponent(location, cb) {
        import('containers/IndexPage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: 'loginSetPassword',
      name: 'loginSetPassword',
      getComponent(location, cb) {
        import('containers/LoginSetPassword')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    }, {
      path: '*',
      name: 'notfound',
      getComponent(nextState, cb) {
        import('containers/NotFoundPage')
          .then(loadModule(cb))
          .catch(errorLoading);
      },
    },
  ];
}


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="appButtonMaterial" parent="Widget.AppCompat.Button">
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:textSize">37sp</item>
        <item name="android:layout_weight">1</item>

    </style>

    <style name="appButtonMaterial_land" parent="Widget.AppCompat.Button">
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:textSize">25sp</item>
        <item name="android:layout_weight">1</item>

    </style>

    <style name="calcText" parent="AppTheme">
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:textSize">25dp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:padding">25dp</item>
        <item name="android:background">@color/colorPrimary</item>

    </style>

</resources>


text:
use num::ToPrimitive;
use StoreValue;
use store::StoreValueStatic;
use std::ops::Deref;

/// A type that want to be converted into from a `StoreValue`
/// must implement this trait.
pub trait Cast {

    /// Try to cast the given StoreValue into Self.
    /// If the StoreValue has an appropriate type, return
    /// `None`.
    fn cast(this: StoreValue) -> Option<Self>;
}

/// A type to convert a type into a store value
/// but without moving it.
pub trait AsStoreValue {

    /// Should convert the type into a StoreValue.
    /// Note that the lifetime of the StoreValue is bounded
    /// by `self`.
    fn as_store_value(&self) -> StoreValue;
}

/// The friend trait of the `Cast` trait. It is automatically implemented
/// and shouldn't be implemented directly. Rely on the `Cast` trait instead.
pub trait AssignFromCast {

    fn assign(&mut self, this: StoreValue);
}

impl<T> AssignFromCast for T
    where T: Cast
{
    fn assign(&mut self, this: StoreValue) {
        match <Self as Cast>::cast(this) {
            Some(v) => *self = v,
            None => (),
        }
    }
}

impl Cast for StoreValueStatic {
    fn cast(this: StoreValue) -> Option<Self> {
        match this {
            StoreValue::String(s) => Some(StoreValueStatic::String(s.to_string())),
            StoreValue::Integer(i) => Some(StoreValueStatic::Integer(i)),
            StoreValue::Boolean(b) => Some(StoreValueStatic::Boolean(b)),
        }
    }
}

impl AsStoreValue for StoreValueStatic {
    fn as_store_value(&self) -> StoreValue {
        match self {
            &StoreValueStatic::String(ref s) => StoreValue::String(s.deref()),
            &StoreValueStatic::Integer(i) => StoreValue::Integer(i),
            &StoreValueStatic::Boolean(b) => StoreValue::Boolean(b),
        }
    }
}

/// Implementation for integers
macro_rules! impl_for_integer {
    ($type_ident:ident, $to_value:ident) => (
        impl Cast for $type_ident {
            fn cast(this: StoreValue) -> Option<Self> {
                match this {
                    StoreValue::Integer(i) => {
                        i.$to_value()
                    }
                    _ => None
                }
            }
        }
        impl AsStoreValue for $type_ident {
            fn as_store_value(&self) -> StoreValue {
                StoreValue::Integer(*self as i64)
            }
        }
    )
}

impl_for_integer!(i64, to_i64);
impl_for_integer!(i32, to_i32);
impl_for_integer!(i16, to_i16);
impl_for_integer!(i8,  to_i8);

impl_for_integer!(u32, to_u32);
impl_for_integer!(u16, to_u16);
impl_for_integer!(u8,  to_u8);

impl Cast for String {
    fn cast(this: StoreValue) -> Option<Self> {
        match this {
            StoreValue::String(s) => {
                Some(s.to_string())
            }
            StoreValue::Integer(i) => {
                Some(i.to_string())
            }
            StoreValue::Boolean(b) => {
                Some(b.to_string())
            }
        }
    }
}

impl AsStoreValue for String {
    fn as_store_value(&self) -> StoreValue {
        StoreValue::String(self.deref())
    }
}

impl Cast for bool {
    fn cast(this: StoreValue) -> Option<Self> {
        match this {
            StoreValue::Boolean(b) => {
                Some(b)
            },
            StoreValue::String(s) => {
                Some(s.is_empty())
            },
            StoreValue::Integer(i) => {
                Some(i != 0)
            }
        }
    }
}

impl AsStoreValue for bool {
    fn as_store_value(&self) -> StoreValue {
        StoreValue::Boolean(*self)
    }
}


text:
package org.kuali.kra.institutionalproposal.specialreview;

import org.kuali.kra.common.specialreview.rules.AddSpecialReviewRuleTestBase;
import org.kuali.kra.institutionalproposal.document.InstitutionalProposalDocument;
import org.kuali.rice.kew.api.exception.WorkflowException;
import org.kuali.rice.krad.UserSession;
import org.kuali.rice.krad.document.Document;
import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
import org.kuali.rice.krad.util.GlobalVariables;

public class AddInstitutionalProposalSpecialReviewRuleTest extends AddSpecialReviewRuleTestBase<InstitutionalProposalSpecialReview> {

    @Override
    public Document getDocument() throws WorkflowException {
        GlobalVariables.setUserSession(new UserSession("quickstart"));
        Document document = KRADServiceLocatorWeb.getDocumentService().getNewDocument(InstitutionalProposalDocument.class);
        return document;
    }

    @Override
    public InstitutionalProposalSpecialReview getSpecialReview() {
        return new InstitutionalProposalSpecialReview();
    }

}


text:
package pod_test

import (
	"reflect"
	"testing"

	. "github.com/onsi/gomega"

	coreV1 "k8s.io/api/core/v1"
	metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	"istio.io/istio/galley/pkg/config/event"
	"istio.io/istio/galley/pkg/config/meta/metadata"
	"istio.io/istio/galley/pkg/config/processor/transforms/serviceentry/pod"
	"istio.io/istio/galley/pkg/config/resource"
)

const (
	ip                         = "1.2.3.4"
	nodeName                   = "node1"
	podName                    = "pod1"
	namespace                  = "ns"
	region                     = "region1"
	zone                       = "zone1"
	expectedLocality           = "region1/zone1"
	serviceAccountName         = "myServiceAccount"
	expectedServiceAccountName = "spiffe://cluster.local/ns/ns/sa/myServiceAccount"
)

var (
	fullName = resource.NewName(namespace, podName)

	labels = map[string]string{
		"l1": "v1",
		"l2": "v2",
	}
)

func TestPodLifecycle(t *testing.T) {
	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	labels := map[string]string{
		"l2": "v2",
	}

	// Add the node.
	h.Handle(event.Event{
		Kind:   event.Added,
		Source: metadata.K8SCoreV1Nodes,
		Entry:  nodeEntry(region, zone),
	})

	t.Run("Add", func(t *testing.T) {
		g := NewGomegaWithT(t)
		h.Handle(event.Event{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		})
		p, _ := c.GetPodByIP(ip)
		expected := pod.Info{
			FullName:           fullName,
			IP:                 ip,
			Locality:           expectedLocality,
			NodeName:           nodeName,
			ServiceAccountName: expectedServiceAccountName,
			Labels:             labels,
		}
		g.Expect(p).To(Equal(expected))
		l.assertAdded(t, expected)
	})

	l.reset()

	t.Run("NoChange", func(t *testing.T) {
		g := NewGomegaWithT(t)
		h.Handle(event.Event{
			Kind:   event.Updated,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodRunning).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		})
		p, _ := c.GetPodByIP(ip)
		expected := pod.Info{
			FullName:           fullName,
			IP:                 ip,
			Locality:           expectedLocality,
			NodeName:           nodeName,
			ServiceAccountName: expectedServiceAccountName,
			Labels:             labels,
		}
		g.Expect(p).To(Equal(expected))
		l.assertNone(t)
	})

	l.reset()

	t.Run("ChangeLabel", func(t *testing.T) {
		g := NewGomegaWithT(t)

		labels = map[string]string{
			"l3": "v3",
			"l4": "v4",
		}
		h.Handle(event.Event{
			Kind:   event.Updated,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodRunning).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		})
		p, _ := c.GetPodByIP(ip)
		expected := pod.Info{
			FullName:           fullName,
			IP:                 ip,
			Locality:           expectedLocality,
			NodeName:           nodeName,
			ServiceAccountName: expectedServiceAccountName,
			Labels:             labels,
		}
		g.Expect(p).To(Equal(expected))
		l.assertUpdated(t, expected)
	})

	l.reset()

	t.Run("Delete", func(t *testing.T) {
		g := NewGomegaWithT(t)
		h.Handle(event.Event{
			Kind:   event.Deleted,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodRunning).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		})
		_, ok := c.GetPodByIP(ip)
		g.Expect(ok).To(BeFalse())
		l.assertDeleted(t, pod.Info{
			FullName:           fullName,
			IP:                 ip,
			Locality:           expectedLocality,
			NodeName:           nodeName,
			ServiceAccountName: expectedServiceAccountName,
			Labels:             labels,
		})
	})
}

func TestNodeLifecycle(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Nodes,
			Entry:  nodeEntry(region, zone),
		},
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
		{
			Kind:   event.Deleted,
			Source: metadata.K8SCoreV1Nodes,
			Entry:  nodeEntry(region, zone),
		},
	})

	p, _ := c.GetPodByIP(ip)
	expected := pod.Info{
		FullName:           fullName,
		IP:                 ip,
		Locality:           "",
		NodeName:           nodeName,
		ServiceAccountName: expectedServiceAccountName,
		Labels:             labels,
	}
	g.Expect(p).To(Equal(expected))
	l.assertUpdated(t, expected)
}

func TestNodeAddedAfterPod(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Nodes,
			Entry:  nodeEntry(region, zone),
		},
	})

	p, _ := c.GetPodByIP(ip)
	expected := pod.Info{
		FullName:           fullName,
		IP:                 ip,
		Locality:           expectedLocality,
		NodeName:           nodeName,
		ServiceAccountName: expectedServiceAccountName,
		Labels:             labels,
	}
	g.Expect(p).To(Equal(expected))
	l.assertUpdated(t, expected)
}

func TestNodeWithOnlyRegion(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Nodes,
			Entry:  nodeEntry(region, ""),
		},
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
	})

	p, _ := c.GetPodByIP(ip)
	expected := pod.Info{
		FullName:           fullName,
		IP:                 ip,
		Locality:           "region1/",
		NodeName:           nodeName,
		ServiceAccountName: expectedServiceAccountName,
	}
	g.Expect(p).To(Equal(expected))
	l.assertAdded(t, expected)
}

func TestNodeWithNoLocality(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Nodes,
			Entry:  nodeEntry("", ""),
		},
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
	})

	p, _ := c.GetPodByIP(ip)
	expected := pod.Info{
		FullName:           fullName,
		IP:                 ip,
		Locality:           "",
		NodeName:           nodeName,
		ServiceAccountName: expectedServiceAccountName,
	}
	g.Expect(p).To(Equal(expected))
	l.assertAdded(t, expected)
}

func TestNoNamespaceAndNoServiceAccount(t *testing.T) {
	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	g := NewGomegaWithT(t)
	h.Handle(event.Event{
		Kind:   event.Added,
		Source: metadata.K8SCoreV1Pods,
		Entry: &resource.Entry{
			Metadata: resource.Metadata{
				Name:    fullName,
				Version: resource.Version("v1"),
			},
			Item: &coreV1.Pod{
				ObjectMeta: metaV1.ObjectMeta{
					Name:      podName,
					Namespace: "",
				},
				Spec: coreV1.PodSpec{
					NodeName:           nodeName,
					ServiceAccountName: "",
				},
				Status: coreV1.PodStatus{
					PodIP: "1.2.3.4",
					Phase: coreV1.PodRunning,
				},
			},
		},
	})
	p, _ := c.GetPodByIP(ip)
	expected := pod.Info{
		IP:                 ip,
		FullName:           fullName,
		NodeName:           nodeName,
		ServiceAccountName: "spiffe://cluster.local/ns//sa/",
	}
	g.Expect(p).To(Equal(expected))
	l.assertAdded(t, expected)
}

func TestWrongCollectionShouldNotPanic(t *testing.T) {
	l := &listener{}
	_, h := pod.NewCache(l.asListener())

	h.Handle(event.Event{
		Kind:   event.Added,
		Source: metadata.K8SCoreV1Services,
		Entry: &resource.Entry{
			Metadata: resource.Metadata{
				Name:    resource.NewName("ns", "myservice"),
				Version: resource.Version("v1"),
			},
			Item: &coreV1.Service{},
		},
	})
	l.assertNone(t)
}

func TestInvalidPodPhase(t *testing.T) {
	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	for _, phase := range []coreV1.PodPhase{coreV1.PodSucceeded, coreV1.PodFailed, coreV1.PodUnknown} {
		t.Run(string(phase), func(t *testing.T) {
			g := NewGomegaWithT(t)
			h.Handle(event.Event{
				Kind:   event.Added,
				Source: metadata.K8SCoreV1Services,
				Entry: newPodEntryBuilder().
					IP(ip).
					Labels(labels).
					Phase(phase).
					NodeName(nodeName).
					ServiceAccountName(serviceAccountName).Build(),
			})
			_, ok := c.GetPodByIP(ip)
			g.Expect(ok).To(BeFalse())
		})
	}
}

func TestUpdateWithInvalidPhaseShouldDelete(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
		{
			Kind:   event.Updated,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodUnknown).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
	})

	_, ok := c.GetPodByIP(ip)
	g.Expect(ok).To(BeFalse())
	l.assertDeleted(t, pod.Info{
		IP:                 ip,
		FullName:           fullName,
		NodeName:           nodeName,
		Labels:             labels,
		ServiceAccountName: expectedServiceAccountName,
	})
}

func TestDeleteWithNoItemShouldUseFullName(t *testing.T) {
	g := NewGomegaWithT(t)

	l := &listener{}
	c, h := pod.NewCache(l.asListener())

	applyEvents(l, h, []event.Event{
		{
			Kind:   event.Added,
			Source: metadata.K8SCoreV1Pods,
			Entry: newPodEntryBuilder().
				IP(ip).
				Labels(labels).
				Phase(coreV1.PodPending).
				NodeName(nodeName).
				ServiceAccountName(serviceAccountName).Build(),
		},
		{
			Kind:   event.Deleted,
			Source: metadata.K8SCoreV1Pods,
			Entry: &resource.Entry{
				Metadata: resource.Metadata{
					Name:    fullName,
					Version: resource.Version("v1"),
				},
			},
		},
	})

	_, ok := c.GetPodByIP(ip)
	g.Expect(ok).To(BeFalse())
}

func TestDeleteNotFoundShouldNotPanic(t *testing.T) {
	l := &listener{}
	_, h := pod.NewCache(l.asListener())

	// Delete it, but with a nil Item to force a lookup by fullName.
	h.Handle(event.Event{
		Kind:   event.Deleted,
		Source: metadata.K8SCoreV1Services,
		Entry: newPodEntryBuilder().
			IP(ip).
			Labels(labels).
			Phase(coreV1.PodPending).
			NodeName(nodeName).
			ServiceAccountName(serviceAccountName).Build(),
	})
}

func TestDeleteNotFoundWithMissingItemShouldNotPanic(t *testing.T) {
	l := &listener{}
	_, h := pod.NewCache(l.asListener())

	// Delete it, but with a nil Item to force a lookup by fullName.
	h.Handle(event.Event{
		Kind:   event.Deleted,
		Source: metadata.K8SCoreV1Pods,
		Entry: &resource.Entry{
			Metadata: resource.Metadata{
				Name: fullName,
			},
		},
	})
}

func TestPodWithNoIPShouldBeIgnored(t *testing.T) {
	l := &listener{}
	_, h := pod.NewCache(l.asListener())

	h.Handle(event.Event{
		Kind:   event.Added,
		Source: metadata.K8SCoreV1Pods,
		Entry: newPodEntryBuilder().
			Phase(coreV1.PodPending).Build(),
	})
	l.assertNone(t)
}

func applyEvents(l *listener, h event.Handler, events []event.Event) {
	for _, event := range events {
		l.reset()
		h.Handle(event)
	}
}

type podEntryBuilder struct {
	ip                 string
	nodeName           string
	labels             map[string]string
	serviceAccountName string
	phase              coreV1.PodPhase
}

func newPodEntryBuilder() *podEntryBuilder {
	return &podEntryBuilder{}
}

func (b *podEntryBuilder) IP(ip string) *podEntryBuilder {
	b.ip = ip
	return b
}

func (b *podEntryBuilder) NodeName(nodeName string) *podEntryBuilder {
	b.nodeName = nodeName
	return b
}

func (b *podEntryBuilder) Labels(labels map[string]string) *podEntryBuilder {
	b.labels = labels
	return b
}

func (b *podEntryBuilder) ServiceAccountName(serviceAccountName string) *podEntryBuilder {
	b.serviceAccountName = serviceAccountName
	return b
}

func (b *podEntryBuilder) Phase(phase coreV1.PodPhase) *podEntryBuilder {
	b.phase = phase
	return b
}

func (b *podEntryBuilder) Build() *resource.Entry {
	return &resource.Entry{
		Metadata: resource.Metadata{
			Name: fullName,
		},
		Item: &coreV1.Pod{
			ObjectMeta: metaV1.ObjectMeta{
				Name:      podName,
				Namespace: namespace,
				Labels:    b.labels,
			},
			Spec: coreV1.PodSpec{
				NodeName:           b.nodeName,
				ServiceAccountName: b.serviceAccountName,
			},
			Status: coreV1.PodStatus{
				PodIP: b.ip,
				Phase: b.phase,
			},
		},
	}
}

func nodeEntry(region, zone string) *resource.Entry {
	labels := make(resource.StringMap)
	if region != "" {
		labels[pod.LabelZoneRegion] = region
	}
	if zone != "" {
		labels[pod.LabelZoneFailureDomain] = zone
	}
	return &resource.Entry{
		Metadata: resource.Metadata{
			Name:   resource.NewName("", nodeName),
			Labels: labels,
		},
	}
}

type listener struct {
	added   []pod.Info
	updated []pod.Info
	deleted []pod.Info
}

func (l *listener) reset() {
	l.added = l.added[:0]
	l.updated = l.updated[:0]
	l.deleted = l.deleted[:0]
}

func (l *listener) onAdded(p pod.Info) {
	l.added = append(l.added, p)
}

func (l *listener) onUpdated(p pod.Info) {
	l.updated = append(l.updated, p)
}

func (l *listener) onDeleted(p pod.Info) {
	l.deleted = append(l.deleted, p)
}

func (l *listener) asListener() pod.Listener {
	return pod.Listener{
		PodAdded:   l.onAdded,
		PodUpdated: l.onUpdated,
		PodDeleted: l.onDeleted,
	}
}

func (l *listener) assertNone(t *testing.T) {
	t.Helper()
	assertNone(t, "added", l.added)
	assertNone(t, "updated", l.updated)
	assertNone(t, "deleted", l.deleted)
}

func (l *listener) assertAdded(t *testing.T, expected pod.Info) {
	t.Helper()
	assertOne(t, "added", l.added, expected)
	assertNone(t, "updated", l.updated)
	assertNone(t, "deleted", l.deleted)

}

func (l *listener) assertUpdated(t *testing.T, expected pod.Info) {
	t.Helper()
	assertNone(t, "added", l.added)
	assertOne(t, "updated", l.updated, expected)
	assertNone(t, "deleted", l.deleted)

}

func (l *listener) assertDeleted(t *testing.T, expected pod.Info) {
	t.Helper()
	assertNone(t, "added", l.added)
	assertNone(t, "updated", l.updated)
	assertOne(t, "deleted", l.deleted, expected)
}

func assertNone(t *testing.T, name string, result []pod.Info) {
	t.Helper()
	if len(result) > 0 {
		t.Fatalf("%s: expected 0, found %d", name, len(result))
	}
}

func assertOne(t *testing.T, name string, result []pod.Info, expected pod.Info) {
	t.Helper()
	if len(result) != 1 {
		t.Fatalf("%s: expected 1, found %d", name, len(result))
	}
	actual := result[0]
	if !reflect.DeepEqual(expected, actual) {
		t.Fatalf("%s: expected\n%v+\nto equal\n%v+", name, actual, expected)
	}
}


text:
package com.developer.iblog.service;

import com.developer.iblog.model.dto.AdminCommentDTO;
import com.developer.iblog.model.dto.CommentInfoDTO;
import com.developer.iblog.model.persistent.BlogComment;

import java.util.List;

/**
 * Created by cnbo on 17-5-21.
 */
public interface IManageCommentService {

    List<CommentInfoDTO> getByPage(AdminCommentDTO adminCommentDTO);

    Integer getPages(AdminCommentDTO adminCommentDTO);

    Integer deleteComment(Integer commentId);

    Integer getCommentCount();

    List<BlogComment> getRecentComment();

}


text:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.ProjectSystem;

using VSPropertyPages;

namespace XSharp.ProjectSystem.VS.PropertyPages
{
    [Guid(PageGuid)]
    public class DebugPropertyPage : PropertyPageBase
    {
        public const string PageGuid = "b56385a5-ad14-4f70-bbeb-ab63baee3dc1";

        public override string PageName => "Debug";

        public override IPropertyPageUI CreatePropertyPageUI() =>
            new DebugPropertyPageControl()
            {
                DataContext = new DebugPropertyPageViewModel(PropertyManager, ProjectThreadingService)
            };

        public override IPropertyManager CreatePropertyManager(
            IReadOnlyCollection<ConfiguredProject> configuredProjects) =>
            new DynamicConfiguredPropertyManager(UnconfiguredProject, configuredProjects);
    }
}