text:
## Entity name resolver and providers ##

**Entity name resolver**

The [Entity Name Resolver](./../../Provider/EntityNameResolver.php) service has been introduced to make the configuring of entity name formatting more flexible.

It provides two functions for getting the entity name:

- string *public* *getName*(object *entity*[, string *format*, string *locale*])

This method can be used to get a text representation of an entity formatted according to the format notation passed (e.g. "full", "short", etc.). If the format is not specified, the default one will be used.

To format the text representation using a specific locale, the *locale* parameter may be passed.

- string *public* *getNameDQL*(string *className*, string *alias*[, string *format*, string *locale*])

This method is useful for getting a DQL expression that can be used to get a text representation of the given type of entities formatted according to the format notation passed (e.g. "full", "short", etc.). If the format is not specified, the default one will be used.

To get a text representation using a specific locale, the *locale* parameter may be passed.

Example of usage:

```php
$entityNameResolver = $container->get('oro_entity.entity_name_resolver');
$user->setFirstName('John');
$user->setLastName('Doe');
echo $entityNameResolver->getName($user); // outputs: John Doe
echo $entityNameResolver->getNameDQL('Oro\Bundle\UserBundle\Entity\User', 'u'); // outputs: CONCAT(u.firstName, CONCAT(u.lastName, ' ')
```

The available entity formats can be configured in the `entity_name_formats` section of `Resources/config/oro/entity.yml` file:

```yaml
oro_entity:
    entity_name_formats:
        full:
            fallback: short
        short: ~
```

Note that it is possible to specify the fallback format for the entity that will be used when the given format is not implemented by any providers.

**Entity name providers**

The Entity Name Resolver does not know how to get the entity name by itself but instead it expects to have a collection of Entity Name Providers that will do the job.
The first provider that is able to return a reliable result wins. The rest of providers will not be asked.

To create an Entity Name Provider you should implement the [EntityNameProviderInterface](./../../Provider/EntityNameProviderInterface.php):

```php
use Oro\Bundle\EntityBundle\Provider\EntityNameProviderInterface;

class FullNameProvider implements EntityNameProviderInterface
{
    /**
     * {@inheritdoc}
     */
    public function getName($format, $locale, $entity)
    {
        if ($format === self::FULL && $this->isFullFormatSupported(get_class($entity))) {
            // return entity format
        }

        return false;
    }

    /**
     * {@inheritdoc}
     */
    public function getNameDQL($format, $locale, $className, $alias)
    {
        if ($format === self::FULL && $this->isFullFormatSupported($className)) {
            // return DQL to get entity format
        }

        return false;
    }

    /**
     * @param string $className
     *
     * @return bool
     */
    protected function isFullFormatSupported($className)
    {
        // check if $className supports full name formatting, e.g. implements some required interfaces
    }
}
```

Note that if the provider cannot return a reliable result, FALSE should be returned to keep looking in the other providers in chain.

Entity name providers are registered in the DI container by `oro_entity.name_provider` tag:

```yml
    oro_entity.entity_name_provider.default:
        class: %oro_entity.entity_name_provider.default.class%
        public: false
        arguments:
            - @doctrine
        tags:
            - { name: oro_entity.name_provider, priority: -100 }
```

The priority can be specified to move the provider up or down the providers chain. The bigger the priority number is, the earlier the provider will be executed. The priority value is optional and defaults to 0.


text:
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::CameraInfo> MySyncPolicy;
typedef message_filters::Subscriber<sensor_msgs::Image> image_sub_type;
typedef message_filters::Subscriber<sensor_msgs::CameraInfo> info_sub_type;

class Sync{
	public:
		Sync();
	private:
		ros::NodeHandle nh;
		ros::Publisher sync_image_pub;
  		ros::Publisher sync_info_pub;
		message_filters::Subscriber<sensor_msgs::Image> *image_sub;
		message_filters::Subscriber<sensor_msgs::CameraInfo> *info_sub;
		message_filters::Synchronizer<MySyncPolicy> *sync;

		void sync_cb(const sensor_msgs::ImageConstPtr& image, const sensor_msgs::CameraInfoConstPtr& cam_info);
};

Sync::Sync(){
	sync_image_pub = nh.advertise<sensor_msgs::Image>("/usb_cam/image_mono_sync", 1);
	sync_info_pub = nh.advertise<sensor_msgs::CameraInfo>("/usb_cam/camera_info_sync", 1);

	image_sub = new image_sub_type(nh, "/usb_cam/image_mono", 1);
	info_sub = new info_sub_type(nh, "/usb_cam/camera_info", 1);

  	sync = new message_filters::Synchronizer<MySyncPolicy>(MySyncPolicy(10), *image_sub, *info_sub);
  	sync -> registerCallback(boost::bind(&Sync::sync_cb, this, _1, _2));
}

void Sync::sync_cb(const sensor_msgs::ImageConstPtr& image, const sensor_msgs::CameraInfoConstPtr& cam_info){

	sync_image_pub.publish(image);
	sync_info_pub.publish(cam_info);
}

int main(int argc, char **argv){
	ros::init(argc, argv, "Sync");
	ROS_INFO_STREAM("Sync Camera Node Active!");
	Sync sync;

	while(ros::ok()){
		ros::spin();
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/* Frontend/layout.html.twig */
class __TwigTemplate_ec9a03b1f8998c91b112f99305a7554c619346fe4dc87fcaaa7f716dbe695643 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
            'title' => array($this, 'block_title'),
            'body' => array($this, 'block_body'),
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo "<!DOCTYPE html>
<html>
<head>
    <meta charset=\"UTF-8\">
    <title>";
        // line 5
        $this->displayBlock('title', $context, $blocks);
        echo "</title>
</head>
<body>
    ";
        // line 8
        $this->displayBlock('body', $context, $blocks);
        // line 10
        echo "</body>
</html>
";
    }

    // line 5
    public function block_title($context, array $blocks = array())
    {
    }

    // line 8
    public function block_body($context, array $blocks = array())
    {
        // line 9
        echo "    ";
    }

    public function getTemplateName()
    {
        return "Frontend/layout.html.twig";
    }

    public function getDebugInfo()
    {
        return array (  49 => 9,  46 => 8,  41 => 5,  35 => 10,  33 => 8,  27 => 5,  21 => 1,);
    }

    public function getSourceContext()
    {
        return new Twig_Source("", "Frontend/layout.html.twig", "E:\\www\\mvcframework\\App\\Views\\Frontend\\layout.html.twig");
    }
}


text:
@interface TimerView : UIControl

@property (nonatomic, assign) CGFloat progression;
@property (nonatomic, assign) UIColor * tintColor;

- (void)cancelProgressionAnimation;
- (void)setProgression:(CGFloat)progression animated:(BOOL)animated;

@end


text:
package io.dropwizard.metrics.graphite;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Fail.failBecauseExceptionWasNotThrown;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.*;

import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.python.core.PyList;
import org.python.core.PyTuple;

import io.dropwizard.metrics.graphite.PickledGraphite;

import javax.net.SocketFactory;
import javax.script.Bindings;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.SimpleBindings;

import java.io.ByteArrayOutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.concurrent.atomic.AtomicBoolean;

public class PickledGraphiteTest {
    private final SocketFactory socketFactory = mock(SocketFactory.class);
    private final InetSocketAddress address = new InetSocketAddress("example.com", 1234);
    private final PickledGraphite graphite = new PickledGraphite(address, socketFactory, Charset.forName("UTF-8"), 2);

    private final Socket socket = mock(Socket.class);
    private final ByteArrayOutputStream output = spy(new ByteArrayOutputStream());

    // Pulls apart the pickled payload. This skips ahead 4 characters to safely ignore
    // the header (length)
    private static final String UNPICKLER_SCRIPT =
        "import cPickle\n" +
            "import struct\n" +
            "format = '!L'\n" +
            "headerLength = struct.calcsize(format)\n" +
            "payloadLength, = struct.unpack(format, payload[:headerLength])\n" +
            "batchLength = headerLength + payloadLength.intValue()\n" +
            "metrics = cPickle.loads(payload[headerLength:batchLength])\n";

    private CompiledScript unpickleScript;

    @Before
    public void setUp() throws Exception {
        final AtomicBoolean connected = new AtomicBoolean(true);
        final AtomicBoolean closed = new AtomicBoolean(false);

        when(socket.isConnected()).thenAnswer(new Answer<Boolean>() {
            @Override
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                return connected.get();
            }
        });

        when(socket.isClosed()).thenAnswer(new Answer<Boolean>() {
            @Override
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                return closed.get();
            }
        });

        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                connected.set(false);
                closed.set(true);
                return null;
            }
        }).when(socket).close();

        when(socket.getOutputStream()).thenReturn(output);

        // Mock behavior of socket.getOutputStream().close() calling socket.close();
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                invocation.callRealMethod();
                socket.close();
                return null;
            }
        }).when(output).close();

        when(socketFactory.createSocket(any(InetAddress.class),
            anyInt())).thenReturn(socket);

        ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
        Compilable compilable = (Compilable) engine;
        unpickleScript = compilable.compile(UNPICKLER_SCRIPT);
    }

    @Test
    public void disconnectsFromGraphite() throws Exception {
        graphite.connect();
        graphite.close();

        verify(socket).close();
    }

    @Test
    public void writesValuesToGraphite() throws Exception {
        graphite.connect();
        graphite.send("name", "value", 100);
        graphite.close();

        assertThat(unpickleOutput())
            .isEqualTo("name value 100\n");
    }

    @Test
    public void writesFullBatch() throws Exception {
        graphite.connect();
        graphite.send("name", "value", 100);
        graphite.send("name", "value2", 100);
        graphite.close();

        assertThat(unpickleOutput())
            .isEqualTo("name value 100\nname value2 100\n");
    }

    @Test
    public void writesPastFullBatch() throws Exception {
        graphite.connect();
        graphite.send("name", "value", 100);
        graphite.send("name", "value2", 100);
        graphite.send("name", "value3", 100);
        graphite.close();

        assertThat(unpickleOutput())
            .isEqualTo("name value 100\nname value2 100\nname value3 100\n");
    }

    @Test
    public void sanitizesNames() throws Exception {
        graphite.connect();
        graphite.send("name woo", "value", 100);
        graphite.close();

        assertThat(unpickleOutput())
            .isEqualTo("name-woo value 100\n");
    }

    @Test
    public void sanitizesValues() throws Exception {
        graphite.connect();
        graphite.send("name", "value woo", 100);
        graphite.close();

        assertThat(unpickleOutput())
            .isEqualTo("name value-woo 100\n");
    }

    @Test
    public void doesNotAllowDoubleConnections() throws Exception {
        graphite.connect();
        try {
            graphite.connect();
            failBecauseExceptionWasNotThrown(IllegalStateException.class);
        } catch (IllegalStateException e) {
            assertThat(e.getMessage())
                    .isEqualTo("Already connected");
        }
    }

    String unpickleOutput() throws Exception {
        StringBuilder results = new StringBuilder();

        // the charset is important. if the GraphitePickleReporter and this test
        // don't agree, the header is not always correctly unpacked.
        String payload = output.toString("UTF-8");

        PyList result = new PyList();
        int nextIndex = 0;
        while (nextIndex < payload.length()) {
            Bindings bindings = new SimpleBindings();
            bindings.put("payload", payload.substring(nextIndex));
            unpickleScript.eval(bindings);
            result.addAll(result.size(), (PyList) bindings.get("metrics"));
            nextIndex += (Integer) bindings.get("batchLength");
        }

        for (Object aResult : result) {
            PyTuple datapoint = (PyTuple) aResult;
            String name = datapoint.get(0).toString();
            PyTuple valueTuple = (PyTuple) datapoint.get(1);
            Object timestamp = valueTuple.get(0);
            Object value = valueTuple.get(1);

            results.append(name).append(" ").append(value).append(" ").append(timestamp).append("\n");
        }

        return results.toString();
    }
}


text:
Christmas 2.0.13 is my annual solo project that demonstrates my best of skills in 2013.

## Tools
- Vim
- Git
- Github
- Gimp
- Dropbox
- Yeoman

## Techniques
- Javascript
- Angular js
- Require js
- Sass
- CSS 3

## License

Copyright (c) 2013 Zhibin Huang - Released under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
/*
 * WRITTEN BY PUJI W PRAYITNO
 * 06-2015
 * mailto:puji@padi.net.id
 * */
function resizeImage(url, callback){
	var canvas = document.createElement("canvas");
	var MAX_WIDTH_ALLOWED = 200;//1600;
	var MAX_HEIGHT = 0;
	canvas.width = 200;//1600;
	var img = new Image();
	img.onload = function(){
		MAX_HEIGHT = img.height * MAX_WIDTH_ALLOWED / img.width;
		canvas.height = MAX_HEIGHT;
		var ctx = canvas.getContext("2d");
		ctx.drawImage(img, 0, 0, MAX_WIDTH_ALLOWED, MAX_HEIGHT);
		callback(canvas.toDataURL("image/jpeg"));
	}
	img.src = url;
}
function resizeImage2(url,width, callback){
	var canvas = document.createElement("canvas");
	var MAX_WIDTH_ALLOWED = width;
	var MAX_HEIGHT = 0;
	canvas.width = width;
	var img = new Image();
	img.onload = function(){
		MAX_HEIGHT = img.height * MAX_WIDTH_ALLOWED / img.width;
		canvas.height = MAX_HEIGHT;
		var ctx = canvas.getContext("2d");
		ctx.drawImage(img, 0, 0, MAX_WIDTH_ALLOWED, MAX_HEIGHT);
		callback(canvas.toDataURL("image/jpeg"));
	}
	img.src = url;
}


text:
permalink: /404.html
layout: default
---

404

Page not found :(

The requested page could not be found.


text:
package rapture.ftp.common;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.UnknownHostException;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException;

import rapture.common.exception.ExceptionToString;
import rapture.common.exception.RaptureExceptionFactory;

public class SFTPConnection extends FTPConnection {

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

    private final JSch jsch;
    private ChannelSftp channel;
    private Session session;

    public SFTPConnection(FTPConnectionConfig config) {
        super(config);
        if (config.isUseSFTP()) jsch = new JSch();
        else {
            log.info("useSFTP is false - using FTP");
            jsch = null;
        }
    }

    public SFTPConnection(String configUri) {
        super(configUri);
        if (getConfig().isUseSFTP()) jsch = new JSch();
        else {
            log.info("useSFTP is false - using FTP");
            jsch = null;
        }
    }

    @Override
    public boolean connectAndLogin() {
        if (isLocal()) {
            log.info("In test mode - not connecting");
            return true;
        }

        if (!config.isUseSFTP()) {
            return super.connectAndLogin();
        } else {
            if (!isConnected()) {
                return FTPService.runWithRetry("Could not login to " + config.getAddress() + " as " + config.getLoginId(), this, false,
                        new FTPAction<Boolean>() {
                    @Override
                    public Boolean run(int attemptNum) throws IOException {
                        try {
                            session = jsch.getSession(config.getLoginId(), config.getAddress(), config.getPort());
                            java.util.Properties properties = new java.util.Properties();
                            properties.put("StrictHostKeyChecking", "no");
                            session.setConfig(properties);
                            if (!StringUtils.isEmpty(config.getPassword())) {
                                session.setPassword(config.getPassword());
                            } else {
                                jsch.addIdentity(config.getAddress(), config.getPrivateKey().getBytes(), null, null);
                            }
                            session.connect();
                            channel = (ChannelSftp) session.openChannel("sftp");
                            channel.setInputStream(System.in);
                            channel.setOutputStream(System.out);
                            channel.connect();
                            return true;
                        } catch (Exception e) {
                            if (e.getCause() instanceof UnknownHostException) {
                                throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, "Unknown host " + config.getAddress());
                            }
                            log.error("Unable to establish secure FTP connection " + config.getLoginId() + "@" + config.getAddress() + ":" + config.getPort());
                            throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR,
                                    "Unable to establish secure FTP connection to " + config.getAddress(), e);
                        }
                    }
                });
            }
        }
        return false;
    }

    @Override
    public boolean isConnected() {
        if (!getConfig().isUseSFTP()) return super.isConnected();
        return isLocal() || (session != null && channel != null && session.isConnected() && channel.isConnected());
    }

    @Override
    public void logoffAndDisconnect() {
        if (isLocal()) return;

        if (!config.isUseSFTP()) {
            super.logoffAndDisconnect();
        } else {
            if ((channel != null) && channel.isConnected()) {
                channel.disconnect();
                channel.exit();
            }
            session.disconnect();
        }
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        logoffAndDisconnect();
    }

    /**
     * Returns a list of filenames found here. This accepts glob(3) patterns in path.
     *
     * @param path
     * @return
     */
    @Override
    public List<String> listFiles(String path) {
        if (!config.isUseSFTP()) return super.listFiles(path);

        List<String> filenames = new LinkedList<>();
        try {
            @SuppressWarnings("rawtypes")
            Vector vector = channel.ls((path == null) ? "." : path);
            for (Object o : vector) {
                String file = o.toString();
                file = file.substring(file.lastIndexOf(' ') + 1);
                if (!file.startsWith(".")) {
                    filenames.add(file);
                }
            }
        } catch (SftpException e) {
            log.debug(String.format("Error listing files with path [%s] on server [%s]. Error: %s", path, config.getAddress(), ExceptionToString.format(e)));
        }
        return filenames;
    }

    @Override
    public InputStream read(String fileName) throws IOException {

        if (isLocal()) {
            File f = new File(fileName);
            if (f.canRead()) {
                return new FileInputStream(f);
            }
            return new ByteArrayInputStream("".getBytes());
        } else {
            if (!config.isUseSFTP()) return super.read(fileName);

            try {
                return channel.get(fileName);
            } catch (SftpException e) {
                String err = String.format("Failed to download %s: %s", fileName, e.getMessage());
                log.warn(err);
                log.trace(ExceptionToString.format(e));
                throw new IOException(err, e);
            }
        }
    }

    @Override
    public boolean retrieveFile(String fileName, OutputStream stream) throws IOException {
        if (!config.isUseSFTP()) return super.retrieveFile(fileName, stream);
        IOUtils.copy(read(fileName), stream);
        return true;
    }

    @Override
    // fileName must be the name of a file, not a directory
    public boolean sendFile(InputStream stream, String fileName) throws IOException {
        if (!config.isUseSFTP()) return super.sendFile(stream, fileName);
        if (fileName.endsWith("/")) {
            log.error("fileName must be the name of a file, not a directory");
        } else try {
            int lio = fileName.lastIndexOf('/');
            if (lio > 0) {
                channel.cd(fileName.substring(0, lio));
                channel.put(stream, fileName.substring(lio + 1));
                return true;
            }
        } catch (SftpException e) {
            throw new IOException("Cannot copy data to " + fileName, e);
        }
        return false;
    }
}


text:
/*******************************************************************
*
* MAIN.H
*
* Definitions for main program
*
*
* VERSION: 24.02.2015
*
* by Hendrik Hangmann
* University of Paderborn
*
********************************************************************/

#ifndef MAIN_H_
#define MAIN_H_

#include <stdio.h>
#include <stdlib.h>
#include "model.h"
#include "measurement_grid.h"
#include "optimizing.h"
#include "parameter.h"

void open_measurements(FILE ** file, char ** path);
void parse_measurements(FILE ** file, int line_len, rc_network * rcn, measurement_grid * m_grid, int heater_size_x, int heater_size_y);
char * strtok(char * s, const char * toks);
void change_by_stage (parameter_set * new_params, parameter_set * params, float start_percentage, rc_network * rcn, int stage);
void change (parameter_set * new_params, parameter_set * params, float start_percentage, rc_network * rcn);
float get_random_float(float a);
void print_parameters(parameter_set * params, int num_layers,int nodes_per_layer);
int main (int argc, char **argv);
float simulate_model(measurement_grid * m_grid, rc_network * rcn, parameter_set * params, int t);
int get_neighbor_index_of(node temp_node, node_type type);

void assign_parameters_to_RCN(parameter_set * params, rc_network * rcn, measurement_grid * m_grid);

#endif /* MAIN_H_ */


text:
package org.apache.flink.table.planner.plan.nodes.exec.serde;

import org.apache.flink.annotation.Internal;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.table.delegation.Parser;
import org.apache.flink.table.planner.calcite.FlinkContext;
import org.apache.flink.table.planner.calcite.FlinkTypeFactory;

import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DatabindContext;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;

import org.apache.calcite.rex.RexBuilder;
import org.apache.calcite.sql.SqlOperatorTable;

/**
 * A context to allow the store user-defined data within ExecNode serialization and deserialization.
 */
@Internal
public class SerdeContext {
    static final String SERDE_CONTEXT_KEY = "serdeCtx";

    private final Parser parser;
    private final ClassLoader classLoader;
    private final FlinkContext flinkContext;
    private final FlinkTypeFactory typeFactory;
    private final SqlOperatorTable operatorTable;
    private final RexBuilder rexBuilder;

    public SerdeContext(
            Parser parser,
            FlinkContext flinkContext,
            ClassLoader classLoader,
            FlinkTypeFactory typeFactory,
            SqlOperatorTable operatorTable) {
        this.parser = parser;
        this.classLoader = classLoader;
        this.flinkContext = flinkContext;
        this.typeFactory = typeFactory;
        this.operatorTable = operatorTable;
        this.rexBuilder = new RexBuilder(typeFactory);
    }

    /** Retrieve context from {@link SerializerProvider} and {@link DeserializationContext}. */
    public static SerdeContext get(DatabindContext databindContext) {
        final SerdeContext serdeContext =
                (SerdeContext) databindContext.getAttribute(SERDE_CONTEXT_KEY);
        assert serdeContext != null;
        return serdeContext;
    }

    public Parser getParser() {
        return parser;
    }

    public Configuration getConfiguration() {
        return flinkContext.getTableConfig().getConfiguration();
    }

    public ClassLoader getClassLoader() {
        return classLoader;
    }

    public FlinkContext getFlinkContext() {
        return flinkContext;
    }

    public FlinkTypeFactory getTypeFactory() {
        return typeFactory;
    }

    public SqlOperatorTable getOperatorTable() {
        return operatorTable;
    }

    public RexBuilder getRexBuilder() {
        return rexBuilder;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Air Native Extension Build Scripts" default="all">

    <!-- Config -->
    <property file="build.config"/>

    <!-- All -->
    <target name="all" depends="ios,android,swc,package" description="Full build of extension"/>

    <!-- iOS -->
    <target name="ios" description="Build iOS Library">

        <!-- make the build directory for the objc code -->
        <mkdir dir="temp/ios/build/"/>

        <!-- clean the build -->
        <exec executable="xcodebuild" failonerror="true" dir="../ios/">
            <arg line="-project ${name}.xcodeproj"/>
            <arg line="-alltargets clean"/>
        </exec>

        <!-- compile the ios lib -->
        <exec executable="xcodebuild" failonerror="true" dir="../ios/">
            <arg line="-project ${name}.xcodeproj"/>
            <arg line="-sdk ${ios.sdkversion}"/>
            <arg line="-alltargets"/>
            <arg line="-configuration Release"/>
            <arg line="SYMROOT=../build/temp/ios/build/"/>
        </exec>

        <!-- copy the ios lib to the base temp ios directory -->
        <copy file="temp/ios/build/Release-iphoneos/lib${name}.a" todir="temp/ios" overwrite="true"/>

        <!-- remove the build directory -->
        <delete dir="temp/ios/build/"/>
    </target>

    <!-- Android -->
    <target name="android" description="Build Android Library">

        <!-- make the build directory for the java code -->
        <mkdir dir="temp/android/build/"/>

        <!-- compile the java code -->
        <javac destdir="temp/android/build/" source="1.6" includeantruntime="false">
            <src path="../android/src/"/>
            <classpath>
                <pathelement location="${android.sdk}/android.jar"/>
                <pathelement location="${air.sdk}/lib/android/FlashRuntimeExtensions.jar"/>
                <pathelement location="../android/libs/google-play-services.jar"/>
            </classpath>
        </javac>

        <!-- Copy over the required libs -->
        <!-- <copy file="../android/libs/google-play-services.jar" todir="temp/android/"/> -->

        <!-- Copy over required resources -->
        <copy todir="temp/android/res/">
            <fileset dir="../android/res/"/>
        </copy>

        <!-- <copy todir="temp/android/google-play-services-res/">
            <fileset dir="../android/libs/google-play-services-res"/>
        </copy> -->

        <!-- make the jar -->
        <jar basedir="temp/android/build/" destfile="temp/android/lib${name}.jar"/>

        <!-- remove the build classes -->
        <delete dir="temp/android/build/"/>
    </target>

    <!-- Actionscript -->
    <target name="swc" description="Build SWC library">

        <mkdir dir="temp/swc/content/"/>

        <fileset dir="../actionscript/src" casesensitive="yes" id="classfiles">
            <include name="**/*.as"/>
        </fileset>

        <pathconvert property="classlist" refid="classfiles" pathsep=" " dirsep=".">
            <regexpmapper from=".*src.(.*)\.as" to="\1"/>
        </pathconvert>

        <exec executable="${air.sdk}/bin/compc${bin.ext}" failonerror="true">
            <arg line='-source-path ../actionscript/src'/>
            <arg line='-output temp/swc/${name}.swc'/>
            <arg line='-swf-version=25'/>
            <arg line='-external-library-path+="${air.sdk}/frameworks/libs/air/airglobal.swc"'/>
            <arg line='-include-classes ${classlist}'/>
            <env key="AIR_SDK_HOME" value="${air.sdk}"/>
        </exec>

        <unzip src="temp/swc/${name}.swc" dest="temp/swc/content" overwrite="true"/>
        <copy file="temp/swc/content/library.swf" todir="temp/ios" overwrite="true"/>
        <copy file="temp/swc/content/library.swf" todir="temp/android" overwrite="true"/>
        <copy file="temp/swc/content/library.swf" todir="temp/default" overwrite="true"/>

        <delete dir="temp/swc/content/"/>
    </target>

    <!-- Package -->
    <target name="package" description="Create the extension package">
        <exec executable="${air.sdk}/bin/adt${bin.ext}" failonerror="true" dir="temp">
            <arg value="-package"/>
            <arg value="-target"/>
            <arg value="ane"/>
            <arg value="${name}.ane"/>
            <arg value="../extension.xml"/>
            <arg line="-swc swc/${name}.swc"/>
            <arg line="-platform iPhone-ARM -platformoptions ../platform-ios.xml -C ios/ ."/>
            <arg line="-platform Android-ARM -platformoptions ../platform-android.xml  -C android/ ."/>
            <arg line="-platform Android-x86 -platformoptions ../platform-android.xml  -C android/ ."/>
            <arg line="-platform default -C default/ ."/>
        </exec>

        <move file="temp/${name}.ane" todir="../bin"/>
        <delete dir="temp/"/>
    </target>

</project>


text:
/***************************************************************************/
/*                                                                         */
/*  gxvmorx2.c                                                             */
/*                                                                         */
/*    TrueTypeGX/AAT morx table validation                                 */
/*    body for type2 (Ligature Substitution) subtable.                     */
/*                                                                         */
/*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/***************************************************************************/

/***************************************************************************/
/*                                                                         */
/* gxvalid is derived from both gxlayout module and otvalid module.        */
/* Development of gxlayout is supported by the Information-technology      */
/* Promotion Agency(IPA), Japan.                                           */
/*                                                                         */
/***************************************************************************/

#include "gxvmorx.h"

  /*************************************************************************/
  /*                                                                       */
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
  /* messages during execution.                                            */
  /*                                                                       */
#undef  FT_COMPONENT
#define FT_COMPONENT  trace_gxvmorx

  typedef struct  GXV_morx_subtable_type2_StateOptRec_
  {
    FT_ULong  ligActionTable;
    FT_ULong  componentTable;
    FT_ULong  ligatureTable;
    FT_ULong  ligActionTable_length;
    FT_ULong  componentTable_length;
    FT_ULong  ligatureTable_length;

  }  GXV_morx_subtable_type2_StateOptRec,
    *GXV_morx_subtable_type2_StateOptRecData;

#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE \
          ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )

  static void
  gxv_morx_subtable_type2_opttable_load( FT_Bytes       table,
                                         FT_Bytes       limit,
                                         GXV_Validator  valid )
  {
    FT_Bytes  p = table;

    GXV_morx_subtable_type2_StateOptRecData  optdata =
      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;

    GXV_LIMIT_CHECK( 4 + 4 + 4 );
    optdata->ligActionTable = FT_NEXT_ULONG( p );
    optdata->componentTable = FT_NEXT_ULONG( p );
    optdata->ligatureTable  = FT_NEXT_ULONG( p );

    GXV_TRACE(( "offset to ligActionTable=0x%08x\n",
                optdata->ligActionTable ));
    GXV_TRACE(( "offset to componentTable=0x%08x\n",
                optdata->componentTable ));
    GXV_TRACE(( "offset to ligatureTable=0x%08x\n",
                optdata->ligatureTable ));
  }

  static void
  gxv_morx_subtable_type2_subtable_setup( FT_ULong       table_size,
                                          FT_ULong       classTable,
                                          FT_ULong       stateArray,
                                          FT_ULong       entryTable,
                                          FT_ULong*      classTable_length_p,
                                          FT_ULong*      stateArray_length_p,
                                          FT_ULong*      entryTable_length_p,
                                          GXV_Validator  valid )
  {
    FT_ULong   o[6];
    FT_ULong*  l[6];
    FT_ULong   buff[7];

    GXV_morx_subtable_type2_StateOptRecData  optdata =
      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;

    GXV_NAME_ENTER( "subtable boundaries setup" );

    o[0] = classTable;
    o[1] = stateArray;
    o[2] = entryTable;
    o[3] = optdata->ligActionTable;
    o[4] = optdata->componentTable;
    o[5] = optdata->ligatureTable;
    l[0] = classTable_length_p;
    l[1] = stateArray_length_p;
    l[2] = entryTable_length_p;
    l[3] = &(optdata->ligActionTable_length);
    l[4] = &(optdata->componentTable_length);
    l[5] = &(optdata->ligatureTable_length);

    gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, valid );

    GXV_TRACE(( "classTable: offset=0x%08x length=0x%08x\n",
                classTable, *classTable_length_p ));
    GXV_TRACE(( "stateArray: offset=0x%08x length=0x%08x\n",
                stateArray, *stateArray_length_p ));
    GXV_TRACE(( "entryTable: offset=0x%08x length=0x%08x\n",
                entryTable, *entryTable_length_p ));
    GXV_TRACE(( "ligActionTable: offset=0x%08x length=0x%08x\n",
                optdata->ligActionTable,
                optdata->ligActionTable_length ));
    GXV_TRACE(( "componentTable: offset=0x%08x length=0x%08x\n",
                optdata->componentTable,
                optdata->componentTable_length ));
    GXV_TRACE(( "ligatureTable:  offset=0x%08x length=0x%08x\n",
                optdata->ligatureTable,
                optdata->ligatureTable_length ));

    GXV_EXIT;
  }

#define GXV_MORX_LIGACTION_ENTRY_SIZE  4

  static void
  gxv_morx_subtable_type2_ligActionIndex_validate(
    FT_Bytes       table,
    FT_UShort      ligActionIndex,
    GXV_Validator  valid )
  {
    /* access ligActionTable */
    GXV_morx_subtable_type2_StateOptRecData optdata =
      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;

    FT_Bytes lat_base  = table + optdata->ligActionTable;
    FT_Bytes p         = lat_base +
                         ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;
    FT_Bytes lat_limit = lat_base + optdata->ligActionTable;

    if ( p < lat_base )
    {
      GXV_TRACE(( "p < lat_base (%d byte rewind)\n", lat_base - p ));
      FT_INVALID_OFFSET;
    }
    else if ( lat_limit < p )
    {
      GXV_TRACE(( "lat_limit < p (%d byte overrun)\n", p - lat_limit ));
      FT_INVALID_OFFSET;
    }

    {
      /* validate entry in ligActionTable */
      FT_ULong   lig_action;
      FT_UShort  last;
      FT_UShort  store;
      FT_ULong   offset;

      lig_action = FT_NEXT_ULONG( p );
      last       = (FT_UShort)( ( lig_action >> 31 ) & 1 );
      store      = (FT_UShort)( ( lig_action >> 30 ) & 1 );

      offset = lig_action & 0x3FFFFFFFUL;
    }
  }

  static void
  gxv_morx_subtable_type2_entry_validate(
    FT_UShort                       state,
    FT_UShort                       flags,
    GXV_StateTable_GlyphOffsetDesc  glyphOffset,
    FT_Bytes                        table,
    FT_Bytes                        limit,
    GXV_Validator                   valid )
  {
    FT_UShort  setComponent;
    FT_UShort  dontAdvance;
    FT_UShort  performAction;
    FT_UShort  reserved;
    FT_UShort  ligActionIndex;

    FT_UNUSED( state );
    FT_UNUSED( limit );

    setComponent   = (FT_UShort)( ( flags >> 15 ) & 1 );
    dontAdvance    = (FT_UShort)( ( flags >> 14 ) & 1 );
    performAction  = (FT_UShort)( ( flags >> 13 ) & 1 );

    reserved       = (FT_UShort)( flags & 0x1FFF );
    ligActionIndex = glyphOffset.u;

    if ( reserved > 0 )
      GXV_TRACE(( "  reserved 14bit is non-zero\n" ));

    if ( 0 < ligActionIndex )
      gxv_morx_subtable_type2_ligActionIndex_validate(
        table, ligActionIndex, valid );
  }

  static void
  gxv_morx_subtable_type2_ligatureTable_validate( FT_Bytes       table,
                                                  GXV_Validator  valid )
  {
    GXV_morx_subtable_type2_StateOptRecData  optdata =
      (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata;

    FT_Bytes p     = table + optdata->ligatureTable;
    FT_Bytes limit = table + optdata->ligatureTable
                           + optdata->ligatureTable_length;

    GXV_NAME_ENTER( "morx chain subtable type2 - substitutionTable" );

    if ( 0 != optdata->ligatureTable )
    {
      /* Apple does not give specification of ligatureTable format */
      while ( p < limit )
      {
        FT_UShort  lig_gid;

        GXV_LIMIT_CHECK( 2 );
        lig_gid = FT_NEXT_USHORT( p );
      }
    }

    GXV_EXIT;
  }

  FT_LOCAL_DEF( void )
  gxv_morx_subtable_type2_validate( FT_Bytes       table,
                                    FT_Bytes       limit,
                                    GXV_Validator  valid )
  {
    FT_Bytes  p = table;

    GXV_morx_subtable_type2_StateOptRec  lig_rec;

    GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" );

    GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE );

    valid->xstatetable.optdata =
      &lig_rec;
    valid->xstatetable.optdata_load_func =
      gxv_morx_subtable_type2_opttable_load;
    valid->xstatetable.subtable_setup_func =
      gxv_morx_subtable_type2_subtable_setup;
    valid->xstatetable.entry_glyphoffset_fmt =
      GXV_GLYPHOFFSET_USHORT;
    valid->xstatetable.entry_validate_func =
      gxv_morx_subtable_type2_entry_validate;

    gxv_XStateTable_validate( p, limit, valid );

    p += valid->subtable_length;
    gxv_morx_subtable_type2_ligatureTable_validate( table, valid );

    GXV_EXIT;
  }

/* END */


text:
require 'spec_helper'

RSpec.describe SolidusSubscriptions::Spree::Variant::AutoDeleteFromSubscriptions, type: :model do
  subject { create(:variant, subscribable: true) }

  describe '.discard' do
    it 'deletes itself from subscriptions' do
      subscription = create(:subscription)
      create(:subscription_line_item, subscription: subscription, subscribable: subject)

      expect { subject.discard }.to change(SolidusSubscriptions::LineItem, :count).by(-1)
    end
  end

  describe '.destroy' do
    it 'deletes itself from subscriptions' do
      subscription = create(:subscription)
      create(:subscription_line_item, subscription: subscription, subscribable: subject)

      expect { subject.destroy }.to change(SolidusSubscriptions::LineItem, :count).by(-1)
    end
  end
end


text:
package com.client.core.scheduledtasks.workflow.node.impl;

import com.bullhornsdk.data.model.entity.core.standard.Note;
import com.client.core.base.model.relatedentity.NoteRelatedEntity;
import com.client.core.scheduledtasks.model.helper.impl.NoteScheduledTaskHelper;
import com.client.core.scheduledtasks.workflow.traversing.impl.NoteEventTraverser;

import java.util.Map;
import java.util.Set;

public abstract class NoteEventTask extends AbstractEventTask<Note, NoteScheduledTaskHelper, NoteEventTraverser> {

    public NoteEventTask(Integer order, Map<NoteRelatedEntity, Set<String>> relatedEntityFields) {
        super(order, relatedEntityFields);
    }

    public NoteEventTask(Map<NoteRelatedEntity, Set<String>> relatedEntityFields) {
        super(relatedEntityFields);
    }

}


text:
package de.onyxbits.raccoon.gplay;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import de.onyxbits.raccoon.db.DataAccessObject;
import de.onyxbits.raccoon.repo.AndroidApp;

public class PlayAppOwnerDao extends DataAccessObject {

	@Override
	protected void upgradeFrom(int tableVersion, Connection c)
			throws SQLException {

		switch (tableVersion + 1) {
			case 1: {
				v1(c);
			}
		}
	}

	private static void v1(Connection c) throws SQLException {
		PreparedStatement st = c
				.prepareStatement("CREATE TABLE playappownership (aid BIGINT FOREIGN KEY REFERENCES androidapps ON DELETE CASCADE, pid VARCHAR(255) FOREIGN KEY REFERENCES playprofiles ON DELETE CASCADE )");
		st.execute();
		st.close();
	}

	@Override
	protected int getVersion() {
		return 1;
	}

	/**
	 * Establish an owned by relationship between app and profile. If the app is
	 * already owned, relink it.
	 *
	 * @param app
	 * @param profile
	 * @throws SQLException
	 */
	public void own(AndroidApp app, PlayProfile profile) throws SQLException {
		Connection c = manager.connect();
		PreparedStatement st = null;
		ResultSet res = null;
		try {
			st = c
					.prepareStatement("MERGE INTO playappownership USING (VALUES (?, ?)) AS vals(aid, pid) ON playappownership.aid = vals.aid WHEN MATCHED THEN UPDATE SET playappownership.pid = vals.pid WHEN NOT MATCHED THEN INSERT VALUES vals.aid, vals.pid");
			st.setLong(1, app.getAppId());
			st.setString(2, profile.getAlias());
			st.execute();
			st.close();
			c.commit();
		}

		finally {
			if (st != null) {
				st.close();
			}
			if (res != null) {
				res.close();
			}
			manager.disconnect(c);
		}
	}

	/**
	 * Destroy an owned by relationship between app and profile
	 *
	 * @param app
	 * @throws SQLException
	 */
	public void release(AndroidApp app) throws SQLException {
		Connection c = manager.connect();
		PreparedStatement st = null;
		ResultSet res = null;
		try {
			st = c.prepareStatement("DELETE FROM playappownership WHERE aid=?");
			st.setLong(0, app.getAppId());
			st.execute();
			st.close();
		}

		finally {
			manager.disconnect(c);
			if (st != null) {
				st.close();
			}
			if (res != null) {
				res.close();
			}
		}
	}

	/**
	 * List apps by owner
	 *
	 * @param profile
	 *          the owning profile
	 * @return the owned apps.
	 * @throws SQLException
	 */
	public List<AndroidApp> list(PlayProfile profile)  {
		List<AndroidApp> ret = new ArrayList<AndroidApp>(100);
		Connection c = manager.connect();
		ResultSet res = null;
		PreparedStatement st = null;

		try {
			st = c
					.prepareStatement("SELECT aid, packagename, versioncode, mainversion, patchversion, name, version, minsdk FROM androidapps NATURAL JOIN playappownership WHERE pid = ? ORDER BY packagename, versioncode DESC");
			st.setString(1, profile.getAlias());
			st.execute();
			res = st.getResultSet();
			while (res.next()) {
				AndroidApp app = new AndroidApp();
				app.setAppId(res.getLong(1));
				app.setPackageName(res.getString(2));
				app.setVersionCode(res.getInt(3));
				app.setMainVersion(res.getInt(4));
				app.setPatchVersion(res.getInt(5));
				app.setName(res.getString(6));
				app.setVersion(res.getString(7));
				app.setMinSdk(res.getInt(8));
				ret.add(app);
			}
		}
		catch (SQLException e) {
			throw new RuntimeException(e);
		}
		finally {
			manager.disconnect(c);
			if (st != null) {
				try {
					st.close();
				}
				catch (SQLException e) {
				}
			}
			if (res != null) {
				try {
					res.close();
				}
				catch (SQLException e) {
				}
			}
		}
		return ret;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="JoziJug" parent="@android:style/Theme.Light"></style>

    <style name="Heading" parent="@android:style/TextAppearance.Large">
        <item name="android:background">@drawable/heading_background</item>
        <item name="android:padding">6dp</item>
        <item name="android:layout_margin">6dp</item>
    </style>

    <style name="HomeButton">
        <item name="android:layout_margin">6dp</item>
        <item name="android:background">@drawable/home_button_bg</item>
    </style>

</resources>


text:
var mongoose = require('mongoose');
var List = require('../db/db').List
var express = require('express');
var router =  express.Router();

// Gets all the lists and builds the JSON document
router.get('/', function(req, res, next) {
	List.find().populate('todos').exec(function(err, results) {
		if (err) { console.error(err); }
		res.send({ lists: results })
	});
});

// Saves a list
router.post('/', function(req, res) {
	var list = new List(req.body);
	list.save(function(err) {
		if (err) { console.error(err); }
		res.send('List saved');
	});
});

// Updates a list
router.put('/:id', function(req, res) {
  var id = req.params.id;
  List.update({ _id: mongoose.Types.ObjectId(id) }, {
    $set: {
			name: req.body.name,
			listColor: req.body.listColor
		}
  }, function(err) {
    if (err) { console.error(err); }
    res.send('List updated');
  });
});

// Deletes a lsit
router.delete('/:id', function(req, res) {
  var id = req.params.id;
  List.remove({ _id: mongoose.Types.ObjectId(id) }, function(err) {
    if (err) { console.error(err); }
    res.send('List deleted');
  });
});

module.exports = router;


text:
/**
 *
 */
package br.odb.gameapp;

/**
 * @author monty
 *
 */
public interface ApplicationClient {
	void printWarning(String msg);

	void printError(String msg);

	void printVerbose(String msg);

	String requestFilenameForSave();

	String requestFilenameForOpen();

	String getInput(String msg);

	int chooseOption(String question, String[] options);

	FileServerDelegate getFileServer();

	void printNormal(String string);

	void alert(String string);

	void playMedia(String uri, String alt);

	void sendQuit();
}


text:
<?xml version="1.0"?>

<!-- Everything common to most realms. -->

<project name="yanel-realm"
 xmlns:artifact="antlib:org.apache.maven.artifact.ant"
>

<!--
     The default task config attribute (for example default="compile") seems not to be imported at least with Ant 1.6.5 or Ant 1.7.1
     which means it needs to be set within each realm build.xml (see also smilar note in ../resource-types/resource-type.build.xml)
-->

  <dirname property="realm.home.dir" file="${ant.file}"/>

  <taskdef resource="net/sf/antcontrib/antlib.xml"/>

  <!-- For example set within build.sh ... -->
  <property name="yanel.home" value="${yanel.source.home}"/>
  <property file="${yanel.home}/src/build/local.build.properties"/>
  <property file="${yanel.home}/src/build/build.properties"/>

  <import file="${realm.home.dir}/src/build/dependencies.xml"/>

  <!-- Initialize build -->
  <target name="init" depends="dependencies">
    <artifact:remoteRepository id="wyona.remote.repository" url="${maven.url}"/>

    <property file="${realm.home.dir}/src/build/local.build.properties"/>
    <property file="${realm.home.dir}/src/build/build.properties"/>

    <path id="classpath">
      <pathelement path="${maven2.cp}"/>
      <pathelement path="${maven2.realm.cp}"/>
    </path>
    <property name="realm.build.dir" value="${realm.home.dir}/build"/>
    <property name="realm.classes.dir" value="${realm.build.dir}/classes"/>
    <property name="realm.lib.dir" value="${realm.build.dir}/lib"/>
    <property name="realm.java.dir" value="${realm.home.dir}/src/java"/>
  </target>

  <target name="init:resource-types" unless="eclipse.realm-resource-types.skip">
    <dirname property="realm.xml.base.dir" file="${ant.file}"/>
    <echo level="debug">realm.xml.base.dir: ${realm.xml.base.dir}</echo>

    <property name="resource-types.xml.location" location="${realm.xml.base.dir}/resource-types.xml"/>
    <fail message="Could not find the ${resource-types.xml.location} file: please set the 'resource-types.xml.location' property to its location or set the 'eclipse.realm-resource-types.skip' property to any value if you for example do not use any realm-specific resource-types.">
      <condition>
        <not>
          <available file="${resource-types.xml.location}" />
        </not>
      </condition>
    </fail>

    <xmlproperty file="${resource-types.xml.location}"
     delimiter="${path.separator}"
    />
    <echo level="debug">resource-types.resource-type(src): ${resource-types.resource-type(src)}</echo>
    <propertyregex property="resource-types.path"
     input="${resource-types.resource-type(src)}"
     defaultValue="${resource-types.resource-type(src)}"
     regexp="@REALM_SRC_DIR@"
     replace="${realm.xml.base.dir}"
     global="true" />
    <echo level="verbose">resource-types.path: ${resource-types.path}</echo>
  </target>

  <property name="eclipse.yanel.build.classes.dir.link" value="yanel-build-webapp-classes"/>
  <property name="eclipse.classes.dir.link" value="cnode1-webapp-WEB-INF-classes"/>

  <target name="eclipse:classpath" description="Update Eclipse's .classpath file" depends="init">
    <artifact:dependencies pathId="Yanel.test.jars.classpath" filesetId="Yanel.test.jars.fileset">
      <remoteRepository refid="wyona.remote.repository"/>
      <dependency groupId="wyona-org-yanel" artifactId="yanel-test" version="${yanel.source.version}"/>
    </artifact:dependencies>
    <echo level="verbose">Yanel test JARs classpath: ${toString:Yanel.test.jars.classpath}</echo>

    <path id="eclipse.classpath">
      <fileset refid="maven2.fileset"/>
      <fileset refid="maven2.realm.fileset"/>
      <fileset refid="Yanel.test.jars.fileset"/>
    </path>
    <condition property="eclipse.classes.dir" value="${eclipse.classes.dir.link}" else="">
      <isset property="do.autopatch.cnode1.webapp.WEB-INF.classes"/>
    </condition>
    <condition property="eclipse.source.dirs" value="src/java:${eclipse.yanel.build.classes.dir.link}" else="">
      <isset property="do.autopatch.cnode1.webapp.WEB-INF.classes"/>
    </condition>
    <ant dir="${yanel.home}/tools/eclipse.settings" target="update-classpath"
     inheritAll="false" inheritRefs="false">
      <reference torefid="classpath.ref" refid="eclipse.classpath"/>
      <property name="classpath.dir" value="${realm.home.dir}"/>
      <property name="classes.dir" value="${eclipse.classes.dir}"/>
      <property name="source.dirs" value="${eclipse.source.dirs}"/>
    </ant>
    <echo><!--XXX -->WARNING (if you used -Ddo.autopatch.cnode1.webapp.WEB-INF.classes=foo to make Eclipse automatically patch the webapp's classes in place during compilation): the logs will show up in ${yanel.home}/build/log4j-cmdl.log and not in ${yanel.home}/build/log4j-cnode1.log (due to to way the build is currently set up).</echo>
  </target>

  <target name="eclipse:resource-types" depends="init:resource-types" unless="eclipse.realm-resource-types.skip">
    <subant buildpath="${resource-types.path}" target="eclipse"
     verbose="true"
     failonerror="false"
    />
  </target>

  <target name="eclipse" description="Generate all files needed to use the realm under Eclipse (WARNING: .project file(s) will be overwritten!)" depends="eclipse:classpath, eclipse:resource-types">
    <!--XXX HACK: we should generify this instead of stealing files from resource-types' build... -->
    <copy file="${yanel.home}/src/build/resource-types/Eclipse-3.template.project" tofile="${realm.home.dir}/.project">
      <filterset>
        <filter token="RESOURCE_TYPE_NAME" value="${ant.project.name}"/>
        <filter token="YANEL_VERSION" value="${yanel.source.version}"/>
        <filter token="GENERATION_COMMAND" value="build -f ${ant.file} eclipse"/>
        <filter token="YANEL_BUILD_CLASSES_DIR_LINK" value="${eclipse.yanel.build.classes.dir.link}"/>
        <filter token="YANEL_BUILD_CLASSES_DIR" value="${yanel.build.webapp.classes.dir}"/>
        <filter token="CLASSES_DIR_LINK" value="${eclipse.classes.dir.link}"/>
        <filter token="CLASSES_DIR" value="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes"/><!--FIXME: this should not be Tomcat-specific... -->
      </filterset>
    </copy>
    <echo level="info">Eclipse project created: in Eclipse you can now import (as an existing project into your workspace) this realm with root directory set to ${realm.home.dir} and build it there!</echo>
  </target>

  <target name="compile" description="Compile Java classes" depends="init">
	<echo>+++++++ Yanel compile</echo>
    <mkdir dir="${realm.classes.dir}"/>
    <touch> <!-- WORKAROUND: See the bottom of http://ant.apache.org/manual/Tasks/javac.html or http://lists.wyona.org/pipermail/yanel-development/2011-February/005447.html -->
      <fileset dir="${realm.java.dir}" includes="**/package-info.java"/>
    </touch>
    <javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
      classpathref="classpath"
      encoding="${javac.encoding}"
      debug="true"
    />

    <mkdir dir="${realm.lib.dir}"/>
    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar"
      basedir="${realm.classes.dir}"
    />
    <available property="realm.install.needed" file="src/build/pom.xml"/>
    <antcall target="install-jar"/>
  </target>

  <target name="clean" depends="init">
    <delete dir="${realm.build.dir}"/>
  </target>

  <target name="copy-dependencies" depends="init">
    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
      <fileset refid="maven2.realm.fileset"/>
      <mapper type="flatten"/>
    </copy>
  </target>

  <!-- Place jar file for this realm into local maven repository -->
  <target name="install-jar" if="realm.install.needed">
    <copy file="src/build/pom.xml" tofile="build/lib/pom.xml"/>

    <replace file="build/lib/pom.xml" value="${realm.version}">
      <replacetoken>@VERSION@</replacetoken>
    </replace>
    <replace file="build/lib/pom.xml" value="${realm.name}">
      <replacetoken>@NAME@</replacetoken>
    </replace>

    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}-sources.jar"
      basedir="${realm.java.dir}"
    />

    <artifact:pom id="maven.project.core" file="build/lib/pom.xml"/>
    <artifact:install file="build/lib/yanel-realm-${realm.name}-${realm.version}.jar">
      <pom refid="maven.project.core"/>
      <attach file="build/lib/yanel-realm-${realm.name}-${realm.version}-sources.jar" classifier="sources"/>
    </artifact:install>
  </target>

  <!-- Deploy jar file for this realm into local webapp libs directory -->
  <target name="deploy-jar" depends="compile">
  	<echo>+++ Executing deploy-jar</echo>
    <copy todir="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib" file="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar">
    </copy>
    <antcall target="deploy-jar-post"/> <!-- see ZG build.xml -->
  </target>
</project>


text:
package org.fcrepo.kernel.api.exception;

/**
 * Indicates that RDF was presented for persistence to the repository, but could not be persisted for some reportable
 * reason.
 *
 * @author ajs6f
 * @author whikloj
 * @since Oct 24, 2013
 */
public class MalformedRdfException extends RepositoryRuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * Ordinary constructor.
     *
     * @param msg the message
     */
    public MalformedRdfException(final String msg) {
        super(msg);
    }

    /**
     * Ordinary constructor.
     *
     * @param rootCause the root cause
     */
    public MalformedRdfException(final Throwable rootCause) {
        super(rootCause);
    }

    /**
     * Ordinary constructor.
     *
     * @param msg the message
     * @param rootCause the root cause
     */
    public MalformedRdfException(final String msg, final Throwable rootCause) {
        super(msg, rootCause);
    }

}


text:
package org.scalafmt.util

import scala.collection.mutable

import java.io.File

import metaconfig.Configured
import metaconfig.Configured.Ok
import org.scalafmt.config
import org.scalafmt.config.ScalafmtConfig

object StyleCache {
  private val styleCache = mutable.Map.empty[String, ScalafmtConfig]

  private val timeStamps = mutable.Map.empty[String, Long]

  def getStyleForFile(filename: String): Option[ScalafmtConfig] = {
    getStyleForFileOrError(filename).toEither.right.toOption
  }

  def getStyleForFileOrError(filename: String): Configured[ScalafmtConfig] = {
    val file = new File(filename)
    val lastModified = file.lastModified()
    val configUnchanged = timeStamps.get(filename).contains(lastModified)
    timeStamps.update(filename, lastModified)
    styleCache.get(filename) match {
      case Some(config) if configUnchanged => Ok(config)
      case _ =>
        // Throw an exception if file does not exist. Better to fail fast than
        // continue silently.
        val result = config.Config.fromHoconString(FileOps.readFile(file))
        result match {
          case Configured.NotOk(e) =>
            styleCache.remove(filename)
          case Configured.Ok(style) =>
            styleCache.put(filename, style)
        }
        result
    }
  }
}


text:
/**
 * @test
 * @bug 8028739
 * @summary javac generates incorrect descriptor for MethodHandle::invoke
 * @run testng MethodReferenceTestMethodHandle
 */

import java.lang.invoke.*;
import java.util.*;

import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;

@Test
public class MethodReferenceTestMethodHandle {

  MethodHandles.Lookup lookup = MethodHandles.lookup();

  interface ReplaceItf {
      Object apply(String a, char b, char c) throws Throwable;
  }

  interface FormatItf {
      Object apply(String a, Object... args) throws Throwable;
  }

  interface AddItf {
      void apply(List st, int idx, Object v) throws Throwable;
  }

  public void testVirtual() throws Throwable {

      MethodType mt = MethodType.methodType(String.class, char.class, char.class);
      MethodHandle ms = lookup.findVirtual(String.class, "replace", mt);

      // --- String.replace(String, char, char) ---

      assertEquals("oome otring to oearch", ms.invoke("some string to search", 's', 'o'));

      ReplaceItf f1 = (a, b, c) -> ms.invoke(a,b,c);
      assertEquals("oome otring to oearch", f1.apply("some string to search", 's', 'o'));

      ReplaceItf f2 = ms::invoke;
      assertEquals("oome otring to oearch", f2.apply("some string to search", 's', 'o'));
      assertEquals("oome otring to oearch", f2.apply("some string to search", new Character('s'), 'o'));
      assertEquals("oome otring to oearch", ((ReplaceItf) ms::invoke).apply("some string to search", 's', 'o'));
  }

  public void testStatic() throws Throwable {
      MethodType fmt = MethodType.methodType(String.class, String.class, (new Object[1]).getClass());
      MethodHandle fms = lookup.findStatic(String.class, "format", fmt);

      // --- String.format(String, Object...) ---

      assertEquals("Testing One 2 3", fms.invoke("Testing %s %d %x", "One", new Integer(2), 3));

      FormatItf ff2 = fms::invoke;
      assertEquals("Testing One 2 3", ff2.apply("Testing %s %d %x", "One", new Integer(2), 3));
      assertEquals("Testing One 2 3", ((FormatItf) fms::invoke).apply("Testing %s %d %x", "One", new Integer(2), 3));
      assertEquals("Testing One 2 3 four", ff2.apply("Testing %s %d %x %s", "One", new Integer(2), 3, "four"));
  }

  public void testVoid() throws Throwable {
      MethodType pmt = MethodType.methodType(void.class, int.class, Object.class);
      MethodHandle pms = lookup.findVirtual(List.class, "add", pmt);
      List<String> list = new ArrayList<>();

      // --- List.add(int,String) ---

      pms.invoke(list, 0, "Hi");

      AddItf pf2 = pms::invoke;
      pf2.apply(list, 1, "there");
      AddItf pf3 = pms::invokeExact;
      pf3.apply(list, 2, "you");
      assertEquals("Hi", list.get(0));
      assertEquals("there", list.get(1));
      assertEquals("you", list.get(2));
   }
}


text:
local Test = {}
local Colors = GUnit.Colors

local function defaultTest(testName)
  MsgC(Colors.yellow, testName .. ": No tests to run.\n")
end

--Returns the number of specs in the test.
function Test:size()
  local size = 0
  for specName, specFunction in pairs(self.specs) do
    size = size + 1
  end
  return size
end

--[[
Sets a function to be run immediately before the entire test suite is run.
If it fails, the entire test suite run is aborted.
PARAM func: => Nil - The function to run before every spec.
]]
function Test:beforeAll(func)
  self.beforeAllFunc = func
end

--[[
Sets a function to be run immediately before the entire test suite is run.
Always runs as long as beforeAll completed successfully (or doesn't exist.)
If it fails, nothing special happens except for it printing out the error.
PARAM func: => Nil - The function to run before every spec.
]]
function Test:afterAll(func)
  self.afterAllFunc = func
end

--[[
Sets a function to be run immediately before each spec is run.
If it fails, the run of the spec and afterEach is aborted, which will probably abort the entire test suite.
PARAM func: => Nil - The function to run before a spec.
]]
function Test:beforeEach(func)
  self.beforeEachFunc = func
end

--[[
Sets a function to be run immediately after each spec is run.
Runs even if a spec fails, but not if beforeEach fails,
as afterEach is usually used to tear down the setup created by beforeEach.
PARAM func: => Nil - The function to run after a spec.
]]
function Test:afterEach(func)
  self.afterEachFunc = func
end

--[[
Adds a spec to the test.
A spec (short for specification) is a subtest that tests one specific element of your code
that is related to the overall test. Usually, it is used to test a single behavior of a class.
PARAM specName:String - The name of the spec.
PARAM specFunction: => Nil -  The spec function to run.
]]
function Test:addSpec(specName, specFunction)
  self.specs[specName] = specFunction
  table.insert(self.indexedSpecs, specName)
end

--Finds the name of the addon directory.
local function findProjectName()
  local workingDirectory = debug.getinfo(3, "S").source:sub(2)
  local path = workingDirectory:match("(.*/)")
  local directories = path:split("/")
  return directories[4]
end

local function runBeforeAll(test)
  local passed, errorMessage = xpcall(test.beforeAllFunc, debug.traceback)
  if (!passed) then
    MsgC(Colors.red, "- " .. test.name .. ": *** ABORTED - BEFOREALL FAILED ***\nError was: " .. errorMessage)
    print("") --Forces a newline because appending /n to the errorMessage doesn't work for whatever reason.
  end
  return passed
end

local function runAfterAll(test)
  local passed, errorMessage = xpcall(test.afterAllFunc, debug.traceback)
  if (!passed) then
    MsgC(Colors.red, "- " .. test.name .. " AfterAll: *** FAILED ***\nError was: " .. errorMessage)
    print("") --Forces a newline because appending /n to the errorMessage doesn't work for whatever reason.
  end
end

local function runTestFunc(specName, func)
  local passed, errorMessage = xpcall(func, debug.traceback)
  return GUnit.Result:new(specName, passed, errorMessage)
end

local function runSpec(testSuite, specName, specFunction)
  local beforeEachResult
  local specResult
  local afterEachResult

  beforeEachResult = runTestFunc(specName, testSuite.beforeEachFunc)

  --If nothing went wrong in the beforeEachResult, run the spec and its afterEach.
  if (beforeEachResult.passed) then
    specResult = runTestFunc(specName, specFunction)
    afterEachResult = runTestFunc(specName, testSuite.afterEachFunc)
  else
    --Something went wrong so don't run anything else.
    return beforeEachResult
  end

  if (!specResult.passed) then
    --It broke before getting to afterEach so we only care about the spec's result.
    return specResult
  else
    --It got through the spec but that doesn't mean it got through the afterEach. Return afterEach's result.
    return afterEachResult
  end
end

function Test:runSpecs()
  local results = {}

  if self:size() == 0 then
    defaultTest(self.name)
  else
    MsgC(Colors.white, self.name .. " should:\n")
    if (runBeforeAll(self)) then
      for index, specName in pairs(self.indexedSpecs) do
        --Mark when the latest spec has been run
        GUnit.timestamp = os.time()
        results[specName] = runSpec(self, specName, self.specs[specName])
        results[specName]:print()
      end
      runAfterAll(self)
    end
  end

  return results
end

local function findAddonDirectories()
  local files, directories = file.Find("addons/*", "MOD")
  return directories
end

local function addProjectNameToTable(test)
  if (GUnit.Tests[test.projectName] == nil) then
    GUnit.Tests[test.projectName] = {}
  end
end

local function addTestToTable(test)
  assert(GUnit.Tests[test.projectName][test.name] == nil,
    "Testname " .. test.name .. " already exist for project " .. test.projectName)
  GUnit.Tests[test.projectName][test.name] = test
end

--[[
Creates a test and instantly adds it to GUnit's list of tests to run.
PARAM name:String - The name of the test.
]]
function Test:new(name)
  local newTest = {}
  setmetatable(newTest, self)
  self.__index = self
  newTest.name = name
  newTest.specs = {}
  newTest.indexedSpecs = {}
  newTest.beforeAllFunc = function() end
  newTest.afterAllFunc = function() end
  newTest.beforeEachFunc = function() end
  newTest.afterEachFunc = function() end
  newTest.projectName = findProjectName()
  addProjectNameToTable(newTest)
  addTestToTable(newTest)
  return newTest
end

--findTests()
GUnit.Test = Test


text:
using System;
using System.Diagnostics.Contracts;
using Gear.Geometry;

namespace Gear.Modeling
{
    /// <summary>
    /// Represents a triangle in 3D-space, defined by three vertices.
    /// </summary>
    public class Triangle3d : Polygon3d
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Triangle3d"/> class.
        /// </summary>
        /// <param name="radius"></param>
        public Triangle3d(double radius)
            : base(3, radius)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Triangle3d"/> class.
        /// </summary>
        /// <param name="radius"></param>
        /// <param name="mode"></param>
        public Triangle3d(double radius, RadiusMode mode)
            : base(3, radius, mode)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Triangle3d"/> class.
        /// </summary>
        /// <param name="a">The first vertex of the triangle.</param>
        /// <param name="b">The second vertex of the triangle.</param>
        /// <param name="c">The third vertex of the triangle.</param>
        public Triangle3d(Vertex3d a, Vertex3d b, Vertex3d c)
            : base(a, b, c)
        {
            Contract.Requires(a != null);
            Contract.Requires(b != null);
            Contract.Requires(c != null);
        }
        #endregion
        #region Properties

        /// <summary>
        /// Gets or sets the first vertex position.
        /// </summary>
        public Vertex3d A
        {
            get
            {
                return this[0];
            }

            set
            {
                Contract.Requires(value != null);

                this[0] = value;
            }
        }

        /// <summary>
        /// Gets or sets the second vertex position.
        /// </summary>
        public Vertex3d B
        {
            get
            {
                return this[1];
            }

            set
            {
                Contract.Requires(value != null);

                this[1] = value;
            }
        }

        /// <summary>
        /// Gets or sets the third vertex position.
        /// </summary>
        public Vertex3d C
        {
            get
            {
                return this[2];
            }

            set
            {
                Contract.Requires(value != null);

                this[2] = value;
            }
        }

        public override PrimitiveKind Kind
        {
            get
            {
                return PrimitiveKind.Triangle;
            }
        }

        public override Vector3d Normal
        {
            get
            {
                return Vector3d.CrossProduct((Vector3d)this.B - (Vector3d)this.A, (Vector3d)this.C - (Vector3d)this.A).Normalize();
            }
        }

        public override bool IsPlanar
        {
            get
            {
                return true;
            }
        }

        #endregion
        #region Methods
        public override bool Equals(object obj)
        {
            if (obj is Triangle3d)
            {
                return this == (Triangle3d)obj;
            }

            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return string.Format("({0}, {1}, {2})", this.A, this.B, this.C);
        }

        /// <summary>
        /// Gets the position on the current polygon at which the specified edge intersects it.
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public Vector3d GetIntersection(Edge3 line)
        {
            Contract.Requires(line != null);

            // Set up vector variables;
            Vector3d a, b, c, p, q;
            a = this.A.ToVector3();
            b = this.B.ToVector3();
            c = this.C.ToVector3();
            p = line.P.ToVector3();
            q = line.Q.ToVector3();

            // Vector from A to C
            var ex = this.C.X - this.A.X;
            var ey = this.C.Y - this.A.Y;
            var ez = this.C.Z - this.A.Z;

            // Vector from A to B
            var fx = this.B.X - this.A.X;
            var fy = this.B.Y - this.A.Y;
            var fz = this.B.Z - this.A.Z;

            // Cross product of e and f
            var nx = (fy * ez) - (fz * ey);
            var ny = (fz * ex) - (fx * ez);
            var nz = (fx * ey) - (fy * ex);

            // Normalize
            var m = Math.Sqrt((nx * nx) + (ny * ny) + (nz * nz));
            nx /= m;
            ny /= m;
            nz /= m;

            // Ray direction vector
            var dx = line.Q.X - line.P.X;
            var dy = line.Q.Y - line.P.Y;
            var dz = line.Q.Z - line.P.Z;

            m = Math.Sqrt((dx * dx) + (dy * dy) + (dz * dz));
            dx /= m;
            dy /= m;
            dz /= m;

            // Dot product of ray and normal, tells us if ray is pointing towards the triangle.
            m = (dx * nx) + (dy * ny) + (dz * nz);

            // Value of m determines the relationship of the vectors:
            // m < 0: Vectors are opposed
            // m == 0: Vectors are perpendicular
            // m > 0: Vectors point the same way
            if (m < 0)
            {
                var gx = this.A.X - line.P.X;
                var gy = this.A.Y - line.P.Y;
                var gz = this.A.Z - line.P.Z;

                var t = (gx * nx) + (gy * ny) + (gz * nz);

                if (t < 0)
                {
                    var k = t / m;

                    var sx = p.X + (dx * k);
                    var sy = p.Y + (dy * k);
                    var sz = p.Z + (dz * k);

                    return new Vector3d(sx, sy, sz);
                }
            }

            throw new NotImplementedException();
            // return null;
        }

        /// <summary>
        /// Calculates the intersection of one triangle with another.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public Edge3 GetIntersection(Triangle3d other)
        {
            if (other == null)
            {
                return null;
            }

            var q1 = this.A.ToVector3();
            var q2 = this.B.ToVector3();
            var q3 = this.C.ToVector3();
            var r1 = other.A.ToVector3();
            var r2 = other.B.ToVector3();
            var r3 = other.C.ToVector3();

            var n1 = Vector3d.CrossProduct(q2 - q1, q3 - q1);

            throw new NotImplementedException();
        }

        [ContractInvariantMethod]
        private void Invariants()
        {
            Contract.Invariant(this.Edges != null);
            Contract.Invariant(this.Edges.Length == 3);

            Contract.Invariant(this.Vertices != null);
            Contract.Invariant(this.Vertices.Length == 3);

            Contract.Invariant(this.A != null);
            Contract.Invariant(this.B != null);
            Contract.Invariant(this.C != null);
        }
        #endregion
        #region Operators

        /// <summary>
        /// Compares the vertices of two triangles and determines if they represent the same triangle.
        /// </summary>
        /// <param name="t1">The first <see cref="Triangle3d"/> to compare.</param>
        /// <param name="t2">The second <see cref="Triangle3d"/> to compare.</param>
        /// <returns>true if the triangles represent the same geometry; otherwise, false.</returns>
        public static bool operator ==(Triangle3d t1, Triangle3d t2)
        {
            if (Triangle3d.ReferenceEquals(t1, null) || Triangle3d.ReferenceEquals(t2, null))
            {
                if (Triangle3d.ReferenceEquals(t1, t2))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return t1.A == t2.A && t1.B == t2.B && t1.C == t2.C;
            }
        }

        /// <summary>
        /// Compares the vertices of two triangles and determines if they represent different triangles.
        /// </summary>
        /// <param name="t1">The first <see cref="Triangle3d"/> to compare.</param>
        /// <param name="t2">The second <see cref="Triangle3d"/> to compare.</param>
        /// <returns>true if the triangles represent different geometry; otherwise, false.</returns>
        public static bool operator !=(Triangle3d t1, Triangle3d t2)
        {
            if (Triangle3d.ReferenceEquals(t1, null) || Triangle3d.ReferenceEquals(t2, null))
            {
                if (Triangle3d.ReferenceEquals(t1, t2))
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                return t1.A != t2.A || t1.B != t2.B || t1.C != t2.C;
            }
        }
        #endregion
    }
}


text:
package com.github.andrepnh.jedis.utils;

public class ConversionException extends RuntimeException {

    private static final long serialVersionUID = 1;

    private static final String PARAMETERIZED_MESSAGE = "%s is not a valid %s";

    private final String value;

    private final Class<?> targetType;

    public ConversionException(String value, Class<?> targetType) {
        super(String.format(PARAMETERIZED_MESSAGE,
                value, targetType.getSimpleName()));
        this.value = value;
        this.targetType = targetType;
    }

    public ConversionException(String value, Class<?> targetType, Throwable cause) {
        super(String.format(PARAMETERIZED_MESSAGE,
                value, targetType.getSimpleName()),
                cause);
        this.value = value;
        this.targetType = targetType;
    }

    public String getValue() {
        return value;
    }

    public Class<?> getTargetType() {
        return targetType;
    }

}


text:
package com.osahub.thehouse.controller;

import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.google.appengine.api.blobstore.BlobKey;
import com.google.appengine.api.blobstore.BlobstoreService;
import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
import com.google.appengine.api.images.ImagesService;
import com.google.appengine.api.images.ImagesServiceFactory;

import static com.osahub.thehouse.dao.PictureDetailsDao.save;

@SuppressWarnings("serial")
public class UploadController extends HttpServlet {
	public void doPost(HttpServletRequest req, HttpServletResponse res)
			throws IOException, ServletException {
		HttpSession session = req.getSession(false);
		String tag = req.getParameter("Tag");
		String place = req.getParameter("Place");
		String description = req.getParameter("Description");
		String uID = (String) session.getAttribute("uID");
		String type = (String) session.getAttribute("Type");
		String picType = null;
		boolean valid = false;
		DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
		Date today = Calendar.getInstance().getTime();
		Date date = new Date();
		String time = timeFormat.format(today);
		//Blob Store Start
		BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
		Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(req);
        List<BlobKey> blobKeys = blobs.get("pic");
        BlobKey blobKey = new BlobKey(blobKeys.get(0).getKeyString());
        System.out.println(blobKey);
        ImagesService imagesService = ImagesServiceFactory.getImagesService();
        @SuppressWarnings("deprecation")
		String picID =  imagesService.getServingUrl(blobKey);
        //Blob Store End
		if (type.equals("admin")) {
			picType = "fame";
			valid = true;
		} else
			picType = "shame";
		//Save Picture
		save(picID, uID, tag, place, description, date, time, valid, picType);
		res.sendRedirect("/login-check");
	}
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Grammitis monticola Sledge

### Remarks
null


text:
convertdate
===========

The convertdate package was originally developed as "[Python Date
Utils](http://sourceforge.net/projects/pythondateutil/)" by Phil
Schwartz. It has been significantly updated and expanded.

[Consult the complete docs for detailed usage info](https://convertdate.readthedocs.io/).

Available calendars:

-   Armenian
-   Bahai
-   Coptic (Alexandrian)
-   French Republican
-   Gregorian
-   Hebrew
-   Indian Civil
-   Islamic
-   Julian
-   Mayan
-   Persian
-   Positivist
-   Mayan
-   ISO
-   Ordinal (day of year)
-   Dublin day count
-   Julian day count

The `holidays` module also provides some useful holiday-calculation,
with a focus on North American and Jewish holidays.

Installing
----------

`pip install convertdate`

Or download the package and run `python setup.py install`.

Examples
--------

    >>> from convertdate import french_republican
    >>> from convertdate import hebrew
    >>> french_republican.from_gregorian(2014, 10, 31)
    (223, 2, 9)
    >>> hebrew.from_gregorian(2014, 10, 31)
    (5775, 8, 7)

Note that in some calendar systems, the day begins at sundown.
Convertdate gives the conversion for noon of the day in question.

Each module includes a `monthcalendar` function, which will generate a
calender-like nested list for a year and month (each list of dates runs
from Sunday to Saturday)

    >>> hebrew.monthcalendar(5775, 8)
    [
        [None, None, None, None, None, None, 1],
        [2, 3, 4, 5, 6, 7, 8],
        [9, 10, 11, 12, 13, 14, 15],
        [16, 17, 18, 19, 20, 21, 22],
        [23, 24, 25, 26, 27, 28, 29]
    ]

    >>> julian.monthcalendar(2015, 1)
    [
       [None, None, None, 1, 2, 3, 4],
       [5, 6, 7, 8, 9, 10, 11],
       [12, 13, 14, 15, 16, 17, 18],
       [19, 20, 21, 22, 23, 24, 25],
       [26, 27, 28, 29, 30, 31, None]
    ]

Special Options
---------------

### Armenian

The Armenian calendar begins on 11 July 552 (Julian) and has two modes of
reckoning. The first is the invariant-length version consisting of 12 months
of 30 days each and five epagomenal days; the second is the version
established by Yovhannes Sarkawag in 1084, which fixed the first day of the
year with respect to the Julian calendar and added a sixth epagomenal day
every four years.

By default the invariant calendar is used, but the Sarkawag calendar can be
used beginning with the Armenian year 533 (11 August 1084) by passing the
parameter `method='sarkawag'` to the relevant functions.

### French Republican

Leap year calculations in the French Republican calendar are a matter of
dispute. By default, `convertdate` calculates leap years using the
autumnal equinox. You can also use one of three more systematic methods
proposed over the years.

-   Romme, a co-creator of the calendar, proposed leap years in years
    divisible by four, except for years divisible by 100.
-   Some concordances were drawn up in the 19th century that gave leap
    years every 4 years, in years that give a remainder of three when
    divided by four (19, 23, 27, etc...).
-   Von Mädler proposed leap years in years divisible by four, except
    for years divisible by 128.

You can specify any of these three methods with the method keyword
argument in `french_republican` conversion functions.

    from convertdate import french_republican

    # Romme's method
    french_republican.to_gregorian(20, 1, 1), method='romme')
    # (1811, 9, 23)

    # continuous method
    french_republican.to_gregorian(20, 1, 1), method='continuous')
    # (1811, 9, 24)

    # von Madler's method
    french_republican.to_gregorian(20, 1, 1), method='madler')
    # (1811, 9, 23)

All the conversion methods correctly assign the leap years implemented
while calendar was in use (3, 7, 11).

Baha'i
------

The Bahá'í (Badí) calendar has an intercalary period, Ayyam-i-Há, which occurs between the 18th and 19th months.
Dates in this period are returned as month 19, and the month of 'Alá is reported as month 20.

```python
from convertdate import bahai
# the first day of Ayyam-i-Ha:
bahai.to_gregorian(175, 19, 1)
# (2019, 2, 26)
# The first day of 'Ala:
bahai.to_gregorian(175, 20, 1)
# (2019, 3, 2)
```

Before the Common Era
---------------------

For dates before the Common Era (year 1), `convertdate` uses
astronomical notation: 1 BC is recorded as 0, 2 BC is -1, etc. This
makes arithmatic much easier at the expense of ignoring custom.

Note that for dates before 4 CE, `convertdate` uses the [proleptic
Julian
calendar](https://en.wikipedia.org/wiki/Proleptic_Julian_calendar). The
Julian Calendar was in use from 45 BC, but before 4 CE the leap year
leap year pattern was irregular.

The [proleptic Gregorian
calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) is
used for dates before 1582 CE, the year of the Gregorian calendar
reform.

Holidays
--------

North American holidays are the current focus of the `holidays` module,
but pull requests are welcome.

    from convertdate import holidays

    # For simplicity, functions in the holidays module return a tuple
    # In the format (year, month, day)

    holidays.new_years(2014)
    # (2014, 1, 1)

    holidays.memorial_day(2014)
    # (2014, 5, 26)

    # USA is default
    holidays.thanksgiving(2014)
    # (2014, 11, 27)

    # But there is a Canadian option for some holidays
    holidays.thanksgiving(2014, 'canada')
    # (2014, 10, 13)

    # Mexican national holidays
    holidays.natalicio_benito_juarez(2016)
    # (2016, 3, 21)

    holidays.dia_revolucion(2016)
    # (2016, 11, 21)

    # Some Jewish holidays are included
    holidays.rosh_hashanah(2014)

    # Easter can be calculated according to different churches
    # ('western', 'orthodox', 'eastern')
    # The eastern Christian computation differs from the Orthodox one
    # 4 times in each 532-year cycle.

    holidays.easter(2019)
    # (2019, 4, 21)
    holidays.easter(2019, church="orthodox")
    # (2019, 4, 28)
    holidays.easter(2019, church="orthodox")
    # (2019, 4, 28)

Utils
-----

Convertdate includes some utilities for manipulating and calculating
dates.

    from convertdate import utils

    # Calculate an arbitrary day of the week
    THUR = 3
    APRIL = 4

    # 3rd Thursday in April
    utils.nth_day_of_month(3, THUR, APRIL, 2014)
    # (2014, 4, 17)

    utils.nth_day_of_month(5, THUR, APRIL, 2014)
    # IndexError: No 5th day of month 4

    # Use 0 for the first argument to get the last weekday of a month
    utils.nth_day_of_month(0, THUR, APRIL, 2014)
    # (2014, 4, 24)

Note that when calculating weekdays, convertdate uses the convention of
the calendar and time modules: Monday is 0, Sunday is 6.

    from convertdate import gregorian

    SUN = 6

    day = gregorian.to_jd(2014, 4, 17)
    nextsunday = utils.next_weekday(SUN, day)

    gregorian.from_jd(nextsunday)
    # (2014, 4, 20)

Other utility functions:

-   nearest\_weekday
-   next\_or\_current\_weekday
-   previous\_weekday
-   previous\_or\_current\_weekday


text:
module Trade
  module Model::PaymentOrder
    extend ActiveSupport::Concern

    included do
      attribute :check_amount, :decimal, default: 0

      enum state: {
        init: 'init',
        confirmed: 'confirmed'
      }, _default: 'init'

      belongs_to :order, inverse_of: :payment_orders
      belongs_to :payment, inverse_of: :payment_orders
      has_one :refund, ->(o){ where(order_id: o.order_id) }, foreign_key: :payment_id, primary_key: :payment_id

      #validate :valid_check_amount
      validates :order_id, uniqueness: { scope: :payment_id }

      after_save :checked_payment, if: -> { confirmed? && (saved_change_to_state? || saved_change_to_check_amount?) }
      after_save :unchecked_payment, if: -> { init? && (state_before_last_save == 'confirmed' || saved_change_to_check_amount?) }
      after_destroy_commit :unchecked_to_order
    end

    def valid_check_amount
      if the_payment_amount > payment.total_amount + payment.adjust_amount
        self.errors.add(:check_amount, 'Total checked amount greater than payment\'s amount')
      end

      if the_order_amount > order.amount + order.adjust_amount
        self.errors.add(:check_amount, 'Total checked amount greater than Order\'s amount')
      end
    end

    def checked_payment
      checked_to_payment
      checked_to_order
    end

    def checked_to_payment
      payment.checked_amount += self.check_amount
      if payment.checked_amount == payment.compute_checked_amount
        payment.check_state
        payment.save!
      else
        payment.errors.add :checked_amount, 'check not equal'
        logger.error "#{self.class.name}/Payment: #{payment.error_text}"
        raise ActiveRecord::RecordInvalid.new(payment)
      end
    end

    def checked_to_order
      order.received_amount += self.check_amount
      if order.received_amount == order.compute_received_amount
        order.check_state
        order.save!
      else
        order.errors.add :received_amount, 'check not equal'
        logger.error "#{self.class.name}/Order: #{order.error_text}"
        raise ActiveRecord::RecordInvalid.new(order)
      end
    end

    def unchecked_payment
      unchecked_to_payment
      unchecked_to_order
    end

    def unchecked_to_payment
      self.payment && payment.reload

      payment.checked_amount -= self.check_amount
      if payment.checked_amount == payment.compute_checked_amount
        payment.check_state
        payment.save!
      else
        payment.errors.add :checked_amount, 'uncheck not equal'
        logger.error "#{self.class.name}/Payment: #{payment.errors.full_messages.join(', ')}"
        raise ActiveRecord::RecordInvalid.new(payment)
      end
    end

    def unchecked_to_order
      self.order && order.reload

      order.received_amount -= self.check_amount
      if order.received_amount == order.compute_received_amount
        order.check_state
        order.save!
      else
        order.errors.add :received_amount, 'uncheck not equal'
        logger.error "#{self.class.name}/Order: #{order.errors.full_messages.join(', ')}"
        raise ActiveRecord::RecordInvalid.new(order)
      end
    end

    def confirm!
      self.state = 'confirmed'
      self.save!
    end

    def revert_confirm!
      self.state = 'init'
      self.save!
    end

  end
end


text:
<?php

/**
 * Includes
 */
require_once 'CouchDBCommand.php';

/**
 * Database Compact Command
 *
 * @package Commands
 * @author Adam Venturella
 */
class Compact implements CouchDBCommand
{
	private $database;

	/**
	 * undocumented function
	 *
	 * @param string $database
	 * @author Adam Venturella
	 */
	public function __construct($database)
	{
		$this->database = $database;
	}

	public function request()
	{

		return <<<REQUEST
POST /$this->database/_compact HTTP/1.0
Connection: Close

REQUEST;
	}

	public function __toString()
	{
		return 'Compact';
	}
}
?>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>org.apache.solr.hadoop.dedup (Solr 4.8.0 API)</title>
<meta name="date" content="2014-04-24">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

org.apache.solr.hadoop.dedup

Interfaces

UpdateConflictResolver

Classes

NoChangeUpdateConflictResolver

RejectingUpdateConflictResolver

RetainMostRecentUpdateConflictResolver

SolrInputDocumentComparator

SolrInputDocumentComparator.TimeStampComparator

SortingUpdateConflictResolver


text:
function Game() {

}


text:
using UnityEngine;

public class NumberSprites : MonoBehaviour
{
    [SerializeField]
    SpriteRenderer[] Renderers;

    [SerializeField]
    OrderType Order;

    [SerializeField]
    Sprite[] SpriteImages = new Sprite[10];

    enum OrderType
    {
        Increase,
        Decrease
    }

    public int Value { get; set; }

    int displayValue = 0;

    System.Action update;

    System.Action Increase
    {
        get
        {
            return () =>
            {
                if (this.Value > this.displayValue) this.UpdateDisplayValue(++this.displayValue);
            };
        }
    }

    System.Action Decrease
    {
        get
        {
            return () =>
            {
                if (this.Value < this.displayValue) this.UpdateDisplayValue(--this.displayValue);
            };
        }
    }

    public void Reset(int value)
    {
        this.displayValue = value;
        this.Value = value;
        this.UpdateDisplayValue(value);
    }

    void Awake()
    {
        this.update = this.Order == OrderType.Increase ? this.Increase : this.Decrease;
    }

    // Update is called once per frame
    void Update ()
    {
        this.update();
    }

    void UpdateDisplayValue(int value)
    {
        int index = 0;
        int last = this.Renderers.Length - 1;

        while (index <= last)
        {
            int num = value / (int)Mathf.Pow(10, last - index) % 10;
            this.Renderers[index++].sprite = this.SpriteImages[num];
        }
    }

    Sprite SpriteImage(int num)
    {
        return this.SpriteImages[num];
    }
}