text:
<?php
namespace MOC\V\Component\Database\Component\Bridge\Repository;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Statement;
use MOC\V\Component\Database\Component\Bridge\Bridge;
use MOC\V\Component\Database\Component\Exception\ComponentException;
use MOC\V\Component\Database\Component\Exception\Repository\NoConnectionException;
use MOC\V\Component\Database\Component\IBridgeInterface;
use MOC\V\Component\Database\Component\Parameter\Repository\DatabaseParameter;
use MOC\V\Component\Database\Component\Parameter\Repository\DriverParameter;
use MOC\V\Component\Database\Component\Parameter\Repository\HostParameter;
use MOC\V\Component\Database\Component\Parameter\Repository\PasswordParameter;
use MOC\V\Component\Database\Component\Parameter\Repository\PortParameter;
use MOC\V\Component\Database\Component\Parameter\Repository\UsernameParameter;
use MOC\V\Core\AutoLoader\AutoLoader;

/**
 * Class Doctrine2DBAL
 *
 * @package MOC\V\Component\Database\Component\Bridge
 */
class Doctrine2DBAL extends Bridge implements IBridgeInterface
{

    /** @var Connection $Connection */
    private $Connection = null;

    /**
     *
     */
    public function __construct()
    {

        AutoLoader::getNamespaceAutoLoader('Doctrine\DBAL',
            __DIR__.'/../../../Vendor/Doctrine2DBAL/2.5.0/lib');
        AutoLoader::getNamespaceAutoLoader('Doctrine\Common',
            __DIR__.'/../../../Vendor/Doctrine2Common/2.5.0/lib');
    }

    /**
     * @param UsernameParameter $Username
     * @param PasswordParameter $Password
     * @param DatabaseParameter $Database
     * @param DriverParameter   $Driver
     * @param HostParameter     $Host
     * @param PortParameter     $Port
     *
     * @param int               $Timeout
     *
     * @return IBridgeInterface
     * @throws ComponentException
     */
    public function registerConnection(
        UsernameParameter $Username,
        PasswordParameter $Password,
        DatabaseParameter $Database,
        DriverParameter $Driver,
        HostParameter $Host,
        PortParameter $Port,
        $Timeout = 5
    ) {

        try {
            $Connection = DriverManager::getConnection(array(
                'driver'        => $Driver->getDriver(),
                'user'          => $Username->getUsername(),
                'password'      => $Password->getPassword(),
                'host'          => $Host->getHost(),
                'dbname'        => $Database->getDatabase(),
                'port'          => $Port->getPort(),
                'driverOptions' => array(
                    \PDO::ATTR_TIMEOUT => $Timeout,
                    \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
                )
            ));
        } catch (\Exception $E) {
            // @codeCoverageIgnoreStart
            throw new ComponentException($E->getMessage(), $E->getCode(), $E);
            // @codeCoverageIgnoreEnd
        }

        try {
            $Connection->connect();
        } catch (\Exception $E) {
            throw new ComponentException($E->getMessage(), $E->getCode(), $E);
        }

        $this->Connection = $Connection;
        return $this;
    }

    /**
     * WARNING: this may drop out with no replacement
     *
     * @return Connection
     * @throws NoConnectionException
     * @codeCoverageIgnore
     */
    public function getConnection()
    {

        return $this->prepareConnection();
    }

    /**
     * @throws NoConnectionException
     * @return Connection
     */
    private function prepareConnection()
    {

        if (null === $this->Connection) {
            // @codeCoverageIgnoreStart
            throw new NoConnectionException();
            // @codeCoverageIgnoreEnd
        }
        return $this->Connection;
    }

    /**
     * WARNING: this may drop out with no replacement
     *
     * @return \Doctrine\DBAL\Schema\AbstractSchemaManager
     * @throws NoConnectionException
     * @codeCoverageIgnore
     */
    public function getSchemaManager()
    {

        return $this->prepareConnection()->getSchemaManager();
    }

    /**
     * WARNING: this may drop out with no replacement
     *
     * @return QueryBuilder
     * @throws NoConnectionException
     * @codeCoverageIgnore
     */
    public function getQueryBuilder()
    {

        return $this->prepareConnection()->createQueryBuilder();
    }

    /**
     * @return int
     * @throws \Doctrine\DBAL\DBALException
     */
    public function executeWrite()
    {

        $Query = $this->prepareQuery();
        return $this->prepareConnection()->executeUpdate($Query[0], $Query[1], $Query[2]);
    }

    /**
     * @return array
     */
    private function prepareQuery()
    {

        /** @var Statement $Statement */
        $Statement = array_pop(self::$StatementList);
        $ParameterCount = substr_count($Statement, '?');
        $QueryValue = array();
        $QueryType = array();
        for ($Run = 0; $Run < $ParameterCount; $Run++) {
            $Parameter = array_pop(self::$ParameterList);
            array_unshift($QueryValue, $Parameter[0]);
            array_unshift($QueryType, $Parameter[1]);
        }
        return array($Statement, $QueryValue, $QueryType);
    }

    /**
     * @return array
     * @throws \Doctrine\DBAL\DBALException
     */
    public function executeRead()
    {

        $Query = $this->prepareQuery();
        return $this->prepareConnection()->executeQuery($Query[0], $Query[1], $Query[2])->fetchAll();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:padding="4dp"
          android:text="footer film comment"
        />

redpajama_set_name: RedPajamaGithub


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

namespace CarWorkshopDbContext
{
    public partial class VehicleTruck : Vehicle
    {
        public bool HasCargo { get; set; }
    }

}


text:
layout: default
title: Archive
---

    {% for post in site.posts %}
    {% include listpost.html %}
    {% endfor %}

      {% include docs_contents.html %}


text:
foam.CLASS({
  package: 'foam.core',
  name: 'FObjectArray',
  extends: 'foam.core.Array',

  documentation: "A Property which contains an array of 'of' FObjects.",

  methods: [
    function installInProto(proto) {
      this.SUPER(proto);
      var self = this;
      Object.defineProperty(proto, self.name + '$' + 'errors$', {
        get: function getArrayErrorSlot() {
          // errors_$ will be updated with an array member's error_$ slot
          var errors_$ = foam.core.SimpleSlot.create({ value: [] });
          // sub will be replaced when the array changes
          var sub = foam.core.FObject.create();

          // Safely combine error lists and update error_$
          var setErrors = errorLists => {
            let errors = errorLists.flat(1).filter(v => v);
            errors_$.set(errors.length > 0 ? errors : null);
          };
          // Handle an array property update
          var subToArray = val => {
            console.log('subbing to', val);
            var errorSlots = val.map(v => v.errors_$);
            setErrors(val.map(v => v.errors_));

            // Alternative to ArraySlot.create(...).map(...), which fails here
            var l = () => {
              val.forEach(v => { let _ = v.errors_ });
              setErrors(val.map(v => v.errors_));
            };
            var subs = errorSlots.map(s => s.sub(l));
            sub.onDetach({ detach: () => { subs.forEach(s => s.detach()); } });
          };
          // Initialize slot listener
          var val = this[self.name];
          if ( Array.isArray(val) ) subToArray(val);
          self.toSlot(this).sub(() => {
            sub.detach();
            sub = foam.core.FObject.create();
            var val = this[self.name];
            if ( Array.isArray(val) ) subToArray(val);
          })
          return errors_$;
        },
        configurable: true
      })
    }
  ],

  properties: [
    { name: 'of', required: true },
    {
      name: 'type',
      factory: function() {
        return this.of + '[]';
      }
    },
    [ 'adapt', function(_, /* array? */ a, prop) {
        if ( ! a ) return [];
        // If not an array, allow assertValue to assert the type-check.
        if ( ! Array.isArray(a) ) return a;

        var b = new Array(a.length);
        for ( var i = 0 ; i < a.length ; i++ ) {
          b[i] = prop.adaptArrayElement(a[i], this);
        }
        return b;
      }
    ],
    [ 'assertValue', function(v, prop) {
        foam.assert(Array.isArray(v),
          prop.name, 'Attempt to set array property to non-array value', v);
      }
    ],
    [ 'adaptArrayElement', function(o, obj) {
      // FUTURE: replace 'foam.' with '(this.__subContext__ || foam).' ?
      var ctx = obj.__subContext__ || foam;
      var of  = o.class || this.of;
      var cls = ctx.lookup(of);
      if ( cls == null ) cls = obj[of];
      return cls.isInstance(o) ? o : cls.create(o, obj);
    }],
    {
      name: 'fromJSON',
      value: function(value, ctx, prop) {
        return foam.json.parse(value, prop.of, ctx);
      }
    }
  ]
});


text:
<?php
/*
 * Italian language for ts-website
 * @copy JohnnyKing94 <https://github.com/JohnnyKing94>
 */

$lang = array();

/************* General *************/

$lang["general"]["langcode"] = "it";
$lang["general"]["scripterror"] = "Un errore si è verificato! {0}: {1}";

/************* Navbar *************/

$lang["navbar"]["navigation"] = "Navigazione";

$lang["navbar"]["viewer"] = "Visualizza Server";
$lang["navbar"]["bans"] = "Lista Ban";
$lang["navbar"]["rules"] = "Regolamento";

$lang["navbar"]["connect"] = "Unisciti a noi!";
$lang["navbar"]["connecttooltip"] = "Clicca per connetterti a {0}";

/************* Footer *************/

$lang["footer"]["css"] = "CSS di";
$lang["footer"]["background"] = "sfondo";

/************* Server status *************/

$lang["serverstatus"]["title"] = "Stato Server";
$lang["serverstatus"]["address"] = "Indirizzo";
$lang["serverstatus"]["loading"] = "In caricamento...";

$lang["serverstatus"]["online"] = "Online";
$lang["serverstatus"]["offline"] = "Offline";
$lang["serverstatus"]["uptime"] = "Uptime";
$lang["serverstatus"]["version"] = "Versione";
$lang["serverstatus"]["avgping"] = "Ping medio";
$lang["serverstatus"]["avgpl"] = "Perdita media dei pacchetti";

/************* Admin list *************/

$lang["adminlist"]["title"] = "Lista admin";
$lang["adminlist"]["emptygroup"] = "Questo gruppo è vuoto";
$lang["adminlist"]["status"]["online"] = "Online";
$lang["adminlist"]["status"]["away"] = "Assente";
$lang["adminlist"]["status"]["offline"] = "Offline";
$lang["adminlist"]["lastupdate"] = "Ultimo aggiornamento: {0}";

/************* Server viewer promo box (under adminlist and contact) *************/

$lang["svpb"]["title"] = "Visualizza server";
$lang["svpb"]["takealook"] = "Guarda »";

/************************************/
/************* SUBPAGES *************/
/************************************/

/************* News - index.php *************/

$lang["index"]["title"] = "News";
$lang["index"]["showmore"] = "Leggi di più";
$lang["index"]["showless"] = "VIsualizza meno";

$lang["index"]["errortitle"] = "Errore: la directory news non è stata trovata!";
$lang["index"]["errorsubtitle"] = "Si prega di assicurarsi che la posizione della cartella impostata in config/config.php sia valida.";

/************* Server viewer - viewer.php *************/

$lang["viewer"]["title"] = "Visualizza Server";
$lang["viewer"]["lastupdate"] = "Ultimo aggiornamento: {0}";

/************* Ban List - bans.php *************/

$lang["banlist"]["title"] = "Lista Ban";
$lang["banlist"]["datatablesurl"] = "//cdn.datatables.net/plug-ins/1.10.12/i18n/Italian.json";
$lang["banlist"]["emptylist"] = "LA LISTA BAN E' VUOTA";
$lang["banlist"]["lastupdate"] = "Ultimo aggiornamento: {0}";

$lang["banlist"]["table"]["emptyreason"] = "(nessun motivo)";
$lang["banlist"]["table"]["permaban"] = "Permanente";

$lang["banlist"]["table"]["nickname"] = "Nick";
$lang["banlist"]["table"]["reason"] = "Motivo";
$lang["banlist"]["table"]["bannedby"] = "Bananto da";
$lang["banlist"]["table"]["bandate"] = "Data del Ban";
$lang["banlist"]["table"]["expires"] = "Scade";

/************* Rules - rules.php *************/

$lang["rules"]["title"] = "Regolamento";
$lang["rules"]["filenotfound"] = "Errore: il file config/rules.md non è stato trovato!";
$lang["rules"]["readerror"] = "Errore: impossibile accede al file config/rules.md!";


text:
using System.Web.Mvc;
using Owin;

namespace CommanderDemo.Web
{
    /// <summary>
    /// Bootstrap SignalR
    /// </summary>
    internal class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var hubSettings = DependencyResolver.Current.GetService<NotificationHub.Settings>();
            if (hubSettings.IsDisabled)
                return;

            app.MapSignalR();
        }
    };
}


text:
/*
Theme Name: Delicate News
Theme URI: http://www.elegantthemes.com/gallery/
Version: 4.4
Description: 2 Column theme from Elegant Themes
Author: Elegant Themes
Author URI: http://www.elegantthemes.com
*/

/*------------------------------------------------*/
/*-----------------[RESET]------------------------*/
/*------------------------------------------------*/

/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; }
body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q {	quotes: none; }
blockquote:before, blockquote:after,q:before, q:after { content: ''; content: none; }
:focus { outline: 0; }
ins { text-decoration: none; }
del { text-decoration: line-through; }
table { border-collapse: collapse; border-spacing: 0; }

/*------------------------------------------------*/
/*-----------------[BASIC STYLES]-----------------*/
/*------------------------------------------------*/

body { text-align: center; line-height: 21px; font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #757575; min-height: 25px; background-color: #1C1C1C; }

a { text-decoration: none; color: #00b7f3; }
a:hover { text-decoration: underline; }
.clear { clear: both; }
.ui-tabs-hide { display: none; }
br.clear { margin: 0px; padding: 0px; }

h1, h2, h3, h4, h5, h6 { padding-bottom: 5px; color: #808080; letter-spacing: -1px; line-height: 1em; font-weight: normal; font-family: Arial, sans-serif;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: #404040; }
h1 { font-size: 24px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 10px; }

p { padding-bottom: 10px; line-height: 24px; }
strong { font-weight: bold; color: #1c1c1c; }
cite, em, i { font-style: italic; }
pre, code { font-family: Courier New, monospace; margin-bottom: 10px; }
ins { text-decoration: none; }
sup, sub { height: 0; line-height: 1; position: relative; vertical-align: baseline; }
sup { bottom: 0.8em; }
sub { top: 0.3em; }
dl { margin: 0 0 1.5em 0; }
dl dt { font-weight: bold; }
dd  { margin-left: 1.5em;}
blockquote  { margin: 1.5em; padding: 1em; color: #666666; background: #e6e6e6; font-style: italic; border: 1px solid #dcdcdc; }
	blockquote p { padding-bottom: 0px; }

input[type=text],input.text, input.title, textarea, select { background-color:#fff; border:1px solid #bbb; padding: 2px; color: #4e4e4e; }
input[type=text]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus { border-color:#2D3940; color: #3e3e3e; }
input[type=text], input.text, input.title, textarea, select { margin:0.5em 0; }
textarea { padding: 4px; }

img#about-image { float: left; margin: 3px 8px 8px 0px; }

.clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

/*------------------------------------------------*/
/*---------------[MAIN LAYOUT INFO]---------------*/
/*------------------------------------------------*/

#header-top  { background: #1a1a1a url(images/header-top-bg.png) repeat-x bottom left; height: 44px; }
	div.container { text-align: left; width: 960px; margin: 0 auto; position: relative; }
/* Jeremy changed header height */
#header { height: 89px; }
#bg {background: #ffffff url(images/main-bg.png) repeat-x; }
			img#logo { margin: 0px; position: absolute; bottom: -100px; left: 37px; float: none; z-index:50; }
	#bg2 { background: url(images/second-bg.jpg) no-repeat 50% 86px; }

		#content {background: url(images/content-bg.png) repeat-y 600px 0px; padding-bottom: 35px;}
			#main-area {width: 600px; float: left; }
				h4#recent, div#breadcrumbs {font-size: 24px; color: #b54836; text-shadow: 1px 1px 1px #dcaaa1; padding-top: 16px; padding-left: 19px; border-left: 1px solid #ececec; border-top: 1px solid #ececec; border-bottom: 1px solid #ececec; background: url(images/recent-bg.png) no-repeat top left; text-transform: uppercase; }
				div#breadcrumbs { padding-top: 12px; padding-bottom: 6px; }
					div#breadcrumbs a { color:#B54836; }
						div#breadcrumbs a:hover { text-decoration: none; }
					span.sep { color: #d9d9d9; margin-right: 3px; font-size: 14px; }
						span.sep span { margin-right: -5px; font-size: 18px; }

					div.entry {width: 246px; float: left; border-bottom: 1px solid #ececec; border-right: 1px solid #ececec; padding: 24px 26px; }
					div.entry.second {border-right: none;}
						.entry h3.title {font-size: 30px; color: #404040; text-shadow: 1px 1px 1px #e6e6e6; margin-bottom: 15px; }
						h3.title a {text-decoration: none;}

						div.thumbnail {position: relative; background-color: #f0f0f0; border: 4px solid #f0f0f0; border-bottom: 1px solid #d0d0d0; margin-bottom: 15px; }
						div.thumbnail img.thumb.alignleft {padding-bottom: 3px;}
							div.thumbnail span.overlay {background: url(images/post-overlay.png) no-repeat; display:block; position: absolute; height: 96px; width: 238px; top: 0px; left: 0px;}
							p.meta-info {font-style: italic; font-size: 11px; color: #949494; text-shadow: 1px 1px 1px #ffffff; padding-left: 10px; padding-bottom:3px; }
							p.meta-info a {font-weight: bold; color: #757575; }

							a.readmore { background: url(images/readmore-right.png) no-repeat right bottom; display: block; height: 23px; padding-right: 11px; line-height: 23px; text-shadow: 1px 1px 1px #797979; font-size: 12px; float: right; color: #fff !important; }
								a.readmore span { display: block; background: url(images/readmore-left.png) no-repeat; padding:0 6px 0 14px; height:23px;  }
								a.readmore:hover { color: #eee; }

		#recent-posts { margin-bottom: 57px; }
			#recent-posts a#left-arrow, #recent-posts a#right-arrow { display: block; text-indent: -9999px; height: 179px; float: left; margin-top: 29px; }
			#recent-posts a#left-arrow { background: url(images/arrow-left.png) no-repeat; width: 62px; }
			#recent-posts a#right-arrow { background: url(images/arrow-right.png) no-repeat; width: 60px; }

			#recent-posts #recent-container { float: left; width: 837px; }
			.slide .cat-entry { float: left; width: 279px; position: relative; height: 208px !important; }
				.slide h4.cat-title { font-size: 24px; text-transform: uppercase; color: #b54836; }
				.slide h3.title { background: #f0f0f0 url(images/recent-block-bg.png) no-repeat; font-size: 24px; padding: 14px 5px 14px 16px; text-shadow: 1px 1px 1px #ffffff; height: 45px; }
				.slide h3.last { border-right: 1px solid #D9D9D9; }

				.slide .thumbnail { display: block; position: relative; }
					.slide .thumbnail img { border-top: 1px solid #636363; }
					.slide .metainfo { position: absolute; right: 0px; bottom: 0px; background: #525252; padding: 2px 8px;  font-style: italic; }
						.slide .metainfo, .slide .metainfo a { text-shadow: 1px 1px 1px #3e2c28; color: #ffffff; }
					.slide .thumbnail .overlay { background: url(images/cat-overlay.png) repeat-x; position: absolute; top: 1px; left: 0px; width: 279px; height: 29px; }

			.post { padding: 30px 35px 38px 20px; }
				.post a { color: #000000; font-weight: bold; }

				.post p.post-meta { font-size: 14px; color: #4d4949; font-style: italic; padding-bottom: 25px; }
					.post p.post-meta a { color: #4d4949; font-weight: bold; }
					.post p.post-meta a:hover { color: #000000; text-decoration: none; }

					.post-thumbnail { float: left; margin: 6px 15px 10px 0px; border: 4px solid #f0f0f0; position: relative; }
						.post-thumbnail span.overlay { background: url(images/post-overlay.png) no-repeat; display:block; position: absolute; height: 238px; width: 500px; top: 0px; left: 0px; }

					.entry ul, .post ul { list-style-type: disc; margin: 10px 0px 10px 20px; }
					.entry ol, .post ol { list-style-type: decimal; list-style-position: inside; margin: 10px 0px 10px 2px; }
						.entry ul li ul, .post ul li ul, .entry ul li ol, .post ul li ol { margin: 2px 0px 2px 20px; }
						.entry ol li ul, .post ol li ul, .entry ol li ol, .post ol li ol  { margin: 2px 0px 2px 35px; }

/*------------------------------------------------*/
/*---------------[DROPDOWN MENU]------------------*/
/*------------------------------------------------*/
		ul#primary { font-size: 16px; float:right;  }
			ul#primary li a { color:#ffffff; text-shadow: 1px 1px 1px #161515; padding: 14px 9px 15px; text-transform: uppercase; }
			ul#primary li a:hover {text-decoration: none;}
				ul#primary > li.current_page_item > a, ul#primary > li.current-menu-ancestor > a {color:#c04531; background: url(images/current-page.jpg) no-repeat bottom center;}
			ul#primary li a:hover { color: #c04531; }
			ul#primary > li.sf-ul.sfHover > a { background: #1a1b1a; }

			ul#primary ul { background: #1a1b1a; padding: 10px 0px 15px; }
			ul#primary li:hover ul, ul#primary li.sfHover ul { top: 44px; box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.3); -moz-box-shadow:3px 6px 7px 1px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.3); -moz-border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; }
				ul#primary ul li { padding: 0px 0px 0px 15px; }
					ul#primary ul li a { background: url(images/top-menu-bullet.png) no-repeat 0px 11px; width: 145px; padding: 8px 0px 8px 15px; }
						ul#primary ul li a:hover { background: url(images/top-menu-active-bullet.png) no-repeat 0px 11px; }
			ul#primary ul li:hover ul, ul#primary ul li.sfHover ul { top: -12px; left: 191px; -moz-border-radius-topright: 8px; -webkit-border-top-right-radius: 8px; }

			ul#secondary { font-size: 14px; position:absolute; right:0; top:35px; }
				ul#secondary li { padding-right: 15px; }
				ul#secondary li a { color:#000000; padding: 8px 0 20px 12px;  }
				ul#secondary li a:hover {text-decoration: none; color:#c04531;}
					ul#secondary > li.current_page_item > a, ul#primary > li.current-menu-ancestor > a, ul.superfish.nav > li > a:hover {color:#c04531; }
					ul#secondary li ul {box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow:3px 6px 7px 1px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 3px 6px 7px 1px rgba(0, 0, 0, 0.2); background: url(images/cat_menu_bg.png) repeat-y; border: 1px solid #cfcfcf; -moz-border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; border-top: none; padding-bottom: 15px; padding-top: 5px; }
						ul#secondary > li.sf-ul.sfHover {background: url(images/active-cat-link.png) no-repeat top right;  }
							ul#secondary > li.sf-ul.sfHover > a {background: url(images/active-cat-link.png) no-repeat top left;}
					ul#secondary li:hover ul, ul#secondary li.sfHover ul { top: 35px; }
					ul#secondary ul li:hover ul, ul#secondary ul li.sfHover ul { top: -6px; }

					ul#secondary ul li { padding: 0px; padding-left: 15px; }
						ul#secondary ul li a { padding: 5px 5px 5px 17px; width: 141px; background: url(images/second-menu-bullet.png) no-repeat 2px 15px; border-top: 1px solid #fff; border-bottom: 1px solid #fff; }
							ul#secondary ul li a:hover { background: url(images/second-active-bullet.png) no-repeat 2px 15px; border-top: 1px solid #efefef; border-bottom: 1px solid #efefef; }

		#search-form { float: right; width: 141px; background: url(images/search.png) no-repeat; height: 25px; margin-top: 9px; margin-left: 16px;}
		#searchinput { background: none; border: none; font-style: italic; color: #959595; text-shadow: 1px 1px 1px #151515; padding-left: 11px; display: block; margin-top: 4px; float:left; width: 100px; font-size: 11px; }
		#searchsubmit { float:left; margin-top:8px; }

/*------------------------------------------------*/
/*--------------[FEATURED SLIDER]-----------------*/
/*------------------------------------------------*/
/* Jeremy changed margin-bottom: 45px to 15 */
#featured { background: url(images/featured-bg.png) no-repeat; height: 310px; margin-bottom: 15px; }
	/* Jeremy added min-height and changed widths. */
	#featured #description { float: left; width: 555px; min-height: 265px;}
	#featured .slide { padding: 40px 0 0 35px;} /*JER removed  width:525px; */
		#featured h2.title { font-size:32px; margin-bottom: 6px; }
			#featured h2.title a { color: #a29f9f; }
			#featured h2.title a:hover { text-decoration: none; }
			#featured p { color: #a29f9f; text-shadow: 1px 1px 1px #fff; line-height: 18px; padding-bottom: 1px; }

			#featured p.meta { float: right; font-style: italic; color: #c1c1c1; margin-top: 9px; }
				#featured p.meta a { color: #b4341f; font-weight: bold; }
	#featured #controllers { float: right; width: 363px; margin-top: -11px; background-color: #bfbfbf; }
		#featured #controllers .alignleft { width: 253px; }
		#featured #controllers .alignright { width: 110px; }

		#featured #controllers a { display: block; position:relative; }
		#featured #controllers a:hover { text-decoration: none; }
			#featured #controllers img { border: 3px solid transparent; }
			#featured #controllers a.active img { border-color: #be341f; }

			span.date { display: block; position:absolute; text-shadow: -1px -1px 1px #8e0601; color: #fff; background: url(images/date-small-bg.png) no-repeat; width: 56px; height: 22px; top: -11px; left: -9px; font-size: 17px; padding: 7px 0px 0px 8px; z-index: 5; text-transform: uppercase; }

			#featured #controllers .alignleft span.date { background: url(images/big-date-bg.png) no-repeat; height:30px; left:-10px; top:-12px; width:76px; padding: 9px 0px 0px 12px; font-size: 24px; text-transform: uppercase; }

			#featured a.second { margin-top: -3px; }
			#featured .alignright img { margin-bottom:-3px; margin-left:-1px; }

			#featured .alignleft span.overlay { position: absolute; top: 3px; left: 3px; background: url(images/feat-big-overlay.png) no-repeat; width: 249px; height: 157px; }

			#featured .alignright span.overlay { position: absolute; top: 2px; left: 2px; background: url(images/feat-small-overlay.png) no-repeat; width: 104px; height: 104px; }

/*------------------------------------------------*/
/*-------------------[COMMENTS]-------------------*/
/*------------------------------------------------*/

#comment-wrap { border-top: 1px solid #ececec; padding-top: 35px; }
	li.depth-1 { padding: 30px 0px 5px 20px; border-bottom: 1px solid #ececec; }

h3#comments { font-size: 36px; padding-bottom:5px; padding-left: 20px; }
h3#reply-title span { font-size: 36px; }

.comment-icon { background: url(images/comment-bottom-bg.png) no-repeat bottom left; padding-bottom: 14px; }

.comment-icon .post { padding: 3px 0px 0px; }

div.authordata { width: 100px; }
		div.avatar { float: left; position: relative; background: url(images/avatar-bg.png) no-repeat; padding:6px 4px 6px 6px; }

	.comment-wrap { float:left; margin-left:14px; }

		.reply-container { display:block; float:right; margin-bottom:15px; }
			.reply-container a { color: #000000; text-shadow: none; font-weight: bold; }
			.reply-container a:hover { text-decoration: none; color: #383838; }

	li.depth-1 .comment-wrap { width: 460px; }
	li.depth-2 .comment-wrap { width: 378px; }
	li.depth-3 .comment-wrap { width: 296px; }
	li.depth-4 .comment-wrap { width: 214px; }

	ol.commentlist { list-style:none outside none; padding-top:8px; }
		ol.commentlist ul { list-style:none outside none; }

		.commentlist li.comment li { background: none; padding: 0px; }
		.commentlist li.comment ul { margin: 8px 0px 8px 82px; }

	#respond { padding-top: 30px; padding-left: 20px; padding-bottom: 10px; }
		.comment #respond { padding-left: 0px; padding-top: 5px; }
		#commentform textarea#comment { width: 88%; }
		#commentform input[type=text] { width: 40%; }

		li.comment #respond textarea { width: 88% !important; }
		li.comment #respond input[type=text] { width: 50% !important; }

	#respond h3#comments { background: none; margin: 0px; padding: 0px; }

	.comment-author { color: #d0cfcf; font-size: 24px; }
		.comment-author .comment-meta, .comment-author .comment-meta a { color: #404040; font-size: 24px; text-transform: uppercase; }
			.comment-author .comment-meta a:hover { text-decoration: none; }
		span.fn, span.fn a { color: #b54836; font-size: 24px; text-transform: uppercase; }
			span.fn a:hover { text-decoration: none; }

	.comment-content { padding-top:2px; }

/*------------------------------------------------*/
/*---------------------[FOOTER]-------------------*/
/*------------------------------------------------*/
#footer { background: #1c1c1c url(images/footer-top-bg.png) repeat-x; }
	.footer-widget { width: 301px; padding-top: 17px; padding-left: 19px; float: left; }
	.footer-widget h4.widgettitle { padding-bottom:30px; font-size: 24px; color: #8c2a1a; text-shadow: 1px 1px 1px #0c0c0c; text-transform: uppercase; }
	#footer a { color: #ababab; text-shadow: 1px 1px 1px #0c0c0c; }
		#footer a:hover { color: #807f7f; text-decoration: none; }

	.footer-widget ul { margin-bottom:5px; }
		.footer-widget ul ul { margin-bottom:0; }
		.footer-widget ul li { background:url(images/footer-bullet.png) no-repeat scroll 0 8px transparent; padding:0px 0 3px 16px; }
			.footer-widget ul li ul { margin:0 0 -3px; padding:5px 0 0 7px; }
#footer-bottom {background-color: #1c1c1c;}
		p#copyright {float:right; font-size:11px; padding-bottom:20px; padding-right: 18px; color:#767676;text-shadow: 1px 1px 1px #0c0c0c; padding-top: 45px;}
		p#copyright a {color:#535353;}

/*------------------------------------------------*/
/*--------------------[SIDEBAR]-------------------*/
/*------------------------------------------------*/
	#sidebar { float: right; width: 360px; }
			#sidebar div#tabbed {width: 360px; }
			#sidebar #one-col ul#tabbed-area {background: url(images/tabbed-right-bg.png) repeat-y top right; border-top: 1px solid #ececec; }
				#sidebar #one-col ul#tabbed-area li { text-align: center; padding: 2px 0px 0px 0px; float: left; }
				#sidebar #one-col #tabbed ul li { background: none; }
					#sidebar #one-col ul#tabbed-area li a { font-size: 24px; color: #b54836 !important; text-shadow: 1px 1px 1px #dcaaa1; float: left; text-decoration: none; padding-left: 2px; text-transform: uppercase; }
						#sidebar #one-col ul#tabbed-area li a span { display: block; padding: 12px 0px 9px;  }

							#sidebar #one-col ul#tabbed-area li.first a span { width: 116px; }
							#sidebar #one-col ul#tabbed-area li.second a span { width: 120px; }
							#sidebar #one-col ul#tabbed-area li.last a span { width: 117px; }

						#sidebar #one-col ul#tabbed-area li.ui-state-active { background: #f0f0f0 url("images/tab-top-bg.png") repeat-x; border-right: 1px solid #d1d1d1; padding-top: 3px; margin-top: -1px; }
							#sidebar #one-col ul#tabbed-area li.ui-state-active a { background:url("images/tabs-left-bg.png") repeat-y scroll 0 0 transparent; }

						#sidebar #one-col ul#tabbed-area li.ui-state-active a  { background-color: #f0f0f0; }

					#sidebar #first-col, #sidebar #last-col {width: 179px; float: right; border-right: 1px solid #ececec; border-top: 1px solid #ececec; border-bottom: 1px solid #ececec;}
					#sidebar #first-col {border-right: none;}
						#sidebar h4 {font-size: 24px; color: #b54836; text-shadow: 1px 1px 1px #dcaaa1; padding-top: 16px; padding-left: 19px;  border-top: 1px solid #ececec; border-bottom: 1px solid #ececec; background: url(images/recent-bg.png) no-repeat top left; margin-bottom: 20px; text-transform: uppercase; }
							.widgetcontent { padding: 0px 10px 15px 20px; }
   #sidebar #first-col ul ul, #sidebar #last-col ul ul, #sidebar #one-col ul ul { margin: 0px 0px 0px 15px; }
   #sidebar #first-col ul li, #sidebar #last-col ul li, #sidebar #one-col ul li { background:url(images/sidebar_bullet.png) no-repeat 0px 5px; padding:0px 20px 5px 20px; line-height: 27px;  }
   #sidebar #first-col ul li ul, #sidebar #last-col ul li ul, #sidebar #one-col ul li ul { padding:3px 0px 0px 7px; margin: 0px 0px -7px; }
								#sidebar ul li a {color:#727272;}

					#tabbed .tab { border-right: 1px solid #d1d1d1; border-bottom: 1px solid #d1d1d1; background: #f0f0f0 url(images/tabs-left-bg.png) repeat-y; /*margin-top:-2px;*/ }
					#all_tabs { margin-top: -2px; }
						#sidebar #one-col #tabbed .tab ul li { background: url(images/tab-top-bg.png) repeat-x; padding: 2px 0px 0px 2px; }
							#sidebar #one-col #tabbed .tab ul li a { display: block; padding: 8px 17px 7px 16px; }
							#sidebar #one-col #tabbed .tab ul li a:hover { text-decoration: none; background-color: #ececec; }

							#sidebar #one-col #tabbed .tab ul span.box{ float: left; margin: 0px 14px 0px 0px; display:block; border: 1px solid #cacaca; background-color: #dddddd; padding: 3px; position: relative; }
								span.box span.overlay { background: url(images/box-overlay.png) no-repeat; display:block; position: absolute; height: 59px; width: 59px; top: 3px; left: 3px; }
							#sidebar #one-col #tabbed .tab ul img {border-right: 1px solid #fff; border-bottom: 1px solid #fff;}
							#sidebar #one-col #tabbed span.title { color: #313131; font-size: 20px; display: block; margin-top: 10px; }

/*------------------------------------------------*/
/*------------[CAPTIONS AND ALIGNMENTS]-----------*/
/*------------------------------------------------*/

div.post .new-post .aligncenter, .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption { border: 1px solid #ddd; text-align: center; background-color: #f3f3f3; padding-top: 4px; margin-bottom: 10px; }
.wp-caption.alignleft { margin: 0px 10px 10px 0px; }
.wp-caption.alignright { margin: 0px 0px 10px 10px; }
.wp-caption img { margin: 0; padding: 0; border: 0 none; }
.wp-caption p.wp-caption-text { font-size: 11px; line-height: 17px; padding: 0 4px 5px; margin: 0; }
.alignright { float: right; }
.alignleft { float: left }
img.alignleft { display:inline; float:left; margin-right:15px; }
img.alignright { display:inline; float:right; margin-left:15px; }

/*------------------------------------------------*/
/*---------------[DEFAULT DROPDOWN SETTINGS]---*/
/*------------------------------------------------*/

.nav ul { position:absolute; top:-999em; background-position: bottom; background-repeat: no-repeat; z-index: 10; }
.nav li { float:left; position:relative; }
.nav a { display:block; float: left; }
	.nav li:hover ul, ul.nav li.sfHover ul { left:0px; top:50px; }
	.nav li:hover li ul, .nav li.sfHover li ul { top:-999em; }
		.nav li li:hover ul, ul.nav li li.sfHover ul { left:192px; top:0px; }
	.nav li:hover ul, .nav li li:hover ul { top: -999em; }
	.nav li li {	display: block;	padding: 0px; float: left; height: auto !important; }
	.nav li ul { width: 191px; }
		.nav li li a:link, .nav li li a:visited {	display: block; height: auto; float: left; }
		.nav li:hover { visibility: inherit; /* fixes IE7 'sticky bug' */ }

/*------------------------------------------------*/
/*-----------------[WP CALENDAR]-----------------*/
/*------------------------------------------------*/
#wp-calendar { empty-cells: show; margin: 10px auto 0; width: 240px;	}
	#wp-calendar a { display: block; text-decoration: none; font-weight: bold; }
		#wp-calendar a:hover { text-decoration: underline; }
	#wp-calendar caption {	text-decoration: none; font: bold 13px Arial, Sans-Serif; }
	#wp-calendar td {	padding: 3px 5px; color: #9f9f9f; }
		#wp-calendar td#today { color: #ffffff; }
	#wp-calendar th {	font-style: normal;	text-transform: capitalize;	padding: 3px 5px; }
		#wp-calendar #prev a, #wp-calendar #next a { font-size: 9pt; }
		#wp-calendar #next a { padding-right: 10px; text-align: right; }
		#wp-calendar #prev a { padding-left: 10px; text-align: left; }

/*------------------------------------------------*/
/*-------------------[PAGE NAVI]------------------*/
/*------------------------------------------------*/
.pagination { overflow: hidden; padding: 15px 12px 0px; clear:both; }

.wp-pagenavi { position: relative; clear:both; padding:30px 0 5px; font-size: 24px; float: right; padding-right: 24px; }
	.wp-pagenavi a, .wp-pagenavi a:link { padding: 5px 7px !important; margin: 2px; text-decoration: none; border:none !important; color: #413f36; background-color: #fff; font-weight: normal !important; color: #b9b9b9 !important; }
	.wp-pagenavi a:visited { padding: 5px 7px; margin: 2px; text-decoration: none; border: 1px solid #e9e9e9; color: #b9b9b9; background-color: #fff;  }
	.wp-pagenavi span.pages { padding: 5px 7px 5px !important; margin: 2px !important ; border:none !important; color: #b9b9b9 !important; background-color: #fff; font-size: 14px; text-transform: uppercase; }
	.wp-pagenavi span.current, .wp-pagenavi span.extend, .wp-pagenavi a:active, .wp-pagenavi a:hover { padding: 5px 7px !important; margin: 2px; font-weight: bold; background-color:none !important; border:none !important; color:#b54836 !important; }

a.readmore:hover, #sidebar div.custom-sidebar-block ul.control li a:hover, ul#cats-menu li a:hover, ul#page-menu li a:hover, div#slider-control div.featitem h2 a  { text-decoration: none; }

.js #feat-content, .js div#from-blog div.entries {display: none;}

.bbottom { border-bottom: 1px solid #ececec; }

.foursixeight { margin: 0px 0px 15px 84px;}

.fullwidth { background: none !important; }
	.fullwidth #main-area { width: 960px; }
		.fullwidth div#breadcrumbs { border-right: 1px solid #ECECEC; }
		.fullwidth .post { padding-right: 20px; }

	.fullwidth li.depth-1 .comment-wrap { width:840px; }
	.fullwidth li.depth-2 .comment-wrap { width:758px; }
	.fullwidth li.depth-3 .comment-wrap { width:676px; }
	.fullwidth li.depth-4 .comment-wrap { width:594px; }
	.fullwidth li.depth-5 .comment-wrap { width:512px; }

.cufon-disabled ul#primary li a, .cufon-disabled span.date, .cufon-disabled .slide h4.cat-title, .cufon-disabled h4#recent, .cufon-disabled div#breadcrumbs, .cufon-disabled #sidebar h4, .cufon-disabled .wp-pagenavi, .cufon-disabled #sidebar ul#tabbed-area li a, .cufon-disabled .footer-widget h4.widgettitle, .cufon-disabled span.fn, .cufon-disabled span.fn a, .cufon-disabled .comment-author .comment-meta, .cufon-disabled .comment-author .comment-meta a { font-family: Impact, sans-serif; font-weight:normal; }
.cufon-disabled #featured h2.title, .cufon-disabled .slide h3.title, .cufon-disabled .entry h3.title, .cufon-disabled #sidebar #tabbed span.title, .cufon-disabled .entry h1, .cufon-disabled .entry h2, .cufon-disabled .entry h3, .cufon-disabled .entry h4, .cufon-disabled .entry h5, .cufon-disabled .entry h6, .cufon-disabled .post h1, .cufon-disabled .post h2, .cufon-disabled .post h3, .cufon-disabled .post h4, .cufon-disabled .post h5, .cufon-disabled .post h6, .cufon-disabled h3#comments  { font-family: Century Gothic, Arial, sans-serif; font-weight:normal; }

.cufon-disabled ul#primary li a { font-size:15px; }
	.cufon-disabled ul#primary ul li a { background:url("images/top-menu-bullet.png") no-repeat scroll 0 15px transparent; }
.cufon-disabled #featured #controllers .alignleft span.date { font-size:17px; }
.cufon-disabled span.date { font-size:13px; height:26px; padding:3px 0 0 8px; }
.cufon-disabled .slide h4.cat-title { font-size:20px; padding-bottom:9px; }
.cufon-disabled h4#recent, .cufon-disabled div#breadcrumbs { font-size:20px; padding-bottom:10px; padding-top:10px; text-shadow: none; }
.cufon-disabled #sidebar h4 { text-shadow: none; font-size:20px; padding-bottom:9px; padding-top:11px; }
.cufon-disabled #sidebar ul#tabbed-area li a { font-size:20px !important; text-shadow: none !important; }
	.cufon-disabled #sidebar ul#tabbed-area li a span { padding:9px 0 !important; }
.cufon-disabled #sidebar #tabbed span.title { text-shadow: 1px 1px 1px #ffffff; }
.cufon-disabled .footer-widget h4.widgettitle { font-size: 20px; }
.cufon-disabled span.fn, .cufon-disabled span.fn a { font-size:20px; }
.cufon-disabled .comment-author .comment-meta, .cufon-disabled .comment-author .comment-meta a { font-size: 20px; }

.js ul#primary li a, .js span.date, .js h4.category-title, .js h4#recent,.js #recent-posts h3.title, .js #tabbed-area li a, .js h4.widgettitle,.js h4.cat-title,.js #footer h4.widgettitle,.js div#breadcrumbs,.js .wp-pagenavi,.js .comment-author,.js #featured h2.title,.js #recent-tabbed a, .js #popular-tabbed a, .js #random-tabbed a,.js .entry h1,.js .entry h2,.js .entry h3,.js .entry h4,.js .entry h5,.js .entry h6,.js .slide h3.title,.js .post h1.title,.js .post h2,.js .post h3,.js .post h4,.js .post h5,.js .post h6,.js h3#comments { text-indent: -9999px; }

span.date { text-shadow:-1px -1px 1px rgba(0, 0, 0, 0.4); }
.et_pt_blogentry a.readmore { color: #282828 !important; }
.et_pt_gallery_entry { margin: 0 0 32px 86px !important; }

#comment-wrap .navigation { padding: 10px 0; }
	.nav-previous { float: left; }
	.nav-next { float: right; }
h3#reply-title small { display: block; font-size: 14px; letter-spacing: 0; }

#commentform input[type=text] { width: 40%; display: block; padding: 5px; }
#commentform textarea#comment { width: 91%; }
.commentlist #respond textarea#comment { width: 98% !important; }
.commentlist #respond input[type=text] { width: 40%; display: block; padding: 5px; }
.comment_navigation_bottom, .comment_navigation_top { padding-right: 35px; }
.comment #respond { width: 93%; }
/*.et_embedded_videos { display: none !important; }*/

.js #featured .slide { display: none; }


text:
package org.javaee7.websocket.encoder.client;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.websocket.ClientEndpoint;
import javax.websocket.EncodeException;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;

/**
 * @author Arun Gupta
 */
@ClientEndpoint(encoders = {MyMessageEncoder.class},
        decoders={MyMessageDecoder.class})
public class MyClient {
    public static CountDownLatch latch= new CountDownLatch(3);
    public static MyMessage response;

    @OnOpen
    public void onOpen(Session session) {
        try {
            MyMessage message = new MyMessage("{\"apple\" : \"red\", \"banana\": \"yellow\"}");
            session.getBasicRemote().sendObject(message);
        } catch (IOException | EncodeException ex) {
            Logger.getLogger(MyClient.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @OnMessage
    public void processMessage(MyMessage message) {
       response = message;
       latch.countDown();
    }

    @OnError
    public void onError(Throwable t) {
        t.printStackTrace();
    }
}


text:
class Solution(object):
    def closestValue(self, root, target):
        """
        :type root: TreeNode
        :type target: float
        :rtype: int
        """


text:
package org.ovirt.engine.core.common.businessentities;

import java.util.List;

import org.ovirt.engine.core.common.utils.ObjectUtils;
import org.ovirt.engine.core.common.utils.ToStringBuilder;
import org.ovirt.engine.core.compat.Guid;

public class VmGuestAgentInterface implements IVdcQueryable {

    private static final long serialVersionUID = -9164680367965630250L;

    /**
     * The Id of the VM this interface belongs to
     */
    private Guid vmId;

    /**
     * The internal nic's name as seen by the guest agent
     */
    private String interfaceName;

    /**
     * The internal nic's mac address as seen by the guest agent
     */
    private String macAddress;

    /**
     * The vNic's IPv4 addresses
     */
    private List<String> ipv4Addresses;

    /**
     * The vNic's IPv6 addresses
     */
    private List<String> ipv6Addresses;

    public Guid getVmId() {
        return vmId;
    }

    public void setVmId(Guid vmId) {
        this.vmId = vmId;
    }

    @Override
    public Object getQueryableId() {
        return getVmId();
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getMacAddress() {
        return macAddress;
    }

    public void setMacAddress(String macAddress) {
        this.macAddress = macAddress;
    }

    public List<String> getIpv4Addresses() {
        return ipv4Addresses;
    }

    public void setIpv4Addresses(List<String> ipv4Addresses) {
        this.ipv4Addresses = ipv4Addresses;
    }

    public List<String> getIpv6Addresses() {
        return ipv6Addresses;
    }

    public void setIpv6Addresses(List<String> ipv6Addresses) {
        this.ipv6Addresses = ipv6Addresses;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getInterfaceName() == null) ? 0 : getInterfaceName().hashCode());
        result = prime * result + ((getIpv4Addresses() == null) ? 0 : getIpv4Addresses().hashCode());
        result = prime * result + ((getIpv6Addresses() == null) ? 0 : getIpv6Addresses().hashCode());
        result = prime * result + ((getMacAddress() == null) ? 0 : getMacAddress().hashCode());
        result = prime * result + ((getVmId() == null) ? 0 : getVmId().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof VmGuestAgentInterface)) {
            return false;
        }
        VmGuestAgentInterface other = (VmGuestAgentInterface) obj;
        return (ObjectUtils.objectsEqual(getInterfaceName(), other.getInterfaceName())
                && ObjectUtils.objectsEqual(getIpv4Addresses(), other.getIpv4Addresses())
                && ObjectUtils.objectsEqual(getIpv6Addresses(), other.getIpv6Addresses())
                && ObjectUtils.objectsEqual(getMacAddress(), other.getMacAddress())
                && ObjectUtils.objectsEqual(getVmId(), other.getVmId()));
    }

    @Override
    public String toString() {
        return ToStringBuilder.forInstance(this)
                .append("vmId", getVmId())
                .append("macAddress", getMacAddress())
                .append("ipv4", getIpv4Addresses())
                .append("ipv6", getIpv6Addresses())
                .build();
    }
}


text:
package org.elixirian.jsonstatham.json;

import static org.elixirian.kommonlee.util.Objects.*;

import java.util.Map.Entry;
import java.util.Set;

import org.elixirian.jsonstatham.annotation.Json;
import org.elixirian.jsonstatham.annotation.JsonField;

/**
 * <pre>
 *     ___  _____                                _____
 *    /   \/    /_________  ___ ____ __ ______  /    /   ______  ______
 *   /        / /  ___ \  \/  //___// //     / /    /   /  ___ \/  ___ \
 *  /        \ /  _____/\    //   //   __   / /    /___/  _____/  _____/
 * /____/\____\\_____/   \__//___//___/ /__/ /________/\_____/ \_____/
 * </pre>
 *
 * @author Lee, SeongHyun (Kevin)
 * @version 0.0.1 (2010-02-03)
 */
@Json
public class JsonObjectContainingMapEntrySet
{
  @JsonField(name = "name")
  private final String name;

  @JsonField(name = "valueMapEntrySet")
  private final Set<Entry<String, Address>> mapEntrySet;

  public JsonObjectContainingMapEntrySet(final String name, final Set<Entry<String, Address>> mapEntrySet)
  {
    this.name = name;
    this.mapEntrySet = mapEntrySet;
  }

  @Override
  public int hashCode()
  {
    return hash(name, mapEntrySet);
  }

  @Override
  public boolean equals(final Object jsonObjectContainingMapEntrySet)
  {
    if (identical(this, jsonObjectContainingMapEntrySet))
    {
      return true;
    }
    final JsonObjectContainingMapEntrySet that =
      castIfInstanceOf(JsonObjectContainingMapEntrySet.class, jsonObjectContainingMapEntrySet);
    /* @formatter:off */
		return isNotNull(that) &&
						   (equal(this.name, that.name) &&
								equal(this.mapEntrySet, that.mapEntrySet));
		/* @formatter:on */
  }

  @Override
  public String toString()
  {
    return toStringBuilder(this).add("name", name)
        .add("valueMapEntrySet", mapEntrySet)
        .toString();
  }
}


text:
date: 2019-07-29 20:34:53 +0000
layout: post
summary: Using unique prime factorisations and itertools to find all the divisors
  of a number.
title: Finding divisors of a number with Python
tags: python maths
---

Here's a problem I was trying to solve recently: given an integer *n*, what are all the divisors of *n*?

A *divisor*, also known as a [*factor*][divisor], is an integer *m* which evenly divides *n*.
For example, the divisors of 12 are 1, 2, 3, 4, 6 and 12.

I ended up writing something with itertools, and the code uses a couple of neat bits of number theory.
I don't know if I'll use it again, but I'm writing it up because it was a fun exercise.

[divisor]: https://en.wikipedia.org/wiki/Divisor

## The simplest approach

If we want to find all the numbers that evenly divide *n*, we could just try every number up to *n*:

```python
def get_divisors(n):
    for i in range(1, int(n / 2) + 1):
        if n % i == 0:
            yield i
    yield n
```

We only need to go up to *n*/2 because anything larger than that can't be a divisor of *n* -- if you divide *n* by something greater than *n*/2, the result won't be an integer.

This code is very simple, and for small values of *n* this is good enough -- but it's quite inefficient and slow.
As *n* gets bigger, the runtime increases linearly.
Can we do better?

## Prime factorisations

For my particular project, I was mostly working with [factorials][factorials].
The factorial of *n*, denoted *n*! is the product of all the integers up to and including *n*.
For example:

  9! = 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1

Because factorials have lots of small factors, I decided to try getting the divisor list by getting smaller factors first.
Specifically, I was looking for *prime factors* -- factors which are also [prime numbers][primes].
(A prime is a number whose only factors are itself and 1.
For example, 2, 3 and 5 are prime, but 4 and 6 are not.)

Here's a function that finds the prime factors of *n*:

```python
def prime_factors(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            n /= i
            yield i
        else:
            i += 1

    if n > 1:
        yield n
```

This is similar to the function above, using trial division -- we keep trying factors, and if we find one, we divide it away and keep going.
Otherwise, we try a higher number.
This is a fairly standard approach to finding prime factors.

Once we have it, we can use it to write the *prime factorisation* of a number -- that is, writing the number as a product of primes.
For example, the prime factorisation of 9! is:

  9! = 27 × 34 × 5 × 7

Computing this factorisation is relatively efficient, especially for factorials -- because the prime factors are all very small, you don't need many divisions to be done.

There's a result in number theory called the [*fundamental theorem of arithmetic*][fta] which states that prime factorisations are unique -- for any number *n*, there's only one way to write it as a product of primes.
(I won't write a proof here, but you can find one [on Wikipedia][proof].)

This gives us a way to find divisors -- by finding all the combinations of prime factors.
The prime factors of any divisor of *n* must be a subset of the prime factors of *n*, or it wouldn't divide *n*.

[factorials]: https://en.wikipedia.org/wiki/Factorial
[primes]: https://en.wikipedia.org/wiki/Prime_number
[fta]: https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic
[proof]: https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic#Proof

## Going from a prime factorisation to divisors

First, let's get the prime factors "with multiplicity" (the prime factors, and how many times each factor appears in the prime factorisation):

```python
import collections

def get_divisors(n):
    pf = prime_factors(n)

    pf_with_multiplicity = collections.Counter(pf)

    ...
```

Then, let's go ahead and construct all the powers of each prime that might appear in a possible divisor of *n*.

```python
def get_divisors(n):
    ...
    powers = [
        [factor ** i for i in range(count + 1)]
        for factor, count in pf_with_multiplicity.items()
    ]
```

For example, for 9! this would give us

```python
[
    [1, 2, 4, 8, 16, 32, 64, 128],    // 2^0, 2^1, ..., 2^7
    [1, 3, 9, 27, 81],                // 3^0, 3^1, ..., 3^4
    [1, 5],
    [1, 7],
]
```

Then to combine these into divisors, we can use the rather nifty [itertools.product][product], which takes a series of iterables, and spits out all the ordered combinations of the different iterables it receives.
It selects one entry from each list of prime powers, and then by multiplying them together we get a divisor of *n*.

```python
import itertools

def prod(iterable):
    result = 1
    for i in iterable:
        result *= i
    return result

def get_divisors(n):
    ...

    for prime_power_combo in itertools.product(*powers):
        yield prod(prime_power_combo)
```

And thus, we have the divisors of *n* (although unlike the original function, they're not in sorted order).

[product]: https://docs.python.org/3/library/itertools.html#itertools.product

## Putting it all together

Putting that all together gives this function for getting the divisors of *n*:

```python
import collections
import itertools

def prime_factors(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            n /= i
            yield i
        else:
            i += 1

    if n > 1:
        yield n

def prod(iterable):
    result = 1
    for i in iterable:
        result *= i
    return result

def get_divisors(n):
    pf = prime_factors(n)

    pf_with_multiplicity = collections.Counter(pf)

    powers = [
        [factor ** i for i in range(count + 1)]
        for factor, count in pf_with_multiplicity.items()
    ]

    for prime_power_combo in itertools.product(*powers):
        yield prod(prime_power_combo)
```

This particular implementation is very efficient when you have lots of small prime factors, like the factorials I was working with.
I don't know how well it performs in the general case -- and if you're doing proper scientific computing, I'm sure there are pre-existing, optimised routines for this sort of thing.

But as a fun little exercise?
I enjoyed it, and it was nice to dip my toes into number theory again.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>QueryNodeSQLWriter</title>
<meta name="date" content="2014-08-12">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.microsoft.windowsazure.mobileservices.table.query

Class QueryNodeSQLWriter

java.lang.Object

com.microsoft.windowsazure.mobileservices.table.query.QueryNodeSQLWriter

public class QueryNodeSQLWriter
extends java.lang.Object

Query node visitor used to generate SQL filter.

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

com.microsoft.windowsazure.mobileservices.table.query.QueryNode
visit(com.microsoft.windowsazure.mobileservices.table.query.BinaryOperatorNode node)

Visit a binary operator node.

com.microsoft.windowsazure.mobileservices.table.query.QueryNode
visit(com.microsoft.windowsazure.mobileservices.table.query.ConstantNode node)

Visit a constant node.

com.microsoft.windowsazure.mobileservices.table.query.QueryNode
visit(com.microsoft.windowsazure.mobileservices.table.query.FieldNode node)

Visit a field node.

com.microsoft.windowsazure.mobileservices.table.query.QueryNode
visit(com.microsoft.windowsazure.mobileservices.table.query.FunctionCallNode node)

Visit a function call node.

com.microsoft.windowsazure.mobileservices.table.query.QueryNode
visit(com.microsoft.windowsazure.mobileservices.table.query.UnaryOperatorNode node)

Visit a unary operator node.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

visit

public com.microsoft.windowsazure.mobileservices.table.query.QueryNode visit(com.microsoft.windowsazure.mobileservices.table.query.ConstantNode node)

Visit a constant node.

Parameters:

node - The node to visit

Returns:

Defined by the implementer.

visit

public com.microsoft.windowsazure.mobileservices.table.query.QueryNode visit(com.microsoft.windowsazure.mobileservices.table.query.FieldNode node)

Visit a field node.

Parameters:

node - The node to visit

Returns:

Defined by the implementer.

visit

public com.microsoft.windowsazure.mobileservices.table.query.QueryNode visit(com.microsoft.windowsazure.mobileservices.table.query.UnaryOperatorNode node)

Visit a unary operator node.

Parameters:

node - The node to visit

Returns:

Defined by the implementer.

visit

public com.microsoft.windowsazure.mobileservices.table.query.QueryNode visit(com.microsoft.windowsazure.mobileservices.table.query.BinaryOperatorNode node)

Visit a binary operator node.

Parameters:

node - The node to visit

Returns:

Defined by the implementer.

visit

public com.microsoft.windowsazure.mobileservices.table.query.QueryNode visit(com.microsoft.windowsazure.mobileservices.table.query.FunctionCallNode node)

Visit a function call node.

Parameters:

node - The node to visit

Returns:

Defined by the implementer.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
using System;
using System.Windows.Data;

namespace OzekiDemoSoftphoneWPF.GUI.Converters
{
    class ReverseBoolConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool val = (bool)value;
            return !val;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool val = (bool)value;
            return !val;
        }

        #endregion
    }
}


text:
import Vue from 'vue'

export default Vue.extend({
  name: 'sizeable',

  props: {
    large: Boolean,
    medium: Boolean,
    size: {
      type: [Number, String]
    },
    small: Boolean,
    xLarge: Boolean
  }
})


text:
package gestionDeBibliotecas;

public enum TipoPrestamo {
	DIARIO, SEMANAL, MENSUAL

}


text:
class CreateItems < ActiveRecord::Migration
  def change
    create_table :items do |t|
      t.string :title
      t.text :description
      t.text :slug

      t.timestamps
    end
  end
end


text:
package storage

import (
	"testing"

	. "github.com/bborbe/assert"
)

func TestImplementsStorage(t *testing.T) {
	r := New(nil)
	var i *Storage
	err := AssertThat(r, Implements(i))
	if err != nil {
		t.Fatal(err)
	}
}


text:
if (typeof define !== 'function') {
  var define = require('amdefine')(module);
}

define(function(require) {

  var RendrView = require('rendr/shared/base/view');

  // Create a base view, for adding common extensions to our
  // application's views.
  return RendrView.extend({});

});


text:
'use strict'

const yaml = require('js-yaml')
const fs = require('fs')
const path = require('path')
const _ = require('halcyon')

const config = {
  /**
   * @property {string} Default location of binci.yml config file
   */
  defaultPath: `${process.cwd()}/binci.yml`,
  /**
   * Loads config from yaml, attempts to parse to object
   * @param {string} (configPath) Path to config file or use defaultPath
   * @returns {object}
   */
  load: (configPath = config.defaultPath) => {
    try {
      fs.statSync(configPath)
    } catch (err) {
      throw new Error([
        `No config found at ${configPath}.`,
        'Please run `binci init` to create a binci.yml file or specify one with the `-c` flag.'
      ].join(' '))
    }

    let cfg
    try {
      cfg = yaml.safeLoad(fs.readFileSync(configPath, 'utf8'))
    } catch (e) {
      const relPath = path.relative(process.cwd(), configPath)
      const error = new Error(`Please fix the errors in ${relPath}`)
      error.message = error.message + `:\n\n${e.message}`
      throw error
    }
    return config.validate(cfg)
  },
  /**
   * Filters out empty config properties
   * @param {object} cfg
   * @returns {object}
   */
  validate: (cfg) => _.pipe([
    _.toPairs,
    _.reject(([key, val]) => !_.contains(key, ['tasks']) && _.isEmpty(val) || _.isNil(val)),
    _.fromPairs
  ])(cfg)
}

module.exports = config


text:
<?php

/* SyliusWebBundle:Backend/ShippingMethod:index.html.twig */
class __TwigTemplate_c59996dd135183a7e4359eef609174e716a8754a1673d2968c29c66cc6596dc2 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("SyliusWebBundle:Backend:layout.html.twig");

        $this->blocks = array(
            'topbar' => array($this, 'block_topbar'),
            'content' => array($this, 'block_content'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "SyliusWebBundle:Backend:layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 3
        $context["buttons"] = $this->env->loadTemplate("SyliusResourceBundle:Macros:buttons.html.twig");
        // line 4
        $context["__internal_0f322234b4eaded336c1cb0a4c3012a69b6e8880bd22375d1a2568bb7aba252b"] = $this->env->loadTemplate("SyliusWebBundle:Backend/Macros:misc.html.twig");
        // line 5
        $context["__internal_110241d3f2d722ce98a914abfd2389bf8ed7bf188e0732ba45e76e2edc1764ef"] = $this->env->loadTemplate("SyliusWebBundle:Backend/ShippingMethod:macros.html.twig");
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 7
    public function block_topbar($context, array $blocks = array())
    {
        // line 8
        echo "

";
        // line 9
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("sylius.breadcrumb.configuration"), "html", null, true);
        echo "

";
        // line 10
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("sylius.breadcrumb.shipping_method.index"), "html", null, true);
        echo "

";
    }

    // line 14
    public function block_content($context, array $blocks = array())
    {
        // line 15
        echo "

        ";
        // line 17
        echo $context["buttons"]->getcreate($this->env->getExtension('routing')->getPath("sylius_backend_shipping_method_create"), $this->env->getExtension('translator')->trans("sylius.shipping_method.create"));
        echo "
        ";
        // line 18
        echo $context["buttons"]->getmanage($this->env->getExtension('routing')->getPath("sylius_backend_shipping_category_index"), $this->env->getExtension('translator')->trans("sylius.shipping_category.manage"));
        echo "

 ";
        // line 20
        echo $this->env->getExtension('translator')->trans("sylius.shipping_method.index_header");
        echo "

";
        // line 23
        echo $context["__internal_0f322234b4eaded336c1cb0a4c3012a69b6e8880bd22375d1a2568bb7aba252b"]->getpagination((isset($context["shipping_methods"]) ? $context["shipping_methods"] : $this->getContext($context, "shipping_methods")));
        echo "
";
        // line 24
        echo $context["__internal_110241d3f2d722ce98a914abfd2389bf8ed7bf188e0732ba45e76e2edc1764ef"]->getlist((isset($context["shipping_methods"]) ? $context["shipping_methods"] : $this->getContext($context, "shipping_methods")));
        echo "
";
        // line 25
        echo $context["__internal_0f322234b4eaded336c1cb0a4c3012a69b6e8880bd22375d1a2568bb7aba252b"]->getpagination((isset($context["shipping_methods"]) ? $context["shipping_methods"] : $this->getContext($context, "shipping_methods")));
        echo "

";
    }

    public function getTemplateName()
    {
        return "SyliusWebBundle:Backend/ShippingMethod:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  82 => 25,  78 => 24,  74 => 23,  68 => 20,  63 => 18,  59 => 17,  55 => 15,  52 => 14,  45 => 10,  41 => 9,  38 => 8,  35 => 7,  30 => 5,  28 => 4,  26 => 3,);
    }
}


text:
var $$_asNumber = function($object, $finite, $hex)
{
    // FORMAT $finite
    $finite = $finite !== undefined ?
              $$_asBoolean($finite) :
              false;

    // Get the internal type of the object
    var $typeof = typeof $object;

    // If the object is not a number primitive
    if ($typeof != 'number')
    {
        // Get the object type
        var $type = $object == null ?
                    $object + '' :
                    $typeof == 'boolean' || $typeof == 'function' || $typeof == 'string' || $typeof == 'symbol' ?
                    $typeof :
                    $_types[$__toString__.call($object)] || 'object';

        // If the object is a string
        if ($type == 'string')
        {
            // If the string is not a primitive, get the primitive value of the string
            if ($typeof != 'string')
                $object = $__string_valueOf__.call($object);

            // Trim the string
            $object = $object.trim();

            // If the string does not match a floating-point numeric string
            if (!$_const_regexp_number.test($object))
            {
                // FORMAT $hex
                $hex = $hex !== undefined ?
                       $$_asBoolean($hex) :
                       false;

                // If the string does not match a hexadecimal numeric string, return NaN (unless forced to be finite)
                if (!$hex || !$_const_regexp_number_hex.test($object))
                    return $finite ? 0 : $__NaN__;

                // Convert the string to a floating-point number
                $object = $__parseInt($object, 16);
            }
            // Convert the string to a floating-point number
            else
                $object = $__parseFloat($object);
        }
        // If the object is a boolean
        else if ($type == 'boolean')
        {
            // If the boolean is not a primitive, get the primitive value of the boolean
            if ($typeof != 'boolean')
                $object = $__boolean_valueOf__.call($object);

            // Convert the boolean to a number
            $object = $object ? 1 : 0;
        }
        // If the object is a number, get the primitive value of the number
        else if ($type == 'number')
            $object = $__number_valueOf__.call($object);
        // Return NaN (unless forced to be finite)
        else
            return $finite ? 0 : $__NaN__;
    }

    // If the finite flag is not set, return the object
    if (!$finite)
        return $object;

    // If the object is not a number, return zero
    if ($__isNaN($object))
        return 0;

    // If the object is greater than the maximum value, return the maximum value
    if ($object > $_const_float_max)
        return $_const_float_max;

    // If the object is less than the minimum value, return the minimum value
    if ($object < $_const_float_min)
        return $_const_float_min;

    // Return the object
    return $object;
};

$_defineMethod('asNumber', $$_asNumber);
$_defineMethod('asFloat',  $$_asNumber);


text:
package io.erva.sample;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

public class DividerItemDecoration extends RecyclerView.ItemDecoration {

    private Drawable divider;

    public DividerItemDecoration(Context context) {
        final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.listDivider});
        divider = a.getDrawable(0);
        a.recycle();
    }

    public DividerItemDecoration(Drawable divider) {
        this.divider = divider;
    }

    public DividerItemDecoration(Context context, @DrawableRes int drawableId) {
        divider = ResourcesCompat.getDrawable(context.getResources(), drawableId, null);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        if (divider == null) return;
        if (parent.getChildAdapterPosition(view) < 1) return;

        if (getOrientation(parent) == LinearLayoutManager.VERTICAL)
            outRect.top = divider.getIntrinsicHeight();
        else outRect.left = divider.getIntrinsicWidth();
    }

    @Override
    public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
        if (divider == null) {
            super.onDrawOver(c, parent, state);
            return;
        }

        if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
            final int left = parent.getPaddingLeft();
            final int right = parent.getWidth() - parent.getPaddingRight();
            final int childCount = parent.getChildCount();

            for (int i = 1; i < childCount; i++) {
                final View child = parent.getChildAt(i);
                final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
                final int size = divider.getIntrinsicHeight();
                final int top = child.getTop() - params.topMargin;
                final int bottom = top + size;
                divider.setBounds(left, top, right, bottom);
                divider.draw(c);
            }
        } else { //horizontal
            final int top = parent.getPaddingTop();
            final int bottom = parent.getHeight() - parent.getPaddingBottom();
            final int childCount = parent.getChildCount();

            for (int i = 1; i < childCount; i++) {
                final View child = parent.getChildAt(i);
                final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
                final int size = divider.getIntrinsicWidth();
                final int left = child.getLeft() - params.leftMargin;
                final int right = left + size;
                divider.setBounds(left, top, right, bottom);
                divider.draw(c);
            }
        }
    }

    private int getOrientation(RecyclerView parent) {
        if (parent.getLayoutManager() instanceof LinearLayoutManager) {
            LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager();
            return layoutManager.getOrientation();
        } else
            throw new IllegalStateException("DividerItemDecoration can only be used with a LinearLayoutManager.");
    }
}


text:
class SamplePolicy < ApplicationPolicy

  # For index
  class Scope < Scope
    def resolve
      if (user.superadmin? || user.admin? || user.seller?)
        scope.all
      else
        nil
      end
    end
  end

  def show?
    user.superadmin? || user.admin? || user.seller?
  end

  def create?
    user.superadmin? || user.admin?
  end

  def new?
    create?
  end

  def edit?
    user.superadmin? || user.admin?
  end

  def update?
    user.superadmin? || user.admin?
  end

  def destroy?
    user.superadmin? || user.admin?
  end
end


text:
<?xml version="1.0" encoding="UTF-8" ?>
<module>
	<name>compatibility</name>
	<displayName><![CDATA[Compatibility]]></displayName>
	<version><![CDATA[1]]></version>
	<description><![CDATA[Module de compatibilié entres produits]]></description>
	<author><![CDATA[Ismail Aydogmus, Johan Salin]]></author>
	<tab><![CDATA[compat]]></tab>
	<is_configurable>1</is_configurable>
	<need_instance>0</need_instance>
	<limited_countries></limited_countries>
</module>


text: export { ArrowDown20 as default } from "../../";


text:
<?php

namespace Magento\Eav\Model\Entity\Increment;

interface IncrementInterface
{
    /**
     * Get next id
     *
     * @return mixed
     */
    public function getNextId();
}


text:
<!--
id: 5671702
link: http://tumblr.atmos.org/post/5671702/from-devin-arsenio-hall-had-some-down-ass-emcees
slug: from-devin-arsenio-hall-had-some-down-ass-emcees
date: Fri Jul 13 2007 09:07:46 GMT-0700 (PDT)
publish: 2007-07-013
tags:
title: From Devin, Arsenio Hall had some down ass emcees at his last show.
-->

From Devin, Arsenio Hall had some down ass emcees at his last show.
===================================================================


text:
package ru.stqa.pft.addressbook.tests;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.model.ContactData;
import ru.stqa.pft.addressbook.model.GroupData;

import java.util.List;

/**
 * Created by Alexander on 09.07.2016.
 */
public class HbConnectionTest {

    private SessionFactory sessionFactory;

    @BeforeTest
    protected void setUp() throws Exception {
        // A SessionFactory is set up once for an application!
        final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
                .configure() // configures settings from hibernate.cfg.xml
                .build();
        try {
            sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();
        }
        catch (Exception e) {
            // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
            // so destroy it manually.
            e.printStackTrace();
            StandardServiceRegistryBuilder.destroy( registry );

        }
    }

    @Test
    public void testHbConnection() {
        Session session = sessionFactory.openSession();
        session.beginTransaction();
        List<ContactData> contacts = session.createQuery( "from ContactData where deprecated = '0000-00-00'" ).list();
        //List<GroupData> groups = session.createQuery( "from GroupData" ).list();
        for ( ContactData contact : contacts ) {
            //System.out.println(contact);
            System.out.println(contact.getGroups());
        }
        session.getTransaction().commit();
        session.close();
    }

}


text:
/****************************************************
  This module was originally from Particle Universe
  Repo: https://github.com/scrawl/particleuniverse
  License: MIT
****************************************************/

#ifndef FxTokensParser_h__
#define FxTokensParser_h__

#include "K2Prerequisites.h"

#include "ParticleEmitter.h"
#include "BillboardRender.h"

namespace Demi
{
    class DEMI_K2_API DiFxTokensParser
    {
    public:

        DiFxTokensParser();

        ~DiFxTokensParser();

        static DiFxTokensParser* Get() { return sParser;  }

    public:

        /// write one particle system
        void    WriteSystem(DiParticleSystemPtr val, const DiString& filePath);

        void    WriteSystems(DiVector<DiParticleSystemPtr>& val, const DiString& filePath);

        DiVector<DiParticleSystemPtr>  LoadEffects(const DiString& file);

        DiVector<DiParticleSystemPtr>  LoadEffects(DiDataStreamPtr ds);

    public:

        void    WriteSystem(DiParticleSystemPtr val, DiXMLElement& node);

        void    WriteElement(DiParticleElement* val, DiXMLElement& node);

        DiParticleElement*   ReadElement(DiParticleSystemPtr val, DiXMLElement& node);

        DiParticleSystemPtr  ReadSystem(DiXMLElement& node);

    public:

        void    WriteRenderer(DiParticleRenderer* val, DiXMLElement& node);

        void    WriteBillboardRenderer(DiBillboardRenderer* val, DiXMLElement& node);

        DiParticleRenderer*    ReadRenderer(DiParticleElement* val, DiXMLElement& node);

        void    ReadBillboardRenderer(DiBillboardRenderer* val, DiXMLElement& node);

    public:

        void    WriteBaseEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    ReadBaseEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    WriteBoxEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    ReadBoxEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    WriteCircleEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    ReadCircleEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    WriteLineEmitter(DiParticleEmitter* val, DiXMLElement& node);

        void    ReadLineEmitter(DiParticleEmitter* val, DiXMLElement& node);

        DiParticleEmitter*  ReadEmitter(DiParticleElement* val, DiXMLElement& node);

    public:

        void    WriteBaseController(DiParticleController* val, DiXMLElement& node);

        void    ReadBaseController(DiParticleController* val, DiXMLElement& node);

        void    WriteBaseForceController(DiParticleController* val, DiXMLElement& node);

        void    ReadBaseForceController(DiParticleController* val, DiXMLElement& node);

        void    WriteLinearForceController(DiParticleController* val, DiXMLElement& node);

        void    ReadLinearForceController(DiParticleController* val, DiXMLElement& node);

        void    WriteSinForceController(DiParticleController* val, DiXMLElement& node);

        void    ReadSinForceController(DiParticleController* val, DiXMLElement& node);

        void    WriteGravityController(DiParticleController* val, DiXMLElement& node);

        void    ReadGravityController(DiParticleController* val, DiXMLElement& node);

        void    WriteJetController(DiParticleController* val, DiXMLElement& node);

        void    ReadJetController(DiParticleController* val, DiXMLElement& node);

        void    WriteRandomiserController(DiParticleController* val, DiXMLElement& node);

        void    ReadRandomiserController(DiParticleController* val, DiXMLElement& node);

        void    WriteVortexController(DiParticleController* val, DiXMLElement& node);

        void    ReadVortexController(DiParticleController* val, DiXMLElement& node);

        void    WriteTextureRotatorController(DiParticleController* val, DiXMLElement& node);

        void    ReadTextureRotatorController(DiParticleController* val, DiXMLElement& node);

        void    WriteBaseColliderController(DiParticleController* val, DiXMLElement& node);

        void    ReadBaseColliderController(DiParticleController* val, DiXMLElement& node);

        void    WritePlaneColliderController(DiParticleController* val, DiXMLElement& node);

        void    ReadPlaneColliderController(DiParticleController* val, DiXMLElement& node);

        void    WriteBoxColliderController(DiParticleController* val, DiXMLElement& node);

        void    ReadBoxColliderController(DiParticleController* val, DiXMLElement& node);

        void    WriteSphereColliderController(DiParticleController* val, DiXMLElement& node);

        void    ReadSphereColliderController(DiParticleController* val, DiXMLElement& node);

        void    WriteGeometryRotatorController(DiParticleController* val, DiXMLElement& node);

        void    ReadGeometryRotatorController(DiParticleController* val, DiXMLElement& node);

        void    WriteColorController(DiParticleController* val, DiXMLElement& node);

        void    ReadColorController(DiParticleController* val, DiXMLElement& node);

        void    WriteScaleController(DiParticleController* val, DiXMLElement& node);

        void    ReadScaleController(DiParticleController* val, DiXMLElement& node);

        DiParticleController* ReadController(DiParticleElement* val, DiXMLElement& node);

    protected:

        DiVector<DiFloatRect*>  ReadFloatRectVector(const DiString& val);

        DiString                WriteFloatRectVector(const DiVector<DiFloatRect*>& val);

    protected:

        static DiFxTokensParser*               sParser;

        DiMap<DiString, BillboardType>         sStrBillboardType;
        DiMap<BillboardType, DiString>         sBillboardTypeStr;

        DiMap<DiString, BillboardOrigin>       sStrBillboardOrigin;
        DiMap<BillboardOrigin, DiString>       sBillboardOriginStr;

        DiMap<DiString, BillboardRotationType> sStrBillboardRotationType;
        DiMap<BillboardRotationType, DiString> sBillboardRotationTypeStr;
    };
}

#endif // PointEmitter_h__


text:
import datetime

import pyparsing as pp
from pyparsing import ParseResults

"""
CWR fields grammar.

This stores grammar for parsing the CWR fields.

These fields are:
- Alphanumeric (A). Only allows non lowercase ASCII characters.
- Numeric field (N). Accepts integer or float values (these are handled as two
different fields).
- Boolean (B). Accepts 'Y' or 'N'.
- Flag (F). Accepts 'Y', 'N' or 'U'.
- Date (D). Accepts numbers in the pattern YYYYMMDD.
- Time (T). Accepts numbers in the pattern HHMMSS.

Each of these fields is parsed into a value as follows:
- Alphanumeric (A). String with no heading or trailing white spaces.
- Numeric field (N). Integer or float.
- Boolean (B). Boolean.
- Flag (F). String
- Date (D). datetime.date.
- Time (T). datetime.time.

Additionally, other fields used on the CWR files, but not defined as basic
fields, are included:
- Blank. A line composed only of whitespaces.
"""

__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'

# BASIC FIELDS

"""
Alphanumeric (A) field.

Only non lowercase ASCII values are allowed.

The string contained in this field is parsed into a string with no heading or
trailing white spaces.
"""

def alphanum(columns, name=None, extended=False, isLast=False):
    """
    Creates the grammar for an Alphanumeric (A) field, accepting only the
    specified number of characters.

    By default Alphanumeric fields accept only ASCII characters, excluding
    lowercases. If the extended flag is set to True, then non-ASCII characters
    are allowed, but the no ASCII lowercase constraint is kept.

    This can be a compulsory field, in which case the empty string is
    disallowed.

    The text will be stripped of heading and trailing whitespaces.

    :param columns: number of columns for this field
    :param name: name for the field
    :param extended: indicates if this is the exceptional case where non-ASCII
    are allowed
    :return: grammar for this Alphanumeric field
    """

    if name is None:
        name = 'Alphanumeric Field'

    if columns < 0:
        # Can't be empty or have negative size
        raise BaseException()

    if isLast:
        columns = str('1,' + str(columns))

    # Checks if non-ASCII characters are allowed
    if not extended:
        # The regular expression just forbids lowercase characters
        field = pp.Regex('([\x00-\x60]|[\x7B-\x7F]){' + str(columns) + '}')
    else:
        # The regular expression forbids lowercase characters but allows
        # non-ASCII characters
        field = pp.Regex('([\x00-\x09]|[\x0E-\x60]|[\x7B-\x7F]|[^\x00-\x7F]){' +
                         str(columns) + '}')

    # Parse action
    field.setParseAction(lambda s: s[0].strip())

    # Compulsory field validation action
    if columns:
        field.addParseAction(lambda s: _check_not_empty(s[0]))

    # White spaces are not removed
    field.leaveWhitespace()

    # Name
    field.setName(name)

    return field

def _check_not_empty(string):
    """
    Checks that the string is not empty.

    If it is empty an exception is raised, stopping the validation.

    This is used for compulsory alphanumeric fields.

    :param string: the field value
    """
    string = string.strip()

    if len(string) == 0:
        message = 'The string should not be empty'
        raise pp.ParseException(message)

"""
Numeric (N) field, integer type.

Only integers are allowed, and the string from the field will be parsed into
an integer.

For the Numeric field allowing float values check the numeric_float method.
"""

def numeric(columns, name=None):
    """
    Creates the grammar for a Numeric (N) field, accepting only the specified
    number of characters.

    This version only allows integers.

    :param columns: number of columns for this field
    :param name: name for the field
    :return: grammar for the integer numeric field
    """

    if name is None:
        name = 'Numeric Field'

    if columns <= 0:
        # Can't be empty or have negative size
        raise BaseException()

    # Only numbers are accepted
    field = pp.Regex('[0-9]{' + str(columns) + '}')

    # Parse action
    field.setParseAction(_to_int)
    field.leaveWhitespace()

    # Name
    field.setName(name)

    return field

def _to_int(parsed):
    """
    Transforms the received parsed value into an integer.

    :param parsed: the parsed value
    :return: an integer created from the value
    """
    if len(parsed) > 0:
        return int(parsed[0])
    else:
        return None

"""
Numeric (N) field, float type.

Only float values are allowed, and the string from the field will be parsed
into a float.

For the Numeric field allowing integer values check the numeric method.
"""

def numeric_float(columns, nums_int, name=None):
    """
    Creates the grammar for a Numeric (N) field, accepting only the specified
    number of characters.

    This version only allows floats.

    As nothing in the string itself indicates how many of the characters are
    for the integer and the decimal sections, this should be specified with
    the nums_int parameter.

    This will indicate the number of characters, starting from the left, to be
    used for the integer value. All the remaining ones will be used for the
    decimal value.

    :param columns: number of columns for this field
    :param name: name for the field
    :param nums_int: characters, counting from the left, for the integer value
    :return: grammar for the float numeric field
    """

    if name is None:
        name = 'Numeric Field'

    if columns <= 0:
        # Can't be empty or have negative size
        raise BaseException('Number of columns should be positive')

    if nums_int < 0:
        # Integer columns can't have negative size
        raise BaseException('Number of integer values should be positive or '
                            'zero')

    if columns < nums_int:
        # There are more integer numbers than columns
        message = 'The number of columns is %s and should be higher or ' \
                  'equal than the integers: %s' % (
                      columns, nums_int)
        raise BaseException(message)

    # Basic field
    field = pp.Word(pp.nums, exact=columns)

    # Parse action
    field.setParseAction(lambda n: _to_numeric_float(n[0], nums_int))

    # Compulsory field validation action
    field.addParseAction(lambda s: _check_above_value_float(s[0], 0))

    # Name
    field.setName(name)

    return field

def _to_numeric_float(number, nums_int):
    """
    Transforms a string into a float.

    The nums_int parameter indicates the number of characters, starting from
    the left, to be used for the integer value. All the remaining ones will be
    used for the decimal value.

    :param number: string with the number
    :param nums_int: characters, counting from the left, for the integer value
    :return: a float created from the string
    """
    index_end = len(number) - nums_int
    return float(number[:nums_int] + '.' + number[-index_end:])

def _check_above_value_float(string, minimum):
    """
    Checks that the number parsed from the string is above a minimum.

    This is used on compulsory numeric fields.

    If the value is not above the minimum an exception is thrown.

    :param string: the field value
    :param minimum: minimum value
    """
    value = float(string)

    if value < minimum:
        message = 'The Numeric Field value should be above %s' % minimum
        raise pp.ParseException(message)

"""
Boolean field (B).

Must be 'Y', for yes/true or 'N' for no/false.

This value will be parsed into a boolean type value.
"""

def boolean(name=None):
    """
    Creates the grammar for a Boolean (B) field, accepting only 'Y' or 'N'

    :param name: name for the field
    :return: grammar for the flag field
    """

    if name is None:
        name = 'Boolean Field'

    # Basic field
    field = pp.Regex('[YN]')

    # Parse action
    field.setParseAction(lambda b: _to_boolean(b[0]))

    # Name
    field.setName(name)

    return field

def _to_boolean(string):
    """
    Transforms a string into a boolean value.

    If a value which is not 'Y' or 'N' is received, a ParseException is thrown.

    :param: string: the string to transform
    :return: True if the string is 'Y', False if it is 'N'
    """

    if string == 'Y':
        result = True
    elif string == 'N':
        result = False
    else:
        raise pp.ParseException(string, msg='Is not a valid boolean value')

    return result

"""
Flag field (F).

Must be 'Y', for yes/true, 'N' for no/false or 'U' for unknown.

This string value will be just returned untouched.
"""

def flag(name=None):
    """
    Creates the grammar for a Flag (F) field, accepting only 'Y', 'N' or 'U'.

    :param name: name for the field
    :return: grammar for the flag field
    """

    if name is None:
        name = 'Flag Field'

    # Basic field
    field = pp.Regex('[YNU]')

    # Name
    field.setName(name)

    field.leaveWhitespace()

    return field

"""
Date field (D).

Date follows the pattern YYYYMMDD, with the following constraints:
- YYYY: from 0001 to 9999
- MM: from 01 to 12
- DD: from 01 to 31

This string will be parsed into a datetime.date.
"""

def date(name=None):
    """
    Creates the grammar for a Date (D) field, accepting only numbers in a
    certain pattern.

    :param name: name for the field
    :return: grammar for the date field
    """

    if name is None:
        name = 'Date Field'

    # Basic field
    # This regex allows values from 00000101 to 99991231
    field = pp.Regex('[0-9][0-9][0-9][0-9](0[1-9]|1[0-2])'
                     '(0[1-9]|[1-2][0-9]|3[0-1])')

    # Parse action
    field.setParseAction(lambda d: datetime.datetime.strptime(d[0], '%Y%m%d')
                         .date())

    # Name
    field.setName(name)

    # White spaces are not removed
    field.leaveWhitespace()

    return field

"""
Time field (T).

Time follows the pattern HHMMSS, with the following constraints:
- HH: from 00 to 23
- MM: from 00 to 59
- SS: from 00 to 59

This string will be parsed into a datetime.time.
"""

def time(name=None):
    """
    Creates the grammar for a Time or Duration (T) field, accepting only
    numbers in a certain pattern.

    :param name: name for the field
    :return: grammar for the date field
    """

    if name is None:
        name = 'Time Field'

    # Basic field
    # This regex allows values from 000000 to 235959
    field = pp.Regex('(0[0-9]|1[0-9]|2[0-3])[0-5][0-9][0-5][0-9]')

    # Parse action
    field.setParseAction(lambda t: datetime.datetime.strptime(t[0], '%H%M%S')
                         .time())

    # White spaces are not removed
    field.leaveWhitespace()

    # Name
    field.setName(name)

    return field

"""
Lookup field (L).

This accepts only values from a table or list.
"""

def lookup(values, name=None):
    """
    Creates the grammar for a Lookup (L) field, accepting only values from a
    list.

    Like in the Alphanumeric field, the result will be stripped of all heading
    and trailing whitespaces.

    :param values: values allowed
    :param name: name for the field
    :return: grammar for the lookup field
    """
    if name is None:
        name = 'Lookup Field'

    if values is None:
        raise ValueError('The values can no be None')

    # TODO: This should not be needed, it is just a patch. Fix this.
    try:
        v = values.asList()
        values = v
    except AttributeError:
        values = values

    # Only the specified values are allowed
    lookup_field = pp.oneOf(values)

    lookup_field.setName(name)

    lookup_field.setParseAction(lambda s: s[0].strip())

    lookup_field.leaveWhitespace()

    return lookup_field

"""
Blank field.

This accepts only a line composed of whitespaces.
"""

def blank(columns=1, name=None):
    """
    Creates the grammar for a blank field.

    These are for constant empty strings which should be ignored, as they are
    used just as fillers.

    :param columns: number of columns, which is the required number of
    whitespaces
    :param name: name for the field
    :return: grammar for the blank field
    """
    if name is None:
        name = 'Blank Field'

    field = pp.Regex('[ ]{' + str(columns) + '}')
    field.leaveWhitespace()
    field.suppress()

    field.setName(name)

    return field


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Elasticsearch.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Nest.Resolvers.Converters;
using System.Linq.Expressions;
using Nest.Resolvers;

namespace Nest
{
	public partial class UnregisterPercolatorDescriptor
		: IndexNamePathDescriptor<UnregisterPercolatorDescriptor, DeleteRequestParameters>
		, IPathInfo<DeleteRequestParameters>
	{
		ElasticsearchPathInfo<DeleteRequestParameters> IPathInfo<DeleteRequestParameters>.ToPathInfo(IConnectionSettingsValues settings)
		{
			//deleting a percolator in elasticsearch < 1.0 is actually deleting a document in a
			//special _percolator index where the passed index is actually a type
			//the name is actually the id, we rectify that here

			var pathInfo = base.ToPathInfo<DeleteRequestParameters>(settings, new DeleteRequestParameters());
			pathInfo.Index = pathInfo.Index;
			pathInfo.Id = pathInfo.Name;
			pathInfo.Type = ".percolator";
			pathInfo.HttpMethod = PathInfoHttpMethod.DELETE;

			return pathInfo;
		}
	}
}


text:
Object Oriented Programming Assignment 2: Make a Game

# C15737505

For this assignement we were tasked with making a game using the various skills we have learned over the past semester. These include:
 - Classes
 - Inheritance
 - Polymorphism
 - Abstract Classes
 - Interfaces
 - Vectors

## Basic Controls
The user can use the mosue to click the various menu buttons to navigate. When playing the game the following controls are used:
 - Up (to Fire jet pack), Left, Right to move the player
 - Space to fire upward

Once the player dies the game is over and the score is displayed. The player has the option of pressing 'W' to write their score to a file, which will then be read,sorted and displayed on the LeaderBoard page.

## Core Gameplay
The gameplay is based on a combination of space invaders and flappy bird. The player must shoot up to kill the enemies while jumping/flying over incoming obstacles from the right.
The are two types of powerups. One increases the players health to 200, and the other slows down the enemy and pipes movement.

## Music/Sound FX and Animation
The game uses the audio library minim to load and play .mp3 files. A variety of sound effects are applied to the player and enemies. For example, when the up key is pressed, the player's Y axis decreases, this triggers a jet pack sound while the players animation changes. The animation is done by storing different PImages in an array. A animation mode variable stores the index of array. This is changed depending on what movement the player is doing.

For the main music, I used an online 8 bit sound generate to create a simple beat and melody. This is loaded and played at the start of the the program. When the player hits the slowDown power up, the main music is stopped and a slowed down version of the same track is played for the duration of the power up effect.

## Video

 ![Video](http://img.youtube.com/vi/tu1Nzzgk20I/0.jpg)](http://www.youtube.com/watch?v=tu1Nzzgk20I)