text:
namespace content {
namespace {

int RenderProcessHostCount() {
  content::RenderProcessHost::iterator hosts =
      content::RenderProcessHost::AllHostsIterator();
  int count = 0;
  while (!hosts.IsAtEnd()) {
    if (hosts.GetCurrentValue()->HasConnection())
      count++;
    hosts.Advance();
  }
  return count;
}

class RenderProcessHostTest : public ContentBrowserTest,
                              public RenderProcessHostObserver {
 public:
  RenderProcessHostTest() : process_exits_(0), host_destructions_(0) {}

 protected:
  // RenderProcessHostObserver:
  void RenderProcessExited(RenderProcessHost* host,
                           base::TerminationStatus status,
                           int exit_code) override {
    ++process_exits_;
  }
  void RenderProcessHostDestroyed(RenderProcessHost* host) override {
    ++host_destructions_;
  }

  int process_exits_;
  int host_destructions_;
};

// Sometimes the renderer process's ShutdownRequest (corresponding to the
// ViewMsg_WasSwappedOut from a previous navigation) doesn't arrive until after
// the browser process decides to re-use the renderer for a new purpose.  This
// test makes sure the browser doesn't let the renderer die in that case.  See
// http://crbug.com/87176.
IN_PROC_BROWSER_TEST_F(RenderProcessHostTest,
                       ShutdownRequestFromActiveTabIgnored) {
  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());

  GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
  NavigateToURL(shell(), test_url);
  RenderProcessHost* rph =
      shell()->web_contents()->GetRenderViewHost()->GetProcess();

  host_destructions_ = 0;
  process_exits_ = 0;
  rph->AddObserver(this);
  ChildProcessHostMsg_ShutdownRequest msg;
  rph->OnMessageReceived(msg);

  // If the RPH sends a mistaken ChildProcessMsg_Shutdown, the renderer process
  // will take some time to die. Wait for a second tab to load in order to give
  // that time to happen.
  NavigateToURL(CreateBrowser(), test_url);

  EXPECT_EQ(0, process_exits_);
  if (!host_destructions_)
    rph->RemoveObserver(this);
}

IN_PROC_BROWSER_TEST_F(RenderProcessHostTest,
                       GuestsAreNotSuitableHosts) {
  // Set max renderers to 1 to force running out of processes.
  content::RenderProcessHost::SetMaxRendererProcessCount(1);

  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());

  GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
  NavigateToURL(shell(), test_url);
  RenderProcessHost* rph =
      shell()->web_contents()->GetRenderViewHost()->GetProcess();
  // Make it believe it's a guest.
  reinterpret_cast<RenderProcessHostImpl*>(rph)->
      set_is_isolated_guest_for_testing(true);
  EXPECT_EQ(1, RenderProcessHostCount());

  // Navigate to a different page.
  GURL::Replacements replace_host;
  std::string host_str("localhost");  // Must stay in scope with replace_host.
  replace_host.SetHostStr(host_str);
  GURL another_url = embedded_test_server()->GetURL("/simple_page.html");
  another_url = another_url.ReplaceComponents(replace_host);
  NavigateToURL(CreateBrowser(), another_url);

  // Expect that we got another process (the guest renderer was not reused).
  EXPECT_EQ(2, RenderProcessHostCount());
}

class ShellCloser : public RenderProcessHostObserver {
 public:
  ShellCloser(Shell* shell, std::string* logging_string)
      : shell_(shell), logging_string_(logging_string) {}

 protected:
  // RenderProcessHostObserver:
  void RenderProcessExited(RenderProcessHost* host,
                           base::TerminationStatus status,
                           int exit_code) override {
    logging_string_->append("ShellCloser::RenderProcessExited ");
    shell_->Close();
  }

  void RenderProcessHostDestroyed(RenderProcessHost* host) override {
    logging_string_->append("ShellCloser::RenderProcessHostDestroyed ");
  }

  Shell* shell_;
  std::string* logging_string_;
};

class ObserverLogger : public RenderProcessHostObserver {
 public:
  explicit ObserverLogger(std::string* logging_string)
      : logging_string_(logging_string), host_destroyed_(false) {}

  bool host_destroyed() { return host_destroyed_; }

 protected:
  // RenderProcessHostObserver:
  void RenderProcessExited(RenderProcessHost* host,
                           base::TerminationStatus status,
                           int exit_code) override {
    logging_string_->append("ObserverLogger::RenderProcessExited ");
  }

  void RenderProcessHostDestroyed(RenderProcessHost* host) override {
    logging_string_->append("ObserverLogger::RenderProcessHostDestroyed ");
    host_destroyed_ = true;
  }

  std::string* logging_string_;
  bool host_destroyed_;
};

IN_PROC_BROWSER_TEST_F(RenderProcessHostTest,
                       AllProcessExitedCallsBeforeAnyHostDestroyedCalls) {
  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());

  GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
  NavigateToURL(shell(), test_url);

  std::string logging_string;
  ShellCloser shell_closer(shell(), &logging_string);
  ObserverLogger observer_logger(&logging_string);
  RenderProcessHost* rph =
      shell()->web_contents()->GetRenderViewHost()->GetProcess();

  // Ensure that the ShellCloser observer is first, so that it will have first
  // dibs on the ProcessExited callback.
  rph->AddObserver(&shell_closer);
  rph->AddObserver(&observer_logger);

  // This will crash the render process, and start all the callbacks.
  // We can't use NavigateToURL here since it accesses the shell() after
  // navigating, which the shell_closer deletes.
  NavigateToURLBlockUntilNavigationsComplete(
      shell(), GURL(kChromeUICrashURL), 1);

  // The key here is that all the RenderProcessExited callbacks precede all the
  // RenderProcessHostDestroyed callbacks.
  EXPECT_EQ("ShellCloser::RenderProcessExited "
            "ObserverLogger::RenderProcessExited "
            "ShellCloser::RenderProcessHostDestroyed "
            "ObserverLogger::RenderProcessHostDestroyed ", logging_string);

  // If the test fails, and somehow the RPH is still alive somehow, at least
  // deregister the observers so that the test fails and doesn't also crash.
  if (!observer_logger.host_destroyed()) {
    rph->RemoveObserver(&shell_closer);
    rph->RemoveObserver(&observer_logger);
  }
}

#if defined(OS_WIN)
// Provides functionality to test renderer processes with the Win32K lockdown
// process mitigation.
class Win32KLockdownRendererProcessHostTest : public RenderProcessHostTest {
 public:
  Win32KLockdownRendererProcessHostTest() {}

  virtual ~Win32KLockdownRendererProcessHostTest() {}

 protected:
  virtual void SetUp() override {
    base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
    command_line->AppendSwitch(switches::kEnableWin32kRendererLockDown);
    RenderProcessHostTest::SetUp();
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(Win32KLockdownRendererProcessHostTest);
};

// Tests whether navigation requests with the Win32K lockdown mitigation set
// work correctly.
IN_PROC_BROWSER_TEST_F(Win32KLockdownRendererProcessHostTest,
                       RendererWin32KLockdownNavigationTest) {
  if (base::win::GetVersion() < base::win::VERSION_WIN8)
    return;

  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());

  GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
  NavigateToURL(shell(), test_url);

  EXPECT_EQ(1, RenderProcessHostCount());
  EXPECT_EQ(0, process_exits_);
}
#endif

}  // namespace
}  // namespace content


text:
package com.woocommerce;

/**
 * Enum with possible HTTP Methods of a Request.
 *
 */
public enum HttpsMethod {

    GET, POST, PUT, DELETE
}

redpajama_set_name: RedPajamaGithub


text:
package com.bstek.bdf3.security.ui.builder;

import java.util.Collection;

import com.bstek.dorado.view.widget.Component;
import com.bstek.dorado.view.widget.Container;
import com.bstek.dorado.view.widget.base.Panel;

@org.springframework.stereotype.Component("maintain.containerBuilder")
public class ContainerBuilder extends AbstractBuilder<Container> {

	protected Collection<Component> getChildren(Container container){
		return container.getChildren();
	}

	public boolean support(Object control) {
		return (control instanceof Container) && !(control instanceof Panel);
	}

}


text:
module Perf {

	interface IPerfMethods {
		getPageLoadTimeline();
	}

	export class Perf implements IPerfMethods{
		getPageLoadTimeline() {

		}
	}

}


text:
```ts
entriesAsObject(entries: [string | number, any][]): object
```

Converts an array of key-value pairs into an object.

## Parameters

* `entries`: An array of key-value pairs.

## Return value

An object whose keys are the first elements of the entries and whose values are the second elements of the entries.

## See also

* https://gist.github.com/lukehorvat/133e2293ba6ae96a35ba


text:
import template from './accountingStripeEvents.html';
import controller from './accountingStripeEvents.controller';
import './accountingStripeEvents.styl';

let accountingStripeEventsComponent = {
  restrict: 'E',
  bindings: {},
  template,
  controller
};

export default accountingStripeEventsComponent;


text:
package ru.job4j.loop;

/**
* Paint.
* @author mignashov
* @since 29.03.2017
* @version 1.0
*/
public class Paint {
	/**
	* Painting pyramid.
	* @param h  - height.
	* @return pyramid.
	*/
	public String piramid(int h) {
		StringBuilder sBuilder = new StringBuilder();
		int pWidth = h - 1 + h;
		for (int height = 1; height <= h; height++) {
			int spaces = h - height;
			int endPir = pWidth - spaces;
			for (int width = 1; width <= pWidth; width++) {
				if ((spaces < width) & (width <= endPir)) {
					sBuilder.append("^");
				} else {
					sBuilder.append(" ");
				}
			}
			if (height != h) {
				sBuilder.append(System.getProperty("line.separator"));
			}
		}
		return sBuilder.toString();
	}
}


text:
<?php

function string_starts_with($haystack, $needle)
{
  $length = strlen($needle);
  return (substr($haystack, 0, $length) === $needle);
}


text:
using System;
using Humanizer.Bytes;
using Humanizer.Localisation;
using Xunit;

namespace Humanizer.Tests.Bytes
{
    [UseCulture("en")]
    public class ByteRateTests
    {
        [Theory]
        [InlineData(400, 1, "400 B/s")]
        [InlineData(4 * 1024, 1, "4 KB/s")]
        [InlineData(4 * 1024 * 1024, 1, "4 MB/s")]
        [InlineData(4 * 2 * 1024 * 1024, 2, "4 MB/s")]
        [InlineData(4 * 1024, 0.1, "40 KB/s")]
        [InlineData(15 * 60 * 1024 * 1024, 60, "15 MB/s")]
        public void HumanizesRates(long inputBytes, double perSeconds, string expectedValue)
        {
            var size = new ByteSize(inputBytes);
            var interval = TimeSpan.FromSeconds(perSeconds);

            var rate = size.Per(interval).Humanize();

            Assert.Equal(expectedValue, rate);
        }

        [Theory]
        [InlineData(1, 1, TimeUnit.Second, "1 MB/s")]
        [InlineData(1, 60, TimeUnit.Minute, "1 MB/min")]
        [InlineData(1, 60 * 60, TimeUnit.Hour, "1 MB/hour")]
        [InlineData(10, 1, TimeUnit.Second, "10 MB/s")]
        [InlineData(10, 60, TimeUnit.Minute, "10 MB/min")]
        [InlineData(10, 60 * 60, TimeUnit.Hour, "10 MB/hour")]
        [InlineData(1, 10 * 1, TimeUnit.Second, "102.4 KB/s")]
        [InlineData(1, 10 * 60, TimeUnit.Minute, "102.4 KB/min")]
        [InlineData(1, 10 * 60 * 60, TimeUnit.Hour, "102.4 KB/hour")]
        public void TimeUnitTests(long megabytes, double measurementIntervalSeconds, TimeUnit displayInterval, string expectedValue)
        {
            var size = ByteSize.FromMegabytes(megabytes);
            var measurementInterval = TimeSpan.FromSeconds(measurementIntervalSeconds);

            var rate = size.Per(measurementInterval);
            var text = rate.Humanize(displayInterval);

            Assert.Equal(expectedValue, text);
        }

        [Theory]
        [InlineData(19854651984, 1, TimeUnit.Second, null, "18.4910856038332 GB/s")]
        [InlineData(19854651984, 1, TimeUnit.Second, "#.##", "18.49 GB/s")]
        public void FormattedTimeUnitTests(long bytes, int measurementIntervalSeconds, TimeUnit displayInterval, string format, string expectedValue)
        {
            var size = ByteSize.FromBytes(bytes);
            var measurementInterval = TimeSpan.FromSeconds(measurementIntervalSeconds);
            var rate = size.Per(measurementInterval);
            var text = rate.Humanize(format, displayInterval);

            Assert.Equal(expectedValue, text);
        }

        [Theory]
        [InlineData(TimeUnit.Millisecond)]
        [InlineData(TimeUnit.Day)]
        [InlineData(TimeUnit.Month)]
        [InlineData(TimeUnit.Week)]
        [InlineData(TimeUnit.Year)]
        public void ThowsOnUnsupportedData(TimeUnit units)
        {
            var dummyRate = ByteSize.FromBits(1).Per(TimeSpan.FromSeconds(1));

            Assert.Throws<NotSupportedException>(() =>
            {
                dummyRate.Humanize(units);
            });
        }

    }
}


text:
package com.mpush.bootstrap.job;

import com.mpush.api.service.Listener;
import com.mpush.api.service.Server;
import com.mpush.api.spi.common.ServiceRegistryFactory;
import com.mpush.api.srd.ServiceNode;
import com.mpush.tools.log.Logs;

/**
 * Created by yxx on 2016/5/14.
 *
 * @author ohun@live.cn
 */
public final class ServerBoot extends BootJob {
    private final Server server;
    private final ServiceNode node;

    public ServerBoot(Server server, ServiceNode node) {
        this.server = server;
        this.node = node;
    }

    @Override
    public void start() {
        server.init();
        server.start(new Listener() {
            @Override
            public void onSuccess(Object... args) {
                Logs.Console.info("start {} success on:{}", server.getClass().getSimpleName(), args[0]);
                if (node != null) {//注册应用到zk
                    ServiceRegistryFactory.create().register(node);
                    Logs.RSD.info("register {} to srd success.", node);
                }
                startNext();
            }

            @Override
            public void onFailure(Throwable cause) {
                Logs.Console.error("start {} failure, jvm exit with code -1", server.getClass().getSimpleName(), cause);
                System.exit(-1);
            }
        });
    }

    @Override
    protected void stop() {
        stopNext();
        if (node != null) {
            ServiceRegistryFactory.create().deregister(node);
        }
        Logs.Console.info("try shutdown {}...", server.getClass().getSimpleName());
        server.stop().join();
        Logs.Console.info("{} shutdown success.", server.getClass().getSimpleName());
    }

    @Override
    protected String getName() {
        return super.getName() + '(' + server.getClass().getSimpleName() + ')';
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Bacidia silvicola Malme

### Remarks
null


text:
/* jslint node: true */
'use strict';

//  enigma-bbs
const { MenuModule } = require('../core/menu_module.js');
const { resetScreen } = require('../core/ansi_term.js');
const { Errors } = require('../core/enig_error.js');

//  deps
const async = require('async');
const _ = require('lodash');
const SSHClient = require('ssh2').Client;

exports.moduleInfo = {
    name: 'ArchaicNET',
    desc: 'ArchaicNET Access Module',
    author: 'NuSkooler',
};

exports.getModule = class ArchaicNETModule extends MenuModule {
    constructor(options) {
        super(options);

        //  establish defaults
        this.config = options.menuConfig.config;
        this.config.host = this.config.host || 'bbs.archaicbinary.net';
        this.config.sshPort = this.config.sshPort || 2222;
        this.config.rloginPort = this.config.rloginPort || 8513;
    }

    initSequence() {
        let clientTerminated;
        const self = this;

        async.series(
            [
                function validateConfig(callback) {
                    const reqConfs = ['username', 'password', 'bbsTag'];
                    for (let req of reqConfs) {
                        if (!_.isString(_.get(self, ['config', req]))) {
                            return callback(
                                Errors.MissingConfig(`Config requires "${req}"`)
                            );
                        }
                    }
                    return callback(null);
                },
                function establishSecureConnection(callback) {
                    self.client.term.write(resetScreen());
                    self.client.term.write('Connecting to ArchaicNET, please wait...\n');

                    const sshClient = new SSHClient();

                    let needRestore = false;
                    //let pipedStream;
                    const restorePipe = function () {
                        if (needRestore && !clientTerminated) {
                            self.client.restoreDataHandler();
                            needRestore = false;
                        }
                    };

                    sshClient.on('ready', () => {
                        //  track client termination so we can clean up early
                        self.client.once('end', () => {
                            self.client.log.info(
                                'Connection ended. Terminating ArchaicNET connection'
                            );
                            clientTerminated = true;
                            return sshClient.end();
                        });

                        //  establish tunnel for rlogin
                        const fwdPort = self.config.rloginPort + self.client.node;
                        sshClient.forwardOut(
                            '127.0.0.1',
                            fwdPort,
                            self.config.host,
                            self.config.rloginPort,
                            (err, stream) => {
                                if (err) {
                                    return sshClient.end();
                                }

                                //
                                //  Send rlogin - [<bbsTag>]<userName> e.g. [Xibalba]NuSkooler
                                //
                                const rlogin = `\x00${self.client.user.username}\x00[${self.config.bbsTag}]${self.client.user.username}\x00${self.client.term.termType}\x00`;
                                stream.write(rlogin);

                                //  we need to filter I/O for escape/de-escaping zmodem and the like
                                self.client.setTemporaryDirectDataHandler(data => {
                                    const tmp = data
                                        .toString('binary')
                                        .replace(/\xff{2}/g, '\xff'); //  de-escape
                                    stream.write(Buffer.from(tmp, 'binary'));
                                });
                                needRestore = true;

                                stream.on('data', data => {
                                    const tmp = data
                                        .toString('binary')
                                        .replace(/\xff/g, '\xff\xff'); //  escape
                                    self.client.term.rawWrite(Buffer.from(tmp, 'binary'));
                                });

                                stream.on('close', () => {
                                    restorePipe();
                                    return sshClient.end();
                                });
                            }
                        );
                    });

                    sshClient.on('error', err => {
                        return self.client.log.info(
                            `ArchaicNET SSH client error: ${err.message}`
                        );
                    });

                    sshClient.on('close', hadError => {
                        if (hadError) {
                            self.client.warn('Closing ArchaicNET SSH due to error');
                        }
                        restorePipe();
                        return callback(null);
                    });

                    self.client.log.trace(
                        { host: self.config.host, port: self.config.sshPort },
                        'Connecting to ArchaicNET'
                    );
                    sshClient.connect({
                        host: self.config.host,
                        port: self.config.sshPort,
                        username: self.config.username,
                        password: self.config.password,
                    });
                },
            ],
            err => {
                if (err) {
                    self.client.log.warn({ error: err.message }, 'ArchaicNET error');
                }

                //  if the client is stil here, go to previous
                if (!clientTerminated) {
                    self.prevMenu();
                }
            }
        );
    }
};


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

<!--
  ~ Copyright (C) 2015 LAM Creations
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resources>

    <style name="Theme.Scaffold.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="scaffoldTheme">true</item>
        <item name="colorPrimary">@color/scaffold_primary</item>
        <item name="colorPrimaryDark">@color/scaffold_primaryDark</item>
        <item name="colorAccent">@color/scaffold_accent</item>
        <item name="colorControlNormal">@color/scaffold_controlNormal</item>
        <item name="colorControlActivated">@color/scaffold_controlActivated</item>
        <item name="colorControlHighlight">@color/scaffold_controlHighlight</item>
        <item name="colorButtonNormal">@color/scaffold_buttonNormal</item>
        <item name="colorSwitchThumbNormal">@color/scaffold_switchThumbNormal</item>

        <item name="android:windowBackground">@color/scaffold_windowBackgroundDark</item>
        <item name="android:textColorPrimary">@color/scaffold_textPrimaryDarkBackground</item>
        <item name="android:textColorSecondary">@color/scaffold_textSecondaryDarkBackground</item>
        <item name="android:textColorHint">@color/scaffold_textHintDarkBackground</item>
    </style>

    <style name="Theme.Scaffold.Base.Light" parent="Theme.Scaffold.Base">
        <item name="android:windowBackground">@color/scaffold_windowBackground</item>
        <item name="android:textColorPrimary">@color/scaffold_textPrimaryLightBackground</item>
        <item name="android:textColorSecondary">@color/scaffold_textSecondaryLightBackground</item>
        <item name="android:textColorHint">@color/scaffold_textHintLightBackground</item>
    </style>

    <style name="Theme.Scaffold.Light.LightActionBar" parent="Theme.Scaffold.Base.Light">
        <item name="drawerArrowStyle">@style/ScaffoldDrawerArrowStyle.LightActionBar</item>
    </style>

    <style name="Theme.Scaffold.Light.DarkActionBar" parent="Theme.Scaffold.Base.Light">
        <item name="drawerArrowStyle">@style/ScaffoldDrawerArrowStyle.DarkActionBar</item>
    </style>

    <style name="Theme.Scaffold.DarkActionBar" parent="Theme.Scaffold.Base">
        <item name="drawerArrowStyle">@style/ScaffoldDrawerArrowStyle.DarkActionBar</item>
    </style>

    <style name="ScaffoldNavigationView">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">match_parent</item>
        <item name="itemIconTint">@color/scaffold_navigation_drawer_item_icon_tint</item>
        <item name="itemTextColor">@color/scaffold_navigation_drawer_item_text_color</item>
    </style>

    <style name="ScaffoldAppBarLayout" parent="ThemeOverlay.AppCompat.ActionBar" />

    <style name="ScaffoldActionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="ScaffoldToolbar">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">?attr/actionBarSize</item>
        <item name="android:background">?attr/colorPrimary</item>
        <item name="android:theme">@style/ScaffoldActionBarTheme</item>
        <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    </style>

    <style name="ScaffoldTabToolbar" parent="ScaffoldToolbar"/>

    <style name="ScaffoldCollapsingToolbar">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">?attr/actionBarSize</item>
        <item name="android:theme">@style/ScaffoldActionBarTheme</item>
        <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    </style>

    <style name="ScaffoldDrawerArrowStyle.LightActionBar" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">false</item>
        <item name="color">@color/scaffold_textPrimaryLightBackground</item>
    </style>

    <style name="ScaffoldDrawerArrowStyle.DarkActionBar" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">false</item>
        <item name="color">@color/scaffold_textPrimaryDarkBackground</item>
    </style>

    <style name="ScaffoldHorizontalSpacer">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">1dp</item>
        <item name="android:layout_weight">1</item>
    </style>

    <style name="ScaffoldVerticalSpacer">
        <item name="android:layout_width">1dp</item>
        <item name="android:layout_height">0dp</item>
        <item name="android:layout_weight">1</item>
    </style>

    <style name="ScaffoldDivider">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">1dp</item>
    </style>

    <style name="ScaffoldNavigationHeaderView">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">180dp</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderBackgroundImage">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:scaleType">centerCrop</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderBackgroundImageOverlay">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:alpha">0.15</item>
        <item name="android:src">@android:color/black</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderContainer">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:paddingBottom">@dimen/scaffold_navigation_header_margin</item>
        <item name="android:paddingLeft">@dimen/scaffold_navigation_header_margin</item>
        <item name="android:paddingRight">@dimen/scaffold_navigation_header_margin</item>
        <item name="android:paddingTop">@dimen/scaffold_navigation_header_margin_top</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderAccountImageContainer">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_alignParentTop">true</item>
        <item name="android:orientation">horizontal</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderCurrentAccountImage">
        <item name="android:layout_width">
            @dimen/scaffold_navigation_header_current_account_image_size
        </item>
        <item name="android:layout_height">
            @dimen/scaffold_navigation_header_current_account_image_size
        </item>
        <item name="riv_border_color">@android:color/white</item>
        <item name="riv_border_width">
            @dimen/scaffold_navigation_header_current_account_image_border_width
        </item>
        <item name="riv_oval">true</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderAltAccountImage">
        <item name="android:layout_width">@dimen/scaffold_navigation_header_alt_account_image_size
        </item>
        <item name="android:layout_height">
            @dimen/scaffold_navigation_header_alt_account_image_size
        </item>
        <item name="android:layout_marginLeft">
            @dimen/scaffold_navigation_header_alt_account_image_margin
        </item>
        <item name="android:layout_marginRight">
            @dimen/scaffold_navigation_header_alt_account_image_margin
        </item>
        <item name="riv_oval">true</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderAccountDropDownButton">
        <item name="android:layout_width">56dp</item>
        <item name="android:layout_height">56dp</item>
        <item name="android:layout_gravity">bottom</item>
        <item name="android:background">?attr/selectableItemBackgroundBorderless</item>
        <item name="android:scaleType">centerInside</item>
        <item name="android:tint">@android:color/white</item>
        <item name="android:src">@drawable/scaffold_ic_arrow_drop_down_18dp</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderCurrentAccountName">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
    </style>

    <style name="ScaffoldNavigationViewHeaderCurrentAccountEmail">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
    </style>

    <style name="ScaffoldFloatingActionButton">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginTop">16dp</item>
        <item name="android:layout_marginBottom">16dp</item>
        <item name="android:layout_marginLeft">16dp</item>
        <item name="android:layout_marginRight">16dp</item>
        <item name="android:src">@drawable/scaffold_ic_add_24dp</item>
        <item name="elevation">4dp</item>
        <item name="borderWidth">0dp</item>
        <item name="fabSize">normal</item>
    </style>

    <style name="ScaffoldTabLayout">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="Widget.Scaffold.CollapsingToolbarTabLayout" parent="android:Widget">
        <item name="scaffoldExpandedTitleMargin">32dp</item>
        <item name="scaffoldStatusBarScrim">?attr/colorPrimaryDark</item>
    </style>

    <style name="ScaffoldCollapsingToolbar.ExpandedTextAppearance" parent="TextAppearance.AppCompat.Display1">
        <item name="android:textColor">@android:color/white</item>
    </style>

    <style name="ScaffoldBottomNavigationViewLight">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
    </style>

    <style name="ScaffoldBottomNavigationView" parent="ScaffoldBottomNavigationViewLight">
        <item name="itemBackground">@color/scaffold_primary</item>
        <item name="itemIconTint">@color/scaffold_bottom_navigation_item_icon_tint</item>
        <item name="itemTextColor">@color/scaffold_bottom_navigation_item_text_color</item>
    </style>

</resources>


text:
[xml]$xamlSMBfull = @"
<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="250" Width="600">
    <Grid>
        <StackPanel Margin="5" Orientation="Vertical">
            <RadioButton x:Name="rbtn_SinglePC" GroupName="WCCheckMethod" Content="Single PC" IsChecked="True" Margin="5"/>
            <TextBox x:Name="txt_SinglePC" Margin="5" ToolTip="Type PC's name or IP-address"/>
            <RadioButton x:Name="rbtn_PCsList" GroupName="WCCheckMethod" Content="PCs List" Margin="5"/>
            <DockPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="5*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <TextBox x:Name="txt_PCsListFilePath" VerticalAlignment="Center" Margin="5" Grid.Column="0" ToolTip="Choose file for discovery"/>
                    <Button x:Name="btn_PCsListChoose" Content="PCs list file" VerticalAlignment="Center" Margin="5" Grid.Column="1"/>
                </Grid>
            </DockPanel>

            <DockPanel>
                <DockPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="5*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBox x:Name="txt_DiscoveryResults" VerticalAlignment="Center" Margin="5" Grid.Column="0" ToolTip="Choose file for results"/>
                        <Button x:Name="btn_DiscoveryResults" Content="Results File" VerticalAlignment="Center" Margin="5" Grid.Column="1"/>
                    </Grid>
                </DockPanel>
            </DockPanel>

            <DockPanel>
                <Button x:Name="btn_StartDiscovery" Content="Start Discovery" Margin="5"/>
            </DockPanel>

            <DockPanel>
                <Label x:Name="lbl_CurrentStatus" Content="Current Status will be show here" Margin="5"/>
            </DockPanel>

        </StackPanel>

    </Grid>
</Window>
"@

# Load requirements for form
[xml]$Global:xmlSMBWPF = $xamlSMBfull

try{
    Add-Type -AssemblyName PresentationCore,PresentationFramework,WindowsBase,system.windows.forms
} catch {
    Throw "Failed to load Windows Presentation Framework assemblies."
}

# Load form from XML
$Global:xamlSMBGUI = [Windows.Markup.XamlReader]::Load((new-object System.Xml.XmlNodeReader $xmlSMBWPF))

# Enumerate controls for form
$xmlSMBWPF.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | ForEach-Object{
    Set-Variable -Name ($_.Name) -Value $xamlSMBGUI.FindName($_.Name) -Scope Global
}

# This part was taken on
# Придумано не мной, взято здесь
# http://www.workingsysadmin.com/open-file-dialog-box-in-powershell/
# Thanx to Thomas Rayner, who posted this
# Всполмогательная функция для выбора файл
function Get-FileName ($initialDirectory) {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null

    $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
    $OpenFileDialog.InitialDirectory = $initialDirectory
    $OpenFileDialog.Filter = "Text file (*.txt)| *.txt"
    $OpenFileDialog.Title = "Choose file with PCs names for check updates"
    $OpenFileDialog.ShowDialog() | Out-Null
    $OpenFileDialog.FileName
}

function PrintSearchResults () {
    Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
}

####### Проверка на наличие обновлений для SMBv1 #######
####### Check patches for SMBv1 #######
# Список патчей был в сообщении в Telegram группе по SCCM, автора не запомнил, к сожалению
# Проверяем версию ОС для выбора правильного списка патчей
# Check OS version for choose correct patches list
function Get-DiscoveryPCs ($ComputersList) {

ForEach ($CurrentPC in $ComputersList) {
    $CurrentPC_OSVersion = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $CurrentPC).Version

        # Windows 7, 2008R2
        If ($CurrentPC_OSVersion -like "6.1*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012212' -or
                $_.HotFixID -eq 'KB4012215' -or
                $_.HotFixID -eq 'KB4015549' -or
                $_.HotFixID -eq 'KB4019264' -or
                $_.HotFixID -eq 'KB4015552'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Windows 8.1, 2012R2
        ElseIf ($CurrentPC_OSVersion -like "6.3*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012213' -or
                $_.HotFixID -eq 'KB4012216' -or
                $_.HotFixID -eq 'KB4015550' -or
                $_.HotFixID -eq 'KB4019215' -or
                $_.HotFixID -eq 'KB4015553'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Windows XP
        ElseIf ($CurrentPC_OSVersion -like "5.1*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012598'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Windows 2003
        ElseIf ($CurrentPC_OSVersion -like "5.2*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012598'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Windows 8, 2012
        ElseIf ($CurrentPC_OSVersion -like "6.2*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012214' -or
                $_.HotFixID -eq 'KB4012217' -or
                $_.HotFixID -eq 'KB4015551' -or
                $_.HotFixID -eq 'KB4019216'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Windows 2008
        ElseIf ($CurrentPC_OSVersion -like "6.0*") {
            Get-WmiObject -Class Win32_QuickFixEngineering -ComputerName $CurrentPC |
            Where-Object {
                $_.HotFixID -eq 'KB4012598'
            } |
            Format-Table -AutoSize -HideTableHeaders | Out-File -Append $txt_DiscoveryResults.Text -Encoding utf8
        }
        # Если ничего из этого, то просто выход для перехода к следующему по списку
        # Exit from cycle, if nothing founded
        Else {
            $NotifyExitMessage = "Undefined OS/no WC-patches/patches not described"
            Write-Host $CurrentPC $CurrentPC_OSVersion $NotifyExitMessage
        }
}
Write-Host "Release all search cycles"
}

### $ComputersList = "localhost"

# Describe form's controls
# Описываем управляющие элементы формы
$btn_PCsListChoose.Add_Click({
    # $ComputersList = Get-Content $WPFform_InputData
    # $WPFform_InputData = Get-FileName "$env:USERPROFILE\Desktop"
    # $txt_PCsListFilePath.Text = $WPFform_InputData
    $txt_PCsListFilePath.Text = Get-FileName "$env:USERPROFILE\Desktop"
})

$btn_DiscoveryResults.Add_Click({
    $txt_DiscoveryResults.Text = Get-FileName "$env:USERPROFILE\Desktop"
})

$btn_StartDiscovery.Add_Click({
    # Check search scope
    if ($rbtn_SinglePC.IsChecked -eq $true) {
        $ComputersList = $txt_SinglePC.Text
    }
    elseif ($rbtn_PCsList.IsChecked -eq $true) {
        $ComputersList = Get-Content $txt_PCsListFilePath.Text
    }

    # Notify: Start process
    $lbl_CurrentStatus.Content = "Start discovery"
    #$btn_StartDiscovery.Background = "Red"
    # Debug: write variable
#    Write-Host "Tracking list" $txt_PCsListFilePath.Text
    # Get list of Computers
#    $ComputersList = Get-Content $txt_PCsListFilePath.Text
    # Debug: write variable
#    Write-Host "Final list" $ComputersList
    # Job: Start working progress
    Get-DiscoveryPCs $ComputersList
    # Notify: End process
    $lbl_CurrentStatus.Content = "End discovery"
    $btn_StartDiscovery.Background = "Green"
})

# Show form for people! :-)
# Теперь всё готово, поэтому можно показать форму
$xamlSMBGUI.ShowDialog() | Out-Null


text:
DECL_NAMESPACE_MZ_NET_BEGIN

class TransmitSocket;

class SelectTransmitStrategy final : public SelectStrategy {
    MZ_DISALLOW_COPY_AND_ASSIGN(SelectTransmitStrategy)

private:
    TransmitSocket& m_transmitSocket;
    SendOperation m_sendOperation;
    RecvOperation m_recvOperation;
    std::atomic<bool> m_canInput{ false };
    std::atomic<bool> m_canOutput{ false };

public:
    SelectTransmitStrategy(TransmitSocket& transmitSocket);

    ~SelectTransmitStrategy();

    void Reset() override final;

    void Prepare() override final;

    void Start() override final;

    void Launch() override final;

    bool IsBusy() const override final;

    void PostInput() override final;

    void PostOutput() override final;

    void EnableInput() override final;

    void EnableOutput() override final;

    bool ShouldCareAboutOutput() const override final;
};

inline bool SelectTransmitStrategy::ShouldCareAboutOutput() const {
    return !m_canOutput;
}

DECL_NAMESPACE_MZ_NET_END

#endif

#endif // _MZ_NET_SELECTTRANSMITSTRATEGY_HPP_


text:
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Restaurant.MVC.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(Restaurant.MVC.App_Start.NinjectWebCommon), "Stop")]

namespace Restaurant.MVC.App_Start
{
    using System;
    using System.Web;

    using Microsoft.Web.Infrastructure.DynamicModuleHelper;

    using Ninject;
    using Ninject.Web.Common;
    using Infra.CrossCutting.IoC;

    public static class NinjectWebCommon
    {
        private static readonly Bootstrapper bootstrapper = new Bootstrapper();

        /// <summary>
        /// Starts the application
        /// </summary>
        public static void Start()
        {
            DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
            DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
            bootstrapper.Initialize(CreateKernel);
        }

        /// <summary>
        /// Stops the application.
        /// </summary>
        public static void Stop()
        {
            bootstrapper.ShutDown();
        }

        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = RegisterServices();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                //RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static StandardKernel RegisterServices()
        {
            var ioc = new Container().GetModule();
            return ioc;
        }
    }
}


text:
package com.google.common.truth;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;

import org.junit.ComparisonFailure;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.util.regex.Pattern;

/**
 * Tests for String Subjects.
 *
 * @author David Saff
 * @author Christian Gruber (cgruber@israfil.net)
 */
@RunWith(JUnit4.class)
public class StringTest {
  @Test
  public void hasLength() {
    assertThat("kurt").hasLength(4);
  }

  @Test
  public void hasLengthZero() {
    assertThat("").hasLength(0);
  }

  @Test
  public void hasLengthFails() {
    try {
      assertThat("kurt").hasLength(5);
      fail();
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("Not true that <\"kurt\"> has a length of 5. It is 4.");
    }
  }

  @Test
  public void hasLengthNegative() {
    try {
      assertThat("kurt").hasLength(-1);
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }

  @Test
  public void stringIsEmpty() {
    assertThat("").isEmpty();
  }

  @Test
  public void stringIsEmptyFail() {
    try {
      assertThat("abc").isEmpty();
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("Not true that <\"abc\"> is empty");
    }
  }

  @Test
  public void stringIsNotEmpty() {
    assertThat("abc").isNotEmpty();
  }

  @Test
  public void stringIsNotEmptyFail() {
    try {
      assertThat("").isNotEmpty();
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("Not true that <\"\"> is not empty");
    }
  }

  @Test
  public void stringContains() {
    assertThat("abc").contains("c");
  }

  @Test
  public void stringContainsCharSeq() {
    CharSequence charSeq = new StringBuilder("c");
    assertThat("abc").contains(charSeq);
  }

  @Test
  public void stringContainsFail() {
    try {
      assertThat("abc").contains("d");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected.getMessage()).contains("Not true that <\"abc\"> contains <\"d\">");
    }
  }

  @Test
  public void stringDoesNotContain() {
    assertThat("abc").doesNotContain("d");
  }

  @Test
  public void stringDoesNotContainCharSequence() {
    CharSequence charSeq = new StringBuilder("d");
    assertThat("abc").doesNotContain(charSeq);
  }

  @Test
  public void stringDoesNotContainFail() {
    try {
      assertThat("abc").doesNotContain("b");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected.getMessage()).contains("<\"abc\"> unexpectedly contains <\"b\">");
      return;
    }
  }

  @Test
  public void stringEquality() {
    assertThat("abc").isEqualTo("abc");
    assertThat("abc").isEqualTo("abc");
  }

  @Test
  public void stringEqualityToNull() {
    try {
      assertThat("abc").isEqualTo(null);
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected.getMessage()).contains("Not true that <\"abc\"> is null");
    }
  }

  @Test
  public void stringEqualityFail() {
    try {
      assertThat("abc").isEqualTo("abd");
      throw new Error("Expected to fail.");
    } catch (ComparisonFailure expected) {
      assertThat(expected).hasMessage("expected:<ab[d]> but was:<ab[c]>");
    }
  }

  @Test
  public void stringNamedEqualityFail() {
    try {
      assertThat("abc").named("foo").isEqualTo("abd");
      throw new Error("Expected to fail.");
    } catch (ComparisonFailure expected) {
      assertThat(expected).hasMessage("\"foo\": expected:<ab[d]> but was:<ab[c]>");
    }
  }

  @Test
  public void stringStartsWith() {
    assertThat("abc").startsWith("ab");
  }

  @Test
  public void stringStartsWithFail() {
    try {
      assertThat("abc").startsWith("bc");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected.getMessage()).contains("Not true that <\"abc\"> starts with <\"bc\">");
    }
  }

  @Test
  public void stringEndsWith() {
    assertThat("abc").endsWith("bc");
  }

  @Test
  public void stringEndsWithFail() {
    try {
      assertThat("abc").endsWith("ab");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected.getMessage()).contains("Not true that <\"abc\"> ends with <\"ab\">");
    }
  }

  @Test
  public void emptyStringTests() {
    assertThat("").contains("");
    assertThat("").startsWith("");
    assertThat("").endsWith("");
    assertThat("a").contains("");
    assertThat("a").startsWith("");
    assertThat("a").endsWith("");
  }

  @Test
  public void stringMatchesString() {
    assertThat("abcaaadev").matches(".*aaa.*");
  }

  @Test
  public void stringMatchesStringWithFail() {
    try {
      assertThat("abcaqadev").matches(".*aaa.*");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("Not true that <\"abcaqadev\"> matches <.*aaa.*>");
    }
  }

  @Test
  public void stringMatchesPattern() {
    assertThat("abcaqadev").doesNotMatch(Pattern.compile(".*aaa.*"));
  }

  @Test
  public void stringMatchesPatternWithFail() {
    try {
      assertThat("abcaaadev").doesNotMatch(Pattern.compile(".*aaa.*"));
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("Not true that <\"abcaaadev\"> fails to match <.*aaa.*>");
    }
  }

  @Test
  public void stringContainsMatchStringUsesFind() {
    assertThat("aba").containsMatch("[b]");
    assertThat("aba").containsMatch(Pattern.compile("[b]"));
  }

  @Test
  public void stringContainsMatchString() {
    assertThat("aba").containsMatch(".*b.*");

    try {
      assertThat("aaa").containsMatch(".*b.*");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("<\"aaa\"> should have contained a match for <.*b.*>");
    }
  }

  @Test
  public void stringContainsMatchPattern() {
    assertThat("aba").containsMatch(Pattern.compile(".*b.*"));

    try {
      assertThat("aaa").containsMatch(Pattern.compile(".*b.*"));
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("<\"aaa\"> should have contained a match for <.*b.*>");
    }
  }

  @Test
  public void stringDoesNotContainMatchString() {
    assertThat("aaa").doesNotContainMatch(".*b.*");

    try {
      assertThat("aba").doesNotContainMatch(".*b.*");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("<\"aba\"> should not have contained a match for <.*b.*>");
    }
  }

  @Test
  public void stringDoesNotContainMatchStringUsesFind() {
    try {
      assertThat("aba").doesNotContainMatch("[b]");
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("<\"aba\"> should not have contained a match for <[b]>");
    }
  }

  @Test
  public void stringDoesNotContainMatchPattern() {
    assertThat("aaa").doesNotContainMatch(Pattern.compile(".*b.*"));

    try {
      assertThat("aba").doesNotContainMatch(Pattern.compile(".*b.*"));
      throw new Error("Expected to fail.");
    } catch (AssertionError expected) {
      assertThat(expected).hasMessage("<\"aba\"> should not have contained a match for <.*b.*>");
    }
  }
}


text:
@implementation TaskPath

-(id)init
{
    self = [super init];
    if (self) {

        if (_imgSrc ==nil) {
            _imgSrc = [NSMutableArray array];
        }
        else
        {
            [_imgSrc removeAllObjects];
        }
        if (_taskPerformerDetails ==nil) {
            _taskPerformerDetails = [NSMutableArray array];
        }
        else
        {
            [_taskPerformerDetails removeAllObjects];
        }

    }
    return self;
}

-(void)resetDatas
{
    if (_imgSrc ==nil) {
        _imgSrc = [NSMutableArray array];
    }
    else
    {
        [_imgSrc removeAllObjects];
    }
    if (_taskPerformerDetails ==nil) {
        _taskPerformerDetails = [NSMutableArray array];
    }
    else
    {
        [_taskPerformerDetails removeAllObjects];
    }

}

@end

@implementation anniversaryPath

-(id)init
{
    self = [super init];
    if (self) {

        _imgSrc = [NSMutableArray array];
    }
    return self;
}

@end


text:
package gohome_test

import (
	"testing"
	"time"

	"github.com/go-home-iot/event-bus"
	"github.com/markdaws/gohome/pkg/gohome"
	"github.com/stretchr/testify/require"
)

type MockTime struct {
	now   time.Time
	after func(time.Duration) <-chan time.Time
}

func (mt MockTime) Now() time.Time {
	return mt.now
}

func (mt MockTime) After(d time.Duration) <-chan time.Time {
	return mt.after(d)
}

func TestSunrise(t *testing.T) {
	t.Parallel()

	mt := MockTime{
		now:   time.Date(2016, time.December, 5, 10, 0, 0, 0, time.UTC),
		after: func(d time.Duration) <-chan time.Time { return time.After(d) },
	}

	wasTriggered := false
	trigger := &gohome.TimeTrigger{
		Time:   mt,
		Mode:   gohome.TimeTriggerModeSunrise,
		Offset: 0,
		Days:   gohome.TimeTriggerDaysMon | gohome.TimeTriggerDaysFri,
		Triggered: func() {
			wasTriggered = true
		},
	}

	ch := make(chan evtbus.Event)
	trigger.StartConsuming(ch)

	// Send sunrise event, check offset
	ch <- &gohome.SunriseEvt{}

	// Send sunset - nothing should happen
	time.Sleep(time.Second * 1)
	require.True(t, wasTriggered)
}

func TestSunset(t *testing.T) {
	t.Parallel()

	mt := MockTime{
		now:   time.Date(2016, time.December, 5, 10, 0, 0, 0, time.UTC),
		after: func(d time.Duration) <-chan time.Time { return time.After(d) },
	}

	wasTriggered := false
	trigger := &gohome.TimeTrigger{
		Time:   mt,
		Mode:   gohome.TimeTriggerModeSunset,
		Offset: 0,
		Days:   gohome.TimeTriggerDaysMon | gohome.TimeTriggerDaysFri,
		Triggered: func() {
			wasTriggered = true
		},
	}

	ch := make(chan evtbus.Event)
	trigger.StartConsuming(ch)

	// Send sunrise event, check offset
	ch <- &gohome.SunsetEvt{}

	// Send sunset - nothing should happen
	time.Sleep(time.Second * 1)

	require.True(t, wasTriggered)
}

func TestExactWithDate(t *testing.T) {
	t.Parallel()

	mt := MockTime{
		now:   time.Date(2016, time.December, 5, 10, 0, 0, 0, time.UTC),
		after: func(d time.Duration) <-chan time.Time { return time.After(d) },
	}

	wasTriggered := false
	trigger := &gohome.TimeTrigger{
		Time: mt,
		Mode: gohome.TimeTriggerModeExact,
		At:   mt.Now().Add(time.Second * 1),
		Triggered: func() {
			wasTriggered = true
		},
	}

	ch := make(chan evtbus.Event)
	trigger.StartConsuming(ch)

	time.Sleep(time.Second * 2)

	require.True(t, wasTriggered)
}

func TestExactWithoutDate(t *testing.T) {
	t.Parallel()

	mt := MockTime{
		// This is a monday
		now: time.Date(2016, time.December, 5, 10, 10, 0, 0, time.UTC),
		after: func(d time.Duration) <-chan time.Time {
			// Return immediately
			c := make(chan time.Time, 1)
			c <- time.Now()
			return c
		},
	}

	// This is the same as the current mock time
	at := time.Date(
		0, 1, 1,
		mt.Now().Hour(), mt.Now().Minute(), mt.Now().Second(), 0, mt.Now().Location())

	// move in to the future
	at = at.Add(time.Second)

	evalCount := 0
	wasTriggered := false
	eval := func() {
		// This is called each time the trigger evaluates if it should run

		// If this is not the first time it is evaluating, then pretend we incremented
		// the current time by 23 hours to the next day (not 24 incase we jump past the
		// execution time), so that the test can run over multiple days. We only want the
		// test to execute on Monday and Friday
		if evalCount > 0 {
			mt.now = mt.now.Add(time.Hour * 23)
		}

		// Start on Monday, if eval is one, it means we ran on monday, so we should have got
		// an execute scene, then also on friday
		if evalCount == 1 || evalCount == 5 {
			require.True(t, wasTriggered)
			wasTriggered = false
		} else {
			require.False(t, wasTriggered)
		}
		evalCount++
	}

	trigger := &gohome.TimeTrigger{
		Time:       &mt,
		Mode:       gohome.TimeTriggerModeExact,
		Days:       gohome.TimeTriggerDaysMon | gohome.TimeTriggerDaysFri,
		At:         at,
		Evaluating: eval,
		Triggered: func() {
			wasTriggered = true
		},
	}

	ch := make(chan evtbus.Event)
	trigger.StartConsuming(ch)

	time.Sleep(time.Second * 2)
	require.Equal(t, 6, evalCount)
}


text:
"""
:mod:`topo` --- SCION topology topo generator
=============================================
"""
# Stdlib
import json
import logging
import os
import random
from collections import defaultdict

# External packages
import yaml

# SCION
from python.lib.defines import (
    AS_LIST_FILE,
    IFIDS_FILE,
    SCION_MIN_MTU,
    SCION_ROUTER_PORT,
    TOPO_FILE,
)
from python.lib.types import LinkType
from python.lib.util import write_file
from python.topology.common import (
    ArgsBase,
    join_host_port,
    json_default,
    SCION_SERVICE_NAMES,
    TopoID
)
from python.topology.net import (
    PortGenerator,
    SubnetGenerator
)

DEFAULT_BEACON_SERVERS = 1
DEFAULT_CONTROL_SERVERS = 1
DEFAULT_COLIBRI_SERVERS = 1

UNDERLAY_4 = 'UDP/IPv4'
UNDERLAY_6 = 'UDP/IPv6'
DEFAULT_UNDERLAY = UNDERLAY_4
ADDR_TYPE_4 = 'IPv4'
ADDR_TYPE_6 = 'IPv6'

class TopoGenArgs(ArgsBase):
    def __init__(self,
                 args: ArgsBase,
                 topo_config,
                 subnet_gen4: SubnetGenerator,
                 subnet_gen6: SubnetGenerator,
                 default_mtu: int):
        """
        :param ArgsBase args: Contains the passed command line arguments.
        :param dict topo_config: The parsed topology config.
        :param SubnetGenerator subnet_gen4: The default network generator for IPv4.
        :param SubnetGenerator subnet_gen6: The default network generator for IPv6.
        :param dict default_mtu: The default mtu.
        """
        super().__init__(args)
        self.topo_config_dict = topo_config
        self.subnet_gen = {
            ADDR_TYPE_4: subnet_gen4,
            ADDR_TYPE_6: subnet_gen6,
        }
        self.default_mtu = default_mtu
        self.port_gen = PortGenerator()

class TopoGenerator(object):
    def __init__(self, args):
        """
        :param TopoGenArgs args: Contains the passed command line arguments.
        """
        self.args = args
        self.topo_dicts = {}
        self.hosts = []
        self.virt_addrs = set()
        self.as_list = defaultdict(list)
        self.links = defaultdict(list)
        self.ifid_map = {}

    def _reg_addr(self, topo_id: TopoID, elem_id, addr_type):
        subnet = self.args.subnet_gen[addr_type].register(str(topo_id))
        if self.args.docker and addr_type == ADDR_TYPE_6:
            # for docker also allocate an IPv4 address so that we have ipv4
            # range allocated for the network.
            v4subnet = self.args.subnet_gen[ADDR_TYPE_4].register(str(topo_id) + '_v4')
            v4subnet.register(elem_id + '_v4')
        return subnet.register(elem_id)

    def _reg_link_addrs(self, local_br, remote_br, local_ifid, remote_ifid, addr_type):
        link_name = str(sorted((local_br, remote_br)))
        link_name += str(sorted((local_ifid, remote_ifid)))
        subnet = self.args.subnet_gen[addr_type].register(link_name)
        if self.args.docker and addr_type == ADDR_TYPE_6:
            # for docker also allocate an IPv4 address so that we have ipv4
            # range allocated for the network.
            v4subnet = self.args.subnet_gen[ADDR_TYPE_4].register(link_name + '_v4')
            v4subnet.register(local_br + '_v4')
        return subnet.register(local_br), subnet.register(remote_br)

    def _iterate(self, f):
        for isd_as, as_conf in self.args.topo_config_dict["ASes"].items():
            f(TopoID(isd_as), as_conf)

    def generate(self):
        self._read_links()
        # in a first step we allocate all networks, so that we can later use
        # the IPs in the generate functions.
        self._iterate(self._register_addrs)
        networks = {}
        for k, v in self.args.subnet_gen[ADDR_TYPE_4].alloc_subnets().items():
            networks[k] = v
        for k, v in self.args.subnet_gen[ADDR_TYPE_6].alloc_subnets().items():
            networks[k] = v
        self._iterate(self._generate_as_topo)
        self._iterate(self._generate_as_list)
        self._iterate(self._write_as_topo)
        self._write_as_list()
        self._write_ifids()
        return self.topo_dicts, networks

    def _register_addrs(self, topo_id, as_conf):
        self._register_srv_entries(topo_id, as_conf)
        self._register_br_entries(topo_id, as_conf)
        if self.args.sig:
            self._register_sig(topo_id, as_conf)
        self._register_sciond(topo_id, as_conf)

    def _register_srv_entries(self, topo_id, as_conf):
        """ registers the addresses of all the services """
        srvs = [("control_servers", DEFAULT_CONTROL_SERVERS, "cs")]
        srvs.append(("colibri_servers", DEFAULT_COLIBRI_SERVERS, "co"))
        # because each colibri service needs its own ip for the debug server, register as many
        # addresses as colibri services we registered above.
        # Note that this only affects the networks, ports, etc, and not the services themselves,
        # thus the debug service does NOT exist (only entries in network, etc).
        srvs.append(("colibri_dbg_servers", DEFAULT_COLIBRI_SERVERS, "codbg"))
        for conf_key, def_num, nick in srvs:
            self._register_srv_entry(topo_id, as_conf, conf_key, def_num, nick)

    def _register_srv_entry(self, topo_id, as_conf, conf_key, def_num, nick):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        count = self._srv_count(as_conf, conf_key, def_num)
        for i in range(1, count + 1):
            elem_id = "%s%s-%s" % (nick, topo_id.file_fmt(), i)
            if not self.args.docker:
                self.args.port_gen.register(elem_id)
            self._reg_addr(topo_id, elem_id, addr_type)

    def _register_br_entries(self, topo_id, as_conf):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        for (linkto, remote, attrs, l_br, r_br, l_ifid, r_ifid) in self.links[topo_id]:
            self._register_br_entry(topo_id, l_ifid, remote, r_ifid,
                                    linkto, attrs, l_br, r_br, addr_type)

    def _register_br_entry(self, local, l_ifid, remote, r_ifid, remote_type, attrs,
                           local_br, remote_br, addr_type):
        link_addr_type = addr_type_from_underlay(attrs.get('underlay', DEFAULT_UNDERLAY))
        self._reg_link_addrs(local_br, remote_br, l_ifid, r_ifid, link_addr_type)
        self._reg_addr(local, local_br + "_internal", addr_type)
        if not self.args.docker:
            self.args.port_gen.register(local_br + "_internal")

    def _register_sig(self, topo_id, as_conf):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        self._reg_addr(topo_id, "sig" + topo_id.file_fmt(), addr_type)

    def _register_sciond(self, topo_id, as_conf):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        self._reg_addr(topo_id, "sd" + topo_id.file_fmt(), addr_type)
        # Always register the tester element. This causes the generator to create a
        # bridge in the docker topology, which SCIOND, SIG (if enabled) and
        # client applications can use to communicate.
        self._reg_addr(topo_id, "tester_" + topo_id.file_fmt(), addr_type)

    def _br_name(self, ep, assigned_br_id, br_ids, if_ids):
        br_name = ep.br_name()
        if br_name:
            # BR with multiple interfaces, reuse assigned id
            br_id = assigned_br_id.get(br_name)
            if br_id is None:
                # assign new id
                br_ids[ep] += 1
                assigned_br_id[br_name] = br_id = br_ids[ep]
        else:
            # BR with single interface
            br_ids[ep] += 1
            br_id = br_ids[ep]
        br = "br%s-%d" % (ep.file_fmt(), br_id)
        ifid = ep.ifid
        if self.args.random_ifids or not ifid:
            ifid = if_ids[ep].new()
        else:
            if_ids[ep].add(ifid)
        return br, ifid

    def _read_links(self):
        assigned_br_id = {}
        br_ids = defaultdict(int)
        if_ids = defaultdict(lambda: IFIDGenerator())
        if not self.args.topo_config_dict.get("links", None):
            return
        for attrs in self.args.topo_config_dict["links"]:
            a = LinkEP(attrs.pop("a"))
            b = LinkEP(attrs.pop("b"))
            linkto = linkto_a = linkto_b = attrs.pop("linkAtoB")
            if linkto.lower() == LinkType.CHILD:
                linkto_a = LinkType.PARENT
                linkto_b = LinkType.CHILD
            a_br, a_ifid = self._br_name(a, assigned_br_id, br_ids, if_ids)
            b_br, b_ifid = self._br_name(b, assigned_br_id, br_ids, if_ids)
            self.links[a].append((linkto_b, b, attrs, a_br, b_br, a_ifid, b_ifid))
            self.links[b].append((linkto_a, a, attrs, b_br, a_br, b_ifid, a_ifid))
            a_desc = "%s %s" % (a_br, a_ifid)
            b_desc = "%s %s" % (b_br, b_ifid)
            self.ifid_map.setdefault(str(a), {})
            self.ifid_map[str(a)][a_desc] = b_desc
            self.ifid_map.setdefault(str(b), {})
            self.ifid_map[str(b)][b_desc] = a_desc

    def _generate_as_topo(self, topo_id, as_conf):
        mtu = as_conf.get('mtu', self.args.default_mtu)
        assert mtu >= SCION_MIN_MTU, mtu
        attributes = []
        for attr in ['authoritative', 'core', 'issuing', 'voting']:
            if as_conf.get(attr, False):
                attributes.append(attr)
        self.topo_dicts[topo_id] = {
            'attributes': attributes,
            'isd_as': str(topo_id),
            'mtu': mtu,
        }
        for i in SCION_SERVICE_NAMES:
            self.topo_dicts[topo_id][i] = {}
        self._gen_srv_entries(topo_id, as_conf)
        self._gen_br_entries(topo_id, as_conf)
        if self.args.sig:
            self.topo_dicts[topo_id]['sigs'] = {}
            self._gen_sig_entries(topo_id, as_conf)

    def _gen_srv_entries(self, topo_id, as_conf):
        srvs = [("control_servers", DEFAULT_CONTROL_SERVERS, "cs", "control_service")]
        srvs.append(("control_servers", DEFAULT_CONTROL_SERVERS, "cs", "discovery_service"))
        srvs.append(("colibri_servers", DEFAULT_COLIBRI_SERVERS, "co", "colibri_service"))
        for conf_key, def_num, nick, topo_key in srvs:
            self._gen_srv_entry(topo_id, as_conf, conf_key, def_num, nick, topo_key)

    def _gen_srv_entry(self, topo_id, as_conf, conf_key, def_num, nick,
                       topo_key, uses_dispatcher=True):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        count = self._srv_count(as_conf, conf_key, def_num)
        for i in range(1, count + 1):
            elem_id = "%s%s-%s" % (nick, topo_id.file_fmt(), i)

            port = self._default_ctrl_port(nick)
            if not self.args.docker:
                port = self.args.port_gen.register(elem_id)

            d = {
                'addr': join_host_port(self._reg_addr(topo_id, elem_id, addr_type).ip, port),
            }
            self.topo_dicts[topo_id][topo_key][elem_id] = d

    def _default_ctrl_port(self, nick):
        if nick == "cs":
            return 30252
        if nick == "co":
            return 30257
        raise ValueError('Invalid nick: %s' % nick)

    def _srv_count(self, as_conf, conf_key, def_num):
        count = as_conf.get(conf_key, def_num)
        if conf_key == "control_servers":
            count = 1
        return count

    def _gen_br_entries(self, topo_id, as_conf):
        addr_type = addr_type_from_underlay(as_conf.get('underlay', DEFAULT_UNDERLAY))
        for (linkto, remote, attrs, l_br, r_br, l_ifid, r_ifid) in self.links[topo_id]:
            self._gen_br_entry(topo_id, l_ifid, remote, r_ifid,
                               linkto, attrs, l_br, r_br, addr_type)

    def _gen_br_entry(self, local, l_ifid, remote, r_ifid, remote_type, attrs,
                      local_br, remote_br, addr_type):
        link_addr_type = addr_type_from_underlay(attrs.get('underlay', DEFAULT_UNDERLAY))
        public_addr, remote_addr = self._reg_link_addrs(local_br, remote_br, l_ifid,
                                                        r_ifid, link_addr_type)

        intl_addr = self._reg_addr(local, local_br + "_internal", addr_type)
        if self.topo_dicts[local]["border_routers"].get(local_br) is None:
            intl_port = 30042
            if not self.args.docker:
                intl_port = self.args.port_gen.register(local_br + "_internal")

            self.topo_dicts[local]["border_routers"][local_br] = {
                'internal_addr': join_host_port(intl_addr.ip, intl_port),
                'interfaces': {
                    l_ifid: self._gen_br_intf(remote, public_addr, remote_addr, attrs, remote_type)
                }
            }
        else:
            # There is already a BR entry, add interface
            intf = self._gen_br_intf(remote, public_addr, remote_addr, attrs, remote_type)
            self.topo_dicts[local]["border_routers"][local_br]['interfaces'][l_ifid] = intf

    def _gen_br_intf(self, remote, public_addr, remote_addr, attrs, remote_type):
        return {
            'underlay': {
                'public': join_host_port(public_addr.ip, SCION_ROUTER_PORT),
                'remote': join_host_port(remote_addr.ip, SCION_ROUTER_PORT),
            },
            'isd_as': str(remote),
            'link_to': LinkType.to_str(remote_type.lower()),
            'mtu': attrs.get('mtu', self.args.default_mtu)
        }

    def _gen_sig_entries(self, topo_id, as_conf):
        addr_type = addr_type_from_underlay(DEFAULT_UNDERLAY)
        elem_id = "sig" + topo_id.file_fmt()
        reg_id = "sig" + topo_id.file_fmt()
        port = 30256
        if not self.args.docker:
            port = self.args.port_gen.register(elem_id)
        d = {
            'ctrl_addr': join_host_port(self._reg_addr(topo_id, reg_id, addr_type).ip, port),
            'data_addr': join_host_port(self._reg_addr(topo_id, reg_id, addr_type).ip, 30056),
        }
        self.topo_dicts[topo_id]['sigs'][elem_id] = d

    def _generate_as_list(self, topo_id, as_conf):
        if as_conf.get('core', False):
            key = "Core"
        else:
            key = "Non-core"
        self.as_list[key].append(str(topo_id))

    def _write_as_topo(self, topo_id, _as_conf):
        path = os.path.join(topo_id.base_dir(self.args.output_dir), TOPO_FILE)
        contents_json = json.dumps(self.topo_dicts[topo_id],
                                   default=json_default, indent=2)
        write_file(path, contents_json + '\n')

    def _write_as_list(self):
        list_path = os.path.join(self.args.output_dir, AS_LIST_FILE)
        write_file(list_path, yaml.dump(dict(self.as_list)))

    def _write_ifids(self):
        list_path = os.path.join(self.args.output_dir, IFIDS_FILE)
        write_file(list_path, yaml.dump(self.ifid_map,
                                        default_flow_style=False))

class LinkEP(TopoID):
    def __init__(self, raw):
        self._brid = None
        self.ifid = None
        isd_as = raw
        parts = raw.split('#')
        if len(parts) == 2:
            self.ifid = int(parts[1])
            isd_as = parts[0]
        parts = isd_as.split("-")
        if len(parts) == 3:
            self._brid = parts[2]
            isd_as = "%s-%s" % (parts[0], parts[1])
        super().__init__(isd_as)

    def br_name(self):
        if self._brid is not None:
            return "%s-%s" % (self.file_fmt(), self._brid)
        return None

class IFIDGenerator(object):
    """Generates unique interface IDs"""

    def __init__(self):
        self._ifids = set()

    def new(self):
        while True:
            ifid = random.randrange(1, 4096)
            if ifid in self._ifids:
                continue
            self.add(ifid)
            return ifid

    def add(self, ifid):
        if ifid in self._ifids:
            logging.critical("IFID %d already exists!" % ifid)
            exit(1)
        if ifid < 1 or ifid > 4095:
            logging.critical("IFID %d is invalid!" % ifid)
            exit(1)
        self._ifids.add(ifid)

def addr_type_from_underlay(underlay: str) -> str:
    return underlay.split('/')[1]


text:
package com.billybyte.dse.debundles;

import java.util.Calendar;
import java.util.HashMap;
import java.util.List;

import com.billybyte.commoninterfaces.QueryInterface;
import com.billybyte.commonstaticmethods.Dates;
import com.billybyte.dse.inputs.QueryManager;
import com.billybyte.dse.inputs.diotypes.AtmDiot;
import com.billybyte.dse.inputs.diotypes.CallPutDiot;
import com.billybyte.dse.inputs.diotypes.DioType;
import com.billybyte.dse.inputs.diotypes.DivDiot;
import com.billybyte.dse.inputs.diotypes.DteSimpleDiot;
import com.billybyte.dse.inputs.diotypes.RateDiot;
import com.billybyte.dse.inputs.diotypes.SettlePriceDiot;
import com.billybyte.dse.inputs.diotypes.StrikeDiot;
import com.billybyte.dse.inputs.diotypes.VolDiot;
import com.billybyte.dse.queries.AtmFromPdiCqrQuery;
import com.billybyte.dse.queries.BaseUnderlyingSecDefQuery;
import com.billybyte.dse.queries.CallPutInputQuery;
import com.billybyte.dse.queries.DivDseInputQuery;
import com.billybyte.dse.queries.DseInputQuery;
import com.billybyte.dse.queries.DteFromPdiInputQuery;
import com.billybyte.dse.queries.SettleDseInputQueryFromPdiQuery;
import com.billybyte.dse.queries.StrikeDseInputQuery;
import com.billybyte.dse.queries.TreasuryRateQueryFromTreasuryRateSingle;
import com.billybyte.dse.queries.VolDseInputQueryForStksFromYahoo;
import com.billybyte.marketdata.SecDef;
import com.billybyte.marketdata.SecDefQueryAllMarkets;
import com.billybyte.marketdata.YahooCombinedStkOptPdiSetCqrRetQuery;
import com.billybyte.marketdata.YahooFinanceDivYieldQuery;
import com.billybyte.marketdata.YahooHistoricalVolCqrQuery;
import com.billybyte.marketdata.YahooOptionVolCqrQueryForOpts;

/**
 * QueryManagerBuilder builds instances of QueryManager.
 *   QueryManager is the class that gathers inputs for the options models
 *     of DerivativeSetEngine.
 *   QueryManager maps the name of a security to various input queries which
 *     fetch atm prices, vols, rates, etc that you use to calculate a
 *     derivative price or a derivative sensitivity.
 *
 * @author bperlman1
 *
 */
public class QueryManagerBuilder {
	public static final QueryManager qmForStocksUsingYahoo(
			Calendar evalDate,
			QueryInterface<String, SecDef> sdQuery){
		long evalDateLong = Dates.getYyyyMmDdFromCalendar(evalDate);

		// 1.  create all of the dse input queries that
		//      the dse needs to price a derivative like an option
		YahooCombinedStkOptPdiSetCqrRetQuery innerPdiQuery =
				new YahooCombinedStkOptPdiSetCqrRetQuery();
		AtmFromPdiCqrQuery atmQuery =
				new AtmFromPdiCqrQuery(sdQuery,innerPdiQuery,evalDateLong);

		// vol - don't get implied atm vol for stocks - it's too slow
		VolDseInputQueryForStksFromYahoo volQuery =
				new VolDseInputQueryForStksFromYahoo(
						null,
						new YahooHistoricalVolCqrQuery(),
						new YahooOptionVolCqrQueryForOpts(),
						new SecDefQueryAllMarkets());

		// dte
		DteFromPdiInputQuery dteQuery =
				new DteFromPdiInputQuery(sdQuery,innerPdiQuery, evalDate);

		// strike
		StrikeDseInputQuery strikeQuery =
				new StrikeDseInputQuery(sdQuery);

		// call put
		CallPutInputQuery cpQuery =
				new CallPutInputQuery(sdQuery);

		// rate
		TreasuryRateQueryFromTreasuryRateSingle rateQuery =
				new TreasuryRateQueryFromTreasuryRateSingle();
		// div
		DivDseInputQuery divQuery =
				new DivDseInputQuery(
						rateQuery,
						new YahooFinanceDivYieldQuery());

		// settle
		SettleDseInputQueryFromPdiQuery settleQuery =
				new SettleDseInputQueryFromPdiQuery(
						sdQuery,
						innerPdiQuery,
						evalDateLong);

		//  2.  Create the QueryManager
		// 	2.1. create map of dioTypes to dseInput queries as per xml pattern below
		VolDiot volDiot = new VolDiot();  // we use it in several places
		HashMap<DioType<?>, DseInputQuery<?>> dseInputQueryMap =
				new HashMap<DioType<?>, DseInputQuery<?>>();
		dseInputQueryMap.put(new AtmDiot(), atmQuery);
		dseInputQueryMap.put(volDiot, volQuery);
		dseInputQueryMap.put(new DteSimpleDiot(),dteQuery);
		dseInputQueryMap.put(new CallPutDiot(), volQuery);
		dseInputQueryMap.put(new StrikeDiot(),strikeQuery);
		dseInputQueryMap.put(new CallPutDiot(), cpQuery);
		dseInputQueryMap.put(new RateDiot(), rateQuery);
		dseInputQueryMap.put(new DivDiot(), divQuery);
		dseInputQueryMap.put(new SettlePriceDiot(), settleQuery);

		//   2.2  create a secDefQueryMap that maps SecSymbolType's to queries
		//     that produce an underlying for that SecSymbolType

		HashMap<String, QueryInterface<String, List<SecDef>>> symTypeToSecDefListMap =
				new HashMap<String, QueryInterface<String,List<SecDef>>>();
		QueryInterface<String,List<SecDef>> baseUnderlyingQuery =
				new BaseUnderlyingSecDefQuery(sdQuery);
		symTypeToSecDefListMap.put("((OPT)|(STK))", baseUnderlyingQuery);

		//  2.3  Create the QueryManager
		QueryManager queryManager =
				new QueryManager(dseInputQueryMap, symTypeToSecDefListMap);
		return queryManager;
	}
}


text:
<?php

namespace Psy\ExecutionLoop;

use Psy\Exception\ParseErrorException;
use Psy\ParserFactory;
use Psy\Shell;

/**
 * A runkit-based code reloader, which is pretty much magic.
 */
class RunkitReloader extends AbstractListener
{
    private $parser;
    private $timestamps = [];

    /**
     * Only enabled if Runkit is installed.
     *
     * @return bool
     */
    public static function isSupported()
    {
        return \extension_loaded('runkit');
    }

    /**
     * Construct a Runkit Reloader.
     *
     * @todo Pass in Parser Factory instance for dependency injection?
     */
    public function __construct()
    {
        $parserFactory = new ParserFactory();
        $this->parser = $parserFactory->createParser();
    }

    /**
     * Reload code on input.
     *
     * @param Shell  $shell
     * @param string $input
     */
    public function onInput(Shell $shell, $input)
    {
        $this->reload($shell);
    }

    /**
     * Look through included files and update anything with a new timestamp.
     *
     * @param Shell $shell
     */
    private function reload(Shell $shell)
    {
        \clearstatcache();
        $modified = [];

        foreach (\get_included_files() as $file) {
            $timestamp = \filemtime($file);

            if (!isset($this->timestamps[$file])) {
                $this->timestamps[$file] = $timestamp;
                continue;
            }

            if ($this->timestamps[$file] === $timestamp) {
                continue;
            }

            if (!$this->lintFile($file)) {
                $msg = \sprintf('Modified file "%s" could not be reloaded', $file);
                $shell->writeException(new ParseErrorException($msg));
                continue;
            }

            $modified[] = $file;
            $this->timestamps[$file] = $timestamp;
        }

        // switch (count($modified)) {
        //     case 0:
        //         return;

        //     case 1:
        //         printf("Reloading modified file: \"%s\"\n", str_replace(getcwd(), '.', $file));
        //         break;

        //     default:
        //         printf("Reloading %d modified files\n", count($modified));
        //         break;
        // }

        foreach ($modified as $file) {
            runkit_import($file, (
                RUNKIT_IMPORT_FUNCTIONS |
                RUNKIT_IMPORT_CLASSES |
                RUNKIT_IMPORT_CLASS_METHODS |
                RUNKIT_IMPORT_CLASS_CONSTS |
                RUNKIT_IMPORT_CLASS_PROPS |
                RUNKIT_IMPORT_OVERRIDE
            ));
        }
    }

    /**
     * Should this file be re-imported?
     *
     * Use PHP-Parser to ensure that the file is valid PHP.
     *
     * @param string $file
     *
     * @return bool
     */
    private function lintFile($file)
    {
        // first try to parse it
        try {
            $this->parser->parse(\file_get_contents($file));
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
}


text:
<!DOCTYPE html>

	<title>Extra Excell types</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>

Extra eXcell types

There are several eXcell types available in dhtmlxGrid:

List "clist"
            - list of values, which is displayed as comma delimited list in cells

Calculator "calck"
			- allows you to make some math calculations

New Checkbox "acheck" - skinable two-state control

Image "img" - allow to insert image into the grid cell


text:
I am a creator of issues on a repository. I follow the builder pattern, by taking several parameters (labels, assignee, body, title, milestone) to create an issue (self>>execute).

My collaborator is GHRepository

Public API and Key Messages

  - Visit https://developer.github.com/v3/issues/#create-an-issue for documentation on each parameter.
  - Send issueCreator to a repository to instantiate me. Alternatively, send #on: to my class passing a GHRepository.
  - create: Create the repository with the given parameters.


text:
require 'active_record'
require 'simplecov'
SimpleCov.start do
  add_filter "/spec/"
end

require 'pagoid'

Dir["./spec/support/**/*.rb"].sort.each {|f| require f}

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus

  config.before { Person.delete_all }

  # --seed 1234
  config.order = 'random'
end


text:
package com.jlj.menu;

import java.util.List;

/**
 * 复合类型的按钮
 * @author John
 *
 */
public class ComplexButton extends Button {
//	private Button[] sub_button;
//
//	public Button[] getSub_button() {
//		return sub_button;
//	}
//
//	public void setSub_button(Button[] sub_button) {
//		this.sub_button = sub_button;
//	}
	private List<Button> sub_button;

	public List<Button> getSub_button() {
		return sub_button;
	}

	public void setSub_button(List<Button> sub_button) {
		this.sub_button = sub_button;
	}

}


text:
package org.gradle.internal.execution.caching;

import com.google.common.collect.ImmutableList;
import org.gradle.caching.BuildCacheKey;
import org.gradle.internal.Either;
import org.gradle.internal.execution.history.BeforeExecutionState;

import javax.annotation.Nullable;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;

public class CachingState {
    public static final CachingState NOT_DETERMINED = disabledWithoutInputs(new CachingDisabledReason(CachingDisabledReasonCategory.UNKNOWN, "Cacheability was not determined"));

    private final Either<Enabled, Disabled> delegate;

    private CachingState(Either<Enabled, Disabled> delegate) {
        this.delegate = delegate;
    }

    public static CachingState enabled(BuildCacheKey key, BeforeExecutionState beforeExecutionState) {
        return new CachingState(Either.left(new Enabled(key, beforeExecutionState)));
    }

    public static CachingState disabled(ImmutableList<CachingDisabledReason> disabledReasons, @Nullable BuildCacheKey key, @Nullable BeforeExecutionState beforeExecutionState) {
        return new CachingState(Either.right(new Disabled(disabledReasons, key, beforeExecutionState)));
    }

    public static CachingState disabledWithoutInputs(CachingDisabledReason reason) {
        return disabled(ImmutableList.of(reason), null, null);
    }

    public Optional<Enabled> whenEnabled() {
        return delegate.getLeft();
    }

    public Optional<Disabled> whenDisabled() {
        return delegate.getRight();
    }

    public <T> T fold(Function<Enabled, T> enabled, Function<Disabled, T> disabled) {
        return delegate.fold(enabled, disabled);
    }

    public void apply(Consumer<Enabled> enabled, Consumer<Disabled> disabled) {
        delegate.apply(enabled, disabled);
    }

    /**
     * Caching state when caching is enabled for the work.
     */
    public static class Enabled {
        private final BuildCacheKey key;
        private final BeforeExecutionState beforeExecutionState;

        private Enabled(BuildCacheKey key, BeforeExecutionState beforeExecutionState) {
            this.key = key;
            this.beforeExecutionState = beforeExecutionState;
        }

        /**
         * The cache key.
         */
        public BuildCacheKey getKey() {
            return key;
        }

        /**
         * The captured state of the work's inputs.
         */
        public BeforeExecutionState getBeforeExecutionState() {
            return beforeExecutionState;
        }
    }

    /**
     * Caching state when caching is disabled for the work.
     */
    public static class Disabled {
        private final ImmutableList<CachingDisabledReason> disabledReasons;
        private final BuildCacheKey key;
        private final BeforeExecutionState beforeExecutionState;

        private Disabled(ImmutableList<CachingDisabledReason> disabledReasons, @Nullable BuildCacheKey key, @Nullable BeforeExecutionState beforeExecutionState) {
            this.disabledReasons = disabledReasons;
            this.key = key;
            this.beforeExecutionState = beforeExecutionState;
        }

        /**
         * Reasons for the caching to be disabled for the work, empty when enabled.
         */
        public ImmutableList<CachingDisabledReason> getDisabledReasons() {
            return disabledReasons;
        }

        /**
         * The cache key if a valid cache key could be built.
         *
         * Might be present even when caching is disabled.
         */
        public Optional<BuildCacheKey> getKey() {
            return Optional.ofNullable(key);
        }

        /**
         * Individual fingerprints for each of the work's inputs, if they were tracked.
         */
        public Optional<BeforeExecutionState> getBeforeExecutionState() {
            return Optional.ofNullable(beforeExecutionState);
        }
    }
}


text:
package talecraft.client.gui.blocks;

import java.util.List;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import talecraft.TaleCraft;
import talecraft.client.ClientNetworkHandler;
import talecraft.client.gui.qad.QADButton;
import talecraft.client.gui.qad.QADFACTORY;
import talecraft.client.gui.qad.QADGuiScreen;
import talecraft.client.gui.qad.QADLabel;
import talecraft.client.gui.qad.QADScrollPanel;
import talecraft.client.gui.qad.QADTextField;
import talecraft.client.gui.qad.layout.QADListLayout;
import talecraft.network.packets.StringNBTCommandPacket;
import talecraft.tileentity.EmitterBlockTileEntity;
import talecraft.util.GObjectTypeHelper;

public class GuiEmitterBlock extends QADGuiScreen {
	EmitterBlockTileEntity tileEntity;

	QADTextField particleTypeTextField;

	public GuiEmitterBlock(EmitterBlockTileEntity tileEntity) {
		this.tileEntity = tileEntity;
	}

	@Override
	public void buildGui() {
		final BlockPos position = tileEntity.getPos();
		addComponent(new QADLabel("Emitter Block @ " + position.getX() + " " + position.getY() + " " + position.getZ(), 2, 2));

		int[] colp = new int[4];
		int[] colw = new int[4];

		colp[0] = 2;
		colw[0] = 100;
		colp[1] = colp[0] + colw[0] + 4;
		colw[1] = 80;
		colp[2] = colp[1] + colw[1] + 4;
		colw[2] = 80;
		colp[3] = colp[2] + colw[2] + 4;
		colw[3] = 80;

		int[] rowp = new int[9]; // row positions
		int rowh = 20; // row height
		int tfc = 2;
		int sro = 6; // string row offset
		rowp[0] = 16;
		rowp[1] = rowp[0] + rowh + 0;
		rowp[2] = rowp[1] + rowh + 0;
		rowp[3] = rowp[2] + rowh + 0;
		rowp[4] = rowp[3] + rowh + 0;
		rowp[5] = rowp[4] + rowh + 0;
		rowp[6] = rowp[5] + rowh + 0;
		rowp[7] = rowp[6] + rowh + 0;
		rowp[8] = rowp[7] + rowh + 0;

		addComponent(QADFACTORY.createLabel("Particle Type"     , colp[0], rowp[0]+sro));
		addComponent(QADFACTORY.createLabel("Spawn Count"       , colp[0], rowp[1]+sro));

		addComponent(QADFACTORY.createLabel("X"       , colp[1] + colw[1]/2, rowp[2]+sro));
		addComponent(QADFACTORY.createLabel("Y"       , colp[2] + colw[2]/2, rowp[2]+sro));
		addComponent(QADFACTORY.createLabel("Z"       , colp[3] + colw[3]/2, rowp[2]+sro));

		addComponent(QADFACTORY.createLabel("Offset"            , colp[0], rowp[3]+sro));
		addComponent(QADFACTORY.createLabel("Offset Randomize"  , colp[0], rowp[4]+sro));
		addComponent(QADFACTORY.createLabel("Velocity"          , colp[0], rowp[5]+sro));
		addComponent(QADFACTORY.createLabel("Velocity Randomize", colp[0], rowp[6]+sro));

		addComponent(QADFACTORY.createLabel("Actions", colp[0], rowp[8]+sro));

		particleTypeTextField = QADFACTORY.createTextField(tileEntity.getParticleType(), colp[1], rowp[0]+tfc, colw[1]);
		particleTypeTextField.setTooltip("The particle type to emit.");
		addComponent(particleTypeTextField);

		addComponent(QADFACTORY.createButton("?", colp[2], rowp[0], 20, new Runnable() {
			@Override public void run() {
				displayGuiScreen(new GuiEmitterBlockParticleTypes(GuiEmitterBlock.this));
			}
		}));

		final QADTextField spawnCountTextField = QADFACTORY.createNumberTextField(tileEntity.getSpawnCount(), colp[1], rowp[1]+tfc, colw[1], 1000, 0);
		spawnCountTextField.setTooltip("How many particles to spawn per tick.");
		addComponent(spawnCountTextField);

		final QADTextField offsetXTextField = QADFACTORY.createTextField(tileEntity.getOffsetX(), colp[1], rowp[3]+tfc, colw[1]);
		final QADTextField offsetYTextField = QADFACTORY.createTextField(tileEntity.getOffsetY(), colp[2], rowp[3]+tfc, colw[2]);
		final QADTextField offsetZTextField = QADFACTORY.createTextField(tileEntity.getOffsetZ(), colp[3], rowp[3]+tfc, colw[3]);
		offsetXTextField.setTooltip("Offset from the emitter-block","on the X-Axis.");
		offsetYTextField.setTooltip("Offset from the emitter-block","on the Y-Axis.");
		offsetZTextField.setTooltip("Offset from the emitter-block","on the Z-Axis.");
		addComponent(offsetXTextField);
		addComponent(offsetYTextField);
		addComponent(offsetZTextField);

		final QADTextField offsetRandXTextField = QADFACTORY.createTextField(tileEntity.getOffsetRandX(), colp[1], rowp[4]+tfc, colw[1]);
		final QADTextField offsetRandYTextField = QADFACTORY.createTextField(tileEntity.getOffsetRandY(), colp[2], rowp[4]+tfc, colw[2]);
		final QADTextField offsetRandZTextField = QADFACTORY.createTextField(tileEntity.getOffsetRandZ(), colp[3], rowp[4]+tfc, colw[3]);
		offsetRandXTextField.setTooltip("Random offset multiplicator","on the X-Axis.");
		offsetRandYTextField.setTooltip("Random offset multiplicator","on the Y-Axis.");
		offsetRandZTextField.setTooltip("Random offset multiplicator","on the Z-Axis.");
		addComponent(offsetRandXTextField);
		addComponent(offsetRandYTextField);
		addComponent(offsetRandZTextField);

		final QADTextField velocityXTextField = QADFACTORY.createTextField(tileEntity.getVelocityX(), colp[1], rowp[5]+tfc, colw[1]);
		final QADTextField velocityYTextField = QADFACTORY.createTextField(tileEntity.getVelocityY(), colp[2], rowp[5]+tfc, colw[2]);
		final QADTextField velocityZTextField = QADFACTORY.createTextField(tileEntity.getVelocityZ(), colp[3], rowp[5]+tfc, colw[3]);
		velocityXTextField.setTooltip("Initial velocity on the X-Axis.");
		velocityYTextField.setTooltip("Initial velocity on the Y-Axis.");
		velocityZTextField.setTooltip("Initial velocity on the Z-Axis.");
		addComponent(velocityXTextField);
		addComponent(velocityYTextField);
		addComponent(velocityZTextField);

		final QADTextField velocityRandXTextField = QADFACTORY.createTextField(tileEntity.getVelocityRandX(), colp[1], rowp[6]+tfc, colw[1]);
		final QADTextField velocityRandYTextField = QADFACTORY.createTextField(tileEntity.getVelocityRandY(), colp[2], rowp[6]+tfc, colw[2]);
		final QADTextField velocityRandZTextField = QADFACTORY.createTextField(tileEntity.getVelocityRandZ(), colp[3], rowp[6]+tfc, colw[3]);
		velocityRandXTextField.setTooltip("Random velocity multiplicator on X-Axis.","0 to disable.");
		velocityRandYTextField.setTooltip("Random velocity multiplicator on Y-Axis.","0 to disable.");
		velocityRandZTextField.setTooltip("Random velocity multiplicator on Z-Axis.","0 to disable.");
		addComponent(velocityRandXTextField);
		addComponent(velocityRandYTextField);
		addComponent(velocityRandZTextField);

		QADButton applyButton = QADFACTORY.createButton("Apply", colp[1], rowp[8], colw[1], null);
		applyButton.setEnabled(true);
		applyButton.setAction(new Runnable() {
			@Override public void run() {
				NBTTagCompound commandComp = new NBTTagCompound();
				commandComp.setString("var_type", particleTypeTextField.getText());
				commandComp.setInteger("var_spawnCount", parseInt(spawnCountTextField.getText(),tileEntity.getSpawnCount(), 1, 1000));

				commandComp.setFloat("var_offsetX", parseFloat(offsetXTextField.getText(), tileEntity.getOffsetX(), -128, +128));
				commandComp.setFloat("var_offsetY", parseFloat(offsetYTextField.getText(), tileEntity.getOffsetY(), -128, +128));
				commandComp.setFloat("var_offsetZ", parseFloat(offsetZTextField.getText(), tileEntity.getOffsetZ(), -128, +128));

				commandComp.setFloat("var_offsetRandX", parseFloat(offsetRandXTextField.getText(), tileEntity.getOffsetRandX(), 0, +128));
				commandComp.setFloat("var_offsetRandY", parseFloat(offsetRandYTextField.getText(), tileEntity.getOffsetRandY(), 0, +128));
				commandComp.setFloat("var_offsetRandZ", parseFloat(offsetRandZTextField.getText(), tileEntity.getOffsetRandZ(), 0, +128));

				commandComp.setFloat("var_velocityX", parseFloat(velocityXTextField.getText(), tileEntity.getVelocityX(), -10, +10));
				commandComp.setFloat("var_velocityY", parseFloat(velocityYTextField.getText(), tileEntity.getVelocityY(), -10, +10));
				commandComp.setFloat("var_velocityZ", parseFloat(velocityZTextField.getText(), tileEntity.getVelocityZ(), -10, +10));

				commandComp.setFloat("var_velocityRandX", parseFloat(velocityRandXTextField.getText(), tileEntity.getVelocityRandX(), 0, +2));
				commandComp.setFloat("var_velocityRandY", parseFloat(velocityRandYTextField.getText(), tileEntity.getVelocityRandY(), 0, +2));
				commandComp.setFloat("var_velocityRandZ", parseFloat(velocityRandZTextField.getText(), tileEntity.getVelocityRandZ(), 0, +2));

				// Final
				commandComp.setString("command", "set_vars");

				String commandString = ClientNetworkHandler.makeBlockCommand(position);
				TaleCraft.network.sendToServer(new StringNBTCommandPacket(commandString, commandComp));
				GuiEmitterBlock.this.mc.displayGuiScreen(null);
			}
		});
		addComponent(applyButton);

		QADButton toggleButton = QADFACTORY.createButton("Toggle", colp[2], rowp[8], colw[2], null);
		toggleButton.setEnabled(false);
		addComponent(toggleButton);

		QADButton resetButton = QADFACTORY.createButton(TextFormatting.RED+"Reset", colp[3], rowp[8], colw[3], null);
		resetButton.setEnabled(false);
		addComponent(resetButton);

	}

	public class GuiEmitterBlockParticleTypes extends QADGuiScreen {
		private QADScrollPanel panel;

		public GuiEmitterBlockParticleTypes(GuiEmitterBlock guiEmitterBlock) {
			this.setBehind(guiEmitterBlock);
			this.returnScreen = guiEmitterBlock;
		}

		@Override
		public void buildGui() {
			panel = new QADScrollPanel();
			panel.setPosition(0, 0);
			panel.setSize(200, 200);
			List<String> names = GObjectTypeHelper.getParticleNameList();
			names.sort(String.CASE_INSENSITIVE_ORDER);
			for(final String string : names) {
				QADButton component = null;

				component = new QADButton(string);
				component.simplified = true;
				component.textAlignment = 0;

				if(string.endsWith("_")) {
					component.setEnabled(false);
				} else {
					component.setAction( new Runnable() {
						final String pt = string;
						@Override public void run() {
							particleTypeTextField.setText(pt);
							displayGuiScreen(GuiEmitterBlockParticleTypes.this.getBehind());
						}
					});
				}

				panel.addComponent(component);
			}
			panel.setLayout(new QADListLayout());
			this.addComponent(panel);
		}

		@Override
		public void layoutGui() {
			panel.setSize(this.width, this.height);
		}

	}

}


text:
from .WatermarkRemover import WatermarkRemover

__version__ = '0.0.1'
__author__ = 'caviler@gmail.com'


text:
{% extends "inviteme/base.html" %}

{% block title %}{{ block.super }} » confirmation sent{% endblock %}

{% block content %}

Invitation request

Please, confirm your email address

A confirmation message has been sent to you. Please click on the link in the message to verify that your email address does exist and it is being used by a human being.

Thank you!

{% endblock %}


text:
<?php

/**
 * Core Design resource collection
 *
 * @category    Mage
 * @package     Mage_Core
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Core_Model_Resource_Design_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
    /**
     * Core Design resource collection
     *
     */
    protected function _construct()
    {
        $this->_init('core/design');
    }

    /**
     * Join store data to collection
     *
     * @return Mage_Core_Model_Resource_Design_Collection
     */
    public function joinStore()
    {
         return $this->join(
            array('cs' => 'core/store'),
            'cs.store_id = main_table.store_id',
            array('cs.name'));
    }

    /**
     * Add date filter to collection
     *
     * @param null|int|string|Zend_Date $date
     * @return Mage_Core_Model_Resource_Design_Collection
     */
    public function addDateFilter($date = null)
    {
        if (is_null($date)) {
            $date = $this->formatDate(true);
        } else {
            $date = $this->formatDate($date);
        }

        $this->addFieldToFilter('date_from', array('lteq' => $date));
        $this->addFieldToFilter('date_to', array('gteq' => $date));
        return $this;
    }

    /**
     * Add store filter to collection
     *
     * @param int|array $storeId
     * @return Mage_Core_Model_Resource_Design_Collection
     */
    public function addStoreFilter($storeId)
    {
        return $this->addFieldToFilter('store_id', array('in' => $storeId));
    }
}