text:
import math

from naoth.math import Vector2 as Vec
from naoth.math import LineSegment

from actions import Actions
from state import State

class Field():
    """
    the field class gives represents the soccer field

    this class is going to be the component on which world and referee operate

    thus we include functions to check weather the ball in in the field, in one goal,
    outside the field etc.

    """

    def __init__(self):
        self.width = 9000
        self.height = 6000
        self.center_point = Vec(0, 0)
        self.opp_goal_line = LineSegment(Vec(4500, 750), Vec(4500, 750))
        self.own_goal_line = LineSegment(Vec(-4500, 750), Vec(-4500, -750))

    def in_onw_goal(self, object1, object2=None):
        """
        detects weather the is / went trough in the own goal
        :param object: m2d Vector2
        :return: boolean
        """
        ball_trajectory = self.get_ball_trajectory(object1, object2)

        if object2 is None or ball_trajectory is None:
            # ball trajectory is none, if the two points are less than 1 cm apart
            return (object1.x < -4500 and (-750 < object1.y < 750))
        in_goal = self.own_goal_line.intersection(ball_trajectory) and \
                  ball_trajectory.intersection(self.own_goal_line)
        if in_goal == float('inf'):
            in_goal = 0
        return in_goal

    def in_opp_goal(self, object1, object2=None):
        """
        detects weather the ball is / went trough in the opponents goal
        :param object: m2d Vector2
        :return: boolean
        """
        ball_trajectory = self.get_ball_trajectory(object1, object2)

        if object2 is None or ball_trajectory is None:
            # ball trajectory is none, if the two points are less than 1 cm apart
            return (object1.x > 4500 and (-750 < object1.y < 750))
        in_goal = self.opp_goal_line.intersection(ball_trajectory) and \
                  ball_trajectory.intersection(self.opp_goal_line)
        if in_goal == float('inf'):
            in_goal = 0
        return in_goal  # TODO: VERY IMPORTANT !!!! CHECK IF BOTH LINES HAVE INTERSECTION ON THEIR LINE SEGMENT

    def in_field(self, object):
        """
        detects weather the object is in the field
        :param object: m2d Vector2
        :return: boolean
        """
        return ((-4500 <= object.x <= 4500) and (-3000 <= object.y <= 3000))

    def get_ball_trajectory(self, player, ball):
        """

        :param ball: math2d Vector2 object
        :param player: math2d Vector2 object
        :return: return line segment
        """
        if (ball - player).abs() <= 100:
            return None  # if distance of the player and ball are to small, return nothing
        return LineSegment(player, ball)

class Rules(Field):
    """
    the rules class checks ball positions and manipulates the ball according to the
    RoboCup Standard Platform League - rules

    this implementation is going to be rather naive and not complete
    """

    def apply_rules(self, ball, player=None):
        """
        applies all robo cup rules

        :param ball: m2d Vector2 object
        :param player: m2d Vector2 object - player who most recently touched the ball
        :return: m2d Vector2 object, 'new' ball position
        """

    def ball_in_goal(self, ball, player):
        if self.in_own_goal(ball) or self.in_opp_goal(ball):
            ball = self.center_point

    def ball_out(self, ball, player=None):
        if not (self.in_field(ball) or self.ball_in_goal(ball)):
            self.throw_in(ball)

    def throw_in(self, ball, player=None):
        """
        Throw-in rules:
            Throw-in line:  400mm into the field from side lines
                            7000mm long (from (-3500,-2600) to (3500,-2600) &
                                            (-3500, 2600) to (3500, 2600) )

                - ball placed on throw-in line on the same side
                - paces farthest back of one of these options:
                    * 1000mm back form the robot
                    * 1000mm back from the point where it went out
                    * always placed on the throw-in line

            End-line:
                - if last touched by defensive team
                    -> placed at closed endpoint of throw-in line
                - if last touched by offensive team
                    -> placed on the throw-in line on the farthes back of these positions:
                        * 1000mm back from last touched robot
                        * at the intersection of halfway and throw-in line (0, -2600) or (0, 2600)

        :param ball: ball position (x,y) coordinates
        :param player: player position (x,y) coordinates
        :return: new ball position (x,y) coordinates
        """
        sides = ['lower', 'upper']
        new_ball = Vec()
        if not (self.in_field(ball) or self.in_onw_goal(ball, player) or self.in_opp_goal(ball,
                                                                                player)):
            if player is not None:
                side = sides[ball.y > 0]
                ## here we always asume that there is only one player thus we know who touched the ball at last
                ### the opponent goal is on the right, the own goal on the left side
                # TODO: add team / side recognition
                # TODO: could be done with trajectories as in the goal methods
                # first case: ball went out crossing a sideline
                if -4500 < ball.x < 4500:
                    if ball.x <= player.x:
                        # take option which places the ball the furthest back
                        new_ball.x = (ball.x - 1000)
                    else:
                        new_ball.x = (player.x - 1000)
                    if new_ball.x > 3500:
                        new_ball.x = 3500
                    if new_ball.x < -3500:
                        new_ball.x = -3500
                # second case: ball went out crossing the end-line
                if ball.x > 4500:
                    if player.x - 1000 < 0:
                        new_ball.x = 0
                    else:
                        new_ball.x = player.x - 1000
                if ball.x < -4500:
                    new_ball.x = -3500

                if side == 'upper':  # set on upper or lower throw-in line
                    new_ball.y = 2600
                else:
                    new_ball.y = -2600

            # TODO: if player is None fall einfuegen // Noetig??

            ball = new_ball  # set new_ball as ball otherwise just return the ball position
        return ball

class World:
    """
    wrapper class with which the simulator interacts
    """

    def __init__(self):
        # self.current_state = initial_state
        self.last_action = None
        self.actions = Actions(add_noise=True)
        self.Rules = Rules()

    def do_action(self, given_state, chosen_action):
        action_list = self.actions.get_actions()
        action_list[chosen_action](given_state)
        self.last_action = chosen_action

    def set_robot_position_to_ball_position(self, given_state):
        if given_state.position != given_state.ball_position:  # just set if position don't not equal
            # (otherwise rotation action could get lost
            given_state.direction = (given_state.ball_position - given_state.position).normalize()
            # robot orientation (direction) is the direction of the shortest path to the ball
            given_state.position = given_state.ball_position
            # new position is equal to ball position

if __name__ == "__main__":
    """
    GameRules = Rules()
    new_ball = GameRules.throw_in(Vec(-2000,2000),Vec(-1000,2000))
    print(new_ball)
    GameActions = Actions()
    new_state = State()
    print new_state.direction
    GameActions.turn_right_45(new_state)
    print new_state.direction
    print new_state.ball_position
    GameActions.sidekick_right(new_state)
    #GameActions.sidekick_right(new_state)
    print new_state.ball_position
    GameActions.sidekick_left(new_state)
    print new_state.ball_position
    GameActions.kick_short(new_state)
    print new_state.ball_position
    """

    simWorld = World()
    for i in range(0, 5):
        print
        "Action: " + str(i)
        print
        "before:"
        new_state = State()
        print
        "Ball Position:"
        print
        new_state.ball_position
        print
        "Position:"
        print
        new_state.position
        print
        "Direction"
        print
        new_state.direction
        print
        "++++++++"
        simWorld.do_action(new_state, i)
        print
        "after kick"
        print
        "Ball Position:"
        print
        new_state.ball_position
        print
        "Position:"
        print
        new_state.position
        print
        "Direction"
        print
        new_state.direction
        print
        "++++++++"
        simWorld.set_robot_position_to_ball_position(new_state)
        print
        "after resetting position"
        print
        "Ball Position:"
        print
        new_state.ball_position
        print
        "Position:"
        print
        new_state.position
        print
        "Direction"
        print
        new_state.direction
        print
        "------------------"


text:
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { TemplateService } from '../../../core/api-services/template.service';
import { Template } from '../../../shared/models';

@Component({
  templateUrl: './list.component.html',
  styleUrls: ['./list.component.scss'],
})
export class ListComponent implements OnInit {

  displayedColumns = ['name', 'action'];
  templatesData: MatTableDataSource<Template>;

  @ViewChild(MatSort, { static: true }) sort: MatSort;
  @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;

  constructor(private templateService: TemplateService,
              private router: Router) {
  }

  async ngOnInit() {
    const templates = await this.templateService.getAll();
    this.templatesData = new MatTableDataSource(templates);
    this.templatesData.paginator = this.paginator;
    this.templatesData.sort = this.sort;
  }

  applyFilter(filterValue: string): void {
    this.templatesData.filter = filterValue.trim().toLowerCase();
  }

  view(template: Template): void {
    this.router.navigate(['/services/templates', template.id]);
  }

  edit(template: Template): void {
    this.router.navigate(['/services/templates', template.id, 'edit']);
  }

}

redpajama_set_name: RedPajamaGithub


text:
using System.Linq.Expressions;
using Remotion.Linq.Parsing.ExpressionTreeVisitors;
using Remotion.Linq.Utilities;

namespace Remotion.Linq.Parsing.Structure.IntermediateModel
{
  /// <summary>
  /// Resolves an expression using <see cref="IExpressionNode.Resolve"/>, removing transparent identifiers and detecting subqueries
  /// in the process. This is used by methods such as <see cref="SelectExpressionNode.GetResolvedSelector"/>, which are
  /// used when a clause is created from an <see cref="IExpressionNode"/>.
  /// </summary>
  public class ExpressionResolver
  {
    public ExpressionResolver (IExpressionNode currentNode)
    {
      ArgumentUtility.CheckNotNull ("currentNode", currentNode);

      CurrentNode = currentNode;
    }

    public IExpressionNode CurrentNode { get; set; }

    public Expression GetResolvedExpression (
        Expression unresolvedExpression, ParameterExpression parameterToBeResolved, ClauseGenerationContext clauseGenerationContext)
    {
      ArgumentUtility.CheckNotNull ("unresolvedExpression", unresolvedExpression);
      ArgumentUtility.CheckNotNull ("parameterToBeResolved", parameterToBeResolved);

      var sourceNode = CurrentNode.Source;
      var resolvedExpression = sourceNode.Resolve (parameterToBeResolved, unresolvedExpression, clauseGenerationContext);
      resolvedExpression = TransparentIdentifierRemovingExpressionTreeVisitor.ReplaceTransparentIdentifiers (resolvedExpression);
      return resolvedExpression;
    }
  }
}


text:
Portafolio para chica

## Base de datos
### 2016-11-28 [added]
- Se agrego el campo "txt_titulo" a la tabla "ent_elementos"
- Alimentación de tabla "cat_categorias"
- Creación de tabla "ent_elementos"
- Creación de tabla "sub_categorias"
- Creación de tabla "cat_categorias"
- Creación de base de datos

### 2016-08-19 [changed]

### 2016-08-10 [fixed]

## Frontend (Aplicación web)
### 2016-11-29 [changed]
- Cambio en el modelo EntElementos.
- Cambio en el modelo CatSubCategorias.
- Cambio en el menu de cada vista.
### 2016-11-28 [added]
- Creación de modelo ConstantesWeb
- Creación de modelo EntElementos
- Creación de modelo CatSubCategorias
- Creación de modelo CatCategorias
- Conexion con base de datos
- Vista research creada
- Vista sustaninArt creada
- Vista bio creada
- Vista core creada
- Vista photography creada
- Vista index creada
- Configuración de proyecto yii2
- Creación de proyecto en yii2


text:
Practical Machine Learning Assignment
==========================

## Background

Using devices such as *Jawbone Up*, *Nike* *FuelBand*, and *Fitbit* it is now possible to collect a large amount of data about personal activity relatively inexpensively. These type of devices are part of the quantified self movement – a group of enthusiasts who take measurements about themselves regularly to improve their health, to find patterns in their behavior, or because they are tech geeks. One thing that people regularly do is quantify how much of a particular activity they do, but they rarely quantify how well they do it. In this project, your goal will be to use data from accelerometers on the belt, forearm, arm, and dumbell of 6 participants. They were asked to perform barbell lifts correctly and incorrectly in 5 different ways.
 More information is available from the website [here](http://groupware.les.inf.puc-rio.br/har) (see the section on the Weight Lifting Exercise Dataset).

## Data

The training data for this project are available here:

[http://groupware.les.inf.puc-rio.br/har](https://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv)

The test data are available here:

[http://groupware.les.inf.puc-rio.br/har](https://d396qusza40orc.cloudfront.net/predmachlearn/pml-testing.csv)

The data for this project come from this source: [http://groupware.les.inf.puc-rio.br/har](http://groupware.les.inf.puc-rio.br/har). If you use the document you create for this class for any purpose please cite them as they have been very generous in allowing their data to be used for this kind of assignment.

## Goal

The goal of your project is to predict the manner in which they did the exercise. This is the "classe" variable in the training set. You may use any of the other variables to predict with. You should create a report describing how you built your model, how you used cross validation, what you think the expected out of sample error is, and why you made the choices you did. You will also use your prediction model to predict 20 different test cases.


text:
package http

import (
	"context"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"

	"github.com/GoogleCloudPlatform/ubbagent/sdk"
)

type HttpInterface struct {
	agent *sdk.Agent
	port  int
	mux   http.ServeMux
	srv   *http.Server
}

// NewHttpInterface creates a new agent interface that listens on the given port. The interface
// must be started with a call to ListenAndServe().
func NewHttpInterface(agent *sdk.Agent, port int) *HttpInterface {
	h := &HttpInterface{agent: agent, port: port}
	h.mux.HandleFunc("/report", h.handleAdd)
	h.mux.HandleFunc("/status", h.handleStatus)
	return h
}

func (h *HttpInterface) handleAdd(w http.ResponseWriter, r *http.Request) {
	// TODO(volkman): better error handling (internal vs client errors)
	// TODO(volkman): request logging

	reportData, err := ioutil.ReadAll(r.Body)
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte(err.Error()))
		return
	}

	err = h.agent.AddReportJson(reportData)
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte(err.Error()))
		return
	}

	w.WriteHeader(http.StatusOK)
}

func (h *HttpInterface) handleStatus(w http.ResponseWriter, r *http.Request) {
	text, err := h.agent.GetStatusJson()
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		w.Write([]byte(err.Error()))
	} else {
		w.WriteHeader(http.StatusOK)
		w.Write(text)
	}
}

// Start starts the HttpInterface in the background. It returns an error immediately if background
// starting fails, but otherwise returns nil. The errHandler callback receives any errors returned
// by the underlying call to ListenAndServe(). Note that the background service may fail quickly
// after startup, such as in the case of a port already in use.
func (h *HttpInterface) Start(errHandler func(error)) error {
	if h.srv != nil {
		return errors.New("already started")
	}
	h.srv = &http.Server{Addr: fmt.Sprintf("localhost:%v", h.port), Handler: &h.mux}
	go func() {
		errHandler(h.srv.ListenAndServe())
	}()
	return nil
}

// Shutdown initiates a graceful shutdown of the HttpInterface and blocks until the operation
// finishes.
func (h *HttpInterface) Shutdown() error {
	if h.srv == nil {
		return errors.New("not started")
	}
	err := h.srv.Shutdown(context.Background())
	h.srv = nil
	return err
}