text:
<?php
namespace Oro\Bundle\IssueBundle\Form\Type;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Oro\Bundle\SoapBundle\Form\EventListener\PatchSubscriber;

class IssueApiType extends IssueType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder->add(
            'createdAt',
            'oro_datetime',
            [
                'required' => false,
            ]
        );
        $builder->addEventSubscriber(new PatchSubscriber());
    }
    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
            [
                'data_class' => 'Oro\Bundle\IssueBundle\Entity\Issue',
                'csrf_protection' => false
            ]
        );
    }
    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'issue';
    }
}


text:
import sys, re

def to_unicode(s):
	if type(s) == str:
		return unicode(s, "utf-8")
	return s

if sys.version_info >= (3,):
	unicode = str
	def to_unicode(s):
		return s

class Template(object):
	_template = None
	_data = {}

	def __init__(self, template=u'', **kw):
		self._template = to_unicode(template)

		self._data = {}
		self.update(**kw)
		if type(self._template) == list:
			for x in self._template:
				self._find_data(x)
		else:
			self._find_data(self._template)

	def _find_data(self, temp):
		for key in re.findall("\{(.*?)\}", temp):
			key = re.split("[:!\[\.]", key, 1)[0]
			if not key in self._data:
				self._data[key] = u""#Template()

	def collapse(self, **kw):
		temp = u"".join(self._template) if type(self._template) == list else self._template
		if kw:
			data = {k:v for k,v in self._data.items() if not k in kw}
			data.update(kw)
		else:
			data = self._data
		return temp.format(**{
			k:(v.collapse() if isinstance(v, Template) else to_unicode(v)) for k,v in data.items()
		})

	def copy(self, **kw):
		t = Template()
		t._template = self._template.copy() if type(self._template) == list else self._template
		t._data = self._data.copy()
		if kw:
			t.update(**kw)
		return t

	# "string" interface

	__str__ = collapse

	def __repr__(self):
		return repr((self._template, self._data))

	def __add__(self, other):
		t = self.copy()
		t += other
		return t

	def __radd__(self, other):
		t = Template(other)
		t += self
		return t

	def __iadd__(self, other):
		if not type(self._template) == list:
			self._template = [self._template]

		if type(other) in (unicode, str):
			other = to_unicode(other)
			self._template.append(other)
			self._find_data(other)
		elif isinstance(other, Template):
			if type(other._template) == list:
				self._template.extend(other._template)
			else:
				self._template.append(other._template)
			for k,v in other._data.items():
				if not k in self._data:
					self._data[k] = v

		return self

	# "function" interface

	__call__ = collapse

	# dictionary interface

	def update(self, **kw):
		#for k, v in kw.items():
			#if type(v) in (unicode, str):
				#kw[k] = Template(v)
		self._data.update(**kw)

	def __getitem__(self, key):
		return self._data[key]

	def __setitem__(self, key, value):
		#if type(value) in (unicode, str):
			#value = Template(value)
		self._data[key] = value

	# attribute interface

	def __getattr__(self, name):
		try:
			return object.__getattribute__(self, name)
		except AttributeError:
			return self._data[name]

	def __setattr__(self, name, value):
		if name in self._data:
			self.__setitem__(name, value)
		else:
			object.__setattr__(self, name, value)

if __name__ == "__main__":
	html = Template("""

			<title>{title}</title>

			{menu}
			{body}

""")

	html.title = "Cool Template"
	link = Template('{text}')
	html.menu = " | ".join(link(url=u, text=t) for u,t in [
		("/", "Home"),
		("/about", "About"),
		("/support", "Support"),
	])
	html.body = Template("""

{header}

			{page}
""")
	html.body.header = "This is so cool.."
	html.body.page = "..."

	print(html)

	import datetime
	comment_f = Template("""\t\t\t
{comment[time]:%Y-%m-%d %H:%M} {comment[poster]} says:
{comment[msg]}""")
	comments = [
		dict(time=datetime.datetime.now(), poster="Awesome Guy", msg="wow.. like really, wow.."),
	]
	for c in comments:
		html.body += comment_f(comment=c)
	html.body += "\n\t\t\t
oh forgot {something}.."
	html.body.something = "this"
	print(html)

	## more fun

	item = Template("
{x} - {y}")
	item.x = 3
	html = Template("""<title>{title}</title>{menu}
{body}""")
	for x in range(3):
		html.body += item.collapse(y="s"*(3+x))
	html = "sf" + html
	print(type(html))
	html.menu = "lol"
	html.body += Template("haha lol {hh:_>10}")
	html.body.hh = 345
	# auto repr/str doesn't work in python 3 it seems
	#html.body.hh = (2,45)
	#html.body.hh = {"sf":2}
	html["body"] += Template("haha lol {p[first]} {p[last]}")
	html["body"]["p"] = {'first': 'Jean-Luc', 'last': 'Picard'}
	print(html)

redpajama_set_name: RedPajamaGithub


text:
nav{
	margin-bottom: 60px;
}

nav ul{
	list-style: none;
	margin: 0;
	padding: 0;
}

nav ul a{
	text-decoration: none;
}

.dropdown{
    position: relative;
    display: inline-block;
	margin: 0;
	padding: 0;
	top: 55px;
}

.dropdown-inhoud{
    display: none;
    position: fixed;
    background-color: #F5F5F5;
	font-size: 16px;
	text-decoration: none;
    min-width: 60px;
    box-shadow: 5px 6px 7px 2px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-inhoud>ul>li>a{
    color: #000000;
    padding: 10px 10px 10px 40px;
    text-decoration: none;
    display: block;
	font-size: 16px;
}

.dropdown-inhoud>ul>li>a:hover{
	background-color: #E9ECE5;
	color: white;
}

.dropdown:hover .dropdown-inhoud{
    display: block;
}

.homeIcon{
	background: url(../assets/icons/homeIcon.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.homeIcon:hover{
	background: url(../assets/icons/homeIconHover.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.portfolioIcon{
	background: url(../assets/icons/portfolioIcon.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.portfolioIcon:hover{
	background: url(../assets/icons/portfolioIconHover.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.infoIcon{
	background: url(../assets/icons/infoIcon.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.infoIcon:hover{
	background: url(../assets/icons/infoIconHover.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.servicesIcon{
	background: url(../assets/icons/servicesIcon.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.servicesIcon:hover{
	background: url(../assets/icons/servicesIconHover.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.teamIcon{
	background: url(../assets/icons/teamIcon.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

.teamIcon:hover{
	background: url(../assets/icons/teamIconHover.png) no-repeat 6px;
	background-position: 10px 8px;
	background-size: 20px;
}

body{
	background-image: url("../assets/images/spacebanner.jpg");
	background-repeat: no-repeat;
	min-height: 100%;
  	min-width: 1024px;
	background-size: 100%;
}

.bodyBanner{
	background-image: url("../assets/images/spacebannerstrook.png");
	background-repeat: no-repeat;
	min-height: 100%;
  	min-width: 1024px;
	background-size: 100%;
}

.logoBanner{
	width: 100%;
	max-width: 550px;
	max-height: 100%;
	position: absolute;
	cursor: pointer;
  	top: 35%;
  	left: 50%;
  	transform: translate(-50%, -50%);
	padding: 20px 60px;
	border: 5px solid #FFFFFF;
}

.logoPosition{
	margin-bottom: 340px;
}

.logoBannerNormaal{
	width: 170px;
	position: relative;
	display: inline-block;
	cursor: pointer;
	float: right;
	top: 38px;
	padding: 7px 20px;
	border: 2px solid #FFFFFF;
}


text:
goog.provide('goog.debug.TraceTest');
goog.setTestOnly('goog.debug.TraceTest');

goog.require('goog.debug.Trace');
goog.require('goog.testing.jsunit');

function testTracer() {
  goog.debug.Trace.initCurrentTrace();
  var t = goog.debug.Trace.startTracer('foo');
  var sum = 0;
  for (var i = 0; i < 100000; i++) {
    sum += i;
  }
  goog.debug.Trace.stopTracer(t);
  var trace = goog.debug.Trace.getFormattedTrace();
  var lines = trace.split('\n');
  assertEquals(8, lines.length);
  assertNotNull(lines[0].match(/^\s*\d+\.\d+\s+Start\s+foo$/));
  assertNotNull(lines[1].match(/^\s*\d+\s+\d+\.\d+\s+Done\s+\d+ ms\s+foo$/));
}

function testPerf() {
  goog.debug.Trace.initCurrentTrace();
  var count = 1000;
  var start = goog.now();
  for (var i = 0; i < count; i++) {
    var t = goog.debug.Trace.startTracer('foo');
    var t2 = goog.debug.Trace.startTracer('foo.bar');
    var t3 = goog.debug.Trace.startTracer('foo.bar.baz');
    goog.debug.Trace.stopTracer(t3);
    var t4 = goog.debug.Trace.startTracer('foo.bar.bim');
    goog.debug.Trace.stopTracer(t4);
    goog.debug.Trace.stopTracer(t2);
    goog.debug.Trace.stopTracer(t);
  }
  count *= 4;
  var end = goog.now();
}


text:
package org.jtrim2.property;

import java.util.Objects;
import org.jtrim2.collections.EqualityComparator;
import org.jtrim2.event.ListenerRef;

/**
 * @see PropertyFactory#lazilyNotifiedSource(PropertySource, EqualityComparator)
 */
final class LazilyNotifiedPropertySource<ValueType> implements PropertySource<ValueType> {
    private final PropertySource<? extends ValueType> wrapped;
    private final EqualityComparator<? super ValueType> equality;

    public LazilyNotifiedPropertySource(
            PropertySource<? extends ValueType> wrapped,
            EqualityComparator<? super ValueType> equality) {
        Objects.requireNonNull(wrapped, "wrapped");
        Objects.requireNonNull(equality, "equality");

        this.wrapped = wrapped;
        this.equality = equality;
    }

    @Override
    public ValueType getValue() {
        return wrapped.getValue();
    }

    @Override
    public ListenerRef addChangeListener(final Runnable listener) {
        return wrapped.addChangeListener(new LazyListener<>(wrapped, equality, listener));
    }

    // Retrieving "lastValue" initially is unsafe. Consider the following scenario:
    //
    // 1. The value is read to "lastValue" and is "A".
    // 2. The value concurrently changes to "B".
    // 3. The listener gets actually registered and will be notified of changes.
    // 4. Later the value changes to "A".
    //
    // Notice that we would fail to forward notification request. Even though,
    // the value changed after the listener got registered (addChangeListener returned).

    static final class LazyListener<ValueType> implements Runnable {
        private final PropertySource<? extends ValueType> wrapped;
        private final EqualityComparator<? super ValueType> equality;
        private final Runnable listener;
        private ValueType lastValue;
        private boolean hasBeenRead;

        public LazyListener(
                PropertySource<? extends ValueType> wrapped,
                EqualityComparator<? super ValueType> equality,
                Runnable listener) {
            Objects.requireNonNull(listener, "listener");

            this.wrapped = wrapped;
            this.equality = equality;
            this.hasBeenRead = false;
            this.listener = listener;
        }

        @Override
        public void run() {
            ValueType currentValue = wrapped.getValue();
            ValueType prevValue = lastValue;
            lastValue = currentValue;

            if (!hasBeenRead || !equality.equals(currentValue, prevValue)) {
                listener.run();
            }
            hasBeenRead = true;
        }
    }
}


text:
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/fs.h>
#include <linux/ioport.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>

#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/system.h>

#define WATCHDOG_NAME "Advantech WDT"
#define PFX WATCHDOG_NAME ": "
#define WATCHDOG_TIMEOUT 60		/* 60 sec default timeout */

static unsigned long advwdt_is_open;
static char adv_expect_close;

/*
 *	You must set these - there is no sane way to probe for this board.
 *
 *	To enable or restart, write the timeout value in seconds (1 to 63)
 *	to I/O port wdt_start.  To disable, read I/O port wdt_stop.
 *	Both are 0x443 for most boards (tested on a PCA-6276VE-00B1), but
 *	check your manual (at least the PCA-6159 seems to be different -
 *	the manual says wdt_stop is 0x43, not 0x443).
 *	(0x43 is also a write-only control register for the 8254 timer!)
 */

static int wdt_stop = 0x443;
module_param(wdt_stop, int, 0);
MODULE_PARM_DESC(wdt_stop, "Advantech WDT 'stop' io port (default 0x443)");

static int wdt_start = 0x443;
module_param(wdt_start, int, 0);
MODULE_PARM_DESC(wdt_start, "Advantech WDT 'start' io port (default 0x443)");

static int timeout = WATCHDOG_TIMEOUT;	/* in seconds */
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");

static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");

/*
 *	Kernel methods.
 */

static void
advwdt_ping(void)
{
	/* Write a watchdog value */
	outb_p(timeout, wdt_start);
}

static void
advwdt_disable(void)
{
	inb_p(wdt_stop);
}

static ssize_t
advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
	if (count) {
		if (!nowayout) {
			size_t i;

			adv_expect_close = 0;

			for (i = 0; i != count; i++) {
				char c;
				if (get_user(c, buf+i))
					return -EFAULT;
				if (c == 'V')
					adv_expect_close = 42;
			}
		}
		advwdt_ping();
	}
	return count;
}

static int
advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
	  unsigned long arg)
{
	int new_timeout;
	void __user *argp = (void __user *)arg;
	int __user *p = argp;
	static struct watchdog_info ident = {
		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
		.firmware_version = 1,
		.identity = "Advantech WDT",
	};

	switch (cmd) {
	case WDIOC_GETSUPPORT:
	  if (copy_to_user(argp, &ident, sizeof(ident)))
	    return -EFAULT;
	  break;

	case WDIOC_GETSTATUS:
	case WDIOC_GETBOOTSTATUS:
	  return put_user(0, p);

	case WDIOC_KEEPALIVE:
	  advwdt_ping();
	  break;

	case WDIOC_SETTIMEOUT:
	  if (get_user(new_timeout, p))
		  return -EFAULT;
	  if ((new_timeout < 1) || (new_timeout > 63))
		  return -EINVAL;
	  timeout = new_timeout;
	  advwdt_ping();
	  /* Fall */

	case WDIOC_GETTIMEOUT:
	  return put_user(timeout, p);

	case WDIOC_SETOPTIONS:
	{
	  int options, retval = -EINVAL;

	  if (get_user(options, p))
	    return -EFAULT;

	  if (options & WDIOS_DISABLECARD) {
	    advwdt_disable();
	    retval = 0;
	  }

	  if (options & WDIOS_ENABLECARD) {
	    advwdt_ping();
	    retval = 0;
	  }

	  return retval;
	}

	default:
	  return -ENOIOCTLCMD;
	}
	return 0;
}

static int
advwdt_open(struct inode *inode, struct file *file)
{
	if (test_and_set_bit(0, &advwdt_is_open))
		return -EBUSY;
	/*
	 *	Activate
	 */

	advwdt_ping();
	return nonseekable_open(inode, file);
}

static int
advwdt_close(struct inode *inode, struct file *file)
{
	if (adv_expect_close == 42) {
		advwdt_disable();
	} else {
		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
		advwdt_ping();
	}
	clear_bit(0, &advwdt_is_open);
	adv_expect_close = 0;
	return 0;
}

/*
 *	Notifier for system down
 */

static int
advwdt_notify_sys(struct notifier_block *this, unsigned long code,
	void *unused)
{
	if (code == SYS_DOWN || code == SYS_HALT) {
		/* Turn the WDT off */
		advwdt_disable();
	}
	return NOTIFY_DONE;
}

/*
 *	Kernel Interfaces
 */

static struct file_operations advwdt_fops = {
	.owner		= THIS_MODULE,
	.llseek		= no_llseek,
	.write		= advwdt_write,
	.ioctl		= advwdt_ioctl,
	.open		= advwdt_open,
	.release	= advwdt_close,
};

static struct miscdevice advwdt_miscdev = {
	.minor = WATCHDOG_MINOR,
	.name = "watchdog",
	.fops = &advwdt_fops,
};

/*
 *	The WDT needs to learn about soft shutdowns in order to
 *	turn the timebomb registers off.
 */

static struct notifier_block advwdt_notifier = {
	.notifier_call = advwdt_notify_sys,
};

static int __init
advwdt_init(void)
{
	int ret;

	printk(KERN_INFO "WDT driver for Advantech single board computer initialising.\n");

	if (timeout < 1 || timeout > 63) {
		timeout = WATCHDOG_TIMEOUT;
		printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
			timeout);
	}

	if (wdt_stop != wdt_start) {
		if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
			printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
				wdt_stop);
			ret = -EIO;
			goto out;
		}
	}

	if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
		printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
			wdt_start);
		ret = -EIO;
		goto unreg_stop;
	}

	ret = register_reboot_notifier(&advwdt_notifier);
	if (ret != 0) {
		printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
			ret);
		goto unreg_regions;
	}

	ret = misc_register(&advwdt_miscdev);
	if (ret != 0) {
		printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
			WATCHDOG_MINOR, ret);
		goto unreg_reboot;
	}

	printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
		timeout, nowayout);

out:
	return ret;
unreg_reboot:
	unregister_reboot_notifier(&advwdt_notifier);
unreg_regions:
	release_region(wdt_start, 1);
unreg_stop:
	if (wdt_stop != wdt_start)
		release_region(wdt_stop, 1);
	goto out;
}

static void __exit
advwdt_exit(void)
{
	misc_deregister(&advwdt_miscdev);
	unregister_reboot_notifier(&advwdt_notifier);
	if(wdt_stop != wdt_start)
		release_region(wdt_stop,1);
	release_region(wdt_start,1);
}

module_init(advwdt_init);
module_exit(advwdt_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Marek Michalkiewicz <marekm@linux.org.pl>");
MODULE_DESCRIPTION("Advantech Single Board Computer WDT driver");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);


text:
.class synthetic Lcn/com/smartdevices/bracelet/analysis/a;
.super Ljava/lang/Object;


text:
/**
 * @overview this class is abstract,use for config line
 * @component#iChart.Line
 * @extend#iChart.Chart
 */
iChart.Line = iChart.extend(iChart.Chart, {
    /**
     * initialize the context for the line
     */
    configure: function () {
        /**
         * invoked the super class's configuration
         */
        iChart.Line.superclass.configure.call(this);

        this.type = 'line';

        this.set({
            /**
             * @cfg {Boolean} if the left-right point are direct when point's value is null.false to break.(default to true)
             */
            nullToDirect: true,
            /**
             * @cfg {Number} Specifies the default linewidth of the canvas's context in this element.(defaults to 1)
             */
            brushsize: 1,
            /**
             * @cfg {Object} Specifies config crosshair.(default enable to false).For details see <link>iChart.CrossHair</link> Note:this has a extra property named 'enable',indicate whether crosshair available(default to false)
             */
            crosshair: {
                enable: false
            },
            /**
             * @cfg {Function} when there has more than one linesegment,you can use tipMocker make them as a tip.(default to null)
             * @paramter Array tips the array of linesegment's tip
             * @paramter int the index of data
             * @return String
             */
            tipMocker: null,
            /**
             * @cfg {Number(0.0~1.0)} If null,the position there will follow the points.If given a number,there has a fixed position,0 is top,and 1 to bottom.(default to null)
             */
            tipMockerOffset: null,
            /**
             * @cfg {String} the align of scale.(default to 'left') Available value are:
             * @Option 'left'
             * @Option 'right'
             */
            scaleAlign: 'left',
            /**
             * @cfg {String} the align of label.(default to 'bottom') Available value are:
             * @Option 'top,'bottom'
             */
            labelAlign: 'bottom',
            /**
             * @cfg {Array} the array of labels close to the axis
             */
            labels: [],
            /**
             * @inner {Number} the distance of column's bottom and text.(default to 6)
             */
            label_space: 6,
            /**
             * @inner {Boolean} if the point are proportional space.(default to true)
             */
            proportional_spacing: true,
            /**
             * @cfg {<link>iChart.LineSegment</link>} the option for linesegment.
             */
            sub_option: {},
            /**
             * {Object} the option for legend.
             */
            legend: {
                sign: 'bar'
            },

            /**
             * @cfg {<link>iChart.Text</link>} Specifies option of label at bottom.
             */
            label: {}
        });

        this.registerEvent(
            /**
             * @event Fires when parse this element'data.Return value will override existing.
             * @paramter object#data the data of one linesegment
             * @paramter object#v the point's value
             * @paramter int#x coordinate-x of point
             * @paramter int#y coordinate-y of point
             * @paramter int#index the index of point
             * @return Object object Detail:
             * @property text the text of point
             * @property x coordinate-x of point
             * @property y coordinate-y of point
             */
            'parsePoint');

        this.lines = [];
        this.components.push(this.lines);
        this.on('resize', function () {
            this.push('point_space', 0);
        });
    },
    /**
     * @method load the new data
     * @paramter array#data
     * @paramter array#labels
     * @return void
     */
    load: function (data, labels) {
        var scale = this.get('coordinate.scale');
        for (var i = 0; labels && i < scale.length; i++) {
            //TODO  labelAlign
            if (scale[i]['position'] == this.get('labelAlign')) {
                scale[i]['labels'] = labels;
            }
        }
        this.push('point_space', 0);
        iChart.Line.superclass.load.call(this, data);
    },
    /**
     * @method toggle or setting the visibility of linesegment
     */
    toggle: function (index, state) {
        var l = this.lines[(index || 0) % this.lines.length];
        if (typeof state == 'undefined') {
            state = !l.get('actived');
        }
        l.push('actived', state);
        this._draw();
    },
    /**
     * @method Returns the coordinate of this element.
     * @return iChart.Coordinate2D
     */
    getCoordinate: function () {
        return this.coo;
    },
    doConfig: function () {
        iChart.Line.superclass.doConfig.call(this);
        var _ = this._(), s = _.data.length <= 1;

        _.lines.length = 0;
        _.lines.zIndex = _.get('z_index');

        var k = _.pushIf('sub_option.keep_with_coordinate', s);
        if (_.get('crosshair.enable')) {
            _.pushIf('crosshair.hcross', s);
            _.pushIf('crosshair.invokeOffset', function (e) {
                /**
                 * TODO how fire muti line?now fire by first line
                 */
                var r = _.lines[0].isEventValid(e);
                return r.valid ? r : k;
            });
        }

        if (!_.Combination) {
            _.push('coordinate.crosshair', _.get('crosshair'));

            _.pushIf('coordinate.scale', [
                iChart.apply(_.get('coordinate.yAxis'), {
                    maxValue: _.get('maxValue'),
                    minValue: _.get('minValue')
                }), iChart.apply(_.get('coordinate.xAxis'), {
                    end_scale: _.get('maxItemSize')
                })]);
        }

        /**
         * use option create a coordinate
         */
        _.coo = iChart.Coordinate.coordinate_.call(_);

        if (_.Combination) {
            _.coo.push('crosshair', _.get('crosshair'));
            _.coo.doCrosshair(_.coo);
        }
        if (_.isE())return;

        var vw = _.coo.valid_width, nw = vw, size = _.get('maxItemSize') - 1, M = size ? vw / size : vw, ps = _.get('point_space');

        if (_.get('proportional_spacing')) {
            if (ps && ps < M) {
                nw = size * ps;
            } else {
                _.push('point_space', M);
            }
        }

        _.push('sub_option.width', nw);
        _.push('sub_option.height', _.coo.valid_height);

        _.push('sub_option.originx', _.coo.get('x_start') + (vw - nw) / 2);
        _.push('sub_option.originy', _.coo.get('y_end'));

        if (_.get('tip.enable')) {
            if (!_.mocker && iChart.isFunction(_.get('tipMocker'))) {
                _.push('sub_option.tip.enable', false);
                _.push('tip.invokeOffsetDynamic', true);
                var U, x = _.coo.get(_.X), y = _.coo.get(_.Y), H = _.coo.height, f = _.get('tipMockerOffset'), r0, r, r1;
                f = iChart.isNumber(f) ? (f < 0 ? 0 : (f > 1 ? 1 : f)) : null;
                _.push('tip.invokeOffset', function (w, h, m) {
                    if (f != null) {
                        m.top = y + (H - h) * f;
                    } else {
                        m.top = m.maxTop - (m.maxTop - m.minTop) / 3 - h;
                        if (h > H || y > m.top) {
                            m.top = y;
                        }
                    }
                    return {
                        left: (m.left - w - x > 5) ? m.left - w - 5 : m.left + 5,
                        top: m.top
                    }
                });
                /**
                 * proxy the event parseText
                 */
                var p = _.get('tip.listeners.parseText');
                if (p)
                    delete _.get('tip.listeners').parseText;
                _.mocker = new iChart.Custom({
                    eventValid: function (e) {
                        r = _.lines[0].isEventValid(e);
                        r.hit = r0 != r.i;
                        if (r.valid) {
                            r0 = r.i;
                            U = [];
                            iChart.each(_.lines, function (l, i) {
                                r1 = l.isEventValid(e);
                                if (i == 0) {
                                    r.minTop = r.maxTop = r1.top;
                                } else {
                                    r.minTop = Math.min(r.minTop, r1.top);
                                    r.maxTop = Math.max(r.maxTop, r1.top);
                                }
                                U.push(p ? p(l, r1.name, r1.value, r1.text, r1.i) : (r1.name + ' ' + r1.value));
                            });
                            r.text = _.get('tipMocker').call(_, U, r.i);
                        }
                        return r.valid ? r : false;
                    }
                });
                new iChart.Tip(_.get('tip'), _.mocker);
                _.register(_.mocker);
            }
        }
        _.pushIf('sub_option.area_opacity', _.get('area_opacity'));
    }

});
/**
 * @end
 */


text:
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using HtmlAgilityPack;
using Newtonsoft.Json;
using SteamKit2;

namespace ArchiSteamFarm.JSON {
	internal static class Steam {
		[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
		[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
		internal sealed class ConfirmationDetails {
#pragma warning disable 649
			[JsonProperty(PropertyName = "success", Required = Required.Always)]
			internal readonly bool Success;
#pragma warning restore 649

			internal ulong OtherSteamID64 {
				get {
					if (_OtherSteamID64 != 0) {
						return _OtherSteamID64;
					}

					if ((Type != EType.Trade) || (OtherSteamID3 == 0)) {
						return 0;
					}

					_OtherSteamID64 = new SteamID(OtherSteamID3, EUniverse.Public, EAccountType.Individual);
					return _OtherSteamID64;
				}
			}

			internal ulong TradeOfferID {
				get {
					if (_TradeOfferID != 0) {
						return _TradeOfferID;
					}

					if ((Type != EType.Trade) || (HtmlDocument == null)) {
						return 0;
					}

					HtmlNode htmlNode = HtmlDocument.DocumentNode.SelectSingleNode("//div[@class='tradeoffer']");
					if (htmlNode == null) {
						ASF.ArchiLogger.LogNullError(nameof(htmlNode));
						return 0;
					}

					string id = htmlNode.GetAttributeValue("id", null);
					if (string.IsNullOrEmpty(id)) {
						ASF.ArchiLogger.LogNullError(nameof(id));
						return 0;
					}

					int index = id.IndexOf('_');
					if (index < 0) {
						ASF.ArchiLogger.LogNullError(nameof(index));
						return 0;
					}

					index++;
					if (id.Length <= index) {
						ASF.ArchiLogger.LogNullError(nameof(id.Length));
						return 0;
					}

					id = id.Substring(index);
					if (ulong.TryParse(id, out _TradeOfferID) && (_TradeOfferID != 0)) {
						return _TradeOfferID;
					}

					ASF.ArchiLogger.LogNullError(nameof(_TradeOfferID));
					return 0;
				}
			}

#pragma warning disable 649
			[JsonProperty(PropertyName = "html", Required = Required.DisallowNull)]
			private readonly string HTML;
#pragma warning restore 649

			private HtmlDocument HtmlDocument {
				get {
					if (_HtmlDocument != null) {
						return _HtmlDocument;
					}

					if (string.IsNullOrEmpty(HTML)) {
						return null;
					}

					_HtmlDocument = WebBrowser.StringToHtmlDocument(HTML);
					return _HtmlDocument;
				}
			}

			private uint OtherSteamID3 {
				get {
					if (_OtherSteamID3 != 0) {
						return _OtherSteamID3;
					}

					if ((Type != EType.Trade) || (HtmlDocument == null)) {
						return 0;
					}

					HtmlNode htmlNode = HtmlDocument.DocumentNode.SelectSingleNode("//a/@data-miniprofile");
					if (htmlNode == null) {
						ASF.ArchiLogger.LogNullError(nameof(htmlNode));
						return 0;
					}

					string miniProfile = htmlNode.GetAttributeValue("data-miniprofile", null);
					if (string.IsNullOrEmpty(miniProfile)) {
						ASF.ArchiLogger.LogNullError(nameof(miniProfile));
						return 0;
					}

					if (uint.TryParse(miniProfile, out _OtherSteamID3) && (_OtherSteamID3 != 0)) {
						return _OtherSteamID3;
					}

					ASF.ArchiLogger.LogNullError(nameof(_OtherSteamID3));
					return 0;
				}
			}

			private EType Type {
				get {
					if (_Type != EType.Unknown) {
						return _Type;
					}

					if (HtmlDocument == null) {
						return EType.Unknown;
					}

					HtmlNode testNode = HtmlDocument.DocumentNode.SelectSingleNode("//div[@class='mobileconf_listing_prices']");
					if (testNode != null) {
						_Type = EType.Market;
						return _Type;
					}

					testNode = HtmlDocument.DocumentNode.SelectSingleNode("//div[@class='mobileconf_trade_area']");
					if (testNode != null) {
						_Type = EType.Trade;
						return _Type;
					}

					_Type = EType.Other;
					return _Type;
				}
			}

			internal MobileAuthenticator.Confirmation Confirmation {
				get { return _Confirmation; }

				set {
					if (value == null) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					_Confirmation = value;
				}
			}

			private MobileAuthenticator.Confirmation _Confirmation;
			private HtmlDocument _HtmlDocument;
			private uint _OtherSteamID3;
			private ulong _OtherSteamID64;
			private ulong _TradeOfferID;
			private EType _Type;

			// Deserialized from JSON
			private ConfirmationDetails() { }

			internal enum EType : byte {
				Unknown,
				Trade,
				Market,
				Other
			}
		}

		[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
		[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
		internal sealed class ConfirmationResponse {
#pragma warning disable 649
			[JsonProperty(PropertyName = "success", Required = Required.Always)]
			internal readonly bool Success;
#pragma warning restore 649

			// Deserialized from JSON
			private ConfirmationResponse() { }
		}

		// REF: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#CEcon_Asset
		internal sealed class Item {
			internal const ushort SteamAppID = 753;
			internal const byte SteamCommunityContextID = 6;

			internal uint Amount { get; private set; }
			internal uint AppID { get; set; }
			internal ulong ClassID { get; private set; }
			internal ulong ContextID { get; set; }
			internal uint RealAppID { get; set; }
			internal EType Type { get; set; }

			private ulong AssetID;

			[JsonProperty(PropertyName = "amount", Required = Required.Always)]
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private string AmountString {
				get { return Amount.ToString(); }

				set {
					if (string.IsNullOrEmpty(value)) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					uint amount;
					if (!uint.TryParse(value, out amount) || (amount == 0)) {
						ASF.ArchiLogger.LogNullError(nameof(amount));
						return;
					}

					Amount = amount;
				}
			}

			[JsonProperty(PropertyName = "appid", Required = Required.DisallowNull)]
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private string AppIDString {
				get { return AppID.ToString(); }

				set {
					if (string.IsNullOrEmpty(value)) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					uint appID;
					if (!uint.TryParse(value, out appID) || (appID == 0)) {
						ASF.ArchiLogger.LogNullError(nameof(appID));
						return;
					}

					AppID = appID;
				}
			}

			[JsonProperty(PropertyName = "assetid", Required = Required.DisallowNull)]
			private string AssetIDString {
				get { return AssetID.ToString(); }

				set {
					if (string.IsNullOrEmpty(value)) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					ulong assetID;
					if (!ulong.TryParse(value, out assetID) || (assetID == 0)) {
						ASF.ArchiLogger.LogNullError(nameof(assetID));
						return;
					}

					AssetID = assetID;
				}
			}

			[JsonProperty(PropertyName = "classid", Required = Required.DisallowNull)]
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private string ClassIDString {
				get { return ClassID.ToString(); }

				set {
					if (string.IsNullOrEmpty(value)) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					ulong classID;
					if (!ulong.TryParse(value, out classID) || (classID == 0)) {
						return;
					}

					ClassID = classID;
				}
			}

			[JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull)]
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private string ContextIDString {
				get { return ContextID.ToString(); }

				set {
					if (string.IsNullOrEmpty(value)) {
						ASF.ArchiLogger.LogNullError(nameof(value));
						return;
					}

					ulong contextID;
					if (!ulong.TryParse(value, out contextID) || (contextID == 0)) {
						ASF.ArchiLogger.LogNullError(nameof(contextID));
						return;
					}

					ContextID = contextID;
				}
			}

			[JsonProperty(PropertyName = "id", Required = Required.DisallowNull)]
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private string ID {
				get { return AssetIDString; }
				set { AssetIDString = value; }
			}

			// Constructed from trades being received
			internal Item(uint appID, ulong contextID, ulong classID, uint amount, uint realAppID, EType type = EType.Unknown) {
				if ((appID == 0) || (contextID == 0) || (classID == 0) || (amount == 0) || (realAppID == 0)) {
					throw new ArgumentNullException(nameof(classID) + " || " + nameof(contextID) + " || " + nameof(classID) + " || " + nameof(amount) + " || " + nameof(realAppID));
				}

				AppID = appID;
				ContextID = contextID;
				ClassID = classID;
				Amount = amount;
				RealAppID = realAppID;
				Type = type;
			}

			// Deserialized from JSON
			[SuppressMessage("ReSharper", "UnusedMember.Local")]
			private Item() { }

			internal enum EType : byte {
				Unknown,
				BoosterPack,
				Emoticon,
				FoilTradingCard,
				ProfileBackground,
				TradingCard,
				SteamGems
			}
		}

		/*
		[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
		[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
		internal sealed class NewDiscoveryQueueResponse {
#pragma warning disable 649
			[JsonProperty(PropertyName = "queue", Required = Required.Always)]
			internal readonly HashSet<uint> Queue;
#pragma warning restore 649

			// Deserialized from JSON
			private NewDiscoveryQueueResponse() { }
		}
		*/

		[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
		[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
		internal sealed class RedeemWalletResponse {
#pragma warning disable 649
			[JsonProperty(PropertyName = "detail", Required = Required.Always)]
			internal readonly EPurchaseResultDetail PurchaseResultDetail;
#pragma warning restore 649

			// Deserialized from JSON
			private RedeemWalletResponse() { }
		}

		// REF: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#CEcon_TradeOffer
		internal sealed class TradeOffer {
			internal readonly HashSet<Item> ItemsToGive = new HashSet<Item>();
			internal readonly HashSet<Item> ItemsToReceive = new HashSet<Item>();
			internal readonly ETradeOfferState State;
			internal readonly ulong TradeOfferID;

			internal ulong OtherSteamID64 {
				get {
					if (_OtherSteamID64 != 0) {
						return _OtherSteamID64;
					}

					if (OtherSteamID3 == 0) {
						ASF.ArchiLogger.LogNullError(nameof(OtherSteamID3));
						return 0;
					}

					_OtherSteamID64 = new SteamID(OtherSteamID3, EUniverse.Public, EAccountType.Individual);
					return _OtherSteamID64;
				}
			}

			private readonly uint OtherSteamID3;

			private ulong _OtherSteamID64;

			// Constructed from trades being received
			internal TradeOffer(ulong tradeOfferID, uint otherSteamID3, ETradeOfferState state) {
				if ((tradeOfferID == 0) || (otherSteamID3 == 0) || (state == ETradeOfferState.Unknown)) {
					throw new ArgumentNullException(nameof(tradeOfferID) + " || " + nameof(otherSteamID3) + " || " + nameof(state));
				}

				TradeOfferID = tradeOfferID;
				OtherSteamID3 = otherSteamID3;
				State = state;
			}

			internal bool IsFairTypesExchange() {
				Dictionary<uint, Dictionary<Item.EType, uint>> itemsToGivePerGame = new Dictionary<uint, Dictionary<Item.EType, uint>>();
				foreach (Item item in ItemsToGive) {
					Dictionary<Item.EType, uint> itemsPerType;
					if (!itemsToGivePerGame.TryGetValue(item.RealAppID, out itemsPerType)) {
						itemsPerType = new Dictionary<Item.EType, uint> { [item.Type] = item.Amount };
						itemsToGivePerGame[item.RealAppID] = itemsPerType;
					} else {
						uint amount;
						if (itemsPerType.TryGetValue(item.Type, out amount)) {
							itemsPerType[item.Type] = amount + item.Amount;
						} else {
							itemsPerType[item.Type] = item.Amount;
						}
					}
				}

				Dictionary<uint, Dictionary<Item.EType, uint>> itemsToReceivePerGame = new Dictionary<uint, Dictionary<Item.EType, uint>>();
				foreach (Item item in ItemsToReceive) {
					Dictionary<Item.EType, uint> itemsPerType;
					if (!itemsToReceivePerGame.TryGetValue(item.RealAppID, out itemsPerType)) {
						itemsPerType = new Dictionary<Item.EType, uint> {
							{ item.Type, item.Amount }
						};

						itemsToReceivePerGame[item.RealAppID] = itemsPerType;
					} else {
						uint amount;
						if (itemsPerType.TryGetValue(item.Type, out amount)) {
							itemsPerType[item.Type] = amount + item.Amount;
						} else {
							itemsPerType[item.Type] = item.Amount;
						}
					}
				}

				// Ensure that amount of items to give is at least amount of items to receive (per game and per type)
				foreach (KeyValuePair<uint, Dictionary<Item.EType, uint>> itemsPerGame in itemsToGivePerGame) {
					Dictionary<Item.EType, uint> otherItemsPerType;
					if (!itemsToReceivePerGame.TryGetValue(itemsPerGame.Key, out otherItemsPerType)) {
						return false;
					}

					foreach (KeyValuePair<Item.EType, uint> itemsPerType in itemsPerGame.Value) {
						uint otherAmount;
						if (!otherItemsPerType.TryGetValue(itemsPerType.Key, out otherAmount)) {
							return false;
						}

						if (itemsPerType.Value > otherAmount) {
							return false;
						}
					}
				}

				return true;
			}

			internal bool IsSteamCardsRequest() => ItemsToGive.All(item => (item.AppID == Item.SteamAppID) && (item.ContextID == Item.SteamCommunityContextID) && (item.Type == Item.EType.TradingCard));

			[SuppressMessage("ReSharper", "UnusedMember.Global")]
			internal enum ETradeOfferState : byte {
				Unknown,
				Invalid,
				Active,
				Accepted,
				Countered,
				Expired,
				Canceled,
				Declined,
				InvalidItems,
				EmailPending,
				EmailCanceled,
				OnHold
			}
		}

		[SuppressMessage("ReSharper", "UnusedMember.Global")]
		internal sealed class TradeOfferRequest {
			[JsonProperty(PropertyName = "me", Required = Required.Always)]
			internal readonly ItemList ItemsToGive = new ItemList();

			[JsonProperty(PropertyName = "them", Required = Required.Always)]
			internal readonly ItemList ItemsToReceive = new ItemList();

			internal sealed class ItemList {
				[JsonProperty(PropertyName = "assets", Required = Required.Always)]
				internal readonly HashSet<Item> Assets = new HashSet<Item>();
			}
		}
	}
}


text:
using EspaceClient.FrontOffice.Data.Context;
using EspaceClient.FrontOffice.Domaine;
using EspaceClient.FrontOffice.Business.Depots;
using System.Linq;

namespace EspaceClient.FrontOffice.Data.Depots
{
    public partial class DepotUtilisateur : Depot<Utilisateur>, IDepotUtilisateur
    {
        public Utilisateur GetByTrigramme(string trigramme)
        {
            var query = from u in DbContext.Utilisateurs
                        where u.Trigramme == trigramme
                        select u;

            return query.Single();
        }
    }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>foreach (Zip::ZipFileSystem::ZipFsFile)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />

# File lib/zip/zipfilesystem.rb, line 391
      def foreach(fileName, aSep = $/, &aProc)
        open(fileName) { |is| is.each_line(aSep, &aProc) }
      end


text:
package com.github.neuralnetworks.util;

import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;

import org.slf4j.Logger;

public class LoggingOutputStream extends OutputStream
{

	public static void redirectSysOutAndSysErr(Logger logger)
	{
		System.setOut(new PrintStream(new LoggingOutputStream(logger, LogLevel.INFO)));
		System.setErr(new PrintStream(new LoggingOutputStream(logger, LogLevel.ERROR)));
	}

	private final ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
	private final Logger logger;
	private final LogLevel level;

	public enum LogLevel
	{
		TRACE,
		DEBUG,
		INFO,
		WARN,
		ERROR,
	}

	public LoggingOutputStream(Logger logger, LogLevel level)
	{
		this.logger = logger;
		this.level = level;
	}

	@Override
	public void write(int b)
	{
		if (b == '\n')
		{
			String line = baos.toString();
			baos.reset();

			switch (level) {
			case TRACE:
				logger.trace(line);
				break;
			case DEBUG:
				logger.debug(line);
				break;
			case ERROR:
				logger.error(line);
				break;
			case INFO:
				logger.info(line);
				break;
			case WARN:
				logger.warn(line);
				break;
			}
		} else
		{
			baos.write(b);
		}
	}

}


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
        <title>Schedule Planner</title>

        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
        <link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection" />
        <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection" />
        <link href="extras\noUiSlider\nouislider.css" rel="stylesheet">

                    menu
                    Schedule Planner

dashboard

schedule

                                John Doe
                                jdandturk@gmail.com

homeHome

classPlanner

scheduleSchedule

CUNY Info

exploreRegistrar

infoBrooklyn College

infoQueens College

infoHunter College

infoCity College

Select your school and year

                            <select id="schoolPick" onchange="changeCarousel(); getCourses(this.value); confirmChange();">
                                <option selected disabled>What school are you attending?</option>
                                <option value="brooklyn">Brooklyn College</option>
                                <option value="ccny">City College</option>
                                <option value="hunter">Hunter College</option>
                                <option value="queens">Queens College</option>
                            </select>
                            School

                            <select id="termPick" onchange="changeColorScheme(this.value)">
                                <option disabled selected>Which term are you attending? (optional)</option>
                                <option value="summer">Summer 2017</option>
                                <option value="fall">Fall 2017</option>
                                <option value="spring">Spring 2018</option>
                            </select>
                            Term

                            <select id="courseSelect">
                                <option value="" disabled selected>Select a course</option>
                            </select>
                            Course

                            Submitsend

Days the class will take place on

                                                <input type="checkbox" class="filled-in" id="filled-in-box1" />
                                                Monday

                                                <input type="checkbox" class="filled-in" id="filled-in-box2" />
                                                Tuesday

                                                <input type="checkbox" class="filled-in" id="filled-in-box3" />
                                                Wednesday

                                                <input type="checkbox" class="filled-in" id="filled-in-box4" />
                                                Thursday

                                                <input type="checkbox" class="filled-in" id="filled-in-box5" />
                                                Friday

                                                <input type="checkbox" class="filled-in" id="filled-in-box6" />
                                                Saturday

                                                <input type="checkbox" class="filled-in" id="filled-in-box7" />
                                                Sunday

                                    Confirm

					question_answer

Changing your college deletes your classes

Make sure you don't change your college unless you want to delete your classes!

                    Made by the  SchedulePlanner Team with Materialize


text:
layout: "aws"
page_title: "AWS: aws_iam_account_password_policy"
sidebar_current: "docs-aws-resource-iam-account-password-policy"
description: |-
  Manages Password Policy for the AWS Account.
---

# aws\_iam\_account_password_policy

-> **Note:** There is only a single policy allowed per AWS account. An existing policy will be lost when using this resource as an effect of this limitation.

Manages Password Policy for the AWS Account.
See more about [Account Password Policy](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html)
in the official AWS docs.

## Example Usage

```
resource "aws_iam_account_password_policy" "strict" {
  minimum_password_length        = 8
  require_lowercase_characters   = true
  require_numbers                = true
  require_uppercase_characters   = true
  require_symbols                = true
  allow_users_to_change_password = true
}
```

## Argument Reference

The following arguments are supported:

* `allow_users_to_change_password` - (Optional) Whether to allow users to change their own password
* `hard_expiry` - (Optional) Whether users are prevented from setting a new password after their password has expired
	(i.e. require administrator reset)
* `max_password_age` - (Optional) The number of days that an user password is valid.
* `minimum_password_length` - (Optional) Minimum length to require for user passwords.
* `password_reuse_prevention` - (Optional) The number of previous passwords that users are prevented from reusing.
* `require_lowercase_characters` - (Optional) Whether to require lowercase characters for user passwords.
* `require_numbers` - (Optional) Whether to require numbers for user passwords.
* `require_symbols` - (Optional) Whether to require symbols for user passwords.
* `require_uppercase_characters` - (Optional) Whether to require uppercase characters for user passwords.

## Attributes Reference

The following attributes are exported:

* `expire_passwords` - Indicates whether passwords in the account expire.
	Returns `true` if `max_password_age` contains a value greater than `0`.
	Returns `false` if it is `0` or _not present_.

## Import

IAM Account Password Policy can be imported using the word `iam-account-password-policy`, e.g.

```
$ terraform import aws_iam_account_password_policy.strict iam-account-password-policy
```


text:
chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('app/index.html',
    {width: 800, height: 550});
});


text:
name: Amil Cook
title: Director of Technology Curriculum and Programs
image: /assets/img/team/Amil.jpeg
tag: team
---


text:
using System;

namespace DotVVM.AutoUI.Annotations
{
    /// <summary>
    /// Defines the settings for the ComboBox form editor provider.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class ComboBoxSettingsAttribute : Attribute
    {

        /// <summary>
        /// Gets or sets the name of the property to be displayed.
        /// </summary>
        public string DisplayMember { get; set; }

        /// <summary>
        /// Gets or sets the name of the property to be used as selected value.
        /// </summary>
        public string ValueMember { get; set; }

        /// <summary>
        /// Gets or sets the binding expression for the list of items.
        /// </summary>
        public string DataSourceBinding { get; set; }

        /// <summary>
        /// Gets or sets the text on the empty item. If null or empty, the empty item will not be included.
        /// </summary>
        public string EmptyItemText { get; set; }

    }
}


text:
package org.trustedanalytics.sparktk.graph.internal.ops

import org.trustedanalytics.sparktk.frame.Frame
import org.apache.spark.sql.functions._
import org.graphframes.GraphFrame
import org.graphframes.GraphFrame.ID
import org.apache.spark.sql.DataFrame
import org.graphframes.lib.AggregateMessages

import org.apache.spark.sql.Column
import org.apache.spark.sql.functions.lit

import org.trustedanalytics.sparktk.graph.internal.{ GraphState, GraphSummarization, BaseGraph }

trait ClusteringCoefficientSummarization extends BaseGraph {
  /**
   * The clustering coefficient of a vertex provides a measure of how
   * tightly clustered that vertex's neighborhood is.
   *
   * Formally:
   *
   * .. math::
   *
   *    cc(v)  = \frac{ \| \{ (u,v,w) \in V^3: \ \{u,v\}, \{u, w\}, \{v,w \} \in \
   *        E \} \| }{\| \{ (u,v,w) \in V^3: \ \{v, u \}, \{v, w\} \in E \} \|}
   *
   * For further reading on clustering
   * coefficients, see http://en.wikipedia.org/wiki/Clustering_coefficient.
   *
   * This method returns a frame with the vertex id associated with it's local
   * clustering coefficient
   *
   * @return The DataFrame associating each vertex id with it's local clustering coefficient
   *
   */
  def clusteringCoefficient(): Frame = {
    execute[Frame](ClusteringCoefficient())
  }
}

case class ClusteringCoefficient() extends GraphSummarization[Frame] {

  val triangles = "count"
  val degree = "degree"
  val outputName = "clustering_coefficient"

  override def work(state: GraphState): Frame = {
    val triangleCount = state.graphFrame.triangleCount.run()

    val weightedDegrees = state
      .graphFrame
      .aggregateMessages
      .sendToDst(lit(1))
      .sendToSrc(lit(1))
      .agg(sum(AggregateMessages.msg).as(degree))

    val joinedFrame = weightedDegrees
      .join(triangleCount, weightedDegrees(ID) === triangleCount(ID))
      .drop(weightedDegrees(ID))

    val msg = udf { (triangles: Int, degree: Int) => if (degree <= 1) 0.0d else (triangles * 2).toDouble / (degree * (degree - 1)).toDouble }

    val clusteringVertices = joinedFrame
      .withColumn(outputName, msg(col(triangles), col(degree)))
      .drop(col(triangles))
      .drop(col(degree))

    new Frame(clusteringVertices)

  }

}


text:
package io.lumify.web.clientapi;

import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataBodyPart;
import com.sun.jersey.multipart.FormDataMultiPart;
import io.lumify.web.clientapi.codegen.ApiException;
import io.lumify.web.clientapi.model.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;

import javax.ws.rs.core.MediaType;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class VertexApiExt extends io.lumify.web.clientapi.codegen.VertexApi {
    public static final int VIDEO_TRANSCRIPT_INDEX_BITS = 12; // duplicated in io.lumify.core.model.textHighlighting.OffsetItem
    public static final int VIDEO_TRANSCRIPT_OFFSET_BITS = 20; // duplicated in io.lumify.core.model.textHighlighting.OffsetItem
    public static final String VERTEX_BASE_URL = "/vertex/";

    public void resolveTerm(String artifactId, String propertyKey, int mentionStart, int mentionEnd, String sign, String conceptId, String visibilitySource) throws ApiException {
        resolveTerm(artifactId, propertyKey, mentionStart, mentionEnd, sign, conceptId, visibilitySource, null, null, null);
    }

    public void resolveVideoTranscriptTerm(String artifactId, String propertyKey, int videoFrameIndex, int mentionStart, int mentionEnd, String sign, String conceptId, String visibilitySource) throws ApiException {
        int mentionStartWithVideoFrame = (videoFrameIndex << VIDEO_TRANSCRIPT_OFFSET_BITS) | mentionStart;
        int mentionEndWithVideoFrame = (videoFrameIndex << VIDEO_TRANSCRIPT_OFFSET_BITS) | mentionEnd;
        resolveTerm(artifactId, propertyKey, mentionStartWithVideoFrame, mentionEndWithVideoFrame, sign, conceptId, visibilitySource, null, null, null);
    }

    public ClientApiArtifactImportResponse importFile(String visibilitySource, String fileName, InputStream data) throws ApiException, IOException {
        File tempDir = FileUtils.getTempDirectory();
        File file = new File(tempDir, fileName);
        try {
            FileOutputStream out = new FileOutputStream(file);
            try {
                IOUtils.copy(data, out);
            } finally {
                out.close();
            }
            return importFile(visibilitySource, file);
        } finally {
            safeDelete(file);
        }
    }

    private static void safeDelete(File file) {
        if (!file.delete()) {
            throw new RuntimeException("Could not delete file: " + file.getAbsolutePath());
        }
    }

    public ClientApiArtifactImportResponse importFiles(FileForImport... files) throws ApiException, IOException {
        Object postBody;
        // verify required params are set
        if (files == null || files.length == 0) {
            throw new ApiException(400, "missing required params");
        }
        try {
            // create path and map variables
            String path = (VERTEX_BASE_URL + "import").replaceAll("\\{format\\}", "json");

            // query params
            Map<String, String> queryParams = new HashMap<String, String>();
            Map<String, String> headerParams = new HashMap<String, String>();
            Map<String, String> formParams = new HashMap<String, String>();

            String[] contentTypes = {
                    "multipart/form-data"};

            String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

            FormDataMultiPart mp = new FormDataMultiPart();
            for (FileForImport fileForImport : files) {
                mp.field("visibilitySource", fileForImport.getVisibilitySource(), MediaType.MULTIPART_FORM_DATA_TYPE);
                FormDataContentDisposition dispo = FormDataContentDisposition
                        .name("file")
                        .fileName(fileForImport.getFileName())
                        .size(fileForImport.getFile().length())
                        .build();
                FormDataBodyPart bodyPart = new FormDataBodyPart(dispo, fileForImport.getFile(), MediaType.MULTIPART_FORM_DATA_TYPE);
                mp.bodyPart(bodyPart);
            }
            postBody = mp;

            try {
                String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
                if (response != null) {
                    return (ClientApiArtifactImportResponse) ApiInvoker.deserialize(response, "", ClientApiArtifactImportResponse.class);
                } else {
                    return null;
                }
            } catch (ApiException ex) {
                if (ex.getCode() == 404) {
                    return null;
                } else {
                    throw ex;
                }
            }
        } finally {
            for (FileForImport fileForImport : files) {
                fileForImport.deleteTempFiles();
            }
        }
    }

    public InputStream getRaw(String graphVertexId) throws IOException, ApiException {
        return getRaw(graphVertexId, true, false, null);
    }

    public InputStream getRawForPlayback(String graphVertexId, String type) throws IOException, ApiException {
        return getRaw(graphVertexId, false, true, type);
    }

    private InputStream getRaw(String graphVertexId, boolean download, boolean playback, String type) throws ApiException, IOException {
        Map<String, String> queryParams = new HashMap<String, String>();
        Map<String, String> headerParams = new HashMap<String, String>();
        queryParams.put("graphVertexId", graphVertexId);
        if (download) {
            queryParams.put("download", "true");
        }
        if (playback) {
            queryParams.put("playback", "true");
        }
        if (type != null) {
            queryParams.put("type", type);
        }
        return apiInvoker.getBinary(basePath, VERTEX_BASE_URL + "raw", queryParams, headerParams);
    }

    public InputStream getThumbnail(String graphVertexId, Integer width) throws ApiException, IOException {
        Map<String, String> queryParams = new HashMap<String, String>();
        Map<String, String> headerParams = new HashMap<String, String>();
        queryParams.put("graphVertexId", graphVertexId);
        if (width != null) {
            queryParams.put("width", width.toString());
        }
        return apiInvoker.getBinary(basePath, VERTEX_BASE_URL + "thumbnail", queryParams, headerParams);
    }

    public InputStream getPosterFrame(String graphVertexId, Integer width) throws ApiException, IOException {
        Map<String, String> queryParams = new HashMap<String, String>();
        Map<String, String> headerParams = new HashMap<String, String>();
        queryParams.put("graphVertexId", graphVertexId);
        if (width != null) {
            queryParams.put("width", width.toString());
        }
        return apiInvoker.getBinary(basePath, VERTEX_BASE_URL + "poster-frame", queryParams, headerParams);
    }

    public InputStream getVideoPreview(String graphVertexId, Integer width) throws ApiException, IOException {
        Map<String, String> queryParams = new HashMap<String, String>();
        Map<String, String> headerParams = new HashMap<String, String>();
        queryParams.put("graphVertexId", graphVertexId);
        if (width != null) {
            queryParams.put("width", width.toString());
        }
        return apiInvoker.getBinary(basePath, VERTEX_BASE_URL + "video-preview", queryParams, headerParams);
    }

    public ClientApiVertexFindRelatedResponse findRelated(List<String> vertexIds) throws ApiException {
        return findRelated(vertexIds, null, null, null);
    }

    public static class FileForImport {
        private final String visibilitySource;
        private final String fileName;
        private final InputStream data;
        private File file;

        public FileForImport(String visibilitySource, String fileName, InputStream data) {
            this.visibilitySource = visibilitySource;
            this.fileName = fileName;
            this.data = data;
        }

        public String getVisibilitySource() {
            return visibilitySource;
        }

        public String getFileName() {
            return fileName;
        }

        public File getFile() throws IOException {
            if (file == null) {
                File tempDir = FileUtils.getTempDirectory();
                file = new File(tempDir, getFileName());
                FileOutputStream out = new FileOutputStream(file);
                try {
                    IOUtils.copy(data, out);
                } finally {
                    out.close();
                }
            }
            return file;
        }

        public void deleteTempFiles() {
            if (file != null) {
                safeDelete(file);
            }
        }
    }

    public ClientApiVertexSearchResponse vertexSearch(String query) throws ApiException {
        JSONArray filters = new JSONArray();
        return vertexSearch(query, filters, null, null, null, null, null);
    }

    public ClientApiVertexSearchResponse vertexSearch(String query, JSONArray filters, Integer offset, Integer size, String conceptType, Boolean leafNodes, List<String> relatedToVertexIds) throws ApiException {
        return vertexSearch(query, filters.toString(), offset, size, conceptType, leafNodes, relatedToVertexIds);
    }

    public ClientApiElement setProperty(String graphVertexId, String propertyKey, String propertyName, String value, String visibilitySource, String justificationText) throws ApiException {
        return setProperty(graphVertexId, propertyKey, propertyName, value, visibilitySource, justificationText, null, null);
    }

    public ClientApiVertexEdges getEdges(String graphVertexId) throws ApiException {
        return getEdges(graphVertexId, null, null, null);
    }
}


text:
package org.wildfly.swarm.internal;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * The {@code GradleFileSystemLayout} provides an abstraction over the file system layout for Gradle based projects. This class
 * is primarily used when executing tests, etc, from within the IDE / Gradle tasks.
 *
 * @author Heiko Braun
 * @since 02/08/16
 */
public class GradleFileSystemLayout extends FileSystemLayout {

    /**
     * Constant for specifying the Gradle project's build directory via the System properties.
     */
    public static final String SYSTEM_PROPERTY_BUILD_DIR = "build.dir";

    /**
     * Constant for specifying the Gradle project's sources root directory (under which the tooling can find find 'main'
     * source set).
     */
    public static final String SYSTEM_PROPERTY_SRC_DIR = "src.dir";

    /**
     * The name of the sources root directory.
     */
    public static final String SRC_DIR_NAME = "src";

    /**
     * The name of the build root directory.
     */
    public static final String BUILD_DIR_NAME = "build";

    private final Path sourceRoot;

    private final Path buildRoot;

    private final Path classesDir;

    GradleFileSystemLayout(String root) {
        super(root);

        // 1. Determine the sources root.
        //      - See if the developer has overridden the path.
        String value = System.getProperty(SYSTEM_PROPERTY_SRC_DIR, SRC_DIR_NAME);
        sourceRoot = rootPath.resolve(Paths.get(value));

        // 2. Determine the build root.
        //      - See if the developer has overridden the path.
        value = System.getProperty(SYSTEM_PROPERTY_BUILD_DIR, BUILD_DIR_NAME);
        buildRoot = rootPath.resolve(Paths.get(value));

        // Gradle 4 and above changed the build layout model. It now uses separate output directories for each jvm language.
        // First check if the layout corresponds to Gradle 4+ or not.
        Path path = buildRoot.resolve(CLASSES).resolve(JAVA).resolve(SOURCE_SET_MAIN);
        if (Files.exists(path)) {
            classesDir = path;
        } else {
            classesDir = buildRoot.resolve(CLASSES).resolve(SOURCE_SET_MAIN);
        }
    }

    @Override
    public String determinePackagingType() {
        if (resolveSrcWebAppDir().toFile().exists()) {
            return TYPE_WAR;
        } else {
            return TYPE_JAR;
        }
    }

    @Override
    public Path resolveBuildClassesDir() {
        return classesDir;
    }

    @Override
    public Path resolveBuildResourcesDir() {
        return buildRoot.resolve(RESOURCES).resolve(SOURCE_SET_MAIN);
    }

    @Override
    public Path resolveSrcWebAppDir() {
        return sourceRoot.resolve(SOURCE_SET_MAIN).resolve(WEBAPP);
    }

    @Override
    public Path getRootPath() {
        return rootPath;
    }

    /**
     * Get the directory under which all built artifacts can be found.
     *
     * @return the directory under which all built artifacts can be found.
     */
    protected Path getBuildRoot() {
        return buildRoot;
    }

    protected static final String CLASSES = "classes";

    protected static final String SOURCE_SET_MAIN = "main";

    protected static final String RESOURCES = "resources";

    protected static final String WEBAPP = "webapp";

    private static final String JAVA = "java";

}


text:
package org.path.episample.android.activities;

import java.io.File;

import org.path.common.android.utilities.MediaUtils;
import org.path.common.android.utilities.ODKFileUtils;
import org.path.common.android.utilities.WebLogger;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

/**
 * Simple shim for media interactions.
 *
 * Called from javascript with: shim.doAction(promptPath, internalPromptContext,
 * "org.path.episample.android.activities.MediaDeleteImageActivity",
 * JSON.stringify({ appName: 'myApp', uriFragment: uriFromDatabase }));
 *
 * @author mitchellsundt@gmail.com
 *
 */
public class MediaDeleteImageActivity extends Activity {
  private static final String t = "MediaDeleteImageActivity";
  private static final String APP_NAME = "appName";
  private static final String URI_FRAGMENT = "uriFragment";

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String appName = null;
    String uriFragmentToMedia = null;
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      appName = extras.getString(APP_NAME);
      uriFragmentToMedia = extras.getString(URI_FRAGMENT);
    }

    if (savedInstanceState != null) {
      appName = savedInstanceState.getString(APP_NAME);
      uriFragmentToMedia = savedInstanceState.getString(URI_FRAGMENT);
    }

    if (appName == null) {
      throw new IllegalArgumentException("Expected " + APP_NAME
            + " key in intent bundle. Not found.");
    }

    if (uriFragmentToMedia == null) {
        throw new IllegalArgumentException("Expected " + URI_FRAGMENT
            + " key in intent bundle. Not found.");
    }

    File f = ODKFileUtils.getAsFile(appName, uriFragmentToMedia);

    int del = MediaUtils.deleteImageFileFromMediaProvider(this, appName, f.getAbsolutePath());
    WebLogger.getLogger(appName).i(t, "Deleted " + del + " matching entries for " + URI_FRAGMENT + ": " + uriFragmentToMedia);

    Intent i = new Intent();

    i.putExtra(URI_FRAGMENT, uriFragmentToMedia);
    i.putExtra("deleteCount", del);
    setResult(Activity.RESULT_OK, i);
    finish();
  }
}


text:
//----------------------------------------------------------------------------//
//|
//|             MachOKit - A Lightweight Mach-O Parsing Library
//! @file       load_command_linker_option.h
//!
//! @author     Milen Dzhumerov
//! @copyright  Copyright (c) 2020-2020 Milen Dzhumerov. All rights reserved.
//|
//| Permission is hereby granted, free of charge, to any person obtaining a
//| copy of this software and associated documentation files (the "Software"),
//| to deal in the Software without restriction, including without limitation
//| the rights to use, copy, modify, merge, publish, distribute, sublicense,
//| and/or sell copies of the Software, and to permit persons to whom the
//| Software is furnished to do so, subject to the following conditions:
//|
//| The above copyright notice and this permission notice shall be included
//| in all copies or substantial portions of the Software.
//|
//| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
//| OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
//| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
//| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
//| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
//| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//----------------------------------------------------------------------------//

#ifndef _load_command_linker_option_h
#define _load_command_linker_option_h

//! @addtogroup LOAD_COMMANDS
//! @{
//!

//----------------------------------------------------------------------------//
#pragma mark -  Linker Option
//! @name       Linker Option
//----------------------------------------------------------------------------//

_mk_export uint32_t
mk_load_command_linker_option_id(void);

_mk_export uint32_t
mk_load_command_linker_option_get_nstrings(mk_load_command_ref load_command);

_mk_export size_t
mk_load_command_linker_option_copy_string(mk_load_command_ref load_command, uint32_t index, char *output, size_t output_len);

#if __BLOCKS__
//! Iterate over the strings using a block.
_mk_export void
mk_load_command_linker_option_enumerate_strings(mk_load_command_ref load_command,
                                                void (^enumerator)(const char *string, uint32_t index, bool *stop));
#endif

//! @} LOAD_COMMANDS !//

#endif /* _load_command_linker_option_h */


text:
    <angular-html-bind-wrapper class="oppia-learner-hint-and-solution-modal-body"
                               [htmlData]="hint.html">
    </angular-html-bind-wrapper>

<button class="oppia-learner-got-it-button protractor-test-learner-got-it-button md-button md-default-theme ml-auto"
        (click)="closeModal()">

</button>


text:
/*
	Module dependencies
*/
var fs = require("fs"),
	path = require("path"),
	join = path.join;

/*
	"require" all js file under a directory synchronously,
	return an array contain all the modules.

	@param {String} directory
	@param {Object} options
	@api public
*/

module.exports = function (dir, options) {
	var ret = [],
		pre_filter = function () { return true; },
		post_filter = function () { return true; };

	if (options) {
		pre_filter = options.pre_filter || pre_filter;
		post_filter = options.post_filter || post_filter;
	}

	// read directory synchronously
	fs.readdirSync(dir).forEach(function (fn) {

		// is it a js file ? does it satisfy pre_filter function ?
		if (
			(/\.js$/i.test(fn)||(fs.statSync(join(dir,fn)).isDirectory())) &&
			pre_filter(fn)) {
			// require the module
			try{
				var mod = require(join(dir, fn));
			}catch(e){

			}
			// do a post filter before add to the array
			if (post_filter(mod)) {
				// module can be accessed in 2 ways:
				//
				//     ret["module name without '.js'"]
				//     ret[2]
				//
				// number of modules: ret.length
				ret.push(mod);
				ret[fn.replace(/\.js$/i, "")] = mod;
			}
		}

	});

	return ret;
};

/*
	"require" all js file under a directory asynchronously,
	pass modules array to callback.

	@param {String} directory
	@param {Object|Function} options or callback
	@param {Function} callback
	@api public
*/
module.exports.async = function (directory, options, callback) {
	// support callback function as the second argument
	if ("function" == typeof options) {
		callback = options;
		options = null;
	}

	var ret = [],
		pre_filter = function () { return true; },
		post_filter = function () { return true; };

	if (options) {
		pre_filter = options.pre_filter || pre_filter;
		post_filter = options.post_filter || post_filter;
	}

	// read directory asynchronously
	fs.readdir(directory, function (err, files) {
		if (!err) {
			files.forEach(function (fn) {
				// is it a js file ? does it satisfy pre_filter function ?
				if (/\.js$/i.test(fn) && pre_filter(fn)) {
					// require the module
					var mod = require(join(dir, fn));
					// do a post filter before add to the array
					if (post_filter(mod)) {
						// module can be accessed in 2 ways:
						//
						//     ret["module name without '.js'"]
						//     ret[2]
						//
						// number of modules: ret.length
						ret[fn.replace(/\.js$/i, "")] = mod;
						ret.push(mod);
					}
				}
			});
		}
		callback(err, ret);
	});
};


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace MiningCore.Extensions
{
    public static class ArrayExtensions
    {
        public static string ToHexString(this IEnumerable<byte> byteArray)
        {
            return ToHexString(byteArray.ToArray());
        }

        public static string ToHexString(this byte[] byteArray)
        {
            return byteArray.Aggregate("", (current, b) => current + b.ToString("x2"));
        }

        public static string ToFormatedHexString(this byte[] byteArray)
        {
            return byteArray.Aggregate("", (current, b) => current + " 0x" + b.ToString("x2"));
        }

        /// <summary>
        /// Apparently mixing big-ending and little-endian isn't confusing enough so sometimes every
        /// block of 4 bytes must be reversed before reversing the entire buffer
        /// </summary>
        public static byte[] ReverseByteOrder(this byte[] bytes)
        {
            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream))
                {
                    for (var i = 0; i < 8; i++)
                    {
                        var value = BitConverter.ToUInt32(bytes, i * 4).ToBigEndian();
                        writer.Write(value);
                    }

                    writer.Flush();
                    return stream.ToArray().Reverse().ToArray();
                }
            }
        }

        public static T[] ToReverseArray<T>(this IEnumerable<T> bytes)
        {
            var arr = bytes.ToArray();
            Array.Reverse(arr);
            return arr;
        }

        public static T[] ToReverseArray<T>(this T[] arr)
        {
            Array.Reverse(arr);
            return arr;
        }
    }
}


text:
using namespace MIPS;

TEST(AndInstruction, differentNumbers) {
	Register rs("s1");
	Register rt("s2");
	AndInstruction And(0, &rs, &rt, 0, 0);
	struct ALUFlags flags;
	And.setALUFlags(flags);
	rs.put(12);
	rt.put(15);
	bit16_t result = And.execute();
	ASSERT_EQ(result, 12);
}

TEST(AndInstruction, equalNumbers) {
	Register rs("s1");
	Register rt("s2");
	Register rd("s0");
	AndInstruction And(0, &rs, &rt, 0, 0);
	struct ALUFlags flags;
	And.setALUFlags(flags);
	rs.put(12);
	rt.put(12);
	bit16_t result = And.execute();
	ASSERT_EQ(result, 12);
}


text:
<resources>
  <string name="app_name">Material Searchview Sample</string>
  <string name="search">Search</string>
</resources>


text:
set -e

if [ $# -ne 2 ]; then
	echo "Usage: $0 [email] [domain]"
	exit 1
fi

mkdir -p /etc/letsencrypt
echo "non-interactive = True" > /etc/letsencrypt/cli.ini
echo "email = $1" >> /etc/letsencrypt/cli.ini

docker build . -t certbot
docker run -p80:80 -p443:443 -it --rm \
	-v "/etc/letsencrypt:/etc/letsencrypt" \
	-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
	--name certbot certbot certbot certonly --standalone --agree-tos -d $2


text:
require 'spec_helper'

describe 'cloud::image::registry' do

  let :params do
    { :glance_db_host                   => '10.0.0.1',
      :glance_db_user                   => 'glance',
      :glance_db_password               => 'secrete',
      :ks_keystone_internal_host        => '10.0.0.1',
      :ks_keystone_internal_proto       => 'https',
      :ks_glance_internal_host          => '10.0.0.1',
      :ks_glance_registry_internal_port => '9191',
      :ks_glance_password               => 'secrete',
      :debug                            => true,
      :verbose                          => true,
      :use_syslog                       => true,
      :log_facility                     => 'LOG_LOCAL0',
      :api_eth                          => '10.0.0.1'
    }
  end

  shared_examples_for 'openstack image registry' do

    it 'configure glance-registry' do
      is_expected.to contain_class('glance::registry').with(
        :database_connection   => 'mysql://glance:secrete@10.0.0.1/glance?charset=utf8',
        :database_idle_timeout => '5000',
        :keystone_password     => 'secrete',
        :keystone_tenant       => 'services',
        :keystone_user         => 'glance',
        :verbose               => true,
        :debug                 => true,
        :auth_host             => '10.0.0.1',
        :auth_protocol         => 'https',
        :log_facility          => 'LOG_LOCAL0',
        :bind_host             => '10.0.0.1',
        :bind_port             => '9191',
        :use_syslog            => true,
        :log_dir               => false,
        :log_file              => false
      )
    end

    it { is_expected.to contain_glance_registry_config('keystone_authtoken/identity_uri').with_value('https://10.0.0.1:35357') }

    it 'checks if Glance DB is populated' do
      is_expected.to contain_exec('glance_db_sync').with(
        :command => 'glance-manage db_sync',
        :user    => 'glance',
        :path    => '/usr/bin',
        :unless  => '/usr/bin/mysql glance -h 10.0.0.1 -u glance -psecrete -e "show tables" | /bin/grep Tables'
      )
    end

    context 'with default firewall enabled' do
      let :pre_condition do
        "class { 'cloud': manage_firewall => true }"
      end
      it 'configure Glance Registry firewall rules' do
        is_expected.to contain_firewall('100 allow glance-registry access').with(
          :port   => '9191',
          :proto  => 'tcp',
          :action => 'accept',
        )
      end
    end

    context 'with custom firewall enabled' do
      let :pre_condition do
        "class { 'cloud': manage_firewall => true }"
      end
      before :each do
        params.merge!(:firewall_settings => { 'limit' => '50/sec' } )
      end
      it 'configure Glance API firewall rules with custom parameter' do
        is_expected.to contain_firewall('100 allow glance-registry access').with(
          :port   => '9191',
          :proto  => 'tcp',
          :action => 'accept',
          :limit  => '50/sec',
        )
      end
    end

  end

  context 'on Debian platforms' do
    let :facts do
      { :osfamily => 'Debian' }
    end

    it_configures 'openstack image registry'
  end

  context 'on RedHat platforms' do
    let :facts do
      { :osfamily => 'RedHat' }
    end

    it_configures 'openstack image registry'
  end

end


text:
INCSDIR= /usr/include/miscfs/procfs

INCS=	procfs.h

.include <bsd.kinc.mk>


text:
echo Executando ...
java -cp bin:../modelo/dist/modelo.jar apresenta.Main


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="concept" name="DC.Type" />
<meta name="DC.Title" content="Autogenerated keys" />
<meta content="autogenerated keys" name="DC.subject" />
<meta content="autogenerated keys" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="rrefjdbcjavasqlstatement30.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="crefjavstateautogen" name="DC.Identifier" />
<meta content="ja" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>Autogenerated keys</title>

Autogenerated keys

JDBC 3.0のキー自動生成に関する機能により、索引の一部あるいは既定値の割り当てられた列から値を取得する方法があります。
Derbyには自動増分の機能があって、この機能により、データベースにより自動的に増分された値をとる列を、ユーザは表に定義することができます。
JDBC 3.0ではStatement.getGeneratedKeysメソッドを呼んでこの種類の列の値を取得することができます。このメソッドは値に自動生成キーをとる列を持つResultSetを返します。
またgetGeneratedKeysから返されたResultSetオブジェクトにてResultSet.getMetaDataメソッドを呼んで、IDENTITY_VAL_LOCALから返るのと同様なResultSetMetaDataオブジェクトを得ることもできます。

 ユーザはConnection.prepareStatementメソッドや、Statement.executeメソッド、Statement.executeUpdateメソッドの二つ目の引数に、以下に示すいずれかの値を渡すことで、自動生成された列を取得できます。

自動生成されたキーを取得できるようにする定数。具体的には<samp class="codeph">Statement.RETURN_GENERATED_KEYS</samp>です。

挿入する行の列の内、取得できるようにする列名の配列。配列にある列名のいずれも自動生成される列で無ければ、Derby は例外を挙げます。(なおこの引数は、Derbyでは組み込みドライバでのみ利用可能です。)

挿入する行の列の内、取得できるようにする列位置の配列。配列のいずれも自動生成される列でなければ、Derbyは例外を挙げます。(この引数はDerbyでは組み込みドライバでのみ利用可能です。)

例

以下のように定義されたTABLE1という表があるとします。

CREATE TABLE TABLE1 (C11 int, C12 int GENERATED ALWAYS AS IDENTITY)

以下の三つのコードは同じことを行います。すなわち、TABLE1に挿入された<samp class="codeph">C12</samp> の値を持つ、ResultSetを生成します。

コード 1:

Statement stmt = conn.createStatement();
stmt.execute(
    "INSERT INTO TABLE1 (C11) VALUES (1)",
    Statement.RETURN_GENERATED_KEYS);
ResultSet rs = stmt.getGeneratedKeys();

コード 2:

Statement stmt = conn.createStatement();
String [] colNames = new String [] { "C12" };
stmt.execute(
    "INSERT INTO TABLE1 (C11) VALUES (1)",
    colNames);
ResultSet rs = stmt.getGeneratedKeys();

コード 3:

Statement stmt = conn.createStatement();
int [] colIndexes = new int [] { 2 };
stmt.execute(
    "INSERT INTO TABLE1 (C11) VALUES (1)",
    colIndexes);
ResultSet rs = stmt.getGeneratedKeys();

もし自動生成された列を取得できるようにする指定がなければ、
Statement.getGeneratedKeysへの呼び出しはnullのResultSetを返します。

親トピック: java.sql.Statementインターフェイス: JDBC 3.0で利用可能なメソッド


text:
package org.commcare.activities;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import org.commcare.CommCareApplication;
import org.commcare.dalvik.R;
import org.commcare.tasks.ConnectionDiagnosticTask;
import org.commcare.tasks.DataSubmissionListener;
import org.commcare.tasks.LogSubmissionTask;
import org.commcare.utils.CommCareUtil;
import org.commcare.utils.MarkupUtil;
import org.commcare.views.ManagedUi;
import org.commcare.views.UiElement;
import org.commcare.views.dialogs.CustomProgressDialog;
import org.javarosa.core.services.Logger;
import org.javarosa.core.services.locale.Localization;

/**
 * Activity that will diagnose various connection problems that a user may be facing.
 *
 * @author srengesh
 */
@ManagedUi(R.layout.connection_diagnostic)
public class ConnectionDiagnosticActivity extends CommCareActivity<ConnectionDiagnosticActivity> {
    private static final String TAG = ConnectionDiagnosticActivity.class.getSimpleName();

    public static final String logUnsetPostURLMessage = "CCHQ ping test: post URL not set.";

    @UiElement(value = R.id.run_connection_test, locale = "connection.test.run")
    Button btnRunTest;

    @UiElement(value = R.id.output_message, locale = "connection.test.messages")
    TextView txtInteractiveMessages;

    @UiElement(value = R.id.settings_button, locale = "connection.test.access.settings")
    Button settingsButton;

    @UiElement(value = R.id.report_button, locale = "connection.test.report.button.message")
    Button reportButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        btnRunTest.setOnClickListener(v -> {
            ConnectionDiagnosticTask<ConnectionDiagnosticActivity> mConnectionDiagnosticTask =
                    new ConnectionDiagnosticTask<ConnectionDiagnosticActivity>(getApplicationContext()) {
                        @Override
                        //<R> receiver, <C> result.
                        //<C> is the return from DoTaskBackground, of type ArrayList<Boolean>
                        protected void deliverResult(ConnectionDiagnosticActivity receiver, Test failedTest) {
                            //user-caused connection issues
                            if (failedTest == Test.isOnline ||
                                    failedTest == Test.googlePing) {
                                //get the appropriate display message based on what the problem is
                                String displayMessage = failedTest == Test.isOnline ?
                                        Localization.get("connection.task.internet.fail")
                                        : Localization.get("connection.task.remote.ping.fail");

                                receiver.txtInteractiveMessages.setText(displayMessage);
                                receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);

                                receiver.settingsButton.setVisibility(View.VISIBLE);
                            } else if (failedTest == Test.commCarePing) {
                                //unable to ping commcare -- report this to cchq
                                receiver.txtInteractiveMessages.setText(
                                        Localization.get("connection.task.commcare.html.fail"));
                                receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);

                                receiver.reportButton.setVisibility(View.VISIBLE);
                            } else if (failedTest == null) {
                                receiver.txtInteractiveMessages.setText(Localization.get("connection.task.success"));
                                receiver.txtInteractiveMessages.setVisibility(View.VISIBLE);
                                receiver.settingsButton.setVisibility(View.INVISIBLE);
                                receiver.reportButton.setVisibility(View.INVISIBLE);
                            }
                        }

                        @Override
                        protected void deliverUpdate(ConnectionDiagnosticActivity receiver, String... update) {
                            receiver.txtInteractiveMessages.setText((Localization.get("connection.test.update.message")));
                        }

                        @Override
                        protected void deliverError(ConnectionDiagnosticActivity receiver, Exception e) {
                            receiver.txtInteractiveMessages.setText(Localization.get("connection.test.error.message"));
                            receiver.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem);
                        }
                    };

            mConnectionDiagnosticTask.connect(ConnectionDiagnosticActivity.this);
            mConnectionDiagnosticTask.executeParallel();
        });

        //Set a button that allows you to change your airplane mode settings
        this.settingsButton.setOnClickListener(v -> startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)));

        this.reportButton.setOnClickListener(v -> {
            String url = LogSubmissionTask.getSubmissionUrl(CommCareApplication.instance().getCurrentApp().getAppPreferences());

            if (url != null) {
                CommCareUtil.executeLogSubmission(url, false);
                ConnectionDiagnosticActivity.this.finish();
                Toast.makeText(
                        CommCareApplication.instance(),
                        Localization.get("connection.task.report.commcare.popup"),
                        Toast.LENGTH_LONG).show();
            } else {
                Logger.log(ConnectionDiagnosticTask.CONNECTION_DIAGNOSTIC_REPORT, logUnsetPostURLMessage);
                ConnectionDiagnosticActivity.this.txtInteractiveMessages.setText(MarkupUtil.localizeStyleSpannable(ConnectionDiagnosticActivity.this, "connection.task.unset.posturl"));
                ConnectionDiagnosticActivity.this.txtInteractiveMessages.setVisibility(View.VISIBLE);
            }
        });
    }

    /**
     * Implementation of generateProgressDialog() for DialogController -- other methods
     * handled entirely in CommCareActivity
     */
    @Override
    public CustomProgressDialog generateProgressDialog(int taskId) {
        if (taskId == ConnectionDiagnosticTask.CONNECTION_ID) {
            String title = Localization.get("connection.test.run.title");
            String message = Localization.get("connection.test.now.running");
            CustomProgressDialog dialog = CustomProgressDialog.newInstance(title, message, taskId);
            dialog.setCancelable();
            return dialog;
        } else {
            Log.w(TAG, "taskId passed to generateProgressDialog does not match "
                    + "any valid possibilities in ConnectionDiagnosticActivity");
            return null;
        }
    }
}


text:
package ch.sourcepond.spring.web.blueprint.internal;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.*;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.springframework.beans.factory.BeanDefinitionStoreException;

import javax.servlet.ServletContext;
import java.util.concurrent.atomic.AtomicReference;

import static ch.sourcepond.spring.web.blueprint.internal.BlueprintApplicationContext.BLUEPRINT_CONTAINER_CONTAINER_HAS_BEEN_SHUTDOWN;
import static java.lang.Thread.currentThread;
import static java.lang.Thread.sleep;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import static org.osgi.framework.ServiceEvent.REGISTERED;
import static org.osgi.framework.ServiceEvent.UNREGISTERING;
import static org.osgi.framework.Version.valueOf;

/**
 *
 */
@Ignore
public class BlueprintApplicationContextTest {
    private static final String ANY_SYMBOLIC_NAME = "anySymbolicName";
    private static final String ANY_VERSION = "1.2.3";
    private static final String ANY_NAME = "anyName";
    private static final Object ANY_BEAN = new Object();
    private static final String FILTER = "(&(objectClass=org.osgi.service.blueprint.container.BlueprintContainer)(osgi.blueprint.container.symbolicname=anySymbolicName)(osgi.blueprint.container.version=1.2.3))";
    private final ServletContext servletContext = mock(ServletContext.class);
    private final Bundle bundle = mock(Bundle.class);
    private final BundleContext bundleContext = mock(BundleContext.class);
    private final ServiceReference<BlueprintContainer> containerRef = mock(ServiceReference.class);
    private final BlueprintContainer container = mock(BlueprintContainer.class);
    private BlueprintApplicationContext factory;

    @Before
    public void setup() {
        when(bundle.getSymbolicName()).thenReturn(ANY_SYMBOLIC_NAME);
        when(bundle.getVersion()).thenReturn(valueOf(ANY_VERSION));
        when(bundleContext.getBundle()).thenReturn(bundle);
        when(bundleContext.getService(containerRef)).thenReturn(container);
        when(container.getComponentInstance(ANY_NAME)).thenReturn(ANY_BEAN);
        factory = new BlueprintApplicationContext(servletContext, bundleContext);
    }

    @Test
    public void getFilter() {
        assertEquals(FILTER, factory.getFilter());
    }

    @Test(timeout = 500)
    public void findExistingBlueprintContainer() throws Exception {
        final ServiceReference<?>[] containerRefs = new ServiceReference<?>[]{containerRef};
        when(bundleContext.getServiceReferences((String) null, FILTER)).thenReturn(containerRefs);
        when(bundleContext.getService(containerRef)).thenReturn(container);
        assertSame(ANY_BEAN, factory.getBean(ANY_NAME));
    }

    @Test(expected = IllegalStateException.class)
    public void findExistingBlueprintContainerIllegalSyntax() throws Exception {
        doThrow(InvalidSyntaxException.class).when(bundleContext).getServiceReferences((String)any(), any());
        factory.getBean(ANY_NAME);
    }

    @Test(timeout = 3000)
    public void waitForBlueprintContainer() throws Exception {
        final AtomicReference<Object> ref = new AtomicReference<>();
        final Thread th = new Thread(() -> ref.set(factory.getBean(ANY_NAME)));
        th.start();
        sleep(1000);
        factory.serviceChanged(new ServiceEvent(REGISTERED, containerRef));
        th.join();
        assertSame(ANY_BEAN, ref.get());
    }

    @Test(timeout = 3000, expected = BeanDefinitionStoreException.class)
    public void waitForBlueprintContainerInterrupted() throws Exception {
        currentThread().interrupt();
        factory.getBean(ANY_NAME);
    }

    @Test(timeout = 3000)
    public void blueprintContainerDestroyedWhileWaiting() throws Exception {
        final AtomicReference<BeanDefinitionStoreException> ref = new AtomicReference<>();
        final Thread th = new Thread(() -> {
            try {
                factory.getBean(ANY_NAME);
            } catch (final BeanDefinitionStoreException expected) {
                ref.set(expected);
            }
        });
        th.start();
        sleep(1000);
        factory.serviceChanged(new ServiceEvent(UNREGISTERING, containerRef));
        th.join();
        assertNotNull(ref.get());
        assertSame(BLUEPRINT_CONTAINER_CONTAINER_HAS_BEEN_SHUTDOWN, ref.get().getMessage());
    }
}