text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>backend</artifactId>
        <groupId>automarker</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>compile-checker</groupId>
    <artifactId>compile-checker</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>${project.artifactId}</name>
    <description>My wonderfull scala app</description>
    <inceptionYear>2015</inceptionYear>
    <licenses>
        <license>
            <name>My License</name>
            <url>http://....</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <encoding>UTF-8</encoding>
        <scala.version>2.11.5</scala.version>
        <scala.compat.version>2.11</scala.compat.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>json_parser</groupId>
            <artifactId>json_parser</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-json_2.11</artifactId>
            <version>2.5.9</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.specs2</groupId>
            <artifactId>specs2-core_${scala.compat.version}</artifactId>
            <version>2.4.16</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.compat.version}</artifactId>
            <version>2.2.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>compile.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- see http://davidb.github.com/scala-maven-plugin -->
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <args>
                                <arg>-dependencyfile</arg>
                                <arg>
                                    ${project.build.directory}/.scala_dependencies
                                </arg>
                            </args>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <useFile>false</useFile>
                    <disableXmlReport>true</disableXmlReport>
                    <!-- If you have classpath issue like NoDefClassError,... -->
                    <!-- useManifestOnlyJar>false</useManifestOnlyJar -->
                    <includes>
                        <include>**/*Test.*</include>
                        <include>**/*Suite.*</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
'use strict';
module.exports = {
  extend: function (target) {
    var source;
    for(var i = 1, l = arguments.length; i < l; ++i) {
      source = arguments[i];
      for(var key in source) {
        target[key] = source[key];
      }
    }
    return target;
  },
  noop: function (){},
  remove: function (array, item) {
    var index = array.indexOf(item);
    if(index >= 0) {
      array.splice(index, 1);
    }
    return array;
  }
};

redpajama_set_name: RedPajamaGithub


text:
<?php
use Nathalie\Exam16\BoardRepo;
use Nathalie\Exam16\DatabaseConnection;

/**
 * Class BoardsTest
 */
class BoardsTest extends PHPUnit_Framework_TestCase
{
    private $database;

    public function setUp()
    {
        $databaseConnection = new DatabaseConnection();
        $this->database     = $databaseConnection->connect();
    }

    public function testGetById()
    {
        $boardsRepo = new BoardRepo($this->database);
        $board      = $boardsRepo->getById(1);

        $this->assertEquals(2, $board->Boards_Seats);
    }

    public function testGetAll()
    {
        $boardsRepo = new BoardRepo($this->database);
        $all        = $boardsRepo->getAll();

        $this->assertEquals(10, count($all));
    }

    public function testGetOccupied()
    {
        $boardsRepo = new BoardRepo($this->database);
        $boards     = $boardsRepo->getOccupied('2016-10-31', '19:00');

        $this->assertEquals(1, count($boards));
        $this->assertEquals(2, reset($boards)->Boards_ID);
    }

    public function testGetAvailable()
    {
        $boardsRepo = new BoardRepo($this->database);
        $boards     = $boardsRepo->getAvailable('2016-10-31', '19:00', 2);

        $this->assertEquals(9, count($boards));
    }
}


text:
<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
    <p>

        <?php
            /*
             * Find the valid hashtags in this string

             Create a function that will find the
                - Hashtags are alphanumeric strings ([a-zA-Z0-9]) prefixed with the hash symbol "#"
                - (e.g. "#keyword" is a valid hashtag and #2Words!? counts as "2Words" only)
                - Hashtags cannot be in the middle of a words or characters (e.g. "some#word" and ".?!#word" are invalid)
                - Hash symbols ("#") alone are not valid
                - If a word is preceded by more than one hash symbol, only one hashtag counts (e.g. "###keyword" counts only as "keyword")
                - Since hashtags are only alphanumeric [a-zA-Z0-9] in case (e.g. "###keyword" counts only as "keyword")
             *
             */

                function findHashtags($validString){
                    $validString = array($validString);
                    if($validString[0] == "#"){
                        return true;
                    }
                }

           echo  findHashtags("#words");
             $sentence = 'this #free is ##wild , .?!#word #can #young some#word ###keyword';

             $words = // find a php function that will turn a string into words

             // now that you have words, loop around them to find the valid hashtags

             // store the bad and good hashtags in their appropriate locations
             $hashtags = array('bad_hashtags' => array(), 'good_hashtags' => array());

        ?>

    </p>

    </body>
</html>


text:
package org.carbon.persistent.exception;

/**
 * @author Shota Oda 2018/01/02.
 */
public class DialectResolveException extends Exception {
    public DialectResolveException(String message) {
        super(message);
    }
}


text:
<?php

/**
 * Style converter for border style properties.
 *
 * @package Document
 * @access private
 * @version //autogen//
 */
class ezcDocumentOdtPcssBorderConverter implements ezcDocumentOdtPcssConverter
{
    /**
     * Converts CSS 'border' style.
     *
     * This method receives a $targetProperty DOMElement and converts the given
     * style with $styleName and $styleValue to attributes on this
     * $targetProperty.
     *
     * @param DOMElement $targetProperty
     * @param string $styleName
     * @param ezcDocumentPcssStyleValue $styleValue
     */
    public function convert( DOMElement $targetProperty, $styleName, ezcDocumentPcssStyleValue $styleValue )
    {
        foreach ( $styleValue->value as $type => $borderValues )
        {
            $targetProperty->setAttributeNS(
                ezcDocumentOdt::NS_ODT_FO,
                "fo:border-{$type}",
                sprintf(
                    "%smm %s %s",
                    $borderValues['width'],
                    $borderValues['style'],
                    ezcDocumentOdtPcssConverterTools::serializeColor( $borderValues['color'] )
                )
            );
        }
    }
}

?>


text:
#include "OpenGLApp.h"
#include "Trace.h"

#include <GLFW/glfw3.h>

#include <cassert>

namespace Pane
{
    OpenGLApp::OpenGLApp()
        : m_window(nullptr)
    {
        if(!glfwInit())
        {
            Pane::error("Could not initialize GLFW");
            glfwTerminate();
        }
        else
        {
            Pane::info("Loaded GLFW version %d.%d.%d", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION);
        }
    }

    OpenGLApp::~OpenGLApp()
    {
        glfwTerminate();
    }

    bool OpenGLApp::createWindow(const WindowConf & conf)
    {
        assert(!m_window);

        m_window = std::make_shared<OpenGLWindow>(conf);

        return m_window != nullptr;
    }

    bool OpenGLApp::init()
    {
        // No need to initialize, OpenGLWindow does everything needed
        return true;
    }

    int OpenGLApp::run()
    {
        m_timer.reset();

        while(m_window->running())
        {
            glfwMakeContextCurrent(m_window->handle());

            m_window->processEvents();

            m_timer.tick();

            update(m_timer);
            draw();

            glfwSwapBuffers(m_window->handle());
        }

        return m_window->exitCode();
    }

    void OpenGLApp::exit(int exitCode)
    {
        m_window->exit(exitCode);
    }

    void OpenGLApp::update(const Pane::GameTime & gametime)
    {
    }

    void OpenGLApp::draw()
    {
    }
}


text:
title: Dolphins
date: 2014-04-01
---

![Dolphins](/a/dolphins.jpg)

The term 'dolphin' can be used to refer to, under the suborder Odontoceti, all
the species in the family Delphinidae (marine dolphins including orcas and pilot
whales) and the river dolphin families Iniidae (South American river dolphins),
Pontoporiidae (La Plata dolphin), Lipotidae (Yangtze river dolphin) and
Platanistidae (Ganges river dolphin and Indus river dolphin).

This term has often been misused in the US, mainly in the fishing industry,
where all small cetaceans (dolphins and porpoises) are considered porpoises,
while the fish dorado is called dolphin fish. In common usage the term
'whale' is used only for the larger cetacean species,[10] while the smaller
ones with a beaked or longer nose are considered 'dolphins'.

The name 'dolphin' is used casually as a synonym for bottlenose dolphin, the
most common and familiar species of dolphin. Killer whales also belong to
the family Delphinidae and therefore qualify as dolphins. Though the terms
'dolphin' and 'porpoise' are sometimes used interchangeably, porpoises are not
considered dolphins and have different physical features such as a shorter beak
and spade-shaped teeth; they also differ in their behavior. Porpoises belong to
the family Phocoenidae and share a common ancestry with the Delphinidae.

A group of dolphins is called a "school" or a "pod". Male dolphins are called
"bulls", females "cows" and young dolphins are called "calves".


text:
<include file="Public:head"/>

 <link rel="stylesheet" href="{gooraye::STATICS}/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{gooraye::STATICS}/kindeditor/plugins/code/prettify.css" />

<link rel="stylesheet" type="text/css" href="{gooraye::RES}/css/cymain.css" />

$token,'wecha_id'=>$wecha_id))}" class="right  btnGreen" >返回

添加回复

{gooraye:$message}

    <form method="post" onsubmit="return check();" action="{gooraye::U('User/Reply/addreply',array('token'=>$token,'wecha_id'=>$wecha_id,'message_id'=>$message_id))}">

<textarea  id="addcontent" name="content"  rows="5" style="width:592px;height:100px;border:1px solid #D7DDE6;" ></textarea>

<input type="submit" value="保存" class="btnGrayS vm smallbtn">  $token,'wecha_id'=>$wecha_id))}" class="btnGrayS vm smallbtn">取消

</form>

回复列表

<if condition="$res">

       选中审核

        选中删除

<form method="post" action="" id="info">
    <input name="wecha_id" type="hidden" id="wecha_id" value="{gooraye:$wecha_id}">
    <input name="checked" type="hidden" id="needCheck" value="{gooraye:$needCheck}">

<input type="button" value="反选" name="button" id="selected" style="color:#94D38A;" >

回复内容
回复时间

操作

<volist name="res" id="item">

<input type="checkbox" name="items" value="{gooraye:$item.id}" class="checkitem"  >
<if condition="$item['differ'] neq 1">(网友回复)<else/>(管理员回复)</if><if condition="$item['checked'] neq 1">(未审核)<else/></if>{gooraye:$item.reply|htmlspecialchars}
{gooraye:$item.time|date="Y-m-d H:i:s",###}

    $item['id'],'token'=>$token))}"><if condition="$item['checked'] neq 1">审核<else/></if>
      $item['id'],'token'=>$token))}');">删除

</volist>

</form>

<else/>

还没有回复内容

</if>

{gooraye:$page}

<include file="Public:footer"/>


text:
package org.deeplearning4j.spark.impl.common.repartition;

import org.datavec.spark.functions.FlatMapFunctionAdapter;
import org.deeplearning4j.spark.util.BasePairFlatMapFunctionAdaptee;
import scala.Tuple2;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This is a simple function used to convert a {@code JavaRDD<Tuple2<T,U>>} to a {@code JavaPairRDD<T,U>} via a
 * {JavaRDD.mappartitionsToPair()} call.
 *
 * @author Alex Black
 */
public class MapTupleToPairFlatMap<T, U> extends BasePairFlatMapFunctionAdaptee<Iterator<Tuple2<T, U>>, T, U> {

    public MapTupleToPairFlatMap() {
        super(new MapTupleToPairFlatMapAdapter<T, U>());
    }
}

class MapTupleToPairFlatMapAdapter<T, U> implements FlatMapFunctionAdapter<Iterator<Tuple2<T, U>>, Tuple2<T, U>> {

    @Override
    public Iterable<Tuple2<T, U>> call(Iterator<Tuple2<T, U>> tuple2Iterator) throws Exception {
        List<Tuple2<T, U>> list = new ArrayList<>();
        while (tuple2Iterator.hasNext()) {
            list.add(tuple2Iterator.next());
        }
        return list;
    }
}


text:
angular.module('userService', [])

.factory('User', function($http) {

	// create a new object
	var userFactory = {};

	// get a single user
	userFactory.get = function(id) {
		return $http.get('/api/users/' + id);
	};

	// get all users
	userFactory.all = function() {
		return $http.get('/api/users/');
	};

	// create a user
	userFactory.create = function(userData) {
		return $http.post('/api/users/', userData);
	};

	// update a user
	userFactory.update = function(id, userData) {
		return $http.put('/api/users/' + id, userData);
	};

	// delete a user
	userFactory.delete = function(id) {
		return $http.delete('/api/users/' + id);
	};

	// return our entire userFactory object
	return userFactory;

});


text:
	<link rel="stylesheet" type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"/>
	<link rel="stylesheet" type="text/css" href="resource/Aristo.css"/>
	<link rel="stylesheet" type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables_themeroller.css"/>
	<link rel="stylesheet" type="text/css" href="resource/TableTools.css"/>
	<link rel="stylesheet" type="text/css" href="resource/TableTools_JUI.css"/>
	<link rel="stylesheet" type="text/css" href="resource/protean.css"/>

Entities

Products

	<input class="gobar">


text:
typedef void (^interfaceManagerBlock)(BOOL isSucceed, NSString *message, id data);

@interface InterfaceManager : NSObject

// 我的收藏
+ (void)getMyCollect:(NSString *)page completion:(interfaceManagerBlock)completion;

// 商品分类<包括顶级分类和子分类>
+ (void)getProductCategory:(NSString *)pid withPage:(NSString *)page completion:(interfaceManagerBlock)completion;

// 商品列表
+ (void)getProductList:(NSString *)pid withPage:(NSString *)page completion:(interfaceManagerBlock)completion;

// 精品频道
+ (void)getGoodProductList:(int)index completion:(interfaceManagerBlock)completion;

// 商品详情
+ (void)getProductDetail:(NSString *)pid completion:(interfaceManagerBlock)completion;

// 加入购物车
+ (void)addProductToShoppingCart:(AddCartRequestModel *)requestData completion:(interfaceManagerBlock)completion;

// 购物车列表
+ (void)getProductListInShoppingCart:(interfaceManagerBlock)completion;

// 购物车提交
+ (void)submitShoppingCart:(CartSubmitRequestModel *)cart completion:(interfaceManagerBlock)completion;

// 订单提交
//+ (void)submitOrder:(CartSubmitRequestModel *)cart completion:(interfaceManagerBlock)completion;
+ (void)submitOrder:(NSDictionary *)cart completion:(interfaceManagerBlock)completion;

// 订单支付
+ (void)payOrder:(NSString *)orderId withPayType:(NSString *)payId completion:(interfaceManagerBlock)completion;

// 删除购物项
+ (void)deleteProductInCart:(NSArray *)productArr completion:(interfaceManagerBlock)completion;

// 全部订单
+ (void)getAllOrder:(NSString *)page completion:(interfaceManagerBlock)completion;

// 待付款订单
+ (void)getOrderForUnpay:(NSString *)page completion:(interfaceManagerBlock)completion;

// 待发货订单
+ (void)getOrderForUnship:(NSString *)page completion:(interfaceManagerBlock)completion;

// 待收货订单
+ (void)getOrderForUnsign:(NSString *)page completion:(interfaceManagerBlock)completion;

// 待评价商品列表
+ (void)getOrderForUnComment:(NSString *)page completion:(interfaceManagerBlock)completion;

// 地区信息
+ (void)getAllArea:(interfaceManagerBlock)completion;

// 立即购买
+ (void)buyProductNow:(ProductBuyRequestModel *)goods completion:(interfaceManagerBlock)completion;

// 添加/修改收货地址
+ (void)addAddress:(AddressItemModel *)addrItem completion:(interfaceManagerBlock)completion;

// 收货地址列表
+ (void)getAddressList:(interfaceManagerBlock)completion;

// 删除收货地址
+ (void)deleteAddress:(AddressModel *)addr completion:(interfaceManagerBlock)completion;

// 设置默认收货地址
+ (void)settingDefaultAddress:(AddressModel *)addr completion:(interfaceManagerBlock)completion;

// 商品规格
+ (void)getProductParameters:(NSString *)goods_id completion:(interfaceManagerBlock)completion;

// 加入收藏
+ (void)addProductCollection:(NSString *)goods_id completion:(interfaceManagerBlock)completion;

// 取消收藏
+ (void)cancelProductCollection:(NSString *)goods_id completion:(interfaceManagerBlock)completion;

// 签收订单
+ (void)userReceiveOrder:(NSString *)orderId completion:(interfaceManagerBlock)completion;

// 商品评价
+ (void)userCommentProduct:(NSString *)productId withOrder:(NSString *)orderId completion:(interfaceManagerBlock)completion;

// 提交商品评论
+ (void)submitProductComment:(CommentSubmitModel *)comment completion:(interfaceManagerBlock)completion;

// 搜索
+ (void)searchProductWithKeyword:(NSString *)keyword completion:(interfaceManagerBlock)completion;

// 订单结算
+ (void)finishUnpayOrder:(NSString *)orderId completion:(interfaceManagerBlock)completion;

// 首页广告
+ (void)getAdsInHomepage:(interfaceManagerBlock)completion;

// 预付款消费记录
+ (void)getPayMoneyRecord:(NSString *)page completion:(interfaceManagerBlock)completion;

// 预存款充值方式
+ (void)getRechargeMethods:(interfaceManagerBlock)completion;

// 预存款充值提交
+ (void)RechargeAccount:(NSString *)money andPayType:(NSString *)pay completion:(interfaceManagerBlock)completion;

// 团购、秒杀列表
// 0团购 1秒杀
+ (void)getGroupOnList:(NSString *)page withType:(NSString *)type completion:(interfaceManagerBlock)completion;

// 团购、秒杀详情
+ (void)getGroupOnDetail:(NSString *)activityID completion:(interfaceManagerBlock)completion;

// 团购、秒杀之商品购买
+ (void)buyGrouponProduct:(NSString *)goods_id withProductId:(NSString *)product_id andNumber:(NSString *)number completion:(interfaceManagerBlock)completion;

@end


text:
package mimir.models;

import scala.util.Random

import mimir.algebra._
import mimir.util._
import mimir.Database
import mimir.ml.spark.SparkML
import mimir.util.TextUtils.Levenshtein
import mimir.ml.spark.SparkML.{SparkModelGeneratorParams => ModelParams }

import org.apache.spark.sql.Row
import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.types.StructField
import mimir.exec.spark.RAToSpark
import mimir.provenance.Provenance
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.types.{IntegerType, DoubleType, FloatType, StringType, DateType, TimestampType, BooleanType, LongType, ShortType}
import mimir.ml.spark.Classification
import mimir.ml.spark.Regression
import org.apache.spark.ml.PipelineModel

object PickerModel
{
  val TRAINING_LIMIT = 10000

  def availableSparkModels(trainingDataq:DataFrame) = Map(
    ID("Classification") ->
      ( Classification,
        Classification.DecisionTreeMulticlassModel(trainingDataq)
      ),
    ID("Regression") ->
      ( Regression,
        Regression.GeneralizedLinearRegressorModel(trainingDataq)
      )
  )

  def train(
    db:Database,
    name: ID,
    resultColumn:ID,
    pickFromCols:Seq[ID],
    colTypes:Seq[Type],
    useClassifier:Option[ID],
    classifyUpFrontAndCache:Boolean,
    query: Operator
  ) : SimplePickerModel = {
    val pickerModel = new SimplePickerModel(name, resultColumn, pickFromCols, colTypes, useClassifier, classifyUpFrontAndCache, query)
    val trainingQuery = Limit(0, Some(TRAINING_LIMIT), Sort(Seq(SortColumn(Function(ID("random"), Seq()), true)), Project(pickFromCols.map(col => ProjectArg(col, Var(col))), query.filter(Not(IsNullExpression(Var(pickFromCols.head)))) )))
    val (schemao, trainingDatao) = SparkUtils.getDataFrameWithProvFromQuery(db, trainingQuery)
    pickerModel.schema = schemao
    pickerModel.trainingData = trainingDatao
    val (sparkMLInst, modelGen) = useClassifier match { //use result of case expression
      case None => (Classification, Classification.DecisionTreeMulticlassModel(pickerModel.trainingData))
      case Some(sparkModelType) =>
        availableSparkModels(pickerModel.trainingData)
          .getOrElse(sparkModelType,
            ( Classification,
              Classification.DecisionTreeMulticlassModel(pickerModel.trainingData)
            )
          )
    }
    pickerModel.classifierModel = Some(modelGen(ModelParams(db, pickFromCols.head, "skip")))
    pickerModel.classifyAll(sparkMLInst)
    db.models.persist(pickerModel)
    pickerModel
  }
}

/**
 * A model representing a key-repair choice.
 *
 * The index is ignored.
 * The one argument is a value for the key.
 * The return value is an integer identifying the ordinal position of the selected value, starting with 0.
 */
@SerialVersionUID(1002L)
class SimplePickerModel(override val name: ID, resultColumn:ID, pickFromCols:Seq[ID], colTypes:Seq[Type], useClassifier:Option[ID], classifyUpFrontAndCache:Boolean, source: Operator)
  extends Model(name)
  with Serializable
  with FiniteDiscreteDomain
  with SourcedFeedback
  with ModelCache
{

  var classifierModel: Option[PipelineModel] = None
  var classifyAllPredictions:Option[Map[String, Seq[(String, Double)]]] = None
  var schema:Seq[(ID, Type)] = null
  var trainingData:DataFrame = null

  def getCacheKey(idx: Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue] ) : ID = ID(args(0).asString)
  def getFeedbackKey(idx: Int, args: Seq[PrimitiveValue] ) : ID = ID(args(0).asString)

  private def classToPrimitive(value:String): PrimitiveValue = {
    try {
      TextUtils.parsePrimitive(colTypes(0), value)
    } catch {
      case t: Throwable => throw new Exception(s"${t.getClass.getName} while parsing primitive: $value of type: ${colTypes(0)}")
    }
  }

  private def pickFromArgs(args: Seq[PrimitiveValue], value:Option[PrimitiveValue] = None) : PrimitiveValue = {
    value match {
      case None =>
        pickFromCols.zipWithIndex.foldLeft(NullPrimitive():PrimitiveValue)( (init, elem) => init match {
          case NullPrimitive() => args(elem._2+1)
          case x => x
        })
      case Some(v) =>
        pickFromCols.zipWithIndex.foldLeft(NullPrimitive():PrimitiveValue)( (init, elem) => (init, args(elem._2+1), v) match {
          case (NullPrimitive(), NullPrimitive(), _) => init
          case (NullPrimitive(), _, _) => args(elem._2+1)
          case (_, NullPrimitive(), _) => init
          case (e1, e2, _) if e1.equals(e2) => {
            val fbh = FeedbackSource.feedbackSource
            FeedbackSource.feedbackSource = FeedbackSource.groundSource
            if(!hasFeedback(0, args))
              setFeedback(0, args, e1)
            FeedbackSource.feedbackSource = fbh
            e1
          }
          case (p1@IntPrimitive(l1), p2@IntPrimitive(l2), IntPrimitive(l3)) => if(Math.abs(l1-l3)<Math.abs(l2-l3)) p1 else p2
          case (p1@FloatPrimitive(f1), p2@FloatPrimitive(f2), FloatPrimitive(f3)) => if(Math.abs(f1-f3)<Math.abs(f2-f3)) p1 else p2
          case (p1@StringPrimitive(s1), p2@StringPrimitive(s2), StringPrimitive(s3)) => if(Levenshtein.distance(s1, s3)<Levenshtein.distance(s2, s3)) p1 else p2
          case (d1:DatePrimitive, d2:DatePrimitive, d3:DatePrimitive) => if(Math.abs(d1.asDateTime.getMillis-d3.asDateTime.getMillis)<Math.abs(d2.asDateTime.getMillis-d3.asDateTime.getMillis)) d1 else d2
          case (d1:TimestampPrimitive, d2:TimestampPrimitive, d3:TimestampPrimitive) => if(Math.abs(d1.asDateTime.getMillis-d3.asDateTime.getMillis)<Math.abs(d2.asDateTime.getMillis-d3.asDateTime.getMillis)) d1 else d2
          case (d1:IntervalPrimitive, d2:IntervalPrimitive, d3:IntervalPrimitive) => if(Math.abs(d1.asInterval.getMillis-d3.asInterval.getMillis)<Math.abs(d2.asInterval.getMillis-d3.asInterval.getMillis)) d1 else d2
          case (p1@BoolPrimitive(b1), p2@BoolPrimitive(b2), BoolPrimitive(b3)) => if(b1 && b3)p1 else p2
          case (p1@RowIdPrimitive(s1), p2@RowIdPrimitive(s2), RowIdPrimitive(s3)) => if(s1.equals(s3)) p1 else p2
          case (p1@TypePrimitive(t1), p2@TypePrimitive(t2), TypePrimitive(t3)) => if(t1.equals(t3)) p1 else p2
          case _ => throw new RAException("Something really wrong is going on")
        }) match {
          case NullPrimitive() => v
          case x => x
        }
    }
  }

  def argTypes(idx: Int) = {
      Seq(TRowId()).union(colTypes)
  }
  def varType(idx: Int, args: Seq[Type]) = colTypes(idx)
  def bestGuess(idx: Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]  ) = {
    val rowid = args(0).asString
    getFeedback(idx, args) match {
      case Some(v) => v
      case None => {
        val arg1 = args(1)
        val arg2 = args(2)
        useClassifier match { //use result of case expression
          case None if hints.isEmpty => pickFromArgs(args)
          case None => hints(0)
          case Some(sparkModelType) =>
            getCache(idx, args, hints) match {
              case None => {
                //if(classifyUpFrontAndCache){
                NullPrimitive()
                //throw new Exception(s"Model Not trained: ($idx $args $hints) -> $cache")
                //}
                /*else
                  classify(idx, args, hints) match {
                    case Seq() => pickFromArgs(args)
                    case x => {
                      val prediction = classToPrimitive( x.head._1 )
                      setCache(idx, args, hints, prediction)
                      pickFromArgs(args, Some(prediction))
                    }
                  }*/
              }
              case Some(v) => pickFromArgs(args, Some(v))
            }
        }
      }

    }
  }
  def sample(idx: Int, randomness: Random, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]) = {
    useClassifier match { //use result of case expression
      case None => hints(0)
      case Some(sparkModelType) => {
        //val (sparmMLInst, modelGen) = availableSparkModels(trainingData).getOrElse(sparkModelType, (Classification, Classification.DecisionTreeMulticlassModel(trainingData)))
        val rowidstr = args(0).asString
        val rowid = RowIdPrimitive(rowidstr)
        (if(classifyUpFrontAndCache){
          val predictions = classifyAllPredictions match {
            case None => throw new Exception("Model Not trained")
            case Some(p) => p
          }
          predictions.getOrElse(rowidstr, Seq())
        }
        else{
          throw new Exception("Model Not trained") //classify(idx, args, hints)
        }) match {
          case Seq() => pickFromArgs(args, Some(classToPrimitive("0")))
          case classes => pickFromArgs(args, Some(classToPrimitive(RandUtils.pickFromWeightedList(randomness, classes))))
        }
      }
    }
  }
  def reason(idx: Int, args: Seq[PrimitiveValue],hints: Seq[PrimitiveValue]): String = {
    val rowid = RowIdPrimitive(args(0).asString)
    getFeedback(idx, args) match {
      case Some(v) =>
        s"${getReasonWho(idx,args)} told me that $resultColumn = $v on row $rowid"
      case None => {
        useClassifier match { //use result of case expression
          case None => s"I used an expressions to pick a value for $resultColumn from columns: ${pickFromCols.mkString(",")}"
          case Some(modelGen) => s"I used a classifier to pick a value for $resultColumn from columns: ${pickFromCols.mkString(",")}"
        }
      }
    }
  }
  def feedback(idx: Int, args: Seq[PrimitiveValue], v: PrimitiveValue): Unit = {
    val rowid = args(0).asString
    setFeedback(idx, args, v)
  }
  def isAcknowledged (idx: Int, args: Seq[PrimitiveValue]): Boolean = {
    hasFeedback(idx, args)
  }
  def hintTypes(idx: Int): Seq[mimir.algebra.Type] = useClassifier match {
    case None => Seq(TAny())
    case Some(x) => Seq()
  }

  def getDomain(idx: Int, args: Seq[PrimitiveValue], hints:Seq[PrimitiveValue]): Seq[(PrimitiveValue,Double)] =  useClassifier match {
    case Some(x) => Seq()//pickFromCols.zipWithIndex.map(colIdx => (args(colIdx._2), 1.0/pickFromCols.length.toDouble))
    case None => Seq((hints(0), 0.0))//pickFromCols.zipWithIndex.map(colIdx => (args(colIdx._2), 1.0/(pickFromCols.length+1).toDouble)) ++ Seq((hints(0), 1.0/(pickFromCols.length+1).toDouble))
  }

  /*def classify(idx:Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]) : Seq[(String,Double)] = {
    val classifier = classifierModel match {
      case None => throw new Exception("Model not trained")//train(useClassifier.get)
      case Some(clsfymodel) => clsfymodel
    }
    val predictions = sparkMLInst.extractPredictions(classifier, sparkMLInst.applyModel(classifier,pickFromCols.zip(colTypes) :+ (Provenance.rowidColnameBase, TString()), List(args)))
    //predictions.show()
    predictions.unzip._2
  }*/

  def classifyAll(sparkMLInstance:SparkML) : Unit = {
    val classifier = classifierModel match {
      case None => throw new Exception("Model not trained")
      case Some(clsfymodel) => clsfymodel
    }
    val classifyAllQuery = trainingData.transform(sparkMLInstance.fillNullValues)
    val predictions = sparkMLInstance.applyModel(classifier, classifyAllQuery)
    val predictionMap = sparkMLInstance.extractPredictions(classifier, predictions).groupBy(_._1).map { case (k,v) => (k,v.map(_._2))}
    classifyAllPredictions = Some(predictionMap)
    predictionMap.map(mapEntry => {
      setCache(0, Seq(RowIdPrimitive(mapEntry._1)), null, classToPrimitive( mapEntry._2(0)._1))
    })

  }

  def confidence (idx: Int, args: Seq[PrimitiveValue], hints:Seq[PrimitiveValue]): Double = {
    val rowid = RowIdPrimitive(args(0).asString)
    getFeedback(idx,args) match {
    case Some(v) => 1.0
    case None => 0.0
    }
  }
}


text:
Better Men. Better Lives.

Website Created and Managed by Daniel Dunn (DPDBP7@mail.missouri.edu)


text:
var table = [
  [ "H", "Hydrogen", "1.00794", 1, 1 ],
  [ "He", "Helium", "4.002602", 18, 1 ],
  [ "Li", "Lithium", "6.941", 1, 2 ],
  [ "Be", "Beryllium", "9.012182", 2, 2 ],
  [ "B", "Boron", "10.811", 13, 2 ],
  [ "C", "Carbon", "12.0107", 14, 2 ],
  [ "N", "Nitrogen", "14.0067", 15, 2 ],
  [ "O", "Oxygen", "15.9994", 16, 2 ],
  [ "F", "Fluorine", "18.9984032", 17, 2 ],
  [ "Ne", "Neon", "20.1797", 18, 2 ],
  [ "Na", "Sodium", "22.98976...", 1, 3 ],
  [ "Mg", "Magnesium", "24.305", 2, 3 ],
  [ "Al", "Aluminium", "26.9815386", 13, 3 ],
  [ "Si", "Silicon", "28.0855", 14, 3 ],
  [ "P", "Phosphorus", "30.973762", 15, 3 ],
  [ "S", "Sulfur", "32.065", 16, 3 ],
  [ "Cl", "Chlorine", "35.453", 17, 3 ],
  [ "Ar", "Argon", "39.948", 18, 3 ],
  [ "K", "Potassium", "39.948", 1, 4 ],
  [ "Ca", "Calcium", "40.078", 2, 4 ],
  [ "Sc", "Scandium", "44.955912", 3, 4 ],
  [ "Ti", "Titanium", "47.867", 4, 4 ],
  [ "V", "Vanadium", "50.9415", 5, 4 ],
  [ "Cr", "Chromium", "51.9961", 6, 4 ],
  [ "Mn", "Manganese", "54.938045", 7, 4 ],
  [ "Fe", "Iron", "55.845", 8, 4 ],
  [ "Co", "Cobalt", "58.933195", 9, 4 ],
  [ "Ni", "Nickel", "58.6934", 10, 4 ],
  [ "Cu", "Copper", "63.546", 11, 4 ],
  [ "Zn", "Zinc", "65.38", 12, 4 ],
  [ "Ga", "Gallium", "69.723", 13, 4 ],
  [ "Ge", "Germanium", "72.63", 14, 4 ],
  [ "As", "Arsenic", "74.9216", 15, 4 ],
  [ "Se", "Selenium", "78.96", 16, 4 ],
  [ "Br", "Bromine", "79.904", 17, 4 ],
  [ "Kr", "Krypton", "83.798", 18, 4 ],
  [ "Rb", "Rubidium", "85.4678", 1, 5 ],
  [ "Sr", "Strontium", "87.62", 2, 5 ],
  [ "Y", "Yttrium", "88.90585", 3, 5 ],
  [ "Zr", "Zirconium", "91.224", 4, 5 ],
  [ "Nb", "Niobium", "92.90628", 5, 5 ],
  [ "Mo", "Molybdenum", "95.96", 6, 5 ],
  [ "Tc", "Technetium", "(98)", 7, 5 ],
  [ "Ru", "Ruthenium", "101.07", 8, 5 ],
  [ "Rh", "Rhodium", "102.9055", 9, 5 ],
  [ "Pd", "Palladium", "106.42", 10, 5 ],
  [ "Ag", "Silver", "107.8682", 11, 5 ],
  [ "Cd", "Cadmium", "112.411", 12, 5 ],
  [ "In", "Indium", "114.818", 13, 5 ],
  [ "Sn", "Tin", "118.71", 14, 5 ],
  [ "Sb", "Antimony", "121.76", 15, 5 ],
  [ "Te", "Tellurium", "127.6", 16, 5 ],
  [ "I", "Iodine", "126.90447", 17, 5 ],
  [ "Xe", "Xenon", "131.293", 18, 5 ],
  [ "Cs", "Caesium", "132.9054", 1, 6 ],
  [ "Ba", "Barium", "132.9054", 2, 6 ],
  [ "La", "Lanthanum", "138.90547", 4, 9 ],
  [ "Ce", "Cerium", "140.116", 5, 9 ],
  [ "Pr", "Praseodymium", "140.90765", 6, 9 ],
  [ "Nd", "Neodymium", "144.242", 7, 9 ],
  [ "Pm", "Promethium", "(145)", 8, 9 ],
  [ "Sm", "Samarium", "150.36", 9, 9 ],
  [ "Eu", "Europium", "151.964", 10, 9 ],
  [ "Gd", "Gadolinium", "157.25", 11, 9 ],
  [ "Tb", "Terbium", "158.92535", 12, 9 ],
  [ "Dy", "Dysprosium", "162.5", 13, 9 ],
  [ "Ho", "Holmium", "164.93032", 14, 9 ],
  [ "Er", "Erbium", "167.259", 15, 9 ],
  [ "Tm", "Thulium", "168.93421", 16, 9 ],
  [ "Yb", "Ytterbium", "173.054", 17, 9 ],
  [ "Lu", "Lutetium", "174.9668", 18, 9 ],
  [ "Hf", "Hafnium", "178.49", 4, 6 ],
  [ "Ta", "Tantalum", "180.94788", 5, 6 ],
  [ "W", "Tungsten", "183.84", 6, 6 ],
  [ "Re", "Rhenium", "186.207", 7, 6 ],
  [ "Os", "Osmium", "190.23", 8, 6 ],
  [ "Ir", "Iridium", "192.217", 9, 6 ],
  [ "Pt", "Platinum", "195.084", 10, 6 ],
  [ "Au", "Gold", "196.966569", 11, 6 ],
  [ "Hg", "Mercury", "200.59", 12, 6 ],
  [ "Tl", "Thallium", "204.3833", 13, 6 ],
  [ "Pb", "Lead", "207.2", 14, 6 ],
  [ "Bi", "Bismuth", "208.9804", 15, 6 ],
  [ "Po", "Polonium", "(209)", 16, 6 ],
  [ "At", "Astatine", "(210)", 17, 6 ],
  [ "Rn", "Radon", "(222)", 18, 6 ],
  [ "Fr", "Francium", "(223)", 1, 7 ],
  [ "Ra", "Radium", "(226)", 2, 7 ],
  [ "Ac", "Actinium", "(227)", 4, 10 ],
  [ "Th", "Thorium", "232.03806", 5, 10 ],
  [ "Pa", "Protactinium", "231.0588", 6, 10 ],
  [ "U", "Uranium", "238.02891", 7, 10 ],
  [ "Np", "Neptunium", "(237)", 8, 10 ],
  [ "Pu", "Plutonium", "(244)", 9, 10 ],
  [ "Am", "Americium", "(243)", 10, 10 ],
  [ "Cm", "Curium", "(247)", 11, 10 ],
  [ "Bk", "Berkelium", "(247)", 12, 10 ],
  [ "Cf", "Californium", "(251)", 13, 10 ],
  [ "Es", "Einstenium", "(252)", 14, 10 ],
  [ "Fm", "Fermium", "(257)", 15, 10 ],
  [ "Md", "Mendelevium", "(258)", 16, 10 ],
  [ "No", "Nobelium", "(259)", 17, 10 ],
  [ "Lr", "Lawrencium", "(262)", 18, 10 ],
  [ "Rf", "Rutherfordium", "(267)", 4, 7 ],
  [ "Db", "Dubnium", "(268)", 5, 7 ],
  [ "Sg", "Seaborgium", "(271)", 6, 7 ],
  [ "Bh", "Bohrium", "(272)", 7, 7 ],
  [ "Hs", "Hassium", "(270)", 8, 7 ],
  [ "Mt", "Meitnerium", "(276)", 9, 7 ],
  [ "Ds", "Darmstadium", "(281)", 10, 7 ],
  [ "Rg", "Roentgenium", "(280)", 11, 7 ],
  [ "Cn", "Copernicium", "(285)", 12, 7 ],
  [ "Uut", "Unutrium", "(284)", 13, 7 ],
  [ "Fl", "Flerovium", "(289)", 14, 7 ],
  [ "Uup", "Ununpentium", "(288)", 15, 7 ],
  [ "Lv", "Livermorium", "(293)", 16, 7 ],
  [ "Uus", "Ununseptium", "(294)", 17, 7 ],
  [ "Uuo", "Ununoctium", "(294)", 18, 7 ]
];

// set up Argon
var app = Argon.init();
app.view.element.style.zIndex = 0;

var camera, scene, renderer, hud;
var root, userLocation;

var objects = [];
var targets = { table: [], sphere: [], helix: [], grid: [] };

// In a typical threejs example, the camera doesn't move and is controlled by the
// mouse.  We do not need that here.  Furthermore, our domElement for rendering is
// coordinated by argon to match the user's prefered rendering setup

//   renderer = new THREE.CSS3DRenderer();
//   renderer.setSize( window.innerWidth, window.innerHeight );
//   renderer.domElement.style.position = 'absolute';
//   renderer.domElement.style.top = 0;
//   document.getElementById( 'container' ).appendChild( renderer.domElement );
//
//   controls = new THREE.TrackballControls( camera, renderer.domElement );
//   controls.rotateSpeed = 0.5;
//   controls.addEventListener( 'change', render );

// In argon, we use a custom version of the CSS3DRenderer called CSS3DArgonRenderer.
// This version of the renderer supports stereo in a way that fits with Argon's renderEvent,
// especially supporting the user providing multiple divs for the potential multiple viewports
// in stereo mode.
renderer = new THREE.CSS3DArgonRenderer();
// The CSS3DArgonHUD has a similar interface to a renderer, and provides a simple abstraction
// for multiple HTML HUD's that can be used in stereo mode.  We do not
// use the HUD features here (instead, just removing the buttons below when in Stereo mode)
hud = new THREE.CSS3DArgonHUD();

// argon creates the domElement for the view, which we add our renderer dom to
app.view.element.appendChild(renderer.domElement);
app.view.element.appendChild(hud.domElement);

// argon will pass us the camera projection details in each renderEvent callback.  This
// is necessary to handle different devices, stereo/mono switching, etc.   argon will also
// tell us the position of the camera to correspond to user movement
//    camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 5000 );
//		camera.position.z = 1800;
camera = new THREE.PerspectiveCamera();
scene = new THREE.Scene();

// add a new Object3D, root, that serves as the root of the 3D world in local coordinates.
// Since the camera is moving in AR, and we want to move the content with us, but have it
// oriented relative to the world, putting it in a sub-graph under the userLocation object
// let's us move the location of the content with us.  Content should not be added to the
// scene directly unless it is going to be updated as the user moves through the world
// (since the world coordinate system is abitrarily chosen to be near the user, and could
// change at any time)

root = new THREE.Object3D()
userLocation = new THREE.Object3D;

// Add the root node to our eyeOrigin
userLocation.add(root)

// put the user and the camera in the world.  This allows us to update the userLocation
// based on the user's currect location in local coordinates, and to update the camera
// based on it's location and orientation in local coordinates
scene.add(userLocation);
scene.add(camera);

// Tell argon what local coordinate system you want.  The default coordinate
// frame used by Argon is Cesium's FIXED frame, which is centered at the center
// of the earth and oriented with the earth's axes.
// The FIXED frame is inconvenient for a number of reasons: the numbers used are
// large and cause issues with rendering, and the orientation of the user's "local
// view of the world" is different that the FIXED orientation (my perception of "up"
// does not correspond to one of the FIXED axes).
// Therefore, Argon uses a local coordinate frame that sits on a plane tangent to
// the earth near the user's current location.  This frame automatically changes if the
// user moves more than a few kilometers.
// The EUS frame cooresponds to the typical 3D computer graphics coordinate frame, so we use
// that here.  The other option Argon supports is localOriginEastNorthUp, which is
// more similar to what is used in the geospatial industry
app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth);

// need init to run after everything loads
window.addEventListener( 'load', init );

// The original animate function was called once to start the
// requestAnimationFrame update cycle.  We don't do that with Argon
//    animate();

function init() {
  // some of the exact locations of content below have been changed slightly from the original
  // example so that they work reasonably on smaller mobile phone screens.
  for ( var i = 0; i < table.length; i ++ ) {

    var item = table[ i ];

    var element = document.createElement( 'div' );
    element.className = 'element';
    element.style.backgroundColor = 'rgba(0,127,127,' + ( Math.random() * 0.5 + 0.25 ) + ')';
    //element.style.backgroundColor = 'rgba(0,127,127,1)';

    // if it's Argon make it bright red
    if (i==17) element.style.backgroundColor = 'rgba(127,0,0,1)';

    var number = document.createElement( 'div' );
    number.className = 'number';
    number.textContent = i + 1;
    element.appendChild( number );

    var symbol = document.createElement( 'div' );
    symbol.className = 'symbol';
    symbol.textContent = item[ 0 ];
    element.appendChild( symbol );

    var details = document.createElement( 'div' );
    details.className = 'details';
    details.innerHTML = item[ 1 ] + '<br>' + item[ 2 ];
    element.appendChild( details );

    var object = new THREE.CSS3DObject( element );
    object.position.x = Math.random() * 4000 - 2000;
    object.position.y = Math.random() * 4000 - 2000;
    object.position.z = Math.random() * 4000 - 2000;
    //object.matrixAutoUpdate = false;
    objects.push( object );

    // Add each object our root node
    root.add(object);
  }

  // table

  for ( var i = 0; i < objects.length; i ++ ) {

    var item = table[ i ];

    var target = new THREE.Object3D();

    target.position.x = ( item[ 3 ] * 140 ) - 1330;
    target.position.y = - ( item[ 4 ] * 180 ) + 990;
    target.position.z = - 1000;

    targets.table.push( target );

  }

  // sphere

  var vector = userLocation.position;

  for ( var i = 0; i < objects.length; i ++ ) {

    var phi = Math.acos( -1 + ( 2 * i ) / objects.length );
    var theta = Math.sqrt( objects.length * Math.PI ) * phi;
    var target = new THREE.Object3D();

    target.position.x = 800 * Math.cos( theta ) * Math.sin( phi );
    target.position.y = 800 * Math.sin( theta ) * Math.sin( phi );
    target.position.z = 800 * Math.cos( phi );

    target.lookAt( vector );

    targets.sphere.push( target );

  }

  // helix

  var vector = new THREE.Vector3(0, 0, 0);

  for ( var i = 0; i < objects.length; i ++ ) {

    var phi = i * 0.175 + Math.PI;

    target = new THREE.Object3D();

    target.position.x = 900 * Math.sin( -phi );
    target.position.y = - ( i * 8 ) + 450;
    target.position.z = 900 * Math.cos( -phi );

    vector.x = -target.position.x * 2;
    vector.y = -target.position.y;
    vector.z = -target.position.z * 2;

    target.lookAt( vector );

    targets.helix.push( target );

  }

  // grid
  for ( var i = 0; i < objects.length; i ++ ) {

    target = new THREE.Object3D();

    target.position.x = ( ( i % 5 ) * 400 ) - 800;
    target.position.y = ( - ( Math.floor( i / 5 ) % 5 ) * 400 ) + 800;
    target.position.z = ( Math.floor( i / 25 ) ) * 1000 - 2500;

    targets.grid.push( target );

  }

  // move the menu to the Argon HUD.  We don't duplicate it because we only
  // use it in mono mode
  var hudContainer = document.getElementById( 'hud' );
  hud.hudElements[0].appendChild(hudContainer);

  // Add button event listeners
  var button = document.getElementById( 'table' );
  button.addEventListener( 'click', function ( event ) {
    transform( targets.table, 2000 );
  }, false );

  var button = document.getElementById( 'sphere' );
  button.addEventListener( 'click', function ( event ) {
    transform( targets.sphere, 2000 );
  }, false );

  var button = document.getElementById( 'helix' );
  button.addEventListener( 'click', function ( event ) {
    transform( targets.helix, 2000 );
  }, false );

  var button = document.getElementById( 'grid' );
  button.addEventListener( 'click', function ( event ) {
    transform( targets.grid, 2000 );
  }, false );

  transform( targets.table, 5000 );

  // do not need to respond to windowResize events.  Argon handles this for us
  //    window.addEventListener( 'resize', onWindowResize, false );

}

function transform( targets, duration ) {
  TWEEN.removeAll();

      for ( var i = 0; i < objects.length; i ++ ) {

        var object = objects[ i ];
        var target = targets[ i ];

        new TWEEN.Tween( object.position )
          .to( { x: target.position.x, y: target.position.y, z: target.position.z }, Math.random() * duration + duration )
          .easing( TWEEN.Easing.Exponential.InOut )
          .start();

        new TWEEN.Tween( object.rotation )
          .to( { x: target.rotation.x, y: target.rotation.y, z: target.rotation.z }, Math.random() * duration + duration )
          .easing( TWEEN.Easing.Exponential.InOut )
          .start();

      }

      // An EXTREMELY important difference between creating desktop 3D content and
      // AR content using Argon is that we should not render except when argon tells
      // us to.  In this way, Argon can decide when to render based on the kind of Reality
      // being rendered, and the device being used.  So, we do not leverage the Tween.onUpdate
      // callback.
      new TWEEN.Tween( this )
        .to( {}, duration * 2 )
//					.onUpdate( render )
        .start();

}

// The original demo responded to windowResize events but updating the camera.
// argon handles this functionality and sends the appropriate information to
// the render callback each frame.

// 			function onWindowResize() {
//
// 				camera.aspect = window.innerWidth / window.innerHeight;
// 				camera.updateProjectionMatrix();
//
// 				renderer.setSize( window.innerWidth, window.innerHeight );
//
// 			}

// The original demo used a simple animation loop to trigger regular updates,
// and manage the mouse virtual trackball controller.  Argon send update
// messages, which we cache and trigger requestAnimationFrames from (see below)

// 			function animate() {
//
// 				requestAnimationFrame( animate );
//
// 				TWEEN.update();
// 				controls.update();
//
// 			}
//
// 			function render() {
//
// 				renderer.render( scene, camera );
//
// 			}

// the updateEvent is called each time the 3D world should be
// rendered, before the renderEvent.  The state of your application
// should be updated here.  Here, we call TWEEN.update()
app.updateEvent.addEventListener(function () {
    // get the position and orientation (the "pose") of the user
    // in the local coordinate frame.
    var userPose = app.context.getEntityPose(app.context.user);

    // assuming we know the user's pose, set the position of our
    // THREE user object to match it
    if (userPose.poseStatus & Argon.PoseStatus.KNOWN) {
        userLocation.position.copy(userPose.position);
    }

    // update the moving DIVs, if need be
    TWEEN.update();
});

// for the CSS renderer, we want to use requestAnimationFrame to
// limit the number of repairs of the DOM.  Otherwise, as the
// DOM elements are updated, extra repairs of the DOM could be
// initiated.  Extra repairs do not appear to happen within the
// animation callback.
var viewport = null;
var subViews = null;
app.renderEvent.addEventListener(function () {
    viewport = app.view.getViewport();
    subViews = app.view.getSubviews();
//    renderFunc();
        window.requestAnimationFrame(renderFunc);
});

// the animation callback.
function renderFunc() {
    rAFpending = false;
    // set the renderer to know the current size of the viewport.
    // This is the full size of the viewport, which would include
    // both views if we are in stereo viewing mode
    renderer.setSize(viewport.width, viewport.height);
    hud.setSize(viewport.width, viewport.height);

    // There is 1 subview in monocular mode, 2 in stereo mode.
    // If we are in mono view, show the buttons.  If not, hide them,
    // since we can't interact with them in an HMD
    if (subViews.length > 1 || !app.focus.hasFocus) {
      hud.domElement.style.display = 'none';
    } else {
      hud.domElement.style.display = 'block';
    }

    // we pass the view number to the renderer so it knows
    // which div's to use for each view
    for (var _i = 0, _a = subViews; _i < _a.length; _i++) {
        var subview = _a[_i];
        var frustum = subview.frustum;

        // set the position and orientation of the camera for
        // this subview
        camera.position.copy(subview.pose.position);
        camera.quaternion.copy(subview.pose.orientation);
        // the underlying system provide a full projection matrix
        // for the camera.  Use it, and then update the FOV of the
        // camera from it (needed by the CSS Perspective DIV)
        camera.projectionMatrix.fromArray(subview.frustum.projectionMatrix);
        camera.fov = THREE.Math.radToDeg(frustum.fovy);

        // set the viewport for this view
        var _b = subview.viewport, x = _b.x, y = _b.y, width = _b.width, height = _b.height;
        renderer.setViewport(x, y, width, height, _i);
        hud.setViewport(x, y, width, height, _i);

        // render this view.
        renderer.render(scene, camera, _i);
        hud.render(_i);
    }
}


text:
#ifndef FREERDP_CLIENT_ANDROID_EVENT_H
#define FREERDP_CLIENT_ANDROID_EVENT_H
#include <freerdp/freerdp.h>
#include <freerdp/api.h>

#define EVENT_TYPE_KEY 1
#define EVENT_TYPE_CURSOR 2
#define EVENT_TYPE_DISCONNECT 3
#define EVENT_TYPE_KEY_UNICODE 4
#define EVENT_TYPE_CLIPBOARD 5

typedef struct
{
	int type;
} ANDROID_EVENT;

typedef struct
{
	int type;
	int flags;
	UINT16 scancode;
} ANDROID_EVENT_KEY;

typedef struct
{
	int type;
	UINT16 flags;
	UINT16 x;
	UINT16 y;
} ANDROID_EVENT_CURSOR;

typedef struct
{
	int type;
	void* data;
	int data_length;
} ANDROID_EVENT_CLIPBOARD;

typedef struct
{
	int size;
	int count;
	HANDLE isSet;
	ANDROID_EVENT** events;
} ANDROID_EVENT_QUEUE;

FREERDP_LOCAL BOOL android_push_event(freerdp* inst, ANDROID_EVENT* event);

FREERDP_LOCAL HANDLE android_get_handle(freerdp* inst);
FREERDP_LOCAL BOOL android_check_handle(freerdp* inst);

FREERDP_LOCAL ANDROID_EVENT_KEY* android_event_key_new(int flags, UINT16 scancode);
FREERDP_LOCAL ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 flags, UINT16 key);
FREERDP_LOCAL ANDROID_EVENT_CURSOR* android_event_cursor_new(UINT16 flags, UINT16 x, UINT16 y);
FREERDP_LOCAL ANDROID_EVENT* android_event_disconnect_new(void);
FREERDP_LOCAL ANDROID_EVENT_CLIPBOARD* android_event_clipboard_new(const void* data,
                                                                   size_t data_length);

FREERDP_LOCAL void android_event_free(ANDROID_EVENT* event);

FREERDP_LOCAL BOOL android_event_queue_init(freerdp* inst);
FREERDP_LOCAL void android_event_queue_uninit(freerdp* inst);

#endif /* FREERDP_CLIENT_ANDROID_EVENT_H */


text:
import unittest

class TestPartOfSpeech(unittest.TestCase):

    @staticmethod
    def _get_target_class():
        from google.cloud.language.syntax import PartOfSpeech

        return PartOfSpeech

    def test_reverse(self):
        klass = self._get_target_class()
        for attr in dir(klass):
            if attr.startswith('_'):
                continue
            if attr.islower():
                continue
            value = getattr(klass, attr)
            result = klass.reverse(value)
            self.assertEqual(result, attr)

class TestToken(unittest.TestCase):

    @staticmethod
    def _get_target_class():
        from google.cloud.language.syntax import Token

        return Token

    def _make_one(self, *args, **kw):
        return self._get_target_class()(*args, **kw)

    def test_constructor(self):
        from google.cloud.language.syntax import PartOfSpeech

        text_content = 'All'
        text_begin = -1
        part_of_speech = PartOfSpeech.DETERMINER
        edge_index = 3
        edge_label = 'PREDET'
        lemma = text_content
        token = self._make_one(text_content, text_begin, part_of_speech,
                               edge_index, edge_label, lemma)
        self.assertEqual(token.text_content, text_content)
        self.assertEqual(token.text_begin, text_begin)
        self.assertEqual(token.part_of_speech, part_of_speech)
        self.assertEqual(token.edge_index, edge_index)
        self.assertEqual(token.edge_label, edge_label)
        self.assertEqual(token.lemma, lemma)

    def test_from_api_repr(self):
        from google.cloud.language.syntax import PartOfSpeech

        klass = self._get_target_class()
        text_content = 'pretty'
        text_begin = -1
        part_of_speech = PartOfSpeech.ADJECTIVE
        edge_index = 3
        edge_label = 'AMOD'
        lemma = text_content
        payload = {
            'text': {
                'content': text_content,
                'beginOffset': text_begin,
            },
            'partOfSpeech': {
                'tag': part_of_speech,
            },
            'dependencyEdge': {
                'headTokenIndex': edge_index,
                'label': edge_label,
            },
            'lemma': lemma,
        }
        token = klass.from_api_repr(payload)
        self.assertEqual(token.text_content, text_content)
        self.assertEqual(token.text_begin, text_begin)
        self.assertEqual(token.part_of_speech, part_of_speech)
        self.assertEqual(token.edge_index, edge_index)
        self.assertEqual(token.edge_label, edge_label)
        self.assertEqual(token.lemma, lemma)


text:
<?php
require_once "query.php";
require_once "modify.php";
$user_number = $_GET["user_number"];
$action = "functions/modify_user.php?staff_number=" . $user_number;
?>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>软件工程大作业</title>

    <link href="assets/css/bootstrap.min.css" rel="stylesheet">

    <link href="assets/css/style.css" rel="stylesheet">

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-title"
                    aria-expanded="false">
                Toggle navigation

            </button>
            教师工资管理系统 - 管理员
                demo

                    <?php echo $staff_name; ?>

回到主页

注销

关于

用户列表

                    工号
                    姓名
                    职位
                    职称
                    身份

                <?php
                print_user_info($con, $user_number);
                ?>

        <form action=<?php echo $action; ?> role="form" method="post">

                修改用户

                    工号: <?php echo $user_number; ?>

                    姓名
                    <input type="text" class="form-control" id="staff_name" name="staff_name" placeholer="工号">

                    职称
                    <select class="form-control" name="professional_title">
                        <option value="0" selected>无</option>
                        <option value="1">教授</option>
                        <option value="2">副教授</option>
                        <option value="3">讲师</option>
                        <option value="4">助教</option>
                    </select>

                    职位
                    <select class="form-control" name="staff_position">
                        <option value="0" selected>无</option>
                        <option value="1">校长</option>
                        <option value="2">副校长</option>
                        <option value="3">处长</option>
                        <option value="4">副处</option>
                        <option value="5">科长</option>
                        <option value="6">副科</option>
                        <option value="7">主管</option>
                        <option value="8">职员</option>
                    </select>

                    权限身份
                    <select class="form-control" name="modify_right">
                        <option value="0" selected>普通教师</option>
                        <option value="1">管理员 - 拥有修改权限</option>
                    </select>

                    密码(6-20位)
                    <input type="password" class="form-control" id="staff_password" name="staff_password"
                           placeholer="工号">

                    确认密码
                    <input type="password" class="form-control" id="reenter_password" name="reenter_password"
                           placeholer="工号">

                <button class="btn btn-success" type="submit">完成</button>
                <button class="btn btn-warning" type="reset">清除</button>

        </form>

海南大学信息科学技术学院 - 软件工程大作业

by 何俊霖 马海英 刘润一 蒋雨汐
                版权所有,仅供内部交流

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

关于

一个基本的工资管理系统的实现,基于 Apache - PHP - MySQL 开发。

                <button type="button" class="btn btn-primary" data-dismiss="modal">了解了</button>


text:
import {
    Entity,
    PrimaryGeneratedColumn,
    Column,
    CreateDateColumn,
} from "../../../../src"

@Entity()
export class Example {
    @PrimaryGeneratedColumn("uuid")
    id?: string

    @CreateDateColumn({ type: "datetime" })
    created?: Date

    @Column("varchar", { length: 10 })
    content: string = ""

    @Column("char", { length: 10 })
    fixedLengthContent: string = ""
}


text:
<?php

namespace Magento\Catalog\Model;

/**
 * Test class for \Magento\Catalog\Model\Category.
 * - tree knowledge is tested
 *
 * @see \Magento\Catalog\Model\CategoryTest
 * @magentoDataFixture Magento/Catalog/_files/categories.php
 * @magentoAppIsolation enabled
 * @magentoDbIsolation enabled
 */
class CategoryTreeTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Catalog\Model\Category
     */
    protected $_model;

    protected function setUp()
    {
        $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
            'Magento\Catalog\Model\Category'
        );
    }

    /**
     * Load category
     *
     * @param $categoryId
     * @return Category
     */
    protected function loadCategory($categoryId)
    {
        $this->_model->setData([]);
        $this->_model->load($categoryId);
        return $this->_model;
    }

    public function testMovePosition()
    {
        //move category 9 to new parent 6 with afterCategoryId = null
        $category = $this->loadCategory(9);
        $category->move(6, null);
        $category = $this->loadCategory(9);
        $this->assertEquals(1, $category->getPosition(), 'Position must be 1, if $afterCategoryId was null|false|0');
        $category = $this->loadCategory(10);
        $this->assertEquals(5, $category->getPosition(), 'Category 10 position must decrease after Category 9 moved');
        $category = $this->loadCategory(11);
        $this->assertEquals(6, $category->getPosition(), 'Category 11 position must decrease after Category 9 moved');
        $category = $this->loadCategory(6);
        $this->assertEquals(2, $category->getPosition(), 'Category 6 position must be the same');

        //move category 11 to new parent 6 with afterCategoryId = 9
        $category = $this->loadCategory(11);
        $category->move(6, 9);
        $category = $this->loadCategory(11);
        $this->assertEquals(2, $category->getPosition(), 'Category 11 position must be after category 9');
        $category = $this->loadCategory(10);
        $this->assertEquals(5, $category->getPosition(), 'Category 10 position must be the same');
        $category = $this->loadCategory(9);
        $this->assertEquals(1, $category->getPosition(), 'Category 9 position must be 1');
    }

    public function testMove()
    {
        $this->_model->load(7);
        $this->assertEquals(2, $this->_model->getParentId());
        $this->_model->move(6, 0);
        /* load is not enough to reset category data */
        $this->_model->setData([]);
        $this->_model->load(7);
        $this->assertEquals(6, $this->_model->getParentId());
    }

    /**
     * @expectedException \Magento\Framework\Exception\LocalizedException
     */
    public function testMoveWrongParent()
    {
        $this->_model->load(7);
        $this->_model->move(100, 0);
    }

    /**
     * @expectedException \Magento\Framework\Exception\LocalizedException
     */
    public function testMoveWrongId()
    {
        $this->_model->move(100, 0);
    }

    /**
     * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php
     * @magentoAppIsolation enabled
     */
    public function testGetUrlPath()
    {
        $this->assertNull($this->_model->getUrlPath());
        $this->_model->load(4);
        $this->assertEquals('category-1/category-1-1', $this->_model->getUrlPath());
    }

    public function testGetParentId()
    {
        $this->assertEquals(0, $this->_model->getParentId());
        $this->_model->unsetData();
        $this->_model->load(4);
        $this->assertEquals(3, $this->_model->getParentId());
    }

    public function testGetParentIds()
    {
        $this->assertEquals([], $this->_model->getParentIds());
        $this->_model->unsetData();
        $this->_model->load(4);
        $this->assertContains(3, $this->_model->getParentIds());
        $this->assertNotContains(4, $this->_model->getParentIds());
    }

    public function testGetChildren()
    {
        $this->_model->load(3);
        $this->assertEquals('4,13', $this->_model->getChildren());
    }

    public function testGetPathInStore()
    {
        $this->_model->load(5);
        $this->assertEquals('5,4,3', $this->_model->getPathInStore());
    }

    public function testGetAllChildren()
    {
        $this->_model->load(4);
        $this->assertEquals('4,5', $this->_model->getAllChildren());
        $this->_model->load(5);
        $this->assertEquals('5', $this->_model->getAllChildren());
    }

    public function testGetPathIds()
    {
        $this->assertEquals([''], $this->_model->getPathIds());
        $this->_model->setPathIds([1]);
        $this->assertEquals([1], $this->_model->getPathIds());

        $this->_model->unsetData();
        $this->_model->setPath('1/2/3');
        $this->assertEquals([1, 2, 3], $this->_model->getPathIds());
    }

    public function testGetLevel()
    {
        $this->assertEquals(0, $this->_model->getLevel());
        $this->_model->setData('level', 1);
        $this->assertEquals(1, $this->_model->getLevel());
    }

    public function testGetAnchorsAbove()
    {
        $this->_model->load(4);
        $this->assertContains(3, $this->_model->getAnchorsAbove());
        $this->_model->load(5);
        $this->assertContains(4, $this->_model->getAnchorsAbove());
    }

    public function testGetParentCategories()
    {
        $this->_model->load(5);
        $parents = $this->_model->getParentCategories();
        $this->assertEquals(3, count($parents));
    }

    public function testGetParentCategoriesEmpty()
    {
        $this->_model->load(1);
        $parents = $this->_model->getParentCategories();
        $this->assertEquals(0, count($parents));
    }

    public function testGetChildrenCategories()
    {
        $this->_model->load(3);
        $children = $this->_model->getChildrenCategories();
        $this->assertEquals(2, count($children));
    }

    public function testGetChildrenCategoriesEmpty()
    {
        $this->_model->load(5);
        $children = $this->_model->getChildrenCategories();
        $this->assertEquals(0, count($children));
    }

    public function testGetParentDesignCategory()
    {
        $this->_model->load(5);
        $parent = $this->_model->getParentDesignCategory();
        $this->assertEquals(5, $parent->getId());
    }

    public function testIsInRootCategoryList()
    {
        $this->assertFalse($this->_model->isInRootCategoryList());
        $this->_model->unsetData();
        $this->_model->load(3);
        $this->assertTrue($this->_model->isInRootCategoryList());
    }
}


text:
var story = {
  "A001": {
    "title": "Échappez-vous ! ",
    "description": "Vous avez moins de 24 heures pour trouver un cadeau pour votre petite amie ! Il faut que vous réussissiez à vous échapper !",
    "conseq_ref": [
      [
        "A002",
        "Vous tentez de distraire votre petite amie en lui faisant croire qu'un OVNI vole derrière elle, tentez de fuir vers un fleuriste",
        "fleuriste"
      ],
      [
        "A003",
        ""Oh regarde ! James Blunt !" *tenter de fuir vers un bar*",
        "bar"
      ]
    ]
  },
  "A002": {
    "title": "Bien tenté...",
    "description": "Malheureusement votre technique subtile n'a pas eu d'emprise sur votre dulcinée...",
    "conseq_ref": [
      [
        "A001",
        "Réessayer",
        ""
      ]
    ]
  },
  "A003": {
    "title": "Prenez vos repères !",
    "description": "Votre audacieux stratagème a fonctionné. Cependant, il vous faut une idée de cadeau pour votre petite amie. Vous décider de chercher de l'aide, en vous inspirant d'entités supérieures possédant ces connaissances perdues.",
    "conseq_ref": [
      [
        "A004",
        "Vous décidez de consulter un magazine féminin, et vous dirigez donc vers un kiosque à journaux.",
        "kiosque"
      ],
      [
        "A005",
        "Seule une voyante peut vous renseigner sur des sujets si obscurs, et vous décidez de retrouver Irma, au commissariat.",
        "commissariat"
      ]
    ]
  },
  "A004": {
    "title": "Une lecture instructive",
    "description": "Vous devez choisir quel magazine vous choisissez pour vous aider",
    "conseq_ref": [
      [
        "A006",
        "Vous choisissez d'acheter fémina, qui vous conseille de vous rendre à une bijouterie.",
        "kiosque"
      ],
      [
        "A007",
        "Vous préférez lire Dragon Ball Z",
        "kiosque"
      ]
    ]
  },
  "A005": {
    "title": "Une voyante lucide",
    "description": "Après\n avoir retrouvé Madame Irma au commisariat, celle ci vous prédit votre \navenir et vous envoie directement vers une bijouterie qu'elle a vue dans\n une de ses visions.",
    "conseq_ref": [
      [
        "A006",
        "Vous vous rendez directement à la bijouterie. Les voyantes ont toujours raison.",
        "bijouterie"
      ]
    ]
  },
  "A006": {
    "title": "Tomber à pic",
    "description": "Vous\n croisez votre patron dans la rue avant d'atteindre la bijouterie. \nCelui-ci, surpris de vous voir, vous annonce qu'il tente à tous prix \nd'échapper à sa femme. Il vous demande de l'aider.",
    "conseq_ref": [
      [
        "A008",
        "Vous refusez et tentez tout de même de fuir vers la bijouterie",
        "bijouterie"
      ],
      [
        "A009",
        "Vous\n acceptez de l'aider. Par réflexe, votre patron vous demande un café, \npuis de finir 3 dossiers en retard et aussi d'aller faire ses courses.",
        "café"
      ]
    ]
  },
  "A007": {
    "title": "It's over 9000 !",
    "description": "Après\n avoir lu l'intégralité des dragon ball Z, vous reprenez conscience de \nvotre environnement, et croisez avec stupeur le regard de votre petite \namie, qui vous attend devant le kiosque. Elle vous fait comprendre qu'il\n est temps de retourner aller faire du shopping….",
    "conseq_ref": [
      [
        "A001",
        "Vous posez gentillement votre manga, et suivez votre petite amie…",
        "kiosque"
      ]
    ]
  },
  "A008": {
    "title": "Juste une !",
    "description": "Pendant votre fuite, vous croisez vos amis, qui se dirigent vers un bar. Ils vous proposent de les accompagner.",
    "conseq_ref": [
      [
        "A010",
        "Vous préférez tout de même accomplir votre quête en priorité, et vous continuez votre route pour la bijouterie",
        "bijouterie"
      ],
      [
        "A011",
        "Après tout, une petite bière pour la route, ca ne fait pas de mal ! Vous vous dirigez vers le bar le plus proche avec vos amis.",
        "bar"
      ]
    ]
  }
};


text:
from flask import g, redirect, url_for
from functools import wraps

from models import Course, Assignment, Submission, Presentation

def get_current_course(kwargs):
    course = None
    if 'course_id' in kwargs:
        course = Course.query.get(kwargs.get('course_id'))
    elif 'assignment_id' in kwargs:
        course = Assignment.query.get(kwargs.get('assignment_id')).course
    elif 'submission_id' in kwargs:
        course = Submission.query.get(kwargs.get('submission_id')).assignment.course
    elif 'presentation_id' in kwargs:
        course = Presentation.query.get(kwargs.get('presentation_id')).course
    return course

def admin_required(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        if g.user.is_admin():
            return f(*args, **kwargs)
        else:
            return redirect(url_for('home'))
    return wrapper

def instructor_required(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        course = get_current_course(kwargs)
        if g.user.is_instructor_for(course):
            return f(*args, **kwargs)
        else:
            return redirect(url_for('home'))
    return wrapper

def course_membership_required(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        course = get_current_course(kwargs)
        if g.user.is_part_of(course):
            return f(*args, **kwargs)
        else:
            return redirect(url_for('home'))
    return wrapper


text:
package org.wildfly.swarm.microprofile.health;

import org.eclipse.microprofile.health.HealthCheckResponseBuilder;
import org.eclipse.microprofile.health.spi.HealthCheckResponseProvider;

/**
 * Created by hbraun on 07.07.17.
 */
public class HealthResponseProvider implements HealthCheckResponseProvider {
    @Override
    public HealthCheckResponseBuilder createResponseBuilder() {
        return new BuilderImpl();
    }
}


text:
sap.ui.define(['jquery.sap.global', './ListItemBaseRenderer', 'sap/ui/core/Renderer'],
	function(jQuery, ListItemBaseRenderer, Renderer) {
	"use strict";

	/**
	 * TreeItemBaseRenderer renderer.
	 * @namespace
	 */
	var TreeItemBaseRenderer = Renderer.extend(ListItemBaseRenderer);

	TreeItemBaseRenderer.renderLIAttributes = function(rm, oLI) {
		rm.addClass("sapMTreeItemBase");

		if (!oLI.isTopLevel()) {
			rm.addClass("sapMTreeItemBaseChildren");
		}

		var iIndentation = oLI._getPadding();
		if (sap.ui.getCore().getConfiguration().getRTL()){
			rm.addStyle("padding-right", iIndentation + "rem");
		} else {
			rm.addStyle("padding-left", iIndentation + "rem");
		}

	};

	TreeItemBaseRenderer.renderContentFormer = function(rm, oLI) {
		this.renderHighlight(rm, oLI);
		this.renderExpander(rm, oLI);
		this.renderMode(rm, oLI, -1);
	};

	TreeItemBaseRenderer.renderExpander = function(rm, oLI) {
		var oExpander = oLI._getExpanderControl();
		if (oExpander) {
			rm.renderControl(oExpander);
		}
	};

	/**
	 * Returns the ARIA accessibility role.
	 *
	 * @param {sap.ui.core.Control} oLI An object representation of the control
	 * @returns {String}
	 * @protected
	 */
	TreeItemBaseRenderer.getAriaRole = function(oLI) {
		return "treeitem";
	};

	TreeItemBaseRenderer.getAccessibilityState = function(oLI) {
		var mAccessibilityState = ListItemBaseRenderer.getAccessibilityState.call(this, oLI);

		mAccessibilityState.level = oLI.getLevel() + 1;
		if (!oLI.isLeaf()) {
			mAccessibilityState.expanded = oLI.getExpanded();
		}

		return mAccessibilityState;
	};

	return TreeItemBaseRenderer;

}, /* bExport= */ true);


text:
import sys

# third party
import numpy as np

# syft absolute
import syft as sy
from syft.core.adp.data_subject_list import DataSubjectArray

# relative
from .utils import download_dataset
from .utils import split_and_preprocess_dataset

def add_dataset_to_domain(domain_ip, dataset_url):

    # Need to run update_syft.sh on every domain
    #         sshpass -p MflpTeamOne@31052022 ssh azureuser@20.253.155.189 update_syft.sh

    # Log into domain
    domain = sy.login(email="info@openmined.org", password="changethis", url=domain_ip)

    # Preprocess dataset split
    dataset = download_dataset(dataset_url)
    train, val, test = split_and_preprocess_dataset(data=dataset)

    data_subjects_image = np.ones(train["images"].shape).astype(object)
    for i, patient in enumerate(train["patient_ids"]):
        data_subjects_image[i] = DataSubjectArray([str(patient)])

    data_subjects_labels = np.ones(train["labels"].shape).astype(object)
    for i, patient in enumerate(train["patient_ids"]):
        data_subjects_labels[i] = DataSubjectArray([str(patient)])

    train_image_data = sy.Tensor(train["images"]).annotate_with_dp_metadata(
        min_val=0, max_val=255, data_subjects=data_subjects_image
    )
    train_label_data = sy.Tensor(train["labels"]).annotate_with_dp_metadata(
        min_val=0, max_val=1, data_subjects=data_subjects_labels
    )

    # Load dataset
    domain.load_dataset(
        name="BreastCancerDataset",
        assets={
            "train_images": train_image_data[:5],
            "train_labels": train_label_data[:5],
        },
        description="Invasive Ductal Carcinoma (IDC) is the most common subtype of all breast cancers. \
            The modified dataset consisted of 162 whole mount slide images of Breast Cancer (BCa) specimens \
            scanned at 40x.Patches of size 50 x 50 were extracted from the original image. \
            The labels 0 is non-IDC and 1 is IDC.",
    )
    try:
        domain.create_user(
            name="Sam Carter",
            email="sam@stargate.net",
            password="changethis",
            budget=9999,
        )
    except Exception as e:
        print(e)

if __name__ == "__main__":
    domain_ip, dataset_url = sys.argv[1], sys.argv[2]
    add_dataset_to_domain(domain_ip, dataset_url.strip("\r"))
    print("Finished Uploading dataset")


text:
namespace gl
{

////// FramebufferAttachment::Target Implementation //////

FramebufferAttachment::Target::Target(GLenum binding, const ImageIndex &imageIndex)
    : mBinding(binding),
      mTextureIndex(imageIndex)
{
}

FramebufferAttachment::Target::Target(const Target &other)
    : mBinding(other.mBinding),
      mTextureIndex(other.mTextureIndex)
{
}

FramebufferAttachment::Target &FramebufferAttachment::Target::operator=(const Target &other)
{
    this->mBinding = other.mBinding;
    this->mTextureIndex = other.mTextureIndex;
    return *this;
}

////// FramebufferAttachment Implementation //////

FramebufferAttachment::FramebufferAttachment()
    : mType(GL_NONE),
      mTarget(GL_NONE, ImageIndex::MakeInvalid())
{
}

FramebufferAttachment::FramebufferAttachment(GLenum type,
                                             GLenum binding,
                                             const ImageIndex &textureIndex,
                                             FramebufferAttachmentObject *resource)
    : mType(type),
      mTarget(binding, textureIndex)
{
    mResource.set(resource);
}

void FramebufferAttachment::detach()
{
    mType = GL_NONE;
    mResource.set(nullptr);

    // not technically necessary, could omit for performance
    mTarget = Target(GL_NONE, ImageIndex::MakeInvalid());
}

void FramebufferAttachment::attach(GLenum type,
                                   GLenum binding,
                                   const ImageIndex &textureIndex,
                                   FramebufferAttachmentObject *resource)
{
    mType = type;
    mTarget = Target(binding, textureIndex);
    mResource.set(resource);
}

FramebufferAttachment::~FramebufferAttachment()
{
    mResource.set(nullptr);
}

GLuint FramebufferAttachment::getRedSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).redBits;
}

GLuint FramebufferAttachment::getGreenSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).greenBits;
}

GLuint FramebufferAttachment::getBlueSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).blueBits;
}

GLuint FramebufferAttachment::getAlphaSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).alphaBits;
}

GLuint FramebufferAttachment::getDepthSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).depthBits;
}

GLuint FramebufferAttachment::getStencilSize() const
{
    return GetInternalFormatInfo(getInternalFormat()).stencilBits;
}

GLenum FramebufferAttachment::getComponentType() const
{
    return GetInternalFormatInfo(getInternalFormat()).componentType;
}

GLenum FramebufferAttachment::getColorEncoding() const
{
    return GetInternalFormatInfo(getInternalFormat()).colorEncoding;
}

const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
{
    ASSERT(type() == GL_TEXTURE);
    return mTarget.textureIndex();
}

GLenum FramebufferAttachment::cubeMapFace() const
{
    ASSERT(mType == GL_TEXTURE);

    const auto &index = mTarget.textureIndex();
    return IsCubeMapTextureTarget(index.type) ? index.type : GL_NONE;
}

GLint FramebufferAttachment::mipLevel() const
{
    ASSERT(type() == GL_TEXTURE);
    return mTarget.textureIndex().mipIndex;
}

GLint FramebufferAttachment::layer() const
{
    ASSERT(mType == GL_TEXTURE);

    const auto &index = mTarget.textureIndex();

    if (index.type == GL_TEXTURE_2D_ARRAY || index.type == GL_TEXTURE_3D)
    {
        return index.layerIndex;
    }
    return 0;
}

Texture *FramebufferAttachment::getTexture() const
{
    return rx::GetAs<Texture>(mResource.get());
}

Renderbuffer *FramebufferAttachment::getRenderbuffer() const
{
    return rx::GetAs<Renderbuffer>(mResource.get());
}

const egl::Surface *FramebufferAttachment::getSurface() const
{
    return rx::GetAs<egl::Surface>(mResource.get());
}

}


text:
package ghpages.pages

import scalaz.Equal
import scalaz.syntax.equal._
import japgolly.scalajs.react._, vdom.prefix_<^._
import japgolly.scalajs.react.extra._
import japgolly.scalajs.react.extra.router2.{RouterConfigDsl, RouterCtl}
import ghpages.examples._

sealed abstract class Example(val title: String,
                              val routerPath: String,
                              val render: () => ReactElement)

object Example {
  import ghpages.examples.util._
  implicit private def auto1(v: SideBySide.Content): () => ReactElement = () => v()
  implicit private def auto2(v: SingleSide.Content): () => ReactElement = () => v()

  case object Hello        extends Example("Hello World",        "hello",            HelloMessageExample .content)
  case object Timer        extends Example("Timer",              "timer",            TimerExample        .content)
  case object Todo         extends Example(TodoExample.title,    "todo",             TodoExample         .content)
  case object StateMonad   extends Example("State monads",       "state-monad",      StateMonadExample   .content)
  case object Refs         extends Example("Refs",               "refs",             RefsExample         .content)
  case object ProductTable extends Example("Product Table",      "product-table",    ProductTableExample .content)
  case object Animation    extends Example("Animation",          "animation",        AnimationExample    .content)
  case object PictureApp   extends Example("AjaxPictureApp",     "ajax-picture-app", PictureAppExample   .content)
  case object Touch        extends Example("Touch events",       "touch-events",     TouchExample        .content)
  case object ExternalVar  extends Example("ExternalVar",        "external-var",     ExternalVarExample  .content)
  case object Reuse        extends Example("Reusability",        "reusability",      ReuseExample        .content)
  case object EventListen  extends Example("EventListener",      "event-listener",   EventListenerExample.content)

  implicit val equality   : Equal[Example]       = Equal.equalA
  implicit val reusability: Reusability[Example] = Reusability.byEqual

  val values = Vector[Example](
    Hello, Timer, Todo, Refs, ProductTable, Animation, // Ported ReactJS examples
    EventListen, ExternalVar, Reuse, StateMonad,       // Scala only examples
    Touch, PictureApp)                                 // General usage

  def default: Example =
    values.head

  def routes = RouterConfigDsl[Example].buildRule { dsl =>
    import dsl._
    import ExamplesPage._
    values.map(e =>
      staticRoute(e.routerPath, e) ~> renderR(r => component(Props(e, r)))
    ).reduce(_ | _)
  }
}

// =====================================================================================================================

object ExamplesPage {

  case class Props(current: Example, router: RouterCtl[Example])

  implicit val propsReuse = Reusability.caseClass[Props]

  val menu = ReactComponentB[Props]("Example menu")
    .render { p =>
      def menuItem(e: Example) = {
        val active = e === p.current
        <.li(
          ^.classSet1("list-group-item", "active" -> active),
          p.router setOnClick e,
          e.title)
      }
      <.div(^.cls := "col-md-2",
        <.ul(^.cls := "list-group",
          Example.values map menuItem))
    }
    .configure(Reusability.shouldComponentUpdate)
    .build

  val body = ReactComponentB[Example]("Example body")
    .render(eg =>
      <.div(
        ^.cls := "col-md-10",
        eg.render()))
    .build

  val component = ReactComponentB[Props]("Examples")
    .render(p =>
      <.div(^.cls := "row",
        menu(p),
        body(p.current))
    ).build
}


text:
use VipunenTK_DW
go

DROP TABLE VipunenTK_DW.dbo._sa_K3_10_Tutk_suor_osuus_aloittaneista_korkeakoulut_surrogaattiavaimet

Select top 0 * into VipunenTK_DW.dbo._sa_K3_10_Tutk_suor_osuus_aloittaneista_korkeakoulut_surrogaattiavaimet
from VipunenTK_DW.dbo._v_sa_K3_10_Tutk_suor_osuus_aloittaneista_korkeakoulut_surrogaattiavaimet_nykytila_taulusta


text:
<?php

namespace GW2Treasures\GW2Api\V2\Endpoint\Quaggan;

use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;

class QuagganEndpoint extends Endpoint implements IBulkEndpoint {
    use BulkEndpoint;

    /**
     * {@inheritdoc}
     */
    public function url() {
        return 'v2/quaggans';
    }
}


text:
from stream_framework.aggregators.base import RecentVerbAggregator
from stream_framework.tests.utils import FakeActivity
from stream_framework.verbs.base import Love as LoveVerb, Add as AddVerb
import datetime
import unittest

class AggregatorTest(unittest.TestCase):
    aggregator_class = None

    def setUp(self):
        id_seq = list(range(42, 999))
        if self.aggregator_class is None:
            return

        self.user_id = 42
        self.activity = FakeActivity(
            1, LoveVerb, 1, 1, datetime.datetime.now(), {})
        self.activities = []
        for x in range(2, 12):
            activity_time = datetime.datetime.now()
            find = x > 5
            activity = FakeActivity(
                x, LoveVerb, id_seq.pop(), x, activity_time, dict(find=find))
            self.activities.append(activity)
        self.add_activities = []
        for x in range(13, 38):
            activity_time = datetime.datetime.now() + datetime.timedelta(
                seconds=x)
            activity = FakeActivity(
                x, AddVerb, id_seq.pop(), x, activity_time, dict(x=x))
            self.add_activities.append(activity)
        self.aggregator = self.aggregator_class()

class RecentVerbAggregatorTest(AggregatorTest):
    aggregator_class = RecentVerbAggregator

    def test_aggregate(self):
        '''
        Verify that all the activities with the same verb and date are stuck
        together
        '''
        assert len(self.activities) == 10
        assert len(self.add_activities) == 25
        activities = self.activities + self.add_activities
        aggregated = self.aggregator.aggregate(activities)
        assert len(aggregated) == 2
        assert len(aggregated[0].activities) == 15
        assert len(aggregated[1].activities) == 10

    def test_empty_merge(self):
        activities = self.activities + self.add_activities
        new, changed, deleted = self.aggregator.merge([], activities)
        assert len(new) == 2
        assert len(new[0].activities) == 15
        assert len(new[1].activities) == 10

    def test_merge(self):
        first = self.aggregator.aggregate(self.activities[:5])
        new, changed, deleted = self.aggregator.merge(
            first, self.activities[5:])
        assert new == []

        old, updated = changed[0]
        assert len(old.activities) == 5
        assert len(updated.activities) == 10


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title><?= $this->section('title'); ?></title>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="codeburrow, web, software, development, design, startup">
    <meta name="description" content="">

    <link rel="shortcut icon" href="/img/logo_trans.png">

<?= $this->section('content') ?>

CodeBurrow

Copyright © 2016 CodeBurrow

                    | Back To: Top


text:
__author__ = 'ajtag'

import random
from collections import namedtuple
import logging

import pygame
from pygame.math import Vector2

from Constants import *
from utils import *
import sys
import platform
import Renderer
import math

log = logging.getLogger()
logging.basicConfig()
log.setLevel(logging.INFO)

Thread = namedtuple('Thread', ('start', 'direction', 'hue', 'width', 'age'))

class Whizz():
    def __init__(self, threadcount):
        self.rect = pygame.Rect((0, 0), MADRIX_SIZE)
        self.threadcount = 20
        self.threadrate_init = 5
        self.threadrate = 0
        self.image = pygame.Surface(MADRIX_SIZE, pygame.SRCALPHA)
        self.ticks = 0
        self.max_age = 50
        self.speed = self.max_age/200
        self.threads = []

    def draw(self, s):
        s.blit(self.image, (0, 0))

    def move_threads(self):
        self.ticks += 1
        if len(self.threads) < self.threadcount:
            if self.threadrate > 0:
                self.threadrate = self.threadrate - 1
            else:
                self.threadrate = self.threadrate_init
                # find a vector not in the roof
                start = Vector2(65, 51)

                offset = Vector2(0, 0)
                offset.from_polar((MADRIX_X/2, random.randrange(360)))
                start = start + offset
                offset.scale_to_length(random.randint(3, 9))
                direction = offset.rotate(random.randrange(-5, 5))

                width = random.random() * 3
                hue = (random.randrange(30) + self.ticks) % 360
                t = Thread(start, direction, hue, width, 0)
                log.debug(('add', t))
                self.threads.append(t)

    def update(self):
        self.move_threads()

        self.image.fill((0, 0, 0, 0))
        px = pygame.PixelArray(self.image)

        new_threads = []

    def draw_by_pixel(self):
        px = pygame.PixelArray(self.image)
        for lamp in ceiling.lamps:
        #for i in range(MADRIX_X):
        #    for j in range(MADRIX_Y):

                p = Vector2(lamp)

                if p.distance_to()

        del px

    def draw_by_thread(self):
        for threadi in self.threads:

            # update location
            new_start = threadi.start - threadi.direction
            new_age = threadi.age + 1
            new_direction = threadi.direction.rotate(0)
            if new_age > self.max_age:
                log.debug(('del', threadi, new_start))
                continue

            thread = Thread(new_start, new_direction, threadi.hue, threadi.width, new_age)
            new_threads.append(thread)

            # draw onto surface
            for i in range(-int(2*thread.width), round(abs(thread.direction.x)+2*thread.width)):
                if new_start.x + i > self.rect.width + self.rect.left \
                        or new_start.x + i < 0:
                        continue
                for j in range(-int(2*thread.width), round(abs(thread.direction.y)+2*thread.width)):
                    if new_start.y + j > self.rect.height + self.rect.top \
                            or new_start.y + j < 0:
                        continue

                    p = Vector2(i, j)
                    d = dist_Point_to_Segment(p, (Vector2(0, 0), thread.direction))
                    dp = thread.direction.dot(p)
                    a = thread.direction.angle_to(p)
                    point_to_direction = (thread.direction - p).length()

                    if d < thread.width:
                        alpha = 255

                        alpha = alpha * (1-(Vector2(i, j).length_squared()/thread.direction.length_squared()))
                        if abs(a) > 90:
                            if thread.width > point_to_direction:
                                alpha = 0.3/(thread.width-point_to_direction)
                            else:
                                alpha = 0
                        #alpha = alpha * a
                        alpha = alpha * (1-(d / thread.width))

                        # bound alpha to valid values
                        alpha = max(0, min(255, alpha))

                        lightness = min(50*(thread.width/(1+p.distance_to(thread.direction))), 50)
                        log.info(lightness)
                        color = hlsa_to_rgba(threadi.hue, 50 + lightness, 100, alpha)
                        try:
                            px[int(i + new_start.x), int(j + new_start.y)] = self.image.map_rgb(color)
                        except:
                            log.error(thread, color)
                            raise

        self.threads = new_threads
        del px

if __name__ == "__main__":

    logging.getLogger().setLevel(logging.INFO)
    logging.basicConfig()

    args = Renderer.cmd_line_args()

    LN2015 = Renderer.Player('objects', MADRIX_X, MADRIX_Y, fps=24, args=args)

    LN2015.load_sprite("whizz", 50, Whizz(5))

    alive = True
    while alive:
        alive = LN2015.run()

        if 'windows' in platform.platform().lower():
            ffmpeg_exe = 'C:\\Users\\admin\\Desktop\\ffmpeg-20150921-git-74e4948-win64-static\\bin\\ffmpeg.exe'
        else:
            ffmpeg_exe = 'ffmpeg'

    LN2015.export_video(ffmpeg_exe)
    LN2015.end()
sys.exit()


text:
namespace PS {

class LearningRate {
 public:
  void set(const LearningRateConfig& cf) { cf_ = cf; }
  double evaluate(int t) {
    typedef LearningRateConfig Type;
    if (cf_.type() == Type:CONSTANT) {
      return cf_.eta();
    }
    return 1.0;
  }
 private:
  LearningRateConfig cf_;
};

} // namespace PS