text:
function File-RemoveReadonlyFlag([System.Array] $files)
{
	if ($files -ne $null)
	{
		$files | %{
			if (Test-Path $_)
			{
				Set-ItemProperty $_ -name IsReadOnly -value $false
			}
		}
	}
}

function File-AddReadonlyFlag([System.Array] $files)
{
	if ($files -ne $null)
	{
		$files | %{
			if (Test-Path $_)
			{
				Set-ItemProperty $_ -name IsReadOnly -value $true
			}
		}
	}
}

function File-FindSolutionFileUnderPath([string] $path)
{
	if (-not (Test-Path $path))
	{
		throw "Path: $path does not exist, please verify"
	}

	$solutionFiles = ls $path -Filter *.sln

	if ($solutionFiles -eq $null)
	{
		throw "No solution files found at $path (not recursive), please verify"
	}

	# if more than one found thne type is array; else type is FileInfo
	if ($solutionFiles.GetType().Name -eq 'Object[]')
	{
		throw "Multiple solutions found in current directory, please specify $SolutionFile"
	}

	return $solutionFiles.FullName
}


text:
module Gametel
  module Webviewable

    attr_reader :platform

    ROBOTIUM_LEFT = 21
    ROBOTIUM_RIGHT = 22

    def initialize(pform = :brazenhead)
      @platform = Gametel::Platforms::BrazenheadPlatform.new if pform == :brazenhead
    end

    #
    # click on the provided text
    #
    def click_on_text(text)
      platform.click_on_text text
    end

    #
    # Returns true if the provided text is found on the screen
    #
    def has_text?(text)
      platform.has_text?(text)
    end

    #
    # Wait for the provided text to appear
    #
    def wait_for_text(text_to_find)
      platform.wait_for_text(text_to_find)
      raise "Timed out waiting for the text '#{text_to_find}'" unless platform.last_json
    end

    #
    # scroll down
    #
    def scroll_down
      platform.scroll_down
    end

    #
    # scroll up
    #
    def scroll_up
      platform.scroll_up
    end

    #
    # scroll left
    #
    def scroll_left
      platform.scroll_to_side ROBOTIUM_LEFT
    end

    #
    # scroll right
    #
    def scroll_right
      platform.scroll_to_side ROBOTIUM_RIGHT
    end

  end
end

redpajama_set_name: RedPajamaGithub


text:
package org.kie.hacep.core.infra.consumer;

import org.kie.hacep.core.infra.election.LeadershipCallback;

public interface EventConsumer extends LeadershipCallback {

    void initConsumer(ConsumerHandler consumerHandler);

    void poll();

    void stop();

}


text:
define(['jquery',
    'underscore',
    'backbone',
    'libs/jquery.form'
    ],
    function($,
        _,
        Backbone,
        JQueryForm) {
            var goatUtils = {
                makeId: function(lessonName) {
                    //var id =
                    return  lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g, '');
                },

                addMenuClasses: function(arr) {
                    for (var i = 0; i < arr.length; i++) {
                        var menuItem = arr[i];
                        //console.log(menuItem);
                        if (menuItem.type && menuItem.type === 'CATEGORY') {
                            menuItem.class = 'fa-angle-right pull-right';
                        }
                    }
                    return arr;
                },
//                debugFormSubmission: false,
                // pre-submit callback
                showRequest: function(formData, jqForm, options) {
                    if (GoatUtils.debugFormSubmission) {
                        // formData is an array; here we use $.param to convert it to a string to display it
                        // but the form plugin does this for you automatically when it submits the data
                        var queryString = $.param(formData);

                        // jqForm is a jQuery object encapsulating the form element.  To access the
                        // DOM element for the form do this:
                        // var formElement = jqForm[0];

                        alert('About to submit: \n\n' + queryString);
                    }
                    // here we could return false to prevent the form from being submitted;
                    // returning anything other than false will allow the form submit to continue
                    return true;
                },

                displayButton: function(id, show) {
                    if ($('#' + id)) {
                        if (show) {
                            $('#' + id).show();
                        } else {

                        }
                    }
                },

                showLessonCookiesAndParams: function() {
                    $.get(goatConstants.cookieService, {}, function(reply) {
                        $("#lesson_cookies").html(reply);
                    }, "html");
                },

                scrollToHelp: function() {
                    $('#leftside-navigation').height($('#main-content').height() + 15)
                    var target = $('#lesson-helps-wrapper');
                    this.scrollEasy(target);
                },

                scrollToTop: function() {
                    $('.lessonHelp').hide();
                    var target = $('#container');
                    this.scrollEasy(target);
                },

                scrollEasy: function(target) {
                    $('html,body').animate({
                        scrollTop: target.offset().top
                    }, 1000);
                },

                highlightCurrentLessonMenu: function(id) {
                    //TODO: move selectors in first two lines into goatConstants
                    $('ul li.selected').removeClass(goatConstants.selectedMenuClass)
                    $('ul li.selected a.selected').removeClass(goatConstants.selectedMenuClass)
                    $('#' + id).addClass(goatConstants.selectedMenuClass);
                    $('#' + id).parent().addClass(goatConstants.selectedMenuClass);
                },

        };

        return goatUtils;
});


text:
<?php

namespace Nascom\TeamleaderApiClient\Request\Planning;

use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;

/**
 * Class ListPlannedTasksRequest
 *
 * @package Nascom\TeamleaderApiClient\Request\Planning
 */
class ListPlannedTasksRequest extends AbstractPostRequest
{
    /**
     * ListPlannedTasksRequest constructor.
     *
     * @param $date_from
     * @param $date_to
     * @param array $options
     *   Optional parameters:
     *   - user_id
     *   - project_id
     */
    public function __construct($date_from, $date_to, array $options = [])
    {
        $this->options = $options;
        $this->setDateFrom($date_from);
        $this->setDateTo($date_to);
    }

    /**
     * @param $date_from
     */
    public function setDateFrom($date_from)
    {
        $this->options['date_from'] = $date_from;
    }

    /**
     * @param $date_to
     */
    public function setDateTo($date_to)
    {
        $this->options['date_to'] = $date_to;
    }

    /**
     * @return string
     */
    public function getUri()
    {
        return 'getPlannedTasks.php';
    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300|Poiret+One" rel="stylesheet">
    <link href="../css/bootstrap.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">

    <title>Shelley's Blog</title>

Cohort

Cultural

Technical

Home

What?... More Nuts and Bolts

Should I get the dark green drill or the forest green drill?

        Captivating thoughts from someone who tries not to think.

10 December 2016

Grid Based Design

Grid systems bring visual structure and balance to site design. As a tool grids are useful for organizing and presenting information. Used properly, they can enhance the user experience by creating preditable patterns for users to follow. From a designer's point of view they allow for an organized methodology for planning systematic layouts. [Content Care Nov/07/2016]

        From a programmer's point of view this allows for a simple and clear way to structure your code, creating blocks of content that can be custom formatted to its location on the page.

Responsive Webpage Design

Responsive web design (RWD) is an approach to web design aimed at allowing desktop webpages to be viewed in response to the size of the screen or web browser one is viewing with. [Wikipedia]

        So regardless of what device, or screen size of the device you are using to view a webpage you will see a clean error free webpage with all its content intake. RWD allows you to set different display looks for the same webpage depending on the screen size viewing it.

Semantic Structure

HTML semantics are a nuanced subject, widely debated and easily open to interpretation. Not everyone agrees on the same thing right away, and this is where problems arise. [Let's Talk about Semantics - Mike Robinson]

          There are two types of elements in html. Semantic and non-semantic. Non-semantic elements tell you nothing about its content eg. tags such as div or span. Semantic elements tell you clearly what their content is eg. tags such as form, table, article etc. So the semantic structure of a webpage is an accurately described page using tags that clearly tell you what their content is.

Psuedo Code

Is an informal high-level description of the operating principle of a computer program or other algorithm. [Wikipedia]

        Psuedo code is a tool used by programmers to talk out the logic of a part of a program. It is all text based and is a simple way of summarising how to handle or think out your code before you start coding. This helps to reduce error as it provides a simple structure for you to then follow as you code. It also gives you a reference point for when you are checking errors in your code. Helping to break down each part in a plan english way to compare against your coded process.

Is this an AWESOME blog or what...?

        Leave a comment


text:
(function() {
  var BrainfuckCompileTimeException, BrainfuckException, BrainfuckInterpreter, BrainfuckInterpreterInstance, BrainfuckNoDataException, BrainfuckRuntimeException,
    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  BrainfuckInterpreterInstance = (function() {
    var backward, compiler_map, decrease, enter, forward, increase, input, leave, operator_map, output;

    function BrainfuckInterpreterInstance() {}

    forward = function() {
      this.dp++;
      return true;
    };

    backward = function() {
      this.dp--;
      return true;
    };

    increase = function() {
      var base, name;
      if ((base = this.memory)[name = this.dp] == null) {
        base[name] = 0;
      }
      if (this.memory[this.dp] === 0xff) {
        this.memory[this.dp] = 0;
      } else {
        this.memory[this.dp]++;
      }
      return true;
    };

    decrease = function() {
      var base, name;
      if ((base = this.memory)[name = this.dp] == null) {
        base[name] = 0;
      }
      if (this.memory[this.dp] === 0) {
        this.memory[this.dp] = 0xff;
      } else {
        this.memory[this.dp]--;
      }
      return true;
    };

    output = function() {
      return this.output_cache.push(this.memory[this.dp]);
    };

    input = function() {
      if (this.input_cache.length === 0) {
        this.status = 'wait_input';
        return false;
      } else {
        this.memory[this.dp] = this.input_cache.shift();
        return true;
      }
    };

    enter = function() {
      if (this.memory[this.dp] === 0) {
        this.ip = this.jump_cache[this.ip];
      }
      return true;
    };

    leave = function() {
      if (this.memory[this.dp] !== 0) {
        this.ip = this.jump_cache[this.ip];
      }
      return true;
    };

    compiler_map = {
      '>': function() {
        return 0;
      },
      '<': function() {
        return 1;
      },
      '+': function() {
        return 2;
      },
      '-': function() {
        return 3;
      },
      '.': function() {
        return 4;
      },
      ',': function() {
        return 5;
      },
      '[': function() {
        this.loop_position_cache.push(this.code.length);
        return 6;
      },
      ']': function() {
        var pos;
        if (this.loop_position_cache.length === 0) {
          this.status = 'exception';
          return false;
        } else {
          pos = this.loop_position_cache.pop();
          this.jump_cache[pos] = this.code.length;
          this.jump_cache[this.code.length] = pos;
        }
        return 7;
      }
    };

    operator_map = {
      0: forward,
      1: backward,
      2: increase,
      3: decrease,
      4: output,
      5: input,
      6: enter,
      7: leave
    };

    BrainfuckInterpreterInstance.prototype.status = 'halt';

    BrainfuckInterpreterInstance.prototype.exception = '';

    BrainfuckInterpreterInstance.prototype.code = [];

    BrainfuckInterpreterInstance.prototype.ip = 0;

    BrainfuckInterpreterInstance.prototype.memory = [];

    BrainfuckInterpreterInstance.prototype.dp = 0;

    BrainfuckInterpreterInstance.prototype.input_cache = [];

    BrainfuckInterpreterInstance.prototype.output_cache = [];

    BrainfuckInterpreterInstance.prototype.jump_cache = [];

    BrainfuckInterpreterInstance.prototype.loop_position_cache = [];

    BrainfuckInterpreterInstance.prototype.reset = function() {
      this.status = 'halt';
      this.exception = '';
      this.code = [];
      this.ip = 0;
      this.memory = [];
      this.dp = 0;
      this.input_cache = [];
      this.output_cache = [];
      this.jump_cache = [];
      return this.loop_position_cache = [];
    };

    BrainfuckInterpreterInstance.prototype.launch = function() {
      if (this.status !== 'halt') {
        return false;
      }
      if (this.loop_position_cache.length !== 0) {
        this.status = 'exception';
        return false;
      }
      this.status = 'running';
      return true;
    };

    BrainfuckInterpreterInstance.prototype.step = function() {
      if (this.status !== 'running') {
        return false;
      }
      if (this.ip >= this.code.length) {
        this.status = 'halt';
        return false;
      }
      if (operator_map[this.code[this.ip]].apply(this)) {
        ++this.ip;
        return true;
      } else {
        return false;
      }
    };

    BrainfuckInterpreterInstance.prototype.writeCode = function(char) {
      var opcode;
      if (this.status !== 'halt' || typeof compiler_map[char] !== 'function') {
        return false;
      }
      opcode = compiler_map[char].apply(this);
      if (opcode === false) {
        return false;
      }
      this.code.push(opcode);
      return true;
    };

    BrainfuckInterpreterInstance.prototype.writeData = function(data) {
      var e, i, index, len;
      switch (typeof data) {
        case 'number':
          this.input_cache.push(data);
          break;
        case 'string':
          for (index in data) {
            this.input_cache.push(data.charCodeAt(index));
          }
          break;
        case 'object':
          if (data instanceof Array) {
            for (i = 0, len = data.length; i < len; i++) {
              e = data[i];
              this.writeData(e);
            }
          } else {
            return false;
          }
          break;
        default:
          return false;
      }
      if (this.status === 'wait_input') {
        this.status = 'running';
      }
      return true;
    };

    return BrainfuckInterpreterInstance;

  })();

  window.BrainfuckException = BrainfuckException = (function() {
    function BrainfuckException(msg) {
      this.msg = msg;
    }

    return BrainfuckException;

  })();

  window.BrainfuckCompileTimeException = BrainfuckCompileTimeException = (function(superClass) {
    extend(BrainfuckCompileTimeException, superClass);

    function BrainfuckCompileTimeException() {
      return BrainfuckCompileTimeException.__super__.constructor.apply(this, arguments);
    }

    return BrainfuckCompileTimeException;

  })(BrainfuckException);

  window.BrainfuckRuntimeException = BrainfuckRuntimeException = (function(superClass) {
    extend(BrainfuckRuntimeException, superClass);

    function BrainfuckRuntimeException() {
      return BrainfuckRuntimeException.__super__.constructor.apply(this, arguments);
    }

    return BrainfuckRuntimeException;

  })(BrainfuckException);

  window.BrainfuckNoDataException = BrainfuckNoDataException = (function(superClass) {
    extend(BrainfuckNoDataException, superClass);

    function BrainfuckNoDataException() {
      return BrainfuckNoDataException.__super__.constructor.apply(this, arguments);
    }

    return BrainfuckNoDataException;

  })(BrainfuckException);

  window.BrainfuckInterpreter = BrainfuckInterpreter = (function() {
    var instance;

    instance = BrainfuckInterpreterInstance.prototype;

    BrainfuckInterpreter.prototype.inFn = prompt;

    BrainfuckInterpreter.prototype.outFn = console.info;

    BrainfuckInterpreter.prototype.getStatus = function() {
      return instance.status;
    };

    BrainfuckInterpreter.prototype.getException = function() {
      return instance.exception;
    };

    BrainfuckInterpreter.prototype.getInstructionPointer = function() {
      return instance.ip;
    };

    BrainfuckInterpreter.prototype.getCurrentInstruction = function() {
      return instance.code[instance.ip];
    };

    function BrainfuckInterpreter() {
      instance = new BrainfuckInterpreterInstance();
    }

    BrainfuckInterpreter.prototype.reset = function() {
      return instance.reset();
    };

    BrainfuckInterpreter.prototype.launch = function() {
      return instance.launch();
    };

    BrainfuckInterpreter.prototype.writeCode = function(code) {
      var char, i, index, len;
      for (index = i = 0, len = code.length; i < len; index = ++i) {
        char = code[index];
        if (!instance.writeCode(char) && 'halt' !== instance.status) {
          throw new BrainfuckCompileTimeException(instance.exception);
        }
      }
      return true;
    };

    BrainfuckInterpreter.prototype.step = function() {
      if (!instance.step()) {
        switch (instance.status) {
          case 'halt':
            return false;
          case 'running':
            return true;
          case 'exception':
            throw new BrainfuckRuntimeException(instance.exception);
            break;
          case 'wait_input':
            if (typeof this.inFn === 'function') {
              instance.writeData(this.inFn.call());
            } else {
              throw new BrainfuckNoDataException(instance.exception);
            }
            break;
          default:
            throw new BrainfuckRuntimeException('Illegal Status!');
        }
      } else {
        if (instance.output_cache.length) {
          this.outFn(this, instance.output_cache);
          instance.output_cache = [];
        }
      }
      return true;
    };

    BrainfuckInterpreter.prototype.run = function() {
      while (instance.step()) {
        ;
      }
      if (instance.output_cache.length) {
        this.outFn(this, instance.output_cache);
        instance.output_cache = [];
      }
      return true;
    };

    return BrainfuckInterpreter;

  })();

}).call(this);

//# sourceMappingURL=bf.js.map


text:
package io.gravitee.am.identityprovider.franceconnect.authentication;

import io.gravitee.am.identityprovider.api.AuthenticationContext;
import io.gravitee.el.TemplateEngine;
import io.gravitee.gateway.api.Request;
import io.gravitee.gateway.api.Response;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;

/**
 * @author David BRASSELY (david.brassely at graviteesource.com)
 * @author GraviteeSource Team
 */
public class DummyAuthenticationContext implements AuthenticationContext {

    private final Map<String, Object> attributes;
    private final Request request;

    DummyAuthenticationContext(Map<String, Object> attributes, Request request) {
        this.attributes = attributes;
        this.request = request;
    }

    @Override
    public Request request() {
        return request;
    }

    @Override
    public Response response() {
        throw new IllegalStateException();
    }

    @Override
    public <T> T getComponent(Class<T> componentClass) {
        throw new IllegalStateException();
    }

    @Override
    public void setAttribute(String name, Object value) {
        attributes.put(name, value);
    }

    @Override
    public void removeAttribute(String name) {
        attributes.remove(name);
    }

    @Override
    public Object getAttribute(String name) {
        return attributes.get(name);
    }

    @Override
    public Enumeration<String> getAttributeNames() {
        return Collections.enumeration(attributes.keySet());
    }

    @Override
    public Map<String, Object> getAttributes() {
        return attributes;
    }

    @Override
    public TemplateEngine getTemplateEngine() {
        return TemplateEngine.templateEngine();
    }
}


text:
<?php

namespace Elcodi\Component\Core\Adapter\Parser;

use Elcodi\Component\Core\Adapter\Parser\Interfaces\ParserAdapterInterface;

/**
 * Class DummyParserAdapter
 */
class DummyParserAdapter implements ParserAdapterInterface
{
    /**
     * Return the parser identifier
     *
     * @return string Parser identifier
     */
    public function getIdentifier()
    {
        return 'none';
    }

    /**
     * Transform plain text to parsed content
     *
     * @param string $text Text to transform
     *
     * @return string Transformed string
     */
    public function parse($text)
    {
        return $text;
    }
}


text:
<?php

namespace ApiBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use FOS\RestBundle\Controller\FOSRestController;

class BookingsController extends FOSRestController
{
    /**
     * @Route("/list")
     * @Template()
     */
    public function getListAction()
    {
        return array(
                // ...
            );    }

}


text:
// This file is automatically generated.

package adila.db;

/*
 * ZTE Grand X Quad Lite
 *
 * DEVICE: P188F07
 * MODEL: ZTE V967S
 */
final class p188f07_zte20v967s {
    public static final String DATA = "ZTE|Grand X Quad Lite|";
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using Xunit;

namespace System.CodeDom.Tests
{
    public class CodeChecksumPragmaTests : CodeObjectTestBase<CodeChecksumPragma>
    {
        [Fact]
        public void Ctor_Default()
        {
            var pragma = new CodeChecksumPragma();
            Assert.Empty(pragma.FileName);
            Assert.Equal(Guid.Empty, pragma.ChecksumAlgorithmId);
            Assert.Null(pragma.ChecksumData);
        }

        public static IEnumerable<object[]> Ctor_TestData()
        {
            yield return new object[] { null, new Guid(), null };
            yield return new object[] { "", Guid.NewGuid(), new byte[0] };
            yield return new object[] { "Value1", Guid.NewGuid(), new byte[] { 0, 1, 2, 3 } };
        }

        [Theory]
        [MemberData(nameof(Ctor_TestData))]
        public void Ctor(string fileName, Guid algorithmId, byte[] checksumData)
        {
            var pragma = new CodeChecksumPragma(fileName, algorithmId, checksumData);
            Assert.Equal(fileName ?? string.Empty, pragma.FileName);
            Assert.Equal(algorithmId, pragma.ChecksumAlgorithmId);
            Assert.Equal(checksumData, pragma.ChecksumData);
        }

        [Theory]
        [MemberData(nameof(String_TestData))]
        public void FileName_Set_Get_ReturnsExpected(string value)
        {
            var pragma = new CodeChecksumPragma();
            pragma.FileName = value;
            Assert.Equal(value ?? string.Empty, pragma.FileName);
        }

        public static IEnumerable<object[]> Guid_TestData()
        {
            yield return new object[] { new Guid() };
            yield return new object[] { Guid.NewGuid() };
        }

        [Theory]
        [MemberData(nameof(Guid_TestData))]
        public void AlgorithmId_Set_Get_ReturnsExpected(Guid value)
        {
            var pragma = new CodeChecksumPragma();
            pragma.ChecksumAlgorithmId = value;
            Assert.Equal(value, pragma.ChecksumAlgorithmId);
        }

        [Theory]
        [InlineData(null)]
        [InlineData(new byte[0])]
        [InlineData(new byte[] { 0, 1, 2, 3 })]
        public void ChecksumData_Set_Get_ReturnsExpected(byte[] value)
        {
            var pragma = new CodeChecksumPragma();
            pragma.ChecksumData = value;
            Assert.Equal(value, pragma.ChecksumData);
        }
    }
}


text:
function parallel(nproc, seed)

    addprocs(nproc)
    @everywhere include("preparation.jl")
    @everywhere include("bayes.jl")
    @everywhere include("loglike.jl")

    srand(seed)
    initialvalues = randn(273, nproc)

    writetable(*("initialvalue", "_$seed", ".txt"), DataFrame(initialvalues))

    estparam = Array(Float64, 273, nproc)
    likelihood = Array(Float64, 1, nproc)
    result = Array(Any, nproc, 1)

    for i in 1:nproc
        result[i, 1] = remotecall(optimize, i+1, loglike, initialvalues[:, i], BFGS())
    end

    for j in 1:nproc
        wait(result[j, 1])
        z = fetch(result[j, 1])
        estparam[:, j] = Optim.minimizer(z)
        likelihood[1, j] = Optim.minimum(z)
    end

    writetable(*("estparam", "_$seed", ".txt"), DataFrame(estparam))
    writetable(*("likelihood", "_$seed", ".txt"), DataFrame(likelihood))

end

parallel(48, 1)


text:
<!DOCTYPE html>

<meta content="text/html;charset=utf-8" http-equiv="content-type"/>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>pymel.core.uitypes.PromptDialog — PyMEL 1.0.7 documentation</title>
<link href="../../../_static/nature.css" rel="stylesheet" type="text/css"/>
<link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../index-2.html" rel="top" title="PyMEL 1.0.7 documentation"/>
<link href="../../pymel.core.uitypes.html" rel="up" title="pymel.core.uitypes"/>
<link href="pymel.core.uitypes.PyUI.html" rel="next" title="pymel.core.uitypes.PyUI"/>
<link href="pymel.core.uitypes.ProgressBar.html" rel="prev" title="pymel.core.uitypes.ProgressBar"/>
<link href="../../../../style/adsk.cpm.css" rel="stylesheet" type="text/css"/><meta content="expert" name="experiencelevel"/><meta content="programmer" name="audience"/><meta content="enable" name="user-comments"/><meta content="ENU" name="language"/><meta content="MAYAUL" name="product"/><meta content="2016" name="release"/><meta content="Customization" name="book"/><meta content="Maya-Tech-Docs" name="component"/><meta content="/view/MAYAUL/2016/ENU/" name="helpsystempath"/><meta content="04/03/2015" name="created"/><meta content="04/03/2015" name="modified"/><meta content="Navigation

 index

 modules |

 next |

 previous |
 PyMEL 1.0.7 documentation »
 pymel.core.uitypes »

 pymel.core.uitypes.PromptDialog ¶

 class PromptDialog ¶
 class counterpart of mel function promptDialog
 The promptDialog command creates a modal dialog with a message to the user, a text field in which the user may enter a response, and a variable number of buttons to dismiss the dialog. The dialog is dismissed when the user..." name="description"/><meta content="__PyMel_generated_classes_pymel_core_uitypes_pymel_core_uitypes_PromptDialog_html" name="topicid"/>

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.uitypes »

pymel.core.uitypes.PromptDialog¶

<map id="inheritance1754731ceb" name="inheritance1754731ceb">
<area alt="" coords="5,44,91,68" href="#pymel.core.uitypes.PromptDialog" id="node1" shape="rect" title="class counterpart of mel function `promptDialog`"></area>
<area alt="" coords="12,5,84,29" href="pymel.core.uitypes.PyUI.html#pymel.core.uitypes.PyUI" id="node2" shape="rect" title="PyUI"></area>
</map>

class <tt class="descname">PromptDialog</tt>¶

class counterpart of mel function <tt class="xref py py-obj docutils literal">promptDialog</tt>

The promptDialog command creates a modal dialog with a message to the user, a text field in which the user may enter a response, and a variable number of buttons to dismiss the dialog.  The dialog is dismissed when the user presses any button or chooses the close item from the window menu.  In the case where a button is pressed then the name of the button selected is returned.  If the dialog is dismissed via the close item then the string returned is specified by the -ds/dismissStringflag. The default behaviour when no arguments are specified is to create an empty single button dialog. To obtain the text entered by the user simply query the -tx/textflag.

<tt class="descname">getText</tt><big>(</big>**kwargs<big>)</big>¶

The field text.

Derived from mel command <tt class="xref py py-obj docutils literal">maya.cmds.promptDialog</tt>

Previous topic

pymel.core.uitypes.ProgressBar

Next topic

pymel.core.uitypes.PyUI

Core Modules

<tt class="xref">animation</tt>

<tt class="xref">effects</tt>

<tt class="xref">general</tt>

<tt class="xref">language</tt>

<tt class="xref">modeling</tt>

<tt class="xref">rendering</tt>

<tt class="xref">system</tt>

<tt class="xref">windows</tt>

Type Modules

<tt class="xref">datatypes</tt>

<tt class="xref">nodetypes</tt>

<tt class="xref">uitypes</tt>

Other Modules

<tt class="xref">plugins</tt>

<tt class="xref">mayautils</tt>

<tt class="xref">util</tt>

<tt class="xref">versions</tt>

<tt class="xref">tools</tt>

This Page

Show Source

Quick search

<form action="http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/search.html" class="search" method="get"></form>
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>

    Enter search terms or a module, class or function name.

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.uitypes »

        © Copyright 2009, Chad Dombrova.
      Created using Sphinx 1.2.3.


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 4(5): 423 (1906)

#### Original name
Melampsora sancti-johannis Barclay

### Remarks
null


text:
/*
 * A simple example of the use of the high level PAPI_flops call.
 * PAPI_flops measures elapsed time, process time, floating point
 * instructions and MFLOP/s for code bracketted by calls to this routine.
 * For the following matrix multiply you should get 2*(INDEX^3) flpins
 * on Intel Pentium processors.
 */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <memory.h>
#include <malloc.h>
#include "papi.h"

#define INDEX 100

static void test_fail(char *file, int line, char *call, int retval);
static void __roi_begin() {

}

static void __roi_end() {
}

int main(int argc, char **argv) {
  extern void dummy(void *);
  float matrixa[INDEX][INDEX], matrixb[INDEX][INDEX], mresult[INDEX][INDEX];
  float real_time, proc_time, mflops;
  long long flpins;
  int retval;
  int i,j,k;

  /* Initialize the Matrix arrays */
  for ( i=0; i<INDEX*INDEX; i++ ){
    mresult[0][i] = 0.0;
    matrixa[0][i] = matrixb[0][i] = rand()*(float)1.1; }

  /* Setup PAPI library and begin collecting data from the counters */
  if((retval=PAPI_flops( &real_time, &proc_time, &flpins, &mflops))<PAPI_OK)
    test_fail(__FILE__, __LINE__, "PAPI_flops", retval);

  /* Matrix-Matrix multiply */
  for (i=0;i<INDEX;i++)
   for(j=0;j<INDEX;j++)
    for(k=0;k<INDEX;k++)
      mresult[i][j]=mresult[i][j] + matrixa[i][k]*matrixb[k][j];

  /* Collect the data into the variables passed in */
  if((retval=PAPI_flops( &real_time, &proc_time, &flpins, &mflops))<PAPI_OK)
    test_fail(__FILE__, __LINE__, "PAPI_flops", retval);

  printf("Real_time:\t%f\nProc_time:\t%f\nTotal flpins:\t%lld\nMFLOPS:\t\t%f\n",
  real_time, proc_time, flpins, mflops);
  printf("%s\tPASSED\n", __FILE__);
  PAPI_shutdown();
  exit(0);
}

static void test_fail(char *file, int line, char *call, int retval){
    printf("%s\tFAILED\nLine # %d\n", file, line);
    if ( retval == PAPI_ESYS ) {
        char buf[128];
        memset( buf, '\0', sizeof(buf) );
        sprintf(buf, "System error in %s:", call );
        perror(buf);
    }
    else if ( retval > 0 ) {
        printf("Error calculating: %s\n", call );
    }
    else {
        printf("Error in %s: %s\n", call, PAPI_strerror(retval) );
    }
    printf("\n");
    exit(1);
}


text:
.recline-transform .script {
  margin-right: 10px;
}

.recline-transform .script textarea {
  width: 100%;
  height: 100px;
  font-family: monospace;
}

.recline-transform h2 {
  margin-bottom: 10px;
}

.recline-transform h2 .okButton {
  margin-left: 10px;
  margin-top: -2px;
}

.recline-transform .preview {
  margin-right: 10px;
}

.expression-preview-parsing-status {
  color: #999;
}

.expression-preview-parsing-status.error {
  color: red;
}

.recline-transform .before-after .after {
  font-style: italic;
}

.recline-transform .before-after .after.different {
  font-weight: bold;
}


text:
class ofApp : public ofBaseApp{

	public:
		void setup();
		void update();
		void draw();

		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
    void createParticle();
    void createParticle(int minX , int minY , int maxX ,int maxY);
    void createParticle(ofRectangle rect);
    void createFadeoutParticle(int minX , int minY , int maxX ,int maxY);
    void createRain(int startX , int startY , int endX ,int endY);
    void createHeadParticle(int minX , int minY , int maxX ,int maxY);
    void toggleNoiseMode(float tx, float ty);
//    ofVideoPlayer player;
    ofImage image;

    vector<Particle> particles;
    vector<Particle>::iterator it;
    ofFbo fboImage;
    ofFbo fbo;
    bool bAutoBG;
    ofxSyphonServer server;

//    ofxGlow     glow;

    ofxDuration duration;

	void trackUpdated(ofxDurationEventArgs& args);
    ofPoint videoPos;
    ofRectangle rangeRect;
    float videoScale;

};


text:
<?php

namespace OpenOrchestra\WorkflowFunctionAdminBundle\DataFixtures\MongoDB;

use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use OpenOrchestra\ModelInterface\DataFixtures\OrchestraFunctionalFixturesInterface;

/**
 * Class LoadGroupData
 */
class LoadGroupData extends AbstractLoadGroupData implements OrderedFixtureInterface, OrchestraFunctionalFixturesInterface
{
    /**
     * Load data fixtures with the passed EntityManager
     *
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager)
    {
        $this->addRole('group3');

        $manager->flush();
    }

    /**
     * Get the order of this fixture
     *
     * @return integer
     */
    public function getOrder()
    {
        return 650;
    }

}


text:
module NoodallPoll
  class PollResponse
    include MongoMapper::Document

    key :text, String
    timestamps!

    belongs_to :poll, :class_name => 'NoodallPoll::Poll'

    def self.responses_for_poll(poll)
      poll_responses = where(:poll_id => poll.id)
      hash = Hash.new
      poll_responses.each do |poll_response|
        if hash[poll_response.text]
          hash[poll_response.text] += 1
        else
          hash[poll_response.text] = 1
        end
      end
      return hash
    end

  end
end


text:
package com.facebook.buck.android;

import com.facebook.buck.util.immutables.BuckStyleImmutable;
import com.google.common.collect.ImmutableSet;
import com.facebook.buck.model.BuildTarget;

import org.immutables.value.Value;

@Value.Immutable
@BuckStyleImmutable
abstract class AbstractAPKModule {
  public abstract String getName();

  @Value.Derived
  public String getCanaryClassName() {
    if (getName().equals(APKModuleGraph.ROOT_APKMODULE_NAME)) {
      return "secondary";
    } else {
      return String.format("store%04x", getName().hashCode() & 0xFFFF);
    }
  }

  public abstract ImmutableSet<BuildTarget> getBuildTargets();
}


text:
package org.optaplanner.spring.boot.autoconfigure.gizmo;

import org.optaplanner.spring.boot.autoconfigure.gizmo.constraints.TestdataGizmoConstraintProvider;
import org.optaplanner.spring.boot.autoconfigure.gizmo.domain.TestdataGizmoSpringEntity;
import org.optaplanner.spring.boot.autoconfigure.gizmo.domain.TestdataGizmoSpringSolution;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EntityScan(basePackageClasses = { TestdataGizmoSpringEntity.class, TestdataGizmoSpringSolution.class,
        TestdataGizmoConstraintProvider.class })
public class GizmoSpringTestConfiguration {
}


text:
<?php

namespace App\Policies;

use App\Helpers\RolesHelper;
use App\Models\Competition;
use App\Models\Division;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class DivisionPolicy
{
    use HandlesAuthorization, CheckRoles;

    public function viewAny(User $user, Competition $competition): bool
    {
        if ($user->hasRole(RolesHelper::seasonAdmin($competition->getSeason()))) {
            return true;
        }

        if ($user->hasRole(RolesHelper::competitionAdmin($competition))) {
            return true;
        }

        return $this->hasAnyDivisionAdminRole($user, $competition);
    }

    public function create(User $user, Competition $competition): bool
    {
        if ($user->hasRole(RolesHelper::seasonAdmin($competition->getSeason()))) {
            return true;
        }

        return $user->hasRole(RolesHelper::competitionAdmin($competition));
    }

    public function update(User $user, Division $division): bool
    {
        if ($user->hasRole(RolesHelper::seasonAdmin($division->getCompetition()->getSeason()))) {
            return true;
        }

        if ($user->hasRole(RolesHelper::competitionAdmin($division->getCompetition()))) {
            return true;
        }

        return $user->hasRole(RolesHelper::divisionAdmin($division));
    }

    public function delete(User $user, Division $division): bool
    {
        if ($user->hasRole(RolesHelper::seasonAdmin($division->getCompetition()->getSeason()))) {
            return true;
        }

        return $user->hasRole(RolesHelper::competitionAdmin($division->getCompetition()));
    }
}


text:
const div = document.createElement('div')
div.style = 'opacity: 0.05;position:fixed;top:0;left:0;height:100%;width:100%;pointer-events:none;background-repeat:repeat;'
div.style.backgroundImage = 'url(一张png图片的地址)'
div.style.zIndex = '2147483647'
div.className = 'watermark'
document.body.insertBefore(div, bo.firstChild)


text:
<?php

namespace common\components;

use yii\grid\ActionColumn;
use yii\helpers\Html;

class ExtActionColumn extends ActionColumn {

    public $filter;

    /**
     * Renders the filter cell.
     */
    public function renderFilterCell() {
        return Html::tag('td', '
' . $this->filter . '
', $this->filterOptions);
    }
}


text:
package org.apache.webapp.admin.server;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.QueryExp;
import javax.management.Query;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.JMException;

import javax.management.modelmbean.ModelMBean;
import javax.management.modelmbean.ModelMBeanInfo;

import org.apache.struts.util.MessageResources;
import org.apache.webapp.admin.LabelValueBean;
import org.apache.webapp.admin.Lists;
import org.apache.webapp.admin.TomcatTreeBuilder;
import org.apache.webapp.admin.ApplicationServlet;

/**
 * Test Action that handles events from the tree control test
 * page.
 *
 * @author Jazmin Jonson
 * @author Manveen Kaur
 * @version $Revision: 1.2 $ $Date: 2003/03/20 05:40:10 $
 */

public class EditServerAction extends Action {

    /**
     * The MBeanServer we will be interacting with.
     */
    private MBeanServer mBServer = null;

    /**
     * The MessageResources we will be retrieving messages from.
     */
    private MessageResources resources = null;

    // --------------------------------------------------------- Public Methods

    /**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an ActionForward instance describing where and how
     * control should be forwarded, or null if the response has
     * already been completed.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param actionForm The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet exception occurs
     */
    public ActionForward perform(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {

         // Acquire the resources that we need
        HttpSession session = request.getSession();
        Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
        if (resources == null) {
            resources = getServlet().getResources();
        }

        // Acquire a reference to the MBeanServer containing our MBeans
        try {
            mBServer = ((ApplicationServlet) getServlet()).getServer();
        } catch (Throwable t) {
            throw new ServletException
            ("Cannot acquire MBeanServer reference", t);
        }

        // label of the node that was clicked on.
        String nodeLabel = request.getParameter("nodeLabel");
        String select = request.getParameter("select");

        ServerForm serverFm = new ServerForm();
        session.setAttribute("serverForm", serverFm);
        serverFm.setNodeLabel(nodeLabel);
        serverFm.setDebugLvlVals(Lists.getDebugLevels());
        serverFm.setObjectName(select);

        ObjectName sname = null;
        try {
            sname = new ObjectName(select);
        } catch (Exception e) {
            String message =
                resources.getMessage("error.serviceName.bad",
                                     request.getParameter("select"));
            getServlet().log(message);
            response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
            return (null);
        }

        String attribute = null;
        try {
            // Copy scalar properties
            attribute = "debug";
            serverFm.setDebugLvl
                (((Integer) mBServer.getAttribute(sname, attribute)).toString());
            attribute = "port";
            serverFm.setPortNumberText
                (((Integer) mBServer.getAttribute(sname, attribute)).toString());
            attribute = "shutdown";
            serverFm.setShutdownText
                ((String) mBServer.getAttribute(sname, attribute));

            } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
            return (null);
        }

        //forward to the server jsp.
        return (mapping.findForward("Server"));
    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Xml.Linq;
using static VisualRust.ProjectSystem.FileSystemMirroring.MsBuild.XProjHelpers;

namespace VisualRust.ProjectSystem.FileSystemMirroring.MsBuild {
    public class XProjElement : XElement {
        public XProjElement(string name) : base(MsBuildNamespace + name) { }

        public XProjElement(string name, object content) : base(MsBuildNamespace + name, content) { }

        public XProjElement(string name, params object[] content) : base(MsBuildNamespace + name, content) { }
    }
}


text:
module OVOV
  module Calculator
    class PullUp < Base
      POOR_PERFORMANCE = 5

      def calculate
        return 0 if @performance < POOR_PERFORMANCE

        @points = ((@performance - 4 ) / 1 ) * 10
      end

    end
  end
end


text:
package org.wiztools.restclient.ui;

import com.google.inject.ImplementedBy;
import java.awt.Container;
import java.awt.Font;
import org.wiztools.restclient.View;
import org.wiztools.restclient.bean.Request;
import org.wiztools.restclient.bean.Response;

/**
 *
 * @author subwiz
 */
@ImplementedBy(RESTViewImpl.class)
public interface RESTView extends View {
    int BORDER_WIDTH = 5;

    void disableBody();

    void enableBody();

    Request getLastRequest();

    Response getLastResponse();

    Request getRequestFromUI();
    Response getResponseFromUI();

    Font getTextAreaFont();

    String getUrl();

    void runClonedRequestTest(Request request, Response response);

    void setStatusMessage(final String msg);

    void setTextAreaFont(final Font f);

    void setTextAreaScrollSpeed(final int scrollSpeed);

    void setUrl(String url);

    void showError(final String error);
    void showError(final Throwable ex);

    void showMessage(final String title, final String message);

    void setUIFromRequest(Request request);
    void setUIFromResponse(Response response);

    void clearUIResponse();

    void clearUIRequest();

    void setUIToLastRequestResponse();

    Container getContainer();
}


text:
And(/^I like that answer$/) do
  visit question_path(@answer.question)
  within "#answer-#{@answer.id}" do
    click_on("like")
  end
end

Then(/^That answer should have (\d+) like(s?)$/) do |count, suffix|
  within "#answer-#{@answer.id}" do
    #expect(page).to have_content("#{count} like#{suffix}")
    expect(page).to have_button("#{count} like#{suffix}")
  end
end

When(/^This answer is liked$/) do
  answer_author = User.find(@answer.user_id)
  click_on "Sign out"
  sign_in_as(@answer.question.author)
  visit question_path(@answer.question)
  within "#answer-#{@answer.id}" do
   click_on "like"
  end
end

When(/^This answer is accepted$/) do
  click_on "Sign out"
  sign_in_as(@answer.question.author)
  visit question_path(@answer.question)
  within "#answer-#{@answer.id}" do
    click_on "Accept"
  end
end

And(/^There is a new question with answer$/) do
  @answer = create(:answer)
end


text:
import Debug from 'debug';
import { STORE_TYPE } from './store';

const debug = Debug('fs:storage');

export class Store {

  private availableTypes = [];

  constructor() {
    if (window.localStorage !== undefined) {
      this.availableTypes.push(STORE_TYPE.LOCAL);
      debug('Local storage exists');
    }

    if (window.sessionStorage !== undefined) {
      this.availableTypes.push(STORE_TYPE.SESSION);
      debug('Session storage exists');
    }

    debug('availableTypes - %O', this.availableTypes);
  }

  public hasAccess(prefType?: STORE_TYPE): boolean {
    debug('Checking access to storage for %s. Available types: %O', prefType, this.availableTypes);

    if (prefType) {
      return this.availableTypes.indexOf(prefType) > -1;
    }

    return !!this.availableTypes.length;
  }

  public getItem(key: string, prefType?: STORE_TYPE) {
    const store = this.getStore(prefType);
    debug('getItem %s from %O', key, store);

    if (!store) {
      return undefined;
    }

    return store.getItem(key);
  }

  public setItem(key: string, value: string, prefType?: STORE_TYPE) {
    const store = this.getStore(prefType);
    debug('setItem %s to %O', key, store);

    if (!store) {
      return undefined;
    }

    return store.setItem(key, value);
  }

  public removeItem(key: string, prefType?: STORE_TYPE) {
    const store = this.getStore(prefType);
    debug('removeItem %s from %O', key, store);

    if (!store) {
      return undefined;
    }

    return store.removeItem(key);
  }

  private getStore(prefType?: STORE_TYPE): false | Storage {
    debug('get store with pref type - %s', prefType);

    if (!this.hasAccess(prefType)) {
      debug('User dont have access to any storage');
      return undefined;
    }

    switch (prefType) {
      case STORE_TYPE.LOCAL:
        return window.localStorage;
      case STORE_TYPE.SESSION:
        return window.sessionStorage;
      default:
        // @ts-ignore
        return window[this.availableTypes[0]] as Storage;
    }
  }
}


text:
<!DOCTYPE html>
  <meta charset=utf-8>
  <title>Locale filter</title>

This legal notice is only for Canadian locales.


text:
FROM tomcat:7-jre7
MAINTAINER "Craig Trim <craigtrim@gmail.com>"

RUN \
  mkdir -p /usr/local/tomcat/webapps/

COPY \
  technikfda.war        /usr/local/tomcat/webapps/


text:
"""Command for adding a path matcher to a URL map."""
import collections
import copy

from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.compute.lib import base_classes

class AddPathMatcher(base_classes.ReadWriteCommand):
  """Add a path matcher to a URL map."""

  @staticmethod
  def Args(parser):
    parser.add_argument(
        '--default-service',
        required=True,
        help=('A backend service that will be used for requests that the path '
              'matcher cannot match.'))

    parser.add_argument(
        '--description',
        help='An optional, textual description for the path matcher.')

    parser.add_argument(
        '--path-matcher-name',
        required=True,
        help='The name to assign to the path matcher.')

    parser.add_argument(
        '--path-rules',
        action=arg_parsers.AssociativeList(),
        default={},
        metavar='PATH=SERVICE',
        nargs='+',
        help='Rules for mapping request paths to services.')

    host_rule = parser.add_mutually_exclusive_group()

    host_rule.add_argument(
        '--new-hosts',
        metavar='NEW_HOST',
        nargs='+',
        help=('If specified, a new host rule with the given hosts is created'
              'and the path matcher is tied to the new host rule.'))

    existing_host = host_rule.add_argument(
        '--existing-host',
        help='An existing host rule to tie the new path matcher to.')
    existing_host.detailed_help = """\
        An existing host rule to tie the new path matcher to. Although
        host rules can contain more than one host, only a single host
        is needed to uniquely identify the host rule.
        """

    parser.add_argument(
        '--delete-orphaned-path-matcher',
        action='store_true',
        default=False,
        help=('If provided and a path matcher is orphaned as a result of this '
              'command, the command removes the orphaned path matcher instead '
              'of failing.'))

    parser.add_argument(
        'name',
        help='The name of the URL map.')

  @property
  def service(self):
    return self.compute.urlMaps

  @property
  def resource_type(self):
    return 'urlMaps'

  def CreateReference(self, args):
    return self.CreateGlobalReference(args.name)

  def GetGetRequest(self, args):
    """Returns the request for the existing URL map resource."""
    return (self.service,
            'Get',
            self.messages.ComputeUrlMapsGetRequest(
                urlMap=self.ref.Name(),
                project=self.project))

  def GetSetRequest(self, args, replacement, existing):
    return (self.service,
            'Update',
            self.messages.ComputeUrlMapsUpdateRequest(
                urlMap=self.ref.Name(),
                urlMapResource=replacement,
                project=self.project))

  def Modify(self, args, existing):
    """Returns a modified URL map message."""
    replacement = copy.deepcopy(existing)

    if not args.new_hosts and not args.existing_host:
      new_hosts = ['*']
    else:
      new_hosts = args.new_hosts

    # If --new-hosts is given, we check to make sure none of those
    # hosts already exist and once the check succeeds, we create the
    # new host rule.
    if new_hosts:
      new_hosts = set(new_hosts)
      for host_rule in existing.hostRules:
        for host in host_rule.hosts:
          if host in new_hosts:
            raise exceptions.ToolException(
                'Cannot create a new host rule with host [{0}] because the '
                'host is already part of a host rule that references the path '
                'matcher [{1}].'.format(host, host_rule.pathMatcher))

      replacement.hostRules.append(self.messages.HostRule(
          hosts=sorted(new_hosts),
          pathMatcher=args.path_matcher_name))

    # If --existing-host is given, we check to make sure that the
    # corresponding host rule will not render a patch matcher
    # orphan. If the check succeeds, we change the path matcher of the
    # host rule. If the check fails, we remove the path matcher if
    # --delete-orphaned-path-matcher is given otherwise we fail.
    else:
      target_host_rule = None
      for host_rule in existing.hostRules:
        for host in host_rule.hosts:
          if host == args.existing_host:
            target_host_rule = host_rule
            break
        if target_host_rule:
          break

      if not target_host_rule:
        raise exceptions.ToolException(
            'No host rule with host [{0}] exists. Check your spelling or '
            'use [--new-hosts] to create a new host rule.'
            .format(args.existing_host))

      path_matcher_orphaned = True
      for host_rule in replacement.hostRules:
        if host_rule == target_host_rule:
          host_rule.pathMatcher = args.path_matcher_name
          continue

        if host_rule.pathMatcher == target_host_rule.pathMatcher:
          path_matcher_orphaned = False
          break

      if path_matcher_orphaned:
        # A path matcher will be orphaned, so now we determine whether
        # we should delete the path matcher or report an error.
        if args.delete_orphaned_path_matcher:
          replacement.pathMatchers = [
              path_matcher for path_matcher in existing.pathMatchers
              if path_matcher.name != target_host_rule.pathMatcher]
        else:
          raise exceptions.ToolException(
              'This operation will orphan the path matcher [{0}]. To '
              'delete the orphan path matcher, rerun this command with '
              '[--delete-orphaned-path-matcher] or use [gcloud compute '
              'url-maps edit] to modify the URL map by hand.'.format(
                  host_rule.pathMatcher))

    # Creates PathRule objects from --path-rules.
    service_map = collections.defaultdict(set)
    for path, service in args.path_rules.iteritems():
      service_map[service].add(path)
    path_rules = []
    for service, paths in sorted(service_map.iteritems()):
      path_rules.append(self.messages.PathRule(
          paths=sorted(paths),
          service=self.CreateGlobalReference(
              service, resource_type='backendServices').SelfLink()))

    new_path_matcher = self.messages.PathMatcher(
        defaultService=self.CreateGlobalReference(
            args.default_service, resource_type='backendServices').SelfLink(),
        description=args.description,
        name=args.path_matcher_name,
        pathRules=path_rules)

    replacement.pathMatchers.append(new_path_matcher)
    return replacement

AddPathMatcher.detailed_help = {
    'brief': 'Add a path matcher to a URL map',
    'DESCRIPTION': """\
        *{command}* is used to add a path matcher to a URL map. A path
        matcher maps HTTP request paths to backend services. Each path
        matcher must be referenced by at least one host rule. This
        command can create a new host rule through the ``--new-hosts''
        flag or it can reconfigure an existing host rule to point to
        the newly added path matcher using ``--existing-host''. In the
        latter case, if a path matcher is orphaned as a result of the
        operation, this command will fail unless
        ``--delete-orphaned-path-matcher'' is provided.
        """,
    'EXAMPLES': """\
        To create a rule for mapping the paths ``/search'' and
        ``/search/*'' to the hypothetical ``search-service'' and
        ``/images/*'' to the ``images-service'' under the hosts
        ``google.com'' and ``*.google.com'', run:

          $ {command} MY-URL-MAP --path-matcher-name MY-MATCHER --default-service MY-DEFAULT-SERVICE --path-rules /search=search-service /search/*=search_service /images/*=images-service --new-hosts google.com "*.google.com"

        Note that a default service must be provided to handle paths
        for which there is no mapping.
        """,
}


text:
<?php
/**
 * Icon view helper
 *
 * Can be used for Gltphicon and FontAwesome
 *
 * @author     Abel Lopes <abel@abellpes.eti.br>
 * @category   AcploUi
 * @license    https://github.com/Acplo/AcploUi/blob/master/LICENSE BSD-3 License
 * @link       http://github.com/Acplo/AcploUi
 * @link       http://fontawesome.io
 * @link       http://getbootstrap.com/components/#glyphicons
 */
namespace AcploUi\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\Filter\FilterChain;
use Zend\Filter\Word\CamelCaseToDash;
use Zend\Filter\StringToLower;

/**
 * Icon view helper
 *
 * Can be used for Gltphicon and FontAwesome
 *
 * @author     Abel Lopes <abel@abellpes.eti.br>
 * @category   AcploUi
 * @license    https://github.com/Acplo/AcploUi/blob/master/LICENSE BSD-3 License
 * @link       http://github.com/Acplo/AcploUi
 * @link       http://fontawesome.io
 * @link       http://getbootstrap.com/components/#glyphicons
 */
class Icon extends AbstractHelper
{
    protected $format = '';
    protected $formatI = '';

    public function __invoke($icon = null, $style = '')
    {
        if ($icon) {
            return $this->render($icon, $style);
        }

        return $this;
    }

    public function __call($method, $args)
    {
        $filterChain = new FilterChain();

        $filterChain->attach(new CamelCaseToDash())->attach(new StringToLower());

        $icon = $filterChain->filter($method);

        return $this->render($icon, isset($args[0]) ? $args[0] : '', isset($args[1]) ? $args[1] : false);
    }

    public function render($icon, $style = null, $useTagI = false)
    {
        if (substr($icon, 0, 3) == 'fa-') {
            $class = trim('fa '.$icon);
        } else {
            $class = trim('glyphicon '.$icon);
        }

        if (!empty($style)) {
            $style = ' style="'.$style.'"';
        }

        if ($useTagI) {
            return sprintf($this->formatI, $class, $style);
        } else {
            return sprintf($this->format, $class, $style);
        }
    }
}


text:
module.exports = function(app){
var cmd = require("cmd-exec").init();
var async = require("async");
var stripAnsi = require('strip-ansi');
var os = require('os');

app.use(function(req, res, next) {
  next();
});

app.get('/systemLoad', function(req, res) {
  res.type('application/json');
  res.send(os.loadavg());
  console.log("successfully returned system load to a client");
});

}


text:
I want to thank everyone that has submitted feedback,ideas and contributions to this project. Some individuals deserve as special thank you for helping make this project a success.

## Jim Caten

The original author of this project is Jim Caten. All of this was made possible by the effort Jim Caten put into getting this project off the ground and the many hours that were spent making everything work.

## Kevin Marquette

This project was generated using a [Plaster template](https://github.com/KevinMarquette/PlasterTemplates) that he put together and shared with the community. It is modeled after the way he build his projects. A lot of the base structure for this project was put in place by that Plaster template. [kevinmarquette.github.io](http://kevinmarquette.github.io)


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

namespace Orchard.ImageGallery.Models.Plugins.Popeye
{
  public class PopeyeResourceDescriptor
  {
  }
}


text:
@interface FreestyleShopItemView : UIViewController <NSURLConnectionDataDelegate>

@property (strong, nonatomic) ShopItem *shopItem;
@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *sellerLabel;
@property (strong, nonatomic) UILabel *contactLabel;
@property (strong, nonatomic) UILabel *priceLabel;
@property (strong, nonatomic) UILabel *locationLabel;
@property (strong, nonatomic) UITextView *descriptionView;
@property (strong, nonatomic) UIScrollView *shopScrollView;

@end


text:
#region Copyright

// Created by Jeremy
// 09 2013

#endregion

#region

using System;

#endregion

namespace Dominion_War.model.ship
{
    public abstract class BaseShip
    {
        // combat factors
        protected Shield shipShields;
        protected Hull shipsHull;
        protected Weapons shipsWeapons;
        protected String ShipClassName;

        public String ShipClass
        {
            get { return ShipClassName; }
        }

        /// <summary>
        ///     Fires the ships weapons, returning the amount of damage that
        ///     the weapons have generated.
        ///     This is made up of the ships base weapon damage and the random generated amount.
        /// </summary>
        /// <returns>The amount of damage that the weapons have generated</returns>
        public abstract int FireWeapons();

        /// <summary>
        ///     Returns the current damage status of the ship
        /// </summary>
        /// <returns></returns>
        public abstract String DamageStatus();

        /// <summary>
        /// Regenerates the ships shields
        /// </summary>
        public abstract void RegenerateShield();

        /// <summary>
        /// Deals the specified amount of damage to the ship. Damage will be applied to the
        ///     ships shield first. If the ships shield is down, or the damage amount is
        ///     greater than the current shield strength, then the hull of the
        ///     ship will take the remaining amount of damage.
        /// </summary>
        /// <param name="damageAmount"></param>
        public abstract void ReceiveDamage(int damageAmount);

        /// <summary>
        /// Returns true if this space ship has been destroyed
        /// </summary>
        /// <returns>True if it has been destroyed, false otherwise</returns>
        public abstract bool IsDestroyed();
    }
}


text:
import sys
from setuptools import setup, find_packages

setup(
    name = "expressions",
    version = "0.2.2",

    packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
    package_data = {
        # If any package contains *.txt or *.rst files, include them:
        '': ['*.txt', '*.rst'],
    },

    classifiers = [
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3',
        'Topic :: Scientific/Engineering',
        'Topic :: Utilities'
    ],

    test_suite = "tests",

    # metadata for upload to PyPI
    author = "Stefan Urbanek",
    author_email = "stefan.urbanek@gmail.com",
    description = "Extensible arithmetic expression parser and compiler",
    license = "MIT license",
    keywords = "arithmetic expression",
    url = "http://databrewery.org"

)


text:
'use strict';

var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

/**
 * =====================================================================================
 * NaitonClient model
 * =====================================================================================
 */

var ClientSchema = new Schema({
	clientid: {
		type: String,
		trim: true,
		required: 'Clientid is required'
	},
	firstname: {
		type: String,
		trim: true,
		required: 'Firstname is required'
	},
	streetaddress: {
		type: String,
		trim: true,
		required: 'Firstname is required'
	},
	infix: {
		type: String,
		trim: true,
		required: 'Infix is required'
	},
	lastname: {
		type: String,
		trim: true,
		required: 'Infix is required'
	},
	gender: {
		type: Boolean,
		trim: true,
		required: 'Gender is required'
	},
	dateofbirth: {
		type: Date,
		trim: true,
		required: 'dateofbirth is required'
	},
	phone: {
		type: String,
		trim: true,
		required: 'Phone is required'
	},
	email: {
		type: String,
		trim: true,
		required: 'E-mail is required'
	},
	password: {
		type: String,
		trim: true,
		required: 'Password is required'
	},
	allownewsletter: {
		type: Boolean,
		trim: true,
		required: 'allownewsletter is required'
	},
	addressid: {
		type: Number,
		trim: true,
		required: 'addressid is required'
	},
	house: {
		type: String,
		trim: true,
		required: 'house is required'
	},
	houseadd: {
		type: String,
		trim: true,
		required: 'houseadd is required'
	},
	zipcode: {
		type: String,
		trim: true,
		required: 'zipcode is required'
	},
	city: {
		type: String,
		trim: true,
		required: 'city is required'
	},
	countryid: {
		type: Number,
		trim: true,
		required: 'countryid is required'
	},
	discountgroupid: {
		type: Number,
		trim: true,
		required: 'discountgroupid is required'
	},
	businessid: {
		type: Number,
		trim: true,
		required: 'businessid is required'
	},
	companyid: {
		type: Number,
		trim: true,
		required: 'companyid is required'
	},
	paymentdays: {
		type: Number,
		trim: true,
		required: 'paymentdays is required'
	},
	creditline: {
		type: Number,
		trim: true,
		required: 'creditline is required'
	},
	emailblacklist: {
		type: Boolean,
		trim: true,
		required: 'emailblacklist is required'
	},
	returnvalue: {
		type: String,
		trim: true
	}
}, {
	collection: 'clients'
});

mongoose.model('NaitonClient', ClientSchema);


text:
=begin

input: string
output: string

Check IF provided input has "CA"
  IF yes, return "Welcome to California"
IF provided inputs does not have "CA" then
  return "You should move to California"

=end

def welcome(address)

  if address.match("CA")
    return "Welcome to California"
  else
    return "You should move to California"
  end
end


text:
#!/usr/bin/env bash

# Build wheel packages containing both CLI product and tests. The script doesn't rely on a pre-existing virtual
# environment.

set -ev

##############################################
# clean up and dir search
mkdir -p ./artifacts

# Current folder (/azure-cli) is mounted from host which has different owner than docker container's
# current user 0(root).
# https://github.blog/2022-04-12-git-security-vulnerability-announced/
git config --global --add safe.directory $(pwd)
echo `git rev-parse --verify HEAD` > ./artifacts/build.sha

mkdir -p ./artifacts/build
mkdir -p ./artifacts/source
mkdir -p ./artifacts/testsrc

output_dir=$(cd artifacts/build && pwd)
sdist_dir=$(cd artifacts/source && pwd)
testsrc_dir=$(cd artifacts/testsrc && pwd)
script_dir=`cd $(dirname $BASH_SOURCE[0]); pwd`

target_profile=${AZURE_CLI_TEST_TARGET_PROFILE:-latest}
if [ "$target_profile" != "latest" ]; then
    # example: hybrid-2019-03-01. Python module name can't begin with a digit.
    target_profile=hybrid_${target_profile//-/_}
fi
echo Pick up profile: $target_profile

##############################################
# Define colored output func
function title {
    LGREEN='\033[1;32m'
    CLEAR='\033[0m'

    echo -e ${LGREEN}$1${CLEAR}
}

##############################################
# Update version strings
title 'Determine version'
. $script_dir/version.sh $1
# echo -n $version > ./artifacts/version

##############################################
# build product packages
title 'Build Azure CLI and its command modules'
for setup_file in $(find src -name 'setup.py'); do
    pushd $(dirname ${setup_file}) >/dev/null
    echo "Building module at $(pwd) ..."
    python setup.py -q bdist_wheel -d $output_dir
    python setup.py -q sdist -d $sdist_dir
    popd >/dev/null
done

##############################################
# copy private packages
if [ -z ./privates ]; then
    cp ./privates/*.whl $output_dir
fi

##############################################
# build test packages
title 'Build Azure CLI tests package'

for test_src in $(find src/azure-cli/azure/cli/command_modules -name tests -type d); do
    rel_path=${test_src##src/azure-cli/}

    mkdir -p $testsrc_dir/$rel_path
    cp -R $test_src/* $testsrc_dir/$rel_path
done

if [ "$target_profile" == "latest" ]; then
    # don't pack core tests for profiles other than latest
    for test_src in $(find src -name tests | grep -v command_modules); do
        rel_path=${test_src##src/}
        rel_path=(${rel_path/\// })
        rel_path=${rel_path[1]}

        mkdir -p $testsrc_dir/$rel_path
        cp -R $test_src/* $testsrc_dir/$rel_path
    done
fi

cat >$testsrc_dir/setup.py <<EOL
#!/usr/bin/env python

from setuptools import setup

VERSION = "1.0.0.$version"

CLASSIFIERS = [
    'Development Status :: 3 - Alpha',
    'Intended Audience :: Developers',
    'Programming Language :: Python',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.7',
    'Programming Language :: Python :: 3.8',
    'Programming Language :: Python :: 3.9',
    'Programming Language :: Python :: 3.10',
    'License :: OSI Approved :: MIT License',
]

DEPENDENCIES = [
    'azure-cli',
    'azure-cli-testsdk'
]

setup(
    name='azure-cli-fulltest',
    version=VERSION,
    description='Microsoft Azure Command-Line Tools Full Tests',
    license='MIT',
    author='Microsoft Corporation',
    author_email='azpycli@microsoft.com',
    url='https://github.com/Azure/azure-cli',
    zip_safe=False,
    classifiers=CLASSIFIERS,
    packages=[
EOL

if [ "$target_profile" == "latest" ]; then
    echo "        'azure.cli.core.tests'," >>$testsrc_dir/setup.py
fi

for name in `ls src/azure-cli/azure/cli/command_modules`; do
    test_folder=src/azure-cli/azure/cli/command_modules/$name/tests
    if [ -d $test_folder ]; then
        echo "        'azure.cli.command_modules.$name.tests'," >>$testsrc_dir/setup.py
        if [ -d $test_folder/$target_profile ]; then
            echo "        'azure.cli.command_modules.$name.tests.$target_profile'," >>$testsrc_dir/setup.py
        fi
    fi
done

cat >>$testsrc_dir/setup.py <<EOL
    ],
    package_data={'': ['*.bat',
                       '*.byok',
                       '*.cer',
                       '*.gql',  # graphql used by apim
                       '*.js',
                       '*.json',
                       '*.kql',
                       '*.md',
                       '*.pem',
                       '*.pfx',
                       '*.sql',
                       '*.txt',
                       '*.txt',
                       '*.xml',
                       '*.yml',
                       '*.zip',
                       '**/*.bat',
                       '**/*.byok',
                       '**/*.cer',
                       '**/*.gql',
                       '**/*.ipynb',
                       '**/*.jar',
                       '**/*.js',
                       '**/*.json',
                       '**/*.kql',
                       '**/*.md',
                       '**/*.pem',
                       '**/*.pfx',
                       '**/*.sql',
                       '**/*.txt',
                       '**/*.txt',
                       '**/*.xml',
                       'data/*',
                       'recordings/*.yaml']},
    install_requires=DEPENDENCIES
)
EOL

cat >>$testsrc_dir/setup.cfg <<EOL
[bdist_wheel]
universal=1
EOL

cat >>$testsrc_dir/README.txt <<EOL
Azure CLI Test Cases
EOL

pushd $testsrc_dir >/dev/null
python setup.py -q bdist_wheel -d $output_dir
python setup.py -q sdist -d $sdist_dir
popd >/dev/null

##############################################
# clear afterwards
rm -rf $testsrc_dir
git checkout src

##############################################
# summary
title 'Results'
echo $(ls $sdist_dir | wc -l) packages created.


text:
"""

The resolution module
======================

This module contains functions for estimating the best resolution to use
for analysing a GAM dataset.

Two metrics are used:
 * Detection efficiency
 * Window coverage

Detection efficiency
--------------------

Detection efficiency is an estimate of the percentage of DNA actually present
in each library that was detected after WGA and sequencing. For example if your
sample contains three NPs with a total of 10 million base pairs of DNA, but the
detected positive windows only cover 6 million base pairs of DNA, the detection
efficiency would be 60%. This value is estimated for a whole dataset and we
would recommend it should be 70% or higher. If detection efficiency is too low,
this can be a sign that your window size is too small (i.e. you are trying to
work at too high a resolution). Datasets with lower detection efficiency can
still be usable, but a greater number of libraries will need to be sequenced.

Window coverage
---------------

In order to have good statistical power, each genomic window should be observed
in the dataset with a sufficient frequency. We recommend that 80% of the windows
in the genome should be detected at least 20 times. If this number is too low,
increasing the window size may help a little but you may need to collect more
libraries.

"""

import numpy as np

from . import segregation

def segregation_info(segregation_table, skip_chroms):
    """
    Given a segregation table, retrieve the number of tubes,
    the diploid genome size and the bin size.

    :param segregation_table: Input :ref:`segregation table <segregation_table>`
    :param list skip_chroms: List of chromosome names to exclude.
    :returns: Number of libraries, total size of the genome and size of each window
    """

    segregation_windows = segregation_table.reset_index()[['chrom', 'start', 'stop']]
    segregation_windows['size'] = segregation_windows.stop - segregation_windows.start
    genome_size = segregation_windows.loc[
        np.logical_not(segregation_windows.chrom.isin(skip_chroms)),
        'size'].sum() * 2

    bin_sizes = segregation_windows['size'].value_counts()
    frequent_sizes = [size for (size, freq)
                      in (bin_sizes / bin_sizes.sum()).iteritems()
                      if freq > 0.95]
    if not frequent_sizes:
        raise Exception('SLICE requires windows of even sizes')
    window_size = frequent_sizes[0]

    return genome_size, window_size

def compute_eff_slice_fraction(slice_thickness, nuclear_radius, window_fraction):
    """
    Compute the ratio between slice thickness and nuclear radius, taking into account
    the window size. This is important because a genomic window does not have to fall
    entirely within the NP to be detected. The larger the window size, the further DNA
    can fall outside of the physical section and still be 'effectively' within the NP.

    :param float slice_thickness: Thickness of the NP.
    :param float nuclear_radius: Average nuclear radius.
    :param float window_fraction: Genomic window size divided by total genome size.
    :returns: Effective slice thickness
    """

    return (slice_thickness/nuclear_radius) + (2 * (window_fraction ** (1/3)))

def get_detection_efficiency(segregation_table, slice_thickness, #pylint: disable=too-many-arguments
                             nuclear_radius, skip_chroms=None, genome_size=None,
                             plexity=1, only_visible=True):
    """
    Given a GAM segregation table, calculate the efficiency of detection
    of individual loci. For example, 0.8 detection efficiency indicates that
    80% of the loci actually intersected by a slice are detected in our
    sequencing data.

    :param segregation_table: Input :ref:`segregation table <segregation_table>`
    :param float slice_thickness: Thickness of the NP.
    :param float nuclear_radius: Average nuclear radius.
    :param list skip_chroms: List of chromosome names to exclude.
    :param float genome_size: Total size of the genome (if None, calculate from \
          the segregation table.
    :param int plexity: Number of nuclear profiles in each sample.
    :param bool only_visible: If true, don't include genomic windows that are \
          never detected across the dataset in calculation. This is the default \
          behaviour.
    :returns: Number of libraries, total size of the genome and size of each window
    """

    if skip_chroms is None:
        skip_chroms = []

    table_genome_size, window_size = segregation_info(segregation_table, skip_chroms)

    if genome_size is None:
        genome_size = table_genome_size

    if only_visible:
        visible = segregation_table.loc[segregation_table.sum(axis=1) > 0]
    else:
        visible = segregation_table

    avg_m1s_m =  visible.sum(axis=1).mean() / visible.shape[1]

    coef = 1 / plexity
    window_fraction = window_size / genome_size

    effective_slice_fraction = compute_eff_slice_fraction(
        slice_thickness, nuclear_radius, window_fraction)

    return ((2 + effective_slice_fraction) / effective_slice_fraction) * (1 -
            (((1 - avg_m1s_m) ** coef) ** (1/2)))

def get_segregation_coverage_qc(segregation_table, skip_chroms=None,
                                only_visible=True, quantile=0.2):
    """
    Given a GAM segregation table, calculate x, such that 80% of the
    windows in the segregation table are identified in an NP at least
    x times. For example, we recommend that in a "good quality" GAM
    dataset, 80% of the genomic windows will be detected at least 20
    times.

    :param segregation_table: Input :ref:`segregation table <segregation_table>`
    :param list skip_chroms: List of chromosome names to exclude.
    :param bool only_visible: If true, don't include genomic windows that are \
          never detected across the dataset in calculation. This is the default \
          behaviour.
    :param float quantile: The quantile at which to calculate window coverage. \
          The default value of 0.2 returns the coverage exceeded by 80% of \
          genomic windows.
    :returns: Number of times 80% of genomic windows are detected.
    """

    if skip_chroms is None:
        skip_chroms = []

    if only_visible:
        visible = segregation_table.loc[segregation_table.sum(axis=1) > 0]
    else:
        visible = segregation_table

    return visible.sum(axis=1).quantile(quantile)

def do_segregation_qc(segregation_table, slice_thickness, nuclear_radius, coverage_q=0.2, #pylint: disable=too-many-arguments
                      skip_chroms=None, genome_size=None, plexity=1, only_visible=True):
    """
    Check that a GAM dataset has sufficient quality and depth.  Specifically,
    check that 80% of genomic windows have been detected at least 20 times
    and that the detection efficiency is at least 70%.

    :param segregation_table: Input :ref:`segregation table <segregation_table>`
    :param float slice_thickness: Thickness of the NP.
    :param float nuclear_radius: Average nuclear radius.
    :param float coverage_q: The quantile at which to calculate window coverage. \
          The default value of 0.2 returns the coverage exceeded by 80% of \
          genomic windows.
    :param list skip_chroms: List of chromosome names to exclude.
    :param float genome_size: Total size of the genome (if None, calculate from \
          the segregation table.
    :param int plexity: Number of nuclear profiles in each sample.
    :param bool only_visible: If true, don't include genomic windows that are \
          never detected across the dataset in calculation. This is the default \
          behaviour.
    :returns: False if either of the checks fail, otherwise True.
    """

    if skip_chroms is None:
        skip_chroms = []

    pass_qc = True

    window_coverage = get_segregation_coverage_qc(segregation_table, skip_chroms,
                                only_visible, coverage_q)

    if window_coverage >= 20:
        print('Coverage check passed. 80% of genomic windows are detected at '
              'least {:.0f} times'.format(window_coverage))
    else:
        print('Coverage check failed. 80% of genomic windows are detected at '
              'least {:.0f} times. This value should be at least 20, try increasing '
              'the genomic window size for this dataset.'.format(window_coverage))
        pass_qc = False

    detection_efficiency = get_detection_efficiency(
        segregation_table, slice_thickness, nuclear_radius,
        skip_chroms, genome_size, plexity, only_visible)

    if detection_efficiency > 0.7:
        if detection_efficiency <= 1.02:
            print('Detection check passed. Genome-wide detection-efficiency '
                  '{:.1%}'.format(detection_efficiency))
        else:
            print('Detection check failed. Genome-wide detection-efficiency '
                  '{:.1%} - this cannot be higher than 100%, please check '
                  'your input parameters.'.format(
                   detection_efficiency))
            pass_qc = False
    else:
        print('Detection check failed. Genome-wide detection-efficiency '
              '{:.1%}. This value should be at least 70%.'.format(
               detection_efficiency))
        pass_qc = False

    return pass_qc

def resolution_check_from_args(args):
    """Extract parameters from an argparse namespace object and pass them
    to do_segregation_qc."""

    segregation_table = segregation.open_segregation(args.segregation_table)

    do_segregation_qc(segregation_table, args.slice_thickness, args.nuclear_radius,
                      skip_chroms=args.skip_chromosomes, genome_size=args.genome_size,
                      plexity=args.plexity, only_visible=args.only_visible)


text:
package com.apache.commons.codec;

/**
 * Defines common encoding methods for String encoders.
 *
 * @author Apache Software Foundation
 * @version $Id: StringEncoder.java 1080701 2011-03-11 17:52:27Z ggregory $
 */
public interface StringEncoder extends Encoder {

    /**
     * Encodes a String and returns a String.
     *
     * @param source the String to encode
     *
     * @return the encoded String
     *
     * @throws EncoderException thrown if there is
     *  an error conidition during the Encoding process.
     */
    String encode(String source) throws EncoderException;
}


text:
package com.intellij.vcsUtil;

import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.NamedColorUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

public final class UIVcsUtil {
  private UIVcsUtil() {
  }

  @SuppressWarnings("unused") // Required for compatibility with external plugins.
  public static JPanel errorPanel(@NotNull @Nls String text, boolean isError) {
    final JLabel label = new JLabel(XmlStringUtil.wrapInHtml(escapeXmlAndAddBr(text)));
    label.setForeground(isError ? SimpleTextAttributes.ERROR_ATTRIBUTES.getFgColor() : NamedColorUtil.getInactiveTextColor());
    final JPanel wrapper = new JPanel(new GridBagLayout());
    wrapper.add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, JBUI.insets(1), 0, 0));
    return wrapper;
  }

  public static JPanel infoPanel(@NotNull @Nls String header, @Nls @NotNull String text) {
    //noinspection HardCodedStringLiteral
    final JLabel label = new JLabel(XmlStringUtil.wrapInHtml(
      "<h4>" + StringUtil.escapeXmlEntities(header) + "</h4>" + escapeXmlAndAddBr(text)));
    final JPanel wrapper = new JPanel(new GridBagLayout());
    wrapper.add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, JBUI.insets(1), 0, 0));
    return wrapper;
  }

  @Nls
  private static String escapeXmlAndAddBr(@Nls @NotNull String text) {
    String escaped = StringUtil.escapeXmlEntities(text);
    //noinspection HardCodedStringLiteral
    escaped = StringUtil.replace(escaped, "\n", UIUtil.BR);
    return escaped;
  }
}


text:
<?php

	Class Extension_CacheableDatasource extends Extension {

		public function about(){
			return array('name' => 'Cacheable Datasource',
						 'version' => '0.5',
						 'release-date' => '2011-09-01',
						 'author' => array('name' => 'Nick Dunn',
										   'website' => 'http://nick-dunn.co.uk'),
						'description' => 'Create custom Data Sources that implement output caching');

		}

		public function fetchNavigation(){
			return array(
				array(
					'location'	=> __('System'),
					'name'	=> __('Cacheable Data Sources'),
					'link'	=> '/view/',
                    'visible' => 'y'
				)
			);
		}

	}

?>


text:
using System;

namespace SettlementApi.Read.QueryCommand.SheetLogModule
{
    public class RQuerySheetLog
    {
        public string Operator { get; set; }

        public string Text { get; set; }

        public DateTime DCreateTime { private get; set; }

        public string CreateTime => DCreateTime.ToString("yyyy-MM-dd HH:mm:ss");
    }
}


text:
package api.web.gw2.mapping.v2.raids;

import api.web.gw2.mapping.core.IdValue;
import api.web.gw2.mapping.core.SetValue;
import api.web.gw2.mapping.v2.APIv2;
import java.util.Set;

/**
 * Defines a raid wing.
 * @author Fabrice Bouyé
 */
@APIv2(endpoint = "v2/raids") // NOI18N.
public interface RaidWing {

    /**
     * Gets the id of this raid wing event.
     * @return A {@code String} instance, never {@code null}.
     */
    @IdValue(flavor = IdValue.Flavor.STRING)
    String getId();

    /**
     * Gets the set of events in this wing.
     * @return A {@code Set<RaidWingEvent>} instance, never {@code null}. May be
     * empty.
     */
    @SetValue
    Set<RaidWingEvent> getEvents();
}


text:
package org.amc.dao;

import org.amc.DAOException;
import org.amc.game.chess.Player;

import java.util.List;

import javax.persistence.EntityManager;

public interface DAOInterface<T> {

    /**
     * Adds the {@link Player} object to the database
     *
     * @param entity
     *            the new Player to be stored in the database
     * @throws DAOException
     *             if a problem occurs in the underlying database
     */
    void addEntity(T entity) throws DAOException;

    /**
     * Deletes the {@link Player} object from the database
     *
     * @param entity
     *            the Player to be deleted
     * @throws DAOException
     *             if a problem occurs in the underlying database
     */
    void deleteEntity(T entity) throws DAOException;

    /**
     * Fetchs a list of all objects of {@link Player} stored in the
     * underlying database. The results from the database are stored in a
     * java.util.List.
     *

     * Caution if there are a lot of rows in the database if may return a very
     * large Collection of objects.
     *
     * @return List of all WorkEntities in the database
     * @throws DAOException
     *             if a problem occurs in the underlying database
     *
     */
    List<T> findEntities() throws DAOException;

    /**
     * Fetchs a list of objects of class {@link Player} stored in the
     * underlying database. The results from the database are stored in a
     * java.util.List.
     *
     * @param col
     *            String name of the column in the database to query
     * @param value
     *            Object to query for in the database
     * @return List of WorkEntities
     * @throws DAOException
     *             if a problem occurs in the underlying database
     */
    List<T> findEntities(String col, Object value) throws DAOException;

    /**
     * Retrieves a {@link Player} object who's database ID value is equal to
     * workEntityId
     *

     * A DAOException is thrown if there is no entry in the database with the
     * given workEntityId.
     *
     * @param workEntityId
     *            The String representation of the number corresponding to the
     *            ID of the Player in the database.
     * @return a Player object
     * @throws DAOException
     *             if a problem occurs in the underlying database
     */
    T getEntity(int id) throws DAOException;

    /**
     * Provides access to {@link EntityManagerThreadLocal} which contains the
     * reference for the {@link EntityManager}
     *
     * @return EntityManager for this class subclasses to use
     * @see EntityManager
     * @see EntityManagerThreadLocal
     */
    EntityManager getEntityManager();

    void setEntityManager(EntityManager entityManager);

    /**
     * Updates the current {@link Player} object in the database.
     *
     * @param entity
     *            the Player to be updated.
     * @throws DAOException
     *             if a problem occurs in the underlying database
     */
    T updateEntity(T entity) throws DAOException;

    /**
     * Detaches Entity from the Persistence context
     *
     * @param entity
     * @see EntityManager#detach(Object)
     */
    void detachEntity(T entity);

    /**
     * Returns a Class object of class Player
     * which this DAO object has been initialised with
     *
     * @return Class object which this DAO is handling
     * @see Player
     */
    Class<? extends T> getEntityClass();

}


text:
package org.javaruntype.type;

/**
 *

 * This class represents a type parameter which only contains a <tt>Type</tt>.
 *

 *

 * For example, the type <tt>List<Set<String[]>></tt>;
 * would have a <tt>StandardTypeParameter</tt>
 * containing the <tt>Set<String[]></tt> parameter.
 *

 *
 *
 * @since 1.0
 *
 * @author Daniel Fernández
 *
 */
public final class StandardTypeParameter<T> extends TypeParameter<T> {

    private static final long serialVersionUID = -1799703488533881728L;

    private final Type<T> type;

    StandardTypeParameter(final Type<T> type) {
        super();
        this.type = type;
    }

    @Override
    public Type<T> getType() {
        return this.type;
    }

    @Override
    boolean isAssignableFrom(final TypeParameter<?> typeParameter) {

        if (this.equals(typeParameter)) {
            return true;
        }
        // Only a StandardTypeParameter for exactly the same type will be valid
        return false;

    }

    @Override
    public int hashCode() {
        return this.type.hashCode();
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final StandardTypeParameter<?> other = (StandardTypeParameter<?>) obj;
        return this.type.equals(other.type);
    }

    @Override
    public String toString() {
        return this.type.getName();
    }

}


text:
package com.vivifram.second.hitalk.ui.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.vivifram.second.hitalk.R;

public class AvatarView extends ImageView {
    public static final String TAG = "AvatarView";

    private int mBorderWidth = 2;
    private int mShadowWidth = 2;

    private int mBorderColor = Color.WHITE;
    private int mShadowColor = Color.RED;

    private RectF mBorderRect;
    private RectF mBitmapRect;

    private float mBorderRadius;
    private float mBitmapRadius;

    private BitmapShader mBitmapShader;
    private Bitmap mBitmap;

    private Matrix mShaderMatrix;
    private Paint mBitmapPaint;
    private Paint mBorderPaint;

    public AvatarView(Context context) {
        this(context, null);
    }

    public AvatarView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public AvatarView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AvatarView);
        try {
            mBorderWidth = a.getDimensionPixelSize(R.styleable.AvatarView_avatar_border_width, mBorderWidth);
            mBorderColor = a.getColor(R.styleable.AvatarView_avatar_border_color, mBorderColor);

            mShadowWidth = a.getDimensionPixelSize(R.styleable.AvatarView_avatar_shadow_width, mShadowWidth);
            mShadowColor = a.getColor(R.styleable.AvatarView_avatar_shadow_color, mShadowColor);
        } finally {
            a.recycle();
        }

        init();
    }

    private void init() {
        setScaleType(ScaleType.CENTER_CROP);

        mShaderMatrix = new Matrix();

        mBorderPaint = new Paint();
        mBorderPaint.setAntiAlias(true);
        mBorderPaint.setColor(mBorderColor);
        mBorderPaint.setStrokeWidth(mBorderWidth);
        mBorderPaint.setStyle(Paint.Style.STROKE);

        mBitmapPaint = new Paint();
        mBitmapPaint.setAntiAlias(true);

        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }

    @Override
    public void onDraw(@NonNull Canvas canvas) {
        if (mBitmap == null) return;

        initBorder();
        initBitmap();

        int cx = getWidth() >> 1;
        int cy = getHeight() >> 1;

        canvas.drawCircle(cx, cy, mBorderRadius, mBorderPaint);
        canvas.drawCircle(cx, cy, mBitmapRadius, mBitmapPaint);
    }

    private void initBorder() {
        mBorderRect = new RectF(mShadowWidth, mShadowWidth, getWidth() - mShadowWidth, getHeight() - mShadowWidth);
        mBorderRadius = Math.min((mBorderRect.width() - mShadowWidth) / 2, (mBorderRect.height() - mShadowWidth) / 2);
        mBorderPaint.setShadowLayer(mShadowWidth, 0, 0, mShadowColor);
    }

    private void initBitmap() {
        mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
        mBitmapPaint.setShader(mBitmapShader);

        int outerWidth = mBorderWidth + mShadowWidth;
        mBitmapRect = new RectF(outerWidth, outerWidth, getWidth() - outerWidth, getHeight()- outerWidth);
        mBitmapRadius = Math.min(mBitmapRect.width() / 2, mBitmapRect.height() / 2) - 2;
        updateShaderMatrix();
    }

    private Bitmap getBitmapFrom(Drawable drawable) {
        if (drawable == null) return null;
        if (drawable instanceof BitmapDrawable) {
            return ((BitmapDrawable) drawable).getBitmap();
        }
        try {
            Bitmap bitmap;
            if (drawable instanceof ColorDrawable) {
                bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.RGB_565);
            } else {
                bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
            }

            Canvas canvas = new Canvas(bitmap);
            drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
            drawable.draw(canvas);
            return bitmap;
        } catch (OutOfMemoryError e) {
            return null;
        }
    }

    private void updateShaderMatrix() {
        float scale;
        float dx = 0;
        float dy = 0;

        mShaderMatrix.set(null);

        int bmpWidth = mBitmap.getWidth();
        int bmpHeight = mBitmap.getHeight();

        if (bmpWidth * mBitmapRect.height() > mBitmapRect.width() * bmpHeight) {
            scale = mBitmapRect.height() / (float) bmpHeight;
            dx = (mBitmapRect.width() - bmpWidth * scale) * 0.5f;
        } else {
            scale = mBitmapRect.width() / (float) bmpWidth;
            dy = (mBitmapRect.height() - bmpHeight * scale) * 0.5f;
        }

        mShaderMatrix.setScale(scale, scale);
        mShaderMatrix.postTranslate(
                (int) (dx + 0.5f) + mBorderWidth + mShadowWidth,
                (int) (dy + 0.5f) + mBorderWidth + mShadowWidth);

        mBitmapShader.setLocalMatrix(mShaderMatrix);
    }

    @Override
    public void setImageBitmap(Bitmap bitmap) {
        super.setImageBitmap(bitmap);
        mBitmap = bitmap;
        invalidate();
    }

    @Override
    public void setImageDrawable(Drawable drawable) {
        super.setImageDrawable(drawable);
        mBitmap = getBitmapFrom(drawable);
        invalidate();
    }

    @Override
    public void setImageResource(int resId) {
        super.setImageResource(resId);
        mBitmap = getBitmapFrom(getDrawable());
        invalidate();
    }

    @Override
    public void setImageURI(Uri uri) {
        super.setImageURI(uri);
        mBitmap = getBitmapFrom(getDrawable());
        invalidate();
    }
}