text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class ContextAllVariablesAndValuesProvider
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class ContextAllVariablesAndValuesProvider
   ">
    <meta name="generator" content="docfx 2.56.6.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class ContextAllVariablesAndValuesProvider

Implementation of IGetsAllVariablesFromContext which prefers definitions in the order:

Inheritance

System.Object

ContextAllVariablesAndValuesProvider

Implements

IGetsAllVariablesFromContext

Inherited Members

      System.Object.Equals(System.Object)

      System.Object.Equals(System.Object, System.Object)

      System.Object.GetHashCode()

      System.Object.GetType()

      System.Object.MemberwiseClone()

      System.Object.ReferenceEquals(System.Object, System.Object)

      System.Object.ToString()

Namespace: ZptSharp.Expressions

Assembly: ZptSharp.dll

Syntax

public class ContextAllVariablesAndValuesProvider : IGetsAllVariablesFromContext

Constructors

    |
    <a href="https://github.com/csf-dev/ZPT-Sharp/new/master/apiSpec/new?filename=ZptSharp_Expressions_ContextAllVariablesAndValuesProvider__ctor_ZptSharp_Expressions_IGetsBuiltinContextsProvider_ZptSharp_Config_RenderingConfig_.md&value=---%0Auid%3A%20ZptSharp.Expressions.ContextAllVariablesAndValuesProvider.%23ctor(ZptSharp.Expressions.IGetsBuiltinContextsProvider%2CZptSharp.Config.RenderingConfig)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

    View Source

ContextAllVariablesAndValuesProvider(IGetsBuiltinContextsProvider, RenderingConfig)

Initializes a new instance of the ContextAllVariablesAndValuesProvider class.

Declaration

public ContextAllVariablesAndValuesProvider(IGetsBuiltinContextsProvider builtinContextsProviderFactory, RenderingConfig config)

Parameters

        Type
        Name
        Description

        IGetsBuiltinContextsProvider
        builtinContextsProviderFactory

Builtin contexts provider factory.

        RenderingConfig
        config

Config.

Methods

    |
    <a href="https://github.com/csf-dev/ZPT-Sharp/new/master/apiSpec/new?filename=ZptSharp_Expressions_ContextAllVariablesAndValuesProvider_GetAllVariablesAsync_ZptSharp_Expressions_ExpressionContext_.md&value=---%0Auid%3A%20ZptSharp.Expressions.ContextAllVariablesAndValuesProvider.GetAllVariablesAsync(ZptSharp.Expressions.ExpressionContext)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

    View Source

GetAllVariablesAsync(ExpressionContext)

Gets all of the variables & corresponding values from the specified context.

Declaration

public Task<IDictionary<string, object>> GetAllVariablesAsync(ExpressionContext context)

Parameters

        Type
        Name
        Description

        ExpressionContext
        context

An expression context.

Returns

        Type
        Description

        System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String, System.Object>>

A dictionary of variables and values.

Implements

      IGetsAllVariablesFromContext

                    Improve this Doc

                    View Source

In This Article

              Back to top

            Generated by DocFX


text:
package org.apache.onami.lifecycle.jsr250;

import com.google.inject.TypeLiteral;
import org.apache.onami.lifecycle.core.DefaultStager;
import org.apache.onami.lifecycle.core.DisposingStager;
import org.apache.onami.lifecycle.core.LifeCycleStageModule;

import javax.annotation.PreDestroy;

/**
 * Guice module to register methods to be invoked when {@link org.apache.onami.lifecycle.core.Stager#stage()} is invoked.
 * Module instance have state so it must not be used to construct more than one {@link com.google.inject.Injector}.
 *
 * @author Mikhail Mazursky
 */
public class PreDestroyModule
    extends LifeCycleStageModule
{

    private final DisposingStager<PreDestroy> stager = new DefaultStager<PreDestroy>(
        PreDestroy.class, DefaultStager.Order.FIRST_IN_LAST_OUT );

    @Override
    protected void configureBindings()
    {
        bindStager( stager );
        bind( new TypeLiteral<DisposingStager<PreDestroy>>() {} ).toInstance( stager );
    }

    public DisposingStager<PreDestroy> getStager()
    {
        return stager;
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.anitech.tquesto.controller;

import java.util.Collections;

import javax.inject.Inject;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.anitech.tquesto.auth.JwtConfigurer;
import com.anitech.tquesto.auth.JwtToken;
import com.anitech.tquesto.auth.TokenProvider;
import com.anitech.tquesto.dto.LoginDTO;

/**
 * Authentication controller
 *
 * @author Tapas
 *
 */
@RestController
@RequestMapping("/api")
public class AuthController {

	private final Logger logger = LoggerFactory.getLogger(AuthController.class);

	@Inject
    private TokenProvider tokenProvider;

    @Inject
    private AuthenticationManager authenticationManager;

    @PostMapping("/authenticate")
    public ResponseEntity<?> authorize(@Valid @RequestBody LoginDTO loginDTO, HttpServletResponse response) {
    	logger.debug("Inside authorize() method!");
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginDTO.getUserName(), loginDTO.getPassword());

        try {
            Authentication authentication = this.authenticationManager.authenticate(authenticationToken);
            SecurityContextHolder.getContext().setAuthentication(authentication);
            boolean rememberMe = (loginDTO.isRememberMe() == null) ? false : loginDTO.isRememberMe();
            String jwt = tokenProvider.createToken(authentication, rememberMe);
            response.addHeader(JwtConfigurer.AUTHORIZATION_HEADER, "Bearer " + jwt);
            return ResponseEntity.ok(new JwtToken(jwt));
        } catch (AuthenticationException exception) {
            return new ResponseEntity<>(Collections.singletonMap("AuthenticationException", exception.getLocalizedMessage()), HttpStatus.UNAUTHORIZED);
        }
    }

}


text:
title: "Testing: What, how and why"
image: /assets/images/coding-cost.jpg
image_width: 638
image_height: 479
tags:
  - talks
  - testing
  - legacy-code-rocks
description: >
  I have seen many talks about testing,
  technologies, and explanations about
  how important is for quality, but
  they do not explain
  what is worth to test, what not,
  or just fundamentals.
  This talk covers all this points.
website: http://www.slideshare.net/DavidRdenasPic/testing-what-how-why
---
This talk cares about the fundamentals of testing,
a little bit history of how the professional community developed what we currently know as testing,
but also about
why I should care about testing?
why is it important to do a test?
What is important to test?
What is not important to test?
How to do testing?

There some examples in plnker just to see each step, and many surprises.

<amp-img src="{{ site.baseurl }}/assets/images/calculator-test.jpg" width="638" height="479" layout="responsive"></amp-img>

```javascript
describe('calculator', () => {
  it('should do sums', () => {
    let calculator = new Calculator();
    calculator.input(2);
    calculator.plus();
    calculator.input(4);
    calculator.equal();

    let result = calculator.get();
    expect(result).toBe(6);
  });
});
```

This talk also compares what people learned in the
Computer Sciences and Engineering degrees and what people does in testing.
It gives some tips to catch up with current state of art and gives some points
to start changing syllabus to make better engineers.

This talk is good for beginners, teachers, bosses,
but also for seasoned techies that just want to light up some of the ideas
that they might have been hatching.

Spoiler alert: testing will save you development time and make you a good professional.

I have given this talk in the meetup Legacy Code Rocks.


text:
#pragma once

#include <pthread.h>
#include <semaphore.h>

namespace datadifferential {
namespace util {

enum shutdown_t {
  SHUTDOWN_RUNNING,
  SHUTDOWN_GRACEFUL,
  SHUTDOWN_FORCED
};

class SignalThread {
  bool _exit_on_signal;
  sigset_t set;
  sem_t lock;
  uint64_t magic_memory;
  volatile shutdown_t __shutdown;
  pthread_mutex_t shutdown_mutex;
  pthread_t thread;

public:

  SignalThread(bool exit_on_signal_arg= false);

  void test();
  void post();
  bool setup();

  bool exit_on_signal()
  {
    return _exit_on_signal;
  }

  int wait(int& sig)
  {
    return sigwait(&set, &sig);
  }

  ~SignalThread();

  void set_shutdown(shutdown_t arg);
  bool is_shutdown();
  shutdown_t get_shutdown();
};

} /* namespace util */
} /* namespace datadifferential */


text:
import { IButton } from '../../types'

export const toSlack = (b: IButton) => ({
  style: b.type || 'default',
  confirm: b.confirm,
  value: b.value,
  type: 'button',
  text: b.label,
  name: b.id
})

export const fromSlack = (b): IButton => ({
  type: b.style || 'default',
  confirm: b.confirm,
  value: b.value,
  label: b.text,
  id: b.name
})


text:
require 'spec_helper'
require File.expand_path("#{File.dirname __FILE__}/../../../../lib/htty/headers")
require File.expand_path("#{File.dirname __FILE__}/../../../../lib/htty/cli/display")

describe HTTY::CLI::Display do
  let(:display) {Class.new.new.extend(HTTY::CLI::Display)}

  describe '#show_headers' do
    it 'displays headers keeping the text case' do
      headers = HTTY::Headers.new('user-agent' => 'htty/1.4.1').to_a

      expect {display.show_headers(headers)}.to print_on_stdout(
        "user-agent:#{display.strong('')} htty/1.4.1\n"
      )
    end

    context 'with one header' do
      let(:headers) {HTTY::Headers.new('User-Agent' => 'htty/1.4.1').to_a}

      it 'displays the header starting from the beginning of the line' do
        expect {display.show_headers(headers)}.to print_on_stdout(
          "User-Agent:#{display.strong('')} htty/1.4.1\n"
        )
      end
    end

    context 'with few headers' do
      let(:headers) {
        headers = HTTY::Headers.new
        headers['User-Agent'] = 'htty/1.4.1'
        headers['Content-Type'] = 'application/json'
        headers.to_a
      }

      it 'aligns headers on colons' do
        expect {display.show_headers(headers)}.to print_on_stdout(
          "  User-Agent:#{display.strong('')} htty/1.4.1\n" +
          "Content-Type:#{display.strong('')} application/json\n"
        )
      end
    end

    context 'with marked headers' do
      context 'with one header' do
        let(:headers) {HTTY::Headers.new('User-Agent' => 'htty/1.4.1').to_a}
        let(:options) {{:show_mercantile_next_to => 'User-Agent'}}

        it 'displays the header starting from the beginning of the line' do
          expect {display.show_headers(headers, options)}.to print_on_stdout(
            "User-Agent:#{display.strong('@')} htty/1.4.1\n"
          )
        end
      end

      context 'with few headers' do
        let(:options) {{:show_mercantile_next_to => 'Content-Type'}}
        let(:headers) {
          headers = HTTY::Headers.new
          headers['User-Agent'] = 'htty/1.4.1'
          headers['Content-Type'] = 'application/json'
          headers.to_a
        }

        it 'aligns colons and mercantiles' do
          expect {display.show_headers(headers, options)}.to print_on_stdout(
            "   User-Agent:#{display.strong('')} htty/1.4.1\n" +
            "Content-Type:#{display.strong('@')} application/json\n"
          )
        end
      end
    end

    context 'when asked to mark an header' do
      let(:options) {{:show_mercantile_next_to => 'Content-Type'}}
      let(:headers) {HTTY::Headers.new('content-type' => 'application/json').to_a}

      it 'marks headers indipendently of the text case' do
        expect {display.show_headers(headers, options)}.to print_on_stdout(
          "content-type:#{display.strong('@')} application/json\n"
        )
      end
    end
  end
end


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

<TITLE>
Progress (Facebook's realtime distributed database, powered by Apache Hadoop based on 0.20-append branch 0.20.1-dev API)
</TITLE>

<META NAME="date" CONTENT="2011-03-30">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.hadoop.util

Class Progress

java.lang.Object
  org.apache.hadoop.util.Progress

public class Progress
extends java.lang.Object

Utility to assist with generation of progress reports.  Applications build
 a hierarchy of Progress instances, each modelling a phase of
 execution.  The root is constructed with Progress().  Nodes for
 sub-phases are created by calling addPhase().

Constructor Summary

Progress()

          Creates a new root node.

Method Summary

 Progress
addPhase()

          Adds a node to the tree.

 Progress
addPhase(java.lang.String status)

          Adds a named node to the tree.

 void
complete()

          Completes this node, moving the parent node to its next child.

 float
get()

          Returns the overall progress of the root.

 Progress
phase()

          Returns the current sub-node executing.

 void
set(float progress)

          Called during execution on a leaf node to set its progress.

 void
setStatus(java.lang.String status)

 void
startNextPhase()

          Called during execution to move to the next phase at this level in the
 tree.

 java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

Progress

public Progress()

Creates a new root node.

Method Detail

addPhase

public Progress addPhase(java.lang.String status)

Adds a named node to the tree.

addPhase

public Progress addPhase()

Adds a node to the tree.

startNextPhase

public void startNextPhase()

Called during execution to move to the next phase at this level in the
 tree.

phase

public Progress phase()

Returns the current sub-node executing.

complete

public void complete()

Completes this node, moving the parent node to its next child.

set

public void set(float progress)

Called during execution on a leaf node to set its progress.

get

public float get()

Returns the overall progress of the root.

setStatus

public void setStatus(java.lang.String status)

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

This release is based on the Facebook's version of Hadoop.
Copyright © 2009 The Apache Software Foundation.


text:
package boofcv.alg.filter.basic.impl;

import boofcv.struct.image.*;

/**
 *

 * Contains implementations of algorithms in {@link boofcv.alg.filter.basic.GrayImageOps}.
 *

 *
 *

 * WARNING: Do not modify.  Automatically generated by {@link GenerateImplGrayImageOps}.
 *

 */
public class ImplGrayImageOps {

	public static void invert(GrayF32 input, float max , GrayF32 output) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				output.data[indexDst++] = (max - (input.data[indexSrc++]));
			}
		}
	}

	public static void brighten(GrayF32 input, float beta, float max , GrayF32 output ) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				float val = (input.data[indexSrc++]) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = val;
			}
		}
	}

	public static void stretch(GrayF32 input, double gamma, float beta, float max , GrayF32 output ) {
		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				float val = (float)((input.data[indexSrc++])* gamma) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = val;
			}
		}
	}

	public static void invert(GrayU8 input, int max , GrayU8 output) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				output.data[indexDst++] = (byte)(max - (input.data[indexSrc++]& 0xFF));
			}
		}
	}

	public static void brighten(GrayU8 input, int beta, int max , GrayU8 output ) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (input.data[indexSrc++]& 0xFF) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (byte)val;
			}
		}
	}

	public static void stretch(GrayU8 input, double gamma, int beta, int max , GrayU8 output ) {
		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (int)((input.data[indexSrc++]& 0xFF)* gamma) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (byte)val;
			}
		}
	}

	public static void invert(GrayS16 input, int max , GrayS16 output) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				output.data[indexDst++] = (short)(max - (input.data[indexSrc++]));
			}
		}
	}

	public static void brighten(GrayS16 input, int beta, int max , GrayS16 output ) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (input.data[indexSrc++]) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (short)val;
			}
		}
	}

	public static void stretch(GrayS16 input, double gamma, int beta, int max , GrayS16 output ) {
		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (int)((input.data[indexSrc++])* gamma) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (short)val;
			}
		}
	}

	public static void invert(GrayU16 input, int max , GrayU16 output) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				output.data[indexDst++] = (short)(max - (input.data[indexSrc++]& 0xFFFF));
			}
		}
	}

	public static void brighten(GrayU16 input, int beta, int max , GrayU16 output ) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (input.data[indexSrc++]& 0xFFFF) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (short)val;
			}
		}
	}

	public static void stretch(GrayU16 input, double gamma, int beta, int max , GrayU16 output ) {
		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (int)((input.data[indexSrc++]& 0xFFFF)* gamma) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = (short)val;
			}
		}
	}

	public static void invert(GrayS32 input, int max , GrayS32 output) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				output.data[indexDst++] = (max - (input.data[indexSrc++]));
			}
		}
	}

	public static void brighten(GrayS32 input, int beta, int max , GrayS32 output ) {

		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (input.data[indexSrc++]) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = val;
			}
		}
	}

	public static void stretch(GrayS32 input, double gamma, int beta, int max , GrayS32 output ) {
		for (int y = 0; y < input.height; y++) {
			int indexSrc = input.startIndex + input.stride*y;
			int indexDst = output.startIndex + output.stride*y;

			for (int x = 0; x < input.width; x++) {
				int val = (int)((input.data[indexSrc++])* gamma) + beta;
				if (val > max) val = max;
				if (val < 0) val = 0;
				output.data[indexDst++] = val;
			}
		}
	}

}


text:
package me.tatarka.redux.rx2;

import io.reactivex.Completable;
import io.reactivex.disposables.Disposable;

import me.tatarka.redux.Dispatcher;

public class CompletableDispatcher extends Dispatcher<Completable, Disposable> {
    @Override
    public Disposable dispatch(Completable action) {
        return action.subscribe();
    }
}


text:
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20140106102940 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
    	$this->addSql("
    		CREATE TABLE IF NOT EXISTS `course_coupon` (
			  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
			  `code` varchar(255) CHARACTER SET utf8 NOT NULL,
			  `type` enum('minus','discount') NOT NULL COMMENT '优惠方式',
			  `rate` float(10,2) unsigned NOT NULL COMMENT '优惠额度 若优惠方式为折扣,则为折扣率,若为立减,则为减免金额',
			  `status` enum('unused','used') NOT NULL DEFAULT 'unused' COMMENT '优惠码状态',
			  `times` int(10) unsigned NOT NULL COMMENT '可使用次数',
			  `targetType` varchar(255) NOT NULL DEFAULT '',
			  `targetId` int(11) unsigned NOT NULL DEFAULT '0',
			  `orderId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单号',
			  `orderUserId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '使用人',
			  `orderTime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '使用时间',
			  `deadline` int(10) unsigned NOT NULL COMMENT '过期时间',
			  `createdTime` int(10) unsigned NOT NULL COMMENT '生成时间',
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=131 ;
    	");
    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs

    }
}


text:
namespace XSharp.Assembler.x86.x87
{
    [XSharp.Assembler.OpCode("ficom")]
    public class IntCompare : InstructionWithDestination
    {
    }
}


text:
package i5.las2peer.services.queryVisualization.encoding;

import i5.las2peer.security.Context;

import java.sql.Types;
import java.util.Iterator;

/**
 * VisualizationXML.java
 *

 * Transforms/Converts a method result into an XML-String, where each row is stored as String-Array (using a subset of the syntax/semantic the LAS-HTTP-Connector)
 *

 * Data Format:

 * - XML with the same (/subset of the) syntax/semantic as used by the HTTP-LAS-Connector

 * - Each row is stored as String array parameters element

 * - The first row contains the column names

 * - The second row denotes the data type of the column as String as used in Java, e.g. "String", "long", "Date", etc.
 *
 */
public class VisualizationXML extends Visualization {

	public VisualizationXML() {
		super(VisualizationType.XML);
	}

	public String generate(MethodResult methodResult, String[] visualizationParameters){
		try {

			if(methodResult == null) {
				throw new Exception("Tried to transform an invalid methodResult into XML!");
			}

			String[] columnNames =methodResult.getColumnNames();
			Integer[] columnTypes = methodResult.getColumnDatatypes();
			Iterator<Object[]> iterator = methodResult.getRowIterator();
			int columnCount = columnTypes.length;

			String xmlRowStart = "\t<param type=\"Array\" class=\"String\" length=\"" + columnCount + "\">\n";
			String xmlRowEnd = "\t</param>\n";

			String xmlStart = "<?xml version=\"1.0\"?>\n<rows>\n";
			String xmlEnd = "\n</rows>";

			StringBuilder xmlResult = new StringBuilder();

			// add the column names
			xmlResult.append(xmlRowStart);
			for(int i=0; i<columnCount; i++) {
				xmlResult.append("\t\t<element><![CDATA["+columnNames[i]+"]]></element>\n");
			}
			xmlResult.append(xmlRowEnd);

			// add the column data types
			xmlResult.append(xmlRowStart);
			for(int i=0; i<columnCount; i++) {
				xmlResult.append("\t\t<element><![CDATA[");

				switch(columnTypes[i]) {
					case Types.BOOLEAN:
						xmlResult.append("Boolean");
						break;
					case Types.DATE:
					case Types.TIME:
					case Types.TIMESTAMP:
						xmlResult.append("Date"); // better idea?
						break;
					case Types.BIGINT:
					case Types.DECIMAL:
					case Types.NUMERIC:
						xmlResult.append("Long"); // better idea?
						break;
					case Types.DOUBLE:
						xmlResult.append("Double");
						break;
					case Types.REAL:
					case Types.FLOAT:
						xmlResult.append("Float");
						break;
					case Types.INTEGER:
					case Types.SMALLINT:
						xmlResult.append("Integer");
						break;
					default:
						xmlResult.append("String");
						break;
				};
				xmlResult.append("]]></element>\n");
			}
			xmlResult.append(xmlRowEnd);

			while(iterator.hasNext()) {
				Object[] currentRow = iterator.next();
				// add the row...
				xmlResult.append(xmlRowStart);
				for(int i=0; i<columnCount; i++) {
					if (currentRow[i] instanceof String) {
						String s = (String)currentRow[i];
						s = s.replace("]]>", "]]]]><![CDATA[>"); //Otherwise problems with xml transportation
						xmlResult.append("\t\t<element><![CDATA["+s+"]]></element>\n");
					} else {
						xmlResult.append("\t\t<element><![CDATA["+currentRow[i]+"]]></element>\n");
					}
				}
				xmlResult.append(xmlRowEnd);
			}

			return xmlStart + xmlResult.toString().trim() + xmlEnd;

		}
		catch (Exception e) {
			Context.logMessage(this, e.getMessage());
			try {
				return  super.visualizationException.generate(e, "Encoding into XML format failed.");
			}
			catch(Exception ex) {
				Context.logError(this, ex.getMessage());
				return "Unknown/handled error occurred!";
			}
		}
	}

	//Always true
	public boolean check(MethodResult methodResult, String[] visualizationParameters) {
		return true;
	}

}


text:
README: [English](https://github.com/wellsluo/DeployVHD/blob/master/README.md) | [中文](https://github.com/wellsluo/DeployVHD/blob/master/README-CN.md)

PowerShell script to deploy new VHD(X) file from Windows Server/Desktop image file ISO/WIM, or edit existed VHD(X) file, and configure un-attend information.

<!-- TOC -->

- [DeployVHD](#deployvhd)
    - [Motivation](#motivation)
    - [Objectives](#objectives)
    - [License](#license)
    - [Features](#features)
    - [Supportability](#supportability)
        - [VHD(X) OS](#vhdx-os)
        - [System Requirements](#system-requirements)
    - [Usage](#usage)
        - [EXAMPLE1](#example1)
        - [EXAMPLE2](#example2)
        - [EXAMPLE3](#example3)
        - [EXAMPLE4](#example4)
        - [EXAMPLE5](#example5)
        - [EXAMPLE6](#example6)
    - [Help](#help)
    - [Dependency](#dependency)

<!-- /TOC -->

## Motivation

"Windows 10 Insider" program should be most popular program which attracts thousands of participants.  As Windows Server,  there is similar program like "Continuous Customer Engagement Program" for enterprise IT administrators.  Both programs will issue new product build ISO periodically, like weekly.  For each build, it will be time consuming for user to setup Windows Server/Windows Desktop from scratch, and so does for different editions.

So I created the project to develop the PowerShell script, which can help user to deploy the new build to VHD(X) file very quickly and with un-attend features to lower down user tasks and time.

## Objectives

Agile and easy way to deploy VHD to physical server (NativeBoot) or VM from Windows Server/Desktop iteration builds with un-attend configurations.

For a passionate user who frequently validates the Windows Server/Windows Desktop fresh builds, or IT administrator who needs to generate virtual disks with multiple editions of Windows Server/Windows Desktop, this script will help you out.

The script is also a pal of "Windows Server CCEP" program and "Windows 10 Insider" program participants.

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/wellsluo/DeployVHD/blob/master/LICENSE) file for details.

## Features

Generally, the script works in following scenarios:
- Generate new VHD(X) file (MBR or GPT partition) and apply Windows Server OS from ISO/WIM as template file for both virtual machine and physical machine (boot from VHD).
- Customize un-attend options (into Unattend.xml), and apply it to VHD(X).
- Use the VHD(X) file as system virtual disk in a virtual machine.
- Enable boot from VHD (NativeBoot) in physical server (auto restart if enabled).

So the following features are supported:

- Generate VHD(X) file from Windows Server ISO/WIM image file.
	+ Create MBR or GUID partition of VHD(X) files.
	+ Set VHD(X) file size .
	+ Select different Edition of Windows Server/Windows Desktop.

- On the first boot, OS will setup automatically without user actions.  Customize following un-attend configurations to the VHD(X) files:
	+ Enable Windows Firewall rules of "Remote Desktop" and "File and Printer Sharing".
	+ Enable automatic logon after Windows boots up, and set automatic logon count.
	+ Set local administrator password for Windows Server editions.
	+ Add additional local administrator account and set its password for Windows Desktop editions.
	+ Enable "Remote Desktop" option.
	+ Set system locale to en-US.
	+ Set computer name or use same computer name which runs the script (for creating native boot VHD of physical machine).
	+ Hide EULA and OOBE pages on first booting up.
	+ Set time zone to "Pacific Standard Time" by default, or set to "China Standard Time".
	+ Set register owner and organization of Windows.
	+ Un-attend options can be disabled if not necessary.

- Physical Machine:
	+ Use same computer name as current OS.
	+ Enable NativeBoot
		+ Restart in 30 seconds after enabling NativeBoot

- Role installed:
	+ Install Hyper-V role for Windows Server by default.
	+ It can be disabled if Hyper-V server is not used or for virtual machines (Windows 10 1511 or above supports nested virtualization, Hyper-V role can run in virtual machine).
		+ Provides test mode if you don't want to add the boot entry and restart physical machine.

- VHD(X) file can be used on both physical machine and Hyper-V virtual machine.

- Apply update packages or drivers when generating the VHD(X) files.

*If you also need features that to create multiple similar virtual machines very quickly, such as a demo lab, it is proviced in other PowerShell project. Please refer to* **[ManageVM](https://github.com/wellsluo/ManageVM)**.

**Note: No any Windows Server/Windows Desktop product keys or licenses are included.  User needs to have your own licenses to use Windows Server/Windows Desktop in production environment.**

## Supportability
### VHD(X) OS

You can generate the VHD(X) files from ISO with following OS versions, x64 only:
- Windows Server 2016
- Windows Server 2012 R2
- Windows 10
- Windows 8.1
- Windows 7 (only for MBR partition, no GUID partition for virtual machine)

### System Requirements

You can run the script on following OS versions and PowerShell version:
- Windows Server 2016
- Windows Server 2012 R2 (Not for Windows Server 2016 and Windows 10 VHD file)
- Windows 10
- PowerShell 4 or above

## Usage

Put the script and all other files under a folder. Run PowerShell command window in "Elevated" mode. Then go to the folder to run it.

File list:

Name | Description | Memo
------------ | ------------- | ------------
Convert-WindowsImage.ps1 | Dependency | Provide function to generate VHD(X) from ISO/WIM image
DeployVHD.ps1 | Main script  |
Example-BootFromNewVHD.ps1 | Example script  | Enable boot from vhd in physical machine
Example-Create-OSVHD.ps1 | Example script  | Generate multiple VHD(X) files from ISO at one running time
unattend_amd64_Client.xml | Un-attend template | for Windows Desktop
unattend_amd64_Server.xml | Un-attend template | for Windows Server

### EXAMPLE1

```PowerShell
    .\Deploy-VHD.ps1 -SourcePath D:\ISO\Win2016.iso -CreateVHDTemplate

```

This command will create a 100GB dynamically-expanding VHDX containing the Datacenter SKU, and will be named as "WinServer2016.Hyper-V.100GB.GUID.VHDX" (name convension is "SourcePath.[Hyper-V].VHDSize.VHDPartitionStyle.VHDFormat"). Computer name will be generated randomly on first booting up. Default un-attend configurations are applied as following:

	- Computer Name:  Random name on first booting
	- AutoLogon:      Disabled
	- RemoteDesktop:  Enabled
	- Firewall:       Opened

### EXAMPLE2

```PowerShell
    .\Deploy-VHD.ps1 -VHDPath .\WinServer2016.VHDX -SourcePath D:\ISO\Win2016.iso
```

This command will create a dynamically-expanding 100GB VHDX containing the Datacenter SKU, and will be named WinServer2016.vhdx
Unattend.xml will be applied with default configurations:

	- Computer Name:  Same as host
	- AutoLogon:      Disabled
	- RemoteDesktop:  Enabled
	- Firewall:       Opened

### EXAMPLE3

```PowerShell
    .\Deploy-VHD.ps1 -VHDPath .\WinServer2016.VHDX -SourceVHD D:\VHDX\Win2016-Template.vhdx
```

This command will use VHDX file D:\VHDX\Win2016-Template.vhdx and copy as WinServer2016.VHDX.
Unattend.xml will be applied with default configurations.

### EXAMPLE4

```PowerShell
    .\Deploy-VHD.ps1 -VHDPath .\WinServer2016.VHDX
```

This command will edit WinServer2016.VHDX directly with default un-attend configurations.

### EXAMPLE5

```PowerShell
    .\Deploy-VHD.ps1 -VHDPath .\WinServer2016.VHDX  -ComputerName Test-01 -AutoLogon
```

This command will edit WinServer2016.VHDX, set the computer name to 'Test-01', and enable Autologon.

### EXAMPLE6

```PowerShell
    .\Deploy-VHD.ps1 -VHDPath .\WinServer2016.VHDX  -EnableNativeBoot -Restart
```

This command will edit WinServer2016.VHDX file, and enable boot from VHD, then system will restart in 30 seconds.

## Help

The script aligns with standard PowerShell help format. To get the help of the script, just run command:

```PowerShell

Help .\Deploy-VHD.PS1 -Detailed

```

## Dependency

The script depends on the script 'Convert-WindowsImage.ps1' from Microsoft. The script 'Convert-WindowsImage.ps1' provides basic functions to convert ISO or WIM image to VHD(X) files.

'DeployVHD' includes version "10.0.9000.0.fbl_core1_hyp_dev(mikekol).141224-3000.amd64fre".

Latest version can be found at:
http://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f


text:
package com.ihtsdo.snomed.dto.refset.validation;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.bind.annotation.XmlRootElement;

import com.google.common.base.Objects;
import com.ihtsdo.snomed.dto.refset.RuleDto;

@XmlRootElement(name="validation-result")
public class ValidationResult{

    public enum Error{
        NULL_OR_ZERO_REFSET_RULE_ID,
        UNCONNECTED_REFSET_RULE,
        REFERENCING_UNDECLARED_RULE,
        SELF_REFERENCING_RULE,
        LEFT_AND_RIGHT_OPERAND_REFERENCE_SAME_RULE,
        UNRECOGNISED_REFSET_RULE_TYPE,
        EMPTY_CONCEPT_LIST,
        INVALID_CONCEPT_ID,
        RULE_REFERENCED_MORE_THAN_ONCE,
        DECLARED_RULE_NEVER_REFERENCED,
        MORE_THAN_ONE_UNREFERENCED_RULE_FOR_TERMINAL_CANDIDATE,
        NO_UNREFERENCED_RULE_FOR_TERMINAL_CANDIDATE
    }

    private static final Map<ValidationResult.Error, String> errorToMessageKeyMap = new HashMap<>();

    static
    {
        errorToMessageKeyMap.put(Error.NULL_OR_ZERO_REFSET_RULE_ID, "validation.error.null.or.zero.refset.rule.id");
        errorToMessageKeyMap.put(Error.UNCONNECTED_REFSET_RULE, "validation.error.unconnected.refset.rule");
        errorToMessageKeyMap.put(Error.REFERENCING_UNDECLARED_RULE, "validation.error.referencing.undeclared.rule");
        errorToMessageKeyMap.put(Error.SELF_REFERENCING_RULE, "validation.error.self.refrencing.rule");
        errorToMessageKeyMap.put(Error.LEFT_AND_RIGHT_OPERAND_REFERENCE_SAME_RULE, "validation.error.left.and.right.operand.reference.same.rule");
        errorToMessageKeyMap.put(Error.UNRECOGNISED_REFSET_RULE_TYPE, "validation.error.unrecognised.refset.rule.type");
        errorToMessageKeyMap.put(Error.EMPTY_CONCEPT_LIST, "validation.error.empty.concept.list");
        errorToMessageKeyMap.put(Error.INVALID_CONCEPT_ID, "validation.error.missing.concept.id");
        errorToMessageKeyMap.put(Error.RULE_REFERENCED_MORE_THAN_ONCE, "validation.error.rule.referenced.more.than.once");
        errorToMessageKeyMap.put(Error.DECLARED_RULE_NEVER_REFERENCED, "validation.error.declared.rule.never.referenced");
        errorToMessageKeyMap.put(Error.MORE_THAN_ONE_UNREFERENCED_RULE_FOR_TERMINAL_CANDIDATE, "validation.error.more.than.one.unreferenced.rule");
        errorToMessageKeyMap.put(Error.NO_UNREFERENCED_RULE_FOR_TERMINAL_CANDIDATE, "validation.error.no.unreferenced.rule.for.terminal.candidate");
    }

    public static String messageKeyFor(final ValidationResult.Error error){
        return errorToMessageKeyMap.get(error);
    }

    private boolean success = true;
    private RuleDto terminal;

    private List<GlobalValidationError> globalErrors = new ArrayList<>();
    private List<FieldValidationError> fieldErrors = new ArrayList<>();;

    @Override
    public String toString(){
        return Objects.toStringHelper(this)
                .add("success", isSuccess())
                .add("globalErrors", getGlobalErrors())
                .add("fieldErrors", getFieldErrors())
                .toString();
    }

    @Override
    public int hashCode(){
        return java.util.Objects.hash(
                isSuccess(),
                getGlobalErrors(),
                getFieldErrors());
    }

    @Override
    public boolean equals (Object o){
        if (o instanceof ValidationResult){
            ValidationResult v = (ValidationResult) o;
            if (java.util.Objects.equals(v.getGlobalErrors(), this.getGlobalErrors()) &&
                java.util.Objects.equals(v.getFieldErrors(), this.getFieldErrors()) &&
                v.isSuccess() == this.isSuccess()){
                return true;
            }
        }
        return false;
    }

    public ValidationResult addError(ValidationResult.Error error, RuleDto rule, String defaultMessage){
        setSuccess(false);
        fieldErrors.add(new FieldValidationError(rule, error, defaultMessage));
        return this;
    }

    public ValidationResult addError(ValidationResult.Error error, String defaultMessage){
        setSuccess(false);
        globalErrors.add(new GlobalValidationError(error, defaultMessage));
        return this;
    }

    public ValidationResult addError(GlobalValidationError error){
        setSuccess(false);
        globalErrors.add(error);
        return this;
    }

    public ValidationResult addError(FieldValidationError error){
        setSuccess(false);
        fieldErrors.add(error);
        return this;
    }

    protected void setSuccess(boolean success) {
        this.success = success;

    }

    public ValidationResult withParams(Collection<String> params){
        params.addAll(params);
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public RuleDto getTerminal() {
        return terminal;
    }

    public void setTerminal(RuleDto terminal) {
        this.terminal = terminal;
    }

    public List<GlobalValidationError> getGlobalErrors() {
        return globalErrors;
    }

    public List<FieldValidationError> getFieldErrors() {
        return fieldErrors;
    }

    public static Builder getBuilder() {
        return new Builder();
    }

    public static class Builder {
        private ValidationResult built;

        Builder() {
            built = new ValidationResult();
        }

        public Builder terminal(RuleDto terminal){
            built.setTerminal(terminal);
            return this;
        }

        public ValidationResult build(){
            return built;
        }
    }
}


text:
<?php namespace Faddle\Http;

class SecureSession {

	/**
	 * Encryption algorithm
	 *
	 * @var string
	 */
	protected $_algo= MCRYPT_RIJNDAEL_128;
	/**
	 * Key for encryption/decryption
	*
	* @var string
	*/
	protected $_key;
	/**
	 * Key for HMAC authentication
	*
	* @var string
	*/
	protected $_auth;
	/**
	 * Path of the session file
	 *
	 * @var string
	 */
	protected $_path;
	/**
	 * Session name (optional)
	 *
	 * @var string
	 */
	protected $_name;
	/**
	 * Size of the IV vector for encryption
	 *
	 * @var integer
	 */
	protected $_ivSize;
	/**
	 * Cookie variable name of the encryption + auth key
	 *
	 * @var string
	 */
	protected $_keyName;

	/**
	 * Generate a random key using openssl
	 * fallback to mcrypt_create_iv
	 *
	 * @param	integer $length
	 * @return string
	 */
	protected function _randomKey($length=32) {
		if(function_exists('openssl_random_pseudo_bytes')) {
			$rnd = openssl_random_pseudo_bytes($length, $strong);
			if ($strong === true) {
				return $rnd;
			}
		}
		return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
	}

	/**
	 * Constructor
	 */
	public function __construct()
	{
		session_set_save_handler(
			array($this, "open"),
			array($this, "close"),
			array($this, "read"),
			array($this, "write"),
			array($this, "destroy"),
			array($this, "gc")
		);
		if (!extension_loaded('mcrypt')) {
			throw new Exception("The SecureSession class needs the Mcrypt PHP extension, please install it.");
		}
	}

	/**
	 * Open the session
	 *
	 * @param string $save_path
	 * @param string $session_name
	 * @return bool
	 */
	public function open($save_path, $session_name)
	{
		$this->_path = $save_path.'/';
		$this->_name = $session_name;
		$this->_keyName = "KEY_$session_name";
		$this->_ivSize = mcrypt_get_iv_size($this->_algo, MCRYPT_MODE_CBC);

		if (empty($_COOKIE[$this->_keyName]) || strpos($_COOKIE[$this->_keyName],':')===false) {
		$keyLength = mcrypt_get_key_size($this->_algo, MCRYPT_MODE_CBC);
		$this->_key = self::_randomKey($keyLength);
		$this->_auth = self::_randomKey(32);
		$cookie_param = session_get_cookie_params();
		setcookie(
			$this->_keyName,
			base64_encode($this->_key) . ':' . base64_encode($this->_auth),
			// if session cookie lifetime > 0 then add to current time; otherwise leave it as zero, honoring zero's special meaning: expire at browser close.
			($cookie_param['lifetime'] > 0) ? time() + $cookie_param['lifetime'] : 0,
			$cookie_param['path'],
			$cookie_param['domain'],
			$cookie_param['secure'],
			$cookie_param['httponly']
		);
		} else {
			list ($this->_key, $this->_auth) = explode (':',$_COOKIE[$this->_keyName]);
			$this->_key = base64_decode($this->_key);
			$this->_auth = base64_decode($this->_auth);
		}
		return true;
	}

	/**
	 * Close the session
	 *
	 * @return bool
	 */
	public function close()
	{
		return true;
	}

	/**
	 * Read and decrypt the session
	 *
	 * @param	integer $id
	 * @return string
	 */
	public function read($id)
	{
		$sess_file = $this->_path.$this->_name."_$id";
		if (!file_exists($sess_file)) {
			return false;
		}
		$data = file_get_contents($sess_file);
		list($hmac, $iv, $encrypted)= explode(':',$data);
		$iv = base64_decode($iv);
		$encrypted = base64_decode($encrypted);
		$newHmac = hash_hmac('sha256', $iv . $this->_algo . $encrypted, $this->_auth);
		if ($hmac !== $newHmac) {
			return false;
		}
		$decrypt = mcrypt_decrypt(
			$this->_algo,
			$this->_key,
			$encrypted,
			MCRYPT_MODE_CBC,
			$iv
		);
		return rtrim($decrypt, "\0");
	}

	/**
	 * Encrypt and write the session
	 *
	 * @param integer $id
	 * @param string $data
	 * @return bool
	 */
	public function write($id, $data)
	{
		$sess_file = $this->_path . $this->_name . "_$id";
		$iv = mcrypt_create_iv($this->_ivSize, MCRYPT_DEV_URANDOM);
		$encrypted = mcrypt_encrypt(
			$this->_algo,
			$this->_key,
			$data,
			MCRYPT_MODE_CBC,
			$iv
		);
		$hmac = hash_hmac('sha256', $iv . $this->_algo . $encrypted, $this->_auth);
		$bytes = file_put_contents($sess_file, $hmac . ':' . base64_encode($iv) . ':' . base64_encode($encrypted));
		return ($bytes !== false);
	}

	/**
	 * Destoroy the session
	 *
	 * @param int $id
	 * @return bool
	 */
	public function destroy($id)
	{
		$sess_file = $this->_path . $this->_name . "_$id";
		setcookie ($this->_keyName, '', time() - 3600);
		return(@unlink($sess_file));
	}

	/**
	 * Garbage Collector
	 *
	 * @param int $max
	 * @return bool
	 */
	public function gc($max)
	{
		foreach (glob($this->_path . $this->_name . '_*') as $filename) {
			if (filemtime($filename) + $max < time()) {
				@unlink($filename);
			}
		}
		return true;
	}
}

//new SecureSession();


text:
import sqlite3
DATABASE = "myshop.db"

def query(sql,data):
    with sqlite3.connect(DATABASE) as db:
        cursor = db.cursor()
        cursor.execute("PRAGMA foreign_keys = ON")
        cursor.execute(sql,data)
        db.commit()


text:
/* *
 *
 *  (c) 2010-2021 Grzegorz Blachlinski, Sebastian Bochan
 *
 *  License: www.highcharts.com/license
 *
 *  !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
 *
 * */
'use strict';
import Chart from '../../Core/Chart/Chart.js';
import H from '../../Core/Globals.js';
import '../../Series/Networkgraph/Layouts.js';
var Reingold = H.layouts['reingold-fruchterman'];
import U from '../../Core/Utilities.js';
var addEvent = U.addEvent, extendClass = U.extendClass, pick = U.pick;
/* *
 *
 *  Composition
 *
 * */
Chart.prototype.getSelectedParentNodes = function () {
    var chart = this, series = chart.series, selectedParentsNodes = [];
    series.forEach(function (series) {
        if (series.parentNode && series.parentNode.selected) {
            selectedParentsNodes.push(series.parentNode);
        }
    });
    return selectedParentsNodes;
};
H.networkgraphIntegrations.packedbubble = {
    repulsiveForceFunction: function (d, k, node, repNode) {
        return Math.min(d, (node.marker.radius + repNode.marker.radius) / 2);
    },
    barycenter: function () {
        var layout = this, gravitationalConstant = layout.options.gravitationalConstant, box = layout.box, nodes = layout.nodes, centerX, centerY;
        nodes.forEach(function (node) {
            if (layout.options.splitSeries && !node.isParentNode) {
                centerX = node.series.parentNode.plotX;
                centerY = node.series.parentNode.plotY;
            }
            else {
                centerX = box.width / 2;
                centerY = box.height / 2;
            }
            if (!node.fixedPosition) {
                node.plotX -=
                    (node.plotX - centerX) *
                        gravitationalConstant /
                        (node.mass * Math.sqrt(nodes.length));
                node.plotY -=
                    (node.plotY - centerY) *
                        gravitationalConstant /
                        (node.mass * Math.sqrt(nodes.length));
            }
        });
    },
    repulsive: function (node, force, distanceXY, repNode) {
        var factor = (force * this.diffTemperature / node.mass /
            node.degree), x = distanceXY.x * factor, y = distanceXY.y * factor;
        if (!node.fixedPosition) {
            node.plotX += x;
            node.plotY += y;
        }
        if (!repNode.fixedPosition) {
            repNode.plotX -= x;
            repNode.plotY -= y;
        }
    },
    integrate: H.networkgraphIntegrations.verlet.integrate,
    getK: H.noop
};
H.layouts.packedbubble = extendClass(Reingold, {
    beforeStep: function () {
        if (this.options.marker) {
            this.series.forEach(function (series) {
                if (series) {
                    series.calculateParentRadius();
                }
            });
        }
    },
    setCircularPositions: function () {
        var layout = this, box = layout.box, nodes = layout.nodes, nodesLength = nodes.length + 1, angle = 2 * Math.PI / nodesLength, centerX, centerY, radius = layout.options.initialPositionRadius;
        nodes.forEach(function (node, index) {
            if (layout.options.splitSeries &&
                !node.isParentNode) {
                centerX = node.series.parentNode.plotX;
                centerY = node.series.parentNode.plotY;
            }
            else {
                centerX = box.width / 2;
                centerY = box.height / 2;
            }
            node.plotX = node.prevX = pick(node.plotX, centerX +
                radius * Math.cos(node.index || index * angle));
            node.plotY = node.prevY = pick(node.plotY, centerY +
                radius * Math.sin(node.index || index * angle));
            node.dispX = 0;
            node.dispY = 0;
        });
    },
    repulsiveForces: function () {
        var layout = this, force, distanceR, distanceXY, bubblePadding = layout.options.bubblePadding;
        layout.nodes.forEach(function (node) {
            node.degree = node.mass;
            node.neighbours = 0;
            layout.nodes.forEach(function (repNode) {
                force = 0;
                if (
                // Node can not repulse itself:
                node !== repNode &&
                    // Only close nodes affect each other:
                    // Not dragged:
                    !node.fixedPosition &&
                    (layout.options.seriesInteraction ||
                        node.series === repNode.series)) {
                    distanceXY = layout.getDistXY(node, repNode);
                    distanceR = (layout.vectorLength(distanceXY) -
                        (node.marker.radius +
                            repNode.marker.radius +
                            bubblePadding));
                    // TODO padding configurable
                    if (distanceR < 0) {
                        node.degree += 0.01;
                        node.neighbours++;
                        force = layout.repulsiveForce(-distanceR / Math.sqrt(node.neighbours), layout.k, node, repNode);
                    }
                    layout.force('repulsive', node, force * repNode.mass, distanceXY, repNode, distanceR);
                }
            });
        });
    },
    applyLimitBox: function (node) {
        var layout = this, distanceXY, distanceR, factor = 0.01;
        // parentNodeLimit should be used together
        // with seriesInteraction: false
        if (layout.options.splitSeries &&
            !node.isParentNode &&
            layout.options.parentNodeLimit) {
            distanceXY = layout.getDistXY(node, node.series.parentNode);
            distanceR = (node.series.parentNodeRadius -
                node.marker.radius -
                layout.vectorLength(distanceXY));
            if (distanceR < 0 &&
                distanceR > -2 * node.marker.radius) {
                node.plotX -= distanceXY.x * factor;
                node.plotY -= distanceXY.y * factor;
            }
        }
        Reingold.prototype.applyLimitBox.apply(this, arguments);
    }
});
// Remove accumulated data points to redistribute all of them again
// (i.e after hiding series by legend)
addEvent(Chart, 'beforeRedraw', function () {
    // eslint-disable-next-line no-invalid-this
    if (this.allDataPoints) {
        // eslint-disable-next-line no-invalid-this
        delete this.allDataPoints;
    }
});


text:
package mf.org.apache.xerces.dom3.as;

/**
 * @deprecated
 * Models a general entity declaration in an abstract schema. The abstract
 * schema does not handle any parameter entity. It is assumed that the
 * parameter entities are expanded by the implementation as the abstract
 * schema is built.
 *
See also the Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification.
 */
public interface ASEntityDeclaration extends ASObject {
    // EntityType
    /**
     * constant defining an internal entity.
     */
    public static final short INTERNAL_ENTITY           = 1;
    /**
     * constant defining an external entity.
     */
    public static final short EXTERNAL_ENTITY           = 2;

    /**
     * The type of the entity as defined above.
     */
    public short getEntityType();
    /**
     * The type of the entity as defined above.
     */
    public void setEntityType(short entityType);

    /**
     * The replacement text for the internal entity. The entity references
     * within the replacement text are kept intact. For an entity of type
     * EXTERNAL_ENTITY, this is null.
     */
    public String getEntityValue();
    /**
     * The replacement text for the internal entity. The entity references
     * within the replacement text are kept intact. For an entity of type
     * EXTERNAL_ENTITY, this is null.
     */
    public void setEntityValue(String entityValue);

    /**
     * the URI reference representing the system identifier for the notation
     * declaration, if present, null otherwise.
     */
    public String getSystemId();
    /**
     * the URI reference representing the system identifier for the notation
     * declaration, if present, null otherwise.
     */
    public void setSystemId(String systemId);

    /**
     * The string representing the public identifier for this notation
     * declaration, if present; null otherwise.
     */
    public String getPublicId();
    /**
     * The string representing the public identifier for this notation
     * declaration, if present; null otherwise.
     */
    public void setPublicId(String publicId);

}


text:
package reply

import "hawx.me/code/iirc/message"

//"<user mode string>"
const RPL_UMODEIS = "221"

func UserModeIs(host, nick string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_UMODEIS,
		message.Params([]string{nick, "+"}))
}


text:
package net.meisen.dissertation.model.dimensions;

import net.meisen.dissertation.exceptions.DescriptorDimensionException;
import net.meisen.general.genmisc.exceptions.ForwardedRuntimeException;
import net.meisen.general.genmisc.types.Objects;

/**
 * A level defined for a {@code DescriptorDimension}.
 *
 * @author pmeisen
 *
 */
public class DescriptorLevel {

	private final String id;
	private final DescriptorHierarchy owner;

	private String name;

	/**
	 * Constructor specifying the {@code id} and the {@code owner} of the level.
	 *
	 * @param id
	 *            the identifier
	 * @param owner
	 *            the owning {@code DescriptorHierarchy}
	 */
	public DescriptorLevel(final String id, final DescriptorHierarchy owner) {
		this(id, id, owner);
	}

	/**
	 * Constructor specifying the {@code id} and the {@code owner} of the level.
	 *
	 * @param id
	 *            the identifier
	 * @param name
	 *            the name of the level
	 * @param owner
	 *            the owning {@code DescriptorHierarchy}
	 */
	public DescriptorLevel(final String id, final String name,
			final DescriptorHierarchy owner) {
		if (owner == null) {
			throw new ForwardedRuntimeException(
					DescriptorDimensionException.class, 1007, id);
		}

		this.id = id;
		this.name = name;
		this.owner = owner;
	}

	/**
	 * Gets the identifier of the level.
	 *
	 * @return the identifier of the level
	 */
	public String getId() {
		return id;
	}

	/**
	 * Gets the name of the level.
	 *
	 * @return the name of the level
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name of the level.
	 *
	 * @param name
	 *            the name of the level
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * Gets the hierarchy {@code this} belongs to.
	 *
	 * @return the hierarchy {@code this} belongs to
	 */
	public DescriptorHierarchy getHierachy() {
		return owner;
	}

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

	@Override
	public boolean equals(final Object obj) {
		if (obj == this) {
			return true;
		} else if (obj == null) {
			return false;
		} else if (obj instanceof DescriptorLevel) {
			final DescriptorLevel cmpLevel = (DescriptorLevel) obj;
			return Objects.equals(id, cmpLevel.getId())
					&& Objects.equals(getHierachy(), cmpLevel.getHierachy());
		} else {
			return false;
		}
	}

	@Override
	public String toString() {
		return "[" + owner.getId() + "]: " + getName() + " (" + getId() + ")";
	}
}


text:
/**
 * mock session service
 *
 */
import Ember from 'ember';
export default Ember.Service.extend({
  isAuthenticated: true,
  token: 'FAKETOKEN123',
  currentUser: {fullName:'testmy mctest', username:'testymctest'},
  portal: {},
  clear(){
    this.set('token', null);
    this.set('isAuthenticated', false);
  }
});


text:
Given /^collection "(.*?)" with (\d+) products$/ do |collection, num|
  @collection = FactoryGirl.create(:collection, name: collection)
  num.times { FactoryGirl.create(:product, collection: @collection) }
end

Then /^I should see (\d+) products$/ do |num|
  all('#list tbody tr').count.should == num
end


text:
@interface HYRingVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) NSMutableArray *dataArray;
@end
static NSString *ID = @"cell";
@implementation HYRingVC
- (NSMutableArray *)dataArray
{
    if (!_dataArray) {
        _dataArray = [NSMutableArray array];
    }
    return _dataArray;
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self.view addSubview:self.tableView];
        [self loadData];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createView];

}
- (void)createView
{

    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, HYScreenWidth, HYScreenHeight)];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [_tableView registerClass:[HYDailyCell class] forCellReuseIdentifier:ID];
    UIView *tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, HYScreenWidth, HYValue(242))];
//    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    tableHeaderView.backgroundColor = [UIColor whiteColor];
    _tableView.scrollIndicatorInsets = UIEdgeInsetsMake(HYValue(182), 0, 0, 0);
    _tableView.tableHeaderView = tableHeaderView;

}

- (void)loadData
{
    [HYNetworking getWithUrl:RingURL refreshCache:YES params:nil success:^(id response) {
        HYLog(@"data ===   %@",response);
        NSDictionary *dictData = [response[@"data"] objectForKey:@"products"];
        for (NSDictionary *dic in dictData) {
            HYDailyModel *model = [[HYDailyModel alloc] initWithDictionary:dic];
            [_dataArray addObject:model];

            HYLog(@"count =======     %ld",self.dataArray.count);

        }

        [self.tableView reloadData];

    } fail:^(NSError *error) {

    }];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [self.dataArray count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    HYLog(@"count1 ==  %ld",(unsigned long)_dataArray.count );
    return _dataArray.count;

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return HYValue(340);
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    HYDailyCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[HYDailyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    cell.model = [self.dataArray objectAtIndex:indexPath.row];
    return cell;

}

@end


text:
set -e

# Load common constants and variables.
. "$(dirname "$0")/common.sh"

usage() {
    echo "Usage $PROG image [config]"
}

main() {
    # We want to catch all the discrepancies, not just the first one.
    # So, any time we find one, we set testfail=1 and continue.
    # When finished we will use testfail to determine our exit value.
    local testfail=0

    if [ $# -ne 1 ] && [ $# -ne 2 ]; then
        usage
        exit 1
    fi

    local image="$1"

    # Default config location: same name/directory as this script,
    # with a .config file extension, ie ensure_no_nonrelease_files.config.
    local configfile="$(dirname "$0")/${0/%.sh/.config}"
    # Or, maybe a config was provided on the command line.
    if [ $# -eq 2 ]; then
        configfile="$2"
    fi
    # Either way, load test-expectations data from config.
    . "$configfile" || return 1

    local rootfs=$(make_temp_dir)
    mount_image_partition_ro "$image" 3 "$rootfs"

    for file in ${RELEASE_FILE_BLACKLIST[@]}; do
        if [ -e "$rootfs/$file" ]; then
            echo "FAIL: $file exists in this image!"
            ls -al "$rootfs/$file"
            testfail=1
        fi
    done

    # Verify that session_manager isn't configured to pass additional
    # environment variables or command-line arguments to Chrome.
    local config_path="$rootfs/etc/chrome_dev.conf"
    local matches=$(grep -s "^[^#]" "${config_path}")
    if [ -n "$matches" ]; then
        echo "FAIL: Found commands in $config_path:"
        echo "$matches"
        testfail=1
    fi

    exit $testfail
}
main "$@"


text:
package javaschool.app.formatters;

public abstract class Formatter {
    public abstract String format(double value, String suffix);

    public abstract String toString();
}


text:
<?php

/**
 * Visit emphasis.
 *
 * Emphasis markup is used to emphasize text inside a paragraph and is
 * rendered, depending on the assigned role, as strong or em tags in HTML.
 *
 * @package Document
 * @version //autogen//
 */
class ezcDocumentEzXmlToDocbookEmphasisHandler extends ezcDocumentElementVisitorHandler
{
    /**
     * Handle a node.
     *
     * Handle / transform a given node, and return the result of the
     * conversion.
     *
     * @param ezcDocumentElementVisitorConverter $converter
     * @param DOMElement $node
     * @param mixed $root
     * @return mixed
     */
    public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )
    {
        $element = $root->ownerDocument->createElement( 'emphasis' );
        $root->appendChild( $element );

        if ( $node->tagName === 'strong' )
        {
            $element->setAttribute( 'Role', 'strong' );
        }

        // Recurse
        $converter->visitChildren( $node, $element );
        return $root;
    }
}

?>


text:
package com.hazelcast.jet.elastic.impl;

import javax.annotation.Nonnull;
import java.io.Serializable;

class Shard implements Serializable {

    private static final long serialVersionUID = 1L;

    private final String index;
    private final int shard;
    // Primary/replica
    private final Prirep prirep;
    private final int docs;
    private final String state;
    private final String ip;
    private final String httpAddress;
    private final String node;

    Shard(@Nonnull String index, int shard, @Nonnull Prirep prirep, int docs,
          @Nonnull String state, @Nonnull String ip, @Nonnull String httpAddress,
          @Nonnull String node) {

        this.index = index;
        this.shard = shard;
        this.prirep = prirep;
        this.docs = docs;
        this.state = state;
        this.ip = ip;
        this.httpAddress = httpAddress;
        this.node = node;
    }

    public String indexShard() {
        return index + "-" + shard;
    }

    public String getIndex() {
        return index;
    }

    public int getShard() {
        return shard;
    }

    public Prirep getPrirep() {
        return prirep;
    }

    public int getDocs() {
        return docs;
    }

    public String getState() {
        return state;
    }

    public String getIp() {
        return ip;
    }

    public String getHttpAddress() {
        return httpAddress;
    }

    public String getNode() {
        return node;
    }

    public enum Prirep {
        /**
         * Primary
         */
        p,

        /**
         * Replica
         */
        r;
    }

    @Override
    public String toString() {
        return "Shard{" +
                "index='" + index + '\'' +
                ", shard=" + shard +
                ", prirep=" + prirep +
                ", docs=" + docs +
                ", state='" + state + '\'' +
                ", ip='" + ip + '\'' +
                ", httpAddress='" + httpAddress + '\'' +
                ", node='" + node + '\'' +
                '}';
    }
}


text:
import zenScroll from 'zenscroll';

function ScrollTo() {
    const defaultDuration = 400
    const edgeOffset = 1
    zenScroll.setup(defaultDuration, edgeOffset)
}

export default ScrollTo;


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip">

    <TextView
        android:id="@+id/number"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_marginRight="6dip"
        android:gravity="center_vertical"
        android:text="00"
        android:textSize="24sp"
        android:background="@drawable/circle"
        android:paddingLeft="4sp"
        android:paddingRight="4sp"
        android:layout_marginEnd="6dip"
        tools:ignore="HardcodedText" />

    <TextView
        android:id="@+id/secondLine"
        android:layout_width="fill_parent"
        android:layout_height="26dip"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@id/number"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:text="Description"
        android:textSize="12sp"
        android:clickable="false"
        tools:ignore="HardcodedText"
        android:layout_alignParentEnd="true"
        android:layout_toEndOf="@id/number" />

    <TextView
        android:id="@+id/firstLine"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/secondLine"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_alignWithParentIfMissing="true"
        android:layout_toRightOf="@id/number"
        android:gravity="center_vertical"
        android:text="Example application"
        android:textSize="16sp"
        android:layout_alignParentEnd="true"
        tools:ignore="HardcodedText"
        android:layout_toEndOf="@id/number" />

    <androidx.appcompat.widget.SwitchCompat
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/alertSwitch"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="false" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/alertIcon"
        android:src="@drawable/ic_alarm_black_24dp"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/alertSwitch"
        android:layout_toStartOf="@+id/alertSwitch"
        android:contentDescription="@string/alert"
        app:tint="#808080" />

</RelativeLayout>


text:
public class Finalizers {
  private static final Object lock = new Object();
  private static boolean finalized = false;

  private static void expect(boolean v) {
    if (! v) throw new RuntimeException();
  }

  protected void finalize() {
    synchronized (lock) {
      finalized = true;
      lock.notifyAll();
    }
  }

  public static void main(String[] args) throws Exception {
    new Finalizers();

    expect(! finalized);

    synchronized (lock) {
      System.gc();
      lock.wait(5000);
    }

    expect(finalized);

    new Finalizers2();

    finalized = false;

    expect(! finalized);

    synchronized (lock) {
      System.gc();
      lock.wait(5000);
    }

    expect(finalized);
  }

  private static class Finalizers2 extends Finalizers { }

}


text:
from ast import literal_eval
from PIL import Image
import csv
import sys
import convolution

image = Image.open("mandrill.png")
pixels = image.load()
size = image.size

reader = csv.reader(sys.stdin, delimiter=';')
gaussian_blur = convolution.generate_centered_gaussian_convolution_matrix(5, 16, 16)

for line in reader:
    index = literal_eval(line[0])
    x = index[0]
    y = index[1]

    new_pixel = convolution.convolution(convolution.unsharp_kernel, pixels, x, y, size[0], size[1])

    print("{0}\t{1}\t{2}\t{3}\t{4}".format(x, y, int(new_pixel[0]), int(new_pixel[1]), int(new_pixel[2])))


text:
    <meta charset="utf-8">
    <title>ML4ALL - A machine learning conference for the rest of us.</title>

    <meta name="description" content="ML4ALL - A machine learning conference for the rest of us. April 28-30, 2019, Portland, OR">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@ml4all">
    <meta name="twitter:creator" content="@ml4all">
    <meta name="twitter:title" content="ML4ALL - A machine learning conference for the rest of us.">
    <meta name="twitter:description" content="ML4ALL - A machine learning conference for the rest of us. April 28-30, 2019, Portland, OR">
    <meta name="twitter:image" content="ml4all-mascot.png">

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.2/css/bulma.css" integrity="sha256-tzp6mtxeugpv7nF5uY4rqr1ZxZynL8F7G5MCwYxJkmY=" crossorigin="anonymous" />

    <link href="https://fonts.googleapis.com/css?family=Open+Sans|Titillium+Web:400,900" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">

    <link href="ml4all.css" rel="stylesheet">

ML4ALL

April 28-30, 2019 - PDX

          Home
          Attend
          Speak
          Schedule
          Sponsors
          Docs
          About

          Docs
          About

Attending The Conference

Everything you need to know about attending the conference.

Buying Guide

Full Schedule

Schedule Overview

Venue Info

Bike Ride

Travel Guide

Workshops

Lightning Talks

Community

Buying Guide

If you'd like to attend ML4ALL, we have a variety of ticket types available. Have a look below and pick the ticket that looks right for you.

If you have any questions, or would like to apply for a free ticket, please email us at ml4allconf@gmail.com and we'll be glad to help you out!

You could also become a volunteer and receive a complementary ticket, or get a discount code when you submit a proposal to be one of our speakers!

                BUY YOUR TICKET NOW

Independent Ticket

If you are paying for yourself, work at a non-profit, or at a company with less than 10 employees, enjoy this discounted ticket rate.

Corporate Ticket

Purchase a corporate ticket if a company is paying for your attendance. Need help convincing your boss? Email us at ml4allconf@gmail.com for some info on why ML4ALL is worth the expense.

Community Support Ticket

Show your support of the ML4ALL community by purchasing a community support ticket. Your purchase will be considered a sponsorship, and you'll be listed as a community supporter on our website.

You'll also enjoy some special experiences just for community supporters during the event (details to follow).

                BUY YOUR TICKET NOW

Financial Assistance

We have a few opportunities for folks that can't afford the independent tickets, but still want to attend.

Student or Unemployed

If you are enrolled as a student, or don't currently have a source of income, please email us at ml4allconf@gmail.com and we'll give you a discount code to make it more affordable.

Volunteering

Becoming a volunteer for ML4ALL entitles you to a free ticket. We have a ton of stuff to do during the conference, and before. If you'd like to be involved, email us at ml4allconf@gmail.com, and we'll get you signed up!

Apply For a Free Ticket

We understand that not everyone can afford a ticket, or is able to volunteer. That's ok! We've got a few tickets set aside for situations like this.

We handle this on a case-by-case basis, so please send us an email to ml4allconf@gmail.com explaining your situation and we'll do our best to help out.

Schedule Overview

→  Google Calendar  |  Full Schedule  |  Talk Abstracts  ←

SUN 4/28

Workshops

Bossanova Ballroom

 Doors @ 9:00am

9:30am-11:30am
Workshop: TensorFlow Docs Sprint

9:30am-11:30am
Workshop: How to Have Curious Conversations

12:30pm-4:30pm
Workshop: Getting Started w/ Keras/OpenCV

Bike Ride

2:00pm @ Bossanova Ballroom

Join your fellow attendees for a leisurely ride around Portland.

Welcome Reception

7:00pm @ Bossanova Ballroom

Get your badge and mingle. Open bar, special guest speakers, live entertainment, and more!

MON 4/29

Conf Day 1

Bossanova Ballroom
Doors @ 8:00am

Talks from 9:00am-5:00pm

Model Building: Refreshing Yoga Session @ 10:15am

Lunch @ Noon

Lightning Talks @ 1:00pm

Hiring Speed Networking @ 3:00pm

Family Photo @ 5:00pm

Official Party

7:00pm-11:00pm @ Pips & Bounce

NOTE: Minors are welcome, but only until 9pm!

TUE 4/30

Conf Day 2

Bossanova Ballroom
Doors @ 8:00am

Talks from 9:00am-5:00pm

Model Building: Refreshing Yoga Session @ 10:15am

Lunch @ Noon

Lightning Talks @ 1:00pm

Hiring Speed Networking @ 3:00pm

Dinner and Mingle

The conference has ended, but we're all still here. Find some friendly faces and invite them to dinner or #relaxml brunch before you leave the venue!

Find your tribe on Slack, or on Twitter using the hashtag #ml4all.

WED 4/30

#relaxml

Self-organize brunch, hacks, and chill-outs with other attendees using the hashtag #relaxml or the #relaxml Slack channel.

MAIN VENUE

Bossanova Ballroom, on Portland's East Side!

The Bossanova Ballroom is ADA accessible, with some restrictions.

For more info, contact the venue at (503) 206-7630

TRAVEL GUIDE

Wondering where to stay and how to get around once you get into Portland? The conference will be held at the Bossanova Ballroom, in Portland's Central Eastside Industrial district, and most conference events will be held within just a few blocks of the main venue.

Where to stay

We are not working with any of the hotels for attendee accommodations, but there are many hotels available within walking distance of the venue:

Jupiter Hotel

Eastside Lodge

Motel 6

Inn at the Convention Center

Hotel Eastlund

DoubleTree by Hilton

How to get around

Portland is a very accessible city and there are many transportation options available, public and otherwise.

Flying Into Portland

Portland International Airport (PDX) is a great airport, with direct flights from many destinations.

If you are traveling from outside the US, please contact us at ml4allconf@gmail.com to obtain an offer letter from the conference to help with your border entry.

The MAX

The MAX is Portland's major light-rail system. The MAX primarily connects Portland with the surrounding cities, such as Gresham, Beaverton, Clackamas, and Hillsboro.

If you're flying into Portland Airport (PDX), we recommend taking the MAX into downtown Portland. There is a MAX station for the red line in the airport itself.

The venue is along East Burnside Street at 7th Ave, just east of the river and Burnside Bridge. The closest Red Line stop to the Bossanova Ballroom is at NE 7th Ave.

Streetcars and Buses

Portland also has a separate streetcar network which criss-crosses the MAX lines. These, along with Portland's extensive bus network, ought to suffice.

The streetcars run along SE Grand and MLK Blvd. The closest stops to the venue are at Burnside Street.

Taxi Companies

While Portland does have Lyft and Uber, they may not always be available. There are several reliable local taxi companies:

Radio Cab

Broadway Cab

Portland Taxi

Please note that it is not common to hail taxis in Portland, and that your best bet is to call in advance.

Bike Rentals

There are two bike rental companies in downtown Portland that may be good options if you want to experience Portland by bike (which we very much recommend!):

Waterfront Bikes

Cycle Portland

Portland also has bike share sponsored by Nike called BIKETOWN which is very easy to use and available widely throughout the Eastside and Downtown.

Eating

Portland is an amazing food city. Here are some resources that will help you find something good to eat:

The Eater38 is a great resource for delightful food.

Willamette Week's Restaurant Guide

Urban Spoon's Best of Portland

Food Carts Portland

COMMUNITY

Stay connected with the community!

Follow us on Twitter at @ml4all

Chat with us in Slack

        <form method="post" action="http://ml4all.us16.list-manage.com/subscribe/post?u=71e48387a8d6ff3798a79e8a3&id=bfc873875c" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate="" _lpchecked="1">

GET UPDATES

Join the mailing list!

              <input size="35" type="text" placeholder="Email Address" value="" name="EMAIL" class="required email textbox input" id="mce-EMAIL" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email address';}">

              <input type="submit" value="Sign Up" name="subscribe" id="mc-embedded-subscribe" class="button is-info">

        </form>

            © ML4ALL Conference 2019 - Code of Conduct


text:
import React from "react";
import { mount } from "enzyme";
import { expect } from "chai";

import Home from "../../../app/containers/home";
import ElementItem from "../../../app/components/element-list/element-item";

describe("ElementItem", () => {
  beforeEach(() => {

  });

  afterEach(() => {

  });

  it("should render", () => {
    const wrapper = mount(
      <Home>
        <ElementItem />
      </Home>
    );

    expect(wrapper).to.be.ok;
  });
});


text:
from django import template
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
from django.test import RequestFactory

from djangocms_page_sitemap.models import PageSitemapProperties

from .base import BaseTest

class RobotsTest(BaseTest):
    def _test_robots_tag(self, template_string, context, expected):

        tpl_obj = template.Template(template_string)
        ctx_obj = template.Context(context)
        rendered = tpl_obj.render(ctx_obj)
        self.assertEqual(rendered, expected)
        for key, value in context.items():
            self.assertEqual(ctx_obj.get(key), value)

    def test_robots_tag_no_request(self):
        template = "{% load robots_index %}{% page_robots %}"
        context = {}
        self._test_robots_tag(template, context, "")

    def test_robots_tag_request_no_page(self):
        template = "{% load robots_index %}{% page_robots %}"
        request = RequestFactory().get("/")
        request.session = {}
        context = {"request": request}
        self._test_robots_tag(template, context, "")

    def test_robots_options(self):
        page1, page2, page3 = self.get_pages()
        extension = PageSitemapProperties.objects.create(extended_object=page1, priority="0.2", changefreq="never")

        template = "{% load robots_index %}{% page_robots %}"
        expected = '<meta name="robots" content="">'
        context = {"request": self.get_page_request(page1, AnonymousUser())}
        self._test_robots_tag(template, context, expected)

        extension.noindex = True
        extension.save()
        expected = '<meta name="robots" content="noindex">'
        self._test_robots_tag(template, context, expected)

        extension.noarchive = True
        extension.save()
        expected = '<meta name="robots" content="noindex,noarchive">'
        self._test_robots_tag(template, context, expected)

        extension.robots_extra = "nodmoz"
        extension.save()
        expected = '<meta name="robots" content="noindex,noarchive,nodmoz">'
        self._test_robots_tag(template, context, expected)

    def test_robots_page_parameter(self):
        page1, page2, page3 = self.get_pages()
        extension = PageSitemapProperties.objects.create(extended_object=page1, priority="0.2", changefreq="never")
        page1.publish("en")
        extension.refresh_from_db()

        template = "{% load robots_index %}{% page_robots %}"
        expected = ""
        context = {"request": self.get_page_request(page2.get_public_object(), AnonymousUser())}
        self._test_robots_tag(template, context, expected)

        extension.noindex = True
        extension.save()
        page1.publish("en")
        expected = ""
        self._test_robots_tag(template, context, expected)

        template = "{%% load robots_index %%}{%% page_robots %s %%}" % page1.pk
        expected = '<meta name="robots" content="noindex">'
        self._test_robots_tag(template, context, expected)

        extension.noarchive = True
        extension.save()
        page1.publish("en")
        expected = '<meta name="robots" content="noindex,noarchive">'
        self._test_robots_tag(template, context, expected)

        extension.robots_extra = "nodmoz"
        extension.save()
        page1.publish("en")
        expected = '<meta name="robots" content="noindex,noarchive,nodmoz">'
        self._test_robots_tag(template, context, expected)

    def test_robots_page_no_site(self):
        page1, page2, page3 = self.get_pages()
        extension = PageSitemapProperties.objects.create(extended_object=page1, priority="0.2", changefreq="never")
        page1.publish("en")
        extension.refresh_from_db()

        template = '{% load robots_index %}{% page_robots None "abc" %}'
        expected = ""
        context = {"request": self.get_page_request(page2.get_public_object(), AnonymousUser())}
        self._test_robots_tag(template, context, expected)

    def test_robots_page_no_page(self):
        page1, page2, page3 = self.get_pages()
        extension = PageSitemapProperties.objects.create(extended_object=page1, priority="0.2", changefreq="never")
        page1.publish("en")
        extension.refresh_from_db()

        template = '{% load robots_index %}{% page_robots "abc" %}'
        expected = ""
        context = {"request": self.get_page_request(page2.get_public_object(), AnonymousUser())}
        self._test_robots_tag(template, context, expected)

    def test_robots_page_other_site(self):
        site_2 = Site.objects.create(domain="http://othersite.com")
        page1, page2, page3 = self.get_pages()
        extension = PageSitemapProperties.objects.create(extended_object=page1, priority="0.2", changefreq="never")
        page1.publish("en")
        extension.refresh_from_db()

        template = "{%% load robots_index %%}{%% page_robots None %s %%}" % site_2.pk
        expected = ""
        context = {"request": self.get_page_request(page2.get_public_object(), AnonymousUser())}
        self._test_robots_tag(template, context, expected)


text:
<aiml version="1.0">

<!-- This category works with the Standard AIML Set -->
<category>
<pattern>LOAD AIML B</pattern>
<template>

<!-- Load standard AIML set -->
<learn>standard/std-*.aiml</learn>
<learn>standard/custom-dev-scripts.aiml</learn>
</template>
</category>

</aiml>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using System.Reflection;

namespace Eris.Controllers
{
    [Route("api/[controller]")]
    public class RootController : Controller
    {

        [HttpGet]
        public IActionResult Get()
        {
            var list = Assembly.GetEntryAssembly().GetTypes()
                .Where(w => w.Namespace == "Eris.Dto")
                .Select(s => s.Name)
                .ToList();
            return Ok(list);
        }

    }
}


text:
<?php

namespace Ds\Component\Formio\Model\Attribute;

/**
 * Trait ExternalIds
 *
 * @package Ds\Component\Formio
 */
trait ExternalIds
{
    /**
     * @var array
     */
    private $externalIds; # region accessors

    /**
     * Set external ids
     *
     * @param array $externalIds
     * @return object
     */
    public function setExternalIds(array $externalIds)
    {
        $this->externalIds = $externalIds;

        return $this;
    }

    /**
     * Get external ids
     *
     * @return array
     */
    public function getExternalIds(): array
    {
        return $this->externalIds;
    }

    # endregion
}


text:
using namespace muduo;
using namespace muduo::net;

typedef std::map<string, string> UserMap;
UserMap users;

string getUser(const string& user)
{
  string result = "No such user";
  UserMap::iterator it = users.find(user);
  if (it != users.end())
  {
    result = it->second;
  }
  return result;
}

void onMessage(const TcpConnectionPtr& conn,
               Buffer* buf,
               Timestamp receiveTime)
{
  const char* crlf = buf->findCRLF();
  if (crlf)
  {
    string user(buf->peek(), crlf);
    conn->send(getUser(user) + "\r\n");
    buf->retrieveUntil(crlf + 2);
    conn->shutdown();
  }
}

int main()
{
  EventLoop loop;
  TcpServer server(&loop, InetAddress(1079), "Finger");
  server.setMessageCallback(onMessage);
  server.start();
  loop.loop();
}


text:
module Language.TaPL.TypedBoolean.Parser (parseString, parseFile) where

import qualified Text.Parsec.Token as Token
import Text.Parsec.Language (emptyDef)
import Text.Parsec.Prim (parse)
import Text.Parsec.String (Parser)
import Control.Applicative ((<|>))

import Language.TaPL.TypedBoolean.Syntax (Term(..))

-- This module is adapted from: http://www.haskell.org/haskellwiki/Parsing_a_simple_imperative_language

booleanDef =
  emptyDef { Token.reservedNames = [ "if"
                                   , "then"
                                   , "else"
                                   , "true"
                                   , "false"
                                   ]
           }

lexer = Token.makeTokenParser booleanDef
reserved   = Token.reserved   lexer -- parses a reserved name
parens     = Token.parens     lexer -- parses surrounding parenthesis:
                                    --   parens p
                                    -- takes care of the parenthesis and
                                    -- uses p to parse what's inside them
whiteSpace = Token.whiteSpace lexer -- parses whitespace

booleanParser :: Parser Term
booleanParser = whiteSpace >> expr

expr :: Parser Term
expr =   parens expr
     <|> ifExpr
     <|> (reserved "true" >> return TmTrue)
     <|> (reserved "false" >> return TmFalse)

ifExpr :: Parser Term
ifExpr = do reserved "if"
            t1 <- expr
            reserved "then"
            t2 <- expr
            reserved "else"
            t3 <- expr
            return $ TmIf t1 t2 t3

parseString :: String -> Term
parseString str =
  case parse booleanParser "" str of
    Left e  -> error $ show e
    Right t -> t

parseFile :: String -> IO Term
parseFile file =
  do program  <- readFile file
     case parse booleanParser "" program of
       Left e  -> print e >> fail "parse error"
       Right t -> return t


text:
import Vue from 'vue/dist/vue.esm'
import Vuex from 'vuex'
import * as getters from './getters'
import * as actions from './actions'
import mutations from './mutations'
import CurrentUserAssignService from '../../../shared/services/current_user_assign_service'

Vue.use(Vuex)

const state = {
  currentUser: CurrentUserAssignService.call('<%= normalized_scope_name %>'),
  flashMessages: [],
  queryString: {},
  retryCounter: 0,
}

export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations
})


text:
import {requiredParameter} from './../Helpers/ECMAScriptHelpers';
import ScrollProxyObserver from './../Core/ScrollProxyObserver';
import DomHelpers from './../Helpers/DomHelpers';

class ScrollAdvancedStickyObserver extends ScrollProxyObserver {

  static SCROLL_DIRECTION = {
    UP: 'UP',
    DOWN: 'DOWN'
  };

  constructor(
    stickyCandidateElementA = requiredParameter(),
    stickyCandidateElementB = requiredParameter(),
    container = requiredParameter(),
    {
      triggerOffset = 0,
      stickyOffsetTop = 0,
      stickyOffsetBottom = 0,
      stickyInnerOffsetTop = 0,
      stickyInnerOffsetBottom = 0
    } = {}) {
    super();

    this.stickyIsNeeded = false;

    // Sticky, candidates, and container
    this.stickyElement = null;
    this.stickyCandidateElementA = stickyCandidateElementA;
    this.stickyCandidateElementB = stickyCandidateElementB;
    this.containerElement = container;

    // Sticky and container boundaries
    this.triggerOffset = triggerOffset;
    this.stickyOffsetTop = stickyOffsetTop;
    this.stickyOffsetBottom = stickyOffsetBottom;
    this.stickyInnerOffsetTop = stickyInnerOffsetTop;
    this.stickyInnerOffsetBottom = stickyInnerOffsetBottom;

    // Cached values
    this.maxStickyTranslate = -1;
    this.maxStickyInnerTranslateY = 0;
    this.stickyExceedsViewport = false;
    this.stickyRect = {};
    this.containerRect = {};

    // Inner translation
    this.latestKnownScrollY = 0;
    this.latestKnownScrollYDelta = 0;
    this.scrollDirection = null;

    this.init();
  }

  init() {
    this.reset();

    // Set if sticky is needed and if so, which stickySubject will play as the sticky element
    this.promoteStickyCandidates(this.stickyCandidateElementA, this.stickyCandidateElementB);
    this.containerRect = this.containerElement.getBoundingClientRect();
    this.stickyIsNeeded = this.stickyRect.height + this.stickyOffsetBottom < this.containerRect.height;

    if (!this.stickyIsNeeded) {
      return;
    }

    this.latestKnownScrollY = window.pageYOffset;

    this.stickyExceedsViewport = this.stickyRect.height + this.stickyInnerOffsetTop + this.stickyInnerOffsetBottom > this.viewportSize.height;
    this.maxStickyTranslate = this.containerRect.height - (this.stickyRect.height + this.stickyOffsetBottom);
    this.maxStickyInnerTranslateY = this.stickyRect.height + this.stickyInnerOffsetBottom - this.viewportSize.height;

    // sticky break limit
    this.maxST = this.stickyExceedsViewport
      ? this.containerRect.height - this.viewportSize.height + this.triggerOffset + (this.stickyInnerOffsetBottom - this.stickyOffsetBottom)
      : this.maxStickyTranslate - this.stickyOffsetTop + this.triggerOffset;

    // Set width (for fixed state)
    this.stickyElement.style.width = `${this.stickyRect.width}px`;

    this.onScroll(this.scrollPosition);
    this.updateDOM();
  }

  promoteStickyCandidates(candidateA, candidateB) {
    const candidateARect = candidateA.getBoundingClientRect(),
      candidateBRect = candidateB.getBoundingClientRect();

    if (candidateARect.height > candidateBRect.height) {
      this.stickyElement = candidateB;
      this.stickyRect = candidateBRect;
    } else {
      this.stickyElement = candidateA;
      this.stickyRect = candidateARect;
    }
  }

  setOffsets({
    triggerOffset = 0,
    stickyOffsetTop = 0,
    stickyOffsetBottom = 0,
    stickyInnerOffsetTop = 0,
    stickyInnerOffsetBottom = 0
  } = {}) {
    this.triggerOffset = triggerOffset;
    this.stickyOffsetTop = stickyOffsetTop;
    this.stickyOffsetBottom = stickyOffsetBottom;
    this.stickyInnerOffsetTop = stickyInnerOffsetTop;
    this.stickyInnerOffsetBottom = stickyInnerOffsetBottom;
    this.init();
  }

  reset() {
    if (this.stickyElement !== null) {
      this.stickyElement.style.width = 'auto';
      this.stickyElement.style.position = 'relative';
      this.stickyElement.style.left = 'auto';
      this.stickyElement.style.top = '0px';
      this.stickyElement.style.transform = 'none';
    }
  }

  isRunning() {
    return super.isRunning() && this.stickyIsNeeded;
  }

  onScroll(scrollPosition) {
    if (!this.isRunning()) {
      return;
    }

    this.setScrollPosition(scrollPosition);

    this.stickyRect = this.stickyElement.getBoundingClientRect();
    this.containerRect = this.containerElement.getBoundingClientRect();

    if (this.stickyExceedsViewport) {
      this.scrollDirection = this.latestKnownScrollY > this.scrollPosition.y
        ? ScrollAdvancedStickyObserver.SCROLL_DIRECTION.UP
        : ScrollAdvancedStickyObserver.SCROLL_DIRECTION.DOWN;
      this.latestKnownScrollYDelta = this.latestKnownScrollY - this.scrollPosition.y;
      this.latestKnownScrollY = this.scrollPosition.y;
    }
  }

  updateDOM() {
    if (!this.isRunning()) {
      return;
    }

    const stickyCondition = this.stickyExceedsViewport
      ? this.containerRect.top - this.triggerOffset + (this.stickyOffsetTop - this.stickyInnerOffsetTop) < 0
      : this.containerRect.top - this.triggerOffset < 0;

    if (stickyCondition) {
      const stickyTranslate = Math.min(Math.abs(this.containerRect.top - this.triggerOffset), this.maxST);

      if (stickyTranslate === this.maxST) {
        this.stickyElement.style.position = 'absolute';
        this.stickyElement.style.top = `${this.maxStickyTranslate}px`;
        this.stickyElement.style.left = 'auto';
        this.stickyElement.style.transform = 'none';
      } else {
        const top = this.stickyExceedsViewport
          ? Math.round(
            Math.min(
              Math.max(this.stickyRect.top + this.latestKnownScrollYDelta, -this.maxStickyInnerTranslateY),
              this.stickyInnerOffsetTop
            ))
          : this.stickyOffsetTop;

        this.stickyElement.style.position = 'fixed';
        this.stickyElement.style.top = '0px';
        this.stickyElement.style.left = `${this.stickyRect.left}px`;
        DomHelpers.setTransform(this.stickyElement, {y: top});
      }
    } else {
      this.stickyElement.style.position = 'relative';
      this.stickyElement.style.top = '0px';
      this.stickyElement.style.left = 'auto';
      this.stickyElement.style.transform = 'none';
    }
  }

  onResize(viewportSize) {
    super.onResize(viewportSize);
    this.reset();
    this.init();
  }

  destroy() {
    super.destroy();
    this.reset();
  }
}

export default ScrollAdvancedStickyObserver;


text:
package processbuilder;

public interface ProcessBuilderFactory {
    ProcessBuilder getProcessBuilder(String... command);
}