text:
import $ from 'jquery';
import app from '../app';
import {
  formatCurrency,
  convertAndFormatCurrency,
  convertCurrency,
  formatPrice,
  getCurrencyValidity,
  getExchangeRate,
  renderFormattedCurrency,
  renderPairedCurrency,
} from './currency';
import {
  getServerCurrency,
  getBlockChainTxUrl,
  getBlockChainAddressUrl,
  getCurrencyByCode as getCryptoCurByCode,
} from '../data/cryptoCurrencies';
import {
  renderCryptoIcon,
  renderCryptoTradingPair,
  renderCryptoPrice,
} from '../utils/crypto';
import {
  isHiRez, isLargeWidth, isSmallHeight, getAvatarBgImage, getListingBgImage,
} from './responsive';
import { upToFixed } from './number';
import twemoji from 'twemoji';
import { splitIntoRows, abbrNum } from './';
import { tagsDelimiter } from '../utils/lib/selectize';
import is from 'is_js';

export function polyT(...args) {
  return app.polyglot.t(...args);
}

export function parseEmojis(text, className = '', attrs = {}) {
  const parsed = twemoji.parse(text,
    icon => (`../imgs/emojis/72X72/${icon}.png`));
  const $parsed = $(`<div>${parsed}</div>`);

  $parsed.find('img')
    .each((index, img) => {
      const $img = $(img);
      $img.addClass(`emoji ${className}`);

      Object.keys(attrs)
        .forEach(attr => {
          $img.attr(attr, attrs[attr]);
        });
    });

  return $parsed.html();
}

/**
 * If the average is a number, show the last 2 digits and trim any trailing zeroes.
 * @param {number} average - the average rating
 * @param {number} count - the number of ratings
 * @param {boolean) skipCount - a count wasn't sent, don't show it or test it for validity
 */
export function formatRating(average, count, skipCount) {
  const avIsNum = typeof average === 'number';
  const countIsNum = typeof count === 'number';
  const ratingAverage = avIsNum ? average.toFixed(1) : '?';
  let ratingCount = countIsNum ? ` (${abbrNum(count)})` : ' (?)';
  if (skipCount) ratingCount = '';
  const error = !avIsNum || (!countIsNum && !skipCount) ?
    ' <i class="ion-alert-circled clrTErr"></i>' : '';
  return `${parseEmojis('⭐')} ${ratingAverage}${ratingCount}${error}`;
}

export const getServerUrl = app.getServerUrl.bind(app);

const currencyExport = {
  formatPrice,
  formatCurrency,
  convertAndFormatCurrency,
  convertCurrency,
  getCurrencyValidity,
  getServerCurrency,
  getCryptoCurByCode,
  getExchangeRate,
  formattedCurrency: renderFormattedCurrency,
  pairedCurrency: renderPairedCurrency,
  getBlockChainTxUrl,
  getBlockChainAddressUrl,
};

const crypto = {
  cryptoIcon: renderCryptoIcon,
  tradingPair: renderCryptoTradingPair,
  cryptoPrice: renderCryptoPrice,
};

export {
  currencyExport as currencyMod,
  crypto,
  isHiRez,
  isLargeWidth,
  isSmallHeight,
  getAvatarBgImage,
  getListingBgImage,
  upToFixed,
  splitIntoRows,
  is,
  tagsDelimiter,
};


text:
import subprocess
import itertools

class SerialFinder():
    _command = """ls -al /sys/class/tty/ttyUSB* | grep -o "/sys/class/tty/ttyUSB.*"| sed 's/ -> .*//'"""
    _replace = "/sys/class/tty"
    _replaceWith = "/dev"

    def Find(self):
        proc = subprocess.Popen([self._command], stdout=subprocess.PIPE, shell=True)
        (out, _) = proc.communicate()

        if len(out) < 2:
            return []

        return self.__split(out)

    def __groupSeparator(self, line):
        return line=='\n'

    def __split(self, data):
        lines = []
        for _, group in itertools.groupby(data, self.__groupSeparator):
            line = ''.join(str(e) for e in group)
            line = line.strip()
            if (len(line) > 1):
                lines.append(line.replace(self._replace, self._replaceWith))
        return lines

redpajama_set_name: RedPajamaGithub


text:
var baseSetData = require('./_baseSetData'),
    shortOut = require('./_shortOut');

/**
 * Sets metadata for `func`.
 *
 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
 * period of time, it will trip its breaker and transition to an identity
 * function to avoid garbage collection pauses in V8. See
 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
 * for more details.
 *
 * @private
 * @param {Function} func The function to associate metadata with.
 * @param {*} data The metadata.
 * @returns {Function} Returns `func`.
 */
var setData = shortOut(baseSetData);

module.exports = setData;


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>HobbyHub</title>
        <link rel="stylesheet" href="/css/pure-min.css">
        <link rel="stylesheet" href="/css/custom.css">

Hobby Hub

logged in as Farah

<button type="button" class="pure-button" id="menu-toggle">Menu</button>

Food

Featured Foods

Restaurant of the week!

Top Restaurants

Categories

Audiobooks

Featured Books

Book of the month!

Search your Book

Categories

Games

Featured Games

Games of the month!

Trending Gameplays

Categories

                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal

                      Merkal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal
                      Mrigal

                      Mrigal
                      Mrigal
                      Mrigal
                      Megal
                      Mrigal
                      Mrigal
                      Mrigal

Featured AudioBooks

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details

Mirka teh Mrigal mach

              Points: No need to review Mirka

              Performance: No need to review Mirka

              Fan base: No need to review Mirka

              Hype: No need to review Mirka

              Mrigalness: No need to review Mirka

            Details


text:
class Connection(object):
    def __init__(self, ip, port, idhash=0):
        self.ip = id
        self.port = port
        self.idhash = idhash
        self.localpacketcount = 0
        self.remotepacketcount = 0
        self.receivedPackets = []
        self.goodrtt = True

    def buildDatagram(protocol):
        datagram = PyDatagram()
        datagram.addUint8(protocol)
        datagram.addUint8(self.packetcount)
        datagram.addUint8(self.packetcount)//ack
        datagram.addUint16(self.packetcount)//ack32
        datagram.addUint16(self.idhash)
        self.packetcount += 1
        if self.packetcount > 255:
            self.packetcount = 0
        return datagram

    def sequenceMoreRecent(s1, s2, maxSequence):
        //Used to determine if wrap around sequence is part of the next packetcount, ie 254, 255, 0, 1
        //returns bool
        return (s1 > s2) and (s1 - s2 <= maxSequence/2) || (s2 > s1) and (s2-s1 > maxSequence/2)

class ServerConnection(Connection):
    //Representation of a server on the client
    def login(username, hashpassword):
        datagram = self.buildDatagram(100)
        datagram.addString(username)
        datagram.addString(hashpassword)
        return datagram


text:
package org.apache.accumulo.proxy;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;

import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.proxy.thrift.ColumnUpdate;
import org.apache.accumulo.proxy.thrift.TimeType;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class TestProxyTableOperations {

  protected static TServer proxy;
  protected static Thread thread;
  protected static TestProxyClient tpc;
  protected static ByteBuffer userpass;
  protected static final int port = 10195;
  protected static final String testtable = "testtable";

  @SuppressWarnings("serial")
  @BeforeClass
  public static void setup() throws Exception {
    Properties prop = new Properties();
    prop.setProperty("useMockInstance", "true");
    prop.put("tokenClass", PasswordToken.class.getName());

    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"), Class.forName("org.apache.accumulo.proxy.ProxyServer"),
        port, TCompactProtocol.Factory.class, prop);
    thread = new Thread() {
      @Override
      public void run() {
        proxy.serve();
      }
    };
    thread.start();
    tpc = new TestProxyClient("localhost", port);
    userpass = tpc.proxy().login("root", new TreeMap<String,String>() {
      {
        put("password", "");
      }
    });
  }

  @AfterClass
  public static void tearDown() throws InterruptedException {
    proxy.stop();
    thread.join();
  }

  @Before
  public void makeTestTable() throws Exception {
    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
  }

  @After
  public void deleteTestTable() throws Exception {
    tpc.proxy().deleteTable(userpass, testtable);
  }

  @Test
  public void createExistsDelete() throws TException {
    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
    tpc.proxy().createTable(userpass, "testtable2", true, TimeType.MILLIS);
    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
    tpc.proxy().deleteTable(userpass, "testtable2");
    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
  }

  @Test
  public void listRename() throws TException {
    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
    tpc.proxy().renameTable(userpass, testtable, "testtable2");
    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
    tpc.proxy().renameTable(userpass, "testtable2", testtable);
    assertTrue(tpc.proxy().listTables(userpass).contains("testtable"));

  }

  // This test does not yet function because the backing Mock instance does not yet support merging
  @Test
  public void merge() throws TException {
    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
    splits.add(ByteBuffer.wrap("a".getBytes()));
    splits.add(ByteBuffer.wrap("c".getBytes()));
    splits.add(ByteBuffer.wrap("z".getBytes()));
    tpc.proxy().addSplits(userpass, testtable, splits);

    tpc.proxy().mergeTablets(userpass, testtable, ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("d".getBytes()));

    splits.remove(ByteBuffer.wrap("c".getBytes()));

    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);

    for (ByteBuffer split : tableSplits)
      assertTrue(splits.contains(split));
    assertTrue(tableSplits.size() == splits.size());

  }

  @Test
  public void splits() throws TException {
    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
    splits.add(ByteBuffer.wrap("a".getBytes()));
    splits.add(ByteBuffer.wrap("b".getBytes()));
    splits.add(ByteBuffer.wrap("z".getBytes()));
    tpc.proxy().addSplits(userpass, testtable, splits);

    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);

    for (ByteBuffer split : tableSplits)
      assertTrue(splits.contains(split));
    assertTrue(tableSplits.size() == splits.size());
  }

  @Test
  public void constraints() throws TException {
    int cid = tpc.proxy().addConstraint(userpass, testtable, "org.apache.accumulo.TestConstraint");
    Map<String,Integer> constraints = tpc.proxy().listConstraints(userpass, testtable);
    assertEquals((int) constraints.get("org.apache.accumulo.TestConstraint"), cid);
    tpc.proxy().removeConstraint(userpass, testtable, cid);
    constraints = tpc.proxy().listConstraints(userpass, testtable);
    assertNull(constraints.get("org.apache.accumulo.TestConstraint"));
  }

  @Test
  public void localityGroups() throws TException {
    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
    Set<String> group1 = new HashSet<String>();
    group1.add("cf1");
    groups.put("group1", group1);
    Set<String> group2 = new HashSet<String>();
    group2.add("cf2");
    group2.add("cf3");
    groups.put("group2", group2);
    tpc.proxy().setLocalityGroups(userpass, testtable, groups);

    Map<String,Set<String>> actualGroups = tpc.proxy().getLocalityGroups(userpass, testtable);

    assertEquals(groups.size(), actualGroups.size());
    for (String groupName : groups.keySet()) {
      assertTrue(actualGroups.containsKey(groupName));
      assertEquals(groups.get(groupName).size(), actualGroups.get(groupName).size());
      for (String cf : groups.get(groupName)) {
        assertTrue(actualGroups.get(groupName).contains(cf));
      }
    }
  }

  @Test
  public void tableProperties() throws TException {
    tpc.proxy().setTableProperty(userpass, testtable, "test.property1", "wharrrgarbl");
    assertEquals(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"), "wharrrgarbl");
    tpc.proxy().removeTableProperty(userpass, testtable, "test.property1");
    assertNull(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"));
  }

  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
    update.setValue(value.getBytes());
    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
  }

  @Test
  public void tableOperationsRowMethods() throws TException {
    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
    for (int i = 0; i < 10; i++) {
      addMutation(mutations, "" + i, "cf", "cq", "");
    }
    tpc.proxy().updateAndFlush(userpass, testtable, mutations);

    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("9".getBytes()));

    tpc.proxy().deleteRows(userpass, testtable, ByteBuffer.wrap("51".getBytes()), ByteBuffer.wrap("99".getBytes()));
    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("5".getBytes()));
  }

}


text:
package com.njackson.utils.time;

import java.util.Date;

/**
 * Created by njackson on 17/01/15.
 */
public class Time implements ITime {
    @Override
    public Date getCurrentDate() {
        return new Date();
    }

    @Override
    public long getCurrentTimeMilliseconds() {
        return new Date().getTime();
    }
}


text:
from google.cloud import talent_v4beta1
import six

def complete_query(project_id, tenant_id, query):
    """Complete job title given partial text (autocomplete)"""

    client = talent_v4beta1.CompletionClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # query = '[partially typed job title]'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(query, six.binary_type):
        query = query.decode("utf-8")

    parent = f"projects/{project_id}/tenants/{tenant_id}"

    request = talent_v4beta1.CompleteQueryRequest(
        parent=parent,
        query=query,
        page_size=5,  # limit for number of results
        language_codes=["en-US"],  # language code
    )
    response = client.complete_query(request=request)
    for result in response.completion_results:
        print(f"Suggested title: {result.suggestion}")
        # Suggestion type is JOB_TITLE or COMPANY_TITLE
        print(
            f"Suggestion type: {talent_v4beta1.CompleteQueryRequest.CompletionType(result.type_).name}"
        )

# [END job_search_autocomplete_job_title]


text:
using System;

class BitSwap
{
    public static void Main()
    {
        uint number = uint.Parse(Console.ReadLine());
        byte firstSequenceBegin = byte.Parse(Console.ReadLine());
        byte secondSequenceBegin = byte.Parse(Console.ReadLine());
        byte sequencesLength = byte.Parse(Console.ReadLine());
        uint mask, firstBit, secondBit;

        byte sequencesDifference;
        sbyte shiftDirection;

        if (firstSequenceBegin < secondSequenceBegin)
        {
            sequencesDifference = (byte)(secondSequenceBegin - firstSequenceBegin);
            shiftDirection = 1;
        }
        else
        {
            sequencesDifference = (byte)(firstSequenceBegin - secondSequenceBegin);
            shiftDirection = -1;
        }

        for (int i = firstSequenceBegin; i <= firstSequenceBegin + sequencesLength - 1; i++)
        {
            mask = 1;
            mask = mask << i;
            mask = mask & number;
            mask = mask >> i;
            firstBit = mask;

            mask = 1;
            mask = mask << i + (sequencesDifference * shiftDirection);
            mask = mask & number;
            mask = mask >> i + (sequencesDifference * shiftDirection);
            secondBit = mask;

            if (firstBit != secondBit)
            {
                mask = 1;
                mask = mask << i;
                if (secondBit == 1)
                {
                    number = mask | number;
                }
                else
                {
                    number = ~mask & number;
                }

                mask = 1;
                mask = mask << i + (sequencesDifference * shiftDirection);
                if (firstBit == 1)
                {
                    number = mask | number;
                }
                else
                {
                    number = ~mask & number;
                }
            }
        }

        Console.WriteLine(number);
    }
}


text:
<?php

namespace Components\Groups\Admin\Controllers;

use Components\Groups\Models\Import;
use Components\Groups\Models\Orm\Group;
use Hubzero\Component\AdminController;
use Hubzero\Content\Import\Model\Hook;
use Hubzero\Content\Importer;
use Hubzero\Config\Registry;
use Filesystem;
use Request;
use Config;
use Route;
use User;
use Date;
use Lang;
use App;

include_once dirname(dirname(__DIR__)) . '/models/orm/group.php';
include_once dirname(dirname(__DIR__)) . '/models/import.php';

/**
 * Member importer
 */
class Imports extends AdminController
{
	/**
	 * Determine task and execute it
	 *
	 * @return  void
	 */
	public function execute()
	{
		if (!User::authorise('core.admin', $this->_option))
		{
			Notify::warning(Lang::txt('Not authorized'));

			App::redirect(
				Route::url('index.php?option=com_members', false)
			);
		}

		Lang::load($this->_option . '.import', dirname(__DIR__));

		parent::execute();
	}

	/**
	 * Display imports
	 *
	 * @return  void
	 */
	public function displayTask()
	{
		// Get filters
		$filters = array(
			'limit' => Request::getState(
				$this->_option . '.' . $this->_controller . '.limit',
				'limit',
				Config::get('list_limit'),
				'int'
			),
			'start' => Request::getState(
				$this->_option . '.' . $this->_controller . '.limitstart',
				'limitstart',
				0,
				'int'
			),
			'state'    => array(1),
			'sort'       => Request::getState(
				$this->_option . '.' . $this->_controller . '.sort',
				'filter_order',
				'created_at'
			),
			'sort_Dir'   => Request::getState(
				$this->_option . '.' . $this->_controller . '.sortdir',
				'filter_order_Dir',
				'DESC'
			),
			'type'     => 'groups'
		);

		$model = Import::all();

		if (isset($filters['state']) && $filters['state'])
		{
			if (!is_array($filters['state']))
			{
				$filters['state'] = array($filters['state']);
			}
			$filters['state'] = array_map('intval', $filters['state']);

			$model->whereIn('state', $filters['state']);
		}

		if (isset($filters['type']) && $filters['type'])
		{
			$model->whereEquals('type', $filters['type']);
		}

		$imports = $model->ordered()
			->paginated('limitstart', 'limit')
			->rows();

		// Output the HTML
		$this->view
			->set('filters', $filters)
			->set('imports', $imports)
			->setLayout('display')
			->display();
	}

	/**
	 * Add an Import
	 *
	 * @return  void
	 */
	public function addTask()
	{
		$this->editTask();
	}

	/**
	 * Edit an Import
	 *
	 * @param   object  $import
	 * @return  void
	 */
	public function editTask($import = null)
	{
		Request::setVar('hidemainmenu', 1);

		// get the import object
		if (!($import instanceof Import))
		{
			// get request vars
			$id = Request::getArray('id', array(0));
			if (is_array($id))
			{
				$id = (isset($id[0]) ? $id[0] : 0);
			}

			$import = Import::oneOrNew($id);
		}

		// import params
		$params = new Registry($import->get('params'));

		// get all files in import filespace
		$files = array();

		if ($import->get('id'))
		{
			if ($this->_createImportFilespace($import))
			{
				$files = Filesystem::files($import->fileSpacePath(), '.');
			}
		}

		// get all import hooks
		$hooks = Hook::all()
			->whereIn('state', array(1))
			->rows();

		// Set any errors
		foreach ($this->getErrors() as $error)
		{
			$this->view->setError($error);
		}

		// Output the HTML
		$this->view
			->set('import', $import)
			->set('params', $params)
			->set('files', $files)
			->set('hooks', $hooks)
			->setLayout('edit')
			->display();
	}

	/**
	 * Save an Import and display edit form
	 *
	 * @return  void
	 */
	public function applyTask()
	{
		$this->saveTask(false);
	}

	/**
	 * Save an Import
	 *
	 * @param   boolean  $redirect  Redirect after save?
	 * @return  void
	 */
	public function saveTask($redirect=true)
	{
		// check token
		Session::checkToken();

		// Get request vars
		$import = Request::getArray('import', array());
		$hooks  = Request::getArray('hooks', array());
		$params = Request::getArray('params', array());
		$fields = Request::getArray('mapping', array());
		$file   = Request::getArray('file', array(), 'FILES');

		// Create import model object
		$model = Import::oneOrNew(isset($import['id']) ? $import['id'] : 0);

		// Set our hooks
		$model->set('hooks', json_encode($hooks));

		// Set our fields
		$model->set('fields', json_encode($fields));

		// Load current params
		$iparams = new Registry($model->get('params'));

		// Bind incoming params
		$iparams->parse($params);

		// Set params on import object
		$model->set('params', $iparams->toString());

		// Bind input to model
		if (!$model->set($import))
		{
			$this->setError($model->getError());
			return $this->editTask($model);
		}

		// Is this a new import?
		$isNew = false;
		if ($model->isNew())
		{
			$isNew = true;

			// Set the created by/at
			$model->set('created_by', User::get('id'));
			$model->set('created_at', Date::toSql());
		}

		// Attempt to save
		if (!$model->save())
		{
			$this->setError($model->getError());
			return $this->editTask();
		}

		// create folder for files
		if (!$this->_createImportFilespace($model))
		{
			return $this->editTask();
		}

		// If we have a file
		if (is_array($file) && !empty($file) && $file['size'] > 0 && $file['error'] == 0)
		{
			move_uploaded_file($file['tmp_name'], $model->fileSpacePath() . DS . $file['name']);
			$model->set('file', $file['name']);
			$model->set('fields', '');

			// Force into the field map view
			$isNew = true;
		}

		// Do we have a data file?
		if ($model->get('file'))
		{
			// get record count
			$importImporter = new Importer();
			$model->set('count', $importImporter->count($model));
		}

		// Save again with import count
		if (!$model->save())
		{
			$this->setError($model->getError());
			return $this->editTask($model);
		}

		Notify::success(Lang::txt('COM_GROUPS_IMPORT_CREATED'));

		// Inform user & redirect
		if ($redirect)
		{
			if ($isNew)
			{
				$this->view
					->set('import', $model)
					->setLayout('fields')
					->display();
				return;
			}

			return $this->cancelTask();
		}

		$this->editTask($model);
	}

	/**
	 * Delete Import
	 *
	 * @return  void
	 */
	public function removeTask()
	{
		// check token
		Session::checkToken();

		// get request vars
		$ids = Request::getArray('id', array());
		$ids = (!is_array($ids) ? array($ids) : $ids);

		// loop through all ids posted
		$i = 0;
		foreach ($ids as $id)
		{
			// make sure we have an object
			$import = Import::oneOrFail($id);

			if (!$import->get('id'))
			{
				continue;
			}

			// attempt to delete import
			if (!$import->destroy())
			{
				Notify::error($import->getError());
				continue;
			}

			$i++;
		}

		if ($i)
		{
			Notify::success(Lang::txt('COM_GROUPS_IMPORT_REMOVED'));
		}

		//inform user & redirect
		$this->cancelTask();
	}

	/**
	 * Run Import as Dry Run
	 *
	 * @return  void
	 */
	public function runTestTask()
	{
		$this->runTask(1);
	}

	/**
	 * Run Import
	 *
	 * @param   integer  $dryRun
	 * @return  void
	 */
	public function runTask($dryRun = 0)
	{
		// Get request vars
		$id = Request::getArray('id', array(0));
		$id = (is_array($id) ? $id[0] : $id);

		// Create import model object
		$import = Import::oneOrFail($id);

		if (!$import->get('id'))
		{
			return $this->cancelTask();
		}

		// Output the HTML
		$this->view
			->set('dryRun', $dryRun)
			->set('import', $import)
			->setLayout('run')
			->setErrors($this->getErrors())
			->display();
	}

	/**
	 * Actually Run Import
	 *
	 * @return  string  JSON encoded records that just got inserted or would be
	 */
	public function doRunTask()
	{
		// Check token
		//Session::checkToken();

		// Start of import
		$start = microtime(true);

		// Get request vars
		$id = Request::getInt('id', 0);

		// Test mode
		$dryRun = Request::getBool('dryrun', 0);

		// Create import model object
		$import = Import::oneOrFail($id);

		// Make import importer
		$importImporter = Importer::getInstance();

		// Run process task on importer
		// passed the import model, array or callbacks, and test mode flag
		$resourceData = $importImporter->process($import, array(
			'postparse'   => $this->_hooks('postparse', $import),
			'postmap'     => $this->_hooks('postmap', $import),
			'postconvert' => $this->_hooks('postconvert', $import)
		), $dryRun);

		// Calculate execution time
		$end  = microtime(true);
		$time = round($end - $start, 3);

		// Outputted with html entities to allow browser json formatter
		if (Request::getInt('format', 0) == 1)
		{
			echo htmlentities(json_encode(array(
				'import'  => 'success',
				'time'    => $time,
				'records' => $resourceData
			)));
			exit();
		}

		// Return results to user
		echo json_encode(array(
			'import'  => 'success',
			'time'    => $time,
			'records' => $resourceData
		));
		exit();
	}

	/**
	 * Get progress of import task
	 *
	 * @return  string  JSON encoded total and position
	 */
	public function progressTask()
	{
		// get request vars
		$id = Request::getInt('id', 0);

		// create import model object
		$import = Import::oneOrFail($id);

		// get the lastest run
		$run = $import->runs()
			->whereEquals('import_id', $import->get('id'))
			->ordered()
			->row();

		// build array of data to return
		$data = array(
			'processed' => $run->get('processed', 0),
			'total'     => $run->get('count', 0)
		);

		// return progress update
		echo json_encode($data);
		exit();
	}

	/**
	 * Return Hook for Post Parsing or Post Convert
	 *
	 * @param   string  $event   Hook we want
	 * @param   object  $import  Import Model
	 * @return  object  Closure
	 */
	private function _hooks($event, $import)
	{
		// Array to hold callbacks
		$callbacks = array();

		// Get hooks on import
		$hooks = json_decode($import->get('hooks'));

		// Make sure we have this type of hook
		if (!isset($hooks->$event))
		{
			return $callbacks;
		}

		// Loop through each hook
		foreach ($hooks->$event as $hook)
		{
			// Load hook object
			$importHook = Hook::oneOrNew($hook);

			// Make sure we have an object
			if (!$importHook->get('id'))
			{
				continue;
			}

			// Build path to script
			$hookFile = $importHook->fileSpacePath() . DS . $importHook->get('file');

			// Make sure we have a file
			if (!is_file($hookFile))
			{
				continue;
			}

			// Add callback
			$callbacks[] = function($data, $dryRun) use ($hookFile)
			{
				return include $hookFile;
			};
		}

		// Return closures as callbacks
		return $callbacks;
	}

	/**
	 * Method to create import filespace if needed
	 *
	 * @param   object  $import  \Hubzero\Content\Import\Model\Import
	 * @return  boolean
	 */
	private function _createImportFilespace(\Hubzero\Content\Import\Model\Import $import)
	{
		// Upload path
		$uploadPath = $import->fileSpacePath();

		// If we dont have a filespace, create it
		if (!is_dir($uploadPath))
		{
			if (!Filesystem::makeDirectory($uploadPath))
			{
				$this->setError(Lang::txt('Failed to create target upload path "%s".', $uploadPath));
				return false;
			}
		}

		return true;
	}

	/**
	 * Quote a value for a CSV file
	 *
	 * @param   string  $val
	 * @return  string
	 */
	public static function quoteCsv($val)
	{
		if (!isset($val))
		{
			return '';
		}

		if (strpos($val, "\n") !== false || strpos($val, ',') !== false)
		{
			return '"' . str_replace(array('\\', '"'), array('\\\\', '""'), $val) . '"';
		}

		return $val;
	}

	/**
	 * Quote a CSV row
	 *
	 * @param   array  $vals
	 * @return  string
	 */
	public function quoteCsvRow($vals)
	{
		return implode(',', array_map(array($this, 'quoteCsv'), $vals)) . "\n";
	}

	/**
	 * Serve up an example CSV file
	 *
	 * @return  void
	 */
	public function sampleTask()
	{
		$skip = array('params', 'type', 'logo');

		$fields = array();
		$row    = array();

		$model = Group::blank();
		$attribs = $model->getStructure()->getTableColumns($model->getTableName());

		foreach ($attribs as $key => $desc)
		{
			if (in_array(strtolower($key), $skip))
			{
				continue;
			}

			$example = 'Example';
			$desc = preg_replace('/\(.*\)/', '', $desc);

			if (in_array($desc, array('int', 'tinyint', 'float')))
			{
				$example = '1';
			}

			array_push($row, $example);
			array_push($fields, $key);
		}

		include_once dirname(dirname(__DIR__)) . '/models/orm/field.php';

		$attribs = \Components\Groups\Models\Orm\Field::all()
			->including(['options', function ($option){
				$option
					->select('*');
			}])
			->ordered()
			->rows();

		foreach ($attribs as $field)
		{
			$key = $field->get('name');

			if (in_array(strtolower($key), $skip))
			{
				continue;
			}

			$example = 'Example';
			if ($field->options->count() || in_array($field->get('type'), array('tags', 'select', 'dropdown', 'list', 'radio', 'radios', 'checkbox', 'checkboxes')))
			{
				$example = 'example;example;example';
			}

			array_push($row, $example);
			array_push($fields, $key);
		}

		$record = new \Components\Groups\Models\Import\Record(new \stdClass);
		foreach ($record->handlers() as $handler)
		{
			$sample = $handler->sample();

			if (is_array($sample) && !empty($sample))
			{
				array_push($row, $sample['content']);
				array_push($fields, $sample['header']);
			}
		}

		// Output header
		@ob_end_clean();

		header("Pragma: public");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		header("Expires: 0");

		header("Content-Transfer-Encoding: binary");
		header('Content-type: text/comma-separated-values');
		header('Content-disposition: attachment; filename="groups.csv"');

		echo $this->quoteCsvRow($fields);
		echo $this->quoteCsvRow($row);
		exit;
	}
}


text:
package common

import (
	"fmt"
	"os"
	"path"
	"time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/uuid"
	"k8s.io/kubernetes/pkg/api/v1"
	"k8s.io/kubernetes/test/e2e/framework"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = framework.KubeDescribe("Secrets", func() {
	f := framework.NewDefaultFramework("secrets")

	It("should be consumable from pods in volume [Conformance] [Volume]", func() {
		doSecretE2EWithoutMapping(f, nil /* default mode */, "secret-test-"+string(uuid.NewUUID()), nil, nil)
	})

	It("should be consumable from pods in volume with defaultMode set [Conformance] [Volume]", func() {
		defaultMode := int32(0400)
		doSecretE2EWithoutMapping(f, &defaultMode, "secret-test-"+string(uuid.NewUUID()), nil, nil)
	})

	It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [Conformance] [Volume]", func() {
		defaultMode := int32(0440) /* setting fsGroup sets mode to at least 440 */
		fsGroup := int64(1001)
		uid := int64(1000)
		doSecretE2EWithoutMapping(f, &defaultMode, "secret-test-"+string(uuid.NewUUID()), &fsGroup, &uid)
	})

	It("should be consumable from pods in volume with mappings [Conformance] [Volume]", func() {
		doSecretE2EWithMapping(f, nil)
	})

	It("should be consumable from pods in volume with mappings and Item Mode set [Conformance] [Volume]", func() {
		mode := int32(0400)
		doSecretE2EWithMapping(f, &mode)
	})

	It("should be able to mount in a volume regardless of a different secret existing with same name in different namespace [Volume]", func() {
		var (
			namespace2  *v1.Namespace
			err         error
			secret2Name = "secret-test-" + string(uuid.NewUUID())
		)

		if namespace2, err = f.CreateNamespace("secret-namespace", nil); err != nil {
			framework.Failf("unable to create new namespace %s: %v", namespace2.Name, err)
		}

		secret2 := secretForTest(namespace2.Name, secret2Name)
		secret2.Data = map[string][]byte{
			"this_should_not_match_content_of_other_secret": []byte("similarly_this_should_not_match_content_of_other_secret\n"),
		}
		if secret2, err = f.ClientSet.Core().Secrets(namespace2.Name).Create(secret2); err != nil {
			framework.Failf("unable to create test secret %s: %v", secret2.Name, err)
		}
		doSecretE2EWithoutMapping(f, nil /* default mode */, secret2.Name, nil, nil)
	})

	It("should be consumable in multiple volumes in a pod [Conformance] [Volume]", func() {
		// This test ensures that the same secret can be mounted in multiple
		// volumes in the same pod.  This test case exists to prevent
		// regressions that break this use-case.
		var (
			name             = "secret-test-" + string(uuid.NewUUID())
			volumeName       = "secret-volume"
			volumeMountPath  = "/etc/secret-volume"
			volumeName2      = "secret-volume-2"
			volumeMountPath2 = "/etc/secret-volume-2"
			secret           = secretForTest(f.Namespace.Name, name)
		)

		By(fmt.Sprintf("Creating secret with name %s", secret.Name))
		var err error
		if secret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(secret); err != nil {
			framework.Failf("unable to create test secret %s: %v", secret.Name, err)
		}

		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: "pod-secrets-" + string(uuid.NewUUID()),
			},
			Spec: v1.PodSpec{
				Volumes: []v1.Volume{
					{
						Name: volumeName,
						VolumeSource: v1.VolumeSource{
							Secret: &v1.SecretVolumeSource{
								SecretName: name,
							},
						},
					},
					{
						Name: volumeName2,
						VolumeSource: v1.VolumeSource{
							Secret: &v1.SecretVolumeSource{
								SecretName: name,
							},
						},
					},
				},
				Containers: []v1.Container{
					{
						Name:  "secret-volume-test",
						Image: "gcr.io/google_containers/mounttest:0.7",
						Args: []string{
							"--file_content=/etc/secret-volume/data-1",
							"--file_mode=/etc/secret-volume/data-1"},
						VolumeMounts: []v1.VolumeMount{
							{
								Name:      volumeName,
								MountPath: volumeMountPath,
								ReadOnly:  true,
							},
							{
								Name:      volumeName2,
								MountPath: volumeMountPath2,
								ReadOnly:  true,
							},
						},
					},
				},
				RestartPolicy: v1.RestartPolicyNever,
			},
		}

		f.TestContainerOutput("consume secrets", pod, 0, []string{
			"content of file \"/etc/secret-volume/data-1\": value-1",
			"mode of file \"/etc/secret-volume/data-1\": -rw-r--r--",
		})
	})

	It("optional updates should be reflected in volume [Conformance] [Volume]", func() {

		// We may have to wait or a full sync period to elapse before the
		// Kubelet projects the update into the volume and the container picks
		// it up. This timeout is based on the default Kubelet sync period (1
		// minute) plus additional time for fudge factor.
		const podLogTimeout = 300 * time.Second
		trueVal := true

		volumeMountPath := "/etc/secret-volumes"

		deleteName := "s-test-opt-del-" + string(uuid.NewUUID())
		deleteContainerName := "dels-volume-test"
		deleteVolumeName := "deletes-volume"
		deleteSecret := &v1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Namespace: f.Namespace.Name,
				Name:      deleteName,
			},
			Data: map[string][]byte{
				"data-1": []byte("value-1"),
			},
		}

		updateName := "s-test-opt-upd-" + string(uuid.NewUUID())
		updateContainerName := "upds-volume-test"
		updateVolumeName := "updates-volume"
		updateSecret := &v1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Namespace: f.Namespace.Name,
				Name:      updateName,
			},
			Data: map[string][]byte{
				"data-1": []byte("value-1"),
			},
		}

		createName := "s-test-opt-create-" + string(uuid.NewUUID())
		createContainerName := "creates-volume-test"
		createVolumeName := "creates-volume"
		createSecret := &v1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Namespace: f.Namespace.Name,
				Name:      createName,
			},
			Data: map[string][]byte{
				"data-1": []byte("value-1"),
			},
		}

		By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
		var err error
		if deleteSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
			framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
		}

		By(fmt.Sprintf("Creating secret with name %s", updateSecret.Name))
		if updateSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(updateSecret); err != nil {
			framework.Failf("unable to create test secret %s: %v", updateSecret.Name, err)
		}

		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: "pod-secrets-" + string(uuid.NewUUID()),
			},
			Spec: v1.PodSpec{
				Volumes: []v1.Volume{
					{
						Name: deleteVolumeName,
						VolumeSource: v1.VolumeSource{
							Secret: &v1.SecretVolumeSource{
								SecretName: deleteName,
								Optional:   &trueVal,
							},
						},
					},
					{
						Name: updateVolumeName,
						VolumeSource: v1.VolumeSource{
							Secret: &v1.SecretVolumeSource{
								SecretName: updateName,
								Optional:   &trueVal,
							},
						},
					},
					{
						Name: createVolumeName,
						VolumeSource: v1.VolumeSource{
							Secret: &v1.SecretVolumeSource{
								SecretName: createName,
								Optional:   &trueVal,
							},
						},
					},
				},
				Containers: []v1.Container{
					{
						Name:    deleteContainerName,
						Image:   "gcr.io/google_containers/mounttest:0.7",
						Command: []string{"/mt", "--break_on_expected_content=false", "--retry_time=120", "--file_content_in_loop=/etc/secret-volumes/delete/data-1"},
						VolumeMounts: []v1.VolumeMount{
							{
								Name:      deleteVolumeName,
								MountPath: path.Join(volumeMountPath, "delete"),
								ReadOnly:  true,
							},
						},
					},
					{
						Name:    updateContainerName,
						Image:   "gcr.io/google_containers/mounttest:0.7",
						Command: []string{"/mt", "--break_on_expected_content=false", "--retry_time=120", "--file_content_in_loop=/etc/secret-volumes/update/data-3"},
						VolumeMounts: []v1.VolumeMount{
							{
								Name:      updateVolumeName,
								MountPath: path.Join(volumeMountPath, "update"),
								ReadOnly:  true,
							},
						},
					},
					{
						Name:    createContainerName,
						Image:   "gcr.io/google_containers/mounttest:0.7",
						Command: []string{"/mt", "--break_on_expected_content=false", "--retry_time=120", "--file_content_in_loop=/etc/secret-volumes/create/data-1"},
						VolumeMounts: []v1.VolumeMount{
							{
								Name:      createVolumeName,
								MountPath: path.Join(volumeMountPath, "create"),
								ReadOnly:  true,
							},
						},
					},
				},
				RestartPolicy: v1.RestartPolicyNever,
			},
		}
		By("Creating the pod")
		f.PodClient().CreateSync(pod)

		pollCreateLogs := func() (string, error) {
			return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, createContainerName)
		}
		Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/secret-volumes/create/data-1"))

		pollUpdateLogs := func() (string, error) {
			return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, updateContainerName)
		}
		Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/secret-volumes/update/data-3"))

		pollDeleteLogs := func() (string, error) {
			return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, deleteContainerName)
		}
		Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-1"))

		By(fmt.Sprintf("Deleting secret %v", deleteSecret.Name))
		err = f.ClientSet.Core().Secrets(f.Namespace.Name).Delete(deleteSecret.Name, &metav1.DeleteOptions{})
		Expect(err).NotTo(HaveOccurred(), "Failed to delete secret %q in namespace %q", deleteSecret.Name, f.Namespace.Name)

		By(fmt.Sprintf("Updating secret %v", updateSecret.Name))
		updateSecret.ResourceVersion = "" // to force update
		delete(updateSecret.Data, "data-1")
		updateSecret.Data["data-3"] = []byte("value-3")
		_, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Update(updateSecret)
		Expect(err).NotTo(HaveOccurred(), "Failed to update secret %q in namespace %q", updateSecret.Name, f.Namespace.Name)

		By(fmt.Sprintf("Creating secret with name %s", createSecret.Name))
		if createSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(createSecret); err != nil {
			framework.Failf("unable to create test secret %s: %v", createSecret.Name, err)
		}

		By("waiting to observe update in volume")

		Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-1"))
		Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-3"))
		Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/secret-volumes/delete/data-1"))
	})

	It("should be consumable from pods in env vars [Conformance]", func() {
		name := "secret-test-" + string(uuid.NewUUID())
		secret := secretForTest(f.Namespace.Name, name)

		By(fmt.Sprintf("Creating secret with name %s", secret.Name))
		var err error
		if secret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(secret); err != nil {
			framework.Failf("unable to create test secret %s: %v", secret.Name, err)
		}

		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: "pod-secrets-" + string(uuid.NewUUID()),
			},
			Spec: v1.PodSpec{
				Containers: []v1.Container{
					{
						Name:    "secret-env-test",
						Image:   "gcr.io/google_containers/busybox:1.24",
						Command: []string{"sh", "-c", "env"},
						Env: []v1.EnvVar{
							{
								Name: "SECRET_DATA",
								ValueFrom: &v1.EnvVarSource{
									SecretKeyRef: &v1.SecretKeySelector{
										LocalObjectReference: v1.LocalObjectReference{
											Name: name,
										},
										Key: "data-1",
									},
								},
							},
						},
					},
				},
				RestartPolicy: v1.RestartPolicyNever,
			},
		}

		f.TestContainerOutput("consume secrets", pod, 0, []string{
			"SECRET_DATA=value-1",
		})
	})

	It("should be consumable via the environment [Conformance]", func() {
		name := "secret-test-" + string(uuid.NewUUID())
		secret := newEnvFromSecret(f.Namespace.Name, name)
		By(fmt.Sprintf("creating secret %v/%v", f.Namespace.Name, secret.Name))
		var err error
		if secret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(secret); err != nil {
			framework.Failf("unable to create test secret %s: %v", secret.Name, err)
		}

		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: "pod-configmaps-" + string(uuid.NewUUID()),
			},
			Spec: v1.PodSpec{
				Containers: []v1.Container{
					{
						Name:    "env-test",
						Image:   "gcr.io/google_containers/busybox:1.24",
						Command: []string{"sh", "-c", "env"},
						EnvFrom: []v1.EnvFromSource{
							{
								SecretRef: &v1.SecretEnvSource{LocalObjectReference: v1.LocalObjectReference{Name: name}},
							},
							{
								Prefix:    "p_",
								SecretRef: &v1.SecretEnvSource{LocalObjectReference: v1.LocalObjectReference{Name: name}},
							},
						},
					},
				},
				RestartPolicy: v1.RestartPolicyNever,
			},
		}

		f.TestContainerOutput("consume secrets", pod, 0, []string{
			"data_1=value-1", "data_2=value-2", "data_3=value-3",
			"p_data_1=value-1", "p_data_2=value-2", "p_data_3=value-3",
		})
	})
})

func newEnvFromSecret(namespace, name string) *v1.Secret {
	return &v1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Namespace: namespace,
			Name:      name,
		},
		Data: map[string][]byte{
			"data_1": []byte("value-1\n"),
			"data_2": []byte("value-2\n"),
			"data_3": []byte("value-3\n"),
		},
	}
}

func secretForTest(namespace, name string) *v1.Secret {
	return &v1.Secret{
		ObjectMeta: metav1.ObjectMeta{
			Namespace: namespace,
			Name:      name,
		},
		Data: map[string][]byte{
			"data-1": []byte("value-1\n"),
			"data-2": []byte("value-2\n"),
			"data-3": []byte("value-3\n"),
		},
	}
}

func doSecretE2EWithoutMapping(f *framework.Framework, defaultMode *int32, secretName string, fsGroup *int64, uid *int64) {
	var (
		volumeName      = "secret-volume"
		volumeMountPath = "/etc/secret-volume"
		secret          = secretForTest(f.Namespace.Name, secretName)
	)

	By(fmt.Sprintf("Creating secret with name %s", secret.Name))
	var err error
	if secret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(secret); err != nil {
		framework.Failf("unable to create test secret %s: %v", secret.Name, err)
	}

	pod := &v1.Pod{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "pod-secrets-" + string(uuid.NewUUID()),
			Namespace: f.Namespace.Name,
		},
		Spec: v1.PodSpec{
			Volumes: []v1.Volume{
				{
					Name: volumeName,
					VolumeSource: v1.VolumeSource{
						Secret: &v1.SecretVolumeSource{
							SecretName: secretName,
						},
					},
				},
			},
			Containers: []v1.Container{
				{
					Name:  "secret-volume-test",
					Image: "gcr.io/google_containers/mounttest:0.7",
					Args: []string{
						"--file_content=/etc/secret-volume/data-1",
						"--file_mode=/etc/secret-volume/data-1"},
					VolumeMounts: []v1.VolumeMount{
						{
							Name:      volumeName,
							MountPath: volumeMountPath,
						},
					},
				},
			},
			RestartPolicy: v1.RestartPolicyNever,
		},
	}

	if defaultMode != nil {
		pod.Spec.Volumes[0].VolumeSource.Secret.DefaultMode = defaultMode
	} else {
		mode := int32(0644)
		defaultMode = &mode
	}

	if fsGroup != nil || uid != nil {
		pod.Spec.SecurityContext = &v1.PodSecurityContext{
			FSGroup:   fsGroup,
			RunAsUser: uid,
		}
	}

	modeString := fmt.Sprintf("%v", os.FileMode(*defaultMode))
	expectedOutput := []string{
		"content of file \"/etc/secret-volume/data-1\": value-1",
		"mode of file \"/etc/secret-volume/data-1\": " + modeString,
	}

	f.TestContainerOutput("consume secrets", pod, 0, expectedOutput)
}

func doSecretE2EWithMapping(f *framework.Framework, mode *int32) {
	var (
		name            = "secret-test-map-" + string(uuid.NewUUID())
		volumeName      = "secret-volume"
		volumeMountPath = "/etc/secret-volume"
		secret          = secretForTest(f.Namespace.Name, name)
	)

	By(fmt.Sprintf("Creating secret with name %s", secret.Name))
	var err error
	if secret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(secret); err != nil {
		framework.Failf("unable to create test secret %s: %v", secret.Name, err)
	}

	pod := &v1.Pod{
		ObjectMeta: metav1.ObjectMeta{
			Name: "pod-secrets-" + string(uuid.NewUUID()),
		},
		Spec: v1.PodSpec{
			Volumes: []v1.Volume{
				{
					Name: volumeName,
					VolumeSource: v1.VolumeSource{
						Secret: &v1.SecretVolumeSource{
							SecretName: name,
							Items: []v1.KeyToPath{
								{
									Key:  "data-1",
									Path: "new-path-data-1",
								},
							},
						},
					},
				},
			},
			Containers: []v1.Container{
				{
					Name:  "secret-volume-test",
					Image: "gcr.io/google_containers/mounttest:0.7",
					Args: []string{
						"--file_content=/etc/secret-volume/new-path-data-1",
						"--file_mode=/etc/secret-volume/new-path-data-1"},
					VolumeMounts: []v1.VolumeMount{
						{
							Name:      volumeName,
							MountPath: volumeMountPath,
						},
					},
				},
			},
			RestartPolicy: v1.RestartPolicyNever,
		},
	}

	if mode != nil {
		pod.Spec.Volumes[0].VolumeSource.Secret.Items[0].Mode = mode
	} else {
		defaultItemMode := int32(0644)
		mode = &defaultItemMode
	}

	modeString := fmt.Sprintf("%v", os.FileMode(*mode))
	expectedOutput := []string{
		"content of file \"/etc/secret-volume/new-path-data-1\": value-1",
		"mode of file \"/etc/secret-volume/new-path-data-1\": " + modeString,
	}

	f.TestContainerOutput("consume secrets", pod, 0, expectedOutput)
}


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

<link rel="stylesheet" type="text/css" href="../css/jxlite.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>XPath Support in JxLite</title>

	TOC

XPath Support in JxLite

	JxLite @Path annotations support a (very) restricted subset of XPath. Specifically:

Only relative paths are supported. (I.e. a path cannot start with / or //).

The . and .. operators are not supported.

Wildcards are not supported.

Predicates are not supported.

	Here are some examples of valid @Path annotations:

@Path("controls")

@Path("controls/button")

@Path("controls/button/@id")

@Path("a:controls/a:button/@id")


text:
package Panels;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import controladores.ctrlAutoAvaliacao;

import dados.Resposta;

public class PainelQuestao extends JPanel  {

	private static final long serialVersionUID = 1L;
	private GridBagConstraints gbc;
	private JLabel label_questao, label_imagemAuxiliar, label_resposta, label_avaliacao, label_explicacao;
	private JTextArea textArea_questao, textArea_explicacao;

	//Imagem necessita disto tudo:
	//private BufferedImage img = ImageIO.read(new File("")); // não sei se com a DB funciona, pelo menos em paths locais é assim.
	private ImageIcon imageIcon_imagem;
	private JLabel label_imagem;

	//
	private JTextField textField_reposta;
	private JButton button_enviarResposta, button_pedirQuestao, button_abandonar,button_limpar;

	private Connection con;
	private ctrlAutoAvaliacao ctrlAutoAvaliacao;

	//experimental emai aluno
	private String email="docente@iscte.pt";

	public PainelQuestao(Connection con,ctrlAutoAvaliacao ctrlAutoAvaliacao) {
		this.ctrlAutoAvaliacao=ctrlAutoAvaliacao;
		this.con= con;
		setup();
	}

	private void setup(){
		init();
		setLayout(new GridBagLayout());
		configCimaEsquerda();
		configCimaDireita();
		configBaixo();
	}

	public JTextArea getTextQuestao(){
		return textArea_questao;
	}

	private void init(){
		gbc = new GridBagConstraints();

		label_questao = new JLabel("Questão:");
		label_imagemAuxiliar = new JLabel("Image Auxiliar:");
		label_resposta = new JLabel("Resposta:");
		label_avaliacao = new JLabel("Avaliação: --------/---------");
		label_explicacao = new JLabel("Explicação");

		textArea_questao = new JTextArea();
		textArea_questao.setEditable(false);

		imageIcon_imagem = new ImageIcon();
		label_imagem = new JLabel(imageIcon_imagem);

		textField_reposta = new JTextField("",1);

		button_enviarResposta = new JButton("Enviar resposta");

		button_enviarResposta.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {

				// TODO Auto-generated method stub
				ctrlAutoAvaliacao.enviarRespostaEscolhida(Integer.parseInt(textField_reposta.getText()),email);

				/*	Resposta r = new Resposta("docente@iscte.pt", null,
						ctrlAutoAvaliacao.getQuestao().getISQuetao(), Integer.parseInt(textField_reposta.getText()));
				r.insert(con);
				*/
				//Integer.parseInt(textField_reposta.getText()) PASSAR A RSP DO TXT PARA INTEIRO

				label_avaliacao.setText(ctrlAutoAvaliacao.obeterAvalaicao(Integer.parseInt(textField_reposta.getText())));

				textArea_explicacao.setText(ctrlAutoAvaliacao.obeterExplicacao());
			}
		});

		button_pedirQuestao = new JButton("Pedir Nova Questão");

		textArea_explicacao = new JTextArea();
		textArea_explicacao.setEditable(false);

		button_abandonar = new JButton("Abandonar");
		button_abandonar.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(1);

			}
		});

		button_limpar = new JButton("Limpar");

	}

	private void configCimaEsquerda(){

		gbc.fill = GridBagConstraints.BOTH;
		gbc.ipady = 20;
		gbc.ipadx = 20;

		gbc.gridx = 0;
		gbc.gridy = 0;
		add(label_questao,gbc);

		gbc.ipady = 100;
		gbc.gridy = 1;
		gbc.gridwidth = 4;
		gbc.gridheight = 3;
		textArea_questao.setBorder(BorderFactory.createLineBorder(Color.black));
		add(textArea_questao, gbc);

		gbc.insets = new Insets(10,10,0,0);
		gbc.ipady = 10;
		gbc.gridy = 4;
		gbc.gridwidth = 1;
		gbc.gridheight = 1;
		add(label_resposta, gbc);

		gbc.gridx = 1;
		textField_reposta.setPreferredSize(new Dimension(100, 20));

		add(textField_reposta, gbc);

		gbc.gridx = 2;
		gbc.gridwidth = 2;
		gbc.insets = new Insets(10,10,0,0);
		add(button_enviarResposta, gbc);
	}

	private void configCimaDireita(){
		gbc.gridx = 4;
		gbc.gridy = 0;
		gbc.gridwidth = 1;
		add(label_imagemAuxiliar, gbc);

		gbc.gridy = 1;
		gbc.gridwidth = 2;
		gbc.gridheight = 3;
		add(label_imagem, gbc);

		gbc.gridy = 4;
		gbc.gridwidth = 1;
		gbc.gridheight = 1;
		add(button_pedirQuestao,gbc);
	}

	private void configBaixo(){
		gbc.gridy = 5;
		gbc.gridx = 0;
		gbc.gridwidth = 1;
		gbc.gridheight = 1;
		add(label_avaliacao,gbc);

		gbc.gridy = 6;
		add(label_explicacao,gbc);

		gbc.gridwidth = 5;
		gbc.gridheight = 2;
		gbc.gridx= 1;

		textArea_explicacao.setPreferredSize(new Dimension(100, 40));
		textArea_explicacao.setBorder(BorderFactory.createLineBorder(Color.black));
		add(textArea_explicacao, gbc);

		gbc.gridwidth = 1;
		gbc.gridheight = 1;
		gbc.gridy = 8;
		gbc.gridx = 3;
		add(button_abandonar, gbc);

		gbc.gridx = 2;
		add(button_limpar, gbc);
	}

	public JButton getButton_limpar() {
		return button_limpar;
	}

}


text:
var gulp = require('gulp');

// Plugins
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');

// Paths
var paths = {
    scripts: ['assets/js/*.js'],
    images: ['assets/img/**'],
    fonts: ['assets/fonts/**']
};

// Compile Sass
gulp.task('sass', function() {
    gulp.src(['assets/scss/*.scss'])
        .pipe(plumber())
        .pipe(sass({
            includePaths: ['assets/scss', 'bower_components'],
            outputStyle: 'expanded'
        }))
        .pipe(prefix(
            "last 1 version", "> 1%", "ie 8", "ie 7"
        ))
        .pipe(gulp.dest('public/assets/css'))
        .pipe(minifycss())
        .pipe(gulp.dest('public/assets/css'))
});
// Uglify JS
gulp.task('uglify', function() {
    gulp.src(paths.scripts)
        .pipe(plumber())
        .pipe(uglify({
            outSourceMap: false
        }))
        .pipe(gulp.dest('public/assets/js'));
});

// Compress images
gulp.task('imagemin', function() {
    gulp.src(paths.images)
        .pipe(plumber())
        .pipe(imagemin())
        .pipe(gulp.dest('public/assets/img'));
});

// Copy all static assets
gulp.task('copyFonts', function() {
    return gulp.src(paths.fonts)
        .pipe(gulp.dest('public/assets/fonts'));
});

// Watch files
gulp.task('watch', function(event) {
    gulp.watch('assets/scss/*.scss', ['sass']);
    gulp.watch(paths.images, ['imagemin']);
    gulp.watch(paths.fonts, ['copyFonts']);
    gulp.watch(paths.scripts, ['uglify']);
});

gulp.task('default', ['watch']);


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <description>
    Assembles the camunda BPM platform and makes it ready for qa.
    The assembly is installed to maven later in the reactor, if the integration tests pass sucessfully
  </description>

  <artifactId>camunda-glassfish-assembly</artifactId>
  <packaging>pom</packaging>

  <parent>
    <groupId>org.camunda.bpm.glassfish</groupId>
    <artifactId>camunda-glassfish</artifactId>
    <version>7.5.0-SNAPSHOT</version>
  </parent>

  <name>camunda BPM - Glassfish 3.1.x Assembly</name>

  <dependencies>

	<dependency>
		<groupId>org.glassfish.main.distributions</groupId>
		<artifactId>glassfish</artifactId>
		<version>${version.glassfish}</version>
		<type>zip</type>
		<exclusions>

        <!-- This keeps maven from downloading a bunch of poms we do not need.
             We just need the glassfish zip distribution.
             For some reason the pom for that depends on all these other poms which again
             transitively pull in every pom used in the appserver.

             NOTE: if you do an upgrade to a new glassfish version, check the
             org.glassfish.distributions:glassfish pom for new dependencies and if
             they added some, exclude these as well. (DM)  -->

        <exclusion>
          <groupId>org.glassfish.distributions</groupId>
          <artifactId>web</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-common-full</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-ejb</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-cmp</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-corba</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>metro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-appclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>glassfish-jms</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>mq</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.registration</groupId>
          <artifactId>servicetag-registry</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.glassfish.packager</groupId>
          <artifactId>legal-fragment</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm.javaee</groupId>
      <artifactId>camunda-ejb-client</artifactId>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm.glassfish</groupId>
      <artifactId>camunda-glassfish-ear</artifactId>
      <version>${project.version}</version>
      <type>ear</type>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm.glassfish</groupId>
      <artifactId>camunda-glassfish-service</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine</artifactId>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm.identity</groupId>
      <artifactId>camunda-identity-ldap</artifactId>
    </dependency>

    <dependency>
      <groupId>org.camunda.spin</groupId>
      <artifactId>camunda-spin-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.camunda.connect</groupId>
      <artifactId>camunda-connect-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
    </dependency>

    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.uuid</groupId>
      <artifactId>java-uuid-generator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </dependency>

    <dependency>
    	<groupId>org.camunda.bpm.javaee</groupId>
    	<artifactId>camunda-jobexecutor-rar</artifactId>
    	<version>${project.version}</version>
    	<type>rar</type>
    </dependency>

    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
    </dependency>

    <dependency>
      <groupId>org.camunda.template-engines</groupId>
      <artifactId>camunda-template-engines-freemarker</artifactId>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>target/filtered-resources</outputDirectory>
              <resources>
                <resource>
                  <directory>src/</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>domain.xml</include>
                  </includes>
                </resource>
              </resources>
              <useDefaultDelimiters>false</useDefaultDelimiters>
              <delimiters>
                <delimiter>#{*}</delimiter>
              </delimiters>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assemble</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assembly.xml</descriptor>
              </descriptors>
              <attach>true</attach>
              <appendAssemblyId>false</appendAssemblyId>
              <outputDirectory>target/</outputDirectory>
              <workDirectory>target/assembly/work</workDirectory>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>


text:
namespace Payplug.Tests
{
    using System;
    using System.Net;
    using NUnit.Framework;
    using Payplug;
    using Payplug.Exceptions;

    [TestFixture]
    public class RefundTests
    {
        private const string PaymentID = "pay_5iHMDxy4ABR4YBVW4UscIn";
        private const string RefundID = "re_3NxGqPfSGMHQgLSZH0Mv3B";

        [Test]
        public void RefundThrowOnEmptySecretKey()
        {
            Configuration.SecretKey = string.Empty;

            Assert.Throws<ConfigurationException>(delegate { Refund.Create(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.CreateRaw(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.List(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.ListRaw(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.Retrieve(PaymentID, RefundID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.RetrieveRaw(PaymentID, RefundID); });
        }

        [Test]
        public void RefundThrowOnMissingSecurityProtocol()
        {
            Configuration.SecretKey = "mysecretkey";
            System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls;
#if !__MonoCS__
            System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls11;
            System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls12;
#endif

            Assert.Throws<ConfigurationException>(delegate { Refund.Create(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.CreateRaw(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.List(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.ListRaw(PaymentID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.Retrieve(PaymentID, RefundID); });
            Assert.Throws<ConfigurationException>(delegate { Refund.RetrieveRaw(PaymentID, RefundID); });
        }

        [Test]
        public void RefundThrowOnNullArgs()
        {
            Assert.Throws<ArgumentNullException>(delegate { Refund.Create(null); });
            Assert.Throws<ArgumentNullException>(delegate { Refund.CreateRaw(null); });
            Assert.Throws<ArgumentNullException>(delegate { Refund.List(null); });
            Assert.Throws<ArgumentNullException>(delegate { Refund.ListRaw(null); });
            Assert.Throws<ArgumentNullException>(delegate { Refund.Retrieve(null, null); });
            Assert.Throws<ArgumentNullException>(delegate { Refund.RetrieveRaw(null, null); });
        }
    }
}


text:
<title>Magnificent Octopus</title>
<meta name="description" content="Cottage Labs Application Framework for Python in Flask">
<meta name="author" content="Cottage Labs">


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <winpr/crt.h>
#include <winpr/smartcard.h>
#include <winpr/environment.h>

#include <freerdp/channels/rdpdr.h>

#include "smartcard_main.h"

void* smartcard_context_thread(SMARTCARD_CONTEXT* pContext)
{
	DWORD nCount;
	DWORD status;
	HANDLE hEvents[2];
	wMessage message;
	SMARTCARD_DEVICE* smartcard;
	SMARTCARD_OPERATION* operation;

	smartcard = pContext->smartcard;

	nCount = 0;
	hEvents[nCount++] = MessageQueue_Event(pContext->IrpQueue);

	while (1)
	{
		status = WaitForMultipleObjects(nCount, hEvents, FALSE, INFINITE);

		if (WaitForSingleObject(MessageQueue_Event(pContext->IrpQueue), 0) == WAIT_OBJECT_0)
		{
			if (!MessageQueue_Peek(pContext->IrpQueue, &message, TRUE))
				break;

			if (message.id == WMQ_QUIT)
				break;

			operation = (SMARTCARD_OPERATION*) message.wParam;

			if (operation)
			{
				status = smartcard_irp_device_control_call(smartcard, operation);

				Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) operation->irp);

				free(operation);
			}
		}
	}

	ExitThread(0);
	return NULL;
}

SMARTCARD_CONTEXT* smartcard_context_new(SMARTCARD_DEVICE* smartcard, SCARDCONTEXT hContext)
{
	SMARTCARD_CONTEXT* pContext;

	pContext = (SMARTCARD_CONTEXT*) calloc(1, sizeof(SMARTCARD_CONTEXT));
	if (!pContext)
		return pContext;

	pContext->smartcard = smartcard;
	pContext->hContext = hContext;

	pContext->IrpQueue = MessageQueue_New(NULL);
	if (!pContext->IrpQueue)
		goto error_irpqueue;

	pContext->thread = CreateThread(NULL, 0,
			(LPTHREAD_START_ROUTINE) smartcard_context_thread,
			pContext, 0, NULL);
	if (!pContext->thread)
		goto error_thread;
	return pContext;

error_thread:
	MessageQueue_Free(pContext->IrpQueue);
error_irpqueue:
	free(pContext);
	return NULL;
}

void smartcard_context_free(SMARTCARD_CONTEXT* pContext)
{
	if (!pContext)
		return;

	/* cancel blocking calls like SCardGetStatusChange */
	SCardCancel(pContext->hContext);
	if (MessageQueue_PostQuit(pContext->IrpQueue, 0))
		WaitForSingleObject(pContext->thread, INFINITE);
	CloseHandle(pContext->thread);

	MessageQueue_Free(pContext->IrpQueue);

	free(pContext);
}

static void smartcard_release_all_contexts(SMARTCARD_DEVICE* smartcard) {
	int index;
	int keyCount;
	ULONG_PTR* pKeys;
	SCARDCONTEXT hContext;
	SMARTCARD_CONTEXT* pContext;

	/**
	 * On protocol termination, the following actions are performed:
	 * For each context in rgSCardContextList, SCardCancel is called causing all SCardGetStatusChange calls to be processed.
	 * After that, SCardReleaseContext is called on each context and the context MUST be removed from rgSCardContextList.
	 */

	/**
	 * Call SCardCancel on existing contexts, unblocking all outstanding SCardGetStatusChange calls.
	 */

	if (ListDictionary_Count(smartcard->rgSCardContextList) > 0)
	{
		pKeys = NULL;
		keyCount = ListDictionary_GetKeys(smartcard->rgSCardContextList, &pKeys);

		for (index = 0; index < keyCount; index++)
		{
			pContext = (SMARTCARD_CONTEXT*) ListDictionary_GetItemValue(smartcard->rgSCardContextList, (void*) pKeys[index]);

			if (!pContext)
				continue;

			hContext = pContext->hContext;

			if (SCardIsValidContext(hContext) == SCARD_S_SUCCESS)
			{
				SCardCancel(hContext);
			}
		}

		free(pKeys);
	}

	/**
	 * Call SCardReleaseContext on remaining contexts and remove them from rgSCardContextList.
	 */

	if (ListDictionary_Count(smartcard->rgSCardContextList) > 0)
	{
		pKeys = NULL;
		keyCount = ListDictionary_GetKeys(smartcard->rgSCardContextList, &pKeys);

		for (index = 0; index < keyCount; index++)
		{
			pContext = (SMARTCARD_CONTEXT*) ListDictionary_Remove(smartcard->rgSCardContextList, (void*) pKeys[index]);

			if (!pContext)
				continue;

			hContext = pContext->hContext;

			if (SCardIsValidContext(hContext) == SCARD_S_SUCCESS)
			{
				SCardReleaseContext(hContext);
			}
		}

		free(pKeys);
	}

}

static void smartcard_free(DEVICE* device)
{
	SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) device;

	/**
	 * Calling smartcard_release_all_contexts to unblock all operations waiting for transactions
	 * to unlock.
	 */
	smartcard_release_all_contexts(smartcard);

	/* Stopping all threads and cancelling all IRPs */

	if (smartcard->IrpQueue)
	{
		if (MessageQueue_PostQuit(smartcard->IrpQueue, 0))
			WaitForSingleObject(smartcard->thread, INFINITE);

		MessageQueue_Free(smartcard->IrpQueue);
		smartcard->IrpQueue = NULL;

		CloseHandle(smartcard->thread);
		smartcard->thread = NULL;
	}

	if (smartcard->device.data)
	{
		Stream_Free(smartcard->device.data, TRUE);
		smartcard->device.data = NULL;
	}

	ListDictionary_Free(smartcard->rgSCardContextList);
	ListDictionary_Free(smartcard->rgOutstandingMessages);
	Queue_Free(smartcard->CompletedIrpQueue);

	if (smartcard->StartedEvent)
	{
		SCardReleaseStartedEvent();
		smartcard->StartedEvent = NULL;
	}

	free(device);
}

/**
 * Initialization occurs when the protocol server sends a device announce message.
 * At that time, we need to cancel all outstanding IRPs.
 */

static void smartcard_init(DEVICE* device)
{
	SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) device;

	smartcard_release_all_contexts(smartcard);

}

void smartcard_complete_irp(SMARTCARD_DEVICE* smartcard, IRP* irp)
{
	void* key;

	key = (void*) (size_t) irp->CompletionId;
	ListDictionary_Remove(smartcard->rgOutstandingMessages, key);

	irp->Complete(irp);
}

void* smartcard_process_irp_worker_proc(SMARTCARD_OPERATION* operation)
{
	IRP* irp;
	UINT32 status;
	SMARTCARD_DEVICE* smartcard;

	irp = operation->irp;
	smartcard = (SMARTCARD_DEVICE*) irp->device;

	status = smartcard_irp_device_control_call(smartcard, operation);

	Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) irp);

	free(operation);

	ExitThread(0);
	return NULL;
}

/**
 * Multiple threads and SCardGetStatusChange:
 * http://musclecard.996296.n3.nabble.com/Multiple-threads-and-SCardGetStatusChange-td4430.html
 */

void smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp)
{
	void* key;
	UINT32 status;
	BOOL asyncIrp = FALSE;
	SMARTCARD_CONTEXT* pContext = NULL;
	SMARTCARD_OPERATION* operation = NULL;

	key = (void*) (size_t) irp->CompletionId;
	ListDictionary_Add(smartcard->rgOutstandingMessages, key, irp);

	if (irp->MajorFunction == IRP_MJ_DEVICE_CONTROL)
	{
		operation = (SMARTCARD_OPERATION*) calloc(1, sizeof(SMARTCARD_OPERATION));

		if (!operation)
			return;

		operation->irp = irp;

		status = smartcard_irp_device_control_decode(smartcard, operation);

		if (status != SCARD_S_SUCCESS)
		{
			irp->IoStatus = STATUS_UNSUCCESSFUL;

			Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) irp);

			return;
		}

		asyncIrp = TRUE;

		/**
		 * The following matches mstsc's behavior of processing
		 * only certain requests asynchronously while processing
		 * those expected to return fast synchronously.
		 */

		switch (operation->ioControlCode)
		{
			case SCARD_IOCTL_ESTABLISHCONTEXT:
			case SCARD_IOCTL_RELEASECONTEXT:
			case SCARD_IOCTL_ISVALIDCONTEXT:
			case SCARD_IOCTL_LISTREADERGROUPSA:
			case SCARD_IOCTL_LISTREADERGROUPSW:
			case SCARD_IOCTL_LISTREADERSA:
			case SCARD_IOCTL_LISTREADERSW:
			case SCARD_IOCTL_INTRODUCEREADERGROUPA:
			case SCARD_IOCTL_INTRODUCEREADERGROUPW:
			case SCARD_IOCTL_FORGETREADERGROUPA:
			case SCARD_IOCTL_FORGETREADERGROUPW:
			case SCARD_IOCTL_INTRODUCEREADERA:
			case SCARD_IOCTL_INTRODUCEREADERW:
			case SCARD_IOCTL_FORGETREADERA:
			case SCARD_IOCTL_FORGETREADERW:
			case SCARD_IOCTL_ADDREADERTOGROUPA:
			case SCARD_IOCTL_ADDREADERTOGROUPW:
			case SCARD_IOCTL_REMOVEREADERFROMGROUPA:
			case SCARD_IOCTL_REMOVEREADERFROMGROUPW:
			case SCARD_IOCTL_LOCATECARDSA:
			case SCARD_IOCTL_LOCATECARDSW:
			case SCARD_IOCTL_LOCATECARDSBYATRA:
			case SCARD_IOCTL_LOCATECARDSBYATRW:
			case SCARD_IOCTL_CANCEL:
			case SCARD_IOCTL_READCACHEA:
			case SCARD_IOCTL_READCACHEW:
			case SCARD_IOCTL_WRITECACHEA:
			case SCARD_IOCTL_WRITECACHEW:
			case SCARD_IOCTL_GETREADERICON:
			case SCARD_IOCTL_GETDEVICETYPEID:
				asyncIrp = FALSE;
				break;

			case SCARD_IOCTL_GETSTATUSCHANGEA:
			case SCARD_IOCTL_GETSTATUSCHANGEW:
				asyncIrp = TRUE;
				break;

			case SCARD_IOCTL_CONNECTA:
			case SCARD_IOCTL_CONNECTW:
			case SCARD_IOCTL_RECONNECT:
			case SCARD_IOCTL_DISCONNECT:
			case SCARD_IOCTL_BEGINTRANSACTION:
			case SCARD_IOCTL_ENDTRANSACTION:
			case SCARD_IOCTL_STATE:
			case SCARD_IOCTL_STATUSA:
			case SCARD_IOCTL_STATUSW:
			case SCARD_IOCTL_TRANSMIT:
			case SCARD_IOCTL_CONTROL:
			case SCARD_IOCTL_GETATTRIB:
			case SCARD_IOCTL_SETATTRIB:
			case SCARD_IOCTL_GETTRANSMITCOUNT:
				asyncIrp = TRUE;
				break;

			case SCARD_IOCTL_ACCESSSTARTEDEVENT:
			case SCARD_IOCTL_RELEASESTARTEDEVENT:
				asyncIrp = FALSE;
				break;
		}

		pContext = ListDictionary_GetItemValue(smartcard->rgSCardContextList, (void*) operation->hContext);

		if (!pContext)
			asyncIrp = FALSE;

		if (!asyncIrp)
		{
			status = smartcard_irp_device_control_call(smartcard, operation);
			Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) irp);
			free(operation);
		}
		else
		{
			if (pContext)
			{
				MessageQueue_Post(pContext->IrpQueue, NULL, 0, (void*) operation, NULL);
			}
		}
	}
	else
	{
		WLog_ERR(TAG, "Unexpected SmartCard IRP: MajorFunction 0x%08X MinorFunction: 0x%08X",
				 irp->MajorFunction, irp->MinorFunction);
		irp->IoStatus = STATUS_NOT_SUPPORTED;

		Queue_Enqueue(smartcard->CompletedIrpQueue, (void*) irp);
	}
}

static void* smartcard_thread_func(void* arg)
{
	IRP* irp;
	DWORD nCount;
	DWORD status;
	HANDLE hEvents[2];
	wMessage message;
	SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) arg;

	nCount = 0;
	hEvents[nCount++] = MessageQueue_Event(smartcard->IrpQueue);
	hEvents[nCount++] = Queue_Event(smartcard->CompletedIrpQueue);

	while (1)
	{
		status = WaitForMultipleObjects(nCount, hEvents, FALSE, INFINITE);

		if (WaitForSingleObject(MessageQueue_Event(smartcard->IrpQueue), 0) == WAIT_OBJECT_0)
		{
			if (!MessageQueue_Peek(smartcard->IrpQueue, &message, TRUE))
				break;

			if (message.id == WMQ_QUIT)
			{
				while (WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0) == WAIT_OBJECT_0)
				{
					irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue);

					if (irp)
					{
						if (irp->thread)
						{
							WaitForSingleObject(irp->thread, INFINITE);
							CloseHandle(irp->thread);
							irp->thread = NULL;
						}

						smartcard_complete_irp(smartcard, irp);
					}
				}

				break;
			}

			irp = (IRP*) message.wParam;

			if (irp)
			{
				smartcard_process_irp(smartcard, irp);
			}
		}

		if (WaitForSingleObject(Queue_Event(smartcard->CompletedIrpQueue), 0) == WAIT_OBJECT_0)
		{
			irp = (IRP*) Queue_Dequeue(smartcard->CompletedIrpQueue);

			if (irp)
			{
				if (irp->thread)
				{
					WaitForSingleObject(irp->thread, INFINITE);
					CloseHandle(irp->thread);
					irp->thread = NULL;
				}

				smartcard_complete_irp(smartcard, irp);
			}
		}
	}

	ExitThread(0);
	return NULL;
}

static void smartcard_irp_request(DEVICE* device, IRP* irp)
{
	SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) device;
	MessageQueue_Post(smartcard->IrpQueue, NULL, 0, (void*) irp, NULL);
}

/* smartcard is always built-in */
#define DeviceServiceEntry	smartcard_DeviceServiceEntry

int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
{
	char* name;
	char* path;
	int length, ck;
	RDPDR_SMARTCARD* device;
	SMARTCARD_DEVICE* smartcard;

	device = (RDPDR_SMARTCARD*) pEntryPoints->device;

	name = device->Name;
	path = device->Path;

	smartcard = (SMARTCARD_DEVICE*) calloc(1, sizeof(SMARTCARD_DEVICE));
	if (!smartcard)
		return -1;

	smartcard->device.type = RDPDR_DTYP_SMARTCARD;
	smartcard->device.name = "SCARD";
	smartcard->device.IRPRequest = smartcard_irp_request;
	smartcard->device.Init = smartcard_init;
	smartcard->device.Free = smartcard_free;

	length = strlen(smartcard->device.name);
	smartcard->device.data = Stream_New(NULL, length + 1);
	if (!smartcard->device.data)
		goto error_device_data;

	Stream_Write(smartcard->device.data, "SCARD", 6);

	smartcard->name = NULL;
	smartcard->path = NULL;

	if (path)
	{
		smartcard->path = path;
		smartcard->name = name;
	}
	else if (name)
	{
		if (1 == sscanf(name, "%d", &ck))
			smartcard->path = name;
		else
			smartcard->name = name;
	}

	smartcard->IrpQueue = MessageQueue_New(NULL);
	if (!smartcard->IrpQueue)
		goto error_irp_queue;

	smartcard->CompletedIrpQueue = Queue_New(TRUE, -1, -1);
	if (!smartcard->CompletedIrpQueue)
		goto error_completed_irp_queue;

	smartcard->rgSCardContextList = ListDictionary_New(TRUE);
	if (!smartcard->rgSCardContextList)
		goto error_context_list;

	ListDictionary_ValueObject(smartcard->rgSCardContextList)->fnObjectFree =
			(OBJECT_FREE_FN) smartcard_context_free;

	smartcard->rgOutstandingMessages = ListDictionary_New(TRUE);
	if (!smartcard->rgOutstandingMessages)
		goto error_outstanding_messages;

	smartcard->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) smartcard_thread_func,
			smartcard, CREATE_SUSPENDED, NULL);
	if (!smartcard->thread)
		goto error_thread;

	pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) smartcard);

	ResumeThread(smartcard->thread);

	return 0;

error_thread:
	ListDictionary_Free(smartcard->rgOutstandingMessages);
error_outstanding_messages:
	ListDictionary_Free(smartcard->rgSCardContextList);
error_context_list:
	Queue_Free(smartcard->CompletedIrpQueue);
error_completed_irp_queue:
	MessageQueue_Free(smartcard->IrpQueue);
error_irp_queue:
	Stream_Free(smartcard->device.data, TRUE);
error_device_data:
	free(smartcard);
	return -1;
}


text:
package pkg_Command;

/**
 *
 *
 * @author  Valentin Messias
 * @version 2016.01.15
 */
import pkg_Engine.Player;
import pkg_Item.Beamer;

public class ChargeCommand extends Command
{

    public ChargeCommand()
    {
    } // ChargeCommand()

    @Override
    public boolean execute( final Player pPlayer )
    {
        if ( pPlayer.hasItem( "Beamer" ) ) {
            Beamer vBeamer = (Beamer) pPlayer.getItemList().getItemList().get( "Beamer" );
            vBeamer.setRoom( pPlayer.getCurrentRoom() );
            pPlayer.getGE().getGUI().println( "You charged the current room into the beamer !" );
            return false;
        }
        else {
            pPlayer.getGE().getGUI().println( "You don't have the beamer." );
            return false;
        }
    } // execute(.)
} // ChargeCommand


text:
using System.Diagnostics;

namespace Kentico.Kontent.Delivery.ContentItems.InlineContentItems
{
    /// <summary>
    /// Structure holding identifier of specific richtext element used in content item.
    /// </summary>
    [DebuggerDisplay("Codename = {" + nameof(RichTextElementCodeName) + "}")]
    internal readonly struct RichTextContentElements
    {
        public string ContentItemCodeName { get; }

        public string RichTextElementCodeName { get; }

        public RichTextContentElements(string contentItemCodeName, string richTextElementCodeName)
        {
            RichTextElementCodeName = richTextElementCodeName;
            ContentItemCodeName = contentItemCodeName;
        }
    }
}


text:
package chana.timeseries.indicator

/**
 * Class for defining indicator's factor
 *
 * @author Caoyuan Deng
 * @Note
 * If you use Factor in indicator, please considerate AbstractIndicator#InnerFactor first
 * which will be added to Indicator's factors automatically when new it.
 */
class Factor(
    var name: String,
    var value: Double,
    var step: Double = 1.0,
    var minValue: Double = Double.MinValue,
    var maxValue: Double = Double.MaxValue) extends Cloneable {

  @inline override final def equals(a: Any) = a match {
    case x: Factor => this.value == x.value
    case _         => false
  }

  @inline override final def hashCode = value.hashCode

  /** this should not be abstract method to get scalac knowing it's an override of @cloneable instead of java.lang.Object#clone */
  override def clone: Factor = new Factor(this.name, this.value, this.step, this.minValue, this.maxValue)
}

case object FactorChanged


text:
import '@angular/platform-browser-dynamic';
import '@angular/platform-browser';
import '@angular/core';
import '@angular/router';

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
import 'rxjs/Rx';

import 'jquery/dist/jquery';
import 'bootstrap-sass/assets/javascripts/bootstrap';


text:
SELECT
    COUNT(*) OVER()::NUMERIC AS full_count,
    document.document_id,
    document.created,
    document.updated,
    document.document_title,
    document.status,
    _note.note_id,
    _note.note,
    revision.revision_id,
    revision.revision_created,
    revision.revision_version,
    _user.user_id,
    _user.email_address,
    _user.title,
    _user.first_name,
    _user.last_name,
    _user.institute_id,
    institute.institute_name,
    institute.university_id,
    university.university_name,
    affiliation.affiliation_id,
    course.course_id,
    course.course_name,
    course.year,
    course.term,
    CASE
        WHEN course.term
            THEN CONCAT('WT', course.year, '/', course.year+1)
            ELSE CONCAT('ST', course.year)
        END AS season,
    course.lecturer
FROM Documents document
    JOIN Notes _note ON document.document_id = _note.document_id
    JOIN (
    	SELECT
    		revision_id AS revision_id,
    		created AS revision_created,
    		document_id AS document_id,
    		version AS revision_version
    	FROM Revisions
        WHERE (document_id, version) IN (
            SELECT
                document_id,
                MAX(version)
            FROM Revisions
            GROUP BY document_id
        )
    ) revision ON document.document_id = revision.document_id
    JOIN Users _user ON document.user_id = _user.user_id
    JOIN Institutes institute ON institute.institute_id = _user.institute_id
    JOIN Universities university ON university.university_id = institute.university_id
    LEFT JOIN Affiliations affiliation ON affiliation.document_id = document.document_id
    LEFT JOIN Courses course ON course.course_id = affiliation.course_id
WHERE
    _user.institute_id=$4::INTEGER
ORDER BY
    CASE
        WHEN $3::TEXT='created.asc' THEN document.created END ASC,
    CASE
        WHEN $3::TEXT='created.desc' THEN document.created END DESC,
    CASE
        WHEN $3::TEXT='updated.asc' THEN document.updated END ASC,
    CASE
        WHEN $3::TEXT='updated.desc' THEN document.updated END DESC,
    CASE
        WHEN $3::TEXT='status.asc' THEN document.status END ASC,
    CASE
        WHEN $3::TEXT='status.desc' THEN document.status END DESC,
    CASE
        WHEN $3::TEXT='title.asc' THEN document.document_title END ASC,
    CASE
        WHEN $3::TEXT='title.desc' THEN document.document_title END DESC
OFFSET $1
LIMIT $2;


text:
{% include "header.html" %}

        {{ content }}

{% include "footer.html" %}


text:
namespace pw::system {

// This is the default channel used by the pw_system RPC server. Some other
// parts of pw_system (e.g. logging) use this channel ID as the default
// destination for unrequested data streams.
inline constexpr uint32_t kDefaultRpcChannelId = PW_SYSTEM_DEFAULT_CHANNEL_ID;

rpc::Server& GetRpcServer();

thread::ThreadCore& GetRpcDispatchThread();

}  // namespace pw::system


text:
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.OpenApi.Models;
using Solid.Practices.Modularity;

namespace Samples.Specifications.Server.Api
{
    [UsedImplicitly]
    internal sealed class Module : ICompositionModule<IServiceCollection>
    {
        public void RegisterModule(IServiceCollection dependencyRegistrator) => dependencyRegistrator.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new OpenApiInfo {Title = "My API", Version = "v1"});
            c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath,
                $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"));
        });
    }
}


text:
package org.unitedinternet.cosmo.server;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.unitedinternet.cosmo.model.CollectionItem;
import org.unitedinternet.cosmo.model.FileItem;
import org.unitedinternet.cosmo.model.HomeCollectionItem;
import org.unitedinternet.cosmo.model.Item;
import org.unitedinternet.cosmo.model.User;

/**
 * Aggregates information about a user's usage of storage space.
 */
public class SpaceUsageReport {
    @SuppressWarnings("unused")
    private static final Log LOG = LogFactory.getLog(SpaceUsageReport.class);

    private List<UsageLineItem> lineItems;

    /** */
    public SpaceUsageReport(User user,
                            HomeCollectionItem home) {
        lineItems = new ArrayList<UsageLineItem>();
        addLineItems(home, "/" + user.getUsername());
    }

    /** */
    public List<UsageLineItem> getLineItems() {
        return lineItems;
    }

    private void addLineItems(CollectionItem item,
                              String path) {
        lineItems.add(new UsageLineItem(item, path));
        for (Item child : item.getChildren()) {
            String childPath = path + "/" + child.getName();
            if (child instanceof CollectionItem) {
                addLineItems((CollectionItem) child, childPath);
            }
            else {
                lineItems.add(new UsageLineItem(child, childPath));
            }
        }
    }

    /**
     * Represents usage information for a single item.
     */
    public static class UsageLineItem {

        private Item item;
        private String path;

        /** */
        public UsageLineItem(Item item,
                             String path) {
            this.item = item;
            this.path = path;
        }

        /** */
        public Date getLastAccessed() {
            return item.getModifiedDate();
        }

        /** */
        public Long getSize() {
            if (item instanceof FileItem) {
                return ((FileItem)item).getContentLength();
            }
            return Long.valueOf(0);
        }

        /** */
        public String getPath() {
            return path;
        }

        /** */
        public User getOwner() {
            return item.getOwner();
        }
    }
}


text:
/*!
 * Start Bootstrap - Stylish Portfolio Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

/* Global Styles */

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: "Source Sans Pro","Helvetica Neue",Helvetica,Arial,sans-serif;
}

h1{margin:0 0 20px 0}
h2{font-size:36px}

.text-vertical-center {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

.text-vertical-center h1 {
    margin: 0;
    padding: 0;
    font-size: 4.5em;
    font-weight: 700;
}

/* Custom Button Styles */

.btn-dark {
    color: #fff;
    background-color: rgba(0,0,0,0.4);
}

.btn-dark:hover,
.btn-dark:focus,
.btn-dark:active {
    color: #fff;
    background-color: rgba(0,0,0,0.7);
}

.btn-light {
    color: #333;
    background-color: rgb(255,255,255);
}

.btn-light:hover,
.btn-light:focus,
.btn-light:active {
    color: #333;
    background-color: rgba(255,255,255,0.8);
}

/* Custom Horizontal Rule */

hr.small {
    max-width: 100px;
}

.page {
    padding: 30px 0;
}

/* Services */

.services {
    padding: 50px 0;
}

.service-item {
    margin-bottom: 30px;
}
.about {
    padding: 50px 0;
}
/* Callout */

.callout {
    display: table;
    width: 100%;
    height: 400px;
    color: #fff;
    background: url(../img/bg.jpg) no-repeat center center scroll;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
    text-shadow: 2px 1px 2px rgba(150, 150, 150, 1);
}

/* Portfolio */

.portfolio {
    padding: 50px 0;
}

.portfolio-item {
    margin-bottom: 30px;
}

.img-portfolio {
    margin: 0 auto;
}

.img-portfolio:hover {
    opacity: 0.8;
}

/* Call to Action */

.call-to-action {
    padding: 50px 0;
}

.call-to-action .btn {
    margin: 10px;
}

/* Footer */

footer {
    padding: 3px 0;
}

.navbar-inverse { padding: 10px 0 10px 0;background-color: #fff}
.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>li>a:hover, .navbar-inverse .navbar-nav>li>a:focus { background-color:#fff;border:1px solid #337AB7;border-radius:5px}
.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus { background-color:#fff;border:1px solid #337AB7;border-radius:5px}
.dropdown-menu { background-color: #FFFFFF}
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { background-color: #428BCA}
.navbar-inverse { background-image: none; }
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { background-image: none; }
.navbar-inverse { border-color: #FFFFFF}
.navbar-inverse .navbar-brand { color: #000000;font-size:28px}
.navbar-inverse .navbar-brand:hover { color: #337ab7}
.navbar-inverse .navbar-nav>li>a { color: #999999;margin-left:5px;font-size:16px}
.navbar-inverse .navbar-nav>li>a:hover, .navbar-inverse .navbar-nav>li>a:focus { color: #999999}
.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:hover, .navbar-inverse .navbar-nav>.open>a:focus { color: #999999}
.navbar-inverse .navbar-nav>.active>a:hover, .navbar-inverse .navbar-nav>.active>a:focus { color: #999999}
.dropdown-menu>li>a { color: #333333}
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { color: #999999}
.navbar-inverse .navbar-nav>.dropdown>a .caret { border-top-color: #999999}
.navbar-inverse .navbar-nav>.dropdown>a:hover .caret { border-top-color: #999999}
.navbar-inverse .navbar-nav>.dropdown>a .caret { border-bottom-color: #999999}
.navbar-inverse .navbar-nav>.dropdown>a:hover .caret { border-bottom-color: #999999}


text:
<?php namespace NewsTV\Http\Controllers\Pages;

use NewsTV\Criterias\SearchPostsCriteria;
use NewsTV\Http\Controllers\AbstractController;
use WebEd\Plugins\Blog\Repositories\Contracts\PostRepositoryContract;
use WebEd\Plugins\Blog\Repositories\PostRepository;

class SearchController extends AbstractController
{
    /**
     * @var PostRepository
     */
    protected $repository;

    public function __construct(PostRepositoryContract $repository)
    {
        parent::__construct();

        $this->repository = $repository;

        $this->setPageTitle('Search');
    }

    public function index()
    {
        $k = $this->request->input('k');

        $this->dis['posts'] = $this->repository
            ->pushCriteria(new SearchPostsCriteria($k))
            ->advancedGet([
                'condition' => [
                    webed_db_prefix() . 'posts.status' => 1,
                ],
                'select' => [
                    webed_db_prefix() . 'posts.id',
                    webed_db_prefix() . 'posts.title',
                    webed_db_prefix() . 'posts.slug',
                    webed_db_prefix() . 'posts.description',
                    webed_db_prefix() . 'posts.created_at',
                    webed_db_prefix() . 'posts.thumbnail',
                ],
                'paginate' => [
                    'per_page' => get_theme_option('items_per_page', 9),
                    'current_paged' => ($this->request->input('page') ?: 1),
                ],
            ]);

        return $this->view('front.page-templates.search');
    }
}


text:
//     Copyright (c) Microsoft Corporation.  All rights reserved.

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

namespace Microsoft.Dash.Common.Utils
{
    public static class StorageServiceVersions
    {
        public static readonly DateTimeOffset Version_2009_09_19 = DateTimeOffset.Parse("2009-09-19 +0:00");
        public static readonly DateTimeOffset Version_2011_08_18 = DateTimeOffset.Parse("2011-08-18 +0:00");
        public static readonly DateTimeOffset Version_2012_02_12 = DateTimeOffset.Parse("2012-02-12 +0:00");
        public static readonly DateTimeOffset Version_2013_08_15 = DateTimeOffset.Parse("2013-08-15 +0:00");
        public static readonly DateTimeOffset Version_2014_02_14 = DateTimeOffset.Parse("2014-02-14 +0:00");
        public static readonly DateTimeOffset Version_2015_02_21 = DateTimeOffset.Parse("2015-02-21 +0:00");
        public static readonly DateTimeOffset Version_2015_04_05 = DateTimeOffset.Parse("2015-04-05 +0:00");

        public static string ToVersionString(this DateTimeOffset version)
        {
            return version.ToString("yyyy-MM-dd");
        }
    }
}