text:
package br.com.objectos.way.relational;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;

/**
 * @author marcio.endo@objectos.com.br (Marcio Endo)
 */
class WayRelationalModuleCore extends AbstractModule {

  @Override
  protected void configure() {
    bind(AtomicInsert.class).to(AtomicInsertJdbc.class).in(Scopes.SINGLETON);
    bind(UniqueInsert.class).to(UniqueInsertJdbc.class).in(Scopes.SINGLETON);
  }

}


text:
@implementation SampleLayoutManager
@synthesize menuHeight, menuPosition, useFocusBar, focusBarHeight;

- (instancetype)init {
    self = [super init];
    if (self) {
        menuHeight = 40.f;
        menuPosition = HIUISlidingTabMenuPositionTop;
        useFocusBar = YES;
        focusBarHeight = 2.f;
    }

    return self;
}

@end

redpajama_set_name: RedPajamaGithub


text:
namespace MDFN_IEN_WSWAN
{
class Memory
{
public:
	~Memory();

	uint8 Read20(uint32);
	void Write20(uint32 address,uint8 data);

	void Init(const SyncSettings &settings);

	void CheckSoundDMA();
	void Reset();
	void writeport(uint32 IOPort, uint8 V);
	uint8 readport(uint32 number);
	uint32 GetRegister(const unsigned int id, char *special, const uint32 special_len);
	void SetRegister(const unsigned int id, uint32 value);

public:
	uint8 wsRAM[65536];
	uint8 *wsCartROM;
	uint32 rom_size;
	uint32 sram_size;
	uint8 *wsSRAM; // = NULL;

	uint16 WSButtonStatus; // bitfield of buttons, indeed
	bool Lagged;

private:

	uint8 ButtonWhich, ButtonReadLatch;

	uint32 DMASource, DMADest;
	uint16 DMALength;
	uint8 DMAControl;

	uint32 SoundDMASource;
	uint16 SoundDMALength;
	uint8 SoundDMAControl;

	uint8 BankSelector[4];

	uint8 CommControl, CommData;

	bool language;

public:
	void (*ButtonHook)();

public:
	System *sys;
	template<bool isReader>void SyncState(NewState *ns);
private:
	void CheckDMA();

};

enum
{
 MEMORY_GSREG_ROMBBSLCT = 0,
 MEMORY_GSREG_BNK1SLCT,
 MEMORY_GSREG_BNK2SLCT,
 MEMORY_GSREG_BNK3SLCT,
};

}

#endif


text:
/* usb_descriptor.h - header for common device descriptor */

/*
 * Copyright (c) 2017 PHYTEC Messtechnik GmbH
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef __USB_DESCRIPTOR_H__
#define __USB_DESCRIPTOR_H__

#ifdef CONFIG_USB_CDC_ACM
#define NUMOF_IFACES_CDC_ACM		2
#define NUMOF_ENDPOINTS_CDC_ACM		3
#else
#define NUMOF_IFACES_CDC_ACM		0
#define NUMOF_ENDPOINTS_CDC_ACM		0
#endif

#ifdef CONFIG_USB_MASS_STORAGE
#define NUMOF_IFACES_MASS		1
#define NUMOF_ENDPOINTS_MASS		2
#else
#define NUMOF_IFACES_MASS		0
#define NUMOF_ENDPOINTS_MASS		0
#endif

#ifdef CONFIG_USB_DEVICE_NETWORK_RNDIS
#define NUMOF_IFACES_RNDIS		2
#define NUMOF_ENDPOINTS_RNDIS		3
#else
#define NUMOF_IFACES_RNDIS		0
#define NUMOF_ENDPOINTS_RNDIS		0
#endif

#ifdef CONFIG_USB_DEVICE_NETWORK_ECM
#define NUMOF_IFACES_CDC_ECM		2
#define NUMOF_ENDPOINTS_CDC_ECM		3
#else
#define NUMOF_IFACES_CDC_ECM		0
#define NUMOF_ENDPOINTS_CDC_ECM		0
#endif

#ifdef CONFIG_USB_DEVICE_HID
#define NUMOF_IFACES_HID		1
#define NUMOF_ENDPOINTS_HID		1
#else /* CONFIG_USB_DEVICE_HID */
#define NUMOF_IFACES_HID		0
#define NUMOF_ENDPOINTS_HID		0
#endif /* CONFIG_USB_DEVICE_HID */

#ifdef CONFIG_USB_DEVICE_NETWORK_EEM
#define NUMOF_IFACES_CDC_EEM		1
#define NUMOF_ENDPOINTS_CDC_EEM		2
#else
#define NUMOF_IFACES_CDC_EEM		0
#define NUMOF_ENDPOINTS_CDC_EEM		0
#endif

#ifdef CONFIG_USB_DEVICE_BLUETOOTH
#define NUMOF_IFACES_BLUETOOTH		1
#define NUMOF_ENDPOINTS_BLUETOOTH	3
#else
#define NUMOF_IFACES_BLUETOOTH		0
#define NUMOF_ENDPOINTS_BLUETOOTH	0
#endif

#ifdef CONFIG_USB_DFU_CLASS
#define NUMOF_IFACES_DFU		1
#else
#define NUMOF_IFACES_DFU		0
#endif

#define NUMOF_IFACES	(NUMOF_IFACES_CDC_ACM + NUMOF_IFACES_MASS + \
			 NUMOF_IFACES_RNDIS + NUMOF_IFACES_CDC_ECM + \
			 NUMOF_IFACES_HID + NUMOF_IFACES_CDC_EEM + \
			 NUMOF_IFACES_BLUETOOTH + NUMOF_IFACES_DFU)
#define NUMOF_ENDPOINTS	(NUMOF_ENDPOINTS_CDC_ACM + NUMOF_ENDPOINTS_MASS + \
			 NUMOF_ENDPOINTS_RNDIS + NUMOF_ENDPOINTS_CDC_ECM + \
			 NUMOF_ENDPOINTS_HID + NUMOF_ENDPOINTS_CDC_EEM + \
			 NUMOF_ENDPOINTS_BLUETOOTH)

#define FIRST_IFACE_CDC_ACM		0
#define FIRST_IFACE_MASS_STORAGE	NUMOF_IFACES_CDC_ACM
#define FIRST_IFACE_RNDIS		(NUMOF_IFACES_CDC_ACM + \
					 NUMOF_IFACES_MASS)
#define FIRST_IFACE_CDC_ECM		(NUMOF_IFACES_CDC_ACM + \
					 NUMOF_IFACES_MASS + \
					 NUMOF_IFACES_RNDIS)
#define FIRST_IFACE_HID			(FIRST_IFACE_CDC_ECM + \
					 NUMOF_IFACES_CDC_ECM)
#define FIRST_IFACE_CDC_EEM		(FIRST_IFACE_HID + \
					 NUMOF_IFACES_HID)
#define FIRST_IFACE_BLUETOOTH		(FIRST_IFACE_CDC_EEM + \
					 NUMOF_IFACES_CDC_EEM)
#define FIRST_IFACE_DFU			(FIRST_IFACE_BLUETOOTH + \
					 NUMOF_IFACES_BLUETOOTH)

#define MFR_DESC_LENGTH		(sizeof(CONFIG_USB_DEVICE_MANUFACTURER) * 2)
#define MFR_UC_IDX_MAX		(MFR_DESC_LENGTH - 3)
#define MFR_STRING_IDX_MAX	(sizeof(CONFIG_USB_DEVICE_MANUFACTURER) - 2)

#define PRODUCT_DESC_LENGTH	(sizeof(CONFIG_USB_DEVICE_PRODUCT) * 2)
#define PRODUCT_UC_IDX_MAX	(PRODUCT_DESC_LENGTH - 3)
#define PRODUCT_STRING_IDX_MAX	(sizeof(CONFIG_USB_DEVICE_PRODUCT) - 2)

#define SN_DESC_LENGTH		(sizeof(CONFIG_USB_DEVICE_SN) * 2)
#define SN_UC_IDX_MAX		(SN_DESC_LENGTH - 3)
#define SN_STRING_IDX_MAX	(sizeof(CONFIG_USB_DEVICE_SN) - 2)

#define ECM_MAC_DESC_LENGTH	(sizeof(CONFIG_USB_DEVICE_NETWORK_ECM_MAC) * 2)
#define ECM_MAC_UC_IDX_MAX	(ECM_MAC_DESC_LENGTH - 3)
#define ECM_STRING_IDX_MAX	(sizeof(CONFIG_USB_DEVICE_NETWORK_ECM_MAC) - 2)

void ascii7_to_utf16le(int idx_max, int asci_idx_max, u8_t *buf);
u8_t *usb_get_device_descriptor(void);

#ifdef CONFIG_USB_DEVICE_HID
void usb_set_hid_report_size(u16_t report_desc_size);
#endif

#endif /* __USB_DESCRIPTOR_H__ */


text:
title:       Visualising Google Trends
short_title: Superbowl Visualisation
summary: 	 Giving big data a half-time show
description: "Visualising big data from Google's Trends API with a responsive web application"
fb_title:    "A big data half-time show | Vizzuality"
fb_description: "Visualising big data from Google's Trends API for the 2014-15 NFL season"
link:        http://nfl.vizzuality.com
link_short:  nfl.vizzuality.com
client:      Google
client_logo: google.png
svg_logo:
post_url:    http://blog.vizzuality.com/post/110056301126/data-gets-its-own-halftime-show-vizzuality
post_title:  "Data gets its own halftime show: Vizzuality launches the new Google Trends API"
image:       google_02.jpg
cover:       google_01.jpg
author:      Craig Mills
date:        2015-04-22
release_date:  February 2015
highlighted:   true
align:       right
logoWidth:   180

modules:
    -   text_left:
            title: "Big Sports means Big Data"
            description: "There was a lot of potential data to visualise, so our first challenge was to identify the most important pieces needed to tell the story of the season. With this in hand we worked in the back end to make sure we didn't overwhelm the browser with data, which would lead to slow, lagged performance, ultimately compromising the vision of the designers and partners. Design is also important here, with a clear and vivid design making the overall story engaging and simple to understand, while also allowing the key moments to stand out."
            image: GoogleTrends-high1.png

    -   text_right:
            title: "Leading from the Front (end)"
            description: "Building on the work of the design and back end teams, our engineers innovated with a number of different languages (including SVG to animate D3.js) to achieve the performace, responsiveness and quality that we wanted from the front end application. By using these languages in new ways we can unleash the full vision and proposal put forward in the sketches and wireframes, delivering a great experience whether you're looking on your phone or your desktop."
            image: GoogleTrends-high3.png

opinions:
    -
        title: "A great reminder of all the amazing moments in the NFL this year including Manning's record, Odell Beckham Jr.'s catch and more."
        photo: media/usa-today.png
        autor: Nina Mandell, USA Today

---
Vizzuality loves to take on big data challenges, so we were honoured and thrilled when Google asked us to work on a flagship visualisation for their new Trends API. The topic was fan loyalty in the lead up to Super Bowl XLIX. Over the course of four weeks we turned anonymised search data from across the United States into a gripping showdown, using a heap of data wrangling, a generous sprinkling of modern design principles and a topping of Vizzuality magic. So sit back and watch the fans react to the biggest plays and shock victories on the road to the Super Bowl.


text:
package org.oscm.communicationservice.bean;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;

/**
 * @author afschar
 *
 */
public class Transport extends javax.mail.Transport {
    String lastMail;

    Transport() {
        super(Session.getDefaultInstance(System.getProperties()), null);
    }

    @Override
    public void sendMessage(Message msg, Address[] addresses)
            throws MessagingException {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            msg.writeTo(out);
            lastMail = new String(out.toByteArray(), "UTF-8");
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}


text:
// Copyright 2009 Google Inc. All Rights Reserved.

package com.google.ie.test;

import com.google.appengine.tools.development.ApiProxyLocalImpl;
import com.google.apphosting.api.ApiProxy;

import org.junit.After;
import org.junit.Before;

import java.io.File;

/**
 * Base class for testing all non transactional service classes. The setUp() and
 * tearDown() methods defined below are responsible for creating and resetting
 * the test environment.
 *
 * @author asirohi
 *
 */
public class ServiceTest {

    @Before
    public void setUp() {
        // Set environment as test environment
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
        ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")) {
        });
    }

    @After
    public void tearDown() {
        // Setting api proxy to null. Not necessary but a good practice.
        ApiProxy.setDelegate(null);
        ApiProxy.setEnvironmentForCurrentThread(null);
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Source/SBJsonWriter.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Classes

Files

File List

Source/SBJsonWriter.h

00001
00029
00030 #import <Foundation/Foundation.h>
00031 #import "SBJsonBase.h"
00032
00038 @protocol SBJsonWriter
00039
00048 @property BOOL humanReadable;
00049
00056 @property BOOL sortKeys;
00057
00067 - (NSString*)stringWithObject:(id)value;
00068
00069 @end
00070
00071
00094 @interface SBJsonWriter : SBJsonBase <SBJsonWriter> {
00095
00096 @private
00097     BOOL sortKeys, humanReadable;
00098 }
00099
00100 @end
00101
00102 // don't use - exists for backwards compatibility. Will be removed in 2.3.
00103 @interface SBJsonWriter (Private)
00104 - (NSString*)stringWithFragment:(id)value;
00105 @end
00106
00126 @interface NSObject (SBProxyForJson)
00127 - (id)proxyForJson;
00128 @end
00129

<address style="text-align: right;">Generated on Sun Mar 7 15:41:17 2010 by

 1.5.9 </address>


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './googleLogin.scss';
import Exit from '../img/exit.png';
import Exit2x from '../img/exit@2x.png';
import Exit3x from '../img/exit@3x.png';
import Google from './img/google.png';
import Google2x from './img/google@2x.png';
import Google3x from './img/google@3x.png';
import Button from '~/components/FlassCommon/Button';

const propTypes = {
  back: PropTypes.func.isRequired,
  goToGoogleAuthPage: PropTypes.func.isRequired
};

class GoogleLogin extends Component {
  state = {

  };

  render() {
    const { back, goToGoogleAuthPage } = this.props;
    // const { } = this.state;
    return (

            <img
              src={Exit}
              srcSet={`${Exit2x} 2x,${Exit3x} 3x`}
              className="exitIcon"
              alt="옵션 선택 취소" />

          <img
            src={Google}
            srcSet={`${Google2x} 2x,${Google3x} 3x`}
            className="googleLoginIcon"
            alt="구글 아이콘" />
          유튜브 업로드를 위해 구글 로그인하세요.
          <Button
            color="#9abf32"
            onClick={goToGoogleAuthPage}>로그인
          </Button>

    );
  }
}

GoogleLogin.propTypes = propTypes;

export default GoogleLogin;


text:
using namespace Transform3DParallax;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::Xaml::Interop;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

MainPage^ MainPage::Current = nullptr;

MainPage::MainPage()
{
    InitializeComponent();
    SampleTitle->Text = FEATURE_NAME;

    // This is a static public property that allows downstream pages to get a handle to the MainPage instance
    // in order to call methods that are in this class.
    MainPage::Current = this;
}

void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
{
    // Populate the ListBox with the scenarios as defined in SampleConfiguration.cpp.
    auto itemCollection = ref new Platform::Collections::Vector<Object^>();
    int i = 1;
    for (auto const& s : MainPage::Current->scenarios)
    {
        // Create a textBlock to hold the content and apply the ListItemTextStyle from Styles.xaml
        TextBlock^ textBlock = ref new TextBlock();
        ListBoxItem^ item = ref new ListBoxItem();
        auto style = App::Current->Resources->Lookup("ListItemTextStyle");

        textBlock->Text = (i++).ToString() + ") " + s.Title;
        textBlock->Style = safe_cast<Windows::UI::Xaml::Style ^>(style);

        item->Name = s.ClassName;
        item->Content = textBlock;
        itemCollection->Append(item);
    }

    // Set the newly created itemCollection as the ListBox ItemSource.
    ScenarioControl->ItemsSource = itemCollection;
    int startingScenarioIndex;

    if (Window::Current->Bounds.Width < 640)
    {
        startingScenarioIndex = -1;
    }
    else
    {
        startingScenarioIndex = 0;
    }

    ScenarioControl->SelectedIndex = startingScenarioIndex;
    ScenarioControl->ScrollIntoView(ScenarioControl->SelectedItem);
}

void MainPage::ScenarioControl_SelectionChanged(Object^ sender, SelectionChangedEventArgs^ e)
{
    ListBox^ scenarioListBox = safe_cast<ListBox^>(sender); //as ListBox;
    ListBoxItem^ item = dynamic_cast<ListBoxItem^>(scenarioListBox->SelectedItem);
    if (item != nullptr)
    {
        // Clear the status block when changing scenarios
        NotifyUser("", NotifyType::StatusMessage);

        // Navigate to the selected scenario.
        TypeName scenarioType = { item->Name, TypeKind::Custom };
        ScenarioFrame->Navigate(scenarioType, this);

        if (Window::Current->Bounds.Width < 640)
        {
            Splitter->IsPaneOpen = false;
            StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
        }
    }
}

void MainPage::NotifyUser(String^ strMessage, NotifyType type)
{
    switch (type)
    {
    case NotifyType::StatusMessage:
        StatusBorder->Background = ref new SolidColorBrush(Windows::UI::Colors::Green);
        break;
    case NotifyType::ErrorMessage:
        StatusBorder->Background = ref new SolidColorBrush(Windows::UI::Colors::Red);
        break;
    default:
        break;
    }
    StatusBlock->Text = strMessage;

    // Collapse the StatusBlock if it has no text to conserve real estate.
    if (StatusBlock->Text != "")
    {
        StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Visible;
    }
    else
    {
        StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
    }
}

void MainPage::Footer_Click(Object^ sender, RoutedEventArgs^ e)
{
    auto uri = ref new Uri((String^)((HyperlinkButton^)sender)->Tag);
    Windows::System::Launcher::LaunchUriAsync(uri);
}

void MainPage::Button_Click(Object^ sender, RoutedEventArgs^ e)
{
    Splitter->IsPaneOpen = (Splitter->IsPaneOpen == true) ? false : true;
    StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}


text:
module OrderDirection
  VERSION = "0.0.3"
end


text:
require 'spec_helper'

describe Swiftrb do
end


text:
<?xml version="1.0" encoding="UTF-8" ?>
<ldml>
	<identity>
		<version number="$Revision: 1.1 $"/>
		<generation date="$Date: 2010-10-25 15:19:43 $"/>
		<language type="en"/>
		<territory type="HK"/>
	</identity>
	<dates>
		<calendars>
			<calendar type="japanese">
				<eras>
					<eraAbbr>
						<era type="161">Bunchū</era>
						<era type="165">Genchū</era>
					</eraAbbr>
				</eras>
				<dateFormats>
					<dateFormatLength type="full">
						<dateFormat>
							<pattern>EEEE, MMMM d, y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="long">
						<dateFormat>
							<pattern>MMMM d, y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="medium">
						<dateFormat>
							<pattern>MMM d, y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="short">
						<dateFormat>
							<pattern>G M/d/yy</pattern>
						</dateFormat>
					</dateFormatLength>
				</dateFormats>
			</calendar>
		</calendars>
	</dates>
	<numbers>
		<currencies>
			<currency type="HKD">
				<symbol>$</symbol>
			</currency>
			<currency type="USD">
				<symbol>US$</symbol>
			</currency>
		</currencies>
	</numbers>
</ldml>


text:
package slick.jdbc.hikaricp

import java.sql.{Connection, Driver}

import com.typesafe.config.Config
import slick.jdbc.{JdbcDataSource, JdbcDataSourceFactory}
import slick.util.ConfigExtensionMethods._

/** A JdbcDataSource for a HikariCP connection pool.
  * See `slick.jdbc.JdbcBackend#Database.forConfig` for documentation on the config parameters. */
class HikariCPJdbcDataSource(val ds: com.zaxxer.hikari.HikariDataSource, val hconf: com.zaxxer.hikari.HikariConfig)
  extends JdbcDataSource {

  def createConnection(): Connection = ds.getConnection()

  def close(): Unit = ds.close()

  override val maxConnections: Option[Int] = Some(ds.getMaximumPoolSize)
}

object HikariCPJdbcDataSource extends JdbcDataSourceFactory {
  import com.zaxxer.hikari._

  def forConfig(c: Config, driver: Driver, name: String, classLoader: ClassLoader): HikariCPJdbcDataSource = {
    val hconf = new HikariConfig()

    // Connection settings
    if (c.hasPath("dataSourceClass")) {
      hconf.setDataSourceClassName(c.getString("dataSourceClass"))
    } else {
      Option(c.getStringOr("driverClassName", c.getStringOr("driver"))).map(hconf.setDriverClassName _)
    }
    hconf.setJdbcUrl(c.getStringOr("url", null))
    c.getStringOpt("user").foreach(hconf.setUsername)
    c.getStringOpt("password").foreach(hconf.setPassword)
    c.getPropertiesOpt("properties").foreach(hconf.setDataSourceProperties)

    // Pool configuration
    hconf.setConnectionTimeout(c.getMillisecondsOr("connectionTimeout", 1000))
    hconf.setValidationTimeout(c.getMillisecondsOr("validationTimeout", 1000))
    hconf.setIdleTimeout(c.getMillisecondsOr("idleTimeout", 600000))
    hconf.setMaxLifetime(c.getMillisecondsOr("maxLifetime", 1800000))
    hconf.setLeakDetectionThreshold(c.getMillisecondsOr("leakDetectionThreshold", 0))
    hconf.setInitializationFailFast(c.getBooleanOr("initializationFailFast", false))
    c.getStringOpt("connectionTestQuery").foreach(hconf.setConnectionTestQuery)
    c.getStringOpt("connectionInitSql").foreach(hconf.setConnectionInitSql)
    val numThreads = c.getIntOr("numThreads", 20)
    hconf.setMaximumPoolSize(c.getIntOr("maxConnections", numThreads))
    hconf.setMinimumIdle(c.getIntOr("minConnections", numThreads))
    hconf.setPoolName(c.getStringOr("poolName", name))
    hconf.setRegisterMbeans(c.getBooleanOr("registerMbeans", false))

    // Equivalent of ConnectionPreparer
    hconf.setReadOnly(c.getBooleanOr("readOnly", false))
    c.getStringOpt("isolation").map("TRANSACTION_" + _).foreach(hconf.setTransactionIsolation)
    hconf.setCatalog(c.getStringOr("catalog", null))

    val ds = new HikariDataSource(hconf)
    new HikariCPJdbcDataSource(ds, hconf)
  }
}


text:
require 'ruote/exp/condition'

module Ruote::Exp

  #
  # The 'participant' expression is very special. It sits on the fence between
  # the engine and the external world.
  #
  # The participant expression is used to pass workitems to participants
  # from the engine. Those participants are bound at start time (usually) in
  # the engine via its register_participant method.
  #
  # Here's an example of two concurrent participant expressions in use :
  #
  #   concurrence do
  #     participant :ref => 'alice'
  #     participant :ref => 'bob'
  #   end
  #
  # Upon encountering the two expressions, the engine will lookup their name
  # in the participant map and hand the workitems to the participant instances
  # registered for those names.
  #
  #
  # == attributes passed as arguments
  #
  # All the attributes passed to a participant will be fed to the outgoing
  # workitem under a new 'params' field.
  #
  # Thus, with
  #
  #     participant :ref => 'alice', :task => 'maw the lawn', :timeout => '2d'
  #
  # Alice will receive a workitem with a field params set to
  #
  #     { :ref => 'alice', :task => 'maw the lawn', :timeout => '2d' }
  #
  # The fields named 'params' will be deleted before the workitems resumes
  # in the flow (with the engine replying to the parent expression of this
  # participant expression).
  #
  #
  # == simplified participant notation
  #
  # This process definition is equivalent to the one above. Less to write.
  #
  #   concurrence do
  #     participant 'alice'
  #     bob
  #   end
  #
  # Please note that 'bob' alone could stand for the participant 'bob' or
  # the subprocess named 'bob'. Subprocesses do take precedence over
  # participants (if there is a subprocess named 'bob' and a participant
  # named 'bob'.
  #
  #
  # == participant defined timeout
  #
  # Usually, timeouts are given for an expression in the process definition.
  #
  #   participant 'alice', :timeout => '2d'
  #
  # where alice as two days to complete her task (send back the workitem).
  #
  # But it's OK for participant classes registered in the engine to provide
  # their own timeout value. The participant instance simply has to reply to
  # the #rtimeout method and provide a meaningful timeout value (like a
  # number of seconds, or a string like "2d" or "1M2w".
  #
  # Note however, that the process definition timeout (if any) will take
  # precedence over the participant specified one.
  #
  #
  # == asynchronous
  #
  # The expression will make sure to dispatch to the participant in an
  # asynchronous way. This means that the dispatch will occur in a dedicated
  # thread.
  #
  # Since the dispatching to the participant could take a long time and block
  # the engine for too long, this 'do thread' policy is used by default.
  #
  # If the participant itself replies to the method #do_not_thread and replies
  # positively to it, a new thread (or a next_tick) won't get used. This is
  # practical for tiny participants that don't do IO and reply immediately
  # (after a few operations). By default, BlockParticipant instances do not
  # thread.
  #
  class ParticipantExpression < FlowExpression

    names :participant

    # Should yield true when the dispatch was successful.
    #
    h_reader :dispatched

    h_reader :participant

    def apply

      #
      # determine participant

      h.participant_name = (attribute(:ref) || attribute_text).to_s

      raise ArgumentError.new(
        'no participant name specified'
      ) if h.participant_name == ''

      h.participant ||=
        @context.plist.lookup_info(h.participant_name, h.applied_workitem)

      raise(ArgumentError.new(
        "no participant named #{h.participant_name.inspect}")
      ) if h.participant.nil?

      #
      # trigger on_apply if the participant sports it

      trigger_callback(:on_apply, h.applied_workitem)

      #
      # dispatch to participant

      h.applied_workitem['participant_name'] = h.participant_name

      h.applied_workitem['fields']['params'] = compile_atts

      h.applied_workitem['fields'].delete('t')
      h.applied_workitem['fields'].delete('__result__')

      h.applied_workitem['re_dispatch_count'] = 0

      if tree.last.any?
        h.applied_workitem['fields']['params']['__children__'] = dsub(tree.last)
      end

      consider_participant_timers(h.participant)

      persist_or_raise

      @context.storage.put_msg(
        'dispatch',
        'fei' => h.fei,
        'participant_name' => h.participant_name,
        'participant' => h.participant,
        'workitem' => h.applied_workitem)
    end

    def cancel(flavour)

      cancel_flanks(flavour)

      return reply_to_parent(h.applied_workitem) unless h.participant_name
        # no participant, reply immediately

      do_persist || return
        #
        # if do_persist returns false, it means we're operating on stale
        # data and cannot continue

      @context.storage.put_msg(
        'dispatch_cancel',
        'fei' => h.fei,
        'participant_name' => h.participant_name,
        'participant' => h.participant,
        'flavour' => flavour,
        'workitem' => h.applied_workitem)
    end

    def reply(workitem)

      trigger_callback(:on_reply, workitem)

      super(workitem)
    end

    def reply_to_parent(workitem)

      workitem['fields'].delete('params')
      workitem['fields'].delete('dispatched_at')
      super(workitem)
    end

    # Overrides FlowExpression#handle_on_error. Attempts to call a
    # potential #on_error method in the participant implementation.
    #
    # If that method exists and returns something true-ish, will not call
    # the super #handle_on_error, it will directly reply to the parent.
    #
    def handle_on_error(msg, err)

      r = trigger_callback(:on_error, msg, err)

      if r
        reply_to_parent(msg['workitem'])
        true # yes, we've dealt with the error.
      else
        super(msg, err)
      end
    end

    protected

    # Used to trigger #on_apply, #on_reply, #on_cancel and #on_error in
    # the participant implementation.
    #
    def trigger_callback(meth, wi_or_msg, err=nil)

      wi, msg, err = if err
        [ wi_or_msg['workitem'], wi_or_msg, err ]
      elsif wi_or_msg['workitem']
        [ wi_or_msg['workitem'], wi_or_msg, nil ]
      else
        [ wi_or_msg, nil, nil ]
      end

      pinfo =
        h.participant ||
        @context.plist.lookup_info(h.participant_name, wi)

      pa = @context.plist.instantiate(pinfo, :if_respond_to? => meth)

      return nil unless pa

      args = { 'workitem' => Ruote::Workitem.new(wi) }
      args['error'] = err if err
      args['msg'] = msg if msg

      Ruote.participant_send(pa, meth, args)
    end

    # Once the dispatching work (done by the dispatch pool) is done, a
    # 'dispatched' msg is sent, we have to flag the participant expression
    # as 'dispatched' => true
    #
    # See http://groups.google.com/group/openwferu-users/browse_thread/thread/ff29f26d6b5fd135
    # for the motivation.
    #
    def do_dispatched(msg)

      h.dispatched = true
      do_persist
        # let's not care if it fails...
    end

    # Determines and schedules timeout if any.
    #
    # Note that process definition timeout has priority over participant
    # specified timeout.
    #
    def consider_participant_timers(p_info)

      return if h.has_timers
        # process definition takes precedence over participant defined timers.

      timers = nil

      [ :rtimers, :timers, :rtimeout ].each do |meth|

        pa = @context.plist.instantiate(p_info, :if_respond_to? => meth)

        next unless pa

        timers = Ruote.participant_send(
          pa, meth, 'workitem' => Ruote::Workitem.new(h.applied_workitem))

        break if timers
      end

      return unless timers

      timers = if timers.index(':')
        timers.split(/,/)
      else
        [ "#{timers}: timeout" ]
      end

      schedule_timers(timers)
    end

    def do_pause(msg)

      return if h.state != nil

      h['state'] = 'paused'
      h['breakpoint'] = true if msg['breakpoint']

      do_persist || return

      @context.storage.put_msg(
        'dispatch_pause',
        'fei' => h.fei,
        'participant_name' => h.participant_name,
        'participant' => h.participant
      ) unless msg['breakpoint']
    end

    def do_resume(msg)

      return if h.state != 'paused'

      h['state'] = nil
      replies = h.delete('paused_replies') || []

      do_persist || return

      if replies.empty?
        @context.storage.put_msg(
          'dispatch_resume',
          'fei' => h.fei,
          'participant_name' => h.participant_name,
          'participant' => h.participant
        ) unless h['breakpoint']
      else
        replies.each { |m| @context.storage.put_msg(m.delete('action'), m) }
          # trigger replies
      end
    end
  end
end


text:
package org.apache.hadoop.yarn.client.api.impl;

import java.io.IOException;
import java.net.URI;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity;
import org.apache.hadoop.yarn.client.api.TimelineV2Client;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnException;

import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;

/**
 * Implementation of timeline v2 client interface.
 *
 */
public class TimelineV2ClientImpl extends TimelineV2Client {
  private static final Log LOG = LogFactory.getLog(TimelineV2ClientImpl.class);

  private static final String RESOURCE_URI_STR_V2 = "/ws/v2/timeline/";

  private TimelineEntityDispatcher entityDispatcher;
  private volatile String timelineServiceAddress;

  // Retry parameters for identifying new timeline service
  // TODO consider to merge with connection retry
  private int maxServiceRetries;
  private long serviceRetryInterval;

  private TimelineConnector connector;

  private ApplicationId contextAppId;

  public TimelineV2ClientImpl(ApplicationId appId) {
    super(TimelineV2ClientImpl.class.getName());
    this.contextAppId = appId;
  }

  public ApplicationId getContextAppId() {
    return contextAppId;
  }

  protected void serviceInit(Configuration conf) throws Exception {
    if (!YarnConfiguration.timelineServiceEnabled(conf)
        || (int) YarnConfiguration.getTimelineServiceVersion(conf) != 2) {
      throw new IOException("Timeline V2 client is not properly configured. "
          + "Either timeline service is not enabled or version is not set to"
          + " 2");
    }
    UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
    UserGroupInformation realUgi = ugi.getRealUser();
    String doAsUser = null;
    UserGroupInformation authUgi = null;
    if (realUgi != null) {
      authUgi = realUgi;
      doAsUser = ugi.getShortUserName();
    } else {
      authUgi = ugi;
      doAsUser = null;
    }

    // TODO need to add/cleanup filter retry later for ATSV2. similar to V1
    DelegationTokenAuthenticatedURL.Token token =
        new DelegationTokenAuthenticatedURL.Token();
    connector = new TimelineConnector(false, authUgi, doAsUser, token);
    addIfService(connector);

    // new version need to auto discovery (with retry till ATS v2 address is
    // got).
    maxServiceRetries =
        conf.getInt(YarnConfiguration.TIMELINE_SERVICE_CLIENT_MAX_RETRIES,
            YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_MAX_RETRIES);
    serviceRetryInterval = conf.getLong(
        YarnConfiguration.TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS);
    entityDispatcher = new TimelineEntityDispatcher(conf);
    super.serviceInit(conf);
  }

  @Override
  protected void serviceStart() throws Exception {
    super.serviceStart();
    entityDispatcher.start();
  }

  @Override
  protected void serviceStop() throws Exception {
    entityDispatcher.stop();
    super.serviceStop();
  }

  @Override
  public void putEntities(TimelineEntity... entities)
      throws IOException, YarnException {
    entityDispatcher.dispatchEntities(true, entities);
  }

  @Override
  public void putEntitiesAsync(TimelineEntity... entities)
      throws IOException, YarnException {
    entityDispatcher.dispatchEntities(false, entities);
  }

  @Override
  public void setTimelineServiceAddress(String address) {
    this.timelineServiceAddress = address;
  }

  @Private
  protected void putObjects(String path, MultivaluedMap<String, String> params,
      Object obj) throws IOException, YarnException {

    int retries = verifyRestEndPointAvailable();

    // timelineServiceAddress could be stale, add retry logic here.
    boolean needRetry = true;
    while (needRetry) {
      try {
        URI uri = TimelineConnector.constructResURI(getConfig(),
            timelineServiceAddress, RESOURCE_URI_STR_V2);
        putObjects(uri, path, params, obj);
        needRetry = false;
      } catch (IOException e) {
        // handle exception for timelineServiceAddress being updated.
        checkRetryWithSleep(retries, e);
        retries--;
      }
    }
  }

  /**
   * Check if reaching to maximum of retries.
   *
   * @param retries
   * @param e
   */
  private void checkRetryWithSleep(int retries, IOException e)
      throws YarnException, IOException {
    if (retries > 0) {
      try {
        Thread.sleep(this.serviceRetryInterval);
      } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
        throw new YarnException("Interrupted while retrying to connect to ATS");
      }
    } else {
      StringBuilder msg =
          new StringBuilder("TimelineClient has reached to max retry times : ");
      msg.append(this.maxServiceRetries);
      msg.append(" for service address: ");
      msg.append(timelineServiceAddress);
      LOG.error(msg.toString());
      throw new IOException(msg.toString(), e);
    }
  }

  protected void putObjects(URI base, String path,
      MultivaluedMap<String, String> params, Object obj)
      throws IOException, YarnException {
    ClientResponse resp;
    try {
      resp = connector.getClient().resource(base).path(path).queryParams(params)
          .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON)
          .put(ClientResponse.class, obj);
    } catch (RuntimeException re) {
      // runtime exception is expected if the client cannot connect the server
      String msg = "Failed to get the response from the timeline server.";
      LOG.error(msg, re);
      throw new IOException(re);
    }
    if (resp == null || resp.getStatusInfo()
        .getStatusCode() != ClientResponse.Status.OK.getStatusCode()) {
      String msg =
          "Response from the timeline server is " + ((resp == null) ? "null"
              : "not successful," + " HTTP error code: " + resp.getStatus()
                  + ", Server response:\n" + resp.getEntity(String.class));
      LOG.error(msg);
      throw new YarnException(msg);
    }
  }

  private int verifyRestEndPointAvailable() throws YarnException {
    // timelineServiceAddress could haven't be initialized yet
    // or stale (only for new timeline service)
    int retries = pollTimelineServiceAddress(this.maxServiceRetries);
    if (timelineServiceAddress == null) {
      String errMessage = "TimelineClient has reached to max retry times : "
          + this.maxServiceRetries
          + ", but failed to fetch timeline service address. Please verify"
          + " Timeline Auxiliary Service is configured in all the NMs";
      LOG.error(errMessage);
      throw new YarnException(errMessage);
    }
    return retries;
  }

  /**
   * Poll TimelineServiceAddress for maximum of retries times if it is null.
   *
   * @param retries
   * @return the left retry times
   * @throws IOException
   */
  private int pollTimelineServiceAddress(int retries) throws YarnException {
    while (timelineServiceAddress == null && retries > 0) {
      try {
        Thread.sleep(this.serviceRetryInterval);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new YarnException("Interrupted while trying to connect ATS");
      }
      retries--;
    }
    return retries;
  }

  private final class EntitiesHolder extends FutureTask<Void> {
    private final TimelineEntities entities;
    private final boolean isSync;

    EntitiesHolder(final TimelineEntities entities, final boolean isSync) {
      super(new Callable<Void>() {
        // publishEntities()
        public Void call() throws Exception {
          MultivaluedMap<String, String> params = new MultivaluedMapImpl();
          params.add("appid", getContextAppId().toString());
          params.add("async", Boolean.toString(!isSync));
          putObjects("entities", params, entities);
          return null;
        }
      });
      this.entities = entities;
      this.isSync = isSync;
    }

    public boolean isSync() {
      return isSync;
    }

    public TimelineEntities getEntities() {
      return entities;
    }
  }

  /**
   * This class is responsible for collecting the timeline entities and
   * publishing them in async.
   */
  private class TimelineEntityDispatcher {
    /**
     * Time period for which the timelineclient will wait for draining after
     * stop.
     */
    private static final long DRAIN_TIME_PERIOD = 2000L;

    private int numberOfAsyncsToMerge;
    private final BlockingQueue<EntitiesHolder> timelineEntityQueue;
    private ExecutorService executor;

    TimelineEntityDispatcher(Configuration conf) {
      timelineEntityQueue = new LinkedBlockingQueue<EntitiesHolder>();
      numberOfAsyncsToMerge =
          conf.getInt(YarnConfiguration.NUMBER_OF_ASYNC_ENTITIES_TO_MERGE,
              YarnConfiguration.DEFAULT_NUMBER_OF_ASYNC_ENTITIES_TO_MERGE);
    }

    Runnable createRunnable() {
      return new Runnable() {
        @Override
        public void run() {
          try {
            EntitiesHolder entitiesHolder;
            while (!Thread.currentThread().isInterrupted()) {
              // Merge all the async calls and make one push, but if its sync
              // call push immediately
              try {
                entitiesHolder = timelineEntityQueue.take();
              } catch (InterruptedException ie) {
                LOG.info("Timeline dispatcher thread was interrupted ");
                Thread.currentThread().interrupt();
                return;
              }
              if (entitiesHolder != null) {
                publishWithoutBlockingOnQueue(entitiesHolder);
              }
            }
          } finally {
            if (!timelineEntityQueue.isEmpty()) {
              LOG.info("Yet to publish " + timelineEntityQueue.size()
                  + " timelineEntities, draining them now. ");
            }
            // Try to drain the remaining entities to be published @ the max for
            // 2 seconds
            long timeTillweDrain =
                System.currentTimeMillis() + DRAIN_TIME_PERIOD;
            while (!timelineEntityQueue.isEmpty()) {
              publishWithoutBlockingOnQueue(timelineEntityQueue.poll());
              if (System.currentTimeMillis() > timeTillweDrain) {
                // time elapsed stop publishing further....
                if (!timelineEntityQueue.isEmpty()) {
                  LOG.warn("Time to drain elapsed! Remaining "
                      + timelineEntityQueue.size() + "timelineEntities will not"
                      + " be published");
                  // if some entities were not drained then we need interrupt
                  // the threads which had put sync EntityHolders to the queue.
                  EntitiesHolder nextEntityInTheQueue = null;
                  while ((nextEntityInTheQueue =
                      timelineEntityQueue.poll()) != null) {
                    nextEntityInTheQueue.cancel(true);
                  }
                }
                break;
              }
            }
          }
        }

        /**
         * Publishes the given EntitiesHolder and return immediately if sync
         * call, else tries to fetch the EntitiesHolder from the queue in non
         * blocking fashion and collate the Entities if possible before
         * publishing through REST.
         *
         * @param entitiesHolder
         */
        private void publishWithoutBlockingOnQueue(
            EntitiesHolder entitiesHolder) {
          if (entitiesHolder.isSync()) {
            entitiesHolder.run();
            return;
          }
          int count = 1;
          while (true) {
            // loop till we find a sync put Entities or there is nothing
            // to take
            EntitiesHolder nextEntityInTheQueue = timelineEntityQueue.poll();
            if (nextEntityInTheQueue == null) {
              // Nothing in the queue just publish and get back to the
              // blocked wait state
              entitiesHolder.run();
              break;
            } else if (nextEntityInTheQueue.isSync()) {
              // flush all the prev async entities first
              entitiesHolder.run();
              // and then flush the sync entity
              nextEntityInTheQueue.run();
              break;
            } else {
              // append all async entities together and then flush
              entitiesHolder.getEntities().addEntities(
                  nextEntityInTheQueue.getEntities().getEntities());
              count++;
              if (count == numberOfAsyncsToMerge) {
                // Flush the entities if the number of the async
                // putEntites merged reaches the desired limit. To avoid
                // collecting multiple entities and delaying for a long
                // time.
                entitiesHolder.run();
                break;
              }
            }
          }
        }
      };
    }

    public void dispatchEntities(boolean sync,
        TimelineEntity[] entitiesTobePublished) throws YarnException {
      if (executor.isShutdown()) {
        throw new YarnException("Timeline client is in the process of stopping,"
            + " not accepting any more TimelineEntities");
      }

      // wrap all TimelineEntity into TimelineEntities object
      TimelineEntities entities = new TimelineEntities();
      for (TimelineEntity entity : entitiesTobePublished) {
        entities.addEntity(entity);
      }

      // created a holder and place it in queue
      EntitiesHolder entitiesHolder = new EntitiesHolder(entities, sync);
      try {
        timelineEntityQueue.put(entitiesHolder);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new YarnException(
            "Failed while adding entity to the queue for publishing", e);
      }

      if (sync) {
        // In sync call we need to wait till its published and if any error then
        // throw it back
        try {
          entitiesHolder.get();
        } catch (ExecutionException e) {
          throw new YarnException("Failed while publishing entity",
              e.getCause());
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
          throw new YarnException("Interrupted while publishing entity", e);
        }
      }
    }

    public void start() {
      executor = Executors.newSingleThreadExecutor();
      executor.execute(createRunnable());
    }

    public void stop() {
      LOG.info("Stopping TimelineClient.");
      executor.shutdownNow();
      try {
        executor.awaitTermination(DRAIN_TIME_PERIOD, TimeUnit.MILLISECONDS);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        e.printStackTrace();
      }
    }
  }
}


text:
<?php

abstract class LavandaDBTestCase extends LavandaTestCase
{
    private static $migrate = true;

    public function setUp()
    {
        parent::setUp();
        $factory = $this->factory;
        include('factories.php');
        if(self::$migrate)
        {
            $this->artisan('migrate', [
                '--database' => 'test',
                '--realpath' => realpath(__DIR__.'/migrations'),
            ]);
            self::$migrate = false;
        }
    }

    protected function rollback()
    {
        self::$migrate = true;
        $this->artisan('migrate:rollback');
    }

    protected function getEnvironmentSetUp($app)
    {
        parent::getEnvironmentSetUp($app);
        $app['config']->set('lavanda.model_path', 'tests/models');
        $app['config']->set('database.default', 'test');
        $app['config']->set('database.connections.test', [
            'driver'    => env('DB_DRIVER', 'mysql'),
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'forge'),
            'username'  => env('DB_USERNAME', 'forge'),
            'password'  => env('DB_PASSWORD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false]);
    }
}


text:
<!DOCTYPE html>

	<title>Init with toolbar</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>


text:
namespace Aion_Launcher
{
    partial class LicenseForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LicenseForm));
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.seperator1 = new Aion_Launcher.Seperator();
            this.seperator2 = new Aion_Launcher.Seperator();
            this.SuspendLayout();
            //
            // textBox1
            //
            this.textBox1.BackColor = System.Drawing.SystemColors.Window;
            this.textBox1.Cursor = System.Windows.Forms.Cursors.Default;
            resources.ApplyResources(this.textBox1, "textBox1");
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.TabStop = false;
            //
            // button1
            //
            resources.ApplyResources(this.button1, "button1");
            this.button1.Name = "button1";
            this.button1.TabStop = false;
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // button2
            //
            resources.ApplyResources(this.button2, "button2");
            this.button2.Name = "button2";
            this.button2.TabStop = false;
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // seperator1
            //
            this.seperator1.BackColor = System.Drawing.Color.Transparent;
            this.seperator1.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.seperator1.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.seperator1.Direction = System.Windows.Forms.Orientation.Horizontal;
            this.seperator1.Image = null;
            resources.ApplyResources(this.seperator1, "seperator1");
            this.seperator1.Name = "seperator1";
            //
            // seperator2
            //
            this.seperator2.BackColor = System.Drawing.Color.Transparent;
            this.seperator2.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.seperator2.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.seperator2.Direction = System.Windows.Forms.Orientation.Horizontal;
            this.seperator2.Image = null;
            resources.ApplyResources(this.seperator2, "seperator2");
            this.seperator2.Name = "seperator2";
            //
            // LicenseForm
            //
            resources.ApplyResources(this, "$this");
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.seperator2);
            this.Controls.Add(this.seperator1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.textBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.Name = "LicenseForm";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.License_FormClosing);
            this.Load += new System.EventHandler(this.License_Load);
            this.Shown += new System.EventHandler(this.License_Shown);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private Seperator seperator1;
        private Seperator seperator2;
    }
}


text:
$(function () {

    //login like employee and company
    if (!$("#id_is_company").is(':checked')) {
        $("#div_id_company_name").toggle(false);
    }
    else {
        $("#div_id_first_name").toggle(false);
        $("#div_id_last_name").toggle(false);
    }

    $('#id_is_company').click(function () {
        $("#div_id_first_name").toggle(!$("#id_is_company").is(':checked'));
        $("#div_id_last_name").toggle(!$("#id_is_company").is(':checked'));
        $("#div_id_company_name").toggle($("#id_is_company").is(':checked')).removeClass('invisible');
    });

    //jop post applying messages
    bootstrap_alert = function () {
    }
    bootstrap_alert.warning = function (message, is_error) {
        if (is_error) {
            $('#alert_placeholder').html('
×' + message + '
')
        } else {
            $('#alert_placeholder').html('
×' + message + '
')
        }
    }

    //jop post applying via ajax
    var frm = $('#apply_form');
    frm.submit(function (e) {
        e.preventDefault();
        $('ul.errorlist').html("");
        var data = new FormData($('#apply_form').get(0));
        $.ajax({
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: data,
            processData: false,
            contentType: false,
            success: function (data) {
                if (data.notification) {
                    $('#applyModal').modal('hide');
                    bootstrap_alert.warning(data.notification, false);
                }
                else if (data.warning) {
                    $('#applyModal').modal('hide');
                    bootstrap_alert.warning(data.warning, true);
                } else if (data.error) {
                    var form_errors = data.error;
                    for (var fieldname in form_errors) {
                        var errors = form_errors[fieldname];
                        $('#apply_form ul.errorlist').append('
' + errors + '
')
                        $('#apply_form input[name="' + fieldname + '"]').addClass('error');
                    }
                }
            },
            error: function (data) {
                console.log(data);
            }
        });
        return false;
    });

    //job post applying form validation
    $('#id_message').click(function () {
        $('ul.errorlist').html("");
        $(this).removeClass("error");
    });

    //adding comment to the blog entry
    var frm = $('#add_comment_form');
    $("#add_comment").on('click', function (e) {
        var data = new FormData($('#add_comment_form').get(0));
        e.preventDefault();
        e.stopPropagation();
        $.ajax({
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: data,
            processData: false,
            contentType: false,
            success: function (data) {
                $('div.comments').append('
' + data.comment.date +
                    ' said by' + data.comment.author +
                    '
 ' + data.comment.content + '

');

                $('#content').val('');
                console.log(data);
            },
            error: function (data) {
                console.log(data);
            }
        });
        return false;
    });
});


text:
package org.redisson.spring.support;

import org.redisson.api.LocalCachedMapOptions;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.Conventions;
import org.springframework.util.Assert;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 *
 * @author Rui Gu (https://github.com/jackygurui)
 */
public class LocalCachedMapOptionsDecorator implements RedissonNamespaceDecorator {

    @Override
    public void decorate(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, RedissonNamespaceParserSupport helper) {
        NodeList list = element.getElementsByTagNameNS(
                RedissonNamespaceParserSupport.REDISSON_NAMESPACE,
                RedissonNamespaceParserSupport.LOCAL_CACHED_MAP_OPTIONS_ELEMENT);
        Element options = null;
        String id;
        if (list.getLength() == 1) {
            options = (Element) list.item(0);
            id = invokeOptions(options, parserContext, helper);
            for (int i = 0; i < options.getAttributes().getLength(); i++) {
                Attr item = (Attr) options.getAttributes().item(i);
                if (helper.isEligibleAttribute(item)
                        && !RedissonNamespaceParserSupport.TIME_TO_LIVE_UNIT_ATTRIBUTE
                        .equals(item.getLocalName())
                        && !RedissonNamespaceParserSupport.MAX_IDLE_UNIT_ATTRIBUTE
                        .equals(item.getLocalName())) {
                    helper.invoker(id,
                            helper.getName(item),
                            new Object[]{item.getValue()},
                            parserContext);
                }
            }
            invokeTimeUnitOptions(options, id, parserContext, helper,
                    RedissonNamespaceParserSupport.TIME_TO_LIVE_ATTRIBUTE,
                    RedissonNamespaceParserSupport.TIME_TO_LIVE_UNIT_ATTRIBUTE);

            invokeTimeUnitOptions(options, id, parserContext, helper,
                    RedissonNamespaceParserSupport.MAX_IDLE_ATTRIBUTE,
                    RedissonNamespaceParserSupport.MAX_IDLE_UNIT_ATTRIBUTE);
        } else {
            id = invokeOptions(options, parserContext, helper);
        }
        helper.addConstructorArgs(new RuntimeBeanReference(id),
                LocalCachedMapOptions.class, builder);
    }

    private String invokeOptions(Element element, ParserContext parserContext, RedissonNamespaceParserSupport helper) {
        BeanComponentDefinition defaultOption
                = helper.factoryInvoker(element, LocalCachedMapOptions.class,
                        "defaults", null, parserContext);
        return defaultOption.getName();
    }

    private void invokeTimeUnitOptions(Element element, String id, ParserContext parserContext, RedissonNamespaceParserSupport helper, String timeAttrubute, String timeUnitAttribute) {
        if (helper.hasAttribute(element, timeUnitAttribute)) {
            Assert.state(
                    helper.hasAttribute(element, timeAttrubute),
                    "Missing \"" + timeAttrubute + "\" attribute in \""
                    + RedissonNamespaceParserSupport.LOCAL_CACHED_MAP_OPTIONS_ELEMENT
                    + "\" element.");
            helper.invoker(id,
                    Conventions.attributeNameToPropertyName(timeAttrubute),
                    new Object[]{
                        Integer.parseInt(
                                helper.getAttribute(element, timeAttrubute)),
                        helper.getAttribute(element, timeUnitAttribute)},
                    parserContext);
        }
    }
}


text:
#pragma once

#include "atn/ATNState.h"

namespace antlr4 {
namespace atn {

  class ANTLR4CPP_PUBLIC RuleStartState final : public ATNState {
  public:
    RuleStartState();

    RuleStopState *stopState = nullptr;
    bool isLeftRecursiveRule = false;

    virtual size_t getStateType() override;

  };

} // namespace atn
} // namespace antlr4


text:
require 'aws-sdk'
require "thwait"

class BucketSyncService
  attr_reader :from_bucket, :to_bucket, :logger
  attr_accessor :debug

  # DEFAULT_ACL = :public_read
  # PRIVATE_ACL = :private

  # credentials are the TO bucket's credentials, which have to
  # have at least READ access on the FROM bucket
  # prefix is a path filter for the FROM bucket
  def initialize(from_bucket, to_bucket, credentials, prefix)
    @from_bucket = bucket_from_credentials(from_bucket, credentials)
    @to_bucket   = bucket_from_credentials(to_bucket, credentials)
    @prefix      = prefix
  end

  def perform(output=STDOUT)
    Aws.eager_autoload! # this makes threads even more happy

    object_counts = {sync:0, skip:0}
    create_logger(output)

    threads = []

    logger.info "Starting sync."
    from_bucket.objects(prefix: @prefix).each do |object|
      threads << Thread.new {
        if object_needs_syncing?(object)
          sync(object)
          object_counts[:sync] += 1
        else
          logger.debug "Skipped #{pp object}"
          object_counts[:skip] += 1
        end
      }
      sleep 0.01 while threads.select {|t| t.alive?}.count > 16 # throttling
    end

    ThreadsWait.all_waits(threads)

    logger.info "Done. Synced #{object_counts[:sync]}, " +
      "skipped #{object_counts[:skip]}."
  end

  private

  def create_logger(output)
    @logger = Logger.new(output).tap do |l|
      l.level = debug ? Logger::DEBUG : Logger::INFO
    end
  end

  def sync(object)
    logger.debug "Syncing #{pp object}"
    acl_setting = file_is_public?(object) ? 'public-read' : 'private'
    to_object = to_bucket.object(object.key)
    to_object.copy_from(object, acl: acl_setting)
  end

  # Crude, but ala aws I think :)
  def file_is_public?(object)
    grants = object.acl.grants
    grants.each do |g|
      return true if g.permission == 'READ' && g.grantee.uri == "http://acs.amazonaws.com/groups/global/AllUsers"
    end
    return false
  end

  def pp(object)
    content_length_in_kb = object.content_length / 1024
    "#{object.key} #{content_length_in_kb}k " +
      "#{object.last_modified.strftime("%b %d %Y %H:%M")}"
  end

  def object_needs_syncing?(object)
    to_object = to_bucket.object(object.key)
    return true if !to_object.exists? # object isn't even present in the dst bucket

    return to_object.etag != object.etag # does the etag on the dst object differ from src?
  end

  def bucket_from_credentials(bucket, credentials)
    s3 = Aws::S3::Resource.new(credentials)

    bucket = s3.bucket(bucket)
    if !bucket.exists?
      bucket = s3.create_bucket(bucket)
    end
    bucket
  end
end

=begin
Example usage:
 credentials = {aws_access_key_id:"XXX", aws_secret_access_key:"YYY"}
 syncer = BucketSyncService.new("first-bucket", "second-bucket", credentials)
 syncer.debug = true # log each object
 syncer.perform
=end


text:
{% include header.html %}

{{ page.title }}

      {% if page.publishing-date %}
        {{ page.publishing-date }}
      {% endif %}
      {{ content }}

{% include footer.html %}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('users', '0002_remove_user_date_of_birth'),
    ]

    operations = [
        migrations.AddField(
            model_name='user',
            name='first_name',
            field=models.CharField(blank=True, max_length=100, null=True),
        ),
        migrations.AddField(
            model_name='user',
            name='last_name',
            field=models.CharField(blank=True, max_length=100, null=True),
        ),
    ]


text:
class Project {
  constructor(name, filepath){
    this.name = name;
    this.filepath = filepath;
  }
}

const fs = require('fs');
const path = require('path');

require("firebase/database");
var database = firebase.database();
var ref = database.ref('projects');

var projectPath;

$('#saveProjectPath').click(function(){
  var app = require('electron').remote;
  var dialog = app.dialog;
  dialog.showOpenDialog({
    title:"Select a folder",
    properties: ["openDirectory"]
    }, (folderPaths) => {
    // folderPaths is an array that contains all the selected paths
    if(folderPaths === undefined){
        console.log("No destination folder selected");
        return;
    }else{
        projectPath = folderPaths;
        console.log(projectPath);
    }
  });
});

function createNewProject(){
  var projectName = $('#projectName').val();
  // TODO: filepath muss später mit der Ordnerauswahl ersetzt werden.

  var project = new Project(projectName, projectPath);

  var data = {
    projectName: projectName,
    projectFilepath: projectPath
  }
  // Übergibt Projektdaten an Firebase Datenbank
  writeProjectData(data.projectName, data.projectName, data.projectFilepath[0]);
  setTimeout(function(){
    createNewCommit(data.projectName, data.projectFilepath[0])
  }, 3000);

}

function createNewCommit(projectName, projectFilepath){
  // TODO Funktion soll nur ID nehmen und daraus sich den Filepath der Datenbank
  // ziehen um neuen Commit zu erstellen
  var archiver = require('archiver');
  var filepath = projectFilepath ;
  //Schaue ob im Projektordner ein .komet Ordner da ist und erstelle ihn ggf.
  var dir = __dirname + '/.komet';
  if (!fs.existsSync(dir)){
    fs.mkdirSync(dir);
    console.log(dir + ' was created!');
  }

  // TODO: Dateiname braucht noch einen Identifier
  var date = Date.now();

  var tempPath = '../.komet/'+ projectName + '-' +  date + '.zip';
  var output = fs.createWriteStream(path.join(__dirname, tempPath));

  var archive = archiver('zip', {
    gzip: true,
    zlib: { level: 9 } // Sets the compression level.
  });

  archive.on('error', function(err) {
    throw err;
  });

  output.on('close', function() {
    console.log('Archiv wurde erstellt mit einer Größe von ' + archive.pointer() + 'bytes');
  });

  // pipe archive data to the output file
  archive.pipe(output);

  //Besorgt alle daten aus einem Ordner
  archive.directory(filepath, false);
  archive.finalize();
}

function writeProjectData(projectId, projectName, projectFilepath) {
  firebase.database().ref('projects/' + projectId).set({
    projectId: projectId,
    projectName: projectName,
    projectFilepath : projectFilepath
  });
}


text:
<?php
namespace LBChat\Filter;

use LBChat\ChatClient;
use LBChat\ChatServer;

/**
 * Simple class that combines an array of filters and applies them all at the same time.
 * @package LBChat\Filter
 */
class FilterGroup extends ChatFilter {

	/**
	 * @var array $filters
	 */
	protected $filters;

	public function __construct(ChatServer $server, ChatClient $client, array $filters) {
		parent::__construct($server, $client);
		$this->filters = $filters;
	}

	/**
	 * @param string $message The message to filter
	 * @return boolean If the message should be shown
	 */
	public function filterMessage(&$message) {
		//Run through all filters
		foreach ($this->filters as $filter) {
			/* @var ChatFilter $filter */
			if (!$filter->filterMessage($message))
				return false;
		}
		return true;
	}
}


text:
using Orchard.ContentManagement.Handlers;
using Orchard.Data;
using Orchard.Environment.Extensions;
using Vandelay.Industries.Models;

namespace Vandelay.Industries.Handlers {
    [OrchardFeature("Vandelay.RemoteRss")]
    public class RemoteRssPartHandler : ContentHandler {
        public RemoteRssPartHandler(IRepository<RemoteRssPartRecord> repository) {
            Filters.Add(StorageFilter.For(repository));
        }
    }
}


text:
namespace policy {

namespace {

// Helper that forwards the result of a fetch job from the thread that the
// ExternalPolicyDataFetcherBackend runs on to the thread that the
// ExternalPolicyDataFetcher which started the job runs on.
void ForwardJobFinished(
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    const ExternalPolicyDataFetcherBackend::FetchCallback& callback,
    ExternalPolicyDataFetcher::Job* job,
    ExternalPolicyDataFetcher::Result result,
    scoped_ptr<std::string> data) {
  task_runner->PostTask(FROM_HERE,
                        base::Bind(callback, job, result, base::Passed(&data)));
}

// Helper that forwards a job cancelation confirmation from the thread that the
// ExternalPolicyDataFetcherBackend runs on to the thread that the
// ExternalPolicyDataFetcher which canceled the job runs on.
void ForwardJobCanceled(
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    const base::Closure& callback) {
  task_runner->PostTask(FROM_HERE, callback);
}

// Helper invoked when a job cancelation confirmation has been forwarded to the
// thread which canceled the job. The helper itself does nothing. It exists so
// that the |job| can be passed as base::Owned(), allowing it to be deleted on
// the correct thread and after any pending callbacks for the |job| have been
// processed.
void DoNothing(ExternalPolicyDataFetcher::Job* job) {
}

}  // namespace

struct ExternalPolicyDataFetcher::Job {
  Job(const GURL& url,
      int64 max_size,
      const ExternalPolicyDataFetcherBackend::FetchCallback& callback);

  const GURL url;
  const int64 max_size;
  const ExternalPolicyDataFetcherBackend::FetchCallback callback;

 private:
  DISALLOW_COPY_AND_ASSIGN(Job);
};

ExternalPolicyDataFetcher::Job::Job(
    const GURL& url,
    int64 max_size,
    const ExternalPolicyDataFetcherBackend::FetchCallback& callback)
    : url(url),
      max_size(max_size),
      callback(callback) {
}

ExternalPolicyDataFetcher::ExternalPolicyDataFetcher(
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    scoped_refptr<base::SequencedTaskRunner> io_task_runner,
    const base::WeakPtr<ExternalPolicyDataFetcherBackend>& backend)
    : task_runner_(task_runner),
      io_task_runner_(io_task_runner),
      backend_(backend),
      weak_factory_(this) {
}

ExternalPolicyDataFetcher::~ExternalPolicyDataFetcher() {
  DCHECK(task_runner_->RunsTasksOnCurrentThread());
  for (JobSet::iterator it = jobs_.begin(); it != jobs_.end(); ++it)
    CancelJob(*it);
}

ExternalPolicyDataFetcher::Job* ExternalPolicyDataFetcher::StartJob(
    const GURL& url,
    int64 max_size,
    const FetchCallback& callback) {
  DCHECK(task_runner_->RunsTasksOnCurrentThread());
  Job* job = new Job(
      url, max_size,
      base::Bind(&ForwardJobFinished,
                 task_runner_,
                 base::Bind(&ExternalPolicyDataFetcher::OnJobFinished,
                            weak_factory_.GetWeakPtr(),
                            callback)));
  jobs_.insert(job);
  io_task_runner_->PostTask(
      FROM_HERE,
      base::Bind(&ExternalPolicyDataFetcherBackend::StartJob, backend_, job));
  return job;
}

void ExternalPolicyDataFetcher::CancelJob(Job* job) {
  DCHECK(task_runner_->RunsTasksOnCurrentThread());
  DCHECK(jobs_.find(job) != jobs_.end());
  jobs_.erase(job);
  // Post a task that will cancel the |job| in the |backend_|. The |job| is
  // removed from |jobs_| immediately to indicate that it has been canceled but
  // is not actually deleted until the cancelation has reached the |backend_|
  // and a confirmation has been posted back. This ensures that no new job can
  // be allocated at the same address while an OnJobFinished() callback may
  // still be pending for the canceled |job|.
  io_task_runner_->PostTask(
      FROM_HERE,
      base::Bind(&ExternalPolicyDataFetcherBackend::CancelJob,
                 backend_,
                 job,
                 base::Bind(&ForwardJobCanceled,
                            task_runner_,
                            base::Bind(&DoNothing, base::Owned(job)))));
}

void ExternalPolicyDataFetcher::OnJobFinished(const FetchCallback& callback,
                                              Job* job,
                                              Result result,
                                              scoped_ptr<std::string> data) {
  DCHECK(task_runner_->RunsTasksOnCurrentThread());
  JobSet::iterator it = jobs_.find(job);
  if (it == jobs_.end()) {
    // The |job| has been canceled and removed from |jobs_| already. This can
    // happen because the |backend_| runs on a different thread and a |job| may
    // finish before the cancellation has reached that thread.
    return;
  }
  callback.Run(result, data.Pass());
  jobs_.erase(it);
  delete job;
}

ExternalPolicyDataFetcherBackend::ExternalPolicyDataFetcherBackend(
    scoped_refptr<base::SequencedTaskRunner> io_task_runner,
    scoped_refptr<net::URLRequestContextGetter> request_context)
    : io_task_runner_(io_task_runner),
      request_context_(request_context),
      last_fetch_id_(-1),
      weak_factory_(this) {
}

ExternalPolicyDataFetcherBackend::~ExternalPolicyDataFetcherBackend() {
  DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
  STLDeleteContainerPairFirstPointers(job_map_.begin(), job_map_.end());
}

scoped_ptr<ExternalPolicyDataFetcher>
    ExternalPolicyDataFetcherBackend::CreateFrontend(
        scoped_refptr<base::SequencedTaskRunner> task_runner) {
  return make_scoped_ptr(new ExternalPolicyDataFetcher(
      task_runner, io_task_runner_, weak_factory_.GetWeakPtr()));
}

void ExternalPolicyDataFetcherBackend::StartJob(
    ExternalPolicyDataFetcher::Job* job) {
  DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
  net::URLFetcher* fetcher =
      net::URLFetcher::Create(++last_fetch_id_, job->url, net::URLFetcher::GET,
                              this).release();
  data_use_measurement::DataUseUserData::AttachToFetcher(
      fetcher, data_use_measurement::DataUseUserData::POLICY);
  fetcher->SetRequestContext(request_context_.get());
  fetcher->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE |
                        net::LOAD_DO_NOT_SAVE_COOKIES |
                        net::LOAD_DO_NOT_SEND_COOKIES |
                        net::LOAD_DO_NOT_SEND_AUTH_DATA);
  fetcher->SetAutomaticallyRetryOnNetworkChanges(3);
  fetcher->Start();
  job_map_[fetcher] = job;
}

void ExternalPolicyDataFetcherBackend::CancelJob(
    ExternalPolicyDataFetcher::Job* job,
    const base::Closure& callback) {
  DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
  for (JobMap::iterator it = job_map_.begin(); it != job_map_.end(); ) {
    if (it->second == job) {
      delete it->first;
      job_map_.erase(it++);
    } else {
      ++it;
    }
  }
  callback.Run();
}

void ExternalPolicyDataFetcherBackend::OnURLFetchComplete(
    const net::URLFetcher* source) {
  DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
  JobMap::iterator it = job_map_.find(const_cast<net::URLFetcher*>(source));
  if (it == job_map_.end()) {
    NOTREACHED();
    return;
  }

  ExternalPolicyDataFetcher::Result result = ExternalPolicyDataFetcher::SUCCESS;
  scoped_ptr<std::string> data;

  const net::URLRequestStatus status = it->first->GetStatus();
  if (status.error() == net::ERR_CONNECTION_RESET ||
      status.error() == net::ERR_TEMPORARILY_THROTTLED) {
    // The connection was interrupted.
    result = ExternalPolicyDataFetcher::CONNECTION_INTERRUPTED;
  } else if (status.status() != net::URLRequestStatus::SUCCESS) {
    // Another network error occurred.
    result = ExternalPolicyDataFetcher::NETWORK_ERROR;
  } else if (source->GetResponseCode() >= 500) {
    // Problem at the server.
    result = ExternalPolicyDataFetcher::SERVER_ERROR;
  } else if (source->GetResponseCode() >= 400) {
    // Client error.
    result = ExternalPolicyDataFetcher::CLIENT_ERROR;
  } else if (source->GetResponseCode() != 200) {
    // Any other type of HTTP failure.
    result = ExternalPolicyDataFetcher::HTTP_ERROR;
  } else {
    data.reset(new std::string);
    source->GetResponseAsString(data.get());
    if (static_cast<int64>(data->size()) > it->second->max_size) {
      // Received |data| exceeds maximum allowed size.
      data.reset();
      result = ExternalPolicyDataFetcher::MAX_SIZE_EXCEEDED;
    }
  }

  ExternalPolicyDataFetcher::Job* job = it->second;
  delete it->first;
  job_map_.erase(it);
  job->callback.Run(job, result, data.Pass());
}

void ExternalPolicyDataFetcherBackend::OnURLFetchDownloadProgress(
    const net::URLFetcher* source,
    int64 current,
    int64 total) {
  DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
  JobMap::iterator it = job_map_.find(const_cast<net::URLFetcher*>(source));
  DCHECK(it != job_map_.end());
  if (it == job_map_.end())
    return;

  // Reject the data if it exceeds the size limit. The content length is in
  // |total|, and it may be -1 when not known.
  if (current > it->second->max_size || total > it->second->max_size) {
    ExternalPolicyDataFetcher::Job* job = it->second;
    delete it->first;
    job_map_.erase(it);
    job->callback.Run(job,
                      ExternalPolicyDataFetcher::MAX_SIZE_EXCEEDED,
                      scoped_ptr<std::string>());
  }
}

}  // namespace policy


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Exobasidium symploci-fasciculatae Racib.

### Remarks
null


text:
PASS_REGULAR_EXPRESSION
-----------------------

The output must match this regular expression for the test to pass.

If set, the test output will be checked against the specified regular
expressions and at least one of the regular expressions has to match,
otherwise the test will fail.  Example:

.. code-block:: cmake

  set_tests_properties(mytest PROPERTIES
    PASS_REGULAR_EXPRESSION "TestPassed;All ok"
  )

``PASS_REGULAR_EXPRESSION`` expects a list of regular expressions.


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd"
    default-lazy-init="true">

    <description>Spring公共配置 </description>

    <!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
    <context:component-scan base-package="com.alibaba.dubbo.user" />

    <bean id="userConfig" class="org.apache.commons.configuration.XMLConfiguration">
        <constructor-arg type="java.lang.String" value="user-config.xml" />
        <property name="reloadingStrategy">
            <bean class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy" />
        </property>
    </bean>

</beans>


text:
package net.mgsx.game.examples.convoy.model;

import com.badlogic.ashley.core.Engine;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.MathUtils;

import net.mgsx.game.examples.convoy.components.Conveyor;
import net.mgsx.game.examples.convoy.components.Docked;
import net.mgsx.game.examples.convoy.components.Planet;

public class Universe {

	static final int SIZE = 5;
	static final float CELL_SCALE = 15;

	static final float GOODS_PER_SIZE = 0.3f;

	public static Universe init(Engine engine){

		Planet[] planets = new Planet[SIZE * SIZE];

		int count=0;
		for(int y=0 ; y<SIZE; y++){
			for(int x=0 ; x<SIZE; x++){

				Entity entity = engine.createEntity();

				Planet planet = engine.createComponent(Planet.class);
				planet.name = "Planet " + (count+1);
				planet.position.x = x * CELL_SCALE + MathUtils.random(CELL_SCALE * 4f/5f);
				planet.position.y = y * CELL_SCALE + MathUtils.random(CELL_SCALE * 4f/5f);
				planet.logicSize = MathUtils.random();
				planet.radius = MathUtils.lerp(1f, CELL_SCALE/5, planet.logicSize);

				entity.add(planet);

				engine.addEntity(entity);

				planets[count] = planet;

				count++;
			}
		}

		// distribute gaz
		int nStations = MathUtils.ceil(SIZE * SIZE / 4);
		for(int i=0  ; i<nStations ; i++){

			planets[MathUtils.random(planets.length-1)].gazAvailability += 1;

		}

		for(int i=0 ; i<planets.length ; i++)
		{
			Planet planet = planets[i];

			for(MaterialType type : MaterialType.ALL){
				MaterialInfo info;
				planet.materials.put(type, info = new MaterialInfo());

				// TODO balance normalized over the universe to always have needs and offers.
				float balance = MathUtils.random() + planet.logicSize - 1;

				info.stock = MathUtils.floor(balance * 10);
				// info.target = info.stock;

//				Goods goods = new Goods();
//				goods.type = type;
//
//
//
//
//				int destinationID = MathUtils.random(0, planets.length-2);
//				if(destinationID == i) destinationID = planets.length-1;
//
//				goods.destination = planets[destinationID];
//
//				float distance = planet.position.dst(goods.destination.position);
//
//				goods.buyValue = 100;
//				goods.sellValue = (int)((MathUtils.random() + 1) * distance * 100 );
//
//				planet.goods.add(goods);
			}

			int nGoods = (int)(planet.radius * planet.radius / (CELL_SCALE * CELL_SCALE* GOODS_PER_SIZE));
			for(int g=0 ; g<nGoods ; g++){

				Goods goods = new Goods();

				int destinationID = MathUtils.random(0, planets.length-2);
				if(destinationID == i) destinationID = planets.length-1;

				goods.destination = planets[destinationID];

				float distance = planet.position.dst(goods.destination.position);

				goods.buyValue = 100;
				goods.sellValue = (int)((MathUtils.random() + 1) * distance * 100 );

				planet.goods.add(goods);

			}
		}

		int totalPos = 0, totalNeg = 0;
		for(int i=0 ; i<planets.length ; i++)
		{
			Planet planet = planets[i];
			for(MaterialType type : MaterialType.ALL){
				if(planet.materials.get(type).stock > 0)
					totalPos += planet.materials.get(type).stock;
				else
					totalNeg -= planet.materials.get(type).stock;
			}
		}

		int offset = (totalNeg - totalPos) / (planets.length * 4);
		for(int i=0 ; i<planets.length ; i++)
		{
			Planet planet = planets[i];
			for(MaterialType type : MaterialType.ALL){
				planet.materials.get(type).stock += offset;
			}
		}

//		int resourcesDelta = SIZE * SIZE * 4;
//		while(resourcesDelta > 0){
//			Planet planet = planets[MathUtils.random(planets.length-1)];
//			MaterialInfo info = planet.materials.get(MaterialType.ALL[MathUtils.random(MaterialType.ALL.length-1)]);
//			info.stock += MathUt;
//			resourcesDelta -= 1;
//			info.target = info.stock;
//		}

		initConveyor(engine, null);

		return new Universe();
	}

	public static void initConveyor(Engine engine, Entity planetEntity) {

		Entity conveyorEntity = engine.createEntity();
		Conveyor conveyor = engine.createComponent(Conveyor.class);

		conveyor.position.setZero();
		conveyor.capacity = 10;
		conveyor.oil = conveyor.oilMax = SIZE * CELL_SCALE * 2; // enough for 2x universe size

		conveyor.storageCapacity = 10;

		for(MaterialType type : MaterialType.ALL){
			conveyor.materials.put(type, 0f);
		}

		conveyorEntity.add(conveyor);

		if(planetEntity != null){
			Planet planet = Planet.components.get(planetEntity);
			conveyor.position.set(planet.position);
			Docked d = engine.createComponent(Docked.class);
			d.planet = planetEntity;
			conveyorEntity.add(d);
		}

		engine.addEntity(conveyorEntity);
	}

	public float playerMoney = 1000;

}


text:
title: "Co-working"
text: "Join us to work on some code in good company. Bring something to work on, ask and discuss with your fellow coders.
"
location: "MADLab"
link: "https://github.com/UofTCoders/Events/issues/254"
date: "2019-07-04"
startTime: "18:10"
endTime: "19:00"
---


text:
public interface ICommand
{
    string[] Parameters { get; }
    string Execute();
}


text:
<?php

namespace Doctrine\Tests\DBAL\Platforms;

use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\TransactionIsolationLevel;

class MySqlPlatformTest extends AbstractMySQLPlatformTestCase
{
    public function createPlatform()
    {
        return new MySqlPlatform();
    }

    public function testHasCorrectDefaultTransactionIsolationLevel()
    {
        self::assertEquals(
            TransactionIsolationLevel::REPEATABLE_READ,
            $this->platform->getDefaultTransactionIsolationLevel()
        );
    }
}


text:
@interface SettingsViewController : TPViewController

@end


text:
testreleases
============

Test Releases feature


text:
#include "curveproperties.h"
#include "ui_curveproperties.h"

#include "Interfaces/imainwindow.h"

CurveProperties::CurveProperties(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::CurveProperties)
{
    ui->setupUi(this);

    QStringList styles;
    styles << "No line"<<"Points olny"<<"--line"<<"- line"<<". line"<<"-. line"<<"-.. line";
    this->ui->style->insertItems(0,styles);

    this->connect(this->ui->label,SIGNAL(editingFinished()),this,SLOT(labelChnged()));
    this->connect(this->ui->comment,SIGNAL(textChanged()),this,SLOT(commentChanged()));

    this->connect(this->ui->style,SIGNAL(currentIndexChanged(int)),this,SLOT(styleChanged(int)));
    this->connect(this->ui->colorbtn,SIGNAL(clicked()),this,SLOT(colorChange()));

    this->connect(this->ui->xaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(xAxisIdChanged(int)));
    this->connect(this->ui->yaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(yAxisIdChanged(int)));

    this->connect(this->ui->width,SIGNAL(valueChanged(double)),this,SLOT(widthChanged(double)));
    this->reloadData();

    ServicesProvider::getInstance()->registerService<ICurveProperties>(this);
}

CurveProperties::~CurveProperties()
{
    delete ui;
}

std::string CurveProperties::getName()
{
    return "ICurveProperties";
}

void CurveProperties::currentCurveIndexChanged(int id)
{
    this->reloadData(id);
}

void CurveProperties::labelChnged()
{
    if (this->c == nullptr || this->c->getLabel() == std::string(this->ui->label->text().toUtf8().constData())) return;
    this->c->setLabel(std::string(this->ui->label->text().toUtf8().constData()));

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::commentChanged()
{
    if (this->c == nullptr || this->c->getComment() == std::string(this->ui->comment->document()->toPlainText().toUtf8().constData())) return;
    this->c->setComment((std::string(this->ui->comment->document()->toPlainText().toUtf8().constData())));

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::styleChanged(int id)
{
    if (this->c == nullptr || this->c->getStyle() == id) return;
    this->c->setStyle(static_cast<Curve::LineStyles>(id));

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::xAxisIdChanged(int id)
{
    if (this->c == nullptr || this->c->getXAxisId() == id - 1) return;
    this->c->setXAxisId(id-1);

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::yAxisIdChanged(int id)
{
    if (this->c == nullptr || this->c->getYAxisId() == id - 1) return;
    this->c->setYAxisId(id-1);

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::colorChange()
{
    if (this->c == nullptr) return;
    auto color = QColorDialog::getColor(QColor(this->ui->color->text()),this);
    if (color.isValid() || QColor(this->ui->color->text()) == color) {

        this->c->setColor(std::string(color.name().toUtf8().constData()));
        this->ui->color->setText(c->getColor().c_str());

        ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
    }
}

void CurveProperties::widthChanged(double w)
{
    if (this->c == nullptr || this->c->getWidth() == w) return;
    this->c->setWidth(this->ui->width->value());

    ServicesProvider::getInstance()->getService<IProjectManager>()->projectSetUnSaved();
}

void CurveProperties::loadCurve(Curve *c){
    this->c = c;
    auto pm = ServicesProvider::getInstance()->getService<IProjectManager>();

    this->ui->label->setText(c->getLabel().c_str());
    this->ui->comment->setText(c->getComment().c_str());

    this->ui->style->setCurrentIndex(static_cast<int>(c->getStyle()));
    this->ui->width->setValue(c->getWidth());
    this->ui->color->setText(c->getColor().c_str());

    this->disconnect(this->ui->xaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(xAxisIdChanged(int)));
    this->reloadAxis(this->ui->xaxis,pm->getProject()->getGraphOpts()->getXAxes());
    this->connect(this->ui->xaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(xAxisIdChanged(int)));

    this->disconnect(this->ui->yaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(yAxisIdChanged(int)));
    this->reloadAxis(this->ui->yaxis,pm->getProject()->getGraphOpts()->getYAxes());
    this->connect(this->ui->yaxis,SIGNAL(currentIndexChanged(int)),this,SLOT(yAxisIdChanged(int)));

    this->ui->xaxis->setCurrentIndex(c->getXAxisId()+1);
    this->ui->yaxis->setCurrentIndex(c->getYAxisId()+1);
}

void CurveProperties::reloadAxis(QComboBox *cb, Axes *a)
{
    cb->clear();
    cb->insertItem(0,"");

    std::for_each(a->begin(),a->end(),[cb] (Axis *ax){
        cb->insertItem(cb->count(),std::get<2>((*ax)).c_str());
    });
}

void CurveProperties::reloadData(int curveId)
{
    auto pm = ServicesProvider::getInstance()->getService<IProjectManager>();

    if (curveId == -1){
        this->setDisabled(true);
        this->c = nullptr;
        return;
    } else if (curveId < pm->getProject()->getCurves()->size()){
        this->setEnabled(true);

        this->loadCurve(pm->getProject()->getCurves()->at(curveId));
    } else {
        QMessageBox::warning(dynamic_cast<QWidget*>(ServicesProvider::getInstance()->getService<IMainWindow>()),
                             "OpenGrapher : Warning","Selected curve not exists",QMessageBox::Ok);

    }
}