text:
import {Entity} from "../../../../../../src/decorator/entity/Entity";
import {PrimaryColumn} from "../../../../../../src/decorator/columns/PrimaryColumn";
import {Column} from "../../../../../../src/decorator/columns/Column";

@Entity()
export class Post {

    @PrimaryColumn()
    id: number;

    @Column()
    name: string;

    // -------------------------------------------------------------------------
    // Numeric Types
    // -------------------------------------------------------------------------

    @Column("integer")
    integer: number;

    @Column("int4")
    int4: number;

    @Column("int")
    int: number;

    @Column("smallint")
    smallint: number;

    @Column("int2")
    int2: number;

    @Column("bigint")
    bigint: string;

    @Column("int8")
    int8: string;

    @Column("numeric")
    numeric: string;

    @Column("decimal")
    decimal: string;

    @Column("double precision")
    doublePrecision: number;

    @Column("float8")
    float8: number;

    @Column("real")
    real: number;

    @Column("float4")
    float4: number;

    // -------------------------------------------------------------------------
    // Monetary Types
    // -------------------------------------------------------------------------

    @Column("money")
    money: string;

    // -------------------------------------------------------------------------
    // Character Types
    // -------------------------------------------------------------------------

    @Column("char")
    char: string;

    @Column("character")
    character: string;

    @Column("varchar")
    varchar: string;

    @Column("character varying")
    characterVarying: string;

    @Column("text")
    text: string;

    @Column("citext")
    citext: string;

    @Column("hstore")
    hstore: string;

    // -------------------------------------------------------------------------
    // Binary Data Types
    // -------------------------------------------------------------------------

    @Column("bytea")
    bytea: Buffer;

    // -------------------------------------------------------------------------
    // Date/Time Types
    // -------------------------------------------------------------------------

    @Column("date")
    date: string;

    @Column("interval")
    interval: any;

    @Column("time")
    time: string;

    @Column("time with time zone")
    timeWithTimeZone: string;

    @Column("timetz")
    timetz: string;

    @Column("timestamp")
    timestamp: Date;

    @Column("timestamp with time zone")
    timestampWithTimeZone: Date;

    @Column("timestamptz")
    timestamptz: Date;

    // -------------------------------------------------------------------------
    // Boolean Type
    // -------------------------------------------------------------------------

    @Column("boolean")
    boolean: boolean;

    @Column("bool")
    bool: boolean;

    // -------------------------------------------------------------------------
    // Enumerated Type
    // -------------------------------------------------------------------------

    @Column("enum", { enum: ["A", "B", "C"] })
    enum: string;

    // -------------------------------------------------------------------------
    // Geometric Type
    // -------------------------------------------------------------------------

    @Column("point")
    point: string|Object;

    @Column("line")
    line: string;

    @Column("lseg")
    lseg: string|string[];

    @Column("box")
    box: string|Object;

    @Column("path")
    path: string;

    @Column("polygon")
    polygon: string;

    @Column("circle")
    circle: string|Object;

    // -------------------------------------------------------------------------
    // Network Address Type
    // -------------------------------------------------------------------------

    @Column("cidr")
    cidr: string;

    @Column("inet")
    inet: string;

    @Column("macaddr")
    macaddr: string;

    // -------------------------------------------------------------------------
    // Bit String Type
    // -------------------------------------------------------------------------

    @Column("bit")
    bit: string;

    @Column("varbit")
    varbit: string;

    @Column("bit varying")
    bitVarying: string;

    // -------------------------------------------------------------------------
    // UUID Type
    // -------------------------------------------------------------------------

    @Column("uuid")
    uuid: string;

    // -------------------------------------------------------------------------
    // XML Type
    // -------------------------------------------------------------------------

    @Column("xml")
    xml: string;

    // -------------------------------------------------------------------------
    // JSON Type
    // -------------------------------------------------------------------------

    @Column("json")
    json: Object;

    @Column("jsonb")
    jsonb: Object;

    // -------------------------------------------------------------------------
    // Range Type
    // -------------------------------------------------------------------------

    @Column("int4range")
    int4range: string;

    @Column("int8range")
    int8range: string;

    @Column("numrange")
    numrange: string;

    @Column("tsrange")
    tsrange: string;

    @Column("tstzrange")
    tstzrange: string;

    @Column("daterange")
    daterange: string;

    // -------------------------------------------------------------------------
    // Array Type
    // -------------------------------------------------------------------------

    @Column("int", { array: true })
    array: number[];

    // -------------------------------------------------------------------------
    // TypeOrm Specific Types
    // -------------------------------------------------------------------------

    @Column("simple-array")
    simpleArray: string[];

    @Column("simple-json")
    simpleJson: { param: string };

    @Column("simple-enum", { enum: ["A", "B", "C"] })
    simpleEnum: string;
}


text:
#undef HAVE_PTHREAD

//
// Define and set to 1 if the target system supports POSIX semaphores
// and you want OpenEXR to use them; otherwise, OpenEXR will use its
// own semaphore implementation.
//

#undef HAVE_POSIX_SEMAPHORES

redpajama_set_name: RedPajamaGithub


text:
package main

import (
	"errors"
	"fmt"
	"log"
	"strconv"
	"time"

	"github.com/boltdb/bolt"
)

// Takes a Bolt database, tenant's name as a string and port for the tenant as an int
// and puts the key-value pair (tenant, port) in the DB
func AddTenant(db *bolt.DB, tenant string, port int) error {
	return db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket([]byte("tenants"))
		err := b.Put([]byte(tenant), []byte(strconv.Itoa(port)))
		return err
	})
}

// Gets the port for a tenant from the provided DB
func GetTenantPort(db *bolt.DB, tenant string) (int, error) {
	var port []byte
	err := db.View(func(tx *bolt.Tx) error {
		b := tx.Bucket([]byte("tenants"))
		port = b.Get([]byte(tenant))
		return nil
	})
	if err != nil {
		return 0, err
	}

	if port == nil {
		return 0, errors.New(fmt.Sprintf("Can't get the port for tenant '%s' from database", tenant))
	}
	return strconv.Atoi(string(port))
}

func InitDB(file string) *bolt.DB {
	db, err := bolt.Open(file, 0600, &bolt.Options{Timeout: 3 * time.Second})
	if err != nil {
		log.Fatal(err)
	}

	err = db.Update(func(tx *bolt.Tx) error {
		_, err := tx.CreateBucketIfNotExists([]byte("tenants"))
		return err
	})
	if err != nil {
		log.Fatal(err)
	}

	return db
}


text:
import os
basedir = os.path.abspath(os.path.dirname(__file__))

class BaseConfig(object):
    SECRET_KEY = 'my_precious'
    DEBUG = True
    BCRYPT_LOG_ROUNDS = 13
    SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:postgres@database/postgres'
    SQLALCHEMY_TRACK_MODIFICATIONS = False


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_recommend_tags"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#f0f0f0"
    android:orientation="vertical"
    tools:context="com.zhanghao.skinexpert.Activity.RecommendTagsActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="#ffffff">

        <ImageView
            android:id="@+id/recommendtags_iv_back"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:src="@mipmap/ic_return_back" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="15dp"
            android:text="推荐标签"
            android:textColor="#000000"
            android:textSize="22sp" />
    </RelativeLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:layout_margin="10dp"
        android:background="#ffffff"
        android:onClick="search"
        android:text="搜索标签"
        android:textColor="#f0f0f0"
        android:textSize="18sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="horizontal">

            <ListView
                android:id="@+id/recommendtags_left_listview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:divider="@null"
                android:dividerHeight="0dp">

            </ListView>
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:orientation="horizontal">

            <ListView
                android:id="@+id/recommendtags_right_listview"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            </ListView>

        </LinearLayout>
    </LinearLayout>

</LinearLayout>


text:
package htmlParserGandhi;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class DomParser {
	private Document dom;
	private List<Text> texts = new ArrayList<Text>();

	public DomParser(String file) {

		try {
			File input = new File(file);
			this.dom = Jsoup.parse(input, "UTF-8", "");

			Elements elements = this.dom.getElementsByTag(Constants.PAGE_CONTAINER_TAG);
			Element element = elements.first();
			Text.canIgnore = true;
			for (Element page : element.getElementsByClass("calibre")) {
				for (Element child : page.getAllElements()) {
					Text text = new Text(child);
					this.texts.add(text);
				}
			}
		} catch (IOException ioe) {

		}

	}

	public String getPages() {
		String data = "";
		for (int i = 0; i < texts.size(); i++) {
			Text text = texts.get(i);
			if (text.containsBold()) {
				data = String.format(Constants.NEWLINE_JOIN_TEMPLATE, data, Constants.PAGE_DECORATION_BOUNDARY);
			}
			if (!text.canIgnore()) {
				data = String.format(Constants.NEWLINE_JOIN_TEMPLATE, data, text.getData());
			}
		}
		return data;
	}
}


text:
Package name is TBD.

## What is `express-routes` ?

## Usage

## How to run the examples

    # start the app
    cd examples/simple
    node app.js
    # goto http://localhost:3000/


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>repost: DWCon and innovation</title>
    <meta name="description" content="" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="https://thomaszahr.github.io/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//thomaszahr.github.io/themes/casper/assets/css/screen.css?v=1488357325536" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://thomaszahr.github.io/2017/03/01/repost-DW-Cn-and-innovation.html" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="crumblingbiscuit" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="repost: DWCon and innovation" />
    <meta property="og:description" content="Reblogged from the defunct: crumblingbiscuit.calepin.co Date: 2012-09-05 20:00 Title: DWCon and innovation Category: sustainability Tags: innovation Recently the 7ath Discworld Convention was held in Birmingham. And very lovely it was too. Lot&#8217;s and lot&#8217;s of Discwold fans, many great programme items, from the" />
    <meta property="og:url" content="https://thomaszahr.github.io/2017/03/01/repost-DW-Cn-and-innovation.html" />
    <meta property="article:tag" content="reblogged" />
    <meta property="article:tag" content=" innovation" />

    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="repost: DWCon and innovation" />
    <meta name="twitter:description" content="Reblogged from the defunct: crumblingbiscuit.calepin.co Date: 2012-09-05 20:00 Title: DWCon and innovation Category: sustainability Tags: innovation Recently the 7ath Discworld Convention was held in Birmingham. And very lovely it was too. Lot&#8217;s and lot&#8217;s of Discwold fans, many great programme items, from the" />
    <meta name="twitter:url" content="https://thomaszahr.github.io/2017/03/01/repost-DW-Cn-and-innovation.html" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="crumblingbiscuit" href="https://thomaszahr.github.io/rss/" />

repost: DWCon and innovation

                <time class="post-date" datetime="2017-03-01">01 March 2017</time>  on reblogged,  innovation

Reblogged from the defunct: crumblingbiscuit.calepin.co

Date: 2012-09-05 20:00
Title: DWCon and innovation
Category: sustainability
Tags: innovation

Recently the 7ath Discworld Convention was held in Birmingham. And very lovely it was too.

Lot’s and lot’s of Discwold fans, many great programme items, from the guest of honour interview to the hedgehog party, from workshops on knots to a discworld masquerade.

What has that got to do with innovation?

Well, nothing, but, …

In the week or so after the Con, looking at the posts on the mailing list, the remarks on Twitter under #dwcon, and the number of views my photos on Flickr garnered made me realise that the convention was actually two conventions.

The convention as published in the official programme

The convention that actually happened in the heads of the con-goers

There is of course a relation between the two cons, but it is not a very explicit one, it is possible to read the programme and have no idea about the real convention, and it is equally possible to take part in the convention without being in any way clear about the structure of the written programme.

And all that contrasted in my mind with the expecation on the product development process of quite a few of the engineers and others in the product development projects I’m involved with. And what they expect is a process that describes in detail who needs to do what when and how. Detailing exact roles and responsibilities, detailing precise steps and methods.

Quite a difference. In design. In expectation. In execution. In outcomes.

So, DWCon shows a way towards sustainable innovation processes. Or something.

                thomaszahr's Picture

thomaszahr

Read more posts by this author.

Share this post

                    Twitter

                    Facebook

                    Google+

          Please enable JavaScript to view the comments powered by Disqus.
          comments powered by Disqus

crumblingbiscuit © 2017

Proudly published with HubPress


text:
import urllib2
import time
import os
import datetime
import sys
from random import randint

def menu():
	sane = 1
	while sane == 1:
		print "[ - ] Please enter absolute path to output directory: "
		in_path = raw_input()+"\\tweeter_scraper_out"
		if os.path.exists(in_path):
			sane = 0
		else:
			try:
				os.mkdir(in_path)
				sane = 0
			except:
				os.system('cls' if os.name == 'nt' else 'clear')
				print "[ - ] Invalid path, try again."
	return(in_path)

def main(in_path):
	print "[ + ] Gathering information..."
	in_path = in_path
	target_list = []
	done_list = []
	cnt = 0

	while True:
		if cnt != 0:
			rand = randint(5,180)
			print "[ - ] Sleeping "+str(rand)+" seconds until check for new items."
			time.sleep(rand)
		try:
			resp = urllib2.urlopen("https://twitter.com/dumpmon")
		except:
			tmp_t = randint(360,720)
			time.sleep(tmp_t)
			print "[ - ] Communication error, sleeping "+str(tmp_t)+" seconds..."
		html = resp.readlines()
		out_log = in_path+"\\out_log.txt"
		out_log_fo = open(out_log, 'a+')
		out_log_items = out_log_fo.readlines()

		for done in out_log_items:
			if done.strip() not in done_list:
				done_list.append(done.strip())

		for line in html:
			if "data-expanded-url=" in line:
				startCut = line.find('data-expanded-url=')+18
				endCut = line[startCut:len(line)].find(' class=')+startCut
				target = line[startCut+1:endCut-1]
				target_list.append(target)

		for targ in target_list:
			if targ not in done_list:
				try:
					time.sleep(randint(1,15))
					resp = urllib2.urlopen(targ)
				except urllib2.HTTPError:
					print "[ - ] Caught a 404, will try one more time in 2-4 minutes..."
					time.sleep(randint(120,240))
					try:
						resp = urllib2.urlopen(targ)
					except urllib2.HTTPError:
						print "[ - ] 404, "+targ+", skipping, "+str(time.strftime("%m%d%y_%H%M%S"))
						out_log_fo.write(targ+"\n")
						continue
				html = resp.read()
				if html.strip() == "Please refresh the page to continue...":
					page = "http://pastebin.com/"+targ[targ.rfind("=")+1:len(targ)]
					print "[ - ] Attempting... "+page
					resp = urllib2.urlopen(page)
					html = resp.read()
					start_raw_cut = html.find('<textarea id="paste_code" class="paste_code" name="paste_code" onkeydown="return catchTab(this,event)">')+103
					end_raw_cut = html[start_raw_cut:len(html)].find('</textarea>')+start_raw_cut
					html = html[start_raw_cut:end_raw_cut]
				time_det = str(time.strftime("%m%d%y_%H%M%S"))
				dump_file = in_path+"\\"+time_det+'.txt'
				dump_file_fo = open(dump_file, 'w')
				dump_file_fo.write(html)
				dump_file_fo.close()
				done_list.append(targ)
				out_log_fo.write(targ+"\n")
				print "[ + ] Dump "+targ+" grabbed @ "+str(time.strftime("%m%d%y_%H%M%S"))
		out_log_fo.close()
		cnt+=1
		print "[ - ] Checked "+str(cnt)+" times."

	out_log_fo.close()

try:
	main(menu())
except KeyboardInterrupt:
	print "[ - ] Interrupt caught, exiting."
	sys.exit(0)


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jparsec</groupId>
    <artifactId>jparsec-root</artifactId>
    <version>3.2-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>jparsec-testutils</artifactId>
  <packaging>jar</packaging>

  <name>jParsec TestUtils</name>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>compile</scope>
    </dependency>

  </dependencies>

</project>


text:
package me.stupideme.embeddedtool.view.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;

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

import me.stupideme.embeddedtool.Constants;
import me.stupideme.embeddedtool.R;

public class DataProtocolFragment extends Fragment {

    //debug
    private static final String TAG = DataProtocolFragment.class.getSimpleName();

    /**
     * protocol changed listener
     */
    private OnDataProtocolChangedListener mListener;

    /**
     * header of protocol
     */
    private EditText mHeader;

    /**
     * tail of protocol
     */
    private EditText mTail;

    public DataProtocolFragment() {
        // Required empty public constructor
    }

    /**
     * get instance of this fragment
     *
     * @return instance
     */
    public static DataProtocolFragment newInstance() {
        DataProtocolFragment fragment = new DataProtocolFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    /**
     * set listener
     *
     * @param listener OnDataProtocolChangedListener
     */
    public void setOnDataProtocolChangedListener(OnDataProtocolChangedListener listener) {
        mListener = listener;
    }

    /**
     * onCreate life circle
     *
     * @param savedInstanceState state
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    /**
     * onCreateView life circle
     *
     * @param inflater           layout inflater
     * @param container          container
     * @param savedInstanceState state
     * @return view
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_settings_protocol, container, false);
        mHeader = (EditText) root.findViewById(R.id.edit_text_header);
        mTail = (EditText) root.findViewById(R.id.edit_text_tail);
        FloatingActionButton fab = (FloatingActionButton) root.findViewById(R.id.fab);
        //set on click listener
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Map<String, String> map = new HashMap<>();
                if (!mHeader.getText().toString().isEmpty() /*&& !mTail.getText().toString().isEmpty()*/) {
                    map.put(Constants.KEY_DATA_HEADER, mHeader.getText().toString());
                    map.put(Constants.KEY_DATA_TAIL, mTail.getText().toString());
                    Log.v(TAG, "tail: " + mTail.getText().toString());
                    mListener.onSaveProtocol(map);
                    Toast.makeText(getActivity(), "数据已保存!", Toast.LENGTH_SHORT).show();
                } else
                    Toast.makeText(getActivity(), "消息头部或者尾部不能为空!", Toast.LENGTH_SHORT).show();

            }
        });

        //load all data protocol when create view
        setDataProtocol();

        return root;
    }

    /**
     * attach activity
     *
     * @param context activity
     */
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof OnDataProtocolChangedListener) {
            mListener = (OnDataProtocolChangedListener) context;
        } else {
            throw new RuntimeException(context.toString()
                    + " must implement OnDataProtocolChangedListener");
        }
    }

    /**
     * detach activity
     */
    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    /**
     * recovery default protocol from database
     *
     * @param list a list contains default protocol
     */
    public void recoveryDefault(List<Map<String, String>> list) {
        Log.v(TAG, String.valueOf(list.size()));
        for (Map<String, String> map : list) {
            if (map.containsKey(Constants.KEY_DATA_HEADER)) {
                mHeader.setText(map.get(Constants.KEY_DATA_HEADER));
                Log.v(TAG, map.get(Constants.KEY_DATA_HEADER));
            }
            if (map.containsKey(Constants.KEY_DATA_TAIL)) {
                mTail.setText(map.get(Constants.KEY_DATA_TAIL));
                Log.v(TAG, map.get(Constants.KEY_DATA_TAIL));
            }
        }
    }

    /**
     * set protocol when fragment created
     */
    private void setDataProtocol() {
        List<Map<String, String>> list = mListener.getDataProtocol();
        for (Map<String, String> map : list) {
            if (map.containsKey(Constants.KEY_DATA_HEADER)) {
                mHeader.setText(map.get(Constants.KEY_DATA_HEADER));
                Log.v(TAG, map.get(Constants.KEY_DATA_HEADER));
            }
            if (map.containsKey(Constants.KEY_DATA_TAIL)) {
                mTail.setText(map.get(Constants.KEY_DATA_TAIL));
                Log.v(TAG, map.get(Constants.KEY_DATA_TAIL));
            }
        }
    }

    /**
     * a callback interface to save custom protocol
     */
    public interface OnDataProtocolChangedListener {

        /**
         * save custom protocol
         *
         * @param map a map contains custom protocol
         */
        void onSaveProtocol(Map<String, String> map);

        /**
         * get protocol from database
         *
         * @return a list
         */
        List<Map<String, String>> getDataProtocol();
    }
}


text:
package ch.heigvd.amt.gamy.services.dao;

import javax.ejb.Local;

/**
 * LoginServiceLocal is an interface where the minimal implementation is
 * defined. All the following method must be implemented to use it correctly.
 */
@Local
public interface LoginServiceLocal {

   /**
    * This method check if the credential about the account is correct.
    * Check if the user could connect to Gamy.
    * @param email is the email address of the user.
    * @param password is his password in plain text.
    * @return true is the credential are correct.
    */
   boolean isLoginSucceed(String email, String password);
}


text:
<?php
//
// After including cdash_test_case.php, subsequent require_once calls are
// relative to the top of the CDash source tree
//
require_once(dirname(__FILE__).'/cdash_test_case.php');

class ViewSubProjectDependenciesTestCase extends KWWebTestCase
{
  function __construct()
    {
    parent::__construct();
    }

  function testViewSubProjectDependencies()
    {
    $this->login();
    $this->get($this->url."/viewSubProjectDependencies.php?project=SubProjectExample");
    if(strpos($this->getBrowser()->getContentAsText(), "Komplex") === false)
      {
      $this->fail("'Komplex' not found when expected");
      return 1;
      }
    $this->pass("Passed");
    }
}
?>


text:
$(function () {

   $.support.transition = false;
   var fx = $('#async-fixture');

   module("date", {
        setup: function(){
            $.fn.editable.defaults.name = 'name1';
        },
        teardown: function(){
            $.fn.editable.defaults.name = undefined;
        }
    });

    asyncTest("popover should contain datepicker with value and save new entered date", function () {
        expect(9);
        var d = '15.05.1984',
            e = $(''+d+'').appendTo(fx).editable({
                format: 'dd.mm.yyyy',
                datepicker: {

                }
            }),
            nextD = '16.05.1984';

          $.mockjax({
              url: 'post-date.php',
              response: function(settings) {
                  equal(settings.data.value, nextD, 'submitted value correct');
              }
          });

        equal(e.data('editable').value, d, 'value correct');

        e.click();
        var p = e.data('popover').$tip;
        ok(p.find('.datepicker').is(':visible'), 'datepicker exists');

        equal(e.data('editable').value, d, 'day set correct');
        equal(p.find('td.day.active').text(), 15, 'day shown correct');
        equal(p.find('th.dow').eq(0).text(), 'Mo', 'weekStart correct');

        //set new day
        p.find('td.day.active').next().click();
        p.find('form').submit();

        setTimeout(function() {
           ok(!p.is(':visible'), 'popover closed')
           equal(e.data('editable').value, nextD, 'new date saved to value')
           equal(e.text(), nextD, 'new text shown')
           e.remove();
           start();
        }, timeout);

     });

     asyncTest("viewformat, init by text", function () {
        expect(9);
        var dview = '15/05/1984',
            d = '1984-05-15',
            e = $(''+dview+'').appendTo(fx).editable({
                format: 'yyyy-mm-dd',
                viewformat: 'dd/mm/yyyy',
                datepicker: {

                }
            }),
            nextD = '1984-05-16',
            nextDview = '16/05/1984';

          equal(e.data('editable').value, d, 'value correct');

          $.mockjax({
              url: 'post-date1.php',
              response: function(settings) {
                  equal(settings.data.value, nextD, 'submitted value correct');
              }
          });

        e.click();
        var p = e.data('popover').$tip;
        ok(p.find('.datepicker').is(':visible'), 'datepicker exists');

        equal(e.data('editable').$input.data('datepicker').getFormattedDate(), d, 'day set correct');
        equal(p.find('td.day.active').text(), 15, 'day shown correct');
        equal(p.find('th.dow').eq(0).text(), 'Mo', 'weekStart correct');

        //set new day
        p.find('td.day.active').next().click();
        p.find('form').submit();

        setTimeout(function() {
           ok(!p.is(':visible'), 'popover closed')
           equal(e.data('editable').value, nextD, 'new date saved to value')
           equal(e.text(), nextDview, 'new text shown in correct format')
           e.remove();
           start();
        }, timeout);

     });

     test("viewformat, init by value", function () {
        var dview = '15/05/1984',
            d = '1984-05-15',
            e = $('').appendTo('#qunit-fixture').editable({
                format: 'yyyy-mm-dd',
                viewformat: 'dd/mm/yyyy'
            });

        equal(e.data('editable').value, d, 'value correct');
        equal(e.text(), dview, 'text correct');
     });

     test("input should contain today if element is empty", function () {
        var e = $('').appendTo('#qunit-fixture').editable();
        e.click();
        var p = e.data('popover').$tip,
            date1 = e.data('editable').$input.data('datepicker').date,
            date2 = new Date();

        equal(date1.setTime(0,0,0), date2.setTime(0,0,0), 'today set correct');

        p.find('button[type=button]').click();
        ok(!p.is(':visible'), 'popover closed');
      });

});


text:
class Model
    def initialize(id, properties)
        @id = id
        @properties = properties
    end

    def id
        @id
    end

    def properties
        @properties
    end

    def to_s
        "#{id}"
    end
end


text:
namespace Rocket.Chat.Net.Tests.Integration
{
    using System.Threading.Tasks;

    using Rocket.Chat.Net.Driver;
    using Rocket.Chat.Net.Tests.Helpers;

    using Xunit;
    using Xunit.Abstractions;

    [Trait("Category", "Sandbox")]
    public class SandboxFacts : DriverFactsBase
    {
        // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
        private readonly ITestOutputHelper _helper;
        private readonly XUnitLogger _xUnitLogger;

        public SandboxFacts(ITestOutputHelper helper) : base(helper)
        {
            _helper = helper;
            _xUnitLogger = new XUnitLogger(_helper);
        }

        [Fact(Skip = "skip")]
        public async Task Can_login()
        {
            //const string password = "SilverLight";

            //var driver = new RocketChatDriver("demo.rocket.chat", true, _xUnitLogger);

            var driver = new RocketChatDriver(Constants.RocketServer, false, _xUnitLogger);

            await driver.ConnectAsync();
            var loginResult = await driver.LoginWithEmailAsync(Constants.OneEmail, Constants.OnePassword);

            var roomId = await driver.GetRoomIdAsync("GENERAL");

            await driver.JoinRoomAsync(roomId.Result);

            await driver.SubscribeToRoomAsync(roomId.Result);

            var messages = await driver.SendMessageAsync("", roomId.Result);

            driver.Dispose();
        }

        [Fact(Skip = "skip")]
        public async Task Send_attachments()
        {
            //const string password = "SilverLight";

            //var driver = new RocketChatDriver("demo.rocket.chat", true, _xUnitLogger);
            var userName = Constants.OneEmail;
            var password = Constants.OnePassword;

            var driver = new RocketChatDriver(Constants.RocketServer, false, _xUnitLogger);

            await driver.ConnectAsync();
            await driver.LoginWithEmailAsync(userName, password);

            var roomId = await driver.GetRoomIdAsync("GENERAL");

            //var a = await driver.SendCustomMessageAsync("test mesage", "name", roomId.Result);

            driver.Dispose();
        }

        [Fact(Skip = "skip")]
        public async Task Clean_up_rooms()
        {
            // Act
            await DefaultAccountLoginAsync();
            await CleanupRoomsAsync();

            // Assert
        }

        public override void Dispose()
        {
            _xUnitLogger.Dispose();
        }
    }
}


text:
/**
 */
package activity;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

/**
 *
 * The Package for the model.
 * It contains accessors for the meta objects to represent
 *

 *
each class,

 *
each feature of each class,

 *
each operation of each class,

 *
each enum,

 *
and each data type

 *

 *
 * @see activity.ActivityFactory
 * @model kind="package"
 * @generated
 */
public interface ActivityPackage extends EPackage {
	/**
	 * The package name.
	 *
	 *
	 * @generated
	 */
	String eNAME = "activity";

	/**
	 * The package namespace URI.
	 *
	 *
	 * @generated
	 */
	String eNS_URI = "http://activity/1.0";

	/**
	 * The package namespace name.
	 *
	 *
	 * @generated
	 */
	String eNS_PREFIX = "activity";

	/**
	 * The singleton instance of the package.
	 *
	 *
	 * @generated
	 */
	ActivityPackage eINSTANCE = activity.impl.ActivityPackageImpl.init();

	/**
	 * The meta object id for the '{@link activity.impl.ResourceTypeImpl Resource Type}' class.
	 *
	 *
	 * @see activity.impl.ResourceTypeImpl
	 * @see activity.impl.ActivityPackageImpl#getResourceType()
	 * @generated
	 */
	int RESOURCE_TYPE = 0;

	/**
	 * The feature id for the 'Name' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RESOURCE_TYPE__NAME = 0;

	/**
	 * The feature id for the 'Resource' reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RESOURCE_TYPE__RESOURCE = 1;

	/**
	 * The number of structural features of the 'Resource Type' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RESOURCE_TYPE_FEATURE_COUNT = 2;

	/**
	 * The number of operations of the 'Resource Type' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RESOURCE_TYPE_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.PredicatImpl Predicat}' class.
	 *
	 *
	 * @see activity.impl.PredicatImpl
	 * @see activity.impl.ActivityPackageImpl#getPredicat()
	 * @generated
	 */
	int PREDICAT = 1;

	/**
	 * The number of structural features of the 'Predicat' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int PREDICAT_FEATURE_COUNT = 0;

	/**
	 * The number of operations of the 'Predicat' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int PREDICAT_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.RuleImpl Rule}' class.
	 *
	 *
	 * @see activity.impl.RuleImpl
	 * @see activity.impl.ActivityPackageImpl#getRule()
	 * @generated
	 */
	int RULE = 2;

	/**
	 * The feature id for the 'Predicat' reference list.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RULE__PREDICAT = 0;

	/**
	 * The number of structural features of the 'Rule' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RULE_FEATURE_COUNT = 1;

	/**
	 * The number of operations of the 'Rule' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RULE_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.ActivityImpl Activity}' class.
	 *
	 *
	 * @see activity.impl.ActivityImpl
	 * @see activity.impl.ActivityPackageImpl#getActivity()
	 * @generated
	 */
	int ACTIVITY = 3;

	/**
	 * The feature id for the 'Periodicite' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__PERIODICITE = 0;

	/**
	 * The feature id for the 'Res alloc' containment reference list.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__RES_ALLOC = 1;

	/**
	 * The feature id for the 'Rule' containment reference list.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__RULE = 2;

	/**
	 * The feature id for the 'Fin' containment reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__FIN = 3;

	/**
	 * The feature id for the 'Debut' containment reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__DEBUT = 4;

	/**
	 * The feature id for the 'Atelier' reference list.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__ATELIER = 5;

	/**
	 * The feature id for the 'Activites' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY__ACTIVITES = 6;

	/**
	 * The number of structural features of the 'Activity' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY_FEATURE_COUNT = 7;

	/**
	 * The number of operations of the 'Activity' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int ACTIVITY_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.ModelImpl Model}' class.
	 *
	 *
	 * @see activity.impl.ModelImpl
	 * @see activity.impl.ActivityPackageImpl#getModel()
	 * @generated
	 */
	int MODEL = 4;

	/**
	 * The feature id for the 'EReference0' reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int MODEL__EREFERENCE0 = 0;

	/**
	 * The feature id for the 'Activity' containment reference list.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int MODEL__ACTIVITY = 1;

	/**
	 * The feature id for the 'Res type' containment reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int MODEL__RES_TYPE = 2;

	/**
	 * The number of structural features of the 'Model' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int MODEL_FEATURE_COUNT = 3;

	/**
	 * The number of operations of the 'Model' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int MODEL_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.DateImpl Date}' class.
	 *
	 *
	 * @see activity.impl.DateImpl
	 * @see activity.impl.ActivityPackageImpl#getDate()
	 * @generated
	 */
	int DATE = 5;

	/**
	 * The feature id for the 'Day' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int DATE__DAY = 0;

	/**
	 * The feature id for the 'Month' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int DATE__MONTH = 1;

	/**
	 * The number of structural features of the 'Date' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int DATE_FEATURE_COUNT = 2;

	/**
	 * The number of operations of the 'Date' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int DATE_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.impl.Res_AllocImpl Res Alloc}' class.
	 *
	 *
	 * @see activity.impl.Res_AllocImpl
	 * @see activity.impl.ActivityPackageImpl#getRes_Alloc()
	 * @generated
	 */
	int RES_ALLOC = 6;

	/**
	 * The feature id for the 'Duration' attribute.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RES_ALLOC__DURATION = 0;

	/**
	 * The feature id for the 'Res type' containment reference.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RES_ALLOC__RES_TYPE = 1;

	/**
	 * The number of structural features of the 'Res Alloc' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RES_ALLOC_FEATURE_COUNT = 2;

	/**
	 * The number of operations of the 'Res Alloc' class.
	 *
	 *
	 * @generated
	 * @ordered
	 */
	int RES_ALLOC_OPERATION_COUNT = 0;

	/**
	 * The meta object id for the '{@link activity.Month Month}' enum.
	 *
	 *
	 * @see activity.Month
	 * @see activity.impl.ActivityPackageImpl#getMonth()
	 * @generated
	 */
	int MONTH = 7;

	/**
	 * The meta object id for the '{@link activity.Periodicite Periodicite}' enum.
	 *
	 *
	 * @see activity.Periodicite
	 * @see activity.impl.ActivityPackageImpl#getPeriodicite()
	 * @generated
	 */
	int PERIODICITE = 8;

	/**
	 * The meta object id for the '{@link activity.Activites Activites}' enum.
	 *
	 *
	 * @see activity.Activites
	 * @see activity.impl.ActivityPackageImpl#getActivites()
	 * @generated
	 */
	int ACTIVITES = 9;

	/**
	 * Returns the meta object for class '{@link activity.ResourceType Resource Type}'.
	 *
	 *
	 * @return the meta object for class 'Resource Type'.
	 * @see activity.ResourceType
	 * @generated
	 */
	EClass getResourceType();

	/**
	 * Returns the meta object for the attribute '{@link activity.ResourceType#getName Name}'.
	 *
	 *
	 * @return the meta object for the attribute 'Name'.
	 * @see activity.ResourceType#getName()
	 * @see #getResourceType()
	 * @generated
	 */
	EAttribute getResourceType_Name();

	/**
	 * Returns the meta object for the reference '{@link activity.ResourceType#getResource Resource}'.
	 *
	 *
	 * @return the meta object for the reference 'Resource'.
	 * @see activity.ResourceType#getResource()
	 * @see #getResourceType()
	 * @generated
	 */
	EReference getResourceType_Resource();

	/**
	 * Returns the meta object for class '{@link activity.Predicat Predicat}'.
	 *
	 *
	 * @return the meta object for class 'Predicat'.
	 * @see activity.Predicat
	 * @generated
	 */
	EClass getPredicat();

	/**
	 * Returns the meta object for class '{@link activity.Rule Rule}'.
	 *
	 *
	 * @return the meta object for class 'Rule'.
	 * @see activity.Rule
	 * @generated
	 */
	EClass getRule();

	/**
	 * Returns the meta object for the reference list '{@link activity.Rule#getPredicat Predicat}'.
	 *
	 *
	 * @return the meta object for the reference list 'Predicat'.
	 * @see activity.Rule#getPredicat()
	 * @see #getRule()
	 * @generated
	 */
	EReference getRule_Predicat();

	/**
	 * Returns the meta object for class '{@link activity.Activity Activity}'.
	 *
	 *
	 * @return the meta object for class 'Activity'.
	 * @see activity.Activity
	 * @generated
	 */
	EClass getActivity();

	/**
	 * Returns the meta object for the attribute '{@link activity.Activity#getPeriodicite Periodicite}'.
	 *
	 *
	 * @return the meta object for the attribute 'Periodicite'.
	 * @see activity.Activity#getPeriodicite()
	 * @see #getActivity()
	 * @generated
	 */
	EAttribute getActivity_Periodicite();

	/**
	 * Returns the meta object for the containment reference list '{@link activity.Activity#getRes_alloc Res alloc}'.
	 *
	 *
	 * @return the meta object for the containment reference list 'Res alloc'.
	 * @see activity.Activity#getRes_alloc()
	 * @see #getActivity()
	 * @generated
	 */
	EReference getActivity_Res_alloc();

	/**
	 * Returns the meta object for the containment reference list '{@link activity.Activity#getRule Rule}'.
	 *
	 *
	 * @return the meta object for the containment reference list 'Rule'.
	 * @see activity.Activity#getRule()
	 * @see #getActivity()
	 * @generated
	 */
	EReference getActivity_Rule();

	/**
	 * Returns the meta object for the containment reference '{@link activity.Activity#getFin Fin}'.
	 *
	 *
	 * @return the meta object for the containment reference 'Fin'.
	 * @see activity.Activity#getFin()
	 * @see #getActivity()
	 * @generated
	 */
	EReference getActivity_Fin();

	/**
	 * Returns the meta object for the containment reference '{@link activity.Activity#getDebut Debut}'.
	 *
	 *
	 * @return the meta object for the containment reference 'Debut'.
	 * @see activity.Activity#getDebut()
	 * @see #getActivity()
	 * @generated
	 */
	EReference getActivity_Debut();

	/**
	 * Returns the meta object for the reference list '{@link activity.Activity#getAtelier Atelier}'.
	 *
	 *
	 * @return the meta object for the reference list 'Atelier'.
	 * @see activity.Activity#getAtelier()
	 * @see #getActivity()
	 * @generated
	 */
	EReference getActivity_Atelier();

	/**
	 * Returns the meta object for the attribute '{@link activity.Activity#getActivites Activites}'.
	 *
	 *
	 * @return the meta object for the attribute 'Activites'.
	 * @see activity.Activity#getActivites()
	 * @see #getActivity()
	 * @generated
	 */
	EAttribute getActivity_Activites();

	/**
	 * Returns the meta object for class '{@link activity.Model Model}'.
	 *
	 *
	 * @return the meta object for class 'Model'.
	 * @see activity.Model
	 * @generated
	 */
	EClass getModel();

	/**
	 * Returns the meta object for the reference '{@link activity.Model#getEReference0 EReference0}'.
	 *
	 *
	 * @return the meta object for the reference 'EReference0'.
	 * @see activity.Model#getEReference0()
	 * @see #getModel()
	 * @generated
	 */
	EReference getModel_EReference0();

	/**
	 * Returns the meta object for the containment reference list '{@link activity.Model#getActivity Activity}'.
	 *
	 *
	 * @return the meta object for the containment reference list 'Activity'.
	 * @see activity.Model#getActivity()
	 * @see #getModel()
	 * @generated
	 */
	EReference getModel_Activity();

	/**
	 * Returns the meta object for the containment reference '{@link activity.Model#getRes_type Res type}'.
	 *
	 *
	 * @return the meta object for the containment reference 'Res type'.
	 * @see activity.Model#getRes_type()
	 * @see #getModel()
	 * @generated
	 */
	EReference getModel_Res_type();

	/**
	 * Returns the meta object for class '{@link activity.Date Date}'.
	 *
	 *
	 * @return the meta object for class 'Date'.
	 * @see activity.Date
	 * @generated
	 */
	EClass getDate();

	/**
	 * Returns the meta object for the attribute '{@link activity.Date#getDay Day}'.
	 *
	 *
	 * @return the meta object for the attribute 'Day'.
	 * @see activity.Date#getDay()
	 * @see #getDate()
	 * @generated
	 */
	EAttribute getDate_Day();

	/**
	 * Returns the meta object for the attribute '{@link activity.Date#getMonth Month}'.
	 *
	 *
	 * @return the meta object for the attribute 'Month'.
	 * @see activity.Date#getMonth()
	 * @see #getDate()
	 * @generated
	 */
	EAttribute getDate_Month();

	/**
	 * Returns the meta object for class '{@link activity.Res_Alloc Res Alloc}'.
	 *
	 *
	 * @return the meta object for class 'Res Alloc'.
	 * @see activity.Res_Alloc
	 * @generated
	 */
	EClass getRes_Alloc();

	/**
	 * Returns the meta object for the attribute '{@link activity.Res_Alloc#getDuration Duration}'.
	 *
	 *
	 * @return the meta object for the attribute 'Duration'.
	 * @see activity.Res_Alloc#getDuration()
	 * @see #getRes_Alloc()
	 * @generated
	 */
	EAttribute getRes_Alloc_Duration();

	/**
	 * Returns the meta object for the containment reference '{@link activity.Res_Alloc#getRes_type Res type}'.
	 *
	 *
	 * @return the meta object for the containment reference 'Res type'.
	 * @see activity.Res_Alloc#getRes_type()
	 * @see #getRes_Alloc()
	 * @generated
	 */
	EReference getRes_Alloc_Res_type();

	/**
	 * Returns the meta object for enum '{@link activity.Month Month}'.
	 *
	 *
	 * @return the meta object for enum 'Month'.
	 * @see activity.Month
	 * @generated
	 */
	EEnum getMonth();

	/**
	 * Returns the meta object for enum '{@link activity.Periodicite Periodicite}'.
	 *
	 *
	 * @return the meta object for enum 'Periodicite'.
	 * @see activity.Periodicite
	 * @generated
	 */
	EEnum getPeriodicite();

	/**
	 * Returns the meta object for enum '{@link activity.Activites Activites}'.
	 *
	 *
	 * @return the meta object for enum 'Activites'.
	 * @see activity.Activites
	 * @generated
	 */
	EEnum getActivites();

	/**
	 * Returns the factory that creates the instances of the model.
	 *
	 *
	 * @return the factory that creates the instances of the model.
	 * @generated
	 */
	ActivityFactory getActivityFactory();

	/**
	 *
	 * Defines literals for the meta objects that represent
	 *

	 *
each class,

	 *
each feature of each class,

	 *
each operation of each class,

	 *
each enum,

	 *
and each data type

	 *

	 *
	 * @generated
	 */
	interface Literals {
		/**
		 * The meta object literal for the '{@link activity.impl.ResourceTypeImpl Resource Type}' class.
		 *
		 *
		 * @see activity.impl.ResourceTypeImpl
		 * @see activity.impl.ActivityPackageImpl#getResourceType()
		 * @generated
		 */
		EClass RESOURCE_TYPE = eINSTANCE.getResourceType();

		/**
		 * The meta object literal for the 'Name' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute RESOURCE_TYPE__NAME = eINSTANCE.getResourceType_Name();

		/**
		 * The meta object literal for the 'Resource' reference feature.
		 *
		 *
		 * @generated
		 */
		EReference RESOURCE_TYPE__RESOURCE = eINSTANCE.getResourceType_Resource();

		/**
		 * The meta object literal for the '{@link activity.impl.PredicatImpl Predicat}' class.
		 *
		 *
		 * @see activity.impl.PredicatImpl
		 * @see activity.impl.ActivityPackageImpl#getPredicat()
		 * @generated
		 */
		EClass PREDICAT = eINSTANCE.getPredicat();

		/**
		 * The meta object literal for the '{@link activity.impl.RuleImpl Rule}' class.
		 *
		 *
		 * @see activity.impl.RuleImpl
		 * @see activity.impl.ActivityPackageImpl#getRule()
		 * @generated
		 */
		EClass RULE = eINSTANCE.getRule();

		/**
		 * The meta object literal for the 'Predicat' reference list feature.
		 *
		 *
		 * @generated
		 */
		EReference RULE__PREDICAT = eINSTANCE.getRule_Predicat();

		/**
		 * The meta object literal for the '{@link activity.impl.ActivityImpl Activity}' class.
		 *
		 *
		 * @see activity.impl.ActivityImpl
		 * @see activity.impl.ActivityPackageImpl#getActivity()
		 * @generated
		 */
		EClass ACTIVITY = eINSTANCE.getActivity();

		/**
		 * The meta object literal for the 'Periodicite' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute ACTIVITY__PERIODICITE = eINSTANCE.getActivity_Periodicite();

		/**
		 * The meta object literal for the 'Res alloc' containment reference list feature.
		 *
		 *
		 * @generated
		 */
		EReference ACTIVITY__RES_ALLOC = eINSTANCE.getActivity_Res_alloc();

		/**
		 * The meta object literal for the 'Rule' containment reference list feature.
		 *
		 *
		 * @generated
		 */
		EReference ACTIVITY__RULE = eINSTANCE.getActivity_Rule();

		/**
		 * The meta object literal for the 'Fin' containment reference feature.
		 *
		 *
		 * @generated
		 */
		EReference ACTIVITY__FIN = eINSTANCE.getActivity_Fin();

		/**
		 * The meta object literal for the 'Debut' containment reference feature.
		 *
		 *
		 * @generated
		 */
		EReference ACTIVITY__DEBUT = eINSTANCE.getActivity_Debut();

		/**
		 * The meta object literal for the 'Atelier' reference list feature.
		 *
		 *
		 * @generated
		 */
		EReference ACTIVITY__ATELIER = eINSTANCE.getActivity_Atelier();

		/**
		 * The meta object literal for the 'Activites' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute ACTIVITY__ACTIVITES = eINSTANCE.getActivity_Activites();

		/**
		 * The meta object literal for the '{@link activity.impl.ModelImpl Model}' class.
		 *
		 *
		 * @see activity.impl.ModelImpl
		 * @see activity.impl.ActivityPackageImpl#getModel()
		 * @generated
		 */
		EClass MODEL = eINSTANCE.getModel();

		/**
		 * The meta object literal for the 'EReference0' reference feature.
		 *
		 *
		 * @generated
		 */
		EReference MODEL__EREFERENCE0 = eINSTANCE.getModel_EReference0();

		/**
		 * The meta object literal for the 'Activity' containment reference list feature.
		 *
		 *
		 * @generated
		 */
		EReference MODEL__ACTIVITY = eINSTANCE.getModel_Activity();

		/**
		 * The meta object literal for the 'Res type' containment reference feature.
		 *
		 *
		 * @generated
		 */
		EReference MODEL__RES_TYPE = eINSTANCE.getModel_Res_type();

		/**
		 * The meta object literal for the '{@link activity.impl.DateImpl Date}' class.
		 *
		 *
		 * @see activity.impl.DateImpl
		 * @see activity.impl.ActivityPackageImpl#getDate()
		 * @generated
		 */
		EClass DATE = eINSTANCE.getDate();

		/**
		 * The meta object literal for the 'Day' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute DATE__DAY = eINSTANCE.getDate_Day();

		/**
		 * The meta object literal for the 'Month' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute DATE__MONTH = eINSTANCE.getDate_Month();

		/**
		 * The meta object literal for the '{@link activity.impl.Res_AllocImpl Res Alloc}' class.
		 *
		 *
		 * @see activity.impl.Res_AllocImpl
		 * @see activity.impl.ActivityPackageImpl#getRes_Alloc()
		 * @generated
		 */
		EClass RES_ALLOC = eINSTANCE.getRes_Alloc();

		/**
		 * The meta object literal for the 'Duration' attribute feature.
		 *
		 *
		 * @generated
		 */
		EAttribute RES_ALLOC__DURATION = eINSTANCE.getRes_Alloc_Duration();

		/**
		 * The meta object literal for the 'Res type' containment reference feature.
		 *
		 *
		 * @generated
		 */
		EReference RES_ALLOC__RES_TYPE = eINSTANCE.getRes_Alloc_Res_type();

		/**
		 * The meta object literal for the '{@link activity.Month Month}' enum.
		 *
		 *
		 * @see activity.Month
		 * @see activity.impl.ActivityPackageImpl#getMonth()
		 * @generated
		 */
		EEnum MONTH = eINSTANCE.getMonth();

		/**
		 * The meta object literal for the '{@link activity.Periodicite Periodicite}' enum.
		 *
		 *
		 * @see activity.Periodicite
		 * @see activity.impl.ActivityPackageImpl#getPeriodicite()
		 * @generated
		 */
		EEnum PERIODICITE = eINSTANCE.getPeriodicite();

		/**
		 * The meta object literal for the '{@link activity.Activites Activites}' enum.
		 *
		 *
		 * @see activity.Activites
		 * @see activity.impl.ActivityPackageImpl#getActivites()
		 * @generated
		 */
		EEnum ACTIVITES = eINSTANCE.getActivites();

	}

} //ActivityPackage


text:
function idFromLabel(label) {
    return label.replace(/\W/g, '');
}

function camelCaseToLabel(name) {
    if (name.indexOf('.') > 0) name = name.split('.')[1];
    return name.replace(/([A-Z])/g, ' $1').replace(/^./, function(str){ return str.toUpperCase(); });
}

function endsWith(label, char) {
    return label.indexOf(char, label.length - char.length) !== -1;
}

// Very simplistic way to turn plural words into singular words
// NOTE: only works on words that end with an 's'.
function singularize(label) {
    label = camelCaseToLabel(label);
    if (endsWith(label, 's')) {
        return label.substring(0, label.length - 1);
    } else {
        return label;
    }
}

function getField(field, name) {
    var defaults = {
        label: camelCaseToLabel(name),

        // signature for options that take functions: (value, doc, modifier)

        // basic validation
        type: 'string',          // validated with typeof check
        required: true,          // or function
        min: null,
        max: null,
        numberStep: null,        // the HTML "step" attribute for 'number' type
        regEx: null,             // or function
        regExMessage: null,      // or function
        customValidation: null,  // function, return [value, error_string] (if no error, set error_string to '')

        // display-related options
        placeholder: '',         // or null to use label for placeholder
        options: null,           // or function
        widget: 'text',
        hidden: false,           // or function
        default: null,           // or function
    };

    var f = _.extend(defaults, field);
    f.name = name;
    if (f.options && !field.widget) f.widget = 'select';
    if (f.type === 'boolean' && !field.widget) f.widget = 'checkbox';
    if (f.type === 'boolean' && !field.options) f.options = [
        {value: true, label: 'Yes'},
        {value: false, label: 'No'}
    ];
    if (f.type === 'boolean' && f.options && f.options.length > 2) throw new Meteor.Error('Boolean can only have two options');

    // convenience method
    f.validate = function(value) {
        return validateField(f, value);
    };

    return f;
}

// handles field options that optionally use functions
function getOption(userId, option, value, doc, modifier) {
    if (typeof option == 'function') {
        return option(userId, value, doc, modifier);
    } else {
        return option;
    }
}

// gets properly formatted list of allow values and labels for a field
function getFieldOptions(userId, field, value, doc, modifier) {
    var options = getOption(userId, field.options, value, doc, modifier);
    if (!options) return options;

    var newOptions = [];
    if (!_.isEmpty(options)) {
        for (var i = 0; i < options.length; i++) {
            if (typeof options[i] == 'object') newOptions.push(options[i]);
            else {
                newOptions.push({value: options[i], label: options[i]});
            }
        }
    }

    return newOptions;
}

function getValue(element) {
    if (element.type == 'checkbox') {
        return element.checked;
    } else {
        return $(element).val();
    }
}

function cleanField(field, value) {
    if (value === null || value === undefined) return value;

    if (field.type == 'number') {
        if (value === '') return undefined;
        if ((typeof value) != 'number') value = Number(value);
    } else if (field.type == 'boolean') {
        if ((typeof value) != 'boolean') {
            if (value === '' || value == '0' || value === 0 || value == 'false') value = false;
            else value = true;
        }
    }

    return value;
}

function validateField(userId, field, value, doc, modifier) {
    if (getOption(userId, field.required, value, doc, modifier) && (value === null || value === undefined || value === '')) return [value, 'This field is required'];
    if (value !== null && value !== undefined && value !== '') {
        if (field.type == 'number') {
            if (field.min && value < field.min) return [value, 'Minimum value is ' + field.min];
            if (field.max && value > field.max) return [value, 'Maximum value is ' + field.max];
        } else if (field.type == 'string' && field.widget != 'list') {
            if (field.min && value.length < field.min) return [value, 'Minimum length is ' + field.min];
            if (field.max && value.length > field.max) return [value, 'Maximum length is ' + field.max];
        }

        if (field.type == 'string') {
            var regEx = getOption(userId, field.regEx, value, doc, modifier);
            if (regEx && value.match(regEx) === null) {
                var regExMessage = getOption(userId, field.regExMessage, value, doc, modifier);
                if (regExMessage) return [value, regExMessage];
                else return [value, 'Does not match pattern'];
            }
        }

        if (field.widget == 'list') {
            var l = [];
            for (var x = 0; x < value.length; x++) {
                var val = value[x];
                if (val) l.push(val);
            }
            if (field.min && _.keys(l).length < field.min) return [value, 'List must have at least ' + field.min + ' items'];
            if (field.max && _.keys(l).length > field.max) return [value, 'List has too many items (max ' + field.max + ')'];
            value = l;
        }

        var options = getFieldOptions(userId, field, value, doc, modifier);
        if (options) {
            var found = false;
            for (var i = 0; i < options.length; i++) {
                var opt = options[i];
                if (value == opt.value) {
                    found = true;
                    break;
                }
            }
            if (!found) return [value, 'Not a valid option'];
        }

        if (field.customValidation) {
            var result = field.customValidation(field, value, doc, modifier);
            return result;
        }
    }

    return [value, ''];
}

function validate(userId, fields, doc, modifier) {
    var foundFields = {};
    if (modifier) {
        if ('$set' in modifier) {
            _.each(modifier.$set, function(item, name) {
                foundFields[name] = item;
            });
        }
    } else {
        _.each(doc, function(item, name) {
            var parentName = name;
            if (typeof item == 'object' && !_.isArray(item)) {
                _.each(item, function(subItem, subName) {
                    foundFields[parentName + '.' + subName] = subItem;
                });
            } else {
                foundFields[name] = item;
            }
        });
    }

    var errorMessages = {};
    _.each(foundFields, function(item, name) {
        if (name in fields) {
            var field = fields[name];
            var result = validateField(userId, field, item, doc, modifier);
            if (result[1]) errorMessages[name] = result[1];
        }
    });

    _.each(fields, function(item, name) {
        if (!getOption(userId, item.required, item.required, doc, modifier)) return;
        if (getOption(userId, item.hidden, item.hidden, doc, modifier)) return;
        if (!(name in foundFields)) {
            errorMessages[name] = 'Field not found';
        }
    });

    return [foundFields, errorMessages];
}

function addListField(field, value) {
    if (!value) value = '';
    var html = '
';
    html += '';
    html += '<input type="text" class="form-control" name="' + field.name + '[]" value="' + value + '" />';
    html += '<button type="button" class="btn btn-danger" onclick="CrudForm.removeListField(this);"></button>';
    html += '
';
    return html;
}

function renderFieldWidget(userId, field, value, doc, modifier) {
    value = cleanField(field, value);
    if (value === null) value = '';
    if (!value && !doc && !modifier && field.default !== null) value = getOption(userId, field.default, value);
    var options = getFieldOptions(userId, field, value, doc, modifier);
    var regExToString = function(regEx) {
        return regEx.toString().slice(1, -1).replace('"', '"');
    };

    var html = '';

    if (field.widget == 'hidden') {
        html += '<input type="hidden" name="' + field.name + '" value="' + value + '" />';
    } else if (field.widget == 'radio') {
        for (var i = 0; i < options.length; i++) {
            var option = options[i];
            html += '<input type="radio" class="form-control" name="' + field.name + '" value="' + option.value + '"';
            if (value == option.value) html += ' checked="checked"';
            html += '>' + option.label + '</input>';
        }
    } else if (field.widget == 'list') {
        html += '
<button type="button" class="btn btn-default" name="' + field.name + '" onclick="CrudForm.addListField(this);">New ' + field.label + '</button>';
        html += '
';
        if (_.isArray(value)) {
            for (var x = 0; x < value.length; x++) {
                html += addListField(field, value[x]);
            }
            setTimeout(CrudForm.sortableListField, 500);  // hack to enable sorting without clickingc
        }
        html += '
';
    } else {
        if (field.widget == 'select') html += '<select ';
        else if (field.widget == 'textarea') html += '<textarea ';
        else if (field.widget == 'checkbox') html += '<input type="checkbox" ';
        else html += '<input type="' + field.widget + '" ';
        html += 'class="form-control" name="' + field.name + '"';
        html += ' onblur="CrudForm.validateField(this);"';

        if (field.widget == 'textarea') {
            html += '>' + _.escape(value) + '</textarea>';
            return html;
        } else if (field.widget == 'checkbox') {
            if (value) html += ' checked="checked"';
            html += ' />';
            return html;
        } else if (field.widget == 'select') {
            html += '>';
            if (!getOption(userId, field.required, value)) html += '<option value="">(none)</option>';
            for (var j = 0; j < options.length; j++) {
                html += '<option value="' + options[j].value + '"';
                if (value == options[j].value) html += ' selected="selected"';
                html += '>' + options[j].label + '</option>';
            }
            html += '</select>';
            return html;
        } else if (field.type == 'number' && field.min !== null && field.max !== null) {
            html += ' min="' + field.min + '" max="' + field.max + '"';
            if (field.numberStep) html += ' step="' + field.numberStep + '"';
        }

        if (field.regEx) {
            html += ' pattern="' + regExToString(field.regEx) + '"';
        }

        html += ' value="' + value + '" />';
    }

    return html;
}

function renderLabelWidget(field) {
    if (field.widget == 'hidden') return '';  // label is taken care of already
    return '' + field.label + '';
}

function renderField(userId, field, value, doc, modifier, error) {
    var hidden = getOption(userId, field.hidden, value, doc, modifier);
    if (hidden) return '';
    if (field.widget == 'hidden') return renderFieldWidget(userId, field, value, doc, modifier);

    var html = '
';
    html += renderLabelWidget(field);
    html += renderFieldWidget(userId, field, value, doc, modifier);
    if (error) html += '
' + error + '
';
    else html += '

';
    html += '
';
    return html;
}

function renderForm(userId, crudForm, doc, modifier) {
    var values = {};
    var errors = {};
    if (doc || modifier) {
        var results = validate(userId, crudForm.fields, doc, modifier);
        values = results[0];
        errors = results[1];
    }

    var html = '<form onsubmit="return CrudForm.formSubmitted(this);" data-form-name="' + crudForm.formName + '">';

    for (var name in crudForm.fields) {
        if (crudForm.fields.hasOwnProperty(name)) {
           var field = crudForm.fields[name];
           var value = null;
            if (name in values) value = values[name];
            var error = null;
            if (name in errors) error = errors[name];
            html += renderField(userId, field, value, doc, modifier, error);
        }
    }

    html += '<button type="submit" class="btn btn-primary btn-block">Submit</button>';
    return html + '</form>';
}

function renderModalForm(userId, crudForm, doc, modifier) {
    var values = {};
    var errors = {};
    if (doc || modifier) {
        var results = validate(userId, crudForm.fields, doc, modifier);
        values = results[0];
        errors = results[1];
    }

    var html = '
';
    html += '

';
    html += '<form onsubmit="return CrudForm.formSubmitted(this);" data-form-name="' + crudForm.formName + '">';
    html += '
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';
    html += '
' + crudForm.label + '

';
    html += '
';

    for (var name in crudForm.fields) {
        if (crudForm.fields.hasOwnProperty(name)) {
            var field = crudForm.fields[name];
            var value = null;
            if (name in values) value = values[name];
            var error = null;
            if (name in errors) error = errors[name];
            html += renderField(userId, field, value, doc, modifier, error);
        }
    }

    html += '
';
    html += '
';
    html += '<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>';
    html += '<button type="submit" class="btn btn-primary">Submit</button>';
    html += '

</form>
';

    return html;
}

function objFromName(formName) {
    var crudForm = null;
    _.each(CrudFormInstances, function(item, name) {
        if (name == formName) {
            crudForm = item;
            return;
        }
    });
    return crudForm;
}

// takes a form element and the collection.formName and returns
// the doc and modifier objects for insert and update
function formToObject(target, formName) {
    var crudForm = objFromName(formName);
    var doc = {};
    var modifier = {$set: {}};
    var setOrAppend = function(existing, name, val) {
        if (name.indexOf('[') > 0) {
            if (existing === undefined) existing = [];
            if (val) existing.push(val);
            return existing;
        } else {
            return val;
        }
    };

    $('.form-control', target).each(function(iter, item) {
        var singleName = item.name.replace('[]', '');
        var field = crudForm.fields[singleName];
        var value = cleanField(field, getValue(item));
        modifier.$set[singleName] = setOrAppend(modifier.$set[singleName], item.name, value);

        if (item.name.indexOf('.') > 0) {
            var fieldnames = item.name.split('.', 2);
            var obj = {};
            if (fieldnames[0] in doc) obj = doc[fieldnames[0]];

            obj[fieldnames[1].replace('[]', '')] = setOrAppend(doc[fieldnames[0]], fieldnames[1], value);
            doc[fieldnames[0]] = obj;
        } else {
            doc[singleName] = setOrAppend(doc[singleName], item.name, value);
        }
    });

    return {doc: doc, modifier: modifier};
}

CrudFormInstances = {};

CrudForm = function(collection, options) {
    if (!(this instanceof CrudForm)) throw new Meteor.Error('Use the "new" on for CrudForm');
    if (!collection) throw new Meteor.Error('Must provide collection name or Meteor.Collection');
    if (typeof collection == 'string') collection = new Meteor.Collection(collection);
    if (!collection instanceof Meteor.Collection) throw new Meteor.Error('Must provide a Meteor.Collection');
    if (!options) throw new Meteor.Error('Must provide options');

    var self = this;
    this.collection = collection;
    this.fields = [];
    var defaults = {
        label: singularize(collection._name),
        properties: {},
        handleAllow: true,   // allow by default
        logValidationFailures: true,
        beforeInsert: null,  // function(userId, doc), return false to cancel
        beforeUpdate: null,  // function(userId, doc, fields, modifier), return false to cancel
        beforeRemove: null,  // function(userId, doc), return false to cancel
        beforeSubmit: null,  // function(action, doc, modifier, editId), return false to cancel (client-only, before validation)
        afterInsert: null,   // function(userId, doc)
        afterUpdate: null,   // function(userId, doc, fields, modifier)
        afterRemove: null,   // function(userId, doc)
        afterSubmit: null,   // function(action, doc, modifier, editId), return false to cancel (client-only, after validation for custom db writing)
        disableServerValidation: false // prevents server-side validation
    };

    if ('fields' in options) {
        _.each(options.fields, function(field, name) {
            self.fields[name] = getField(field, name);
        });
    }

    this.options = _.extend(defaults, options);
    this.label = this.options.label;
    this.formName = idFromLabel('crudForm' + this.label);
    this.modalName = idFromLabel('modal' + this.label);

    if (this.options.handleAllow) {
        this.collection.allow({
            insert: function() { return true; },
            update: function() { return true; },
            remove: function() { return true; }
        });
    }

    this.collection.before.insert(function(userId, doc) {
        if (self.options.beforeInsert && self.options.beforeInsert(userId, doc) === false) return false;
        if (Meteor.isClient || !self.options.disableServerValidation) {
            var result = self.validate(userId, doc);
            if (!_.isEmpty(result[1])) {
                if (self.options.logValidationFailures) console.log(result);
                return false;
            }
        }
    });
    this.collection.before.update(function(userId, doc, fields, modifier, options) {
        if (self.options.beforeUpdate && self.options.beforeUpdate(userId, doc, fields, modifier) === false) return false;
        if (Meteor.isClient || !self.options.disableServerValidation) {
            var result = self.validate(userId, doc, modifier);
            if (!_.isEmpty(result[1])) {
                if (self.options.logValidationFailures) console.log(result);
                return false;
            }
        }
    });
    this.collection.before.remove(function(userId, doc) {
        if (self.options.beforeRemove && self.options.beforeRemove(userId, doc) === false) return false;
    });

    if (this.options.afterInsert) {
        this.collection.after.insert(this.options.afterInsert);
    }

    if (this.options.afterUpdate) {
        this.collection.after.update(this.options.afterUpdate);
    }

    if (this.options.afterRemove) {
        this.collection.after.remove(this.options.afterRemove);
    }

    CrudFormInstances[this.formName] = this;
};

// class functions
CrudForm.sortableListField = function() {
    try { $('.crud-field-list').sortable('destroy'); } catch (err) {}
    $('.crud-field-list').sortable({
        axis: 'y',
        handle: '.handle'
    });
};

CrudForm.addListField = function(element) {
    var formName = $(element).closest('form').data('form-name');
    var crudForm = objFromName(formName);
    var field = crudForm.fields[element.name];
    var html = addListField(field);
    $(element).next('.crud-field-list').append(html);
    CrudForm.sortableListField();
};

CrudForm.removeListField = function(element) {
    $(element).closest('div').remove();
    CrudForm.sortableListField();
};

CrudForm.validateField = function(element) {
    var formName = $(element).closest('form').data('form-name');
    var crudForm = objFromName(formName);
    var field = crudForm.fields[element.name.replace('[]', '')];
    var value = cleanField(field, getValue(element));
    var group = $(element).parent('.crudField' + field.name);
    var result = validateField(Meteor.userId(), field, value);
    if (result[1]) {
        $(group).addClass('has-error');
        $('.help-block', group).text(result[1]);
    } else {
        $(group).removeClass('has-error');
        $('.help-block', group).text('');
    }

    return result;
};

CrudForm.formSubmitted = function(element) {
    var formName = $(element).data('form-name');
    var crudForm = objFromName(formName);
    var obj = formToObject(element, formName);
    var editId = Session.get('crud-edit-id');
    var action = 'insert';

    if (editId) action = 'update';
    if (crudForm.options.beforeSubmit && crudForm.options.beforeSubmit(action, obj.doc, obj.modifier, editId) === false) return false;

    var results = {};

    $('.form-control', element).each(function(iter, item) {
        var result = CrudForm.validateField(item);
        if (result[1]) results[item.name.replace('[]', '')] = result[1];
    });

    if (!_.isEmpty(results)) console.log('Form validation failed: ', results);
    else {
        if (crudForm.options.afterSubmit) {
            crudForm.options.afterSubmit(action, obj.doc, obj.modifier, editId);
        }

        if (editId) crudForm.update({_id: editId}, obj.modifier, editId);
        else crudForm.insert(obj.doc);

        $('.' + crudForm.modalName).modal('hide');
    }

    return false;
};

CrudForm.newModalForm = function(formName) {
    var crudForm = objFromName(formName);
    $('.' + crudForm.modalName).remove();
    $(document.body).append(renderModalForm(Meteor.userId(), crudForm));
    $('.' + crudForm.modalName).modal('show');
    Session.set('crud-edit-id', undefined);
};

CrudForm.editModalForm = function(formName, id) {
    var crudForm = objFromName(formName);
    $('.' + crudForm.modalName).remove();
    var doc = crudForm.fetchOne({_id: id});
    $(document.body).append(renderModalForm(Meteor.userId(), crudForm, doc));
    $('.' + crudForm.modalName).modal('show');
    Session.set('crud-edit-id', id);
};

CrudForm.confirmRemove = function(formName, id) {
    var crudForm = objFromName(formName);
    Modal.confirm({
        message: 'Are you sure you want to remove this ' + crudForm.label + '?',
        title: 'Confirm Removal',
        buttonText: 'Remove',
        buttonClass: 'btn-danger',
        callback: function() {
            crudForm.remove({_id: id});
        }
    });
};

// instance functions
CrudForm.prototype.validateField = function(field, value, doc, modifier) {
    return validateField(Meteor.userId(), field, value, doc, modifier);
};

CrudForm.prototype.validate = function(doc, modifier) {
    return validate(Meteor.userId(), this.fields, doc, modifier);
};

CrudForm.prototype.renderForm = function(doc, modifier) {
    return renderForm(Meteor.userId(), this, doc, modifier);
};

CrudForm.prototype.renderModalForm = function(doc, modifier) {
    return renderModalForm(Meteor.userId(), this, doc, modifier);
};

// Passthrough methods
CrudForm.prototype.allow = function(args) {
    return this.collection.allow(args);
};

CrudForm.prototype.deny = function(args) {
    return this.collection.deny(args);
};

CrudForm.prototype.insert = function(/* arguments */) {
    return this.collection.insert.apply(this.collection, arguments);
};

CrudForm.prototype.update = function(/* arguments */) {
    return this.collection.update.apply(this.collection, arguments);
};

CrudForm.prototype.remove = function(/* arguments */) {
    return this.collection.remove.apply(this.collection, arguments);
};

CrudForm.prototype.find = function(/* arguments */) {
    return this.collection.find.apply(this.collection, arguments);
};

CrudForm.prototype.findOne = function(/* arguments */) {
    return this.collection.findOne.apply(this.collection, arguments);
};

// Assigns options.properties to a document
CrudForm.prototype.applyProperties = function(doc) {
    if (!doc) return;
    _.each(this.options.properties, function(fn, key) {
        doc[key] = fn(doc);
    });
};

// Custom method that calls find, then runs applyProperties to apply
// all options.properties to all objects found.
CrudForm.prototype.fetch = function(/* arguments */) {
    var docs = this.collection.find.apply(this.collection, arguments).fetch();
    for (var i = 0; i < docs.length; i++) {
        this.applyProperties(docs[i]);
    }
    return docs;
};

// Custom method that calls findOne, then runs applyProperties to apply
// all options.properties to the found object.
CrudForm.prototype.fetchOne = function(/* arguments */) {
    var doc = this.collection.findOne.apply(this.collection, arguments);
    if (doc) this.applyProperties(doc);
    return doc;
};

// Handlebars helpers
if (typeof Handlebars !== 'undefined' && Meteor.isClient) {
    // Renders a table to list each row in the given collection, allow with New, Edit, and Remove buttons
    // label: The name for the type of item represented (i.e User, Message, etc)
    // collection: A collection cursor
    // fields: List of {name, label] to show for each document
    // allowNew: true or false (default: true)
    // allowEdit: true or false (default: true)
    // allowRemove: true or false (default: true)
    // rowCallback: function(item, field, value)
    Handlebars.registerHelper('crudList', function(options) {
        var defaults = {
            crudForm: null,
            fields: null,
            selector: {},
            allowNew: true,
            allowEdit: true,
            allowRemove: true,
            rowCallback: null
        };

        options = _.extend(defaults, options);

        if (!options.crudForm) throw new Error('Must supply CrudForm');
        if (!options.fields) options.fields = _.keys(options.crudForm.fields);
        if (!options.fields) throw new Error('CrudForm does not have fields defined');
        var rows = [];

        if (_.isArray(options.selector)) {
            rows = options.crudForm.fetch(options.selector[0], options.selector[1]);
        } else {
            rows = options.crudForm.fetch(options.selector);
        }

        var html = '';
        if (options.allowNew)
            html += '<button type="button" class="btn btn-primary btn-new" onclick="CrudForm.newModalForm(\'' + options.crudForm.formName + '\');">New ' + options.crudForm.label + '</button>';

        html += '

';
        for (var i = 0; i < options.fields.length; i++) {
            var field_name = options.fields[i];
            var label = options.crudForm.fields[field_name].label;
            html += '' + label + '	';
        }
        html += '
';
        for (var row = 0; row < rows.length; row++) {
            var item = rows[row];
            if (!item) continue;
            html += '
';
            for (var col = 0; col < options.fields.length; col++) {
                var field = options.crudForm.fields[options.fields[col]];
                if (!field) continue;

                html += '';
                if (col === 0) {
                    if (options.allowEdit) html += '<button type="button" class="btn btn-default btn-xs btn-edit" onclick="CrudForm.editModalForm(\'' + options.crudForm.formName + '\', \'' + item._id + '\');"></button> ';
                    if (options.allowRemove) html += '<button type="button" class="btn btn-danger btn-xs btn-remove" onclick="CrudForm.confirmRemove(\'' + options.crudForm.formName + '\', \'' + item._id + '\');"></button> ';
                }
                var value = '';
                if (field.name.indexOf('.') > 0) {
                    var fieldnames = field.name.split('.', 2);
                    value = item[fieldnames[0]][fieldnames[1]];
                } else {
                    value = item[field.name];
                }
                if (options.rowCallback) {
                    value = options.rowCallback(item, field, value);
                }
                html += value + '	';
            }
            html += '
';
        }
        html += '
';
        return new Handlebars.SafeString(html);
    });

    // Creates a Modal with the given form template inside
    // crudForm: The CrudForm object
    Handlebars.registerHelper('crudModal', function(crudForm) {
        if (!crudForm) return;
        var html = crudForm.renderModalForm();
        return new Handlebars.SafeString(html);
    });

    // Creates a form and handles submission (insert only, cannot edit existing docs)
    // crudForm: The CrudForm object
    Handlebars.registerHelper('crudForm', function(crudForm) {
        if (!crudForm) return;
        var html = crudForm.renderForm();
        return new Handlebars.SafeString(html);
    });

    // Sets the page title
    // title: The text to use for the page title
    Handlebars.registerHelper('title', function(title) {
        if (title) {
            document.title = title;
        }
    });
}


text:
require 'yt/errors/request_error'

module Yt
  module Errors
    class ServerError < RequestError
      def explanation
        'A request to YouTube API caused an unexpected server error'
      end
    end
  end
end


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sphere : BlockBase {

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.transform.tag == "Player")
        {
            base.DoDestroy();

            //Do death animation in the meantime
        }
    }

}


text:
USE [DBAUtility];
GO
IF NOT EXISTS ( SELECT  *
                FROM    [INFORMATION_SCHEMA].[ROUTINES]
                WHERE   [ROUTINE_NAME] = 'sp_RestoreGeneWrapper' )
    EXEC ('CREATE PROC dbo.sp_RestoreGeneWrapper AS SELECT ''stub version, to be replaced''');
GO
-- =============================================
-- Author:		Ryan DeVries
-- Create date: 2016-09-07
-- Description:	This is a wrapper function for Paul Brewer's sp_RestoreGene (https://paulbrewer.wordpress.com/sp_restoregene/)
--				It is designed to be executed using SQLCMD as an agent job step after backups are performed, and output a restoration script to the Output file specified in the agent job step.
--              Example: sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d DBAUtility -Q "EXECUTE [dbo].[sp_RestoreGeneWrapper] @WithRecovery = 1, @WithReplace = 1" -b
--                       Output File: \\backups\Restore Scripts\RestoreScript_$(ESCAPE_SQUOTE(SRVR))_$(ESCAPE_SQUOTE(STRTDT))_$(ESCAPE_SQUOTE(STRTTM)).sql
--              It also logs the restore information to a table in the DBAUtility database for reference, keeping one week's worth of restore scripts.
--				It supports most of the same parameters as sp_RestoreGene, minus the ones that don't make sense for this application.
--
--              Enhancements to sp_RestoreGene:
--					- Table logging
--					- Script comment with custom warning message
--					- Listing of restore point datetime for each database
-- ChangeLog:
-- 2016-09-07 - v1.0 - Release
-- =============================================
ALTER PROCEDURE [dbo].[sp_RestoreGeneWrapper]
    (
      @Database sysname = NULL ,
      @TargetDatabase sysname = NULL ,
      @WithMoveDataFiles VARCHAR(2000) = NULL ,
      @WithMoveLogFile VARCHAR(2000) = NULL ,
      @WithMoveFileStreamFile VARCHAR(2000) = NULL ,
      @FromFileFullUNC VARCHAR(2000) = NULL ,
      @FromFileDiffUNC VARCHAR(2000) = NULL ,
      @FromFileLogUNC VARCHAR(2000) = NULL ,
      @StopAt DATETIME = NULL ,
      @StandbyMode BIT = 0 ,
      @IncludeSystemDBs BIT = 0 ,
      @WithRecovery BIT = 0 ,
      @WithCHECKDB BIT = 0 ,
      @WithReplace BIT = 0 ,
      @Log_Reference VARCHAR(250) = NULL ,
      @BlobCredential VARCHAR(255) = NULL , --Credential used for Azure blob access
      @RestoreScriptReplaceThis NVARCHAR(255) = NULL ,
      @RestoreScriptWithThis NVARCHAR(255) = NULL ,
      @SuppressWithMove BIT = 1 ,
      @PivotWithMove BIT = 0
    )
AS
    BEGIN
        SET NOCOUNT ON;
        DECLARE @GeneDate DATETIME2 ,
            @TSQL NVARCHAR(4000) ,
            @MaxDBNameLength INT ,
            @ScriptComment NVARCHAR(MAX);

        SET @GeneDate = SYSDATETIME();
        SET @ScriptComment = 'This script is automatically generated after each backup.  It will restore each selected database to the most recent restore point.
	- It is only intended for use in catastrophic server failure.
	- If msdb is still available, use that to generate the restore script using [DBAUtility].[dbo].[sp_RestoreGene] instead, and take a backup of the log tail(s) first to avoid data loss.
	- Make sure no connections are made to the databases before executing.  You may need to put the databases in Single_user mode first, or kill existing connections.
	- Master is excluded, as it required special recovery procedures.
	- If you wish to restore msdb as well, stop the SQL Agent first.
	- Do not blindly run this, it will overwrite all of your databases!  Make sure you know what you are doing!';

        IF OBJECT_ID('[dbo].[RestoreGene]') IS NULL
            CREATE TABLE [dbo].[RestoreGene]
                (
                  [ID] [BIGINT] IDENTITY(1, 1)
                                NOT NULL ,
                  [GeneDate] [DATETIME2](7) NOT NULL ,
                  [Latest] [BIT] NOT NULL ,
                  [TSQL] [NVARCHAR](4000) NOT NULL ,
                  [BackupDate] [DATETIME2](7) NULL ,
                  [BackupDevice] [NVARCHAR](260) NULL ,
                  [last_lsn] [DECIMAL](25, 0) NULL ,
                  [database_name] [NVARCHAR](128) NULL ,
                  [SortSequence] [BIGINT] NOT NULL ,
                  CONSTRAINT [PK_RestoreGene] PRIMARY KEY CLUSTERED
                    ( [ID] ASC )
                );

        IF OBJECT_ID('tempdb..#RestoreGene') IS NOT NULL
            DROP TABLE [#RestoreGene];

        CREATE TABLE [#RestoreGene]
            (
              [TSQL] NVARCHAR(MAX) ,
              [BackupDate] DATETIME ,
              [BackupDevice] NVARCHAR(260) ,
              [last_lsn] DECIMAL(25, 0) ,
              [database_name] NVARCHAR(128) ,
              [SortSequence] BIGINT
            );

        INSERT  INTO [#RestoreGene]
                EXEC [dbo].[sp_RestoreGene] @Database = @Database,
                    @TargetDatabase = @TargetDatabase,
                    @WithMoveDataFiles = @WithMoveDataFiles,
                    @WithMoveLogFile = @WithMoveLogFile,
                    @WithMoveFileStreamFile = @WithMoveFileStreamFile,
                    @FromFileFullUNC = @FromFileFullUNC,
                    @FromFileDiffUNC = @FromFileDiffUNC,
                    @FromFileLogUNC = @FromFileLogUNC, @StopAt = @StopAt,
                    @StandbyMode = @StandbyMode,
                    @IncludeSystemDBs = @IncludeSystemDBs,
                    @WithRecovery = @WithRecovery, @WithCHECKDB = @WithCHECKDB,
                    @WithReplace = @WithReplace,
                    @Log_Reference = @Log_Reference,
                    @BlobCredential = @BlobCredential,
                    @RestoreScriptReplaceThis = @RestoreScriptReplaceThis,
                    @RestoreScriptWithThis = @RestoreScriptWithThis,
                    @SuppressWithMove = @SuppressWithMove,
                    @PivotWithMove = @PivotWithMove;

        SELECT  @MaxDBNameLength = MAX(LEN([database_name]))
        FROM    [#RestoreGene]
        WHERE   [BackupDevice] <> '';

        UPDATE  [dbo].[RestoreGene]
        SET     [Latest] = 0
        WHERE   [Latest] = 1;

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        VALUES  ( @GeneDate ,
                  1 ,
                  '/*' + CHAR(10) + @ScriptComment + CHAR(10)
                  + 'Latest restore points: ' ,
                  @GeneDate ,
                  '' ,
                  0 ,
                  'master' ,
                  0
                );

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        VALUES  ( @GeneDate ,
                  1 ,
                  CHAR(9) + 'Database' + REPLICATE(' ', @MaxDBNameLength - 6)
                  + 'Restore Point' + REPLICATE(' ', 8) + 'Recovery Model' ,
                  @GeneDate ,
                  '' ,
                  0 ,
                  'master' ,
                  0
                );

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        VALUES  ( @GeneDate ,
                  1 ,
                  CHAR(9) + REPLICATE('-', @MaxDBNameLength + 37) ,
                  @GeneDate ,
                  '' ,
                  0 ,
                  'master' ,
                  0
                );

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        SELECT  @GeneDate AS [GeneDate] ,
                1 ,
                CHAR(9) + [rg].[database_name] + REPLICATE(' ',
                                                           @MaxDBNameLength
                                                           - LEN([rg].[database_name])
                                                           + 2)
                + CONVERT(VARCHAR(19), MAX([rg].[BackupDate]), 120) + '  '
                + CASE MAX([db].[recovery_model])
                    WHEN 1 THEN 'FULL'
                    WHEN 2 THEN 'BULK LOGGED'
                    WHEN 3 THEN 'SIMPLE'
                  END ,
                @GeneDate ,
                '' ,
                0 ,
                'master' ,
                0
        FROM    [#RestoreGene] [rg]
        JOIN    [master].[sys].[databases] [db] ON [rg].[database_name] = [db].[name]
        WHERE   [rg].[BackupDevice] <> ''
                AND [rg].[database_name] <> 'master'
        GROUP BY [rg].[database_name];

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        VALUES  ( @GeneDate ,
                  1 ,
                  'Restore scripts were not generated for the following database(s):' ,
                  @GeneDate ,
                  '' ,
                  0 ,
                  'master' ,
                  0
                );

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        SELECT  @GeneDate AS [GeneDate] ,
                1 ,
                CHAR(9) + [name] ,
                @GeneDate ,
                '' ,
                0 ,
                'master' ,
                0
        FROM    [master].[sys].[databases]
        WHERE   [name] NOT IN ( SELECT DISTINCT
                                        [database_name]
                                FROM    [#RestoreGene] )
                AND [database_id] <> 2;

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        VALUES  ( @GeneDate ,
                  1 ,
                  '*/' + CHAR(10) + ';USE [master]' ,
                  @GeneDate ,
                  '' ,
                  0 ,
                  'master' ,
                  0
                );

        INSERT  INTO [dbo].[RestoreGene]
                ( [GeneDate] ,
                  [Latest] ,
                  [TSQL] ,
                  [BackupDate] ,
                  [BackupDevice] ,
                  [last_lsn] ,
                  [database_name] ,
                  [SortSequence]
                )
        SELECT  @GeneDate AS [GeneDate] ,
                1 ,
                [TSQL] ,
                [BackupDate] ,
                [BackupDevice] ,
                [last_lsn] ,
                [database_name] ,
                [SortSequence]
        FROM    [#RestoreGene]
        WHERE   [database_name] <> 'master';

        DECLARE [db_cursor] CURSOR
        FOR
            SELECT  [TSQL]
            FROM    [dbo].[RestoreGene]
            WHERE   [Latest] = 1
            ORDER BY [SortSequence] ASC;

        OPEN [db_cursor];
        FETCH NEXT FROM [db_cursor] INTO @TSQL;

        WHILE @@FETCH_STATUS = 0
            BEGIN
                PRINT @TSQL;
                FETCH NEXT FROM [db_cursor] INTO @TSQL;
            END;

        CLOSE [db_cursor];
        DEALLOCATE [db_cursor];

        DELETE  FROM [dbo].[RestoreGene]
        WHERE   [GeneDate] < DATEADD(wk, -1, @GeneDate);
        SET NOCOUNT OFF;
    END;
GO


text:
source "${ENVIRONMENT_CONFIG_PATH_}go.sh"

source "${ENVIRONMENT_CONFIG_PATH_}plist.sh"


text:
from __future__ import unicode_literals
from __future__ import absolute_import
from compose.cli.utils import split_buffer
from .. import unittest

class SplitBufferTest(unittest.TestCase):
    def test_single_line_chunks(self):
        def reader():
            yield b'abc\n'
            yield b'def\n'
            yield b'ghi\n'

        self.assert_produces(reader, [b'abc\n', b'def\n', b'ghi\n'])

    def test_no_end_separator(self):
        def reader():
            yield b'abc\n'
            yield b'def\n'
            yield b'ghi'

        self.assert_produces(reader, [b'abc\n', b'def\n', b'ghi'])

    def test_multiple_line_chunk(self):
        def reader():
            yield b'abc\ndef\nghi'

        self.assert_produces(reader, [b'abc\n', b'def\n', b'ghi'])

    def test_chunked_line(self):
        def reader():
            yield b'a'
            yield b'b'
            yield b'c'
            yield b'\n'
            yield b'd'

        self.assert_produces(reader, [b'abc\n', b'd'])

    def test_preserves_unicode_sequences_within_lines(self):
        string = u"a\u2022c\n".encode('utf-8')

        def reader():
            yield string

        self.assert_produces(reader, [string])

    def assert_produces(self, reader, expectations):
        split = split_buffer(reader(), b'\n')

        for (actual, expected) in zip(split, expectations):
            self.assertEqual(type(actual), type(expected))
            self.assertEqual(actual, expected)