text:
package org.zkoss.ztl;

import junit.framework.TestCase;

import com.thoughtworks.selenium.SeleneseTestBase;
import com.thoughtworks.selenium.Selenium;

/**
 * This is a copy of SeleneseTestCase.java and improve the log mechanism.
 * @author jumperchen
 *
 */
public class ZKSeleneseTestCase extends TestCase {

    private ZKSeleneseTestBase stb = new ZKSeleneseTestBase();

    /** Use this object to run all of your selenium tests */
    protected Selenium selenium;

    public ZKSeleneseTestCase() {
        super();
    }

    public ZKSeleneseTestCase(String name) {
        super(name);
    }

    /** Asserts that there were no verification errors during the current test, failing immediately if any are found */
    public void checkForVerificationErrors() {
        stb.checkForVerificationErrors();
    }

    /** Clears out the list of verification errors */
    public void clearVerificationErrors() {
        stb.clearVerificationErrors();
    }

    /** Returns the body text of the current page */
    public String getText() {
        return stb.getText();
    }

    /** Sleeps for the specified number of milliseconds */
    public void pause(int millisecs) {
        stb.pause(millisecs);
    }

    /** Calls this.setUp(null)
     * @see #setUp(String)
     */
    public void setUp() throws Exception {
        stb.setUp();
        selenium = stb.selenium;
    }

    /**
     * Calls this.setUp with the specified url and a default browser.  On Windows, the default browser is *iexplore; otherwise, the default browser is *firefox.
     * @see #setUp(String, String)
     * @param url the baseUrl to use for your Selenium tests
     * @throws Exception
     *
     */
    public void setUp(String url) throws Exception {
        stb.setUp(url);
        selenium = stb.selenium;
    }

    /**
     * Creates a new DefaultSelenium object and starts it using the specified baseUrl and browser string
     * @param url the baseUrl for your tests
     * @param browserString the browser to use, e.g. *firefox
     * @throws Exception
     */
    public void setUp(String url, String browserString) throws Exception {
        stb.setUp(url, browserString);
        selenium = stb.selenium;
    }

    /** checks for verification errors and stops the browser */
    public void tearDown() throws Exception {
        stb.tearDown();
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(boolean arg1, boolean arg2) {
        stb.verifyEquals(arg1, arg2, selenium);
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(String message, boolean arg1, boolean arg2) {
        stb.verifyEquals(message, arg1, arg2, selenium);
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(Object s1, Object s2) {
        stb.verifyEquals(s1, s2, selenium);
    }

    public void verifyContains(String message,String s1,String s2){
		stb.verifyContains(message, s1, s2, selenium);
    }

    public void verifyNotContains(String message,String s1,String s2){
		stb.verifyNotContains(message, s1, s2, selenium);
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(String message, Object s1, Object s2) {
        stb.verifyEquals(message, s1, s2, selenium);
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(String[] s1, String[] s2) {
        stb.verifyEquals(s1, s2, selenium);
    }

    /** Like assertEquals, but fails at the end of the test (during tearDown) */
    public void verifyEquals(String message, String[] s1, String[] s2) {
        stb.verifyEquals(message, s1, s2, selenium);
    }

    /** Like assertFalse, but fails at the end of the test (during tearDown) */
    public void verifyFalse(boolean b) {
        stb.verifyFalse("verification should be false", b, selenium);
    }
    /** Like assertFalse, but fails at the end of the test (during tearDown) */
    public void verifyFalse(String message, boolean b) {
        stb.verifyFalse(message, b, selenium);
    }

    /** Like assertNotEquals, but fails at the end of the test (during tearDown) */
    public void verifyNotEquals(boolean s1, boolean s2) {
        stb.verifyNotEquals(s1, s2, selenium);
    }

    /** Like assertNotEquals, but fails at the end of the test (during tearDown) */
    public void verifyNotEquals(String message, boolean s1, boolean s2) {
        stb.verifyNotEquals(message, s1, s2, selenium);
    }

    /** Like assertNotEquals, but fails at the end of the test (during tearDown) */
    public void verifyNotEquals(Object s1, Object s2) {
        stb.verifyNotEquals(s1, s2, selenium);
    }

    /** Like assertNotEquals, but fails at the end of the test (during tearDown) */
    public void verifyNotEquals(String message, Object s1, Object s2) {
        stb.verifyNotEquals(message, s1, s2, selenium);
    }

    /** Like assertTrue, but fails at the end of the test (during tearDown) */
    public void verifyTrue(boolean b) {
        stb.verifyTrue("verification should be true", b, selenium);
    }

    /** Like assertTrue, but fails at the end of the test (during tearDown) */
    public void verifyTrue(String message, boolean b) {
        stb.verifyTrue(message, b, selenium);
    }

	/**
	 *
	 * Compare number1 and number2 with a tolearant .
	 *
	 * sometimes we will have 1~2px mistake when browser compute the numbers ,
	 * but it's ok in actully , so we add this test method.
	 *
	 * as other verify method , it fails at the end of the test (during tearDown)
	 * @param number1
	 * @param number2
	 * @param tolerant
	 * @author TonyQ
	 */
	public void verifyTolerant(int number1,int number2,int tolerant){
		if(number1 == number2) return;

		if(Math.abs(number1 -  number2) > tolerant){
			verifyEquals(number1,number2);
		}

	}

    /** Like JUnit's Assert.assertEquals, but knows how to compare string arrays */
    public static void assertEquals(Object s1, Object s2) {
        SeleneseTestBase.assertEquals(s1, s2);
    }

    /** Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese */
    public static void assertEquals(String s1, String s2) {
        SeleneseTestBase.assertEquals(s1, s2);
    }

    /** Like JUnit's Assert.assertEquals, but joins the string array with commas, and
     * handles "regexp:" strings like HTML Selenese
     */
    public static void assertEquals(String s1, String[] s2) {
        SeleneseTestBase.assertEquals(s1, s2);
    }

    /** Asserts that two string arrays have identical string contents */
    public static void assertEquals(String[] s1, String[] s2) {
        SeleneseTestBase.assertEquals(s1, s2);
    }

    /** Asserts that two booleans are not the same */
    public static void assertNotEquals(boolean b1, boolean b2) {
        SeleneseTestBase.assertNotEquals(b1, b2);
    }

    /** Asserts that two objects are not the same (compares using .equals()) */
    public static void assertNotEquals(Object obj1, Object obj2) {
        SeleneseTestBase.assertNotEquals(obj1, obj2);
    }

    /** Compares two objects, but handles "regexp:" strings like HTML Selenese
     * @see #seleniumEquals(String, String)
     * @return true if actual matches the expectedPattern, or false otherwise
     */
    public static boolean seleniumEquals(Object expected, Object actual) {
        return SeleneseTestBase.seleniumEquals(expected, actual);
    }

    /** Compares two strings, but handles "regexp:" strings like HTML Selenese
     *
     * @param expectedPattern
     * @param actual
     * @return true if actual matches the expectedPattern, or false otherwise
     */
    public static boolean seleniumEquals(String expected, String actual) {
        return SeleneseTestBase.seleniumEquals(expected, actual);
    }

    /**
     * @deprecated Use {@link #isCaptureScreenShotOnFailure()} instead
     */
    protected boolean isCaptureScreetShotOnFailure() {
        return isCaptureScreenShotOnFailure();
    }

    protected boolean isCaptureScreenShotOnFailure() {
        return stb.isCaptureScreenShotOnFailure();
    }

    protected String runtimeBrowserString() {
        return stb.runtimeBrowserString();
    }

    /**
     * @deprecated Use {@link #setCaptureScreenShotOnFailure(boolean)} instead
     */
    protected void setCaptureScreetShotOnFailure(boolean b) {
        setCaptureScreenShotOnFailure(b);
    }

    protected void setCaptureScreenShotOnFailure(boolean b) {
        stb.setCaptureScreenShotOnFailure(b);
    }

    protected void setTestContext() {
        selenium.setContext(this.getClass().getSimpleName() + "." + getName());
    }

    /**
     * Runs the bare test sequence, capturing a screenshot if a test fails
     * @exception Throwable if any exception is thrown
     */
    // @Override
    public void runBare() throws Throwable {
        if (!isCaptureScreenShotOnFailure()) {
            super.runBare();
            return;
        }
        setUp();
        try {
            runTest();
        } catch (Throwable t) {
            if (selenium != null) {
                String filename = getName() + ".png";
                try {
                    selenium.captureScreenshot(filename);
                    System.err.println("Saved screenshot " + filename);
                } catch (Exception e) {
                    System.err.println("Couldn't save screenshot " + filename + ": " + e.getMessage());
                    e.printStackTrace();
                }
                throw t;
            }
        }
        finally {
            tearDown();
        }
    }

    public String join(String[] array, char c) {
        return stb.join(array, c);
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Java Programming Language</title>

<link rel="stylesheet" type="text/css" href="../../../technotes/css/guide.css" />

Documentation Contents

Java™ Programming Language

The Java™ Programming Language is a general-purpose,
concurrent, strongly typed, class-based object-oriented language.
It is normally compiled to the bytecode instruction set and binary
format defined in the Java Virtual Machine Specification.

Tutorials and Programmer's Guides

The Java
Tutorial

API Enhancements

Enhancements in Java SE
8

Enhancements in Java SE
7

Enhancements in Java SE
6

Enhancements in Java SE
5.0

Enhancements in J2SE
1.4

More Information

Java Language Specification

Generics
by Gilad Bracha.

Copyright
© 1993, 2015, Oracle and/or its affiliates. All rights
reserved.

Contact
Us

redpajama_set_name: RedPajamaGithub


text:
import roslib
roslib.load_manifest('roswww')
import rospy

import socket
import subprocess

import tornado.ioloop
import tornado.web

def run(*args):
    '''run the provided command and return its stdout'''
    args = sum([(arg if type(arg) == list else [arg]) for arg in args], [])
    return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0].strip()

def split_words(text):
    '''return a list of lines where each line is a list of words'''
    return [line.strip().split() for line in text.split('\n')]

def get_packages():
    ''' Find the names and locations of all packages '''
    lines = split_words(run('rospack', 'list'))
    packages = [{ 'name': name, 'path': path } for name, path in lines]
    return packages

class MainHandler(tornado.web.RequestHandler):

    def initialize(self, packages):
        self.packages = packages

    def get(self):
        self.write("
ROS web server successfully started.

Package List
")
        for package in self.packages:
            self.write("
"+package['name']+"
")

def create_webserver(packages):
    handlers = [(r"/", MainHandler, {"packages": packages})]

    for package in packages:
        handler_root = ("/"+package['name']+"/?()", tornado.web.StaticFileHandler, {"path": package['path']+"/www/index.html" })
        handlers.append(handler_root)
        handler = ("/"+package['name']+"/(.*)", tornado.web.StaticFileHandler, {"path": package['path']+"/www", "default_filename": "index.html" })
        handlers.append(handler)

    rospy.loginfo("Webserver initialized for %d packages", len(packages))
    application = tornado.web.Application(handlers)

    return application

def bind_webserver(application):
    """ See if there's a default port, use 80 if not """
    default_port, start_port, end_port = get_webserver_params()

    """ First, we try the default http port 80 """
    bound = bind_to_port(application, default_port)

    if not bound:
        """ Otherwise bind any available port within the specified range """
        bound = bind_in_range(application, start_port, end_port)

    return bound

def get_webserver_params():
    try:
        default_port = rospy.get_param("http/default", 80)
        start_port = rospy.get_param("http/range_start", 8000)
        end_port = rospy.get_param("http/range_end", 9000)
        return (default_port, start_port, end_port)
    except socket.error as err:
        if err.errno == 111:
            # Roscore isn't started or cannot be contacted
            rospy.logwarn("Could not contact ROS master. Is a roscore running? Error: %s", err.strerror)
            return 80, 8000, 9000
        else:
            raise

def start_webserver(application):
    try:
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        rospy.loginfo("Webserver shutting down")

def bind_to_port(application, portno):
    rospy.loginfo("Attempting to start webserver on port %d", portno)
    try:
        application.listen(portno)
        rospy.loginfo("Webserver successfully started on port %d", portno)
    except socket.error as err:
        # Socket exceptions get handled, all other exceptions propagated
        if err.errno==13:
            rospy.logwarn("Insufficient priveliges to run webserver on port %d. Error: %s", portno, err.strerror)
            rospy.loginfo("-- Try re-running as super-user: sudo su; source ~/.bashrc)")
        elif err.errno==98:
            rospy.logwarn("There is already a webserver running on port %d. Error: %s", portno, err.strerror)
            rospy.loginfo("-- Try stopping your web server. For example, to stop apache: sudo /etc/init.d/apache2 stop")
        else:
            rospy.logerr("An error occurred attempting to listen on port %d: %s", portno, err.strerror)
        return False
    return True

def bind_in_range(application, start_port, end_port):
    if (end_port > start_port):
        for i in range(start_port, end_port):
            if bind_to_port(application, i):
                return True
    return False

def run_webserver():
    try:
        packages = get_packages()
        server = create_webserver(packages)
        bound = bind_webserver(server)
        if (bound):
            start_webserver(server)
        else:
            raise Exception()
    except Exception as exc:
        rospy.logerr("Unable to bind webserver.  Exiting.  %s" % exc)

if __name__=='__main__':
    run_webserver()


text:
<!DOCTYPE html>

	<title>Wireframe Sites</title>
	<link rel="stylesheet" type="text/css" href="stylesheets/wireframes.css">
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>

Wireframes

Sound Cloud

Completed with Danny Glover during peer-pairing 4-5-2014

Sound Cloud is a platform for people to share and discover music. 10 years ago, most people listened to music on the radio or from their own personal collections, painstakingly purcased 12 songs at a time or downloaded through virus-ridden platforms like Limewire and Kazaa. The cost of recording provided a barrier to entry for many aspiring artists and limited the music available for public use. As the power of personal computing grew and synthesizers rose in popularity, music evolved to a point where anyone with a Macbook and a little bit of determinatin could produce a song. But how do these aspiring artists connect with people around the world that might be interested in hearing their beats? Enter Sound Cloud.

The main visual challenge facing Sound Cloud is just how to represent and display songs. Most people think of songs as something you hear (not see), but in order to interact with them (comment, navigate through, etc) these songs need a user interface. Sound Cloud solved this by focusing on the song's progress bar, adjusting it's height to represnt various elements of the song. They created individual song pags where they could extend the progress bar to the width of the screen so users can accurately place comments at any second they want. With these elements, Sound Cloud created a UI that was fun and intuitive to use, driving over 40 million registered users to the site.

Whiskey Militia

Whiskey Militia is a great example of a true e-commerce site, offering nothing to users but the current deal-of-the-day and whatever might be listed in their 'private stash' section. Furthermore, they offer soft and hard goods at ridiculously low prices (lower than other websites, seriously). This drives users to visit whiskeymilitia.com only when they are ready to buy, keeping 'window shopping' at a minum and driving sales up up up!

Whiskey Militia's main design challenge is that they only sell one item at a time. Considering what other e-commerce sites smash into one browswer-window (thumbnails, navigation, product sorting, recommened items, etc etc), Whiskey is actually faced with the problem of having too little to show on one screen. For better or worse, Whiskey solves this problem with ads - plastering them all over the screen and expecting their veteran users to ignore them while they begrugingly purchase the latest 60% off snowbaord because it's just too good of a deal to pass up (I now have 7).

New York Times

Completed with Danny Glover during peer-pairing 4-5-2014

The New York Times is a premier news source, offering hundreds if not thousnads of uinique stories per day through the online version of their 160 year-old paper. The NYT attempts to connect people with events and stories that happen all over the world, offering a great deal of free online content in an attempt to drive up subscription services. The main design problem for their home page is the massive amount of text that they need to fit onto one page. In order represent of all their top stories in the space of just one browser width, nytimes.com has to omit pictures and stick to just headlines/synopses. While this could cause the page to look bland, The New York Times does a good job of using white space to separate stories. This spacing keeps keeps articles from flowing into eachother and makes their website resemble the front page of a traditional paper - a familiar site for most readers.

				Back To Index


text:
<?php

namespace Anax\Comment;

/**
 * To attach comments-flow to a page or some content.
 *
 */
class CommentsInSession implements \Anax\DI\IInjectionAware {

    use \Anax\DI\TInjectable;

    /**
     * Add a new comment.
     *
     * @param array $comment with all details.
     *
     * @return void
     */
    public function add($comment, $key = null) {
        $comments = $this->session->get('comments', []);
        $comments[$key][] = $comment;
        $this->session->set('comments', $comments);
    }

    /**
     * Save edited comment.
     *
     * @param array $comment with all details.
     *
     * @return void
     */
    public function saveId($comment, $id = null, $key = null) {
        $comments = $this->session->get('comments', []);
        $comments[$key][$id] = $comment;
        $this->session->set('comments', $comments);
    }

    /**
     * Find and return all comments.
     *
     * @return array with all comments.
     */
    public function findAll($key = null) {
        $comments = $this->session->get('comments', []);
        if (isset($comments[$key]))
            return $comments[$key];
    }

    /**
     * Find and return one comment.
     *
     * @return array with comment.
     */
    public function findId($id = null, $key = null) {
        $comments = $this->session->get('comments', []);
        $comment = $comments[$key][$id];
        return $comment;
    }

    /**
     * Delete all comments in session.
     *
     * @return void
     */
    public function deleteAllSession() {
        $this->session->set('comments', []);
    }

    /**
     * Delete one comment.
     *
     * @return void
     */
    public function deleteAll($key = null) {
        $comments = $this->session->get('comments', []);
        $comments[$key] = [];
        $this->session->set('comments', $comments);
    }

    /**
     * Delete one comment.
     *
     * @return void
     */
    public function deleteId($id = null, $key = null) {
        $comments = $this->session->get('comments', []);
        unset($comments[$key][$id]);
        $this->session->set('comments', $comments);
    }

}


text:
module Azure::ARM::DataLakeAnalytics
  module Models
    #
    # Additional Data Lake Store parameters.
    #
    class AddDataLakeStoreParameters

      include MsRestAzure

      # @return [String] the optional suffix for the Data Lake Store account.
      attr_accessor :suffix

      #
      # Mapper for AddDataLakeStoreParameters class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          required: false,
          serialized_name: 'AddDataLakeStoreParameters',
          type: {
            name: 'Composite',
            class_name: 'AddDataLakeStoreParameters',
            model_properties: {
              suffix: {
                required: false,
                serialized_name: 'properties.suffix',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
from numpy import array
from math import sqrt
# $example off$

from pyspark import SparkContext
# $example on$
from pyspark.mllib.clustering import KMeans, KMeansModel
# $example off$

if __name__ == "__main__":
    sc = SparkContext(appName="KMeansExample")  # SparkContext

    # $example on$
    # Load and parse the data
    data = sc.textFile("data/mllib/kmeans_data.txt")
    parsedData = data.map(lambda line: array([float(x) for x in line.split(' ')]))

    # Build the model (cluster the data)
    clusters = KMeans.train(parsedData, 2, maxIterations=10, initializationMode="random")

    # Evaluate clustering by computing Within Set Sum of Squared Errors
    def error(point):
        center = clusters.centers[clusters.predict(point)]
        return sqrt(sum([x**2 for x in (point - center)]))

    WSSSE = parsedData.map(lambda point: error(point)).reduce(lambda x, y: x + y)
    print("Within Set Sum of Squared Error = " + str(WSSSE))

    # Save and load model
    clusters.save(sc, "target/org/apache/spark/PythonKMeansExample/KMeansModel")
    sameModel = KMeansModel.load(sc, "target/org/apache/spark/PythonKMeansExample/KMeansModel")
    # $example off$

    sc.stop()


text:
Shindo.tests("Fog::Compute[:hp] | volume requests", ['hp', 'compute', 'volumes']) do

  @list_volume_attachments_format = {
    'volumeAttachments' => [{
      'device'   => String,
      'serverId' => Integer,
      'id'       => Integer,
      'volumeId' => Integer
    }]
  }

  @volume_attachment_format = {
    'volumeAttachment' => {
      "volumeId" => Integer,
      "id"       => Integer
    }
  }

  @base_image_id = ENV["BASE_IMAGE_ID"] || 1242

  @server = Fog::Compute[:hp].servers.create(:name => 'fogservoltests', :flavor_id => 100, :image_id => @base_image_id)
  @server.wait_for { ready? }

  tests('success') do
    response = HP[:block_storage].create_volume('fogvoltest', 'fogvoltest desc', 1)
    @volume_id = response.body['volume']['id']
    @device = "\/dev\/sdf"

    HP[:block_storage].volumes.get(@volume_id).wait_for { ready? }
    tests("#attach_volume(#{@server.id}, #{@volume_id}, #{@device}").formats(@volume_attachment_format) do
      Fog::Compute[:hp].attach_volume(@server.id, @volume_id, @device).body
    end

    HP[:block_storage].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking?
    tests("#detach_volume(#{@server.id}, #{@volume_id}").succeeds do
      Fog::Compute[:hp].detach_volume(@server.id, @volume_id)
    end

    HP[:block_storage].volumes.get(@volume_id).wait_for { ready? }
    tests("#list_server_volumes(#{@server.id})").formats(@list_volume_attachments_format) do
      Fog::Compute[:hp].list_server_volumes(@server.id).body
    end

  end

  tests('failure') do

    tests("#list_server_volumes(0)").raises(Fog::Compute::HP::NotFound) do
      Fog::Compute[:hp].list_server_volumes(0)
    end

    tests("#attach_volume(#{@server.id}, 0, #{@device})").raises(Fog::Compute::HP::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:hp].attach_volume(@server.id, 0, @device)
    end

    tests("#attach_volume(0, #{@volume_id}, #{@device})").raises(Fog::Compute::HP::NotFound) do
      Fog::Compute[:hp].attach_volume(0, @volume_id, @device)
    end

    tests("#detach_volume(#{@server.id}, 0)").raises(Fog::Compute::HP::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:hp].detach_volume(@server.id, 0)
    end

    tests("#detach_volume(0, #{@volume_id})").raises(Fog::Compute::HP::NotFound) do
      Fog::Compute[:hp].detach_volume(0, @volume_id)
    end

  end

  HP[:block_storage].delete_volume(@volume_id)
  Fog::Compute[:hp].delete_server(@server.id)

end


text:
#ifndef __I2C_BOOT_H__
#define __I2C_BOOT_H__

/*****************************************************************************
 * FUNCTION:
 * 	init_i2c
 *
 * PURPOSE:
 * 	To do all of the initialization of the I2C interface.   That is why
 * 	this function does not take any values.
 *
 * RETURNS:
 * 	1 - Success
 * 	0 - Error
 ****************************************************************************/
int init_i2c (void);

/*****************************************************************************
 * FUNCTION:
 * 	write_data_i2c
 *
 * PURPOSE:
 * 	To write data out to the I2C device.
 *
 * IN:
 * 	unsigned char slave_address - This is the I2C address of the device.
 *
 * 	unsigned char *data - This is the data to be written to the I2C device
 *
 * IN / OUT:
 * 	unsigned short *size - This is the amount of data when passed to this
 * 		function and holds the number of bytes that were actually
 * 		written when the function returns.
 * RETURNS:
 * 	1 - Success
 * 	0 - Error
 *
 * SPECIAL NOTES:
 * 	This function requires that the I2C driver for the I2C device does
 * 	not send this function more data that the device is able to handle.
 * 	This is mostly only important because we do page based writes and
 * 	hardcoding it into this driver may break other things later.
 ****************************************************************************/
int write_data_i2c (unsigned char slave_address, unsigned char *data,
	       unsigned short *size);

/*****************************************************************************
 * FUNCTION:
 * 	read_data_i2c
 *
 * PURPOSE:
 * 	To read data from the I2C device.
 *
 * IN:
 * 	unsigned char slave_address - This is the I2C address of the device
 *
 * 	unsigned char *address - This is the address to be used inside of the
 * 		I2C device
 *
 * OUT:
 * 	unsigned char *data - This is where the data to be read will be put
 *
 * IN / OUT:
 * 	unsigned short *size - This is the amount of data to be read on input
 * 		and the amount of data read on output
 *
 * RETURNS:
 * 	1 - Success
 * 	0 - Error
 *
 * SPECIAL NOTES:
 * 	This function requires that the I2C driver for the I2C device does
 * 	not send this function more data that the device is able to handle.
 * 	This is mostly only important because we do page based writes and
 * 	hardcoding it into this driver may break other things later.
 ****************************************************************************/
int read_data_i2c (unsigned char slave_address, unsigned char *address,
		unsigned char *data, unsigned short *size);

#endif // __I2C_BOOT_H__


text:
import os
from setuptools import setup, Command
import platform
import sys

CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))

requirements = []
if platform.python_implementation() == "PyPy":
    if sys.pypy_version_info < (2, 6):
        raise RuntimeError(
            "LZCOMP is not compatible with PyPy < 2.6. Please "
            "upgrade PyPy to use this library."
        )
else:
    requirements.append("cffi>=1.1.0")

class TestCommand(Command):
    """ Run all *_test.py scripts in 'tests' folder with the same Python
    interpreter used to run setup.py.
    """

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import subprocess
        import glob

        self.run_command('build')

        test_dir = os.path.join(CURR_DIR, 'tests')
        os.chdir(test_dir)

        for test_script in glob.glob("*_test.py"):
            try:
                subprocess.check_call([sys.executable, test_script])
            except subprocess.CalledProcessError:
                raise SystemExit(1)

def keywords_require_cffi(argv):
    """ This setup.py script uses the setuptools 'setup_requires' feature
    to ensures the cffi package is installed before compiling the extension
    module.
    This function parses the command line arguments to setup.py, and if none
    of these need the cffi module, then it returns an empty dictionary.
    """
    setup_requires_arguments = (
        'build',
        'build_ext',
        'build_clib',
        'install',
        'install_lib',
        'install_headers',
        'bdist',
        'bdist_dumb',
        'bdist_rpm',
        'bdist_wininst',
        'upload',
        'develop',
        'test',
        'bdist_wheel',
        'bdist_egg',
    )

    if any(argv[i] in setup_requires_arguments for i in range(1, len(argv))):
        return {
            "setup_requires": requirements,
            "cffi_modules": [
                "cffi/build_lzcomp.py:ffi",
            ]
        }
    else:
        return {}

setup(
    name="lzcomp",
    version='0.1',
    url="https://github.com/google/brotli",
    description="Python binding of the LZCOMP compression library",
    author="Cosimo Lupo",
    author_email="cosimo.lupo@daltonmaag.com",
    license="Apache 2.0",
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: MacOS :: MacOS X',
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX :: Linux',
        'Programming Language :: C',
        'Programming Language :: C++',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Unix Shell',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Topic :: System :: Archiving',
        'Topic :: System :: Archiving :: Compression',
        'Topic :: Text Processing :: Fonts',
        'Topic :: Utilities',
        ],
    package_dir={"": "Lib"},
    packages=['lzcomp'],

    tests_require=requirements,
    install_requires=requirements,

    zip_safe=False,
    entry_points={
        'console_scripts': ["lzcomp = lzcomp.cli:main"]
        },
    cmdclass={
        "test": TestCommand,
        },
    **keywords_require_cffi(sys.argv)
)


text:
using System;

namespace SmeshLink.Misty.Entity
{
    /// <summary>
    /// Represents a unit.
    /// </summary>
    public class Unit
    {
        private String _label;
        private String _symbol;
        private String _type;

        /// <summary>
        /// Gets or sets the unit of this feed, e.g. Celsius.
        /// </summary>
        public String Label
        {
            get { return _label; }
            set { _label = value; }
        }

        /// <summary>
        /// Gets or sets the unit type of this feed.
        /// </summary>
        public String Type
        {
            get { return _type; }
            set { _type = value; }
        }

        /// <summary>
        /// Gets or sets the unit symbol of this feed, e.g. C.
        /// </summary>
        public String Symbol
        {
            get { return _symbol; }
            set { _symbol = value; }
        }
    }
}


text:
namespace metrics {
namespace switches {

// Forces metrics reporting to be enabled. Should not be used for tests as it
// will send data to servers.
const char kForceEnableMetricsReporting[] = "force-enable-metrics-reporting";

// Enables the recording of metrics reports but disables reporting. In contrast
// to kForceEnableMetricsReporting, this executes all the code that a normal
// client would use for reporting, except the report is dropped rather than sent
// to the server. This is useful for finding issues in the metrics code during
// UI and performance tests.
const char kMetricsRecordingOnly[] = "metrics-recording-only";

// Override the standard time interval between each metrics report upload for
// UMA and UKM. It is useful to set to a short interval for debugging. Unit in
// seconds. (The default is 1800 seconds on desktop).
const char kMetricsUploadIntervalSec[] = "metrics-upload-interval";

// Forces a reset of the one-time-randomized FieldTrials on this client, also
// known as the Chrome Variations state.
const char kResetVariationState[] = "reset-variation-state";

// Overrides the URL of the server that UKM reports are uploaded to. This can
// only be used in debug builds.
const char kUkmServerUrl[] = "ukm-server-url";

// Overrides the URL of the server that UMA reports are uploaded to. This can
// only be used in debug builds.
const char kUmaServerUrl[] = "uma-server-url";

// Overrides the URL of the server that UMA reports are uploaded to when the
// connection to the default secure URL fails (see |kUmaServerUrl|). This can
// only be used in debug builds.
const char kUmaInsecureServerUrl[] = "uma-insecure-server-url";

}  // namespace switches

bool IsMetricsRecordingOnlyEnabled() {
  return base::CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kMetricsRecordingOnly);
}

bool IsMetricsReportingForceEnabled() {
  return base::CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kForceEnableMetricsReporting);
}

void EnableMetricsRecordingOnlyForTesting(base::CommandLine* command_line) {
  DCHECK(command_line != nullptr);
  if (!command_line->HasSwitch(switches::kMetricsRecordingOnly))
    command_line->AppendSwitch(switches::kMetricsRecordingOnly);
}

void ForceEnableMetricsReportingForTesting(base::CommandLine* command_line) {
  DCHECK(command_line != nullptr);
  if (!command_line->HasSwitch(switches::kForceEnableMetricsReporting))
    command_line->AppendSwitch(switches::kForceEnableMetricsReporting);
}

}  // namespace metrics


text:
<?php
namespace AmbuShiftBundle\ViewModel;

use AmbuShiftBundle\Entity\User;
use AmbuShiftBundle\Entity\Month;

class HomeViewModel
{
    const DATETIMEFORMAT = "d-m-Y H:i:s";

    private $shifts;
    private $user;

    public function __construct(array $shifts, User $user)
    {
        $this->shifts = $shifts;
        $this->user = $user;
    }

    public function shifts()
    {
        $shifts = [];

        foreach($this->shifts as $shift)
        {
            $shifts[] =
            [
                "from"          => $shift->getFrom()->format(self::DATETIMEFORMAT),
                "to"            => $shift->getTo()->format("H:i:s"),
                "vehicle"       => $shift->getVehicle()->getDescription(),
                "crewPosition"  => $shift->getShiftWorkerForUser($this->user)->getCrewPosition()->getDescription()
            ];
        }

        return $shifts;
    }
}


text:
struct longlong {
	uint32_t low;
	uint32_t hi;
};

int _pbcV_encode32(uint32_t number, uint8_t buffer[10]);
int _pbcV_encode(uint64_t number, uint8_t buffer[10]);
int _pbcV_zigzag32(int32_t number, uint8_t buffer[10]);
int _pbcV_zigzag(int64_t number, uint8_t buffer[10]);

int _pbcV_decode(uint8_t buffer[10], struct longlong *result);
void _pbcV_dezigzag64(struct longlong *r);
void _pbcV_dezigzag32(struct longlong *r);

#endif


text: load File.join(File.dirname(__FILE__), 'tasks', 'multi_customers.rb')


text:
import { Action } from '@ngrx/store';
import { type } from '../../../util';

/**
 * For each action type in an action group, make a simple
 * enum object for all of this group's action types.
 *
 * The 'type' utility function coerces strings into string
 * literal types and runs a simple check to guarantee all
 * action types in the application are unique.
 */
export const ActionTypes = {
  OPEN:           type('[Header] Open Navigation'),
  CLOSE:  type('[Header] Close Navigation'),
  FETCH_COUNT_CREATED:  type('[Header] Fetch count created'),
  FETCH_COUNT_SUBSCRIBED:  type('[Header] Fetch count subscribed'),
  FETCH_COUNT_APPROVE:  type('[Header] Fetch count approve'),
  COUNT_SUBSCRIBED:  type('[Header] Count subscribed'),
  COUNT_CREATED:  type('[Header] Count created'),
  COUNT_APPROVE:  type('[Header] Count approve'),
};

export class OpenNavigation implements Action {
  type = ActionTypes.OPEN;

  constructor() {}
}

export class CloseNavigation implements Action {
  type = ActionTypes.CLOSE;

  constructor() {}
}

export class FetchCountCreated implements Action {
  type = ActionTypes.FETCH_COUNT_CREATED;

  constructor() {}
}

export class FetchCountSubscribed implements Action {
  type = ActionTypes.FETCH_COUNT_SUBSCRIBED;

  constructor() {}
}

export class FetchCountApproved implements Action {
  type = ActionTypes.FETCH_COUNT_APPROVE;

  constructor() {}
}

export class CountCreatedChange implements Action {
  type = ActionTypes.COUNT_CREATED;

  constructor(public payload: number) {}
}

export class CountSubscribedChange implements Action {
  type = ActionTypes.COUNT_SUBSCRIBED;

  constructor(public payload: number) {}
}

export class CountApproveChange implements Action {
  type = ActionTypes.COUNT_APPROVE;

  constructor(public payload: number) {}
}


text:
import { intoView } from './intoView'

const MOCK_ID = 'mockId'

it('scrollIntoView を実行できる', async () => {
  let result: boolean = false

  const mockDiv: any = document.createElement('div')
  mockDiv.scrollIntoViewIfNeeded = () => (result = true)

  document.getElementById = () => mockDiv

  intoView(MOCK_ID)
  expect(result).toBeTruthy()
})

it('DOMを取得できなかったら scrollIntoView は実行されない', async () => {
  let result: boolean = false

  const mockDiv: any = document.createElement('div')
  mockDiv.scrollIntoViewIfNeeded = () => (result = true)

  document.getElementById = () => null

  intoView(MOCK_ID)
  expect(result).toBeFalsy()
})

it('scrollIntoViewIfNeeded がそもそも実行できないブラウザでもエラーにはならない', async () => {
  const mockDiv: any = document.createElement('div')
  mockDiv.scrollIntoViewIfNeeded = undefined
  document.getElementById = () => mockDiv
  intoView(MOCK_ID)
})


text:
<?php

namespace Pterodactyl\Http\Requests\Api\Client\Servers\Databases;

use Pterodactyl\Models\Permission;
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;

class DeleteDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest
{
    public function permission(): string
    {
        return Permission::ACTION_DATABASE_DELETE;
    }
}


text:
var sl = require('sugarlisp-core/sl-types');
var match = require('sugarlisp-match/pattern-match');
var reader = require('sugarlisp-core/reader');

function testMatch(forms) {
  return match(forms, function(when) {
    when([
        function(sym) {
          return sym.value === "function";
        },
        match.var("fname", match.slsymbol),
        match.var("fargs", match.sllist)
      ],
      function(vars) {
        return (function(fname, fargs, fbody) {
          console.log(["Was: function ", fname, "(", fargs, ") (", fbody, ")"].join(''));
        }).call(this, vars["fname"], vars["fargs"], vars["_rest"]);
      }, this);
    when([
        function(sym) {
          return sym.value === "function";
        },
        match.var("fargs", match.sllist)
      ],
      function(vars) {
        return (function(fargs, fbody) {
          console.log(["Was: Anonymous function (", fargs, ") (", fbody, ")"].join(''));
        }).call(this, vars["fargs"], vars["_rest"]);
      }, this);
    when([
        match.var("any", match.sldefault)
      ],
      function(vars) {
        return (function(any) {
          console.log("No match!");
        }).call(this, vars["any"]);
      }, this);
  }, this);

}

var src = '(function add(x y) (+ x y))';
var forms = reader.read_from_source(src, 'testReader.slisp');
console.log(["\n ", sl.pprintSEXP(forms[0].toJSON(), {
  bareSymbols: true
}), "\n"].join(''));
testMatch(forms[0]);
src = '(function (x y) (+ x y))';
forms = reader.read_from_source(src, 'testReader.slisp');
console.log(["\n ", sl.pprintSEXP(forms[0].toJSON(), {
  bareSymbols: true
}), "\n"].join(''));
testMatch(forms[0]);


text:
package com.ph1ash.dexter.beeplepaper;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * Created by dexter on 1/31/16.
 */
public class BootUpReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent)
    {
        Intent i = new Intent(context, BeeplePaperService.class);
        context.startService(i);
    }
}


text:
<?php

namespace LinkShrink\Exception;

class InvalidCredentials extends \RuntimeException implements Exception
{

}


text:
(function($) {

  Sammy = Sammy || {};

  // <tt>Sammy.Mustache</tt> provides a quick way of using mustache style templates in your app.
  // The plugin wraps the awesome mustache.js lib created and maintained by Jan Lehnardt
  // at http://github.com/janl/mustache.js
  //
  // Note: As of Sammy 0.7 the Mustache lib is not included in the templates source. Please download
  // mustache.js and include it before Sammy.Mustache.
  //
  // Mustache is a clever templating system that relys on double brackets {{}} for interpolation.
  // For full details on syntax check out the original Ruby implementation created by Chris Wanstrath at
  // http://github.com/defunkt/mustache
  //
  // By default using Sammy.Mustache in your app adds the <tt>mustache()</tt> method to the EventContext
  // prototype. However, just like <tt>Sammy.Template</tt> you can change the default name of the method
  // by passing a second argument (e.g. you could use the ms() as the method alias so that all the template
  // files could be in the form file.ms instead of file.mustache)
  //
  // ### Example #1
  //
  // The template (mytemplate.ms):
  //
  //
\{\{title\}\}

  //
  //       Hey, {{name}}! Welcome to Mustache!
  //
  // The app:
  //
  //       var $.app = $.sammy(function() {
  //         // include the plugin and alias mustache() to ms()
  //         this.use('Mustache', 'ms');
  //
  //         this.get('#/hello/:name', function() {
  //           // set local vars
  //           this.title = 'Hello!'
  //           this.name = this.params.name;
  //           // render the template and pass it through mustache
  //           this.partial('mytemplate.ms');
  //         });
  //
  //       });
  //
  // If I go to #/hello/AQ in the browser, Sammy will render this to the <tt>body</tt>:
  //
  //
Hello!

  //
  //       Hey, AQ! Welcome to Mustache!
  //
  //
  // ### Example #2 - Mustache partials
  //
  // The template (mytemplate.ms)
  //
  //       Hey, {{name}}! {{>hello_friend}}
  //
  //
  // The partial (mypartial.ms)
  //
  //       Say hello to your friend {{friend}}!
  //
  // The app:
  //
  //       var $.app = $.sammy(function() {
  //         // include the plugin and alias mustache() to ms()
  //         this.use('Mustache', 'ms');
  //
  //         this.get('#/hello/:name/to/:friend', function() {
  //           var context = this;
  //
  //           // fetch mustache-partial first
  //           $.get('mypartial.ms', function(response){
  //             context.partials = response;
  //
  //             // set local vars
  //             context.name = this.params.name;
  //             context.hello_friend = {name: this.params.friend};
  //
  //             // render the template and pass it through mustache
  //             context.partial('mytemplate.ms');
  //           });
  //         });
  //
  //       });
  //
  // If I go to #/hello/AQ/to/dP in the browser, Sammy will render this to the <tt>body</tt>:
  //
  //       Hey, AQ! Say hello to your friend dP!
  //
  // Note: You dont have to include the mustache.js file on top of the plugin as the plugin
  // includes the full source.
  //
  Sammy.Mustache = function(app, method_alias) {

    // *Helper* Uses Mustache.js to parse a template and interpolate and work with the passed data
    //
    // ### Arguments
    //
    // * `template` A String template. {{}} Tags are evaluated and interpolated by Mustache.js
    // * `data` An Object containing the replacement values for the template.
    //   data is extended with the <tt>EventContext</tt> allowing you to call its methods within the template.
    // * `partials` An Object containing one or more partials (String templates
    //   that are called from the main template).
    //
    var mustache = function(template, data, partials) {
      data     = $.extend({}, this, data);
      partials = $.extend({}, data.partials, partials);
      return Mustache.to_html(template, data, partials);
    };

    // set the default method name/extension
    if (!method_alias) { method_alias = 'mustache'; }
    app.helper(method_alias, mustache);
  };

})(jQuery);


text:
define(function(require) {
  'use strict';

  var UpdateStreamusView = require('foreground/view/dialog/updateStreamusView');
  var viewTestUtility = require('test/foreground/view/viewTestUtility');

  describe('UpdateStreamusView', function() {
    beforeEach(function() {
      this.documentFragment = document.createDocumentFragment();
      this.view = new UpdateStreamusView();
    });

    afterEach(function() {
      this.view.destroy();
    });

    viewTestUtility.ensureBasicAssumptions.call(this);
  });
});


text:
require "image_benchmarks/version"
require "fileutils"
require "RMagick"
require "mini_magick"
require "image_science"

module ImageBenchmarks
  class RMagickResizer
    def resize(file, sizes)
      name = File.basename(file)
      img = Magick::Image.read(file).first
      resized_imgs = sizes.each do |w, h|
        new_img = img.resize_to_fill(w, h)
        output_dir = File.join("target", "rmagick", "#{w}x#{h}")
        FileUtils.mkdir_p(output_dir)
        output = File.join(output_dir, name)
        new_img.write(output)
      end
    end
  end

  class MinimagickResizer
    def resize(file, sizes)
      name = File.basename(file)
      sizes.each do |w, h|
        img = MiniMagick::Image.open(file)

        img.resize("#{w}x#{h}^")

        output_dir = File.join("target", "minimagick", "#{w}x#{h}")
        FileUtils.mkdir_p(output_dir)
        output = File.join(output_dir, name)
        img.write(output)
      end
    end
  end

  class ImageScienceResizer
    def resize(file, sizes)
      name = File.basename(file)
      sizes.each do |w, h|
        output_dir = File.join("target", "image_science", "#{w}x#{h}")
        FileUtils.mkdir_p(output_dir)
        big, small = w > h ? [w, h] : [h, w]
        l = ((big - w).to_f / 2).round
        r = w + ((big - w).to_f / 2).round
        t = ((big - h).to_f / 2).round
        b = h + ((big - h).to_f / 2).round

        ImageScience.with_image(file) do |img|
          output = File.join(output_dir, name)
          img.thumbnail(big) do |img2|
            img2.with_crop(l, t, r, b) do |img3|
              img3.save output
            end
          end
        end
      end
    end
  end
end


text:
import lombok.Data;

@Data(staticConstructor="of")
public class DataStaticConstructor2 {
  private int privateInt;
  private final int privateFinalInt;

  // Custom private constructor
  private DataStaticConstructor2(int privateFinalInt) {
    this.privateInt = 5;
    this.privateFinalInt = privateFinalInt;
  }

  public static void main(String[] args) {
    final DataStaticConstructor2 test = new DataStaticConstructor2.of();
    System.out.println(test);
  }
}


text:
package com.jetbrains.python;

import com.intellij.psi.PsiElement;
import com.jetbrains.python.psi.types.TypeEvalContext;
import org.jetbrains.annotations.Nullable;

/**
 * Reference that may be resolved differently (i.e use better {@link TypeEvalContext}) when resolved by user request
 * @author Ilya.Kazakevich
 */
@FunctionalInterface
public interface PyUserInitiatedResolvableReference {
  @Nullable
  PsiElement userInitiatedResolve();
}


text:
<core:FragmentDefinition
		id="customFragment"
		xmlns="sap.m"
		xmlns:core="sap.ui.core">
		<Text id="EP5_FRAGMENT_TEXT_ID" text="{Name}" />
</core:FragmentDefinition>


text:
#pragma once
#include <aws/elastictranscoder/ElasticTranscoder_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace ElasticTranscoder
{
namespace Model
{

  /**
   *
The PlayReady DRM settings, if any, that you want Elastic Transcoder to apply
   * to the output files associated with this playlist.

PlayReady DRM encrypts
   * your media files using aes-ctr encryption.

If you use DRM
   * for an HLSv3 playlist, your outputs must have a master
   * playlist.

See Also:
   AWS
   * API Reference

   */
  class AWS_ELASTICTRANSCODER_API PlayReadyDrm
  {
  public:
    PlayReadyDrm();
    PlayReadyDrm(Aws::Utils::Json::JsonView jsonValue);
    PlayReadyDrm& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline const Aws::String& GetFormat() const{ return m_format; }

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline bool FormatHasBeenSet() const { return m_formatHasBeenSet; }

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline void SetFormat(const Aws::String& value) { m_formatHasBeenSet = true; m_format = value; }

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline void SetFormat(Aws::String&& value) { m_formatHasBeenSet = true; m_format = std::move(value); }

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline void SetFormat(const char* value) { m_formatHasBeenSet = true; m_format.assign(value); }

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline PlayReadyDrm& WithFormat(const Aws::String& value) { SetFormat(value); return *this;}

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline PlayReadyDrm& WithFormat(Aws::String&& value) { SetFormat(std::move(value)); return *this;}

    /**
     *
The type of DRM, if any, that you want Elastic Transcoder to apply to the
     * output files associated with this playlist.

     */
    inline PlayReadyDrm& WithFormat(const char* value) { SetFormat(value); return *this;}

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline const Aws::String& GetKey() const{ return m_key; }

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; }

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; }

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); }

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); }

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline PlayReadyDrm& WithKey(const Aws::String& value) { SetKey(value); return *this;}

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline PlayReadyDrm& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;}

    /**
     *
The DRM key for your file, provided by your DRM license provider. The key
     * must be base64-encoded, and it must be one of the following bit lengths before
     * being base64-encoded:

 128, 192, or
     * 256.

The key must also be encrypted by using AWS KMS.

     */
    inline PlayReadyDrm& WithKey(const char* value) { SetKey(value); return *this;}

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline const Aws::String& GetKeyMd5() const{ return m_keyMd5; }

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline bool KeyMd5HasBeenSet() const { return m_keyMd5HasBeenSet; }

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline void SetKeyMd5(const Aws::String& value) { m_keyMd5HasBeenSet = true; m_keyMd5 = value; }

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline void SetKeyMd5(Aws::String&& value) { m_keyMd5HasBeenSet = true; m_keyMd5 = std::move(value); }

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline void SetKeyMd5(const char* value) { m_keyMd5HasBeenSet = true; m_keyMd5.assign(value); }

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline PlayReadyDrm& WithKeyMd5(const Aws::String& value) { SetKeyMd5(value); return *this;}

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline PlayReadyDrm& WithKeyMd5(Aws::String&& value) { SetKeyMd5(std::move(value)); return *this;}

    /**
     *
The MD5 digest of the key used for DRM on your file, and that you want
     * Elastic Transcoder to use as a checksum to make sure your key was not corrupted
     * in transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes
     * before being base64-encoded.

     */
    inline PlayReadyDrm& WithKeyMd5(const char* value) { SetKeyMd5(value); return *this;}

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline const Aws::String& GetKeyId() const{ return m_keyId; }

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline bool KeyIdHasBeenSet() const { return m_keyIdHasBeenSet; }

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline void SetKeyId(const Aws::String& value) { m_keyIdHasBeenSet = true; m_keyId = value; }

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline void SetKeyId(Aws::String&& value) { m_keyIdHasBeenSet = true; m_keyId = std::move(value); }

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline void SetKeyId(const char* value) { m_keyIdHasBeenSet = true; m_keyId.assign(value); }

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline PlayReadyDrm& WithKeyId(const Aws::String& value) { SetKeyId(value); return *this;}

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline PlayReadyDrm& WithKeyId(Aws::String&& value) { SetKeyId(std::move(value)); return *this;}

    /**
     *
The ID for your DRM key, so that your DRM license provider knows which key to
     * provide.

The key ID must be provided in big endian, and Elastic
     * Transcoder converts it to little endian before inserting it into the PlayReady
     * DRM headers. If you are unsure whether your license server provides your key ID
     * in big or little endian, check with your DRM provider.

     */
    inline PlayReadyDrm& WithKeyId(const char* value) { SetKeyId(value); return *this;}

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline const Aws::String& GetInitializationVector() const{ return m_initializationVector; }

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline bool InitializationVectorHasBeenSet() const { return m_initializationVectorHasBeenSet; }

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline void SetInitializationVector(const Aws::String& value) { m_initializationVectorHasBeenSet = true; m_initializationVector = value; }

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline void SetInitializationVector(Aws::String&& value) { m_initializationVectorHasBeenSet = true; m_initializationVector = std::move(value); }

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline void SetInitializationVector(const char* value) { m_initializationVectorHasBeenSet = true; m_initializationVector.assign(value); }

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline PlayReadyDrm& WithInitializationVector(const Aws::String& value) { SetInitializationVector(value); return *this;}

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline PlayReadyDrm& WithInitializationVector(Aws::String&& value) { SetInitializationVector(std::move(value)); return *this;}

    /**
     *
The series of random bits created by a random bit generator, unique for every
     * encryption operation, that you want Elastic Transcoder to use to encrypt your
     * files. The initialization vector must be base64-encoded, and it must be exactly
     * 8 bytes long before being base64-encoded. If no initialization vector is
     * provided, Elastic Transcoder generates one for you.

     */
    inline PlayReadyDrm& WithInitializationVector(const char* value) { SetInitializationVector(value); return *this;}

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline const Aws::String& GetLicenseAcquisitionUrl() const{ return m_licenseAcquisitionUrl; }

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline bool LicenseAcquisitionUrlHasBeenSet() const { return m_licenseAcquisitionUrlHasBeenSet; }

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline void SetLicenseAcquisitionUrl(const Aws::String& value) { m_licenseAcquisitionUrlHasBeenSet = true; m_licenseAcquisitionUrl = value; }

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline void SetLicenseAcquisitionUrl(Aws::String&& value) { m_licenseAcquisitionUrlHasBeenSet = true; m_licenseAcquisitionUrl = std::move(value); }

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline void SetLicenseAcquisitionUrl(const char* value) { m_licenseAcquisitionUrlHasBeenSet = true; m_licenseAcquisitionUrl.assign(value); }

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline PlayReadyDrm& WithLicenseAcquisitionUrl(const Aws::String& value) { SetLicenseAcquisitionUrl(value); return *this;}

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline PlayReadyDrm& WithLicenseAcquisitionUrl(Aws::String&& value) { SetLicenseAcquisitionUrl(std::move(value)); return *this;}

    /**
     *
The location of the license key required to play DRM content. The URL must be
     * an absolute path, and is referenced by the PlayReady header. The PlayReady
     * header is referenced in the protection header of the client manifest for Smooth
     * Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
     * HLS playlist outputs. An example URL looks like this:
     * https://www.example.com/exampleKey/

     */
    inline PlayReadyDrm& WithLicenseAcquisitionUrl(const char* value) { SetLicenseAcquisitionUrl(value); return *this;}

  private:

    Aws::String m_format;
    bool m_formatHasBeenSet = false;

    Aws::String m_key;
    bool m_keyHasBeenSet = false;

    Aws::String m_keyMd5;
    bool m_keyMd5HasBeenSet = false;

    Aws::String m_keyId;
    bool m_keyIdHasBeenSet = false;

    Aws::String m_initializationVector;
    bool m_initializationVectorHasBeenSet = false;

    Aws::String m_licenseAcquisitionUrl;
    bool m_licenseAcquisitionUrlHasBeenSet = false;
  };

} // namespace Model
} // namespace ElasticTranscoder
} // namespace Aws


text:
var keystone = require('keystone'),
	Types = keystone.Field.Types;

/**
 * Achievement Model
 * ===========
 */

 // Ideas
 //
 // - winning/losing streak of 5|10|20
 // - played on your birthday
 // - played for 5 days straight
 // - played 10 games in one day
 // - finished a game in under 5mins

var Achievement = new keystone.List('Achievement', {
	autokey: { path: 'key', from: 'name', unique: true },
	track: true
});

Achievement.add({
	// dateAchieved: { type: Types.Date }, // there should probably be PlayerAchievement model to join these together
	name: { type: Types.Name, required: true, index: true },
	value: { type: Number, required: true, index: true, initial: true },
	notes: { type: Types.Textarea }
});

Achievement.defaultColumns = 'name, value';

Achievement.register();


text:
package kz.epam.zd.util;

import kz.epam.zd.exception.PropertyManagerException;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Utility class to manage properties through property files.
 */
public class PropertyManager {

    private Properties properties;

    public PropertyManager(String propertyFile) throws PropertyManagerException {
        try (InputStream in = PropertyManager.class.getClassLoader().getResourceAsStream(propertyFile)) {
            if (in != null) {
                properties = new Properties();
                properties.load(in);
            }
        } catch (IOException e) {
            throw new PropertyManagerException(e);
        }
    }

    public String getPropertyKey(String key) throws PropertyManagerException {
        if (properties == null) throw new PropertyManagerException("Couldn't load properties.");
        return properties.getProperty(key);
    }

    public Properties getProperties() {
        return properties;
    }
}


text:
  <task-monitor monitor="taskMonitor"></task-monitor>
  <form role="form">
    <modal-close></modal-close>

Resize {{serverGroup.name}}

          <reservation-report account="serverGroup.account"
                              region="serverGroup.region"
                              zones="serverGroup.asg.availabilityZones"
                              instance-type="serverGroup.launchConfig.instanceType"></reservation-report>

      <aws-resize-capacity command="command" current-size="currentSize"></aws-resize-capacity>

          <platform-health-override command="command"
                                    platform-health-type="'Amazon'"
                                    show-help-details="true"
                                    field-columns="12">
          </platform-health-override>

      <aws-resize-verification account="serverGroup.account" verification="verification"></aws-resize-verification>

    <aws-resize-footer resize="ctrl.resize()" cancel="ctrl.cancel()" is-valid="ctrl.isValid()"></aws-resize-footer>
  </form>


text:
@(u: User, info: lila.app.mashup.UserInfo, games: Paginator[Game], filters: lila.app.mashup.GameFilterMenu, searchForm: Form[_], rel: Option[lila.relation.Relation], notes: List[lila.user.Note], followable: Boolean, blocked: Boolean)(implicit ctx: Context)

@import lila.rating.PerfType

@title = @{ s"${u.username} : ${userGameFilterTitleNoTag(info, filters.current)}${if(games.currentPage == 1) "" else " - page " + games.currentPage}" }

@searchUrl = @{ routes.User.showFilter(u.username, "search") }

@evenMoreJs = {
@if(!u.lame || ctx.is(u) || isGranted(_.UserSpy)) {
@if(filters.current.name == "search") {
@jsTag("search.js")
@jsTag("vendor/jquery.infinitescroll.min.js")
}
@jsTagCompiled("chart2.js")
@info.ratingChart.map { ratingChart =>
@embedJs(s"var lichess_rating_series = $ratingChart;")
}
}
}

@showPerf(perf: lila.rating.Perf, perfType: PerfType, name: Option[String] = none) = {

    @if(lila.rating.PerfType.nonGame.contains(perfType)) {
    @name.getOrElse(perfType.name).toUpperCase
    } else {

      @name.getOrElse(perfType.name).toUpperCase

    }

    @perf.glicko.intRating@if(perf.provisional){?}
    / @perf.nb.localize @if(perfType.key == "puzzle") {@trans.puzzles()} else {@trans.games()}
    @showProgress(perf.progress)

    @info.ranks.get(perfType.key).map { rank =>
    Rank: @rank.localize@nth(rank)
    }

}

@side = {

  @if(!u.lame || ctx.is(u) || isGranted(_.UserSpy)) {
  @showPerf(u.perfs.bullet, PerfType.Bullet)
  @showPerf(u.perfs.blitz, PerfType.Blitz)
  @showPerf(u.perfs.classical, PerfType.Classical)
  @showPerf(u.perfs.correspondence, PerfType.Correspondence)

  @if(u.perfs.chess960.nonEmpty) {
  @showPerf(u.perfs.chess960, PerfType.Chess960)
  }
  @if(u.perfs.kingOfTheHill.nonEmpty) {
  @showPerf(u.perfs.kingOfTheHill, PerfType.KingOfTheHill)
  }
  @if(u.perfs.threeCheck.nonEmpty) {
  @showPerf(u.perfs.threeCheck, PerfType.ThreeCheck)
  }
  @if(u.perfs.antichess.nonEmpty) {
  @showPerf(u.perfs.antichess, PerfType.Antichess)
  }
  @if(u.perfs.atomic.nonEmpty) {
  @showPerf(u.perfs.atomic, PerfType.Atomic)
  }
  @if(u.perfs.horde.nonEmpty) {
  @showPerf(u.perfs.horde, PerfType.Horde)
  }

  }
  @showPerf(u.perfs.puzzle, PerfType.Puzzle)
  @showPerf(u.perfs.opening, PerfType.Opening)

}

@user.layout(
title = title,
side = side.some,
robots = false,
evenMoreJs = evenMoreJs,
openGraph = lila.app.ui.OpenGraph(
image = staticUrl("images/large_tile.png").some,
title = u.titleUsernameWithBestRating,
url = s"$netBaseUrl${routes.User.show(u.username).url}",
description = describeUser(u)).some) {

    @info.allTrophies.map { trophy =>

      href="@url"
      } class="trophy award @trophy.kind.key @trophy.kind.klass hint--left" data-hint="@trophy.kind.name">
      @trophy.kind match {
      case lila.user.Trophy.Kind.ZugMiracle => {

      }
      case _ => {

      }
      }

    }
    @if(u.perfs.puzzle.nb >= 10000) {

    }
    @if(!u.lame) {
    @info.ranks.map {
    case (perf, rank) if rank == 1 => {

    }
    case (perf, rank) if rank <= 10 => {

    }
    case (perf, rank) if rank <= 50 => {

    }
    case (perf, rank) if rank <= 100 => {

    }
    case _ => {}
    }
    }

 @u.titleUsername

    @if(u.disabled) {
    CLOSED
    }

    @splitNumber(trans.nbFollowing(info.nbFollowing))
    @splitNumber(trans.nbFollowers(info.nbFollowers))
    @info.nbBlockers.map { nb =>
    @splitNumber(nb + " Blockers")
    }
    @splitNumber(u.toints + " " + trans.tournamentPoints())
    @splitNumber(trans.nbForumPosts(info.nbPosts))
    @NotForKids {
    @if(ctx.isAuth && !ctx.is(u)) {
    @splitNumber(notes.size + " Notes")
    }
    }

      @if(ctx is u) {

      }
      @if(isGranted(_.UserSpy)) {

      }

      @if(ctx.isAuth && !ctx.is(u)) {
      @relation.actions(u.id, relation = rel, followable = followable, blocked = blocked)
      @NotForKids {

      }
      }
      @if(ctx is u) {

      }

  @NotForKids {
  @if(!(ctx is u)) {

    <form class="wide" action="@routes.User.writeNote(u.username)?note" method="post">
      <textarea name="text" placeholder="Write a note about this user only you and your friends can read"></textarea>
      <button type="submit" class="button">@trans.send()</button>
    </form>
    @if(notes.isEmpty) {

No note yet

    }
    @notes.map { note =>

@userIdLink(note.from.some)
@momentFromNow(note.date)

@autoLink(note.text)

    }

  }
  }
  @if((ctx is u) && u.perfs.bestRating > 2400 && !u.hasTitle && !ctx.pref.hasSeenVerifyTitle ) {
  @claimTitle(u)
  }

  @if(filters.current.name == "search") {
  @search.user(u, searchForm)
  } else {

    @info.ratingChart.ifTrue(!u.lame || ctx.is(u) || isGranted(_.UserSpy)).map { ratingChart =>

      Chart loading…

    }

      @if(ctx.me.fold(true)(u !=)) {
      @if(u.engine) {

        @trans.thisPlayerUsesChessComputerAssistance()

      }
      @if(u.booster) {

        @trans.thisPlayerArtificiallyIncreasesTheirRating()

      }
      } else {
      @u.title.flatMap(lila.user.User.titlesMap.get).map { title =>

 @title

      }
      }
      @u.profile.map { p =>
      @NotForKids {
      @p.nonEmptyRealName.map { name =>
      @name
      }
      @p.nonEmptyBio.map { bio =>

@shorten(bio, 400)

      }
      }
      }

        @NotForKids {
        @u.profileOrDefault.nonEmptyLocation.map { l =>
        @l,
        }
        }
        @u.profileOrDefault.countryInfo.map {
        case (code, name) => {
         @name
        }
        }
        @u.lang.flatMap(langName).map { name =>
         @name
        }

@trans.memberSince() @showDate(u.createdAt)

        @u.seenAt.map { seen =>

@trans.lastLogin() @momentFormat(seen)

        }
        @trans.favoriteOpponents()

@trans.tpTimeSpentPlaying(showPeriod(info.playTime.totalPeriod))

        @info.playTime.tvPeriod.map { tvPeriod =>

@trans.tpTimeSpentOnTV(showPeriod(tvPeriod))

        }

          @teamIds(u.id).sortBy(t => !myTeam(t)).map { teamId =>
          @teamLink(teamId, myTeam(teamId).option("mine"))
          }

  }
  @if(u.hasGames || info.nbImported > 0) {

    @filters.list.map { f =>

      @userGameFilterTitle(info, f)

    }

  @if(filters.current.name == "me") {
  @info.crosstable.map { c =>

@game.crosstable(c, none)

  }
  }

    @views.html.user.games(u, games, filters.current.name)

  }

}


text:
<?php

/**
 * Session subscriber observer.
 *
 * Following methods can be implemented: _postUpdate, _postInsert, _postDelete
 * @package Core_Model
 * @subpackage Core_Model_Observer
 */
class Core_Model_Observer_Sessionsubscriber extends TA_Model_Acl_Abstract implements TA_Model_Observer_Interface
{

	private function _informSubscribers(TA_Model_Observed_Interface $subject, $msg)
	{
		$conference = Zend_Registry::get('conference');

		$sessionModel = new Core_Model_Session();
		$subscriptions = $sessionModel->getSubscriptions(null, $subject->session_id);

		$flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');

		$subs = array();
		foreach ($subscriptions as $sub) {
			$subs[] = $sub['email'];
		}

		if (!empty($subscriptions)) {
		   $mailer = new TA_Controller_Action_Helper_SendEmail();
		   $mailer->sendEmail(array(
			  'to_email' => $conference['email'],
			  'html' => true,
			  'bcc' => $subs,
			  'subject' => $conference['name'].': Session updated',
			  'template' => 'session/subscriber'
		   ), $subject->toArray());

			$flash->addMessage('Successfully emailed '.count($subs).' subscriber(s)');
		}

	}

	public function _postInsert(TA_Model_Observed_Interface $subject, $msg)
	{
	}

	public function _postUpdate(TA_Model_Observed_Interface $subject, $msg)
	{
		$this->_informSubscribers($subject, $msg);
	}

	public function _postDelete(TA_Model_Observed_Interface $subject, $msg)
	{
	}

}


text:
package com.develhack;

import static org.testng.Assert.*;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class ConditionsTest_checkValidNumber {

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validDoubleTypeNumber")
	public void checkValidNumber_DoubleTypeValueIsValidNumber_ReturnsTheValue(double value) throws Exception {

		assertEquals(Conditions.checkValidNumber(null, value), value);
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidDoubleTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumber_DoubleTypeValueIsInvalidNumber_ThrowsException(String name, double value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumber(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validFloatTypeNumber")
	public void checkValidNumber_FloatTypeValueIsValidNumber_ReturnsTheValue(float value) throws Exception {

		assertEquals(Conditions.checkValidNumber(null, value), value);
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidFloatTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumber_FloatTypeValueIsInvalidNumber_ThrowsException(String name, float value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumber(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validDoubleTypeNumber")
	public void checkValidNumber_WrappedDoubleTypeValueIsValidNumber_ReturnsTheValue(Double value) throws Exception {

		assertEquals(Conditions.checkValidNumber(null, value), value);
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidDoubleTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumber_WrappedDoubleTypeValueIsInvalidNumber_ThrowsException(String name, Double value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumber(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validFloatTypeNumber")
	public void checkValidNumber_WrappedFloatTypeValueIsValidNumber_ReturnsTheValue(Float value) throws Exception {

		assertEquals(Conditions.checkValidNumber(null, value), value);
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidFloatTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumber_WrappedFloatTypeValueIsInvalidNumber_ThrowsException(String name, Float value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumber(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validDoubleTypeNumber")
	public void checkValidNumberIfNonnull_WrappedDoubleTypeValueIsValidNumber_ReturnsTheValue(Double value) throws Exception {

		assertEquals(Conditions.checkValidNumberIfNonnull(null, value), value);
	}

	@Test
	public void checkValidNumberIfNonnull_WrappedDoubleTypeValueIsNull_ReturnsNull() throws Exception {

		assertNull(Conditions.checkValidNumberIfNonnull(null, (Double) null));
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidDoubleTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumberIfNonnull_WrappedDoubleTypeValueIsInvalidNumber_ThrowsException(String name, Double value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumberIfNonnull(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "validFloatTypeNumber")
	public void checkValidNumberIfNonnull_WrappedFloatTypeValueIsValidNumber_ReturnsTheValue(Float value) throws Exception {

		assertEquals(Conditions.checkValidNumberIfNonnull(null, value), value);
	}

	@Test
	public void checkValidNumberIfNonnull_WrappedFloatTypeValueIsNull_ReturnsNull() throws Exception {

		assertNull(Conditions.checkValidNumberIfNonnull(null, (Float) null));
	}

	@Test(dataProviderClass = DataProviders.class, dataProvider = "invalidFloatTypeNumberWithExpectedExceptionMessage", expectedExceptions = IllegalArgumentException.class)
	public void checkValidNumberIfNonnull_WrappedFloatTypeValueIsInvalidNumber_ThrowsException(String name, Float value,
			String expectedExceptionMessage) throws Exception {

		try {
			Conditions.checkValidNumberIfNonnull(name, value);
		} catch (IllegalArgumentException e) {
			assertEquals(e.getMessage(), expectedExceptionMessage);
			throw e;
		}
	}

	static class DataProviders {

		@DataProvider
		static Object[][] validDoubleTypeNumber() {// @formatter:off
			return new Object[][] {
					{ Double.MIN_VALUE },
					{ Double.MAX_VALUE },
					{ Double.NEGATIVE_INFINITY },
					{ Double.POSITIVE_INFINITY },
					{ 0D },
					{ 1D },
			};
		}// @formatter:on

		@DataProvider
		static Object[][] validFloatTypeNumber() {// @formatter:off
			return new Object[][] {
					{ Float.MIN_VALUE },
					{ Float.MAX_VALUE },
					{ Float.NEGATIVE_INFINITY },
					{ Float.POSITIVE_INFINITY },
					{ 0F },
					{ 1F },
			};
		}// @formatter:on

		@DataProvider
		static Object[][] invalidDoubleTypeNumberWithExpectedExceptionMessage() {// @formatter:off
			return new Object[][] {
					{ "foo", Double.NaN,      "foo must be valid number, but it is NaN." },
					{  null, Double.NaN, "variable must be valid number, but it is NaN." },
			};
		}// @formatter:on

		@DataProvider
		static Object[][] invalidFloatTypeNumberWithExpectedExceptionMessage() {// @formatter:off
			return new Object[][] {
					{ "foo", Float.NaN,      "foo must be valid number, but it is NaN." },
					{  null, Float.NaN, "variable must be valid number, but it is NaN." },
			};
		}// @formatter:on
	}
}


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Graduate extends MY_Controller {

    /**
     * Constructor
     *
     * @return void
     */
    function __construct() {
        parent::__construct();
        $this->load->model('graduate/Graduates_model');
        if(!$this->session->userdata('user_id'))
        {
            redirect(base_url().'user/login');
        }
    }

    function index() {
        $this->data['title'] = 'Toppers Graduate';
        $this->data['page'] = 'graduate';
        $this->data['graduates'] = $this->Graduates_model->get_all_graduates();
        $this->__template('graduate/index', $this->data);
    }

    /**
     * Create new deparmtents
     */
    function create() {
         if ($_POST) {
              if (is_uploaded_file($_FILES['main_img']['tmp_name'])) {
                    $path = FCPATH . 'uploads/student_image/';
                    if (!is_dir($path)) {
                        mkdir($path, 0777);
                    }
                    $ext = explode(".", $_FILES['main_img']['name']);
                    $ext_file = strtolower(end($ext));
                    $image1 = date('dmYhis') . 'main.' . $ext_file;
                    $config['upload_path'] = 'uploads/student_image';
                    $config['allowed_types'] = 'gif|jpg|png|jpeg';
                    $config['file_name'] = $image1;
                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);
                    $main_img = $config['file_name'];
                    //$this->upload->set_allowed_types('*');

                    if (!$this->upload->do_upload('main_img')) {
                        $this->session->set_flashdata('flash_message', "Invalid File!");
                        redirect(base_url() . 'graduate/', 'refresh');
                    } else {
                        $config['image_library'] = 'gd2';
                        $config['source_image'] = 'uploads/student_image/' . $main_img;
                        $config['create_thumb'] = TRUE;
                        $config['maintain_ratio'] = TRUE;
                        $config['width'] = 50;
                        $config['height'] = 50;
                        $this->load->library('image_lib', $config);
                        $this->image_lib->resize();
                        $file = $this->upload->data();
                        $thumb_img = $file['raw_name'] . '_thumb' . $file['file_ext']; // Here it is
                    }
                } else {
                    $main_img = '';
                }

                $this->Graduates_model->insert(array(
                    'student_id' => $_POST['student'],
                    'degree_id' => $_POST['degree'],
                    'course_id' => $_POST['course'],
                    'batch_id' => $_POST['batch'],
                    'semester_id' => $_POST['semester'],
                    'description' => $_POST['description'],
                    'graduate_year' => $_POST['year'],
                    "student_img" => $main_img,
                    "std_thumb_img" => $thumb_img));
                $this->flash_notification("New Graduate student successfully added");

            }
             redirect(base_url('graduate'));

    }

    /**
     * Delete Charity Fund
     * @param string $id
     */
    function delete($id) {
        $this->Graduates_model->delete($id);
        $this->flash_notification('Graduate Student is successfully deleted.');
        redirect(base_url('graduate'));
    }

    /**
     * Update Charity Fund
     * @param string $id
     */
    function update($id = '') {
        if ($_POST) {
               $graduate_std = $this->Graduates_model->get($id);

                if ($_FILES['main_img']['name'] != "") {
                    $path = FCPATH . 'uploads/student_image/';
                    if (!is_dir($path)) {
                        mkdir($path, 0777);
                    }
                    $ext = explode(".", $_FILES['main_img']['name']);
                    $ext_file = strtolower(end($ext));
                    $image1 = date('dmYhis') . 'main.' . $ext_file;
                    $config['upload_path'] = 'uploads/student_image/';
                    $config['allowed_types'] = 'gif|jpg|png|jpeg';
                    $config['file_name'] = $image1;
                    $this->load->library('upload', $config);
                    $this->upload->initialize($config);
                    $main_img = $config['file_name'];
                    //$this->upload->set_allowed_types('*');

                    if (!$this->upload->do_upload('main_img')) {
                        $this->session->set_flashdata('flash_message', "Invalid File!");
                        redirect(base_url() . 'graduate/', 'refresh');
                    } else {
                        $config['image_library'] = 'gd2';
                        $config['source_image'] = 'uploads/student_image/' . $main_img;
                        $config['create_thumb'] = TRUE;
                        $config['maintain_ratio'] = TRUE;
                        $config['width'] = 50;
                        $config['height'] = 50;
                        $this->load->library('image_lib', $config);
                        $this->image_lib->resize();
                        $file = $this->upload->data();
                        $thumb_img = $file['raw_name'] . '_thumb' . $file['file_ext']; // Here it is
                    }
                } else {
                    $main_img = $graduate_std->student_img;
                    $thumb_img = $graduate_std->std_thumb_img;
                }
                $this->Graduates_model->update($id,array(
                    'student_id' => $_POST['student'],
                    'degree_id' => $_POST['degree'],
                    'course_id' => $_POST['course'],
                    'batch_id' => $_POST['batch'],
                    'semester_id' => $_POST['semester'],
                    'description' => $_POST['description'],
                    'graduate_year' => $_POST['year'],
                    "student_img" => $main_img,
                    "std_thumb_img" => $thumb_img));
                $this->flash_notification("Graduate student successfully updated");

        }

        redirect(base_url('graduate'));
    }
    function check_graduate()
    {
        $stdid=$this->input->post('student');
        $data=$this->Graduates_model->get_by(array('student_id'=>$stdid));
        if ($data) {
                echo "false";
            } else {
                echo "true";
            }
    }
}