text:
$(document).ready(function () {
    var $left_bar = $('#left-side'),
        $example_content = $('.example-content'),
        $expanded = $('.example-info-group-expanded'),
        $group_heading = $('.example-info-group-heading'),
        $example_title = $('.example-title'),
        $example_info = $('.example-info'),
        $demo = $('.demonstration'),
        $med_arrow = $('.arrow-med'),
        $top_arrow = $('.arrow-lrg-top'),
        $demo_top_cat = $('#demos'),
        $overview_top_cat = $('#overview'),
        $settings_top_cat = $('#settings'),
        $demos_heading = $('#demos-heading'),
        $settings_heading = $('#settings-heading'),
        $overview_heading = $('#overview-heading'),
        $wrapper = $('#page-wrap'),
        viewport_height = '';
    $left_bar.css({
        width: '380px'
    });
    $demo_top_cat.add($settings_top_cat).css({
        left: '-9999px'
    });
    $demos_heading.click(function () {
        $overview_top_cat.add($settings_top_cat).css({
            left: '-9999px'
        });
        $demo_top_cat.css('left', '0px');
    });
    $settings_heading.click(function () {
        $overview_top_cat.add($demo_top_cat).css({
            left: '-9999px'
        });
        $settings_top_cat.css('left', '0px');
    });
    $overview_heading.click(function () {
        $settings_top_cat.add($demo_top_cat).css({
            left: '-9999px'
        });
        $overview_top_cat.css('left', '0px');
    });
    $example_info.css({
        position: 'absolute',
        width: '373px',
        left: '0px',
        float: 'none'
    });
    ex_heights = [];
    $example_info.each(function () {
        var height = $(this).height();
        ex_heights.push(height);
    });
    $demo.css({
        position: 'absolute',
        left: '385px',
        right: '0px',
        float: 'none',
        margin: '0 20px',
    });
    $example_title.css({
        position: 'absolute',
        left: '-9999px'
    });
    $example_content.css({
        position: 'absolute',
        left: '-9999px',
        width: '100%'
    });
    for (var i = 0; i < ex_heights.length; i++) {
        $example_content.eq(i).height(ex_heights[i]+'px');
    }
    $example_title.eq(0).css({
        position: 'relative',
        left: '0px'
    });
    $example_content.eq(0).css({position: 'relative', left: '0px', height: ex_heights[0]+'px'});
    var start_coords = $example_content.eq(0).offset();
    var start_top = -(start_coords.top)+59;
    $demo.eq(0).css({
        top: start_top+'px'
    });
    $top_arrow.eq(0).css({
        transform: 'rotate(-90deg)',
        '-ms-transform': 'rotate(-90deg)',
        '-webkit-transform': 'rotate(-90deg)',
        'border-right': '9px solid red'
    });
    $('.arrow-lrg').eq(0).css({
        transform: 'rotate(-90deg)',
        '-ms-transform': 'rotate(-90deg)',
        '-webkit-transform': 'rotate(-90deg)',
        'border-right': '6px solid red'
    });
    $('.cat-title').toggle(
    function () {
        var $category = $(this).parent('.category'),
            $page_area = $category.parent('div'),
            $page_area_cats = $page_area.children('.category'),
            $example = $category.children('.example'),
            $cat_subs = $example.children('.example-title'),
            $this_arrow = $(this).children('.arrow-lrg-top'),
            cat_heading_height = $('.cat-heading').outerHeight(true),
            cat_title_heights = 0,
            category_subs_heights = [],
            page_area_cat_exTitleHeights = [],
            category_subs_heights = [];
        $page_area_cats.children('.cat-title').each(function () {
            var height = $(this).outerHeight(true);
            cat_title_heights += height;
        });
        $page_area_cats.each(function(){
            var example_title_heights = 0;
            $(this).find('.example-title').each(function () {
                var height = $(this).outerHeight(true);
                example_title_heights += height;
            });
            page_area_cat_exTitleHeights.push(example_title_heights);
            var expanded_heights = [],
                $expandeds = $(this).find($expanded);
            $expandeds.each(function(){
                var height = $(this).height();
                expanded_heights.push(height);
            });
            if (expanded_heights[0] !== undefined) {
                var max_expanded_height = Math.max.apply(Math,expanded_heights),
                    heading_height = $group_heading.outerHeight(true);
            } else {
                if (expanded_heights[0] === undefined) {
                    var max_expanded_height = 0,
                        heading_height = 0;
                }
            }
            var sub_cat_height = max_expanded_height + (2*heading_height);
            category_subs_heights.push(sub_cat_height);
        });
        //want to add together the cat_title_heights, max of category_subs_heights, max of page_area_cat_exTitleHeights
        var max_category_subs_heights = Math.max.apply(Math,category_subs_heights),
            max_page_area_cat_exTitleHeights = Math.max.apply(Math,page_area_cat_exTitleHeights);
        max_left_side_height = max_category_subs_heights + max_page_area_cat_exTitleHeights + cat_title_heights + cat_heading_height;
        if ($cat_subs.css('position', 'absolute')) { // if subheadings are hidden
            $example_title.not($cat_subs).css({
                position: 'absolute',
                left: '-9999px'
            });
            $cat_subs.css({
                position: 'relative',
                left: '0px'
            });
            $example_content.css({
                left: '-9999px',
                height: '0px'
            });
            $top_arrow.not($this_arrow).css({
                transform: 'rotate(0deg)',
                '-ms-transform': 'rotate(0deg)',
                '-webkit-transform': 'rotate(0deg)',
                'border-right': '9px solid black'
            });
            $this_arrow.css({
                transform: 'rotate(-90deg)',
                '-ms-transform': 'rotate(-90deg)',
                '-webkit-transform': 'rotate(-90deg)',
                'border-right': '9px solid red'
            });
        } else {
            if ($cat_subs.css('position', 'relative')) { // if subheadings are shown
                $example_title.css({
                    position: 'absolute',
                    left: '-9999px'
                });
                $example_content.css({
                    position: 'absolute',
                    left: '-9999px',
                    height: '0px'
                });
                $this_arrow.css({
                    transform: 'rotate(0deg)',
                    '-ms-transform': 'rotate(0deg)',
                    '-webkit-transform': 'rotate(0deg)',
                    'border-right': '9px solid black'
                });
            }
        }
    }, function () {
    var $category = $(this).parent('.category'),
        $example = $category.children('.example'),
        $cat_subs = $example.children('.example-title'),
        $this_arrow = $(this).children('.arrow-lrg-top');
        if ($cat_subs.css('position', 'relative')) { // if subheadings are shown
            $example_title.css({
                position: 'absolute',
                left: '-9999px'
            });
            $example_content.css({
                position: 'absolute',
                left: '-9999px',
                height: '0px'
            });
            $this_arrow.css({
                transform: 'rotate(0deg)',
                '-ms-transform': 'rotate(0deg)',
                '-webkit-transform': 'rotate(0deg)',
                'border-right': '9px solid black'
            });
        } else {
            if ($cat_subs.css('position', 'absolute')) {
                $example_title.not($cat_subs).css({
                    position: 'absolute',
                    left: '-9999px'
                });
                $cat_subs.css({
                    position: 'relative',
                    left: '0px'
                });
                $example_content.css({
                    position: 'absolute',
                    left: '-9999px',
                    height: '0px'
                });
                $top_arrow.not($this_arrow).css({
                    transform: 'rotate(0deg)',
                    '-ms-transform': 'rotate(0deg)',
                    '-webkit-transform': 'rotate(0deg)',
                    'border-right': '9px solid black'
                });
                $this_arrow.css({
                    transform: 'rotate(-90deg)',
                    '-ms-transform': 'rotate(-90deg)',
                    '-webkit-transform': 'rotate(-90deg)',
                    'border-right': '9px solid red'
                });
            }
        }
    });
    $example_title.toggle(
    function () {
        var $ex_content = $(this).siblings('.example-content'),
            $this_demo = $ex_content.children('.demonstration'),
            $arrow = $(this).children('.arrow-lrg');
        if ($ex_content.css('position', 'absolute')) { // if related content is hidden
            $example_content.not($ex_content).css({position: 'absolute', left: '-9999px', height: '0px'});
            ex_content_num = $example_content.index($ex_content);
            $ex_content.css({position: 'relative', left: '0px', height: ex_heights[ex_content_num]+'px'});
            var ex_content_position = $ex_content.offset(),
                this_demo_top = -(ex_content_position.top)+59;
            $this_demo.css('top', this_demo_top+'px');
            //collect height of ($this_demo+144) and window
            var demo_height = $this_demo.height();
            demo_height_test = demo_height+134;
            viewport_height = $(window).height();
            left_side_height = max_left_side_height+254;

            //need to add up heights of all visible components on left of screen
            var cat_heading_height = $('.cat-heading:visible').outerHeight(true),
                cat_titles_height = 0;
            $('.cat-title').css('position', 'relative').each(function(){
                cat_titles_height += $(this).outerHeight(true);
            });
            var set_height = [demo_height_test, viewport_height, left_side_height],
                doc_height = Math.max.apply(Math,set_height);
            $wrapper.height(doc_height);
            $('.arrow-lrg').not($arrow).css({
                transform: 'rotate(0deg)',
                '-ms-transform': 'rotate(0deg)',
                '-webkit-transform': 'rotate(0deg)',
                'border-right': '6px solid black'
            });
            $arrow.css({
                transform: 'rotate(-90deg)',
                '-ms-transform': 'rotate(-90deg)',
                '-webkit-transform': 'rotate(-90deg)',
                'border-right': '6px solid red'
            });
            $expanded.hide();
            var $local_expandeds = $ex_content.find('.example-info-group-expanded'),
                $first_local_expanded = $local_expandeds.eq(0),
                $first_arrow_med = $first_local_expanded.prev('.example-info-group-heading').children('.arrow-med');
            $first_local_expanded.show();
            $first_arrow_med.css({
                transform: 'rotate(-90deg)',
                '-ms-transform': 'rotate(-90deg)',
                '-webkit-transform': 'rotate(-90deg)',
                'border-right': '6px solid red'
            });
        } else {
            if ($ex_content.css('position', 'relative')) { // if related content is displayed
                $ex_content.css({position: 'absolute', left: '-9999px', height: '0px'});
                $arrow.css({
                    transform: 'rotate(0deg)',
                    '-ms-transform': 'rotate(0deg)',
                    '-webkit-transform': 'rotate(0deg)',
                    'border-right': '6px solid black'
                });
            }
        }
    }, function () {
        var $ex_content = $(this).siblings('.example-content'),
            $arrow = $(this).children('.arrow-lrg');
        if ($ex_content.css('position', 'relative')) {
            $ex_content.css({position: 'absolute', left: '-9999px', height: '0px'});
            $arrow.css({
                transform: 'rotate(0deg)',
                '-ms-transform': 'rotate(0deg)',
                '-webkit-transform': 'rotate(0deg)',
                'border-right': '6px solid black'
            });
        } else {
            if ($ex_content.css('position', 'absolute')) {
                $example_content.not($ex_content).css({position: 'absolute', left: '-9999px', height: '0px'});
                ex_content_num = $example_content.index($ex_content);
                $ex_content.css({position: 'relative', left: '0px', height: ex_heights[ex_content_num]+'px'});
                var ex_content_position = $ex_content.offset(),
                    this_demo_top = -($ex_content_position.top)+59;
                $this_demo.css('top', this_demo_top+'px');
                $arrow.css({
                    transform: 'rotate(-90deg)',
                    '-ms-transform': 'rotate(-90deg)',
                    '-webkit-transform': 'rotate(-90deg)',
                    'border-right': '6px solid red'
                });
                $expanded.hide();
                var $local_expandeds = $ex_content.find('.example-info-group-expanded');
                $local_expandeds.eq(0).show();
            }
        }
    });
    $group_heading.click(
    function () {
        if ($(this).siblings('.example-info-group-expanded').is(':visible')) {
            $expanded.hide();
            $(this).children('.arrow-med').css({
                transform: 'rotate(0deg)',
                '-ms-transform': 'rotate(0deg)',
                '-webkit-transform': 'rotate(0deg)',
                'border-right': '6px solid white'
            });
        } else {
            if ($(this).siblings('.example-info-group-expanded').is(':hidden')) {
                $expanded.hide();
                $(this).siblings('.example-info-group-expanded').show();
                $med_arrow.css({
                    transform: 'rotate(0deg)',
                    '-ms-transform': 'rotate(0deg)',
                    '-webkit-transform': 'rotate(0deg)',
                    'border-right': '6px solid white'
                });
                $(this).children('.arrow-med').css({
                    transform: 'rotate(-90deg)',
                    '-ms-transform': 'rotate(-90deg)',
                    '-webkit-transform': 'rotate(-90deg)',
                    'border-right': '6px solid red'
                });
            }
        }
    });
});


text:
import sys

class Console:

  def __init__(self):
    self.stdout = None
    self.stderr = None

  def write(self,string):
    if myService is not None:
        myService.invoke(u'publishStdOut', string)

  def attach(self):
    if (self.stdout == None):
      self.stdout = sys.stdout
      self.stderr = sys.stderr
      sys.stdout = self
      sys.stderr = self

  def flush(self):
    pass

  def detach(self):
    if (self.stdout != None):
      sys.stdout = self.stdout
      sys.stderr = self.stderr
      self.stdout = None
      self.stderr = None

console = Console()
console.attach()

redpajama_set_name: RedPajamaGithub


text:
/*
 * $Id: DOMDocumentTypeImpl.hpp 641193 2008-03-26 08:06:57Z borisk $
 */

#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP)
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP

//
//  This file is part of the internal implementation of the C++ XML DOM.
//  It should NOT be included or used directly by application programs.
//
//  Applications should include the file <xercesc/dom/DOM.hpp> for the entire
//  DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
//  name is substituded for the *.
//

#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/dom/DOMDocumentType.hpp>
#include "DOMNodeImpl.hpp"
#include "DOMChildNode.hpp"
#include "DOMParentNode.hpp"

XERCES_CPP_NAMESPACE_BEGIN

class DOMNamedNodeMapImpl;

class CDOM_EXPORT DOMDocumentTypeImpl: public DOMDocumentType, public XMemory {
protected:
    DOMNodeImpl          fNode;
    DOMParentNode        fParent;
    DOMChildNode         fChild;

    const XMLCh *        fName;
    DOMNamedNodeMapImpl* fEntities;
    DOMNamedNodeMapImpl* fNotations;
    DOMNamedNodeMapImpl* fElements;
    const XMLCh *        fPublicId;
    const XMLCh *        fSystemId;
    const XMLCh *        fInternalSubset;

    bool			     fIntSubsetReading;
    bool                 fIsCreatedFromHeap;

    virtual void         setPublicId(const XMLCh * value);
    virtual void         setSystemId(const XMLCh * value);
    virtual void         setInternalSubset(const XMLCh *value);
    bool                 isIntSubsetReading() const;

    friend class AbstractDOMParser;
    friend class DOMDocumentImpl;

public:
    DOMDocumentTypeImpl(DOMDocument *, const XMLCh *, bool);
    DOMDocumentTypeImpl(DOMDocument *,
                     const XMLCh *qualifiedName,	//DOM Level 2
                     const XMLCh *publicId, const XMLCh *systemId, bool);
    DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep=false);
    virtual ~DOMDocumentTypeImpl();

public:
    // Declare all of the functions from DOMNode.
    DOMNODE_FUNCTIONS;

public:
    virtual void setOwnerDocument(DOMDocument *doc);
    virtual DOMNamedNodeMap * getEntities() const;
    virtual const XMLCh *       getName() const;
    virtual DOMNamedNodeMap * getNotations() const;
    virtual DOMNamedNodeMap * getElements() const;
    virtual void                setReadOnly(bool readOnly, bool deep);

    //Introduced in DOM Level 2

    virtual const XMLCh *     getPublicId() const;
    virtual const XMLCh *     getSystemId() const;
    virtual const XMLCh *     getInternalSubset() const;

private:
    // -----------------------------------------------------------------------
    // Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    DOMDocumentTypeImpl & operator = (const DOMDocumentTypeImpl &);
};

XERCES_CPP_NAMESPACE_END

#endif


text:
//
//  TextResult.h
//  AhNetManagerDemo
//
//  Created by ah on 2017/1/13.
//  Copyright © 2017年 ah. All rights reserved.
//

#import "AhResult.h"

@interface TextResult : AhResult

//  建立自己建立一个基于AhTesult的继承类, 这里边放置一些自己业务的公共返回参数, 当然Bre011Res 直接继承AhResult也是可以的
@end

/**上传图片*/
@interface Bre011Res : TextResult

@property (nonatomic,strong)NSArray *data;
@end

/**
 *  上传图片Item
 */
@interface Bre011ResItem : TextResult
/**图片名字*/
@property (nonatomic,copy)NSString *picname;
/**图片url*/
@property (nonatomic,copy)NSString *picurl;

@end


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.galadar.example.stockxchange.StockXChange2">

</RelativeLayout>
<!-- From: file:/C:/Users/Galadar/AndroidStudioProjects/StockXchange2/app/src/main/res/layout/activity_splash.xml -->


text:
<?php

namespace Acme\DemoBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ContactType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('email', 'email');
        $builder->add('message', 'textarea');
    }

    public function getName()
    {
        return 'contact';
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults([
            'data_class' => '\Acme\DemoBundle\Data\Contact',
        ]);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="pref_units_options">preference units options</string-array>
    <string-array name="pref_units_values">preference units values</string-array>
    <string-array name="pref_units_metric">preferences units metric</string-array>
</resources>


text:
var _ = require('lodash');
var log = require('winston');
var path = require('canonical-path');
var trimIndentation = require('dgeni/lib/utils/trim-indentation');
var code = require('dgeni/lib/utils/code');
var protractorFolder;

module.exports = {
  name: 'protractor-generate',
  description: 'Generate a protractor test file from the e2e tests in the examples',
  runAfter: ['adding-extra-docs'],
  runBefore: ['extra-docs-added'],
  init: function(config, injectables) {
    protractorFolder = config.get('rendering.protractor.outputFolder', 'ptore2e');
  },
  process: function(docs, examples) {
    _.forEach(examples, function(example) {

      _.forEach(example.files, function(file) {

        // Check if it's a Protractor test.
        if (!(file.type == 'protractor')) {
          return;
        }

        // Create a new file for the test.
        // TODO - at the moment, only jqLite is being used. Will need to generate
        // another doc for jQuery if we want to test against that.
        var protractorDoc = {
          docType: 'e2e-test',
          id: 'protractorTest' + '-' + example.id,
          template: 'protractorTests.template.js',
          outputPath: path.join(protractorFolder, example.id, 'jqlite' + '_test.js'),
          innerTest: file.fileContents,
          pathPrefix: '.', // Hold for if we test with full jQuery
          exampleId: example.id,
          description: example.doc.id,
          examplePath: example.outputFolder + '/index.html'
        };

        docs.push(protractorDoc);
      });
    });
  }
};


text:
layout: page
title: Twoer Research Conference
date: 2016-05-24
author: Lori Coffey
tags: weekly links, java
status: published
summary: Praesent dapibus orci nec odio rhoncus, id blandit augue.
banner: images/banner/wedding.jpg
booking:
  startDate: 11/24/2017
  endDate: 11/25/2017
  ctyhocn: ATLFBHX
  groupCode: TRC
published: true
---
Integer egestas congue est, eget convallis nulla pretium nec. Aliquam euismod tincidunt metus, sed rutrum est. Morbi convallis ultricies lorem, in eleifend dolor ullamcorper quis. Integer vulputate posuere turpis quis sodales. Vestibulum lacinia eu nibh eu consequat. Fusce eu odio vitae purus scelerisque pretium. Aliquam purus nisl, luctus vitae porta ut, tempor ut ante. Praesent turpis sem, sagittis eu placerat eu, molestie non nisl. Sed non luctus nunc. Aenean nec volutpat leo. In luctus elit et elit sagittis bibendum. Integer ac auctor mauris. Maecenas ornare egestas nulla, ac ultrices purus elementum sit amet. Maecenas convallis lectus id ligula rhoncus dictum et ac augue. Sed ornare nunc non congue suscipit. Aliquam efficitur a sapien vitae vehicula.

* Suspendisse nec lacus pharetra sapien dictum pretium ut sit amet sem
* Nunc cursus enim vel elit fringilla, a vulputate quam luctus
* Nam aliquet arcu ut nulla egestas volutpat
* Sed at leo vitae lectus semper dapibus.

Maecenas quis pharetra nulla. Pellentesque lacinia libero vel nisl posuere, et viverra arcu condimentum. Maecenas gravida urna augue, sed feugiat metus sodales ac. In sit amet tempus sem. Integer id est erat. Integer fringilla eget nibh sit amet euismod. Proin nisi nisi, consequat nec tincidunt nec, congue in lacus. Aenean faucibus, neque ut ornare sodales, nibh justo interdum tortor, volutpat pretium ante lacus ac sem. Vivamus eleifend ante sem, ac vehicula nibh egestas eu. Praesent eu placerat eros, pretium placerat nibh. Mauris porta vulputate sem a vulputate. Nam convallis ipsum quis tortor ullamcorper, nec pulvinar mi condimentum. Sed in augue quis turpis aliquet efficitur commodo sit amet odio.


text:
from openpds.accesscontrol.internal import AccessControlledInternalDataStore

class CompoundInternalDataStore:

    def __init__(self, ids1, ids2):
        self.ids1 = ids1
        self.ids2 = ids2

    def getData(self, key, start, end):
        return self.ids1.getData(key, start, end)

    def getAnswer(self, key):
        return self.ids1.getAnswer(key)

    def getAnswerList(self, key):
        return self.ids1.getAnswerList(key)

    def saveData(self, data):
        self.ids1.saveData(data)
        self.ids2.saveData(data)

    def saveAnswer(self, key, answer):
        self.ids1.saveAnswer(key, answer)
        self.ids2.saveAnswer(key, answer)

    def notify(self, notificationType, title, content, uri):
        return self.ids1.notify(notificationType, title, content, uri)


text:
package net.sf.mmm.game.engine.player;

import net.sf.mmm.game.engine.Game;
import net.sf.mmm.game.engine.GameAttributeGame;
import net.sf.mmm.game.engine.choice.GameChoice;

/**
 * This is the interface for the {@link GamePlayerConfig}
 */
public interface GamePlayerConfig extends GameAttributePlayers, GameAttributeGame {

  /**
   * @return the minimum number of {@link GamePlayer}s required to play this {@link Game game}.
   */
  int getMinPlayers();

  /**
   * @return the maximum number of {@link GamePlayer}s required to play this {@link Game game}.
   */
  int getMaxPlayers();

  /**
   * @return the minimum number of {Player#isHuman() human} {@link GamePlayer}s required to play this {@link Game game}.
   *         Override this method in your {@link Game}.
   */
  int getMinHumans();

  /**
   * @return the maximum number of {Player#isHuman() human} {@link GamePlayer}s allowed to play this {@link Game game}.
   */
  int getMaxHumans();

  /**
   * @return the minimum number of non-{Player#isHuman() human} (bot) {@link GamePlayer}s required to play this
   *         {@link Game game}.
   */
  int getMinBots();

  /**
   * @return the maximum number of non-{Player#isHuman() human} (bot) {@link GamePlayer}s allowed to play this
   *         {@link Game game}.
   */
  int getMaxBots();

  /**
   * @return the initial {@link GameChoice} to setup the {@link #getPlayers() players}.
   */
  GameChoice<GamePlayer> getChoice();

}


text:
<?php

namespace TomGud\FoosLeader\UserBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * UserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class UserRepository extends EntityRepository
{
	/**
	 *
	 */
	public function findByRole($role) {
	    $qb = $this->_em->createQueryBuilder();
	    $qb->select('u')
	            ->from($this->_entityName, 'u')
	            ->where('u.roles LIKE :roles')
	            ->setParameter('roles', '%"' . $role . '"%');
        return $qb->getQuery()->getResult();
	}

    public function getActiveUsers() {
        $monthAgo = new \DateTime('now', new \DateTimeZone('utc'));
        $monthAgo->sub(\DateInterval::createFromDateString('1 month'));
        $qb = $this->createQueryBuilder('u');
        $qb
            ->innerJoin("TomGud\FoosLeader\CoreBundle\Entity\Result", "r", 'WITH',
                'u.id = r.player1 OR u.id = r.player2 OR u.id = r.player3 OR u.id = r.player4')
            ->where('r.submitted > :monthAgo')
            ->setParameter('monthAgo', $monthAgo);
        return $qb->getQuery()->getResult();
    }
}


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

<!--
 This file is part of the FOSCommentBundle package.

 (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>

 This source file is subject to the MIT license that is bundled
 with this source code in the file LICENSE.
-->

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="fos_comment.model.thread.class">FOS\CommentBundle\Entity\Thread</parameter>
        <parameter key="fos_comment.model.comment.class">FOS\CommentBundle\Entity\Comment</parameter>
        <parameter key="fos_comment.model.vote.class">FOS\CommentBundle\Entity\Vote</parameter>

        <parameter key="fos_comment.manager.thread.default.class">FOS\CommentBundle\Entity\ThreadManager</parameter>
        <parameter key="fos_comment.manager.comment.default.class">FOS\CommentBundle\Entity\CommentManager</parameter>
        <parameter key="fos_comment.manager.vote.default.class">FOS\CommentBundle\Entity\VoteManager</parameter>
    </parameters>

    <services>
        <service id="fos_comment.manager.thread.default" class="%fos_comment.manager.thread.default.class%">
            <argument type="service" id="event_dispatcher" />
            <argument type="service" id="fos_comment.entity_manager" />
            <argument>%fos_comment.model.thread.class%</argument>
        </service>
        <service id="fos_comment.manager.comment.default" class="%fos_comment.manager.comment.default.class%">
            <argument type="service" id="event_dispatcher" />
            <argument type="service" id="fos_comment.sorting_factory" />
            <argument type="service" id="fos_comment.entity_manager" />
            <argument>%fos_comment.model.comment.class%</argument>
        </service>
        <service id="fos_comment.manager.vote.default" class="%fos_comment.manager.vote.default.class%">
            <argument type="service" id="event_dispatcher" />
            <argument type="service" id="fos_comment.entity_manager" />
            <argument>%fos_comment.model.vote.class%</argument>
        </service>
    </services>

</container>


text:
package net.cassite.sql;

public class InsertClause {

        public class InsertInto extends SQLEnd<InsertInto> {

                public class InsertIntoCols extends SQLEnd<InsertIntoCols> {

                        public class Values extends SQLEnd<Values> {
                                protected Values(StringBuilder sb, Object... objs) {
                                        super(sb);
                                        sb.append(" values (");
                                        boolean isFirst = true;
                                        for (Object o : objs) {
                                                if (isFirst) {
                                                        isFirst = false;
                                                } else {
                                                        sb.append(", ");
                                                }
                                                sb.append(SQLSyntaxUtils.objToStr(o));
                                        }
                                        sb.append(")");
                                }

                                public Values _(Object... objs) {
                                        sb.append(" (");
                                        boolean isFirst = true;
                                        for (Object o : objs) {
                                                if (isFirst) {
                                                        isFirst = false;
                                                } else {
                                                        sb.append(", ");
                                                }
                                                sb.append(SQLSyntaxUtils.objToStr(o));
                                        }
                                        sb.append(")");
                                        return this;
                                }
                        }

                        protected InsertIntoCols(StringBuilder sb, String... cols) {
                                super(sb);
                                sb.append(" (");
                                boolean isFirst = true;
                                for (String col : cols) {
                                        if (isFirst) {
                                                isFirst = false;
                                        } else {
                                                sb.append(", ");
                                        }
                                        SQLSyntaxUtils.appendSplitDots(sb, col);
                                }
                                sb.append(")");
                        }

                        public SQLEnd<InsertIntoCols> _(SQLEnd<?> select) {
                                sb.append(" (").append(select.toString()).append(")");
                                return this;
                        }

                        public Values values(Object... objs) {
                                return new Values(sb, objs);
                        }
                }

                protected InsertInto(StringBuilder sb, String tbl) {
                        super(sb);
                        sb.append(" into ").append(tbl);
                }

                public InsertIntoCols _(String... cols) {
                        return new InsertIntoCols(sb, cols);
                }

                public SQLEnd<InsertInto> values(Object... objs) {
                        sb.append(" values (");
                        boolean isFirst = true;
                        for (Object o : objs) {
                                if (isFirst) {
                                        isFirst = false;
                                } else {
                                        sb.append(", ");
                                }
                                sb.append(SQLSyntaxUtils.objToStr(o));
                        }

                        sb.append(")");
                        return this;
                }

        }

        protected StringBuilder sb;

        protected InsertClause(StringBuilder sb) {
                this.sb = sb;
                sb.append("insert");
        }

        public InsertInto into(String tbl) {
                return new InsertInto(sb, tbl);
        }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Collections;
using System.Data.OleDb;
using System.Threading;
using NPOI.XSSF.UserModel;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System.IO;
using IDCM.OverallSC.Commons;
using IDCM.ControlMBL.Utilities;
using IDCM.ControlMBL.AsyncInvoker;
using IDCM.ServiceBL.DataTransfer;
using IDCM.SimpleDAL.DAM;
using IDCM.SimpleDAL.POO;
using IDCM.ServiceBL.Common.Converter;
using IDCM.ViewLL.Win;

namespace IDCM.ServiceBL.DataTransfer
{
    class ExcelDataImporter
    {
        /// <summary>
        /// 解析指定的Excel文档,执行数据转换.
        /// 本方法调用对类功能予以线程包装,用于异步调用如何方法。
        /// 在本线程调用下的控件调用,需通过UI控件的Invoke/BegainInvoke方法更新。
        /// </summary>
        /// <param name="fpath"></param>
        /// <returns>返回请求流程是否执行完成</returns>
        public static bool parseExcelData(string fpath,long lid,long plid)
        {
            if (fpath == null || fpath.Length < 1)
                return false;
            string fullPath = System.IO.Path.GetFullPath(fpath);
            IWorkbook workbook = null;
            try
            {
                using (FileStream fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
                {
                    workbook = WorkbookFactory.Create(fs);
                    ISheet dataSheet = workbook.GetSheet("Core Datasets");
                    if (dataSheet == null)
                        dataSheet = workbook.GetSheetAt(0);
                    parseSheetInfo(dataSheet,Convert.ToString(lid,10),Convert.ToString(plid,10));
                }
            }
            catch (Exception ex)
            {
                log.Info("ERROR: Excel文件导入失败! ", ex);
                MessageBox.Show("ERROR: Excel文件导入失败! " + ex.Message + "\n" + ex.StackTrace);
            }
            return true;
        }
        /// <summary>
        /// 通过NPOI读取Excel文档,转换可识别内容至本地数据库中
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="dgv"></param>
        public static void parseSheetInfo(ISheet sheet, string lid, string plid)
        {
            int skipIdx = 1;
            if (sheet == null || sheet.LastRowNum < skipIdx) //no data
                return;
            /////////////////////////////////////////////////////////
            IRow titleRow = sheet.GetRow(skipIdx - 1);
            int columnSize = titleRow.LastCellNum;
            int rowSize = sheet.LastRowNum;
            List<string> xlscols = new List<string>(columnSize);
            for (int i = titleRow.FirstCellNum; i < columnSize; i++)
            {
                ICell titleCell = titleRow.GetCell(i);
                if (titleCell != null && titleCell.ToString().Length>0)
                {
                    string cellData = titleCell.ToString();
                    xlscols.Add(CVNameConverter.toViewName(cellData.Trim().ToLower()));
                }
                else
                {
                    xlscols.Add(null);
                }
            }
            AttrMapOptionDlg amoDlg = new AttrMapOptionDlg();
            Dictionary<string, string> dataMapping = new Dictionary<string, string>();
            amoDlg.setInitCols(xlscols, ColumnMappingHolder.getViewAttrs(false), ref dataMapping);
            amoDlg.ShowDialog();
            ///////////////////////////////////////////
            if (amoDlg.DialogResult == DialogResult.OK)
            {
                amoDlg.Dispose();
                for (int i = skipIdx; i <= rowSize; ++i)
                {
                    IRow row = sheet.GetRow(i);
                    if (row == null) continue; //没有数据的行默认是null
                    ICell headCell = row.GetCell(row.FirstCellNum);
                    if (headCell == null || headCell.ToString().Length == 0 || headCell.ToString().Equals("end!"))
                        break;
                    Dictionary<string, string> mapValues = new Dictionary<string, string>();
                    for (int j = row.FirstCellNum; j < columnSize; j++)
                    {
                        if (row.GetCell(j) != null && xlscols[j]!=null)
                        {
                            string cellData = row.GetCell(j).ToString().Trim();
                            string mapName = null;
                            dataMapping.TryGetValue(xlscols[j], out mapName);
                            if (mapName != null)
                            {
                                mapValues[mapName] = cellData;
                            }
                        }
                    }
                    mapValues[CTDRecordDAM.CTD_LID] = lid;
                    mapValues[CTDRecordDAM.CTD_PLID] = plid;
                    long nuid = CTDRecordDAM.mergeRecord(mapValues);
                }
            }else
                amoDlg.Dispose();
        }

        private static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
    }
}


text:
@interface ISBaseModel : NSObject

@property (nonatomic,strong) NSArray * primaryKey;

@end


text:
//
//  AppController.m
//  Amnesty Client
//
//  Created by Danny Espinoza on 1/4/06.
//  Copyright 2006 Mesa Dynamics, LLC. All rights reserved.
//

#import "AppController.h"
#import "WidgetController.h"

#include "CFontList.h"
#include "CWidget.h"
#include "WidgetUtilities.h"

extern "C" UInt32 GetCurrentKeyModifiers();

/* Example:
	<key>CFBundleName</key>
	<string>World Clock</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>

	<key>AmnestyClientStamp</key>
	<string>1137018635.066035</string>
	<key>AmnestyClientKey</key>
	<string>48D2-5FA7-E91D-E78B</string>
	<key>AmnestyClientSignature</key>
	<string>4834-7534-3503-ADD4</string>

	<key>AmnestyClientPath</key>
	<string>World Clock.wdgt</string>
	<key>AmnestyClientID</key>
	<string>com.apple.widget.worldclock</string>

	<key>AmnestyClientCommands</key>
	<array>
		<dict>
			<key>CommandTitle</key>
			<string>Test</string>
			<key>CommandKey</key>
			<string>t</string>
			<key>CommandString</key>
			<string>showbackside()</string>
		</dict>
	</array>
*/

#define kClientBundleID CFSTR("com.mesadynamics.AmnestySingles")

@implementation AppController

- (id)init
{
	[super init];

	if(self) {
		commandArray = nil;
		widget = nil;
		data = nil;
		name = nil;
		path = nil;
		nameString = nil;
		pathString = nil;

		opener = nil;

		enableFlip = YES;
	}

	return self;
}

- (void)dealloc
{
	[super dealloc];
}

- (void)awakeFromNib
{
	[NSApp activateIgnoringOtherApps: YES];

	macVersion = 0;
	Gestalt(gestaltSystemVersion, &macVersion);

	NSNumber* setting = (NSNumber*) CFPreferencesCopyAppValue(CFSTR("EnableFlip"), kClientBundleID);
	if(setting)
		enableFlip = [setting boolValue];

	[NSApp setDelegate: self];

	NSMenu* mainMenu = [NSApp mainMenu];

	[self buildCommandArray];
	[self handleMenu:mainMenu];

	// set the client menus to match the widget's name
	NSString* widgetName = nil;
	NSDictionary* infoPlist = [[NSBundle mainBundle] infoDictionary];
	if(infoPlist) {
		widgetName = (NSString*) [infoPlist objectForKey:@"CFBundleName"];

		if(widgetName) {
			NSMenuItem* appMenuItem = [mainMenu itemAtIndex:0];
			NSMenu* appMenu = [appMenuItem submenu];
			NSArray* appMenuItems = [appMenu itemArray];
			if(appMenuItems) {
				NSEnumerator* enumerator = [appMenuItems objectEnumerator];
				NSMenuItem* item;

				while(item = [enumerator nextObject]) {
					NSString* title = [item title];

					NSRange range = [title rangeOfString:@"Amnesty Client" options:NSCaseInsensitiveSearch];
					if(range.length != 0) {
						NSMutableString* newTitle = [title mutableCopyWithZone:nil];
						[newTitle replaceOccurrencesOfString:@"Amnesty Client" withString:widgetName options:0 range:NSMakeRange(0, [newTitle length])];
						[item setTitle:newTitle];
					}
				}
			}
		}
	}

	[self openAmnesty];
}

- (void)buildCommandArray
{
	NSMenu* mainMenu = [NSApp mainMenu];

	NSMenuItem* commandMenuItem = nil;
	NSMenu* commandMenu = nil;
	NSZone* mZone = [NSMenu menuZone];

	NSDictionary* infoPlist = [[NSBundle mainBundle] infoDictionary];
	NSArray* commands = [infoPlist objectForKey:@"AmnestyClientCommands"];

	if(commands) {
		NSEnumerator* enumerator = [commands objectEnumerator];
		NSDictionary* cmd;

		int tag = 5000;

		while(cmd = [enumerator nextObject]) {
			NSString* cmdTitle = [cmd objectForKey:@"CommandTitle"];
			NSString* cmdKey = [cmd objectForKey:@"CommandKey"];
			NSString* cmdString = [cmd objectForKey:@"CommandString"];

			if([cmdKey isEqualToString:@"nil"])
				cmdKey = @"";

			if(commandArray == nil) {
				commandArray = [NSMutableArray arrayWithCapacity:[commands count]];
				[commandArray retain];
			}

			if(cmdTitle && cmdString) {
				if(commandMenuItem == nil) {
					commandMenuItem = [[NSMenuItem allocWithZone: mZone] initWithTitle: NSLocalizedString(@"CommandMenu", @"")
						action: @selector(menuAction:)
						keyEquivalent: @""];

					commandMenu	= [[NSMenu allocWithZone: mZone] initWithTitle:NSLocalizedString(@"CommandMenu", @"")];
					[commandMenu setAutoenablesItems:NO];
					[commandMenu setDelegate:(id)self];
					[commandMenuItem setSubmenu:commandMenu];

					[mainMenu addItem:commandMenuItem];
				}

				if(commandMenuItem) {
					NSMenuItem* cmdMenuItem = [[NSMenuItem allocWithZone: mZone] initWithTitle: cmdTitle
						action: @selector(menuAction:)
						keyEquivalent: cmdKey];

					[cmdMenuItem setTag:tag++];

					[commandMenu addItem:cmdMenuItem];

					NSString* commandString = [NSString stringWithString:cmdString];
					[commandString retain];

					[commandArray addObject:commandString];
				}
			}
		}
	}
}

- (void)handleMenu:(NSMenu*)menu
{
	[menu setDelegate:(id)self];

	NSArray* mainMenuItems = [menu itemArray];
	if(mainMenuItems) {
		NSEnumerator* enumerator = [mainMenuItems objectEnumerator];
		NSMenuItem* item;

		while(item = [enumerator nextObject]) {
			NSMenu* submenu = [item submenu];
			if(submenu)
				[self handleMenu:submenu];
		}
	}
}

- (BOOL)openAmnesty
{
	return YES;
}

- (void)closeAmnesty
{
	CFontList* fontList = CFontList::GetInstance(false);
	if(fontList)
		fontList->Free();
}

- (BOOL)openWidget
{
	BOOL addToList = YES;

	NSString* widgetStamp = nil;
	NSString* widgetPath = nil;
	NSString* widgetID = nil;
	NSString* widgetName = nil;
	NSDictionary* infoPlist = [[NSBundle mainBundle] infoDictionary];
	if(infoPlist) {
        // AmnestyClientKey and AmnestyClientSignature are ignored in free version

		widgetStamp = (NSString*) [infoPlist objectForKey:@"AmnestyClientStamp"];
		widgetPath = (NSString*) [infoPlist objectForKey:@"AmnestyClientPath"];
		widgetID = (NSString*) [infoPlist objectForKey:@"AmnestyClientID"];
		widgetName = (NSString*) [infoPlist objectForKey:@"CFBundleName"];
    }

	NSBundle* bundle = [NSBundle mainBundle];

	if([widgetPath hasPrefix:@"/"] == NO) {
		NSString* embeddedPath = [NSString stringWithFormat:@"%@/%@", [bundle resourcePath], widgetPath];
		widgetPath = embeddedPath;
	}

	UInt32 modifiers = GetCurrentKeyModifiers();

	BOOL didRedirect = NO;
	BOOL didFind = NO;
	NSString* redirectKey = [NSString stringWithFormat:@"%@-Redirect", widgetStamp];

	NSFileManager* fm = [NSFileManager defaultManager];
	if(widgetPath == nil || [fm fileExistsAtPath: widgetPath] == NO) {
		if((modifiers & (1<<8)) && (modifiers & (1<<11))) {
			CFPreferencesSetAppValue((CFStringRef) redirectKey, (CFStringRef) NULL, kCFPreferencesCurrentApplication);
			CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
		}
		else {
			NSString* redirect = (NSString*) CFPreferencesCopyAppValue((CFStringRef) redirectKey, kClientBundleID);
			if(redirect) {
				if([fm fileExistsAtPath: redirect]) {
					widget = new CWidget((CFStringRef) redirect);

					didRedirect = YES;
				}
			}

			if(widget == nil) {
				widget = [self findWidget:widgetID];

				if(widget) {
					didFind = YES;
					addToList = NO;
				}
			}
		}

		if(widget == nil) {
			NSAlert* alert = [NSAlert alertWithMessageText: NSLocalizedString(@"MissingTitle", @"")
				defaultButton: NSLocalizedString(@"GenericOK", @"")
				alternateButton: nil
				otherButton: nil
				informativeTextWithFormat: NSLocalizedString(@"MissingMessage", @""), widgetName];

			[NSApp activateIgnoringOtherApps: YES];
			[[alert window] setLevel: NSStatusWindowLevel+1];
			[alert runModal];

			NSOpenPanel* panel = [NSOpenPanel openPanel];
			NSArray* fileTypes = [NSArray arrayWithObject:@"wdgt"];
			if([panel runModalForTypes:fileTypes] == NSOKButton) {
				NSArray* filePaths = [panel filenames];
				widgetPath = [filePaths objectAtIndex:0];
				widget = new CWidget((CFStringRef) widgetPath);

				didRedirect = YES;

				if(widget) {
					CFPreferencesSetAppValue((CFStringRef) redirectKey, (CFStringRef) widgetPath, kClientBundleID);
					CFPreferencesAppSynchronize(kClientBundleID);
				}
			}
		}
	}
	else
		widget = new CWidget((CFStringRef) widgetPath);

	if(widget == nil) {
		if(didRedirect) {
			CFPreferencesSetAppValue((CFStringRef) redirectKey, (CFStringRef) NULL, kClientBundleID);
			CFPreferencesAppSynchronize(kClientBundleID);
		}

		return NO;
	}

	if([widgetID isEqualToString:(NSString*)widget->GetID()] == NO) {
		NSAlert* alert = [NSAlert alertWithMessageText: NSLocalizedString(@"MismatchTitle", @"")
			defaultButton: NSLocalizedString(@"GenericQuit", @"")
			alternateButton: nil
			otherButton: nil
			informativeTextWithFormat: NSLocalizedString(@"MismatchMessage", @""), widgetName];

		[NSApp activateIgnoringOtherApps: YES];
		[[alert window] setLevel: NSStatusWindowLevel+1];
		[alert runModal];

		if(didRedirect) {
			CFPreferencesSetAppValue((CFStringRef) redirectKey, (CFStringRef) NULL, kClientBundleID);
			CFPreferencesAppSynchronize(kClientBundleID);
		}

		return NO;
	}

	if(addToList) {
		CWidgetList* list = CWidgetList::GetInstance();
		list->AddWidget(widget);
	}

	widget->Core();

	if(widget->IsValid() == false) {
		NSAlert* alert = nil;

		if(widget->IsForbidden()) {
			alert = [NSAlert alertWithMessageText: NSLocalizedString(@"NoSupportTitle", @"")
				defaultButton: NSLocalizedString(@"GenericQuit", @"")
				alternateButton: nil
				otherButton: nil
				informativeTextWithFormat: NSLocalizedString(@"NoSupportPantherMessage", @""), widgetName];
		}
		else {
			alert = [NSAlert alertWithMessageText: NSLocalizedString(@"NoSupportTitle", @"")
				defaultButton: NSLocalizedString(@"GenericQuit", @"")
				alternateButton: nil
				otherButton: nil
				informativeTextWithFormat: NSLocalizedString(@"NoSupportMessage", @""), widgetName];
		}

		[NSApp activateIgnoringOtherApps: YES];
		[[alert window] setLevel: NSStatusWindowLevel+1];
		[alert runModal];

		widget = nil;
		return NO;
	}

	FindPlugins(widget->GetPath(), true);

	widget->LoadFonts();

	WidgetController* controller = [[WidgetController alloc] init];

	[controller setCompatible: (widget->GetCompatible() ? YES : NO)];

	[controller setSecurityFile: YES];
	[controller setSecurityPlugins: YES];
	[controller setSecurityJava: YES];
	[controller setSecurityNet: YES];
	[controller setSecuritySystem: YES];

	[controller setLocalFolder: widget->GetLocalFolder()];

	NSURL* widgeturl = (NSURL*) widget->GetWidgetURL();
	[controller setWidgetURL: widgeturl];

	NSURL* pluginurl = (NSURL*) widget->GetPluginURL();
	if(pluginurl) // optional
		[controller setPluginURL: pluginurl];

	NSURL* iconurl = (NSURL*) widget->GetIconURL();
	if(iconurl) // optional
		[controller setIconURL: iconurl];

	NSString* bid = (NSString*) widget->GetID();
	[controller setWidgetID: bid];

	NSString* pth = (NSString*) widget->GetPath();
	[controller setWidgetPath: pth];

	NSWindow* window = [controller window];
	[window setTitle: (NSString*) widget->GetName()];

	NSRect widgetFrame;
	widgetFrame.origin.x = 0.0;
	widgetFrame.origin.y = 0.0;
	widgetFrame.size.width = (float) widget->GetWidth();
	widgetFrame.size.height = (float) widget->GetHeight();

	NSRect contentRect = [window contentRectForFrameRect: widgetFrame];
	[window setFrame: contentRect display: NO];

	[window center];

	widget->SetController(controller);

	[controller prepareWidget:self];

	return YES;
}

- (void)handleOpen:(id)sender
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();

		if(controller) {
			if([controller closing] == NO && [controller loaded] == NO) {
				[self performSelectorOnMainThread: @selector(handleOpenTask:) withObject: controller waitUntilDone:NO];
				return;
			}
		}
	}
}

- (void)handleOpenTask:(id)sender
{
	WidgetController* controller = sender;

	if([controller closing] == NO && [controller loaded] == NO) {
		if([controller busy] == YES) {
			[controller runWidget:self];
			[opener invalidate];
		}
		else
			[controller loadWidget:self];
	}
}

- (void)closeWidget:(id)sender
{
	if(widget) {
		FindPlugins(widget->GetPath(), false);

		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller) {
			[controller forceQuit];
		}
	}
}

- (CWidget*)findWidget:(NSString*)wid
{
	{
		NSMutableString* amnestyWidgetString = [NSMutableString stringWithCapacity: 1024];
		[amnestyWidgetString appendString: NSHomeDirectory()];
		[amnestyWidgetString appendString: @"/Library/Application Support/Amnesty/Widgets"];
		FindWidgets((CFStringRef) amnestyWidgetString, 2);
	}

	if(macVersion >= 0x1040) {
		NSMutableString* localWidgetString = [NSMutableString stringWithCapacity: 1024];
		[localWidgetString appendString: NSHomeDirectory()];
		[localWidgetString appendString: @"/Library/Widgets"];
		FindWidgets((CFStringRef) localWidgetString, 1);
	}

	if(macVersion >= 0x1040) {
		NSMutableString* systemWidgetString = [NSMutableString stringWithCapacity: 1024];
		[systemWidgetString appendString: NSOpenStepRootDirectory()];
		[systemWidgetString appendString: @"Library/Widgets"];
		FindWidgets((CFStringRef) systemWidgetString, 1);
	}

	CWidgetList* list = CWidgetList::GetInstance();
	list->Sort();

	for(int i = 1; i <= list->Size(); i++) {
		CWidget* testWidget = list->GetByIndex(i);
		if(testWidget) {
			if([wid isEqualToString: (NSString*) testWidget->GetID()]) {
				return testWidget;
			}
		}
	}

	return nil;
}

- (NSString*)getWidgetName // key
{
	return nameString;
}

- (NSString*)getWidgetPath // signature
{
	return pathString;
}

- (NSImage*)getWidgetIcon
{
	NSImage* icon = nil;

	if(widget) {
		NSURL* url = (NSURL*) widget->GetIconURL();

		if(url) {
			icon = [[NSImage alloc] initWithContentsOfURL: url];
			[url release];
		}
	}

	return icon;
}

- (IBAction)minimizeAction:(id)sender
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller && [controller busy] == NO) {
			NSWindow* window = [controller window];
			[window miniaturize:self];
		}
	}
}

- (IBAction)refreshAction:(id)sender
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller && [controller busy] == NO)
			[controller manualRefresh:self];
	}
}

- (IBAction)spacesAction:(id)sender
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller && [controller busy] == NO) {
			NSMenuItem* item = (NSMenuItem*) sender;
			if([item state] == NSOnState)
				[controller setAllSpaces:NO];
			else
				[controller setAllSpaces:YES];
		}
	}
}

- (IBAction)getInfoAction:(id)sender
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller && [controller busy] == NO) {
			[controller getInfo:self];
		}
	}
}

- (IBAction)menuAction:(id)sender
{
	NSMenuItem* item = (NSMenuItem*) sender;

	int tag = [item tag];

	WidgetController* controller = (WidgetController*) widget->GetController();
	if(controller && [controller busy])
		return;

	if(tag >= 5000 && tag < 6000 && commandArray)
		[controller runCommand:[commandArray objectAtIndex:(tag - 5000)]];
	else if(tag >= 4000 && tag < 5000)
		[controller setAutoUpdate:(tag - 4000)];

	switch(tag) {
		case 3000:
		case 3001:
		case 3002:
		case 3003:
				[controller setWindowLevel:(tag - 3000)];
			break;
	}
}

- (IBAction)aboutAction:(id)sender
{
	NSImage* icon = [self getWidgetIcon];

	if(icon) {
		NSDictionary* dict = [NSDictionary dictionaryWithObject:icon forKey:@"ApplicationIcon"];
		[NSApp orderFrontStandardAboutPanelWithOptions:dict];

		[icon release];
	}
	else
		[NSApp orderFrontStandardAboutPanel:self];
}

// NSApplication delegate
- (void)applicationWillHide:(NSNotification* )aNotification
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller)
			[controller hideNow];
	}
}

- (void)applicationWillUnhide:(NSNotification* )aNotification
{
	if(widget) {
		WidgetController* controller = (WidgetController*) widget->GetController();
		if(controller)
			[controller showNow];
	}
}

- (void)applicationWillTerminate:(NSNotification* )aNotification
{
	[self closeWidget:self];
	[self closeAmnesty];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
	if([self openWidget] == NO)
		exit(1);

	opener = [NSTimer
		scheduledTimerWithTimeInterval: (double) 0.125
		target: self
		selector:@selector(handleOpen:)
		userInfo: nil
		repeats: YES];
}

// NSMenu
- (void)menuNeedsUpdate:(NSMenu *)menu
{
	NSArray* menuItems = [menu itemArray];
	if(menuItems == nil || widget == NULL)
		return;

	NSEnumerator* enumerator = [menuItems objectEnumerator];
	NSMenuItem* item;

	while(item = [enumerator nextObject]) {
		int tag = [item tag];

		if(tag >= 4000 && tag < 5000) {
			BOOL active = NO;
			WidgetController* controller = nil;

			if(widget) {
				controller = (WidgetController*) widget->GetController();
				if(controller && [controller busy] == NO)
					active = YES;
			}

			if(controller && (tag - 4000) == [controller getAutoUpdate])
				[item setState: NSOnState];
			else
				[item setState: NSOffState];

			if(active && [controller canRefresh] == NO)
				active = NO;

			[item setEnabled:active];
		}
		else switch(tag) {
			case 3000:
			case 3001:
			case 3002:
			case 3003:
			{
				if(widget) {
					WidgetController* controller = (WidgetController*) widget->GetController();
					if(controller && (tag - 3000) == [controller getWindowLevel])
						[item setState: NSOnState];
					else
						[item setState: NSOffState];
				}

				// drop
			}

			default:
			{
				BOOL active = NO;
				WidgetController* controller = nil;

				if(widget) {
					controller = (WidgetController*) widget->GetController();
					if(controller && [controller busy] == NO)
						active = YES;
				}

				if(active && (tag == 2000 || tag == 2002) && [controller canRefresh] == NO)
					active = NO;

				[item setEnabled:active];

				if(tag == 2003) {
					if(macVersion >= 0x1050) {
						BOOL spaces = [controller allSpaces];
						[item setState:(spaces ? NSOnState : NSOffState)];
					}
					else
						[item setEnabled:NO];
				}

				break;
			}
		}
	}
}

// Amnesty
- (BOOL)doesEnableFlip
{
	return enableFlip;
}

@end


text:
package home.manager.system.hardware.modules;

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

public class HubModule extends BaseModule implements ParentModule {

    private Map<Long, Module> moduleList;

    public HubModule() {
        super();
        moduleList = new HashMap<>();
    }

    @Override
    public boolean addModule(Module module) {
        moduleList.put(module.getId(), module);
        return true;
    }

    @Override
    public boolean addAllModule(Module... modules) {
        for (Module m : modules) {
            this.addModule(m);
        }
        return true;
    }

    @Override
    public Module getModule(long id) {
        return moduleList.get(id);
    }

    @Override
    public Collection<Module> getAllModules() {
        return new ArrayList<>(moduleList.values());
    }

    @Override
    public int size() {
        return moduleList.size();
    }

    @Override
    public boolean removeModule(long id) {
        moduleList.remove(id);
        return true;
    }

    @Override
    public boolean removeAllModule() {
        moduleList.clear();
        return true;

    }

    @Override
    public boolean turnOffModule(long moduleId) {
        if (this.getId() == moduleId)
            this.turnOff();
        this.getModule(moduleId).turnOff();
        return true;
    }

    @Override
    public boolean turnOnModule(long moduleId) {
        if (this.getId() == moduleId) {
            this.turnOn();
        } else {
            if (this.moduleList.containsKey(moduleId)) {
                this.getModule(moduleId).turnOn();
            }
        }
        return true;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        for (Module m : this.moduleList.values())
            b.append(m.toString()).append("\n");
        return b.toString();
    }
}


text:
package org.cometd.oort;

import java.util.concurrent.atomic.AtomicLong;

/**
 *
A distributed counter service to be deployed on a Oort cluster that
 * modifies a {@code long} value hosted in a "master" node.

 *
Instances of this service may be used as unique ID generator, or as
 * unique counter across the cluster, for example to aggregate values
 * from different nodes, such as the number of users connected to each
 * node.

 *
Applications may call methods {@link #addAndGet(long, Callback)} or
 * {@link #getAndAdd(long, Callback)} providing the amount to add
 * (it may be negative) and a {@link Callback} object that will be
 * invoked on the requesting node when the result has been
 * computed and transmitted back by the "master" node.

 */
public class OortMasterLong extends OortMasterService<Long, OortMasterLong.Context>
{
    private final AtomicLong value = new AtomicLong();

    public OortMasterLong(Oort oort, String name, boolean master)
    {
        this(oort, name, master, 0);
    }

    /**
     * @param oort the oort this instance is associated to
     * @param name the name of this service
     * @param master whether this service lives on the "master" node
     * @param initial the initial local value
     */
    public OortMasterLong(Oort oort, String name, boolean master, long initial)
    {
        super(oort, name, master);
        value.set(initial);
    }

    /**
     * @return the local value, which makes sense only if called on the "master" node.
     */
    protected long getValue()
    {
        return value.get();
    }

    /**
     * Retrieves the value from the "master" node and then invokes the given {@code callback}
     * with the result value.
     *
     * @param callback the callback invoked when the result is available
     * @return whether the request could be forwarded to the "master" node
     */
    public boolean get(Callback callback)
    {
        return getAndAdd(0, callback);
    }

    /**
     * Adds the given {@code delta} and then invokes the given {@code callback} with
     * the counter value after the addition.
     * The counter value may be already out of date at the moment
     * of the invocation of the {@code callback}.
     *
     * @param delta    the value to add, may be negative
     * @param callback the callback invoked when the result is available
     * @return whether the request could be forwarded to the "master" node
     * @see #getAndAdd(long, Callback)
     */
    public boolean addAndGet(long delta, Callback callback)
    {
        return forward(getMasterOortURL(), delta, new Context(delta, callback, true));
    }

    /**
     * Adds the given {@code delta} and then invokes the given {@code callback} with
     * the counter value before the addition.
     *
     * @param delta    the value to add, may be negative
     * @param callback the callback invoked when the result is available
     * @return whether the request could be forwarded to the "master" node
     * @see #addAndGet(long, Callback)
     */
    public boolean getAndAdd(long delta, Callback callback)
    {
        return forward(getMasterOortURL(), delta, new Context(delta, callback, false));
    }

    @Override
    protected Result<Long> onForward(Request request)
    {
        if (!isMaster())
            return Result.ignore(0L);

        long delta = ((Number)request.getData()).longValue();
        long oldValue = value.get();
        while (true)
        {
            if (value.compareAndSet(oldValue, oldValue + delta))
                break;
            oldValue = value.get();
        }
        return Result.success(oldValue);
    }

    @Override
    protected void onForwardSucceeded(Long result, Context context)
    {
        context.callback.succeeded(context.compute ? result + context.delta : result);
    }

    @Override
    protected void onForwardFailed(Object failure, Context context)
    {
        context.callback.failed(failure);
    }

    /**
     * Callback invoked when the result of the operation on the counter is available,
     * or when the operation failed.
     */
    public interface Callback
    {
        /**
         * Callback method invoked when the operation on the counter succeeded.
         *
         * @param result the result of the operation
         */
        public void succeeded(Long result);

        /**
         * Callback method invoked when the operation on the counter failed.
         *
         * @param failure the failure object
         */
        public void failed(Object failure);

        /**
         * Empty implementation of {@link Callback}
         */
        public static class Adapter implements Callback
        {
            public void succeeded(Long result)
            {
            }

            public void failed(Object failure)
            {
            }
        }
    }

    protected static class Context
    {
        private final long delta;
        private final Callback callback;
        private final boolean compute;

        private Context(long delta, Callback callback, boolean compute)
        {
            this.delta = delta;
            this.callback = callback;
            this.compute = compute;
        }
    }
}


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):

        # Adding model 'GroupStateName'
        db.create_table('name_groupstatename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['GroupStateName'])

        # Adding model 'GroupTypeName'
        db.create_table('name_grouptypename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['GroupTypeName'])

        # Adding model 'RoleName'
        db.create_table('name_rolename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['RoleName'])

        # Adding model 'StreamName'
        db.create_table('name_streamname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['StreamName'])

        # Adding model 'DocRelationshipName'
        db.create_table('name_docrelationshipname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['DocRelationshipName'])

        # Adding model 'DocTypeName'
        db.create_table('name_doctypename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['DocTypeName'])

        # Adding model 'DocTagName'
        db.create_table('name_doctagname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['DocTagName'])

        # Adding model 'StdLevelName'
        db.create_table('name_stdlevelname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['StdLevelName'])

        # Adding model 'IntendedStdLevelName'
        db.create_table('name_intendedstdlevelname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['IntendedStdLevelName'])

        # Adding model 'DocReminderTypeName'
        db.create_table('name_docremindertypename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['DocReminderTypeName'])

        # Adding model 'BallotPositionName'
        db.create_table('name_ballotpositionname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['BallotPositionName'])

        # Adding model 'GroupBallotPositionName'
        db.create_table('name_groupballotpositionname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['GroupBallotPositionName'])

        # Adding model 'MeetingTypeName'
        db.create_table('name_meetingtypename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['MeetingTypeName'])

        # Adding model 'SessionStatusName'
        db.create_table('name_sessionstatusname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['SessionStatusName'])

        # Adding model 'TimeSlotTypeName'
        db.create_table('name_timeslottypename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['TimeSlotTypeName'])

        # Adding model 'ConstraintName'
        db.create_table('name_constraintname', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['ConstraintName'])

        # Adding model 'LiaisonStatementPurposeName'
        db.create_table('name_liaisonstatementpurposename', (
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=8, primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('desc', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('used', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('order', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal('name', ['LiaisonStatementPurposeName'])

    def backwards(self, orm):

        # Deleting model 'GroupStateName'
        db.delete_table('name_groupstatename')

        # Deleting model 'GroupTypeName'
        db.delete_table('name_grouptypename')

        # Deleting model 'RoleName'
        db.delete_table('name_rolename')

        # Deleting model 'StreamName'
        db.delete_table('name_streamname')

        # Deleting model 'DocRelationshipName'
        db.delete_table('name_docrelationshipname')

        # Deleting model 'DocTypeName'
        db.delete_table('name_doctypename')

        # Deleting model 'DocTagName'
        db.delete_table('name_doctagname')

        # Deleting model 'StdLevelName'
        db.delete_table('name_stdlevelname')

        # Deleting model 'IntendedStdLevelName'
        db.delete_table('name_intendedstdlevelname')

        # Deleting model 'DocReminderTypeName'
        db.delete_table('name_docremindertypename')

        # Deleting model 'BallotPositionName'
        db.delete_table('name_ballotpositionname')

        # Deleting model 'GroupBallotPositionName'
        db.delete_table('name_groupballotpositionname')

        # Deleting model 'MeetingTypeName'
        db.delete_table('name_meetingtypename')

        # Deleting model 'SessionStatusName'
        db.delete_table('name_sessionstatusname')

        # Deleting model 'TimeSlotTypeName'
        db.delete_table('name_timeslottypename')

        # Deleting model 'ConstraintName'
        db.delete_table('name_constraintname')

        # Deleting model 'LiaisonStatementPurposeName'
        db.delete_table('name_liaisonstatementpurposename')

    models = {
        'name.ballotpositionname': {
            'Meta': {'ordering': "['order']", 'object_name': 'BallotPositionName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.constraintname': {
            'Meta': {'ordering': "['order']", 'object_name': 'ConstraintName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.docrelationshipname': {
            'Meta': {'ordering': "['order']", 'object_name': 'DocRelationshipName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.docremindertypename': {
            'Meta': {'ordering': "['order']", 'object_name': 'DocReminderTypeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.doctagname': {
            'Meta': {'ordering': "['order']", 'object_name': 'DocTagName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.doctypename': {
            'Meta': {'ordering': "['order']", 'object_name': 'DocTypeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.groupballotpositionname': {
            'Meta': {'ordering': "['order']", 'object_name': 'GroupBallotPositionName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.groupstatename': {
            'Meta': {'ordering': "['order']", 'object_name': 'GroupStateName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.grouptypename': {
            'Meta': {'ordering': "['order']", 'object_name': 'GroupTypeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.intendedstdlevelname': {
            'Meta': {'ordering': "['order']", 'object_name': 'IntendedStdLevelName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.liaisonstatementpurposename': {
            'Meta': {'ordering': "['order']", 'object_name': 'LiaisonStatementPurposeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.meetingtypename': {
            'Meta': {'ordering': "['order']", 'object_name': 'MeetingTypeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.rolename': {
            'Meta': {'ordering': "['order']", 'object_name': 'RoleName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.sessionstatusname': {
            'Meta': {'ordering': "['order']", 'object_name': 'SessionStatusName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.stdlevelname': {
            'Meta': {'ordering': "['order']", 'object_name': 'StdLevelName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.streamname': {
            'Meta': {'ordering': "['order']", 'object_name': 'StreamName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        'name.timeslottypename': {
            'Meta': {'ordering': "['order']", 'object_name': 'TimeSlotTypeName'},
            'desc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'slug': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'used': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        }
    }

    complete_apps = ['name']


text:
using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.OptionsModel;

namespace Microsoft.AspNet.SignalR.Transports
{
    /// <summary>
    /// The default <see cref="ITransportManager"/> implementation.
    /// </summary>
    public class TransportManager : ITransportManager
    {
        private readonly ConcurrentDictionary<string, Func<HttpContext, ITransport>> _transports = new ConcurrentDictionary<string, Func<HttpContext, ITransport>>(StringComparer.OrdinalIgnoreCase);

        /// <summary>
        /// Initializes a new instance of <see cref="TransportManager"/> class.
        /// </summary>
        /// <param name="serviceProvider">The default <see cref="IDependencyResolver"/>.</param>
        [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Those are factory methods")]
        public TransportManager(IServiceProvider serviceProvider,
                                IOptions<SignalROptions> optionsAccessor)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            if (optionsAccessor == null)
            {
                throw new ArgumentNullException("optionsAccessor");
            }

            var enabledTransports = optionsAccessor.Value.Transports.EnabledTransports;

            if (enabledTransports.HasFlag(TransportType.WebSockets))
            {
                Register("webSockets", context => ActivatorUtilities.CreateInstance<WebSocketTransport>(serviceProvider, context));
            }
            if (enabledTransports.HasFlag(TransportType.ServerSentEvents))
            {
                Register("serverSentEvents", context => ActivatorUtilities.CreateInstance<ServerSentEventsTransport>(serviceProvider, context));
            }
            if (enabledTransports.HasFlag(TransportType.ForeverFrame))
            {
                Register("foreverFrame", context => ActivatorUtilities.CreateInstance<ForeverFrameTransport>(serviceProvider, context));
            }
            if (enabledTransports.HasFlag(TransportType.LongPolling))
            {
                Register("longPolling", context => ActivatorUtilities.CreateInstance<LongPollingTransport>(serviceProvider, context));
            }

            if (_transports.Count == 0)
            {
                throw new InvalidOperationException(Resources.Error_NoTransportsEnabled);
            }
        }

        /// <summary>
        /// Adds a new transport to the list of supported transports.
        /// </summary>
        /// <param name="transportName">The specified transport.</param>
        /// <param name="transportFactory">The factory method for the specified transport.</param>
        public void Register(string transportName, Func<HttpContext, ITransport> transportFactory)
        {
            if (String.IsNullOrEmpty(transportName))
            {
                throw new ArgumentNullException("transportName");
            }

            if (transportFactory == null)
            {
                throw new ArgumentNullException("transportFactory");
            }

            _transports.TryAdd(transportName, transportFactory);
        }

        /// <summary>
        /// Removes a transport from the list of supported transports.
        /// </summary>
        /// <param name="transportName">The specified transport.</param>
        public void Remove(string transportName)
        {
            if (String.IsNullOrEmpty(transportName))
            {
                throw new ArgumentNullException("transportName");
            }

            Func<HttpContext, ITransport> removed;
            _transports.TryRemove(transportName, out removed);
        }

        /// <summary>
        /// Gets the specified transport for the specified <see cref="HttpContext"/>.
        /// </summary>
        /// <param name="context">The <see cref="HttpContext"/> for the current request.</param>
        /// <returns>The <see cref="ITransport"/> for the specified <see cref="HttpContext"/>.</returns>
        public ITransport GetTransport(HttpContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            string transportName = context.Request.Query["transport"];

            if (String.IsNullOrEmpty(transportName))
            {
                return null;
            }

            Func<HttpContext, ITransport> factory;
            if (_transports.TryGetValue(transportName, out factory))
            {
                return factory(context);
            }

            return null;
        }

        /// <summary>
        /// Determines whether the specified transport is supported.
        /// </summary>
        /// <param name="transportName">The name of the transport to test.</param>
        /// <returns>True if the transport is supported, otherwise False.</returns>
        public bool SupportsTransport(string transportName)
        {
            if (String.IsNullOrEmpty(transportName))
            {
                return false;
            }

            return _transports.ContainsKey(transportName);
        }
    }
}


text:
DROP TABLE IF EXISTS invitations;
CREATE TABLE invitations (
  user_id      char(016),
  hash         char(016),
  invited_to   char(016),
  issued_at   timestamp,
  clicked_at   timestamp,
  invited_at   timestamp
);


text:
<!DOCTYPE html>

one two three four five six seven eight


text:
<?php

	// 	Donut 				🍩
	//	Dictionary Toolkit
	// 		Version a.1
	//		Written by Thomas de Roo
	//		Licensed under MIT

	//	++	File: admin.structure.cset.php

class pSimpleStructure extends pStructure{

	private $_ajax, $_section, $_template;

	public function compile(){
		if(isset(pRegister::arg()['section']))
			$this->_section = pRegister::arg()['section'];
		else
			$this->_section = $this->_default_section;

		if(isset($this->_structure['template']))
			$this->_template = new $this->_structure['template'];
		else
			die('Could not compile the simple structure, requires a template!');

		pMainTemplate::setTitle($this->_page_title);

	}

	public function render(){

		// Call the render function of the simple template
		$this->_template->renderAll();

	}

}


text:
from django.db import models, migrations
from django.conf import settings
import django.core.validators
import markupfield.fields
import django.utils.timezone

class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('password', models.CharField(verbose_name='password', max_length=128)),
                ('last_login', models.DateTimeField(verbose_name='last login', default=django.utils.timezone.now)),
                ('is_superuser', models.BooleanField(help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status', default=False)),
                ('username', models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')], verbose_name='username', unique=True)),
                ('first_name', models.CharField(blank=True, verbose_name='first name', max_length=30)),
                ('last_name', models.CharField(blank=True, verbose_name='last name', max_length=30)),
                ('email', models.EmailField(blank=True, verbose_name='email address', max_length=75)),
                ('is_staff', models.BooleanField(help_text='Designates whether the user can log into this admin site.', verbose_name='staff status', default=False)),
                ('is_active', models.BooleanField(help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active', default=True)),
                ('date_joined', models.DateTimeField(verbose_name='date joined', default=django.utils.timezone.now)),
                ('bio', markupfield.fields.MarkupField(blank=True, rendered_field=True)),
                ('bio_markup_type', models.CharField(choices=[('', '--'), ('html', 'html'), ('plain', 'plain'), ('markdown', 'markdown'), ('restructuredtext', 'restructuredtext')], max_length=30, default='markdown', blank=True)),
                ('search_visibility', models.IntegerField(choices=[(1, 'Allow search engines to index my profile page (recommended)'), (0, "Don't allow search engines to index my profile page")], default=1)),
                ('_bio_rendered', models.TextField(editable=False)),
                ('email_privacy', models.IntegerField(choices=[(0, 'Anyone can see my e-mail address'), (1, 'Only logged-in users can see my e-mail address'), (2, 'No one can ever see my e-mail address')], verbose_name='E-mail privacy', default=2)),
                ('groups', models.ManyToManyField(help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', related_name='user_set', blank=True, related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(help_text='Specific permissions for this user.', related_name='user_set', blank=True, related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name_plural': 'users',
                'verbose_name': 'user',
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('legal_name', models.CharField(max_length=100)),
                ('preferred_name', models.CharField(max_length=100)),
                ('email_address', models.EmailField(max_length=100)),
                ('city', models.CharField(blank=True, max_length=100)),
                ('region', models.CharField(blank=True, verbose_name='State, Province or Region', max_length=100)),
                ('country', models.CharField(blank=True, max_length=100)),
                ('postal_code', models.CharField(blank=True, max_length=20)),
                ('psf_code_of_conduct', models.NullBooleanField(verbose_name='I agree to the PSF Code of Conduct')),
                ('psf_announcements', models.NullBooleanField(verbose_name='I would like to receive occasional PSF email announcements')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('updated', models.DateTimeField(default=django.utils.timezone.now, blank=True)),
                ('creator', models.ForeignKey(null=True, to=settings.AUTH_USER_MODEL, blank=True, related_name='membership', on_delete=models.CASCADE)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]


text:
package org.jenkinsci.plugins.radargun.config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.jenkinsci.plugins.radargun.RadarGunBuilder;
import org.jenkinsci.plugins.radargun.RadarGunInstallation;
import org.jenkinsci.plugins.radargun.util.Functions;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;

import hudson.model.FreeStyleProject;
import hudson.tasks.Builder;

public class RgInstallBackwardCompatibilityTest {

    @Rule public JenkinsRule rule = new JenkinsRule();

    @Test
    @LocalData
    public void testRgInstallations() throws Exception {
        List<RadarGunInstallation> installs = rule.jenkins.getDescriptorByType(RadarGunBuilder.DescriptorImpl.class).getInstallations();
        assertEquals(3, installs.size());
        assertEquals("rg-snapshot", installs.get(0).getName());
        assertEquals("/tmp/radarun/RadarGun-SNAPSHOT", installs.get(0).getHome());
    }

    @Test
    @LocalData
    public void testRgInstallInJobConfig() throws Exception {
        assertTrue(rule.jenkins.getJobNames().contains("backwardComp"));
        FreeStyleProject job = (FreeStyleProject)rule.jenkins.getItem("backwardComp");
        List<Builder> builders = job.getBuilders();
        assertEquals(1, builders.size());
        assertTrue(builders.get(0) instanceof RadarGunBuilder);
        RadarGunBuilder rgBuilder = (RadarGunBuilder)builders.get(0);
        assertEquals("rg-snapshot", rgBuilder.getRadarGunInstance().getName());
        assertTrue(rgBuilder.getRadarGunInstance() instanceof RadarGunInstallationWrapper);
        assertEquals("/tmp/radarun/RadarGun-SNAPSHOT", Functions.getRgInstallation(rgBuilder.getRadarGunInstance()).getHome());
    }

}