text:
package Cluster::MachineQueue;

# Cluster::MachineQueue contains a set of Cluster::Machine objects that represent machines
# on the cluster (either a compute node or the master node).  It is used primarily to
# identify machines that are available so jobs can be started on them.
# See also Cluster::Machine.

# Author: Robert Freimuth
# Washington University, July 2006

use strict;
use warnings;

use Carp;
use Cluster::Machine;

our $VERSION = 0.01;

#*****************************************************************************************
#                                       Example of Use
#*****************************************************************************************

=pod

methods:

my $machQ = Cluster::MachineQueue->new( { see comments below } );
$machQ->load_machines( @machine_list );
$machQ->load_machines_file( $pathfile );

my @machine_objs = $machQ->get_all_machines();
my @machine_objs = $machQ->get_available_machines();
my $machine_obj  = $machQ->get_next_avail_machine()
my $status_table = $machQ->machine_status_table();

my $machine_obj  = $machQ->get_machine_by_name( $name );

=cut

#*****************************************************************************************
#                                       Public Methods
#*****************************************************************************************

sub new
{
	# Creates a new Cluster::MachineQueue object.  Requires a hash ref as a
	# parameter.  The href should contain at least one of the following keys:
	#    infile   = a filename (with full path) that contains a list of machines to use
    #    machines = a hash ref that contains a list of machines ( name => max # jobs )
    # If both keys are present, the union of the lists will be used.
	# Any additional keys can be included in $href, but no accessors are defined for them.

	my ( $class, $href ) = @_;

	if( (not defined $href) || (ref $href ne 'HASH') )
	{
		Carp::carp "$class->new() requires a hash ref as a parameter";
		return;
	}

	# copy the keys for Cluster::MachineQueue into a class-specific subhash

	if( exists $href->{_Cluster_MachineQueue} )
	{
		Carp::carp "Warning: class-specific key already exists. Data will be overwritten";
	}

	my $obj = bless( $href, $class );

	# load machines

	if( defined $href->{infile} )
	{
		$obj->load_machines_file( $href->{infile} );
	}

	if( defined $href->{machines} )
	{
		$obj->load_machines( $href->{machines} );
	}

	return $obj;
}

sub load_machines_file
{
	my ( $self, $pathfile ) = @_;

    open( my $infh, '<', $pathfile ) or
        die "Error opening $pathfile:\n$!";

	my %machines;

    while( my $line = <$infh> )
    {
        chomp $line;
        next if( $line =~ m/^\s*$/ );
		next if( $line =~ m/^#/ );

		my ( $name, $num_jobs ) = split( /\t/, $line );
		$num_jobs = ( defined $num_jobs ? $num_jobs : 1 );

		$machines{$name} += $num_jobs;
    }

    close $infh;

	$self->load_machines( \%machines );
}

sub load_machines
{
	my ( $self, $href ) = @_;

	if( ref $href ne 'HASH' )
	{
		Carp::carp "load_machines requires a hash ref as a parameter";
		return;
	}

	foreach my $machine ( keys %{ $href } )
	{
		my $machine_obj = $self->get_machine_by_name( $machine );

		if( defined $machine_obj )
		{
			# overwrite previous value
			$machine_obj->set_max_num_jobs( $href->{$machine} );
		}
		else
		{
			# create new Cluster::Machine object
			$machine_obj = Cluster::Machine->new( { name => $machine, max_num_jobs => $href->{$machine} } );
		}

		$self->{_Cluster_MachineQueue}{loaded_machines}{$machine} = $machine_obj;
	}

	return 1;
}

sub get_all_machines
{
	# returns a list of Cluster::Machine objects
	my ( $self ) = @_;
	return values %{ $self->{_Cluster_MachineQueue}{loaded_machines} };
}

sub get_available_machines
{
	# returns a list of Cluster::Machine objects
	my ( $self ) = @_;
	my @available = grep { $_->is_free() } $self->get_all_machines;
	return @available;
}

sub get_next_avail_machine
{
	# there could be a race condition here, where one piece of code gets a machine obj but
	# fails to update the job status of the machine before the next request to this sub
	# (not a big deal - if it happens the only effect is that there might be more than
	# $max jobs started on that machine

	my ( $self ) = @_;

	my $machine_obj = ( $self->get_available_machines() )[0];

	if( not defined $machine_obj )
	{
		return undef;
	}

    return $machine_obj;
}

sub get_machine_by_name
{
	my ( $self, $name ) = @_;

	if( (not defined $name) ||
		(not defined $self->{_Cluster_MachineQueue}{loaded_machines}{$name}) )
	{
		# Carp::carp "Machine name or object not defined\n";
		return;
	}

	return $self->{_Cluster_MachineQueue}{loaded_machines}{$name};
}

sub machine_status_table
{
	my ( $self ) = @_;

	my @mach_objs = $self->get_all_machines;

	@mach_objs = sort { $a->get_name cmp $b->get_name } @mach_objs;

	my $format = "%-15.15s %7.7s %7.7s\n";

	my $table = sprintf( $format, 'Name', 'Running', 'MaxJobs' );

	foreach my $mach_obj ( @mach_objs )
	{
		my $line = sprintf( $format,
								$mach_obj->get_name,
							   	$mach_obj->get_num_running_jobs,
							   	$mach_obj->get_max_num_jobs );

		$table .= $line;
	}

	return $table;
}

#*****************************************************************************************

1;


text:
include_recipe "build-essential"

pkgs = value_for_platform_family(
    ["rhel","fedora"] => ["openssl-devel","make","tar"] ,
    "debian" => ["libssl-dev","make","tar"],
    "default" => ["libssl-dev","make","tar"]
  )

pkgs.each do |pkg|
  package pkg do
    action :install
  end
end

user node['nagios']['user'] do
  system true
end

group node['nagios']['group'] do
  members [ node['nagios']['user'] ]
end

plugins_version = node['nagios']['plugins']['version']

remote_file "#{Chef::Config[:file_cache_path]}/nagios-plugins-#{plugins_version}.tar.gz" do
  source "#{node['nagios']['plugins']['url']}/nagios-plugins-#{plugins_version}.tar.gz"
  checksum node['nagios']['plugins']['checksum']
  action :create_if_missing
end

bash "compile-nagios-plugins" do
  cwd Chef::Config[:file_cache_path]
  code <<-EOH
    tar zxvf nagios-plugins-#{plugins_version}.tar.gz
    cd nagios-plugins-#{plugins_version}
    ./configure --with-nagios-user=#{node['nagios']['user']} \
                --with-nagios-group=#{node['nagios']['group']} \
                --prefix=/usr \
                --libexecdir=#{node['nagios']['plugin_dir']}
    make -s
    make install
  EOH
  creates "#{node['nagios']['plugin_dir']}/check_users"
end

# compile the NRPE service and NRPE plugin
include_recipe "nagios::nrpe_source"

redpajama_set_name: RedPajamaGithub


text:
If you're new to machine learning, we recommend starting here.  You'll learn
about a classic problem, handwritten digit classification (MNIST), and get a
gentle introduction to multiclass classification.

[View Tutorial](../tutorials/mnist/beginners/index.md)

## Deep MNIST for Experts

If you're already familiar with other deep learning software packages, and are
already familiar with MNIST, this tutorial with give you a very brief primer on
TensorFlow.

[View Tutorial](../tutorials/mnist/pros/index.md)

## TensorFlow Mechanics 101

This is a technical tutorial, where we walk you through the details of using
TensorFlow infrastructure to train models at scale.  We use again MNIST as the
example.

[View Tutorial](../tutorials/mnist/tf/index.md)

## TensorFlow Serving

An introduction to TensorFlow Serving, a flexible, high-performance system for
serving machine learning models, designed for production environments.

[View Tutorial](../tutorials/tfserve/index.md)

## Convolutional Neural Networks

An introduction to convolutional neural networks using the CIFAR-10 data set.
Convolutional neural nets are particularly tailored to images, since they
exploit translation invariance to yield more compact and effective
representations of visual content.

[View Tutorial](../tutorials/deep_cnn/index.md)

## Vector Representations of Words

This tutorial motivates why it is useful to learn to represent words as vectors
(called *word embeddings*). It introduces the word2vec model as an efficient
method for learning embeddings. It also covers the high-level details behind
noise-contrastive training methods (the biggest recent advance in training
embeddings).

[View Tutorial](../tutorials/word2vec/index.md)

## Recurrent Neural Networks

An introduction to RNNs, wherein we train an LSTM network to predict the next
word in an English sentence.  (A task sometimes called language modeling.)

[View Tutorial](../tutorials/recurrent/index.md)

## Sequence-to-Sequence Models

A follow on to the RNN tutorial, where we assemble a sequence-to-sequence model
for machine translation.  You will learn to build your own English-to-French
translator, entirely machine learned, end-to-end.

[View Tutorial](../tutorials/seq2seq/index.md)

## Mandelbrot Set

TensorFlow can be used for computation that has nothing to do with machine
learning.  Here's a naive implementation of Mandelbrot set visualization.

[View Tutorial](../tutorials/mandelbrot/index.md)

## Partial Differential Equations

As another example of non-machine learning computation, we offer an example of
a naive PDE simulation of raindrops landing on a pond.

[View Tutorial](../tutorials/pdes/index.md)

## MNIST Data Download

Details about downloading the MNIST handwritten digits data set.  Exciting
stuff.

[View Tutorial](../tutorials/mnist/download/index.md)

## Image Recognition

How to run object recognition using a convolutional neural network
trained on ImageNet Challenge data and label set.

[View Tutorial](../tutorials/image_recognition/index.md)

We will soon be releasing code for training a state-of-the-art Inception model.

## Deep Dream Visual Hallucinations

Building on the Inception recognition model, we will release a TensorFlow
version of the [Deep Dream](https://github.com/google/deepdream) neural network
visual hallucination software.

COMING SOON


text:
import os
import posixpath

from dmunit import DeviceManagerTestCase

class PushBinaryTestCase(DeviceManagerTestCase):

    def runTest(self):
        """This tests copying a binary file.
        """
        testroot = self.dm.getDeviceRoot()
        self.dm.removeFile(posixpath.join(testroot, 'mybinary.zip'))
        self.assert_(self.dm.pushFile(
            os.path.join('test-files', 'mybinary.zip'),
            posixpath.join(testroot, 'mybinary.zip')))


text:
//////////////////////////////////////////////////////////////////////////
//  Copyright (c) 2009 Organic Vectory B.V.
//  Written by George van Venrooij
//
//  Distributed under the Boost Software License, Version 1.0.
//  (See accompanying file license.txt)
//////////////////////////////////////////////////////////////////////////

#include "clew.h"

#ifdef _WIN32
    #define WIN32_LEAN_AND_MEAN
    #define VC_EXTRALEAN
    #include <windows.h>

    typedef HMODULE             CLEW_DYNLIB_HANDLE;

    #define CLEW_DYNLIB_OPEN    LoadLibrary
    #define CLEW_DYNLIB_CLOSE   FreeLibrary
    #define CLEW_DYNLIB_IMPORT  GetProcAddress
#else
    #include <dlfcn.h>

    typedef void*                   CLEW_DYNLIB_HANDLE;

    #define CLEW_DYNLIB_OPEN(path)  dlopen(path, RTLD_NOW | RTLD_GLOBAL)
    #define CLEW_DYNLIB_CLOSE       dlclose
    #define CLEW_DYNLIB_IMPORT      dlsym
#endif

#include <stdlib.h>

//! \brief module handle
static CLEW_DYNLIB_HANDLE module = NULL;

//  Variables holding function entry points
PFNCLGETPLATFORMIDS                 __clewGetPlatformIDs                = NULL;
PFNCLGETPLATFORMINFO                __clewGetPlatformInfo               = NULL;
PFNCLGETDEVICEIDS                   __clewGetDeviceIDs                  = NULL;
PFNCLGETDEVICEINFO                  __clewGetDeviceInfo                 = NULL;
PFNCLCREATESUBDEVICES               __clewCreateSubDevices              = NULL;
PFNCLRETAINDEVICE                   __clewRetainDevice                  = NULL;
PFNCLRELEASEDEVICE                  __clewReleaseDevice                 = NULL;
PFNCLCREATECONTEXT                  __clewCreateContext                 = NULL;
PFNCLCREATECONTEXTFROMTYPE          __clewCreateContextFromType         = NULL;
PFNCLRETAINCONTEXT                  __clewRetainContext                 = NULL;
PFNCLRELEASECONTEXT                 __clewReleaseContext                = NULL;
PFNCLGETCONTEXTINFO                 __clewGetContextInfo                = NULL;
PFNCLCREATECOMMANDQUEUE             __clewCreateCommandQueue            = NULL;
PFNCLRETAINCOMMANDQUEUE             __clewRetainCommandQueue            = NULL;
PFNCLRELEASECOMMANDQUEUE            __clewReleaseCommandQueue           = NULL;
PFNCLGETCOMMANDQUEUEINFO            __clewGetCommandQueueInfo           = NULL;
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
PFNCLSETCOMMANDQUEUEPROPERTY        __clewSetCommandQueueProperty       = NULL;
#endif
PFNCLCREATEBUFFER                   __clewCreateBuffer                  = NULL;
PFNCLCREATESUBBUFFER                __clewCreateSubBuffer               = NULL;
PFNCLCREATEIMAGE                    __clewCreateImage                   = NULL;
PFNCLRETAINMEMOBJECT                __clewRetainMemObject               = NULL;
PFNCLRELEASEMEMOBJECT               __clewReleaseMemObject              = NULL;
PFNCLGETSUPPORTEDIMAGEFORMATS       __clewGetSupportedImageFormats      = NULL;
PFNCLGETMEMOBJECTINFO               __clewGetMemObjectInfo              = NULL;
PFNCLGETIMAGEINFO                   __clewGetImageInfo                  = NULL;
PFNCLSETMEMOBJECTDESTRUCTORCALLBACK __clewSetMemObjectDestructorCallback = NULL;
PFNCLCREATESAMPLER                  __clewCreateSampler                 = NULL;
PFNCLRETAINSAMPLER                  __clewRetainSampler                 = NULL;
PFNCLRELEASESAMPLER                 __clewReleaseSampler                = NULL;
PFNCLGETSAMPLERINFO                 __clewGetSamplerInfo                = NULL;
PFNCLCREATEPROGRAMWITHSOURCE        __clewCreateProgramWithSource       = NULL;
PFNCLCREATEPROGRAMWITHBINARY        __clewCreateProgramWithBinary       = NULL;
PFNCLCREATEPROGRAMWITHBUILTINKERNELS __clewCreateProgramWithBuiltInKernels = NULL;
PFNCLRETAINPROGRAM                  __clewRetainProgram                 = NULL;
PFNCLRELEASEPROGRAM                 __clewReleaseProgram                = NULL;
PFNCLBUILDPROGRAM                   __clewBuildProgram                  = NULL;
PFNCLGETPROGRAMINFO                 __clewGetProgramInfo                = NULL;
PFNCLGETPROGRAMBUILDINFO            __clewGetProgramBuildInfo           = NULL;
PFNCLCREATEKERNEL                   __clewCreateKernel                  = NULL;
PFNCLCREATEKERNELSINPROGRAM         __clewCreateKernelsInProgram        = NULL;
PFNCLRETAINKERNEL                   __clewRetainKernel                  = NULL;
PFNCLRELEASEKERNEL                  __clewReleaseKernel                 = NULL;
PFNCLSETKERNELARG                   __clewSetKernelArg                  = NULL;
PFNCLGETKERNELINFO                  __clewGetKernelInfo                 = NULL;
PFNCLGETKERNELWORKGROUPINFO         __clewGetKernelWorkGroupInfo        = NULL;
PFNCLWAITFOREVENTS                  __clewWaitForEvents                 = NULL;
PFNCLGETEVENTINFO                   __clewGetEventInfo                  = NULL;
PFNCLCREATEUSEREVENT                __clewCreateUserEvent               = NULL;
PFNCLRETAINEVENT                    __clewRetainEvent                   = NULL;
PFNCLRELEASEEVENT                   __clewReleaseEvent                  = NULL;
PFNCLSETUSEREVENTSTATUS             __clewSetUserEventStatus            = NULL;
PFNCLSETEVENTCALLBACK               __clewSetEventCallback              = NULL;
PFNCLGETEVENTPROFILINGINFO          __clewGetEventProfilingInfo         = NULL;
PFNCLFLUSH                          __clewFlush                         = NULL;
PFNCLFINISH                         __clewFinish                        = NULL;
PFNCLENQUEUEREADBUFFER              __clewEnqueueReadBuffer             = NULL;
PFNCLENQUEUEREADBUFFERRECT          __clewEnqueueReadBufferRect         = NULL;
PFNCLENQUEUEWRITEBUFFER             __clewEnqueueWriteBuffer            = NULL;
PFNCLENQUEUEWRITEBUFFERRECT         __clewEnqueueWriteBufferRect        = NULL;
PFNCLENQUEUECOPYBUFFER              __clewEnqueueCopyBuffer             = NULL;
PFNCLENQUEUEREADIMAGE               __clewEnqueueReadImage              = NULL;
PFNCLENQUEUEWRITEIMAGE              __clewEnqueueWriteImage             = NULL;
PFNCLENQUEUECOPYIMAGE               __clewEnqueueCopyImage              = NULL;
PFNCLENQUEUECOPYBUFFERRECT          __clewEnqueueCopyBufferRect         = NULL;
PFNCLENQUEUECOPYIMAGETOBUFFER       __clewEnqueueCopyImageToBuffer      = NULL;
PFNCLENQUEUECOPYBUFFERTOIMAGE       __clewEnqueueCopyBufferToImage      = NULL;
PFNCLENQUEUEMAPBUFFER               __clewEnqueueMapBuffer              = NULL;
PFNCLENQUEUEMAPIMAGE                __clewEnqueueMapImage               = NULL;
PFNCLENQUEUEUNMAPMEMOBJECT          __clewEnqueueUnmapMemObject         = NULL;
PFNCLENQUEUENDRANGEKERNEL           __clewEnqueueNDRangeKernel          = NULL;
PFNCLENQUEUETASK                    __clewEnqueueTask                   = NULL;
PFNCLENQUEUENATIVEKERNEL            __clewEnqueueNativeKernel           = NULL;

PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM __clewGetExtensionFunctionAddressForPlatform = NULL;

#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
PFNCLCREATEIMAGE2D                  __clewCreateImage2D                 = NULL;
PFNCLCREATEIMAGE3D                  __clewCreateImage3D                 = NULL;
PFNCLENQUEUEMARKER                  __clewEnqueueMarker                 = NULL;
PFNCLENQUEUEWAITFOREVENTS           __clewEnqueueWaitForEvents          = NULL;
PFNCLENQUEUEBARRIER                 __clewEnqueueBarrier                = NULL;
PFNCLUNLOADCOMPILER                 __clewUnloadCompiler                = NULL;
PFNCLGETEXTENSIONFUNCTIONADDRESS    __clewGetExtensionFunctionAddress   = NULL;
#endif

/* cl_gl */
PFNCLCREATEFROMGLBUFFER             __clewCreateFromGLBuffer            = NULL;
PFNCLCREATEFROMGLTEXTURE            __clewCreateFromGLTexture           = NULL;
PFNCLCREATEFROMGLRENDERBUFFER       __clewCreateFromGLRenderbuffer      = NULL;
PFNCLGETGLOBJECTINFO                __clewGetGLObjectInfo               = NULL;
PFNCLGETGLTEXTUREINFO               __clewGetGLTextureInfo              = NULL;
PFNCLENQUEUEACQUIREGLOBJECTS        __clewEnqueueAcquireGLObjects       = NULL;
PFNCLENQUEUERELEASEGLOBJECTS        __clewEnqueueReleaseGLObjects       = NULL;
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
PFNCLCREATEFROMGLTEXTURE2D          __clewCreateFromGLTexture2D         = NULL;
PFNCLCREATEFROMGLTEXTURE3D          __clewCreateFromGLTexture3D         = NULL;
#endif
PFNCLGETGLCONTEXTINFOKHR            __clewGetGLContextInfoKHR           = NULL;

static void clewExit(void)
{
    if (module != NULL)
    {
        //  Ignore errors
        CLEW_DYNLIB_CLOSE(module);
        module = NULL;
    }
}

int clewInit()
{
#ifdef _WIN32
    const char *path = "OpenCL.dll";
#elif defined(__APPLE__)
    const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
#else
    const char *path = "libOpenCL.so";
#endif

    int error = 0;

    //  Check if already initialized
    if (module != NULL)
    {
        return CLEW_SUCCESS;
    }

    //  Load library
    module = CLEW_DYNLIB_OPEN(path);

    //  Check for errors
    if (module == NULL)
    {
        return CLEW_ERROR_OPEN_FAILED;
    }

    //  Set unloading
    error = atexit(clewExit);

    if (error)
    {
        //  Failure queuing atexit, shutdown with error
        CLEW_DYNLIB_CLOSE(module);
        module = NULL;

        return CLEW_ERROR_ATEXIT_FAILED;
    }

    //  Determine function entry-points
    __clewGetPlatformIDs                = (PFNCLGETPLATFORMIDS              )CLEW_DYNLIB_IMPORT(module, "clGetPlatformIDs");
    __clewGetPlatformInfo               = (PFNCLGETPLATFORMINFO             )CLEW_DYNLIB_IMPORT(module, "clGetPlatformInfo");
    __clewGetDeviceIDs                  = (PFNCLGETDEVICEIDS                )CLEW_DYNLIB_IMPORT(module, "clGetDeviceIDs");
    __clewGetDeviceInfo                 = (PFNCLGETDEVICEINFO               )CLEW_DYNLIB_IMPORT(module, "clGetDeviceInfo");
    __clewCreateSubDevices              = (PFNCLCREATESUBDEVICES            )CLEW_DYNLIB_IMPORT(module, "clCreateSubDevices");
    __clewRetainDevice                  = (PFNCLRETAINDEVICE                )CLEW_DYNLIB_IMPORT(module, "clRetainDevice");
    __clewReleaseDevice                 = (PFNCLRELEASEDEVICE               )CLEW_DYNLIB_IMPORT(module, "clReleaseDevice");
    __clewCreateContext                 = (PFNCLCREATECONTEXT               )CLEW_DYNLIB_IMPORT(module, "clCreateContext");
    __clewCreateContextFromType         = (PFNCLCREATECONTEXTFROMTYPE       )CLEW_DYNLIB_IMPORT(module, "clCreateContextFromType");
    __clewRetainContext                 = (PFNCLRETAINCONTEXT               )CLEW_DYNLIB_IMPORT(module, "clRetainContext");
    __clewReleaseContext                = (PFNCLRELEASECONTEXT              )CLEW_DYNLIB_IMPORT(module, "clReleaseContext");
    __clewGetContextInfo                = (PFNCLGETCONTEXTINFO              )CLEW_DYNLIB_IMPORT(module, "clGetContextInfo");
    __clewCreateCommandQueue            = (PFNCLCREATECOMMANDQUEUE          )CLEW_DYNLIB_IMPORT(module, "clCreateCommandQueue");
    __clewRetainCommandQueue            = (PFNCLRETAINCOMMANDQUEUE          )CLEW_DYNLIB_IMPORT(module, "clRetainCommandQueue");
    __clewReleaseCommandQueue           = (PFNCLRELEASECOMMANDQUEUE         )CLEW_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
    __clewGetCommandQueueInfo           = (PFNCLGETCOMMANDQUEUEINFO         )CLEW_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
    __clewSetCommandQueueProperty       = (PFNCLSETCOMMANDQUEUEPROPERTY     )CLEW_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
#endif
    __clewCreateBuffer                  = (PFNCLCREATEBUFFER                )CLEW_DYNLIB_IMPORT(module, "clCreateBuffer");
    __clewCreateSubBuffer               = (PFNCLCREATESUBBUFFER             )CLEW_DYNLIB_IMPORT(module, "clCreateBuffer");
    __clewCreateImage                   = (PFNCLCREATEIMAGE                 )CLEW_DYNLIB_IMPORT(module, "clCreateImage");
    __clewRetainMemObject               = (PFNCLRETAINMEMOBJECT             )CLEW_DYNLIB_IMPORT(module, "clRetainMemObject");
    __clewReleaseMemObject              = (PFNCLRELEASEMEMOBJECT            )CLEW_DYNLIB_IMPORT(module, "clReleaseMemObject");
    __clewGetSupportedImageFormats      = (PFNCLGETSUPPORTEDIMAGEFORMATS    )CLEW_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
    __clewGetMemObjectInfo              = (PFNCLGETMEMOBJECTINFO            )CLEW_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
    __clewGetImageInfo                  = (PFNCLGETIMAGEINFO                )CLEW_DYNLIB_IMPORT(module, "clGetImageInfo");
    __clewSetMemObjectDestructorCallback = (PFNCLSETMEMOBJECTDESTRUCTORCALLBACK)CLEW_DYNLIB_IMPORT(module, "clSetMemObjectDestructorCallback");
    __clewCreateSampler                 = (PFNCLCREATESAMPLER               )CLEW_DYNLIB_IMPORT(module, "clCreateSampler");
    __clewRetainSampler                 = (PFNCLRETAINSAMPLER               )CLEW_DYNLIB_IMPORT(module, "clRetainSampler");
    __clewReleaseSampler                = (PFNCLRELEASESAMPLER              )CLEW_DYNLIB_IMPORT(module, "clReleaseSampler");
    __clewGetSamplerInfo                = (PFNCLGETSAMPLERINFO              )CLEW_DYNLIB_IMPORT(module, "clGetSamplerInfo");
    __clewCreateProgramWithSource       = (PFNCLCREATEPROGRAMWITHSOURCE     )CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
    __clewCreateProgramWithBinary       = (PFNCLCREATEPROGRAMWITHBINARY     )CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
    __clewCreateProgramWithBuiltInKernels =(PFNCLCREATEPROGRAMWITHBUILTINKERNELS)CLEW_DYNLIB_IMPORT(module, "clCreateProgramWithBuiltInKernels");
    __clewRetainProgram                 = (PFNCLRETAINPROGRAM               )CLEW_DYNLIB_IMPORT(module, "clRetainProgram");
    __clewReleaseProgram                = (PFNCLRELEASEPROGRAM              )CLEW_DYNLIB_IMPORT(module, "clReleaseProgram");
    __clewBuildProgram                  = (PFNCLBUILDPROGRAM                )CLEW_DYNLIB_IMPORT(module, "clBuildProgram");

    __clewGetProgramInfo                = (PFNCLGETPROGRAMINFO              )CLEW_DYNLIB_IMPORT(module, "clGetProgramInfo");
    __clewGetProgramBuildInfo           = (PFNCLGETPROGRAMBUILDINFO         )CLEW_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
    __clewCreateKernel                  = (PFNCLCREATEKERNEL                )CLEW_DYNLIB_IMPORT(module, "clCreateKernel");
    __clewCreateKernelsInProgram        = (PFNCLCREATEKERNELSINPROGRAM      )CLEW_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
    __clewRetainKernel                  = (PFNCLRETAINKERNEL                )CLEW_DYNLIB_IMPORT(module, "clRetainKernel");
    __clewReleaseKernel                 = (PFNCLRELEASEKERNEL               )CLEW_DYNLIB_IMPORT(module, "clReleaseKernel");
    __clewSetKernelArg                  = (PFNCLSETKERNELARG                )CLEW_DYNLIB_IMPORT(module, "clSetKernelArg");
    __clewGetKernelInfo                 = (PFNCLGETKERNELINFO               )CLEW_DYNLIB_IMPORT(module, "clGetKernelInfo");
    __clewGetKernelWorkGroupInfo        = (PFNCLGETKERNELWORKGROUPINFO      )CLEW_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
    __clewWaitForEvents                 = (PFNCLWAITFOREVENTS               )CLEW_DYNLIB_IMPORT(module, "clWaitForEvents");
    __clewGetEventInfo                  = (PFNCLGETEVENTINFO                )CLEW_DYNLIB_IMPORT(module, "clGetEventInfo");
    __clewCreateUserEvent               = (PFNCLCREATEUSEREVENT             )CLEW_DYNLIB_IMPORT(module, "clCreateUserEvent");
    __clewRetainEvent                   = (PFNCLRETAINEVENT                 )CLEW_DYNLIB_IMPORT(module, "clRetainEvent");
    __clewReleaseEvent                  = (PFNCLRELEASEEVENT                )CLEW_DYNLIB_IMPORT(module, "clReleaseEvent");
    __clewSetUserEventStatus            = (PFNCLSETUSEREVENTSTATUS          )CLEW_DYNLIB_IMPORT(module, "clSetUserEventStatus");
    __clewSetEventCallback              = (PFNCLSETEVENTCALLBACK            )CLEW_DYNLIB_IMPORT(module, "clSetEventCallback");
    __clewGetEventProfilingInfo         = (PFNCLGETEVENTPROFILINGINFO       )CLEW_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
    __clewFlush                         = (PFNCLFLUSH                       )CLEW_DYNLIB_IMPORT(module, "clFlush");
    __clewFinish                        = (PFNCLFINISH                      )CLEW_DYNLIB_IMPORT(module, "clFinish");
    __clewEnqueueReadBuffer             = (PFNCLENQUEUEREADBUFFER           )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
    __clewEnqueueReadBufferRect         = (PFNCLENQUEUEREADBUFFERRECT       )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadBufferRect");
    __clewEnqueueWriteBuffer            = (PFNCLENQUEUEWRITEBUFFER          )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
    __clewEnqueueWriteBufferRect        = (PFNCLENQUEUEWRITEBUFFERRECT      )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteBufferRect");
    __clewEnqueueCopyBuffer             = (PFNCLENQUEUECOPYBUFFER           )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
    __clewEnqueueCopyBufferRect         = (PFNCLENQUEUECOPYBUFFERRECT       )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferRect");
    __clewEnqueueReadImage              = (PFNCLENQUEUEREADIMAGE            )CLEW_DYNLIB_IMPORT(module, "clEnqueueReadImage");
    __clewEnqueueWriteImage             = (PFNCLENQUEUEWRITEIMAGE           )CLEW_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
    __clewEnqueueCopyImage              = (PFNCLENQUEUECOPYIMAGE            )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
    __clewEnqueueCopyImageToBuffer      = (PFNCLENQUEUECOPYIMAGETOBUFFER    )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
    __clewEnqueueCopyBufferToImage      = (PFNCLENQUEUECOPYBUFFERTOIMAGE    )CLEW_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
    __clewEnqueueMapBuffer              = (PFNCLENQUEUEMAPBUFFER            )CLEW_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
    __clewEnqueueMapImage               = (PFNCLENQUEUEMAPIMAGE             )CLEW_DYNLIB_IMPORT(module, "clEnqueueMapImage");
    __clewEnqueueUnmapMemObject         = (PFNCLENQUEUEUNMAPMEMOBJECT       )CLEW_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
    __clewEnqueueNDRangeKernel          = (PFNCLENQUEUENDRANGEKERNEL        )CLEW_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
    __clewEnqueueTask                   = (PFNCLENQUEUETASK                 )CLEW_DYNLIB_IMPORT(module, "clEnqueueTask");
    __clewEnqueueNativeKernel           = (PFNCLENQUEUENATIVEKERNEL         )CLEW_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");

    __clewGetExtensionFunctionAddressForPlatform = (PFNCLGETEXTENSIONFUNCTIONADDRESSFORPLATFORM)CLEW_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddressForPlatform");
#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
    __clewCreateImage2D                 = (PFNCLCREATEIMAGE2D               )CLEW_DYNLIB_IMPORT(module, "clCreateImage2D");
    __clewCreateImage3D                 = (PFNCLCREATEIMAGE3D               )CLEW_DYNLIB_IMPORT(module, "clCreateImage3D");
    __clewEnqueueMarker                 = (PFNCLENQUEUEMARKER               )CLEW_DYNLIB_IMPORT(module, "clEnqueueMarker");
    __clewEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLEW_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
    __clewEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLEW_DYNLIB_IMPORT(module, "clEnqueueBarrier");
    __clewUnloadCompiler                = (PFNCLUNLOADCOMPILER              )CLEW_DYNLIB_IMPORT(module, "clUnloadCompiler");
    __clewGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLEW_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
#endif

    /* cl_gl */
    __clewCreateFromGLBuffer            = (PFNCLCREATEFROMGLBUFFER          )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLBuffer");
    __clewCreateFromGLTexture           = (PFNCLCREATEFROMGLTEXTURE         )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture");
    __clewCreateFromGLRenderbuffer      = (PFNCLCREATEFROMGLRENDERBUFFER    )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLRenderbuffer");
    __clewGetGLObjectInfo               = (PFNCLGETGLOBJECTINFO             )CLEW_DYNLIB_IMPORT(module, "clGetGLObjectInfo");
    __clewGetGLTextureInfo              = (PFNCLGETGLTEXTUREINFO            )CLEW_DYNLIB_IMPORT(module, "clGetGLTextureInfo");
    __clewEnqueueAcquireGLObjects       = (PFNCLENQUEUEACQUIREGLOBJECTS     )CLEW_DYNLIB_IMPORT(module, "clEnqueueAcquireGLObjects");
    __clewEnqueueReleaseGLObjects       = (PFNCLENQUEUERELEASEGLOBJECTS     )CLEW_DYNLIB_IMPORT(module, "clEnqueueReleaseGLObjects");
    #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
    __clewCreateFromGLTexture2D         = (PFNCLCREATEFROMGLTEXTURE2D       )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture2D");
    __clewCreateFromGLTexture3D         = (PFNCLCREATEFROMGLTEXTURE3D       )CLEW_DYNLIB_IMPORT(module, "clCreateFromGLTexture3D");
    #endif
    __clewGetGLContextInfoKHR           = (PFNCLGETGLCONTEXTINFOKHR         )CLEW_DYNLIB_IMPORT(module, "clGetGLContextInfoKHR");

    if(__clewGetPlatformIDs == NULL) return 0;
    if(__clewGetPlatformInfo == NULL) return 0;
    if(__clewGetDeviceIDs == NULL) return 0;
    if(__clewGetDeviceInfo == NULL) return 0;

    return CLEW_SUCCESS;
}

const char *clewErrorString(cl_int error) {
    switch(error) {
        case CL_SUCCESS: return "Success!";                                                                         //    0
        case CL_DEVICE_NOT_FOUND: return "Device not found.";                                                       //   -1
        case CL_DEVICE_NOT_AVAILABLE: return "Device not available";                                                //   -2
        case CL_COMPILER_NOT_AVAILABLE: return "Compiler not available";                                            //   -3
        case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "Memory object allocation failure";                           //   -4
        case CL_OUT_OF_RESOURCES: return "Out of resources";                                                        //   -5
        case CL_OUT_OF_HOST_MEMORY: return "Out of host memory";                                                    //   -6
        case CL_PROFILING_INFO_NOT_AVAILABLE: return "Profiling information not available";                         //   -7
        case CL_MEM_COPY_OVERLAP: return "Memory copy overlap";                                                     //   -8
        case CL_IMAGE_FORMAT_MISMATCH: return "Image format mismatch";                                              //   -9
        case CL_IMAGE_FORMAT_NOT_SUPPORTED: return "Image format not supported";                                    //  -10
        case CL_BUILD_PROGRAM_FAILURE: return "Program build failure";                                              //  -11
        case CL_MAP_FAILURE: return "Map failure";                                                                  //  -12
        case CL_MISALIGNED_SUB_BUFFER_OFFSET: return "CL_MISALIGNED_SUB_BUFFER_OFFSET";                             //  -13
        case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST";   //  -14
        case CL_COMPILE_PROGRAM_FAILURE: return "CL_COMPILE_PROGRAM_FAILURE";                                       //  -15
        case CL_LINKER_NOT_AVAILABLE: return "CL_LINKER_NOT_AVAILABLE";                                             //  -16
        case CL_LINK_PROGRAM_FAILURE: return "CL_LINK_PROGRAM_FAILURE";                                             //  -17
        case CL_DEVICE_PARTITION_FAILED: return "CL_DEVICE_PARTITION_FAILED";                                       //  -18
        case CL_KERNEL_ARG_INFO_NOT_AVAILABLE: return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE";                           //  -19
        case CL_INVALID_VALUE: return "Invalid value";                                                              //  -30
        case CL_INVALID_DEVICE_TYPE: return "Invalid device type";                                                  //  -31
        case CL_INVALID_PLATFORM: return "Invalid platform";                                                        //  -32
        case CL_INVALID_DEVICE: return "Invalid device";                                                            //  -33
        case CL_INVALID_CONTEXT: return "Invalid context";                                                          //  -34
        case CL_INVALID_QUEUE_PROPERTIES: return "Invalid queue properties";                                        //  -35
        case CL_INVALID_COMMAND_QUEUE: return "Invalid command queue";                                              //  -36
        case CL_INVALID_HOST_PTR: return "Invalid host pointer";                                                    //  -37
        case CL_INVALID_MEM_OBJECT: return "Invalid memory object";                                                 //  -38
        case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: return "Invalid image format descriptor";                          //  -39
        case CL_INVALID_IMAGE_SIZE: return "Invalid image size";                                                    //  -40
        case CL_INVALID_SAMPLER: return "Invalid sampler";                                                          //  -41
        case CL_INVALID_BINARY: return "Invalid binary";                                                            //  -42
        case CL_INVALID_BUILD_OPTIONS: return "Invalid build options";                                              //  -43
        case CL_INVALID_PROGRAM: return "Invalid program";                                                          //  -44
        case CL_INVALID_PROGRAM_EXECUTABLE: return "Invalid program executable";                                    //  -45
        case CL_INVALID_KERNEL_NAME: return "Invalid kernel name";                                                  //  -46
        case CL_INVALID_KERNEL_DEFINITION: return "Invalid kernel definition";                                      //  -47
        case CL_INVALID_KERNEL: return "Invalid kernel";                                                            //  -48
        case CL_INVALID_ARG_INDEX: return "Invalid argument index";                                                 //  -49
        case CL_INVALID_ARG_VALUE: return "Invalid argument value";                                                 //  -50
        case CL_INVALID_ARG_SIZE: return "Invalid argument size";                                                   //  -51
        case CL_INVALID_KERNEL_ARGS: return "Invalid kernel arguments";                                             //  -52
        case CL_INVALID_WORK_DIMENSION: return "Invalid work dimension";                                            //  -53
        case CL_INVALID_WORK_GROUP_SIZE: return "Invalid work group size";                                          //  -54
        case CL_INVALID_WORK_ITEM_SIZE: return "Invalid work item size";                                            //  -55
        case CL_INVALID_GLOBAL_OFFSET: return "Invalid global offset";                                              //  -56
        case CL_INVALID_EVENT_WAIT_LIST: return "Invalid event wait list";                                          //  -57
        case CL_INVALID_EVENT: return "Invalid event";                                                              //  -58
        case CL_INVALID_OPERATION: return "Invalid operation";                                                      //  -59
        case CL_INVALID_GL_OBJECT: return "Invalid OpenGL object";                                                  //  -60
        case CL_INVALID_BUFFER_SIZE: return "Invalid buffer size";                                                  //  -61
        case CL_INVALID_MIP_LEVEL: return "Invalid mip-map level";                                                  //  -62
        case CL_INVALID_GLOBAL_WORK_SIZE: return "CL_INVALID_GLOBAL_WORK_SIZE";                                     //  -63
        case CL_INVALID_PROPERTY: return "CL_INVALID_PROPERTY";                                                     //  -64
        case CL_INVALID_IMAGE_DESCRIPTOR: return "CL_INVALID_IMAGE_DESCRIPTOR";                                     //  -65
        case CL_INVALID_COMPILER_OPTIONS: return "CL_INVALID_COMPILER_OPTIONS";                                     //  -66
        case CL_INVALID_LINKER_OPTIONS: return "CL_INVALID_LINKER_OPTIONS";                                         //  -67
        case CL_INVALID_DEVICE_PARTITION_COUNT: return "CL_INVALID_DEVICE_PARTITION_COUNT";                         //  -68
        default: return "Unknown OpenCL error value";
    }
}


text:
<?php

/**
 * CLEANING UP wp_head()
 *
 * Originally from http://wpengineer.com/1438/wordpress-header/ via Roots
 */
function vital_head_cleanup() {
    //remove_action('wp_head', 'feed_links', 2);
    //remove_action('wp_head', 'feed_links_extra', 3);
    //remove_action('wp_head', 'rsd_link');
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
    remove_action('wp_head', 'wp_generator');
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);

    global $wp_widget_factory;
    if(isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
        remove_action('wp_head',
            array(
                $wp_widget_factory->widgets['WP_Widget_Recent_Comments'],
                'recent_comments_style'
            )
        );
    }

    if (!class_exists('WPSEO_Frontend')) {
        remove_action('wp_head', 'rel_canonical');
        add_action('wp_head', 'vital_rel_canonical');
    }

    //removing emoji scripts:
    //https://wordpress.org/plugins/disable-emojis/
    //http://wordpress.stackexchange.com/questions/185577/disable-emojicons-introduced-with-wp-4-2
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'wp_print_styles', 'print_emoji_styles' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
    remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
    remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
    remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
    add_filter( 'tiny_mce_plugins', 'vital_disable_emojis_tinymce' );
}

function vital_disable_emojis_tinymce( $plugins ) {
    if ( is_array( $plugins ) ) {
        return array_diff( $plugins, array( 'wpemoji' ) );
    } else {
        return array();
    }
}

function vital_rel_canonical() {
    global $wp_the_query;

    if (!is_singular()) {
        return;
    }

    if (!$id = $wp_the_query->get_queried_object_id()) {
        return;
    }

    $link = get_permalink($id);
    echo "\t<link rel=\"canonical\" href=\"$link\">\n";
}

add_action('init', 'vital_head_cleanup');

/**
 * REMOVE THE WORDPRESS VERSION FROM RSS FEEDS
 */
add_filter('the_generator', '__return_false');

/**
 * CLEAN UP LANGUAGE_ATTRIBUTES() USED IN  TAG
 *
 * Remove dir="ltr"
 */
function vital_language_attributes() {

    $attributes = array();
    $output = '';

    if (is_rtl()) {
        $attributes[] = 'dir="rtl"';
    }

    $lang = get_bloginfo('language');

    if ($lang && $lang !== 'en-US') {
        $attributes[] = "lang=\"$lang\"";
    } else {
        $attributes[] = 'lang="en"';
    }

    $output = implode(' ', $attributes);
    $output = apply_filters('vital_language_attributes', $output);

    return $output;
}
add_filter('language_attributes', 'vital_language_attributes');

/**
 * CLEAN UP OUTPUT OF STYLESHEET <LINK> TAGS
 */
function vital_clean_style_tag($input) {
    preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);
    // Only display media if it is meaningful
    $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';
    return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
}
add_filter('style_loader_tag', 'vital_clean_style_tag');

/**
 * ADD AND REMOVE BODY_CLASS() CLASSES
 */
function vital_body_class($classes) {
    // Add post/page slug
    if (is_single() || is_page() && !is_front_page()) {
        $classes[] = basename(get_permalink());
    }

    // Remove unnecessary classes
    $home_id_class = 'page-id-' . get_option('page_on_front');
    $remove_classes = array(
        'page-template-default',
        $home_id_class
    );
    $classes = array_diff($classes, $remove_classes);

    return $classes;
}

add_filter('body_class', 'vital_body_class');

/**
 * WRAP EMBEDDED MEDIA AS SUGGESTED BY READABILITY
 *
 * https://gist.github.com/965956
 * http://www.readability.com/publishers/guidelines#publisher
 */
function vital_embed_wrap($cache, $url, $attr = '', $post_ID = '') {
    return '
' . $cache . '
';
}
add_filter('embed_oembed_html', 'vital_embed_wrap', 10, 4);

/**
 * CLEAN UP THE_EXCERPT()
 */
function vital_excerpt_length($length) {
    return POST_EXCERPT_LENGTH;
}
add_filter('excerpt_length', 'vital_excerpt_length');

function vital_excerpt_more($more) {
    return ' … ' . __('Continued', 'vital') . '';
}

add_filter('excerpt_more', 'vital_excerpt_more');

/**
 * DON'T RETURN THE DEFAULT DESCRIPTION IN THE RSS FEED IF IT HASN'T BEEN CHANGED
 */
function vital_remove_default_description($bloginfo) {
    $default_tagline = 'Just another WordPress site';
    return ($bloginfo === $default_tagline) ? '' : $bloginfo;
}

add_filter('get_bloginfo_rss', 'vital_remove_default_description');

/**
 * ADD ADDITIONAL CLASSES ONTO WIDGETS
 * http://wordpress.org/support/topic/how-to-first-and-last-css-classes-for-sidebar-widgets
 */
function vital_widget_first_last_classes($params) {
    global $my_widget_num;

    $this_id = $params[0]['id'];
    $arr_registered_widgets = wp_get_sidebars_widgets();

    if (!$my_widget_num) {
        $my_widget_num = array();
    }

    if (!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) {
        return $params;
    }

    if (isset($my_widget_num[$this_id])) {
        $my_widget_num[$this_id] ++;
    } else {
        $my_widget_num[$this_id] = 1;
    }

    $class = 'class="widget-' . $my_widget_num[$this_id] . ' ';

    if ($my_widget_num[$this_id] == 1) {
        $class .= 'widget-first ';
    } elseif ($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) {
        $class .= 'widget-last ';
    }

    $params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);

    return $params;
}

add_filter('dynamic_sidebar_params', 'vital_widget_first_last_classes');

/**
 * FIX FOR GET_SEARCH_QUERY() RETURNING +'S BETWEEN SEARCH TERMS
 */
function vital_search_query($escaped = true) {
    $query = apply_filters('vital_search_query', get_query_var('s'));

    if ($escaped) {
        $query = esc_attr($query);
    }

    return urldecode($query);
}

add_filter('get_search_query', 'vital_search_query');

/**
 * FIX FOR EMPTY SEARCH QUERIES REDIRECTING TO HOME PAGE
 *
 * http://wordpress.org/support/topic/blank-search-sends-you-to-the-homepage#post-1772565
 * http://core.trac.wordpress.org/ticket/11330
 */
function vital_request_filter($query_vars) {
    if (isset($_GET['s']) && empty($_GET['s']) && !is_admin()) {
    $query_vars['s'] = ' ';
  }

  return $query_vars;
}
add_filter('request', 'vital_request_filter');

?>


text:
package com.bernardomg.example.swss.test.util.config.properties;

/**
 * Paths to the WSS4J-based endpoints test properties files.
 * <p>
 * These files contain the URL for an endpoint and its WSDL, each with their own
 * security protocol, and the SOAP action for the tested operation.
 *
 * @author Bernardo Martínez Garrido
 */
public final class TestEndpointWss4jPropertiesPaths {

    /**
     * Encrypted endpoint.
     */
    public static final String ENCRYPTION      = "classpath:config/endpoint/test-endpoint-encryption-wss4j.properties";

    /**
     * Digested password endpoint.
     */
    public static final String PASSWORD_DIGEST = "classpath:config/endpoint/test-endpoint-password-digest-wss4j.properties";

    /**
     * Plain password endpoint.
     */
    public static final String PASSWORD_PLAIN  = "classpath:config/endpoint/test-endpoint-password-plain-wss4j.properties";

    /**
     * Signed endpoint.
     */
    public static final String SIGNATURE       = "classpath:config/endpoint/test-endpoint-signature-wss4j.properties";

    /**
     * Unsecure endpoint.
     */
    public static final String UNSECURE        = "classpath:config/endpoint/test-endpoint-unsecure.properties";

    /**
     * Private constructor to avoid initialization.
     */
    private TestEndpointWss4jPropertiesPaths() {
        super();
    }

}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj;

import edu.wpi.first.wpilibj.util.BaseSystemNotInitializedException;

public class RobotState {
  private static Interface impl;

  public static void SetImplementation(Interface i) {
    impl = i;
  }

  public static boolean isDisabled() {
    if (impl != null) {
      return impl.isDisabled();
    } else {
      throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
    }
  }

  public static boolean isEnabled() {
    if (impl != null) {
      return impl.isEnabled();
    } else {
      throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
    }
  }

  public static boolean isOperatorControl() {
    if (impl != null) {
      return impl.isOperatorControl();
    } else {
      throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
    }
  }

  public static boolean isAutonomous() {
    if (impl != null) {
      return impl.isAutonomous();
    } else {
      throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
    }
  }

  public static boolean isTest() {
    if (impl != null) {
      return impl.isTest();
    } else {
      throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
    }
  }

  interface Interface {
    boolean isDisabled();

    boolean isEnabled();

    boolean isOperatorControl();

    boolean isAutonomous();

    boolean isTest();
  }
}


text:
package org.apache.samza.container.grouper.task

import java.util

import org.apache.samza.container.TaskName
import org.apache.samza.system.SystemStreamPartition
import org.junit.Assert._
import org.junit.Test
import org.apache.samza.job.model.TaskModel
import org.apache.samza.Partition
import org.scalatest.Assertions.intercept
import scala.collection.JavaConversions._

class TestGroupByContainerCount {
  @Test
  def testEmptyTasks {
    intercept[IllegalArgumentException] { new GroupByContainerCount(1).group(new util.HashSet()) }
  }

  @Test
  def testFewerTasksThanContainers {
    val taskModels = new util.HashSet[TaskModel]()
    taskModels.add(getTaskModel("1", 1))
    intercept[IllegalArgumentException] { new GroupByContainerCount(2).group(taskModels) }
  }

  @Test
  def testHappyPath {
    val taskModels = Set(
      getTaskModel("1", 1),
      getTaskModel("2", 2),
      getTaskModel("3", 3),
      getTaskModel("4", 4),
      getTaskModel("5", 5))
    val containers = asScalaSet(new GroupByContainerCount(2)
      .group(setAsJavaSet(taskModels)))
      .map(containerModel => containerModel.getContainerId -> containerModel)
      .toMap
    assertEquals(2, containers.size)
    val container0 = containers(0)
    val container1 = containers(1)
    assertNotNull(container0)
    assertNotNull(container1)
    assertEquals(0, container0.getContainerId)
    assertEquals(1, container1.getContainerId)
    assertEquals(3, container0.getTasks.size)
    assertEquals(2, container1.getTasks.size)
    assertTrue(container0.getTasks.containsKey(new TaskName("1")))
    assertTrue(container0.getTasks.containsKey(new TaskName("3")))
    assertTrue(container0.getTasks.containsKey(new TaskName("5")))
    assertTrue(container1.getTasks.containsKey(new TaskName("2")))
    assertTrue(container1.getTasks.containsKey(new TaskName("4")))
  }

  private def getTaskModel(name: String, partitionId: Int) = {
    new TaskModel(new TaskName(name), Map[SystemStreamPartition, String](), new Partition(partitionId))
  }
}


text:
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/to_i', __FILE__)

describe "Float#" do
  it_behaves_like(:float_to_i, :to_int)
end

describe "Float#to_int" do
  it "needs to be reviewed for spec completeness"
end


text:
from os import path

from gluon import *
from gluon.storage import Storage
from s3 import *

THEME = "SandyRelief"

# =============================================================================
class index():
    """ Custom Home Page """

    def __call__(self):

        request = current.request
        response = current.response
        response.title = current.deployment_settings.get_system_name()

        T = current.T
        db = current.db
        s3db = current.s3db
        s3 = response.s3
        appname = request.application
        settings = current.deployment_settings

        # Check logged in and permissions
        auth = current.auth
        roles = current.session.s3.roles
        system_roles = auth.get_system_roles()
        ADMIN = system_roles.ADMIN
        AUTHENTICATED = system_roles.AUTHENTICATED
        s3_has_role = auth.s3_has_role

        # CMS
        item = ""
        if settings.has_module("cms"):
            table = s3db.cms_post
            ltable = s3db.cms_post_module
            query = (ltable.module == "default") & \
                    (ltable.post_id == table.id) & \
                    (table.deleted != True)
            item = db(query).select(table.body,
                                    limitby=(0, 1)).first()
            if item:
                item = DIV(XML(item.body))
            else:
                item = ""

        # Big Buttons
        big_buttons = DIV(
                        A(DIV(T("Request Supplies"),
                              _class = "menu-btn-r"),
                          _class = "menu-btn-l",
                          _href = URL(c="req", f="req", args=["create"], vars={"type":1})
                          ),
                        A(DIV(T("Request People"),
                              _class = "menu-btn-r"),
                          _class = "menu-btn-l",
                          _href=URL(c="req", f="req", args=["create"], vars={"type":3})
                          ),
                        A(DIV(T("Fulfill Requests"),
                              _class = "menu-btn-r"),
                          _class = "menu-btn-l",
                          _href=URL(c="req", f="req")
                          ),
                        _id = "sit_dec_res_box",
                        _class = "menu_box fleft swidth")

        # Login/Registration forms
        self_registration = settings.get_security_self_registration()
        registered = False
        login_form = None
        login_div = None
        register_form = None
        register_div = None
        if AUTHENTICATED not in roles:
            # This user isn't yet logged-in
            if request.cookies.has_key("registered"):
                # This browser has logged-in before
                registered = True

            if self_registration:
                # Provide a Registration box on front page
                register_form = auth.s3_registration_form()
                register_div = DIV(H3(T("Register")),
                                   P(XML(T("If you would like to help, then please %(sign_up_now)s") % \
                                            dict(sign_up_now=B(T("sign-up now"))))))

                if request.env.request_method == "POST":
                    post_script = \
'''$('#register_form').removeClass('hide')
$('#login_form').addClass('hide')'''
                else:
                    post_script = ""
                register_script = \
'''$('#register-btn').attr('href','#register')
$('#login-btn').attr('href','#login')
%s
$('#register-btn').click(function(){
 $('#register_form').removeClass('hide')
 $('#login_form').addClass('hide')
})
$('#login-btn').click(function(){
 $('#register_form').addClass('hide')
 $('#login_form').removeClass('hide')
})''' % post_script
                s3.jquery_ready.append(register_script)

            # Provide a login box on front page
            request.args = ["login"]
            auth.messages.submit_button = T("Login")
            login_form = auth()
            login_div = DIV(H3(T("Login")),
                            P(XML(T("Registered users can %(login)s to access the system") % \
                                  dict(login=B(T("login"))))))

        if settings.frontpage.rss:
            s3.external_stylesheets.append("http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css")
            s3.scripts.append("http://www.google.com/jsapi?key=notsupplied-wizard")
            s3.scripts.append("http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js")
            counter = 0
            feeds = ""
            for feed in settings.frontpage.rss:
                counter += 1
                feeds = "".join((feeds,
                                 "{title:'%s',\n" % feed["title"],
                                 "url:'%s'}" % feed["url"]))
                # Don't add a trailing comma for old IEs
                if counter != len(settings.frontpage.rss):
                    feeds += ",\n"
            # feedCycleTime: milliseconds before feed is reloaded (5 minutes)
            feed_control = "".join(('''
function LoadDynamicFeedControl(){
 var feeds=[
  ''', feeds, '''
 ]
 var options={
  feedCycleTime:300000,
  numResults:5,
  stacked:true,
  horizontal:false,
  title:"''', str(T("News")), '''"
 }
 new GFdynamicFeedControl(feeds,'feed-control',options)
}
google.load('feeds','1')
google.setOnLoadCallback(LoadDynamicFeedControl)'''))
            s3.js_global.append(feed_control)

        view = path.join(request.folder, "private", "templates",
                         THEME, "views", "index.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP(404, "Unable to open Custom View: %s" % view)

        return dict(title = response.title,
                    item = item,
                    big_buttons = big_buttons,
                    self_registration=self_registration,
                    registered=registered,
                    login_form=login_form,
                    login_div=login_div,
                    register_form=register_form,
                    register_div=register_div
                    )

# =============================================================================
class req():
    """
        Function to handle pagination for the requests list on the homepage
    """

    def __call__(self):

        request = current.request
        get_vars = request.get_vars

        resource = current.s3db.resource("req_req")
        totalrows = resource.count()
        if "iDisplayLength" in get_vars:
            display_length = int(request.get_vars["iDisplayLength"])
        else:
            display_length = 10
        limit = 4 * display_length

        list_fields = ["id", "name"]
        filter, orderby, left = resource.datatable_filter(list_fields,
                                                          get_vars)
        resource.add_filter(filter)

        data = resource.select(list_fields,
                               start=0,
                               limit=limit,
                               orderby=orderby,
                               left=left,
                               count=True,
                               represent=True)
        filteredrows = data["numrows"]
        rfields = data["rfields"]
        rows = data["rows"]

        dt = S3DataTable(rfields, rows)
        dt.defaultActionButtons(resource)
        current.response.s3.no_formats = True

        if request.extension == "html":
            items = dt.html(totalrows,
                            totalrows,
                            "req_list_1",
                            dt_displayLength=display_length,
                            dt_ajax_url=URL(c="default",
                                            f="index",
                                            args=["req"],
                                            extension="aadata",
                                            vars={"id": "req_list_1"},
                                            ),
                            dt_pagination="true",
                           )
        elif request.extension == "aadata":
            if "sEcho" in request.vars:
                echo = int(request.vars.sEcho)
            else:
                echo = None
            items = dt.json(totalrows,
                            filteredrows,
                            "req_list_1",
                            echo)
        else:
            from gluon.http import HTTP
            raise HTTP(501, current.ERROR.BAD_FORMAT)
        return items

# =============================================================================
class contact():
    """ Contact Form """

    def __call__(self):

        request = current.request
        response = current.response

        view = path.join(request.folder, "private", "templates",
                         THEME, "views", "contact.html")
        try:
            # Pass view as file not str to work in compiled mode
            response.view = open(view, "rb")
        except IOError:
            from gluon.http import HTTP
            raise HTTP(404, "Unable to open Custom View: %s" % view)

        if request.env.request_method == "POST":
            # Processs Form
            vars = request.post_vars
            result = current.msg.send_email(
                    to=current.deployment_settings.get_mail_approver(),
                    subject=vars.subject,
                    message=vars.message,
                    reply_to=vars.address,
                )
            if result:
                response.confirmation = "Thankyou for your message - we'll be in touch shortly"

        #T = current.T

        form = DIV(
                H1("Contact Us"),
                P("You can leave a message using the contact form below."),
                FORM(TABLE(
                        TR(LABEL("Your name:",
                              SPAN(" *", _class="req"),
                              _for="name")),
                        TR(INPUT(_name="name", _type="text", _size=62, _maxlength="255")),
                        TR(LABEL("Your e-mail address:",
                              SPAN(" *", _class="req"),
                              _for="address")),
                        TR(INPUT(_name="address", _type="text", _size=62, _maxlength="255")),
                        TR(LABEL("Subject:",
                              SPAN(" *", _class="req"),
                              _for="subject")),
                        TR(INPUT(_name="subject", _type="text", _size=62, _maxlength="255")),
                        TR(LABEL("Message:",
                              SPAN(" *", _class="req"),
                              _for="name")),
                        TR(TEXTAREA(_name="message", _class="resizable", _rows=5, _cols=62)),
                        TR(INPUT(_type="submit", _value="Send e-mail")),
                        ),
                    _id="mailform"
                    )
                )
        s3 = response.s3
        if s3.cdn:
            if s3.debug:
                s3.scripts.append("http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js")
            else:
                s3.scripts.append("http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js")

        else:
            if s3.debug:
                s3.scripts.append("/%s/static/scripts/jquery.validate.js" % request.application)
            else:
                s3.scripts.append("/%s/static/scripts/jquery.validate.min.js" % request.application)
        s3.jquery_ready.append(
'''$('#mailform').validate({
 errorClass:'req',
 rules:{
  name:{
   required:true
  },
  subject:{
   required:true
  },
  message:{
   required:true
  },
  name:{
   required:true
  },
  address: {
   required:true,
   email:true
  }
 },
 messages:{
  name:"Enter your name",
  subject:"Enter a subject",
  message:"Enter a message",
  address:{
   required:"Please enter a valid email address",
   email:"Please enter a valid email address"
  }
 },
 errorPlacement:function(error,element){
  error.appendTo(element.parents('tr').prev().children())
 },
 submitHandler:function(form){
  form.submit()
 }
})''')
        # @ToDo: Move to static
        s3.jquery_ready.append(
'''$('textarea.resizable:not(.textarea-processed)').each(function() {
    // Avoid non-processed teasers.
    if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) {
        return false;
    }
    var textarea = $(this).addClass('textarea-processed'), staticOffset = null;
    // When wrapping the text area, work around an IE margin bug. See:
    // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout
    $(this).wrap('

')
    .parent().append($('

').mousedown(startDrag));
    var grippie = $('div.grippie', $(this).parent())[0];
    grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px';
    function startDrag(e) {
        staticOffset = textarea.height() - e.pageY;
        textarea.css('opacity', 0.25);
        $(document).mousemove(performDrag).mouseup(endDrag);
        return false;
    }
    function performDrag(e) {
        textarea.height(Math.max(32, staticOffset + e.pageY) + 'px');
        return false;
    }
    function endDrag(e) {
        $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
        textarea.css('opacity', 1);
    }
});''')

        response.title = "Contact | SandyRelief"
        return dict(form=form)

# END =========================================================================


text:
package fixtures.azurespecials.implementation;

import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import fixtures.azurespecials.ErrorException;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;

/**
 * An instance of this class provides access to all the operations defined
 * in Odatas.
 */
public class OdatasInner {
    /** The Retrofit service to perform REST calls. */
    private OdatasService service;
    /** The service client containing this operation class. */
    private AutoRestAzureSpecialParametersTestClientImpl client;

    /**
     * Initializes an instance of OdatasInner.
     *
     * @param retrofit the Retrofit instance built from a Retrofit Builder.
     * @param client the instance of the service client containing this operation class.
     */
    public OdatasInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) {
        this.service = retrofit.create(OdatasService.class);
        this.client = client;
    }

    /**
     * The interface defining all the services for Odatas to be
     * used by Retrofit to perform actually REST calls.
     */
    interface OdatasService {
        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.azurespecials.Odatas getWithFilter" })
        @GET("azurespecials/odata/filter")
        Observable<Response<ResponseBody>> getWithFilter(@Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderby") String orderby, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws ErrorException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void getWithFilter() {
        getWithFilterWithServiceResponseAsync().toBlocking().single().body();
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<Void> getWithFilterAsync(final ServiceCallback<Void> serviceCallback) {
        return ServiceFuture.fromResponse(getWithFilterWithServiceResponseAsync(), serviceCallback);
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<Void> getWithFilterAsync() {
        return getWithFilterWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() {
            @Override
            public Void call(ServiceResponse<Void> response) {
                return response.body();
            }
        });
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<ServiceResponse<Void>> getWithFilterWithServiceResponseAsync() {
        final String filter = null;
        final Integer top = null;
        final String orderby = null;
        return service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
                @Override
                public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<Void> clientResponse = getWithFilterDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''.
     * @param top The top parameter with value 10.
     * @param orderby The orderby parameter with value id.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws ErrorException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     */
    public void getWithFilter(String filter, Integer top, String orderby) {
        getWithFilterWithServiceResponseAsync(filter, top, orderby).toBlocking().single().body();
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''.
     * @param top The top parameter with value 10.
     * @param orderby The orderby parameter with value id.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<Void> getWithFilterAsync(String filter, Integer top, String orderby, final ServiceCallback<Void> serviceCallback) {
        return ServiceFuture.fromResponse(getWithFilterWithServiceResponseAsync(filter, top, orderby), serviceCallback);
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''.
     * @param top The top parameter with value 10.
     * @param orderby The orderby parameter with value id.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<Void> getWithFilterAsync(String filter, Integer top, String orderby) {
        return getWithFilterWithServiceResponseAsync(filter, top, orderby).map(new Func1<ServiceResponse<Void>, Void>() {
            @Override
            public Void call(ServiceResponse<Void> response) {
                return response.body();
            }
        });
    }

    /**
     * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'.
     *
     * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''.
     * @param top The top parameter with value 10.
     * @param orderby The orderby parameter with value id.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceResponse} object if successful.
     */
    public Observable<ServiceResponse<Void>> getWithFilterWithServiceResponseAsync(String filter, Integer top, String orderby) {
        return service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
                @Override
                public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<Void> clientResponse = getWithFilterDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<Void> getWithFilterDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
        return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<Void>() { }.getType())
                .registerError(ErrorException.class)
                .build(response);
    }

}


text:
package com.gnirt69.mscrum.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import butterknife.ButterKnife;
import butterknife.Bind;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.gnirt69.mscrum.R;
import com.gnirt69.mscrum.constant.MSConstants;
import com.gnirt69.mscrum.model.DataHolder;
import com.gnirt69.mscrum.utils.JSONObjectManager;

import com.gnirt69.mscrum.utils.Utils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class LoginActivity extends ActionBarActivity {
    private static final String TAG = "LoginActivity";
    private static final int REQUEST_SIGNUP = 0;

    @Bind(R.id.input_email) EditText _emailText;
    @Bind(R.id.input_password) EditText _passwordText;
    @Bind(R.id.btn_login) Button _loginButton;
    @Bind(R.id.link_signup) TextView _signupLink;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);

        _emailText.setText("sm1@gmail.com");
        _passwordText.setText("123456");

        _loginButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                login();
            }
        });

        _signupLink.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // Start the Signup activity
//                Intent intent = new Intent(getApplicationContext(), SignupActivity.class);
//                startActivityForResult(intent, REQUEST_SIGNUP);
            }
        });
    }

    public void login() {
        Log.d(TAG, "Login");

        //razib need to open later

        if (!validate()) {
            onLoginFailed();
            return;
        }

//        _loginButton.setEnabled(false);

//        final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this,
//                R.style.AppTheme_Dark_Dialog);
        final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this,
                R.style.AppTheme);
        progressDialog.setIndeterminate(true);
        progressDialog.setMessage("Authenticating...");
        progressDialog.show();

        String email = _emailText.getText().toString();
        String password = _passwordText.getText().toString();

        //test data

        // TODO: Implement your own authentication logic here.

//        new android.os.Handler().postDelayed(
//                new Runnable() {
//                    public void run() {
//                        // On complete call either onLoginSuccess or onLoginFailed
//                        onLoginSuccess();
//                        // onLoginFailed();
//                        progressDialog.dismiss();
//                    }
//                }, 3000);

        JSONObject userObj = new JSONObject();

        try {
            userObj.put("email", email);
            userObj.put("password", password);

            Log.d("userObj:", userObj.toString());

        } catch (JSONException e) {
            Log.d("JSONException", "JSONException"+e.toString());
            e.printStackTrace();
        }

        RequestQueue requestQueue = Volley.newRequestQueue(this);
        JsonObjectRequest stringRequest = new JsonObjectRequest(Request.Method.POST, MSConstants.USER_LOGIN, userObj,
                new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {
                        Log.d("response", "Success");
                        Log.d("response", "Success"+response.toString());

                        try {
                            int status = response.getInt(MSConstants.KEY_STATUSCODE);
                            if(status ==1) {
                                JSONObject userData  = response.getJSONObject("data");
                                DataHolder.getInstance().setLogger(JSONObjectManager.parseUser(userData.getJSONObject("individual")));
                                int userType = JSONObjectManager.parseUserType(userData.getJSONObject("individual"));

                                if(userType > 0) {

                                    if(userData.has("userList")) {
                                        JSONArray userList = (JSONArray) userData.get("userList");
                                        if (userList != null && userList.length() > 0) {
                                            DataHolder.getInstance().setUserList(JSONObjectManager.parseUserListData(userList));
                                        }

                                    }

                                    if(userData.has("projectList")) {
                                        JSONArray projectList = (JSONArray) userData.get("projectList");
                                        if (projectList != null) {
//                                                    DataHolder.getInstance().setUserList(JSONObjectManager.parseUserListData(userList));
                                            DataHolder.getInstance().setProjectList(JSONObjectManager.parseProjectData(projectList));
                                        }
                                    }

                                    switch(userType){

                                        case 1:  //System admin

                                            break;
                                        case 2:  //po

                                        case 3:  //Sm
                                        case 4:  //dev

                                        default:
                                            Log.d("User Type:", "Not a valid User");

                                    }

                                //permission list
                                //save token n user type

                                String token = userData.getString("token");
//                                JSONObject role = userData.

                                   SharedPreferences sharedpreferences = getSharedPreferences(MSConstants.MSPREFERENCES, Context.MODE_PRIVATE);
                                   Utils.Save(sharedpreferences, token, userType);
                                   onLoginSuccess(userType);
                                   progressDialog.dismiss();
                               } else {
                                   progressDialog.dismiss();
                                   Toast.makeText(getBaseContext(), "Could't find Role", Toast.LENGTH_LONG).show();
                               }

                            }else {
                                Toast.makeText(getBaseContext(), "Email or Password is Incorrect", Toast.LENGTH_LONG).show();
                            }
                        } catch (JSONException e) {
                            Log.d("JSONException", ""+e.toString());
//                            e.printStackTrace();
                        }

                        progressDialog.dismiss();
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_LONG).show();
                        Log.d("Error", "Nope"+error.toString());
                        progressDialog.dismiss();
                    }
                }){
//            @Override
//            protected Map<String,String> getParams(){
//                Map<String,String> params = new HashMap<String, String>();
//                params.put("firstName", "gggg");
////                params.put(MSConstants.KEY_LASTNAME, lName);
////                params.put(MSConstants.KEY_EMAIL, emailAddress);
////                params.put(MSConstants.KEY_PASSWORD,passwordText);
////                Log.d("params", ":" +params.get());
//
//                return params;
//            }

//            @Override
//            public Map<String, String> getHeaders() throws AuthFailureError {
//                HashMap<String, String> headers = new HashMap<String, String>();
//                headers.put("Content-Type", "application/json");
////                headers.put("Accept", "application/json");
//                Log.d("headers", ":" +headers.get("Content-Type"));
//                return headers;
//            }

        };

        Log.d("stringRequest", ":" +stringRequest);
//        stringRequest.setRetryPolicy(new RetryPolicy() {
//            @Override
//            public int getCurrentTimeout() {
//                return 50000;
//            }
//
//            @Override
//            public int getCurrentRetryCount() {
//                return 50000;
//            }
//
//            @Override
//            public void retry(VolleyError error) throws VolleyError {
//
//            }
//        });

        requestQueue.add(stringRequest);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == REQUEST_SIGNUP) {
            if (resultCode == RESULT_OK) {

                // TODO: Implement successful signup logic here
                // By default we just finish the Activity and log them in automatically
                this.finish();
            }
        }
    }

    @Override
    public void onBackPressed() {
        // Disable going back to the MainActivity
        moveTaskToBack(true);
    }

    public void onLoginSuccess(int userType) {
        _loginButton.setEnabled(true);
        Intent intent=new Intent();
        intent.putExtra("USERTYPE",userType);
        setResult(200,intent);
        finish();
    }

    public void onLoginFailed() {
        Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();

        _loginButton.setEnabled(true);
    }

    public boolean validate() {
        boolean valid = true;

        String email = _emailText.getText().toString();
        String password = _passwordText.getText().toString();

        if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
            _emailText.setError("enter a valid email address");
            valid = false;
        } else {
            _emailText.setError(null);
        }

        if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
            _passwordText.setError("between 4 and 10 alphanumeric characters");
            valid = false;
        } else {
            _passwordText.setError(null);
        }

        return valid;
    }
}


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe 'date input' do

  include FormtasticSpecHelper

  before do
    @output_buffer = ''
    mock_everything

    semantic_form_for(@new_post) do |builder|
      concat(builder.input(:publish_at, :as => :date))
    end
  end

  it_should_have_input_wrapper_with_class("date")
  it_should_have_input_wrapper_with_id("post_publish_at_input")
  it_should_have_a_nested_fieldset
  it_should_apply_error_logic_for_input_type(:date)

  it 'should have a legend - classified as a label - containing the label text inside the fieldset' do
    output_buffer.should have_tag('form li.date fieldset legend.label', /Publish at/)
  end

  it 'should have an ordered list of three items inside the fieldset' do
    output_buffer.should have_tag('form li.date fieldset ol')
    output_buffer.should have_tag('form li.date fieldset ol li', :count => 3)
  end

  it 'should have three labels for year, month and day' do
    output_buffer.should have_tag('form li.date fieldset ol li label', :count => 3)
    output_buffer.should have_tag('form li.date fieldset ol li label', /year/i)
    output_buffer.should have_tag('form li.date fieldset ol li label', /month/i)
    output_buffer.should have_tag('form li.date fieldset ol li label', /day/i)
  end

  it 'should have three selects for year, month and day' do
    output_buffer.should have_tag('form li.date fieldset ol li select', :count => 3)
  end

  it_should_select_existing_datetime_else_current(:year, :month, :day)
  it_should_select_explicit_default_value_if_set(:year, :month, :day)

  describe "when :selected is nil" do

    before(:each) do
      output_buffer.replace ''
      semantic_form_for(:project, :url => 'http://test.host') do |builder|
        concat(builder.input(:publish_at, :as => :datetime, :selected => nil))
      end
    end

    it "should not pre-select any options" do
      output_buffer.should_not have_tag("form li.datetime li select option[@selected]")
    end

  end

end


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

namespace SpecByExample.Common
{
    public class HtmlElementIsNoInputElementException : Exception
    {
        public HtmlElementIsNoInputElementException() : base() { }
        public HtmlElementIsNoInputElementException(string message) : base(message) { }
        public HtmlElementIsNoInputElementException(string message, Exception innerException) : base(message, innerException) { }
    }
}


text:
<?php

/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/

return [
    'accepted'             => 'Ang :attribute ay dapat tanggapin.',
    'accepted_if'          => 'The :attribute must be accepted when :other is :value.',
    'active_url'           => 'Ang :attribute ay hindi balidong URL.',
    'after'                => 'Ang :attribute ay dapat petsa pagkatapos ng :date.',
    'after_or_equal'       => 'Ang :attribute ay dapat na isang petsa pagkatapos o katumbas ng :date.',
    'alpha'                => 'Ang :attribute ay maaaring magtaglay ng mga letra lang.',
    'alpha_dash'           => 'Ang :attribute ay maaaring magtaglay ng mga letra, numero at gitling lang.',
    'alpha_num'            => 'Ang :attribute ay maaaring magtaglay ng mga letra at numero lang.',
    'array'                => 'Ang :attribute ay dapat magkakasunod.',
    'before'               => 'Ang :attribute ay dapat petsa bago ang :date.',
    'before_or_equal'      => 'Ang :attribute ay dapat na isang petsa bago o katumbas ng :date.',
    'between'              => [
        'array'   => 'Ang :attribute ay dapat nasa pagitan ng :min at :max items.',
        'file'    => 'Ang :attribute ay dapat nasa pagitan ng :min at :max kilobytes.',
        'numeric' => 'Ang :attribute ay dapat nasa pagitan ng :min at :max.',
        'string'  => 'Ang :attribute ay dapat nasa pagitan ng :min at :max characters.',
    ],
    'boolean'              => 'Ang :attribute ng attribute ay dapat tama o mali.',
    'confirmed'            => 'Ang :attribute ng attribute ay hindi magkatugma.',
    'current_password'     => 'The password is incorrect.',
    'date'                 => 'Ang :attribute ay hindi balidong petsa.',
    'date_equals'          => ':attribute ay dapat na isang petsa na katumbas ng :date.',
    'date_format'          => 'Ang :attribute ay hindi katugma ng format :format.',
    'declined'             => 'The :attribute must be declined.',
    'declined_if'          => 'The :attribute must be declined when :other is :value.',
    'different'            => 'Ang :attribute at :other pa ay dapat magkaiba.',
    'digits'               => 'Ang :attribute ay dapat :digits digits.',
    'digits_between'       => 'Ang :attribute ay dapat nasa pagitan ng :min at :max digits.',
    'dimensions'           => 'Ang :attribute ay may di-wastong sukat ng imahe.',
    'distinct'             => 'Ang :attribute ng attribute ay may katulad na balyu.',
    'email'                => 'Ang :attribute ay dapat balidong email address.',
    'ends_with'            => ':attribute ang dapat magtapos sa isa sa mga sumusunod: :values.',
    'enum'                 => 'The selected :attribute is invalid.',
    'exists'               => 'Ang piniling :attribute ay imbalido.',
    'file'                 => 'Ang :attribute ay dapat na isang talaksan.',
    'filled'               => 'Ang :attribute ng attribute ay kailangan.',
    'gt'                   => [
        'array'   => 'The :attribute must have more than :value items.',
        'file'    => 'The :attribute must be greater than :value kilobytes.',
        'numeric' => 'The :attribute must be greater than :value.',
        'string'  => 'The :attribute must be greater than :value characters.',
    ],
    'gte'                  => [
        'array'   => 'The :attribute must have :value items or more.',
        'file'    => 'The :attribute must be greater than or equal :value kilobytes.',
        'numeric' => 'The :attribute must be greater than or equal :value.',
        'string'  => 'The :attribute must be greater than or equal :value characters.',
    ],
    'image'                => 'Ang :attribute ay dapat isang imahe.',
    'in'                   => 'Ang piniling :attribute ay imbalido.',
    'in_array'             => 'Ang :attribute ng attribute ay wala sa :other.',
    'integer'              => 'Ang :attribute ay dapat isang integer.',
    'ip'                   => 'Ang :attribute ay dapat isang balidong IP address.',
    'ipv4'                 => 'Ang :attribute ay dapat na isang wastong Ipbagong address.',
    'ipv6'                 => 'Ang :attribute ay dapat na isang balidong Ipbagong address.',
    'json'                 => 'Ang :attribute ay dapat isang balidong JSON string.',
    'lt'                   => [
        'array'   => 'The :attribute must have less than :value items.',
        'file'    => 'The :attribute must be less than :value kilobytes.',
        'numeric' => 'The :attribute must be less than :value.',
        'string'  => 'The :attribute must be less than :value characters.',
    ],
    'lte'                  => [
        'array'   => 'The :attribute must not have more than :value items.',
        'file'    => 'The :attribute must be less than or equal :value kilobytes.',
        'numeric' => 'The :attribute must be less than or equal :value.',
        'string'  => 'The :attribute must be less than or equal :value characters.',
    ],
    'mac_address'          => 'The :attribute must be a valid MAC address.',
    'max'                  => [
        'array'   => 'Ang :attribute ay hindi maaaring higit sa :max items.',
        'file'    => 'Ang :attribute ay hindi maaaring higit sa  :max kilobytes.',
        'numeric' => 'Ang :attribute ay hindi maaaring higit sa  :max.',
        'string'  => 'Ang :attribute ay hindi maaaring higit sa :max characters.',
    ],
    'mimes'                => 'Ang :attribute ay dapat file ng uri na: :values.',
    'mimetypes'            => 'Ang :attribute ay dapat na isang talaksan ng uri: :values.',
    'min'                  => [
        'array'   => 'Ang :attribute ay dapat di-kukulangin sa :min items.',
        'file'    => 'Ang :attribute ay dapat di-kukulangin sa :min kilobytes.',
        'numeric' => 'Ang :attribute ay dapat di-kukulangin sa :min.',
        'string'  => 'Ang :attribute ay dapat di-kukulangin sa :min characters.',
    ],
    'multiple_of'          => 'Ang :attribute ay dapat na maramihang ng :value',
    'not_in'               => 'Ang piniling :attribute ay imbalido.',
    'not_regex'            => 'Hindi tanggap ang :attribute na anyo.',
    'numeric'              => 'Ang :attribute ay dapat isang numero.',
    'password'             => 'Ang password ay hindi tama.',
    'present'              => 'Ang :attribute ng attribute ay dapat naroon.',
    'prohibited'           => 'Ang patlang na :attribute ay ipinagbabawal.',
    'prohibited_if'        => 'Ang :attribute patlang ay ipinagbabawal kapag :other ay :value.',
    'prohibited_unless'    => 'Ang :attribute patlang ay ipinagbabawal maliban kung :other ay nasa :values.',
    'prohibits'            => 'The :attribute field prohibits :other from being present.',
    'regex'                => 'Ang :attribute ng attribute ay imbalido.',
    'required'             => 'Ang :attribute ng attribute ay kailangan.',
    'required_array_keys'  => 'The :attribute field must contain entries for: :values.',
    'required_if'          => 'Ang :attribute ng attribute ay kailangan kapag :other iba ay :value.',
    'required_unless'      => 'Ang :attribute ng attribute ay kailangan maliban kung :other iba ay nasa :values.',
    'required_with'        => 'Ang :attribute ng attribute ay kailangan kapag :values balyu ang naroon.',
    'required_with_all'    => 'Ang :attribute ng attribute ay kailangan kapag :values balyu ang naroon.',
    'required_without'     => 'Ang :attribute ng attribute ay kailangan kapag :values balyu ang naroon.',
    'required_without_all' => 'Ang :attribute ng attribute ay kailangan kapag wala sa :values balyu ang naroon.',
    'same'                 => 'Ang :attribute at :other pa ay dapat magtugma.',
    'size'                 => [
        'array'   => 'Ang :attribute ay dapat magtaglay ng :size sa items.',
        'file'    => 'Ang :attribute ay dapat :size sukat sa kilobytes.',
        'numeric' => 'Ang :attribute ay dapat :size sukat.',
        'string'  => 'Ang :attribute ay dapat :size sukat sa characters.',
    ],
    'starts_with'          => 'Ang :attribute ay dapat magsimula sa isa sa mga sumusunod: :values.',
    'string'               => 'Ang  :attribute ay dapat isang string.',
    'timezone'             => 'Ang :attribute ay dapat isang balidong sona.',
    'unique'               => 'Ang :attribute ay nakuha na.',
    'uploaded'             => 'Nabigo ang :attribute upang i-upload.',
    'url'                  => 'Ang :attribute ng attribute ay imbalido.',
    'uuid'                 => ':attribute ay dapat na isang wastong UUID.',
    'custom'               => [
        'attribute-name' => [
            'rule-name' => 'pasadyang-mensahe',
        ],
    ],
];


text:
mkdir -p ~/.ssh

if [ -f /tmp/gerrit/id_rsa ]; then
    echo "Setting private key"
    eval `ssh-agent -s`
    cp /tmp/gerrit/id_rsa ~/.ssh/id_rsa
    chmod 600 ~/.ssh/id_rsa
    echo "StrictHostKeyChecking no" > ~/.ssh/config
    ssh-add ~/.ssh/id_rsa
    ssh-keyscan -p $INFRABOX_GERRIT_PORT $INFRABOX_GERRIT_HOSTNAME >> ~/.ssh/known_hosts
else
    echo "No private key configured"
fi

python /git/api.py


text:
<bill session="115" type="hr" number="381" updated="2017-09-15T19:15:11Z">
  <state datetime="2017-06-13T12:20:34-04:00">PASSED:SIMPLERES</state>
  <status>
    <unknown datetime="2017-06-13T12:20:34-04:00"/>
  </status>
  <introduced datetime="2017-06-13"/>
  <titles>
    <title type="official" as="introduced">Electing Members to certain standing committees of the House of Representatives.</title>
    <title type="display">Electing Members to certain standing committees of the House of Representatives.</title>
  </titles>
  <sponsor bioguide_id="B001297"/>
  <cosponsors/>
  <actions>
    <action datetime="2017-06-13">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-06-13T12:19:45-04:00">
      <text>Considered as privileged matter.</text>
      <reference ref="CR H4867" label="consideration"/>
    </action>
    <vote how="without objection" type="vote" datetime="2017-06-13T12:20:34-04:00" where="h" result="pass" state="PASSED:SIMPLERES">
      <text>On agreeing to the resolution Agreed to without objection.</text>
      <reference ref="CR H4867" label="text"/>
    </vote>
    <action datetime="2017-06-13T12:20:40-04:00">
      <text>Motion to reconsider laid on the table Agreed to without objection.</text>
    </action>
  </actions>
  <committees/>
  <relatedbills/>
  <subjects>
    <term name="Congress"/>
    <term name="Congressional committees"/>
    <term name="House Committee on Oversight and Government Reform"/>
    <term name="House Committee on the Judiciary"/>
    <term name="House of Representatives"/>
    <term name="Members of Congress"/>
  </subjects>
  <amendments/>
  <summary date="2017-06-13T12:24:15Z" status="Passed House without amendment">(This measure has not been amended since it was introduced. The summary of that version is repeated here.)

Elects specified Members to the following House Committees: (1) the Judiciary, and (2) Oversight and Government Reform.

Declares that Representative Jason Chaffetz shall rank after Representative Jim Jordan on the House Committee on Oversight and Government Reform.</summary>
  <committee-reports/>
</bill>


text:
echo "launch_script.sh start"
service nginx start
uwsgi ./conf/ImageResizingServerApp.ini