text:
<bill session="110" type="h" number="777" updated="2009-01-08T18:26:23-05:00">
	<status><introduced date="1170219600" datetime="2007-01-31"/></status>

	<introduced date="1170219600" datetime="2007-01-31"/>
	<titles>
		<title type="short" as="introduced">Clean Ocean and Safe Tourism Anti-Drilling Act</title>
		<title type="short" as="introduced">COAST Anti-Drilling Act</title>
		<title type="official" as="introduced">To amend the Outer Continental Shelf Lands Act to permanently prohibit the conduct of offshore drilling on the outer Continental Shelf in the Mid-Atlantic and North Atlantic planning areas.</title>
	</titles>
	<sponsor id="400308"/>
	<cosponsors>
		<cosponsor id="400031" joined="2007-06-07"/>
		<cosponsor id="400162" joined="2007-07-18"/>
		<cosponsor id="400102" joined="2007-06-21"/>
		<cosponsor id="400430" joined="2007-06-07"/>
		<cosponsor id="400170" joined="2007-06-19"/>
		<cosponsor id="412195" joined="2008-07-14"/>
		<cosponsor id="400312" joined="2007-02-07"/>
		<cosponsor id="400245" joined="2007-06-07"/>
		<cosponsor id="400387" joined="2007-06-19"/>
		<cosponsor id="400346" joined="2008-07-08"/>
		<cosponsor id="412186" joined="2007-05-16"/>
	</cosponsors>
	<actions>
		<action date="1170219600" datetime="2007-01-31"><text>Referred to the House Committee on Natural Resources.</text></action>
		<action date="1170824400" datetime="2007-02-07"><text>Referred to the Subcommittee on Energy and Mineral Resources.</text></action>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>

	1/31/2007--Introduced.
Clean Ocean and Safe Tourism Anti-Drilling Act, or the COAST Anti-Drilling Act - Amends the Outer Continental Shelf Lands Act to prohibit the Secretary of the Interior from issuing a lease for the exploration, development, or production of oil, natural gas, or any other mineral in either the Mid-Atlantic or the North Atlantic planning areas.

</bill>


text:
package helloscala.http.session

import akka.event.LoggingAdapter
import akka.http.scaladsl.marshalling.ToResponseMarshallable
import akka.http.scaladsl.model.{HttpRequest, StatusCodes, Uri}
import akka.http.scaladsl.server.{Rejection, RequestContext, RouteResult}
import akka.http.scaladsl.settings.{ParserSettings, RoutingSettings}
import akka.stream.Materializer

import scala.concurrent.{ExecutionContextExecutor, Future}

case class SessionRequestContext[T](session: T, rc: RequestContext) extends RequestContext {
  println("init SessionRequestContext")

  override val request: HttpRequest = rc.request
  override val unmatchedPath: Uri.Path = rc.unmatchedPath

  implicit override def executionContext: ExecutionContextExecutor =
    rc.executionContext

  implicit override def materializer: Materializer = rc.materializer

  override def log: LoggingAdapter = rc.log

  override def settings: RoutingSettings = rc.settings

  override def parserSettings: ParserSettings = rc.parserSettings

  override def reconfigure(
      executionContext: ExecutionContextExecutor,
      materializer: Materializer,
      log: LoggingAdapter,
      settings: RoutingSettings): RequestContext =
    rc.reconfigure(executionContext, materializer, log, settings)

  override def complete(obj: ToResponseMarshallable): Future[RouteResult] =
    rc.complete(obj)

  override def reject(rejections: Rejection*): Future[RouteResult] =
    rc.reject(rejections: _*)

  override def redirect(uri: Uri, redirectionType: StatusCodes.Redirection): Future[RouteResult] =
    rc.redirect(uri, redirectionType)

  override def fail(error: Throwable): Future[RouteResult] = rc.fail(error)

  override def withRequest(req: HttpRequest): RequestContext =
    rc.withRequest(req)

  override def withExecutionContext(ec: ExecutionContextExecutor): RequestContext =
    rc.withExecutionContext(ec)

  override def withMaterializer(materializer: Materializer): RequestContext =
    rc.withMaterializer(materializer)

  override def withLog(log: LoggingAdapter): RequestContext = rc.withLog(log)

  override def withRoutingSettings(settings: RoutingSettings): RequestContext =
    rc.withRoutingSettings(settings)

  override def withParserSettings(settings: ParserSettings): RequestContext =
    rc.withParserSettings(settings)

  override def mapRequest(f: HttpRequest => HttpRequest): RequestContext =
    rc.mapRequest(f)

  override def withUnmatchedPath(path: Uri.Path): RequestContext =
    rc.withUnmatchedPath(path)

  override def mapUnmatchedPath(f: Uri.Path => Uri.Path): RequestContext =
    rc.mapUnmatchedPath(f)

  override def withAcceptAll: RequestContext = rc.withAcceptAll

  override def toString = super.toString
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Oro\Bundle\EntityExtendBundle\Tests\Unit\EventListener;

use Oro\Bundle\EntityConfigBundle\Config\Config;
use Oro\Bundle\EntityConfigBundle\Config\ConfigManager;
use Oro\Bundle\EntityConfigBundle\Config\Id\EntityConfigId;
use Oro\Bundle\EntityConfigBundle\Entity\FieldConfigModel;
use Oro\Bundle\EntityConfigBundle\Event\FieldConfigEvent;
use Oro\Bundle\EntityExtendBundle\EventListener\ConfigSubscriber;

class ConfigSubscriberCreateFieldTest extends \PHPUnit_Framework_TestCase
{
    const ENTITY_CLASS_NAME = 'Oro\Bundle\UserBundle\Entity\User';

    public function testCreateNew()
    {
        $entityConfig = new Config(
            new EntityConfigId('extend', self::ENTITY_CLASS_NAME)
        );

        //value of Config should be empty
        $this->assertEmpty($entityConfig->all());

        $configProvider = $this->getMockBuilder('Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider')
            ->disableOriginalConstructor()
            ->getMock();
        $configProvider
            ->expects($this->once())
            ->method('getConfig')
            ->with(self::ENTITY_CLASS_NAME)
            ->will($this->returnValue($entityConfig));
        $configProvider
            ->expects($this->never())
            ->method('persist');

        $configManager = $this->getMockBuilder('Oro\Bundle\EntityConfigBundle\Config\ConfigManager')
            ->disableOriginalConstructor()
            ->getMock();
        $configManager
            ->expects($this->once())
            ->method('getProvider')
            ->with('extend')
            ->will($this->returnValue($configProvider));

        $extendManager = $this->getMockBuilder('Oro\Bundle\EntityExtendBundle\Extend\ExtendManager')
            ->disableOriginalConstructor()
            ->getMock();

        $event = new FieldConfigEvent(self::ENTITY_CLASS_NAME, 'testField', $configManager);

        $configSubscriber = new ConfigSubscriber($extendManager);
        $configSubscriber->newFieldConfig($event);

        /** @var ConfigManager $cm */
        $cm = $event->getConfigManager();

        $this->assertObjectHasAttribute('persistConfigs', $cm);
        $this->assertAttributeSame(null, 'persistConfigs', $cm);
    }

    public function testUpdateNew()
    {
        $configModel = new FieldConfigModel('testField', 'string');
        $entityConfig = new Config(
            new EntityConfigId('extend', self::ENTITY_CLASS_NAME)
        );
        $entityConfig->set('upgradeable', false);

        $this->assertEquals(
            ['upgradeable' => false],
            $entityConfig->all()
        );

        $configProvider = $this->getMockBuilder('Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider')
            ->disableOriginalConstructor()
            ->getMock();
        $configProvider
            ->expects($this->once())
            ->method('getConfig')
            ->with(self::ENTITY_CLASS_NAME)
            ->will($this->returnValue($entityConfig));
        $configProvider
            ->expects($this->once())
            ->method('persist');

        $configManager = $this->getMockBuilder('Oro\Bundle\EntityConfigBundle\Config\ConfigManager')
            ->disableOriginalConstructor()
            ->getMock();
        $configManager
            ->expects($this->once())
            ->method('getProvider')
            ->with('extend')
            ->will($this->returnValue($configProvider));

        $extendManager = $this->getMockBuilder('Oro\Bundle\EntityExtendBundle\Extend\ExtendManager')
            ->disableOriginalConstructor()
            ->getMock();

        $event = new FieldConfigEvent(self::ENTITY_CLASS_NAME, 'testField', $configManager);

        $configSubscriber = new ConfigSubscriber($extendManager);
        $configSubscriber->newFieldConfig($event);

        /** @var ConfigManager $cm */
        $cm = $event->getConfigManager();

        $this->assertEquals(
            ['upgradeable' => true],
            $entityConfig->all()
        );
        $this->assertObjectHasAttribute('persistConfigs', $cm);
    }
}


text:
'use strict';

describe('Filter: regional', function () {
  beforeEach(window.module(require('./image.regional.filter').name));

  beforeEach(
    window.inject(function (_regionalFilter_) {
      this.regionalFilter = _regionalFilter_;
      this._ = _;

      this.images = [
        {
          name: 'null',
          region: null,
        },
        {
          name: 'west',
          region: 'west',
        },
        {
          name: 'east',
          region: 'east',
        },
      ];
    }),
  );

  it('filters the images based on the selected region and null', function () {
    var noEast = [
      {
        name: 'null',
        region: null,
      },
      {
        name: 'west',
        region: 'west',
      },
    ];

    expect(this.regionalFilter(this.images, 'west')).toEqual(noEast);
  });
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace King_of_Thieves.usr.local.MapTests
{
    class HryuleCastleTownTest : PlayableState
    {
        protected override void _initMap()
        {
            CMasterControl.mapManager.swapMap("castleTown.xml", "player", new Vector2(400, 1000));
        }
    }
}


text:
static id PopValue(NSMutableDictionary *dictionary, NSString *key) {
    id value = dictionary[key];
    dictionary[key] = nil;
    return value;
}

static void LoadBoolean     (BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key);
static void LoadString      (BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key);
static void LoadNumber      (BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key);
static void LoadStringSet   (BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key);
static void LoadEndpoints   (BugsnagConfiguration *config, NSMutableDictionary *options);
static void LoadSendThreads (BugsnagConfiguration *config, NSMutableDictionary *options);

#pragma mark -

BugsnagConfiguration * BSGConfigurationWithOptions(NSDictionary *options) {
    BugsnagConfiguration *config;
    NSMutableDictionary *dict = [options mutableCopy];

    NSString *apiKey = PopValue(dict, BSG_KEYPATH(config, apiKey));
    if (apiKey != nil && ![apiKey isKindOfClass:[NSString class]]) {
        @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Bugsnag apiKey must be a string" userInfo:nil];
    }

    config = [[BugsnagConfiguration alloc] initWithApiKey:apiKey];

    LoadBoolean     (config, dict, BSG_KEYPATH(config, attemptDeliveryOnCrash));
    LoadBoolean     (config, dict, BSG_KEYPATH(config, autoDetectErrors));
    LoadBoolean     (config, dict, BSG_KEYPATH(config, autoTrackSessions));
    LoadBoolean     (config, dict, BSG_KEYPATH(config, persistUser));
    LoadBoolean     (config, dict, BSG_KEYPATH(config, sendLaunchCrashesSynchronously));
    LoadEndpoints   (config, dict);
    LoadNumber      (config, dict, BSG_KEYPATH(config, launchDurationMillis));
    LoadNumber      (config, dict, BSG_KEYPATH(config, maxBreadcrumbs));
    LoadNumber      (config, dict, BSG_KEYPATH(config, maxPersistedEvents));
    LoadNumber      (config, dict, BSG_KEYPATH(config, maxPersistedSessions));
    LoadNumber      (config, dict, BSG_KEYPATH(config, maxStringValueLength));
    LoadSendThreads (config, dict);
    LoadString      (config, dict, BSG_KEYPATH(config, appType));
    LoadString      (config, dict, BSG_KEYPATH(config, appVersion));
    LoadString      (config, dict, BSG_KEYPATH(config, bundleVersion));
    LoadString      (config, dict, BSG_KEYPATH(config, releaseStage));
    LoadStringSet   (config, dict, BSG_KEYPATH(config, discardClasses));
    LoadStringSet   (config, dict, BSG_KEYPATH(config, enabledReleaseStages));
    LoadStringSet   (config, dict, BSG_KEYPATH(config, redactedKeys));

#if BSG_HAVE_APP_HANG_DETECTION
    LoadBoolean     (config, dict, BSG_KEYPATH(config, reportBackgroundAppHangs));
    LoadNumber      (config, dict, BSG_KEYPATH(config, appHangThresholdMillis));
#endif

    if (dict.count > 0) {
        bsg_log_warn(@"Ignoring unexpected Info.plist values: %@", dict);
    }

    return config;
}

static void LoadBoolean(BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key) {
    id value = PopValue(options, key);
    if (value && CFGetTypeID((__bridge CFTypeRef)value) == CFBooleanGetTypeID()) {
        [config setValue:value forKey:key];
    }
}

static void LoadString(BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key) {
    id value = PopValue(options, key);
    if ([value isKindOfClass:[NSString class]]) {
        [config setValue:value forKey:key];
    }
}

static void LoadNumber(BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key) {
    id value = PopValue(options, key);
    if ([value isKindOfClass:[NSNumber class]]) {
        [config setValue:value forKey:key];
    }
}

static void LoadStringSet(BugsnagConfiguration *config, NSMutableDictionary *options, NSString *key) {
    id val = PopValue(options, key);
    if ([val isKindOfClass:[NSArray class]]) {
        for (NSString *obj in val) {
            if (![obj isKindOfClass:[NSString class]]) {
                return;
            }
        }
        [config setValue:[NSSet setWithArray:val] forKey:key];
    }
}

static void LoadEndpoints(BugsnagConfiguration *config, NSMutableDictionary *options) {
    NSDictionary *endpoints = PopValue(options, BSG_KEYPATH(config, endpoints));
    if ([endpoints isKindOfClass:[NSDictionary class]]) {
        NSString *notify = endpoints[BSG_KEYPATH(config.endpoints, notify)];
        if ([notify isKindOfClass:[NSString class]]) {
            config.endpoints.notify = notify;
        }
        NSString *sessions = endpoints[BSG_KEYPATH(config.endpoints, sessions)];
        if ([sessions isKindOfClass:[NSString class]]) {
            config.endpoints.sessions = sessions;
        }
    }
}

static void LoadSendThreads(BugsnagConfiguration *config, NSMutableDictionary *options) {
#if BSG_HAVE_MACH_THREADS
    NSString *sendThreads = [PopValue(options, BSG_KEYPATH(config, sendThreads)) lowercaseString];
    if ([sendThreads isKindOfClass:[NSString class]]) {
        if ([@"unhandledonly" isEqualToString:sendThreads]) {
            config.sendThreads = BSGThreadSendPolicyUnhandledOnly;
        } else if ([@"always" isEqualToString:sendThreads]) {
            config.sendThreads = BSGThreadSendPolicyAlways;
        } else if ([@"never" isEqualToString:sendThreads]) {
            config.sendThreads = BSGThreadSendPolicyNever;
        }
    }
#endif
}


text:
/*
 * drivers/base/memory.c - basic Memory class support
 *
 * Written by Matt Tolentino <matthew.e.tolentino@intel.com>
 *            Dave Hansen <haveblue@us.ibm.com>
 *
 * This file provides the necessary infrastructure to represent
 * a SPARSEMEM-memory-model system's physical memory in /sysfs.
 * All arch-independent code that assumes MEMORY_HOTPLUG requires
 * SPARSEMEM should be contained here, or in mm/memory_hotplug.c.
 */

#include <linux/sysdev.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/topology.h>
#include <linux/capability.h>
#include <linux/device.h>
#include <linux/memory.h>
#include <linux/kobject.h>
#include <linux/memory_hotplug.h>
#include <linux/mm.h>
#include <asm/atomic.h>
#include <asm/uaccess.h>

#define MEMORY_CLASS_NAME	"memory"

static struct sysdev_class memory_sysdev_class = {
	set_kset_name(MEMORY_CLASS_NAME),
};

static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
{
	return MEMORY_CLASS_NAME;
}

static int memory_uevent(struct kset *kset, struct kobject *kobj, char **envp,
			int num_envp, char *buffer, int buffer_size)
{
	int retval = 0;

	return retval;
}

static struct kset_uevent_ops memory_uevent_ops = {
	.name		= memory_uevent_name,
	.uevent		= memory_uevent,
};

static struct notifier_block *memory_chain;

int register_memory_notifier(struct notifier_block *nb)
{
        return notifier_chain_register(&memory_chain, nb);
}

void unregister_memory_notifier(struct notifier_block *nb)
{
        notifier_chain_unregister(&memory_chain, nb);
}

/*
 * register_memory - Setup a sysfs device for a memory block
 */
int register_memory(struct memory_block *memory, struct mem_section *section,
		struct node *root)
{
	int error;

	memory->sysdev.cls = &memory_sysdev_class;
	memory->sysdev.id = __section_nr(section);

	error = sysdev_register(&memory->sysdev);

	if (root && !error)
		error = sysfs_create_link(&root->sysdev.kobj,
					  &memory->sysdev.kobj,
					  kobject_name(&memory->sysdev.kobj));

	return error;
}

static void
unregister_memory(struct memory_block *memory, struct mem_section *section,
		struct node *root)
{
	BUG_ON(memory->sysdev.cls != &memory_sysdev_class);
	BUG_ON(memory->sysdev.id != __section_nr(section));

	sysdev_unregister(&memory->sysdev);
	if (root)
		sysfs_remove_link(&root->sysdev.kobj,
				  kobject_name(&memory->sysdev.kobj));
}

/*
 * use this as the physical section index that this memsection
 * uses.
 */

static ssize_t show_mem_phys_index(struct sys_device *dev, char *buf)
{
	struct memory_block *mem =
		container_of(dev, struct memory_block, sysdev);
	return sprintf(buf, "%08lx\n", mem->phys_index);
}

/*
 * online, offline, going offline, etc.
 */
static ssize_t show_mem_state(struct sys_device *dev, char *buf)
{
	struct memory_block *mem =
		container_of(dev, struct memory_block, sysdev);
	ssize_t len = 0;

	/*
	 * We can probably put these states in a nice little array
	 * so that they're not open-coded
	 */
	switch (mem->state) {
		case MEM_ONLINE:
			len = sprintf(buf, "online\n");
			break;
		case MEM_OFFLINE:
			len = sprintf(buf, "offline\n");
			break;
		case MEM_GOING_OFFLINE:
			len = sprintf(buf, "going-offline\n");
			break;
		default:
			len = sprintf(buf, "ERROR-UNKNOWN-%ld\n",
					mem->state);
			WARN_ON(1);
			break;
	}

	return len;
}

static inline int memory_notify(unsigned long val, void *v)
{
	return notifier_call_chain(&memory_chain, val, v);
}

/*
 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is
 * OK to have direct references to sparsemem variables in here.
 */
static int
memory_block_action(struct memory_block *mem, unsigned long action)
{
	int i;
	unsigned long psection;
	unsigned long start_pfn, start_paddr;
	struct page *first_page;
	int ret;
	int old_state = mem->state;

	psection = mem->phys_index;
	first_page = pfn_to_page(psection << PFN_SECTION_SHIFT);

	/*
	 * The probe routines leave the pages reserved, just
	 * as the bootmem code does.  Make sure they're still
	 * that way.
	 */
	if (action == MEM_ONLINE) {
		for (i = 0; i < PAGES_PER_SECTION; i++) {
			if (PageReserved(first_page+i))
				continue;

			printk(KERN_WARNING "section number %ld page number %d "
				"not reserved, was it already online? \n",
				psection, i);
			return -EBUSY;
		}
	}

	switch (action) {
		case MEM_ONLINE:
			start_pfn = page_to_pfn(first_page);
			ret = online_pages(start_pfn, PAGES_PER_SECTION);
			break;
		case MEM_OFFLINE:
			mem->state = MEM_GOING_OFFLINE;
			memory_notify(MEM_GOING_OFFLINE, NULL);
			start_paddr = page_to_pfn(first_page) << PAGE_SHIFT;
			ret = remove_memory(start_paddr,
					    PAGES_PER_SECTION << PAGE_SHIFT);
			if (ret) {
				mem->state = old_state;
				break;
			}
			memory_notify(MEM_MAPPING_INVALID, NULL);
			break;
		default:
			printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n",
					__FUNCTION__, mem, action, action);
			WARN_ON(1);
			ret = -EINVAL;
	}
	/*
	 * For now, only notify on successful memory operations
	 */
	if (!ret)
		memory_notify(action, NULL);

	return ret;
}

static int memory_block_change_state(struct memory_block *mem,
		unsigned long to_state, unsigned long from_state_req)
{
	int ret = 0;
	down(&mem->state_sem);

	if (mem->state != from_state_req) {
		ret = -EINVAL;
		goto out;
	}

	ret = memory_block_action(mem, to_state);
	if (!ret)
		mem->state = to_state;

out:
	up(&mem->state_sem);
	return ret;
}

static ssize_t
store_mem_state(struct sys_device *dev, const char *buf, size_t count)
{
	struct memory_block *mem;
	unsigned int phys_section_nr;
	int ret = -EINVAL;

	mem = container_of(dev, struct memory_block, sysdev);
	phys_section_nr = mem->phys_index;

	if (!valid_section_nr(phys_section_nr))
		goto out;

	if (!strncmp(buf, "online", min((int)count, 6)))
		ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE);
	else if(!strncmp(buf, "offline", min((int)count, 7)))
		ret = memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
out:
	if (ret)
		return ret;
	return count;
}

/*
 * phys_device is a bad name for this.  What I really want
 * is a way to differentiate between memory ranges that
 * are part of physical devices that constitute
 * a complete removable unit or fru.
 * i.e. do these ranges belong to the same physical device,
 * s.t. if I offline all of these sections I can then
 * remove the physical device?
 */
static ssize_t show_phys_device(struct sys_device *dev, char *buf)
{
	struct memory_block *mem =
		container_of(dev, struct memory_block, sysdev);
	return sprintf(buf, "%d\n", mem->phys_device);
}

static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);

#define mem_create_simple_file(mem, attr_name)	\
	sysdev_create_file(&mem->sysdev, &attr_##attr_name)
#define mem_remove_simple_file(mem, attr_name)	\
	sysdev_remove_file(&mem->sysdev, &attr_##attr_name)

/*
 * Block size attribute stuff
 */
static ssize_t
print_block_size(struct class *class, char *buf)
{
	return sprintf(buf, "%lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
}

static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL);

static int block_size_init(void)
{
	sysfs_create_file(&memory_sysdev_class.kset.kobj,
		&class_attr_block_size_bytes.attr);
	return 0;
}

/*
 * Some architectures will have custom drivers to do this, and
 * will not need to do it from userspace.  The fake hot-add code
 * as well as ppc64 will do all of their discovery in userspace
 * and will require this interface.
 */
#ifdef CONFIG_ARCH_MEMORY_PROBE
static ssize_t
memory_probe_store(struct class *class, const char *buf, size_t count)
{
	u64 phys_addr;
	int ret;

	phys_addr = simple_strtoull(buf, NULL, 0);

	ret = add_memory(phys_addr, PAGES_PER_SECTION << PAGE_SHIFT);

	if (ret)
		count = ret;

	return count;
}
static CLASS_ATTR(probe, 0700, NULL, memory_probe_store);

static int memory_probe_init(void)
{
	sysfs_create_file(&memory_sysdev_class.kset.kobj,
		&class_attr_probe.attr);
	return 0;
}
#else
#define memory_probe_init(...)	do {} while (0)
#endif

/*
 * Note that phys_device is optional.  It is here to allow for
 * differentiation between which *physical* devices each
 * section belongs to...
 */

static int add_memory_block(unsigned long node_id, struct mem_section *section,
		     unsigned long state, int phys_device)
{
	struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
	int ret = 0;

	if (!mem)
		return -ENOMEM;

	mem->phys_index = __section_nr(section);
	mem->state = state;
	init_MUTEX(&mem->state_sem);
	mem->phys_device = phys_device;

	ret = register_memory(mem, section, NULL);
	if (!ret)
		ret = mem_create_simple_file(mem, phys_index);
	if (!ret)
		ret = mem_create_simple_file(mem, state);
	if (!ret)
		ret = mem_create_simple_file(mem, phys_device);

	return ret;
}

/*
 * For now, we have a linear search to go find the appropriate
 * memory_block corresponding to a particular phys_index. If
 * this gets to be a real problem, we can always use a radix
 * tree or something here.
 *
 * This could be made generic for all sysdev classes.
 */
static struct memory_block *find_memory_block(struct mem_section *section)
{
	struct kobject *kobj;
	struct sys_device *sysdev;
	struct memory_block *mem;
	char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1];

	/*
	 * This only works because we know that section == sysdev->id
	 * slightly redundant with sysdev_register()
	 */
	sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, __section_nr(section));

	kobj = kset_find_obj(&memory_sysdev_class.kset, name);
	if (!kobj)
		return NULL;

	sysdev = container_of(kobj, struct sys_device, kobj);
	mem = container_of(sysdev, struct memory_block, sysdev);

	return mem;
}

int remove_memory_block(unsigned long node_id, struct mem_section *section,
		int phys_device)
{
	struct memory_block *mem;

	mem = find_memory_block(section);
	mem_remove_simple_file(mem, phys_index);
	mem_remove_simple_file(mem, state);
	mem_remove_simple_file(mem, phys_device);
	unregister_memory(mem, section, NULL);

	return 0;
}

/*
 * need an interface for the VM to add new memory regions,
 * but without onlining it.
 */
int register_new_memory(struct mem_section *section)
{
	return add_memory_block(0, section, MEM_OFFLINE, 0);
}

int unregister_memory_section(struct mem_section *section)
{
	if (!valid_section(section))
		return -EINVAL;

	return remove_memory_block(0, section, 0);
}

/*
 * Initialize the sysfs support for memory devices...
 */
int __init memory_dev_init(void)
{
	unsigned int i;
	int ret;

	memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops;
	ret = sysdev_class_register(&memory_sysdev_class);

	/*
	 * Create entries for memory sections that were found
	 * during boot and have been initialized
	 */
	for (i = 0; i < NR_MEM_SECTIONS; i++) {
		if (!valid_section_nr(i))
			continue;
		add_memory_block(0, __nr_to_section(i), MEM_ONLINE, 0);
	}

	memory_probe_init();
	block_size_init();

	return ret;
}


text:
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';

import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatIconModule, MatTabsModule } from '@angular/material';

import { FeedComponent } from './feed.component';
import { SideBoardComponent } from '../side-board/side-board.component';
import { ThreatHeaderComponent } from '../threat-header/threat-header.component';
import { ContributorListComponent } from './contributor-list/contributor-list.component';
import { FeedCarouselComponent } from '../feed-carousel/feed-carousel.component';
import { BoardReportsComponent } from './board-reports/board-reports.component';
import { RelatedBoardsComponent } from './related-boards/related-boards.component';
import { ActivityListComponent } from './activity-list/activity-list.component';
import { DisplayCommentComponent } from '../display-comment/display-comment.component';
import { CommentInputComponent } from '../display-comment/comment-input.component';
import { ThreatDashboardBetaService } from '../threat-beta.service';
import MockThreatDashboardBetaService from '../testing/mock-threat.service';
import { GlobalModule } from '../../global/global.module';
import { threatReducer } from '../store/threat.reducers';

describe('FeedComponent', () => {

    let fixture: ComponentFixture<FeedComponent>;
    let component: FeedComponent;

    beforeEach(async(() => {
        TestBed
            .configureTestingModule({
                imports: [
                    RouterTestingModule,
                    MatTabsModule,
                    MatIconModule,
                    GlobalModule,
                    NoopAnimationsModule,
                    StoreModule.forRoot(threatReducer),
                ],
                declarations: [
                    FeedComponent,
                    FeedCarouselComponent,
                    BoardReportsComponent,
                    RelatedBoardsComponent,
                    ActivityListComponent,
                    ContributorListComponent,
                    DisplayCommentComponent,
                    CommentInputComponent,
                    ThreatHeaderComponent,
                    SideBoardComponent,
                ],
                providers: [
                    { provide: ThreatDashboardBetaService, useValue: MockThreatDashboardBetaService },
                ]
            })
            .compileComponents();
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(FeedComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('should create', () => {
        expect(component).toBeTruthy();
    });

    /*
     * TODO:
     * - add board data to the store to mimic loading threatboard data
     * - check board update time
     */

});


text:
package jp.co.iti.mynfcwriter2;

import android.os.Bundle;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.view.Menu;
import android.widget.RadioGroup;
import android.widget.Toast;

public class MainActivity extends Activity {

	// Target URLs
	private static final String TARGET_URL_WEB = "http://bit.ly/1cBnsuk";
	private static final String TARGET_URL_TEL = "tel:09000000000";
	private static final String TARGET_URL_SMS = "sms:09000000000";
	private static final String TARGET_URL_MAIL = "mailto:xxx@xxx.com";
	private static final String TARGET_URL_MAP = "geo:35.6703915,139.7758437";
//	private static final String TARGET_URL_YOUTUBE = "http://www.youtube.com/watch?v=sGF6bOi1NfA";
	private static final String TARGET_URL_YOUTUBE = "vnd.youtube://sGF6bOi1NfA";
	private static final String TARGET_URL_LINE = "http://line.me/R/msg/text/?somemessage";
//	private static final String TARGET_URL_TWITTER = "twitter://";
//	private static final String TARGET_URL_TWITTER = "https://twitter.com/";

	private NfcWriter nfcWriter = null;
	private String targetUrl = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		this.nfcWriter = new NfcWriter(this);
		this.targetUrl = TARGET_URL_WEB;

		// Set up radio group control.
		this.setRadioGroup();
	}

	@Override
	protected void onResume() {
		super.onResume();

		PendingIntent pendingIntent = this.createPendingIntent();

		// Enable the NFC adapter
		this.nfcWriter.enable(this, pendingIntent);
	}

	@Override
	protected void onPause() {
		super.onPause();

		// Disable the NFC adapter
		this.nfcWriter.disable(this);
	}

	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);

		if (this.nfcWriter.write(this, intent, this.targetUrl)) {
			Toast.makeText(this, "Completed.", Toast.LENGTH_SHORT).show();
		} else {
			Toast.makeText(this, this.nfcWriter.getErrorMessage(), Toast.LENGTH_SHORT).show();
		}
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();

		this.nfcWriter = null;
		this.targetUrl = null;
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	private PendingIntent createPendingIntent() {
		Intent intent = new Intent(this, MainActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP
						| Intent.FLAG_ACTIVITY_NEW_TASK);
		return PendingIntent.getActivity(this, 0, intent, 0);
	}

	// Set up radio group control.
	private void setRadioGroup() {
		RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroupFunction);
		radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// Change the target url.

				switch (checkedId) {
				case R.id.radioWeb:
					MainActivity.this.targetUrl = TARGET_URL_WEB;
					break;
				case R.id.radioTel:
					MainActivity.this.targetUrl = TARGET_URL_TEL;
					break;
				case R.id.radioSms:
					MainActivity.this.targetUrl = TARGET_URL_SMS;
					break;
				case R.id.radioMail:
					MainActivity.this.targetUrl = TARGET_URL_MAIL;
					break;
				case R.id.radioMap:
					MainActivity.this.targetUrl = TARGET_URL_MAP;
					break;
				case R.id.radioYoutube:
					MainActivity.this.targetUrl = TARGET_URL_YOUTUBE;
					break;
				case R.id.radioLine:
					MainActivity.this.targetUrl = TARGET_URL_LINE;
					break;
//				case R.id.radioTwitter:
//					MainActivity.this.targetUrl = TARGET_URL_TWITTER;
//					break;
				}

				Toast.makeText(MainActivity.this,
							MainActivity.this.targetUrl,
							Toast.LENGTH_SHORT).show();
			}
		});
	}
}


text:
<?php

/**
 * @see Zend_Gdata_Extension
 */
require_once 'Zend/Gdata/Extension.php';

/**
 * Data model for representing an atom:link element
 *
 * @category   Zend
 * @package    Zend_Gdata
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
{

    protected $_rootElement = 'link';
    protected $_href = null;
    protected $_rel = null;
    protected $_type = null;
    protected $_hrefLang = null;
    protected $_title = null;
    protected $_length = null;

    public function __construct($href = null, $rel = null, $type = null,
            $hrefLang = null, $title = null, $length = null)
    {
        parent::__construct();
        $this->_href = $href;
        $this->_rel = $rel;
        $this->_type = $type;
        $this->_hrefLang = $hrefLang;
        $this->_title = $title;
        $this->_length = $length;
    }

    public function getDOM($doc = null)
    {
        $element = parent::getDOM($doc);
        if ($this->_href != null) {
            $element->setAttribute('href', $this->_href);
        }
        if ($this->_rel != null) {
            $element->setAttribute('rel', $this->_rel);
        }
        if ($this->_type != null) {
            $element->setAttribute('type', $this->_type);
        }
        if ($this->_hrefLang != null) {
            $element->setAttribute('hreflang', $this->_hrefLang);
        }
        if ($this->_title != null) {
            $element->setAttribute('title', $this->_title);
        }
        if ($this->_length != null) {
            $element->setAttribute('length', $this->_length);
        }
        return $element;
    }

    protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
        case 'href':
            $this->_href = $attribute->nodeValue;
            break;
        case 'rel':
            $this->_rel = $attribute->nodeValue;
            break;
        case 'type':
            $this->_type = $attribute->nodeValue;
            break;
        case 'hreflang':
            $this->_hrefLang = $attribute->nodeValue;
            break;
        case 'title':
            $this->_title = $attribute->nodeValue;
            break;
        case 'length':
            $this->_length = $attribute->nodeValue;
            break;
        default:
            parent::takeAttributeFromDOM($attribute);
        }
    }

    /**
     * @return Zend_Gdata_App_Extension_Href
     */
    public function getHref()
    {
        return $this->_href;
    }

    /**
     * @param Zend_Gdata_App_Extension_Href $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setHref($value)
    {
        $this->_href = $value;
        return $this;
    }

    /**
     * @return Zend_Gdata_App_Extension_Rel
     */
    public function getRel()
    {
        return $this->_rel;
    }

    /**
     * @param Zend_Gdata_App_Extension_Rel $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setRel($value)
    {
        $this->_rel = $value;
        return $this;
    }

    /**
     * @return Zend_Gdata_App_Extension_Type
     */
    public function getType()
    {
        return $this->_type;
    }

    /**
     * @param Zend_Gdata_App_Extension_Type $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setType($value)
    {
        $this->_type = $value;
        return $this;
    }

    /**
     * @return Zend_Gdata_App_Extension_HrefLang
     */
    public function getHrefLang()
    {
        return $this->_hrefLang;
    }

    /**
     * @param Zend_Gdata_App_Extension_HrefLang $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setHrefLang($value)
    {
        $this->_hrefLang = $value;
        return $this;
    }

    /**
     * @return Zend_Gdata_App_Extension_Title
     */
    public function getTitle()
    {
        return $this->_title;
    }

    /**
     * @param Zend_Gdata_App_Extension_Title $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setTitle($value)
    {
        $this->_title = $value;
        return $this;
    }

    /**
     * @return Zend_Gdata_App_Extension_Length
     */
    public function getLength()
    {
        return $this->_length;
    }

    /**
     * @param Zend_Gdata_App_Extension_Length $value
     * @return Zend_Gdata_App_Entry Provides a fluent interface
     */
    public function setLength($value)
    {
        $this->_length = $value;
        return $this;
    }

}


text:
class RmaReports < Sinatra::Application
	get "/" do
		@title = "RMA REPORTS"
		@students = Student.all
		@teachers = Teacher.all
		haml :index, :layout => :nobody_layout
	end
	get	"/learn" do
		@title = "learn sinatra"
		haml :learn, :layout => :teacher_layout
	end
end


text:
	/*
  	Flaticon icon font: Flaticon
  	Creation date: 10/10/2017 18:19
  	*/

@font-face {
  font-family: "Flaticon";
  src: url("./Flaticon.eot");
  src: url("./Flaticon.eot?#iefix") format("embedded-opentype"),
       url("./Flaticon.woff") format("woff"),
       url("./Flaticon.ttf") format("truetype"),
       url("./Flaticon.svg#Flaticon") format("svg");
  font-weight: normal;
  font-style: normal;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
  @font-face {
    font-family: "Flaticon";
    src: url("./Flaticon.svg#Flaticon") format("svg");
  }
}

[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {
  font-family: Flaticon;
        font-size: 100%;
font-style: normal;
}

.flaticon-mirror-ball:before { content: "\f100"; }
.flaticon-drone:before { content: "\f101"; }
.flaticon-camera:before { content: "\f102"; }
.flaticon-music-player:before { content: "\f103"; }
.flaticon-marriage-rings-couple-with-a-heart:before { content: "\f104"; }


text:
goog.provide('gmf-mobilequery');

goog.require('gmf.QueryManager');
goog.require('gmf.Themes');
goog.require('gmf.mobiledisplayqueriesDirective');
goog.require('gmf.layertreeDirective');
goog.require('gmf.mapDirective');
goog.require('ngeo.proj.EPSG21781');
goog.require('ngeo');
goog.require('ngeo.Query');
goog.require('ngeo.btnDirective');
goog.require('ngeo.mobileQueryDirective');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');

/** @const **/
var app = {};

/** @type {!angular.Module} **/
app.module = angular.module('app', ['gmf']);

app.module.constant('ngeoQueryOptions', {
  'limit': 20
});

app.module.constant(
    'gmfTreeUrl',
    'https://geomapfish-demo.camptocamp.net/2.1/wsgi/themes?' +
        'version=2&background=background');

app.module.value('gmfWmsUrl',
    'https://geomapfish-demo.camptocamp.net/1.6/wsgi/mapserv_proxy');

/**
 * Demo, NOT USED.
 * A sample directive to display the result.
 *
 * @return {angular.Directive} The directive specs.
 */
app.queryresultDirective = function() {
  return {
    restrict: 'E',
    scope: {},
    controller: 'AppQueryresultController',
    controllerAs: 'qrCtrl',
    bindToController: true,
    templateUrl: 'partials/queryresult.html'
  };
};

app.module.directive('appQueryresult', app.queryresultDirective);

/**
 * Demo, NOT USED.
 * @param {ngeo.QueryResult} ngeoQueryResult Query service.
 * @constructor
 * @ngInject
 */
app.QueryresultController = function(ngeoQueryResult) {

  /**
   * @type {ngeo.QueryResult}
   * @export
   */
  this.result = ngeoQueryResult;

};

app.module.controller('AppQueryresultController', app.QueryresultController);

/**
 * @constructor
 * @param {gmf.Themes} gmfThemes The gme themes service.
 * @param {gmf.QueryManager} gmfQueryManager The gmf query manager service.
 * @param {ngeo.FeatureOverlayMgr} ngeoFeatureOverlayMgr The ngeo feature
 *   overlay manager service.
 */
app.MainController = function(gmfThemes, gmfQueryManager,
    ngeoFeatureOverlayMgr) {

  gmfThemes.loadThemes();

  var projection = ol.proj.get('EPSG:21781');
  projection.setExtent([485869.5728, 76443.1884, 837076.5648, 299941.7864]);

  var fill = new ol.style.Fill({color: [255, 170, 0, 0.6]});
  var stroke = new ol.style.Stroke({color: [255, 170, 0, 1], width: 2});

  /**
   * FeatureStyle used by the mobiledisplayqueries directive
   * @type {ol.style.Style}
   * @export
   */
  this.featureStyle = new ol.style.Style({
    fill: fill,
    image: new ol.style.Circle({fill: fill, radius: 5, stroke: stroke}),
    stroke: stroke
  });

  /**
   * @type {ol.Map}
   * @export
   */
  this.map = new ol.Map({
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    view: new ol.View({
      projection: projection,
      resolutions: [200, 100, 50, 20, 10, 5, 2.5, 2, 1, 0.5],
      center: [537635, 152640],
      zoom: 3
    })
  });

  /**
   * @type {Array.<Object>|undefined}
   * export
   */
  this.themes = undefined;

  /**
   * @type {Object|undefined}
   * @export
   */
  this.treeSource = undefined;

  /**
   * @type {boolean}
   * @export
   */
  this.queryActive = true;

  gmfThemes.getThemesObject().then(function(themes) {
    if (themes) {
      this.themes = themes;
      this.treeSource = themes[3];
    }
  }.bind(this));

  ngeoFeatureOverlayMgr.init(this.map);
};

app.module.controller('MainController', app.MainController);


text:
export default function(clickable, is) {
  return function(obj) {
    return {
      ...obj,
      ...{
        create: clickable('[data-test-create]'),
        createIsEnabled: is(':not(:disabled)', '[data-test-create]'),
      },
    };
  };
}


text:
exports.name = 'https';
exports.category = 'NativeModule';
exports.context = 'use require';
exports.homepage = 'http://nodejs.org/api/https.html';
exports.description = [
 "\t# HTTPS".red
,"\t"
,"\tHTTPS is the HTTP protocol over TLS/SSL. In Node this is implemented as a"
,"\tseparate module."
,"\t"
,"\t## Class: https.Server".cyan
,"\t"
,"\tThis class is a subclass of `tls.Server` and emits events same as"
,"\t`http.Server`. See `http.Server` for more information."
,"\t"
,"\t## https.createServer(options, [requestListener])".cyan
,"\t"
,"\tReturns a new HTTPS web server object. The `options` is similar to"
,"\t`tls.createServer()`. The `requestListener` is a function which is"
,"\tautomatically added to the `'request'` event."
,"\t"
,"\tExample:"
,"\t"
,"\t    // curl -k https://localhost:8000/".green
,"\t    var https = require('https');".green
,"\t    var fs = require('fs');".green
,"\t".green
,"\t    var options = {".green
,"\t      key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),".green
,"\t      cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')".green
,"\t    };".green
,"\t".green
,"\t    https.createServer(options, function (req, res) {".green
,"\t      res.writeHead(200);".green
,"\t      res.end(\"hello world\n\");".green
,"\t    }).listen(8000);".green
,"\t"
,"\t"
,"\t## https.request(options, callback)".cyan
,"\t"
,"\tMakes a request to a secure web server."
,"\tAll options from [http.request()](http.html#http.request) are valid."
,"\t"
,"\tExample:"
,"\t"
,"\t    var https = require('https');".green
,"\t".green
,"\t    var options = {".green
,"\t      host: 'encrypted.google.com',".green
,"\t      port: 443,".green
,"\t      path: '/',".green
,"\t      method: 'GET'".green
,"\t    };".green
,"\t".green
,"\t    var req = https.request(options, function(res) {".green
,"\t      console.log(\"statusCode: \", res.statusCode);".green
,"\t      console.log(\"headers: \", res.headers);".green
,"\t".green
,"\t      res.on('data', function(d) {".green
,"\t        process.stdout.write(d);".green
,"\t      });".green
,"\t    });".green
,"\t    req.end();".green
,"\t".green
,"\t    req.on('error', function(e) {".green
,"\t      console.error(e);".green
,"\t    });".green
,"\t"
,"\tThe options argument has the following options"
,"\t"
,"\t- host: IP or domain of host to make request to. Defaults to `'localhost'`."
,"\t- port: port of host to request to. Defaults to 443."
,"\t- path: Path to request. Default `'/'`."
,"\t- method: HTTP request method. Default `'GET'`."
,"\t"
,"\t- `host`: A domain name or IP address of the server to issue the request to."
,"\t  Defaults to `'localhost'`."
,"\t- `hostname`: To support `url.parse()` `hostname` is preferred over `host`"
,"\t- `port`: Port of remote server. Defaults to 443."
,"\t- `method`: A string specifying the HTTP request method. Defaults to `'GET'`."
,"\t- `path`: Request path. Defaults to `'/'`. Should include query string if any."
,"\t  E.G. `'/index.html?page=12'`"
,"\t- `headers`: An object containing request headers."
,"\t- `auth`: Basic authentication i.e. `'user:password'` to compute an"
,"\t  Authorization header."
,"\t- `agent`: Controls [Agent](#https.Agent) behavior. When an Agent is"
,"\t  used request will default to `Connection: keep-alive`. Possible values:"
,"\t - `undefined` (default): use [globalAgent](#https.globalAgent) for this"
,"\t   host and port."
,"\t - `Agent` object: explicitly use the passed in `Agent`."
,"\t - `false`: opts out of connection pooling with an Agent, defaults request to"
,"\t   `Connection: close`."
,"\t"
,"\tThe following options from [tls.connect()](tls.html#tls.connect) can also be"
,"\tspecified. However, a [globalAgent](#https.globalAgent) silently ignores these."
,"\t"
,"\t- `key`: Private key to use for SSL. Default `null`."
,"\t- `passphrase`: A string of passphrase for the private key. Default `null`."
,"\t- `cert`: Public x509 certificate to use. Default `null`."
,"\t- `ca`: An authority certificate or array of authority certificates to check"
,"\t  the remote host against."
,"\t"
,"\tIn order to specify these options, use a custom `Agent`."
,"\t"
,"\tExample:"
,"\t"
,"\t    var options = {".green
,"\t      host: 'encrypted.google.com',".green
,"\t      port: 443,".green
,"\t      path: '/',".green
,"\t      method: 'GET',".green
,"\t      key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),".green
,"\t      cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')".green
,"\t    };".green
,"\t    options.agent = new https.Agent(options);".green
,"\t".green
,"\t    var req = https.request(options, function(res) {".green
,"\t      ...".green
,"\t    }".green
,"\t"
,"\tOr does not use an `Agent`.".yellow
,"\t"
,"\tExample:"
,"\t"
,"\t    var options = {".green
,"\t      host: 'encrypted.google.com',".green
,"\t      port: 443,".green
,"\t      path: '/',".green
,"\t      method: 'GET',".green
,"\t      key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),".green
,"\t      cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),".green
,"\t      agent: false".green
,"\t    };".green
,"\t".green
,"\t    var req = https.request(options, function(res) {".green
,"\t      ...".green
,"\t    }".green
,"\t"
,"\t## https.get(options, callback)".cyan
,"\t"
,"\tLike `http.get()` but for HTTPS."
,"\t"
,"\tExample:"
,"\t"
,"\t    var https = require('https');".green
,"\t".green
,"\t    https.get({ host: 'encrypted.google.com', path: '/' }, function(res) {".green
,"\t      console.log(\"statusCode: \", res.statusCode);".green
,"\t      console.log(\"headers: \", res.headers);".green
,"\t".green
,"\t      res.on('data', function(d) {".green
,"\t        process.stdout.write(d);".green
,"\t      });".green
,"\t".green
,"\t    }).on('error', function(e) {".green
,"\t      console.error(e);".green
,"\t    });".green
,"\t"
,"\t"
,"\t## Class: https.Agent".cyan
,"\t"
,"\tAn Agent object for HTTPS similar to [http.Agent](http.html#http.Agent)."
,"\tSee [https.request()](#https.request) for more information."
,"\t"
,"\t"
,"\t## https.globalAgent".cyan
,"\t"
,"\tGlobal instance of [https.Agent](#https.Agent) which is used as the default"
,"\tfor all HTTPS client requests."
].join('\n');


text:
require "csv"
require 'date'

#TO-DO add check if updated compared with last download time from crawl_data_table before changing it
def group_value(a)
  a.group_by do |e|
    e
  end.values.max_by(&:size)
end

f2 = File.new("crawl_data_table.csv", "w")
CSV.foreach("result.csv") do |row|
  cycle=[]
  count=0
  date = CSV.parse(row[4])[0]
  id = row[0]
  parentUrl = row[6]
  lastUpdateDate = DateTime.now
  newDate =[]
  cycleNum=0
unless date.nil?
  for i in 0..date.size-1
    unless date[i].nil?
      newDate[i] = date[i].gsub(/[年月]/,'-').chop
    end
  end
 unless newDate[0].nil?
 if Date.parse(newDate[0])>Date.parse("13-12-1")

 #print newDate
 for i in 0..newDate.size-2
    cycle[count]=(Date.parse(newDate[i])-Date.parse(newDate[i+1])).to_i
     if cycle[0] == 0
 	puts id+"!!!!!!!!!!!!!! is having more than one latest release"
    end
    count = count+1
  end
  #print cycle
  groupedValue = group_value(cycle)
  unless groupedValue.nil?
   puts id
    if groupedValue.first==0
       cycleNum = (cycle.instance_eval { reduce(:+) / size.to_f } ).to_i
       cycleNum = cycleNum==0 ? 1 : cycleNum
    else
       cycleNum = groupedValue.first
    end
  f2.puts '"'+id+'",'+'"'+parentUrl+'",'+'"'+cycleNum.to_s+'",' + '"'+lastUpdateDate.to_s+'"'
  end

  end
  end
end

end


text:
package jp.rte.core.utils.string;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TextUtils {
    static Pattern DOMAIN = Pattern
        .compile("https?:\\/\\/[-_.!~*'()a-zA-Z0-9;?:\\@&=+\\$,%#]+\\/");

    public static String createDigest(String source)
            throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5");

        byte[] data = source.getBytes();
        md.update(data);

        byte[] digest = md.digest();

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < digest.length; i++) {
            int b = (0xFF & digest[i]);
            if (b < 16)
                sb.append("0");
            sb.append(Integer.toHexString(b));
        }
        return sb.toString();
    }

    /**
     * URLからドメインだけを抽出
     *
     * @param url
     * @return
     */
    public static String getDomain(String url) {
        String domain = null;
        Matcher m = DOMAIN.matcher(url);
        if (m.find()) {
            domain = m.group(0);
        }
        return domain;
    }

    public static Integer[] toIntegerArray(String[] strings) {
        List<String> list = Arrays.asList(strings);
        List<Integer> list2 = new ArrayList<Integer>();
        for (String string : list) {
            list2.add(Integer.parseInt(string));
        }
        return (Integer[]) list2.toArray(new Integer[0]);
    }

    public static String trimString(String str, Integer len, String charset) {
        StringBuffer sb = new StringBuffer();
        int cnt = 0;

        try {
            for (int i = 0; i < str.length(); i++) {
                String tmpStr = str.substring(i, i + 1);
                byte[] b = tmpStr.getBytes(charset);
                if (cnt + b.length > len) {
                    return sb.toString();
                } else {
                    sb.append(tmpStr);
                    cnt += b.length;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sb.toString();
    }

}


text:
namespace content {

ServiceRegistryImpl::ServiceRegistryImpl()
    : bound_(false), weak_factory_(this) {
}

ServiceRegistryImpl::ServiceRegistryImpl(mojo::ScopedMessagePipeHandle handle)
    : bound_(false), weak_factory_(this) {
  BindRemoteServiceProvider(handle.Pass());
}

ServiceRegistryImpl::~ServiceRegistryImpl() {
  while (!pending_connects_.empty()) {
    mojo::CloseRaw(pending_connects_.front().second);
    pending_connects_.pop();
  }
}

void ServiceRegistryImpl::BindRemoteServiceProvider(
    mojo::ScopedMessagePipeHandle handle) {
  CHECK(!bound_);
  bound_ = true;
  mojo::WeakBindToPipe(this, handle.Pass());
  while (!pending_connects_.empty()) {
    client()->ConnectToService(
        mojo::String::From(pending_connects_.front().first),
        mojo::ScopedMessagePipeHandle(pending_connects_.front().second));
    pending_connects_.pop();
  }
}

void ServiceRegistryImpl::OnConnectionError() {
  // TODO(sammc): Support reporting this to our owner.
}

void ServiceRegistryImpl::AddService(
    const std::string& service_name,
    const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory) {
  service_factories_[service_name] = service_factory;
}

void ServiceRegistryImpl::RemoveService(const std::string& service_name) {
  service_factories_.erase(service_name);
}

void ServiceRegistryImpl::ConnectToRemoteService(
    const base::StringPiece& service_name,
    mojo::ScopedMessagePipeHandle handle) {
  if (!bound_) {
    pending_connects_.push(
        std::make_pair(service_name.as_string(), handle.release()));
    return;
  }
  client()->ConnectToService(mojo::String::From(service_name), handle.Pass());
}

base::WeakPtr<ServiceRegistry> ServiceRegistryImpl::GetWeakPtr() {
  return weak_factory_.GetWeakPtr();
}

void ServiceRegistryImpl::ConnectToService(
    const mojo::String& name,
    mojo::ScopedMessagePipeHandle client_handle) {
  std::map<std::string,
           base::Callback<void(mojo::ScopedMessagePipeHandle)> >::iterator it =
      service_factories_.find(name);
  if (it == service_factories_.end())
    return;

  it->second.Run(client_handle.Pass());
}

}  // namespace content