text:
"""
Methods for generating "perfect data" hessians.
"""
from __future__ import division
from builtins import zip
from builtins import range
from past.utils import old_div
__docformat__ = "restructuredtext en"

import copy
import logging
logger = logging.getLogger('RxnNets.PerfectData')

import scipy
import scipy.integrate
import numpy as np

from SloppyCell.ReactionNetworks import Dynamics
from SloppyCell import HAVE_MPI, my_rank, my_host, num_procs, comm

def apply_func_to_traj(traj, func, only_nonderivs=False):
    """
    Return a trajectory with func applied to each variable stored in the
    trajectory
    """
    if only_nonderivs:
        keys = [key for key in list(traj.key_column.keys())
                if not isinstance(key, tuple)]
    else:
        keys = None

    ret_traj = traj.copy_subset(keys)
    for var, col in list(traj.key_column.items()):
        vals = func(traj, var)
        ret_traj.values[:,col] = vals

    return ret_traj

def update_typical_vals(networks, int_times, rtol = 1e-9, fraction=1.0,
                        cutoff=1e-14):
    """
    Update the typical var values for a group of networks.

    Find the maximum of each variable over the integrations. In each network
    the typical value is set to fraction of that maximum. If that maximum value
    is less than cutoff, the typical value is set to 1.

    networks    List of networks to work with
    int_times   List of corresponding integration endpoints
                  (ie. [(0, 100), (0, 50)])
    fraction    Relative size of typical value, compared to max value over
                the integrations.
    rtol        Relative tolerance for the integrations.
    cutoff      Values below this are considered to be zero
    """
    max_vals = {}
    for net, times in zip(networks, int_times):
        traj = Dynamics.integrate(net, times, rtol=rtol, fill_traj=True)
        for var_id in list(net.variables.keys()):
            curr_max = max(traj.get_var_traj(var_id))
            max_vals[var_id] = max(curr_max, max_vals.get(var_id, 0))

    for var_id, val in list(max_vals.items()):
        for net in networks:
            if var_id in net.variables:
                if val > cutoff:
                    net.set_var_typical_val(var_id, val*fraction)
                else:
                    net.set_var_typical_val(var_id, 1.0)

    return max_vals

def typ_val_uncert(fraction = 0.1, cutoff=1e-14):
    """
    This is an uncertainty that is fraction of the variable's typical value.
    """
    def sigmaFunc(traj, data_id):
        sigma = traj.get_var_typical_val(data_id) * fraction
        if sigma < cutoff:
            logger.warn('sigma < cutoff value (%g) for variable %s! '
                        'Taking sigma = 1.' % (cutoff, data_id))
            sigma = 1
        return sigma
    return sigmaFunc

def discrete_data(net, params, pts, interval, vars=None, random=False,
                  uncert_func=typ_val_uncert(0.1, 1e-14)):
    """
    Return a set of data points for the given network generated at the given
    parameters.

    net         Network to generate data for
    params      Parameters for this evaluation of the network
    pts         Number of data points to output
    interval    Integration interval
    vars        Variables to output data for, defaults to all species in net
    random      If False data points are distributed evenly over interval
                If True they are spread randomly and uniformly over each
                variable
    uncert_func Function that takes in a trajectory and a variable id and
                returns what uncertainty should be assumed for that variable,
                either as a scalar or a list the same length as the trajectory.
    """
    # Default for vars
    if vars is None:
        vars = list(net.species.keys())

    # Assign observed times to each variable
    var_times = {}
    for var in vars:
        if random:
            var_times[var] = np.random.rand(pts) * (interval[1]-interval[0]) + interval[0]
        else:
            var_times[var] = np.linspace(interval[0], interval[1], pts)

    # Create a sorted list of the unique times in the var_times dict
    int_times = set(np.ravel(list(var_times.values())))
    int_times.add(0)
    int_times = list(int_times)
    int_times.sort()

    # Get the trajectory
    traj = Dynamics.integrate(net, int_times, params=params, fill_traj=False)

    # Build up our data dictionary
    data = {}
    for var, times in list(var_times.items()):
        var_data = {}
        data[var] = var_data

        # Calculate our uncertainties
        var_uncerts = uncert_func(traj, var)
        for time in times:
            val = traj.get_var_val(var, time)
            if np.isscalar(var_uncerts):
                uncert = var_uncerts
            else:
                index = traj._get_time_index(time)
                uncert = var_uncerts[index]
            var_data[time] = (val, uncert)
    return data

def hessian_log_params(sens_traj, data_ids=None, opt_ids=None,
                       fixed_sf=False, return_dict=False,
                       uncert_func=typ_val_uncert(1.0, 1e-14)):
    """
    Calculate the "perfect data" hessian in log parameters given a sensitivity
    trajectory.

    sens_traj   Sensitivity trajectory of Network being considered.
    data_ids    A sequence of variable id's to assume we have data for. If
                data_ids is None, all dynamic and assigned variables will be
                used.
    opt_ids     A sequence of parameter id's to calculate derivatives with
                respect to. The hessian is (len(opt_ids) x len(opt_ids)).
                If opt_ids is None, all optimizable variables are considered.
    fixed_sf    If True, calculate the hessian assuming fixed scale factors.
    return_dict If True, returned values are (hess, hess_dict). hess_dict is a
                dictionary keyed on the elements of data_ids; each corresponding
                value is the hessian assuming data only on a single variable.
                hess is the sum of all these hessians
    uncert_func Function that takes in a trajectory and a variable id and
                returns what uncertainty should be assumed for that variable,
                either as a scalar or a list the same length as the trajectory.
    """
    if data_ids is None:
        data_ids = sens_traj.dynamicVarKeys + sens_traj.assignedVarKeys
    if opt_ids is None:
        opt_ids = sens_traj.optimizableVarKeys

    data_sigmas = {}
    for data_id in data_ids:
        ds = uncert_func(sens_traj, data_id)
        if np.isscalar(ds):
            ds = np.zeros(len(sens_traj), scipy.float_) + ds
        data_sigmas[data_id] = ds

    vars_assigned = [data_ids[node::num_procs] for node in range(num_procs)]
    for worker in range(1, num_procs):
        logger.debug('Sending to worker %i.' % worker)
        # reduce the amount we have to pickle
        # The only things the worker needs in the sens_traj are those that
        #  refer to data_ids it has to deal with.
        vars_needed = set(sens_traj.optimizableVarKeys)
        vars_needed.union_update(vars_assigned[worker])
        for var in vars_assigned[worker]:
            vars_needed.union_update([(var, ov) for ov in opt_ids])
        worker_traj = sens_traj.copy_subset(vars_needed)
        # And the only uncertainties it needs have to do with those data_ids
        worker_ds = dict([(var, data_sigmas[var])
                          for var in vars_assigned[worker]])
        command = 'PerfectData.compute_sf_LMHessian_conts(sens_traj, data_ids,'\
                'data_sigmas, opt_ids, fixed_sf)'
        args = {'sens_traj': worker_traj, 'data_ids': vars_assigned[worker],
                'data_sigmas': worker_ds, 'opt_ids': opt_ids,
                'fixed_sf': fixed_sf}
        comm.send((command, args), dest=worker)

    hess_dict = compute_sf_LMHessian_conts(sens_traj, vars_assigned[0],
                                           data_sigmas, opt_ids, fixed_sf)

    for worker in range(1, num_procs):
        logger.debug('Receiving from worker %i.' % worker)
        hess_dict.update(comm.recv(source=worker))

    hess = np.sum(list(hess_dict.values()), axis=0)
    if return_dict:
        return hess, hess_dict
    else:
        return hess

def compute_sf_LMHessian_conts(sens_traj, data_ids, data_sigmas, opt_ids,
                               fixed_sf):
    hess_dict = {}
    for data_id in data_ids:
        if fixed_sf:
            sf_deriv = dict([(id, 0) for id in opt_ids])
        else:
            sf_deriv = get_sf_derivs(sens_traj, data_id, data_sigmas[data_id],
                                     opt_ids)
        hess_dict[data_id] = computeLMHessianContribution(sens_traj, data_id,
                                                          data_sigmas[data_id],
                                                          opt_ids, sf_deriv)

    return hess_dict

def get_intervals(traj):
    # We want to break up our integrals when events fire, so first we figure out
    #  when they fired by looking for duplicated times in the trajectory
    times = traj.get_times()
    eventIndices = np.compress(np.diff(times) == 0,
                                  np.arange(len(times)))
    intervals = list(zip([0] + list(eventIndices + 1),
                    list(eventIndices + 1) + [len(times)]))

    return intervals

def get_sf_derivs(traj, dataId, data_sigma, optIds):
    scaleFactorDerivs = {}
    intTheorySq = 0
    for start, end in get_intervals(traj):
        y = traj.get_var_traj(dataId)[start:end]
        times = traj.get_times()[start:end]
        sigma = data_sigma[start:end]

        value = scipy.integrate.simps((old_div(y,sigma))**2, times,
                                      even='last')
        intTheorySq += value

        for optId in optIds:
            optValue = abs(traj.get_var_traj(optId)[start:end])
            sens = traj.get_var_traj((dataId, optId))[start:end]*optValue

            numerator = scipy.integrate.simps(old_div(sens*y,sigma**2), times,
                                              even='last')

            scaleFactorDerivs.setdefault(optId, 0)
            scaleFactorDerivs[optId] += -numerator

    for optId in optIds:
        if intTheorySq != 0:
            scaleFactorDerivs[optId] /= intTheorySq
        else:
            scaleFactorDerivs[optId] = 0

    return scaleFactorDerivs

def computeLMHessianContribution(traj, dataId, data_sigma, optIds,
                                 scaleFactorDerivs):
    LMHessian = np.zeros((len(optIds), len(optIds)), scipy.float_)

    # We break up our integral at event firings.
    for start, end in get_intervals(traj):
        times = traj.timepoints[start:end]
        y = traj.getVariableTrajectory(dataId)[start:end]
        sigma = data_sigma[start:end]

        for optIndex1, optId1 in enumerate(optIds):
            # We convert our sensitivity trajectory to a sensitivity wrt the
            #  log(abs()) by multiplying by the parmeter value.
            optValue = abs(traj.get_var_traj(optId1)[start:end])
            sens1 = traj.get_var_traj((dataId, optId1))[start:end]*optValue
            dB1 = scaleFactorDerivs[optId1]
            for jj, optId2 in enumerate(optIds[optIndex1:]):
                optIndex2 = jj + optIndex1

                optValue = abs(traj.get_var_traj(optId2)[start:end])
                sens2 = traj.get_var_traj((dataId, optId2))[start:end]*optValue
                dB2 = scaleFactorDerivs[optId2]

                integrand = old_div((sens1 + dB1 * y) * (sens2 + dB2 * y), sigma**2)
                # We do the even='last' for speed. Otherwise, for an even number
                #  of points, simps does twice as much work as for an odd
                #  number.
                # In tests it really doesn't make much difference in accurary.
                value = scipy.integrate.simps(integrand, times,
                                              even='last')

                LMHessian[optIndex1][optIndex2] += value
                if optIndex1 != optIndex2:
                    LMHessian[optIndex2][optIndex1] += value

    LMHessian /= (traj.timepoints[-1] - traj.timepoints[0])

    return LMHessian


text:
aws_ebs_raid 'db_ebs_raid' do
  aws_access_key node['aws_test']['key_id']
  aws_secret_access_key node['aws_test']['access_key']
  disk_size 10
  disk_count 6
  mount_point '/aws_raid'
end

redpajama_set_name: RedPajamaGithub


text:
@interface PodsDummy_Pods_WJStepper : NSObject
@end
@implementation PodsDummy_Pods_WJStepper
@end


text:
<!DOCTYPE html>

click the button:

<button onclick="myFunction()">Try it</button>


text:
import java.util.*;

class A {
  public static void main(String[] args) {
    List<String> names = Arrays.asList("Bob", "Alice", "Bob", "Carol");
    Set<String> uniqNames = new HashSet<>(names.size());
      names.forEach(name -> uniqNames.add(makeNameUnique(name, uniqNames)));
    uniqNames.forEach(System.out::println);
  }

  private static String makeNameUnique(final String name, final Set<String> uniqNames) {
    if (uniqNames.contains(name)) {
      return name + "1";
    }
    return name;
  }

}


text:
from rest_framework.routers import (
    DefaultRouter as BaseDefaultRouter,
    Route,
    DynamicListRoute,
    DynamicDetailRoute,
)

# This was copied from rest_framework.routes.SimpleRouter. The list
# routes are unmodified, so they will have trailing slashes as
# usual. The detail routes were modified so that they won't have
# trailing slashes.
ROUTES = [
    # List
    Route(
        url=r'^{prefix}{trailing_slash}$',
        mapping={
            'get': 'list',
            'post': 'create'
        },
        name='{basename}-list',
        initkwargs={'suffix': 'List'}
    ),
    DynamicListRoute(
        url=r'^{prefix}/{methodname}{trailing_slash}$',
        name='{basename}-{methodnamehyphen}',
        initkwargs={}
    ),
    # Detail
    Route(
        url=r'^{prefix}/{lookup}$',
        mapping={
            'get': 'retrieve',
            'put': 'update',
            'patch': 'partial_update',
            'delete': 'destroy'
        },
        name='{basename}-detail',
        initkwargs={'suffix': 'Instance'}
    ),
    DynamicDetailRoute(
        url=r'^{prefix}/{lookup}/{methodname}$',
        name='{basename}-{methodnamehyphen}',
        initkwargs={}
    ),
]

class DefaultRouter(BaseDefaultRouter):

    """A router with a "proper" trailing slash policy.

    Collection/list routes end with a trailing slash; member/detail
    routes don't.

    This is more aesthetically appealing, is arguably more "correct",
    and is easier to use with AngularJS resources.

    """

    routes = ROUTES


text:
<?php
/**
 * Admin functions
 *
 * Functions for the admin back end components only.
 *
 * @package SimpleCalendar/Admin/Functions
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Get settings pages and tabs.
 *
 * @since  3.0.0
 *
 * @return array
 */
function simcal_get_admin_pages() {
	$objects = \SimpleCalendar\plugin()->objects;
	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_pages() : array();
}

/**
 * Get a settings page tab.
 *
 * @since  3.0.0
 *
 * @param  string $page
 *
 * @return null|\SimpleCalendar\Abstracts\Admin_Page
 */
function simcal_get_admin_page( $page ) {
	$objects = \SimpleCalendar\plugin()->objects;
	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page( $page ) : null;
}

/**
 * Get a field.
 *
 * @since  3.0.0
 *
 * @param  array  $args
 * @param  string $name
 *
 * @return null|\SimpleCalendar\Abstracts\Field
 */
function simcal_get_field( $args, $name = '' ) {
	$objects = \SimpleCalendar\plugin()->objects;
	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field( $args, $name ) : null;
}

/**
 * Print a field.
 *
 * @since  3.0.0
 *
 * @param  array  $args
 * @param  string $name
 *
 * @return void
 */
function simcal_print_field( $args, $name = '' ) {

	$field = simcal_get_field( $args, $name );

	if ( $field instanceof \SimpleCalendar\Abstracts\Field ) {
		$field->html();
	}
}

/**
 * Sanitize a variable of unknown type.
 *
 * Recursive helper function to sanitize a variable from input,
 * which could also be a multidimensional array of variable depth.
 *
 * @since  3.0.0
 *
 * @param  mixed  $var  Variable to sanitize.
 * @param  string $func Function to use for sanitizing text strings (default 'sanitize_text_field')
 *
 * @return array|string Sanitized variable
 */
function simcal_sanitize_input( $var, $func = 'sanitize_text_field'  ) {

	if ( is_null( $var ) ) {
		return '';
	}

	if ( is_bool( $var ) ) {
		if ( $var === true ) {
			return 'yes';
		} else {
			return 'no';
		}
	}

	if ( is_string( $var ) || is_numeric( $var ) ) {
		$func = is_string( $func ) && function_exists( $func ) ? $func : 'sanitize_text_field';
		return call_user_func( $func, trim( strval( $var ) ) );
	}

	if ( is_object( $var ) ) {
		$var = (array) $var;
	}

	if ( is_array( $var ) ) {
		$array = array();
		foreach ( $var as $k => $v ) {
			$array[ $k ] = simcal_sanitize_input( $v );
		}
		return $array;
	}

	return '';
}

/**
 * Check if a screen is a plugin admin view.
 * Returns the screen id if true, false (bool) if not.
 *
 * @since  3.0.0
 *
 * @return string|bool
 */
function simcal_is_admin_screen() {

	$view = function_exists( 'get_current_screen' ) ? get_current_screen() : false;

	if ( $view instanceof WP_Screen ) {

		// Screens used by this plugin.
		$screens = array(
			'customize',
			'calendar',
			'calendar_page_simple-calendar_add_ons',
			'calendar_page_simple-calendar_settings',
			'calendar_page_simple-calendar_tools',
			'edit-calendar',
			'edit-calendar_category',
			'dashboard_page_simple-calendar_about',
			'dashboard_page_simple-calendar_credits',
			'dashboard_page_simple-calendar_translators',
		);
		if ( in_array( $view->id, $screens ) ) {
			return $view->id;
		}
	}

	return false;
}

/**
 * Update add-on.
 *
 * @since 3.0.0
 *
 * @param string $_api_url     The URL pointing to the custom API end
 * @param string $_plugin_file Path to the plugin file.
 * @param array  $_api_data    Optional data to send with API calls.
 *
 * @return \SimpleCalendar\Admin\Updater
 */
function simcal_addon_updater( $_api_url, $_plugin_file, $_api_data = null ) {
	return new \SimpleCalendar\Admin\Updater( $_api_url, $_plugin_file, $_api_data );
}

/**
 * Get add-on license key.
 *
 * @since  3.0.0
 *
 * @param  string $addon Unique add-on id.
 *
 * @return null|string
 */
function simcal_get_license_key( $addon ) {
	$licenses = get_option( 'simple-calendar_settings_licenses', array() );
	if ( isset( $licenses['keys'][ $addon ] ) ) {
		return empty( $licenses['keys'][ $addon ] ) ? null : $licenses['keys'][ $addon ];
	}
	return null;
}

/**
 * Get add-on license status.
 *
 * Without passing arguments returns all the statuses array.
 *
 * @since  3.0.0
 *
 * @param  null|string $addon Unique add-on slug.
 *
 * @return array|string
 */
function simcal_get_license_status( $addon = null ) {
	$licenses = get_option( 'simple-calendar_licenses_status', array() );
	return isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : $licenses;
}

/**
 * Get admin notices.
 *
 * @since  3.0.0
 *
 * @return array
 */
function simcal_get_admin_notices() {
	$notices = new \SimpleCalendar\Admin\Notices();
	return $notices->get_notices();
}

/**
 * Delete admin notices.
 *
 * @since 3.0.0
 */
function simcal_delete_admin_notices() {
	delete_option( 'simple-calendar_admin_notices' );
}

/**
 * Print a shortcode tip.
 *
 * @since  3.0.0
 *
 * @param  int $post_id
 *
 * @return void
 */
function simcal_print_shortcode_tip( $post_id ) {

	$browser = new \SimpleCalendar\Browser();
	if ( $browser::PLATFORM_APPLE == $browser->getPlatform() ) {
		$cmd = '⌘+C';
	} else {
		$cmd = 'Ctrl+C';
	}

	$shortcut  = sprintf( __( 'Press %s to copy.', 'google-calendar-events' ), $cmd );
	$shortcode = sprintf( '[calendar id="%s"]', $post_id );

	echo "<input readonly='readonly' " .
				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' " .
				"title='" . $shortcut . "' " .
				"onclick='this.select();' value='" . $shortcode . "' />";
}

/**
 * Google Analytics campaign URL.
 *
 * @since   3.0.0
 *
 * @param   string  $base_url   Plain URL to navigate to
 * @param   string  $campaign   GA "campaign" tracking value
 * @param   string  $content    GA "content" tracking value
 * @param   bool    $raw        Use esc_url_raw instead (default = false)
 *
 * @return  string  $url        Full Google Analytics campaign URL
 */
function simcal_ga_campaign_url( $base_url, $campaign, $content, $raw = false ) {

	$url = add_query_arg( array(
		'utm_source'   => 'inside-plugin',
		'utm_medium'   => 'link',
		'utm_campaign' => $campaign, // i.e. 'core-plugin', 'gcal-pro'
		'utm_content'  => $content // i.e. 'sidebar-link', 'settings-link'
	), $base_url );

	if ( $raw ) {
		return esc_url_raw( $url );
	}

	return esc_url( $url );
}

/**
 * Newsletter signup form.
 *
 * @since  3.0.0
 *
 * @return void
 */
function simcal_newsletter_signup() {

	if ( $screen = simcal_is_admin_screen() ) {

		global $current_user;
		wp_get_current_user();

		$name = $current_user->user_firstname ? $current_user->user_firstname : '';

		?>
		<div id="simcal-drip" class="<?php echo $screen; ?>">

					<?php _e( "Enter your name and email and we'll send you a coupon code for 20% off all Pro Add-on purchases.", 'google-calendar-events' ); ?>

					<?php _e( 'Your Email', 'google-calendar-events' ); ?>

					<input type="email"
					       id="simcal-drip-field-email"
					       name="fields[email]"
					       value="<?php echo $current_user->user_email; ?>" />

					<?php _e( 'First Name', 'google-calendar-events' ); ?>

					<input type="text"
					       id="simcal-drip-field-first_name"
					       name="fields[first_name]"
					       value="<?php echo $name; ?>" />

					<?php _e( 'Send me the coupon', 'google-calendar-events' ); ?>

					<?php _e( 'No spam. Unsubscribe anytime.', 'google-calendar-events' ); ?>

					<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
					   target="_blank"><?php _e( 'Just take me the add-ons', 'google-calendar-events' ); ?>

				<?php _e( 'Thank you!', 'google-calendar-events' ); ?>

		<?php

	}
}

/**
 * Upgrade to Premium Add-ons HTML.
 *
 * @since  3.1.6
 *
 * @return void
 */
function simcal_upgrade_to_premium() {

	if ( $screen = simcal_is_admin_screen() ) {
		?>

				<?php _e( 'Some of the features included with our premium add-ons', 'google-calendar-events' ); ?>

 <?php _e( 'Display color coded events', 'google-calendar-events' ); ?>

 <?php _e( 'Show week & day views', 'google-calendar-events' ); ?>

 <?php _e( 'Fast view switching', 'google-calendar-events' ); ?>

 <?php _e( 'Event titles & start times in grid', 'google-calendar-events' ); ?>

 <?php _e( 'Limit event display times', 'google-calendar-events' ); ?>

 <?php _e( 'Display private calendar events', 'google-calendar-events' ); ?>

 <?php _e( 'Show attendees & RSVP status', 'google-calendar-events' ); ?>

 <?php _e( 'Display attachments', 'google-calendar-events' ); ?>

 <?php _e( 'Priority email support', 'google-calendar-events' ); ?>

				<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
				   class="button-primary button-large" target="_blank">
					<?php _e( 'Upgrade to Premium Now', 'google-calendar-events' ); ?>

		<?php
	}
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Pmseo extends CI_Controller {

	function __construct()
    {
        parent::__construct();
        if (!$this->ion_auth->logged_in()) {//cek login ga?
            redirect('login','refresh');
        }else{
            if (!$this->ion_auth->in_group('members')) {//cek admin ga?
                redirect('login','refresh');
            }
        }
        $this->load->model('Model_Pmseo');
        $this->load->library('form_validation');
    }

	public function index()
	{
		$data['aktif']       ='Pengaturan';
        $data['title']       ='Admin Panel';
        $data['judul']       ='Pengaturan';
        $data['sub_judul']   ='Meta Seo';
        $data['table_title'] ='BrajaMarketindo MetaSeo';
        $data['judul_menu']  ='Braja Marketindo';
        $data['nama_jln']    ='Jl.Lotus Timur, Jakasetia, Jawa Barat';
        $data['content']     = 'pmseo/pmseo_list';
        $data['record']      = $this->Model_Pmseo->getpmseo();
        $this->load->view('dashboard', $data);

	}

	public function edit($id){
        $data['aktif']       ='Pengaturan';
        $data['title']       ='Admin Panel';
        $data['judul']       ='Pengaturan';
        $data['sub_judul']   ='Edit MetaSeo';
        $data['judul_menu']  ='Braja Marketindo';
        $data['nama_jln']    ='Jl.Lotus Timur, Jakasetia, Jawa Barat';
        $data['content']     ='pmseo/pmseo_edit';
        $data['record']      = $this->Model_Pmseo->edit($id);
        $this->load->view('dashboard', $data);
    }

	public function update(){

		$id_meta_seo = $this->input->post('id_meta_seo');
		$judul 		 = $this->input->post('judul');
		$deskripsi   = $this->input->post('deskripsi');
		$keyword     = $this->input->post('keyword');
		$google_ver  = $this->input->post('google_ver');

		$data = array('judul' => $judul,
					  'deskripsi' => $deskripsi,
					   'keyword' => $keyword,
					   'google_ver' => $google_ver,
					   'tgl_entry' => date('Y-m-d H:i:s'),
                       'username' => $this->session->identity
					    );

		$update = $this->Model_Pmseo->update($id_meta_seo,$data);
		if ($update) {
            $this->session->set_flashdata('info','Data Berhasil Diubah!');
            redirect('panelIMS/pmseo');
        } else {
            $this->session->set_flashdata('info','Gagal Menghapus Data!');
            redirect('panelIMS/pmseo');
        }

	}
}


text:
  #initialize NameData class with an instance variable called name
  #intialize Greetings class with an instance of NameData.
  #create a method that will display the NameData plus a greeting string.

class NameData
  attr_reader :name
  def initialize
    @name = "Traci"
  end

end

class Greetings
  def initialize
    @namedata = NameData.new
  end

  def hello
    puts "Hello "  + @namedata.name + ", it's nice to meet you!"
  end

end

greet = Greetings.new
greet.hello

# Reflection
=begin
  Release 1
  -What are these methods doing?
  These methods are establishing what the person's age, name, and occupation are and changing them when they need to be changed.

  -How are they modifying or returning the value of instance variables?
  Each method is modifying the instance variable it has based on the assumption that the values are still what it was declared in the initialize method.

  Release 2
  -What changed between the last release and this release?
  The only thing that changed was that the what_is_age method was removed.

  -What was replaced?
  The what_is_age method was with attr_reader :age at line 5.

  -Is this code simpler than the last?
  It is more simple but a person who has less coding experience could more easily read the first version.

  Release 3
  - What changed between the last relase and this release?
  Attr_writer :age was added at line 6, the change_my_age method was removed, and the instance_of_profile.change_my_name.

  -What was replaced?
  The instance_of_profile.change_my_age was replaced with instance_of_profile.age on line 68.

  -Is this code simpler than the last?
  This code is more simple than the last, since it requires less.

  Release 6
  -What is a reader method?
    The reader method allows a instance variable to be recoginzed in Ruby without having to define an entire method.
  -What is a writer method?
    The writer method allows the instance variable to be used by Ruby without having to define an entire method.
  -What do the attr methods do for you?
  The attr methods allow me to simplify my code by making simple methods that declare and write instance variables unnecessary.
  -Should you always use an accessor to cover your bases? Why or why not?
  I think it would be a good idea to always use accesor methods because it simplifies code.
  -What is confusing to you about these methods?
  Sometimes its confusing where you are allowed to use the methods that you declare using the accesor methods.
=end


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

namespace ASPPatterns.Chap6.EventTickets.Service
{
    public class MessageResponseHistory<T>
    {
        private Dictionary<string, T> _responseHistory;

        public MessageResponseHistory()
        {
            _responseHistory = new Dictionary<string, T>();
        }

        public bool IsAUniqueRequest(string correlationId)
        {
            return !_responseHistory.ContainsKey(correlationId);
        }

        public void LogResponse(string correlationId, T response)
        {
            if (_responseHistory.ContainsKey(correlationId))
                _responseHistory[correlationId] = response;
            else
                _responseHistory.Add(correlationId, response);
        }

        public T RetrievePreviousResponseFor(string correlationId)
        {
            return _responseHistory[correlationId];
        }
    }
}


text:
package errors

import (
	"fmt"
)

// Raised when there is an issue with the filesystem for scm checkout
type ScmFilesystemError string

func (str ScmFilesystemError) Error() string {
	return fmt.Sprintf("ScmFilesystemError: %q", string(str))
}

// Raised when the scm is not recognized
type ScmUnspecifiedError string

func (str ScmUnspecifiedError) Error() string {
	return fmt.Sprintf("ScmUnspecifiedError: %q", string(str))
}

// Raised when capsule cannot create an authenticated client for the source.
type ScmAuthenticationFailed string

func (str ScmAuthenticationFailed) Error() string {
	return fmt.Sprintf("ScmAuthenticationFailed: %q", string(str))
}

// Raised when there is an error parsing the repo payload format.
type ScmPayloadFormatError string

func (str ScmPayloadFormatError) Error() string {
	return fmt.Sprintf("ScmPayloadFormatError: %q", string(str))
}

// Raised when a source payload is unsupported/action is invalid
type ScmPayloadUnsupported string

func (str ScmPayloadUnsupported) Error() string {
	return fmt.Sprintf("ScmPayloadUnsupported: %q", string(str))
}

// Raised when the user who started the packaging is unauthorized (non-collaborator)
type ScmUnauthorizedUser string

func (str ScmUnauthorizedUser) Error() string {
	return fmt.Sprintf("ScmUnauthorizedUser: %q", string(str))
}

// Raised when the scm cleanup failed
type ScmCleanupFailed string

func (str ScmCleanupFailed) Error() string {
	return fmt.Sprintf("ScmCleanupFailed: %q", string(str))
}

// Raised when the scm pr already merged
type ScmMergeNothingToMergeError string

func (str ScmMergeNothingToMergeError) Error() string {
	return fmt.Sprintf("ScmMergeNothingToMergeError: %q", string(str))
}

// Raised during a PR merge when there is a merge conflict
type ScmMergeConflictError string
func (str ScmMergeConflictError) Error() string {
	return fmt.Sprintf("ScmMergeConflictError: %q", string(str))
}

// Raised during a PR merge where the analysis returns a result that we do not understand.
type ScmMergeAnalysisUnknownError string
func (str ScmMergeAnalysisUnknownError) Error() string {
	return fmt.Sprintf("ScmMergeAnalysisUnknownError: %q", string(str))
}

// Raised when the config file specifies a hook/override for a step when the type is :repo
type EngineTransformUnavailableStep string

func (str EngineTransformUnavailableStep) Error() string {
	return fmt.Sprintf("EngineTransformUnavailableStep: %q", string(str))
}

// Raised when the environment is missing a required tool/binary
type EngineValidateToolError string

func (str EngineValidateToolError) Error() string {
	return fmt.Sprintf("EngineValidateToolError: %q", string(str))
}

// Raised when the engine is not recognized
type EngineUnspecifiedError string

func (str EngineUnspecifiedError) Error() string {
	return fmt.Sprintf("EngineUnspecifiedError: %q", string(str))
}

// Raised when the package is missing certain required files (ie metadata.rb, package.json, setup.py, etc)
type EngineBuildPackageInvalid string

func (str EngineBuildPackageInvalid) Error() string {
	return fmt.Sprintf("EngineBuildPackageInvalid: %q", string(str))
}

// Raised when the source could not be compiled or build for any reason
type EngineBuildPackageFailed string

func (str EngineBuildPackageFailed) Error() string {
	return fmt.Sprintf("EngineBuildPackageFailed: %q", string(str))
}

// Raised when package dependencies fail to install correctly.
type EngineTestDependenciesError string

func (str EngineTestDependenciesError) Error() string {
	return fmt.Sprintf("EngineTestDependenciesError: %q", string(str))
}

// Raised when the package test runner fails
type EngineTestRunnerError string

func (str EngineTestRunnerError) Error() string {
	return fmt.Sprintf("EngineTestRunnerError: %q", string(str))
}

// Raised when package manager asseble step fails.
type MgrAssembleError string

func (str MgrAssembleError) Error() string {
	return fmt.Sprintf("MgrAssembleError: %q", string(str))
}

// Raised when the Mgr is not recognized
type MgrUnspecifiedError string

func (str MgrUnspecifiedError) Error() string {
	return fmt.Sprintf("MgrUnspecifiedError: %q", string(str))
}

// Raised when credentials required to upload/deploy new package are missing.
type MgrDistCredentialsMissing string

func (str MgrDistCredentialsMissing) Error() string {
	return fmt.Sprintf("MgrDistCredentialsMissing: %q", string(str))
}

// Raised when an error occurs while uploading package.
type MgrDistPackageError string

func (str MgrDistPackageError) Error() string {
	return fmt.Sprintf("MgrDistPackageError: %q", string(str))
}


text:
FROM ubuntu:14.04
MAINTAINER dl@taktik.be

ADD . /build
RUN chmod +x /build/build.sh && sleep 5 && /build/build.sh

# Define additional metadata for our image.
VOLUME /var/lib/docker

ENTRYPOINT ["/start.sh"]
CMD [""]


text:
using System;
using System.Management.Automation;
using Microsoft.ServiceBus.Messaging;

namespace ServiceBus
{
    [Cmdlet(VerbsCommon.Get, "SBTopic", DefaultParameterSetName = "List")]
    [OutputType(typeof(TopicDescription))]
    public class GetSBTopic : PSCmdlet
    {
        [Parameter(Mandatory = true,
            ValueFromPipeline = true,
                Position = 0,
                    ParameterSetName = "Named")]
        [ValidateNotNullOrEmpty()]
        [Alias("Path")]
        public string Name { get; set; }

        [Parameter(ParameterSetName = "Current")]
        public SwitchParameter Current
        {
            get { return current; }
            set { current = value; }
        }
        private bool current;

        protected override void ProcessRecord()
        {
            try
            {
                if (SBConnection.Instance.ConnectionString == null)
                {
                    throw new Exception("Run Connect-SB first!");
                }
                if (current)
                {
                    WriteObject(SBConnection.Instance.TopicClient);
                }
                else
                {
                    if (ParameterSetName == "Named")
                    {
                        WriteObject(SBConnection.Instance.NamespaceManager.GetTopic(Name));
                    }
                    else
                    {
                        foreach (var topic in SBConnection.Instance.NamespaceManager.GetTopics())
                        {
                            WriteObject(topic);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorRecord er = new ErrorRecord(
                    ex,
                    "Failed",
                    ErrorCategory.ObjectNotFound,
                    this
                );
                WriteError(er);
            }
        }
    }
}


text:
require 'spec_helper'

# Find more details on ChefSpec here: https://github.com/sethvargo/chefspec#readme
describe 'chef-skeleton::default' do
  [{ 'name' => 'centos', 'version' => '6.5' },
   { 'name' => 'centos', 'version' => '5.10' },
   { 'name' => 'debian', 'version' => '7.5' },
   { 'name' => 'debian', 'version' => '6.0.5' },
   { 'name' => 'ubuntu', 'version' => '14.04' },
   { 'name' => 'ubuntu', 'version' => '12.04' }
  ].each do |platform|
    describe "for #{platform['name']}-#{platform['version']}" do
      before(:all) do
        @chef_run = ChefSpec::Runner.new(platform: platform['name'],
                                         version: platform['version']).converge(described_recipe)
      end
      it 'should log something' do
        expect(@chef_run).to write_log('log something')
      end if platform['name'] == 'centos'
      it 'does something' do
        pending 'Please add some proper test cases'
        fail
      end
    end
  end
end


text:
"use strict";
function GM_addStyle(aCss) {
    var head = document.getElementsByTagName('head')[0];
    if (head) {
        var style = document.createElement('style');
        style.setAttribute('type', 'text/css');
        style.textContent = aCss;
        head.appendChild(style);
        return style;
    }
}
module.exports = GM_addStyle;


text:
import './index';
import fetchMock from 'fetch-mock';
import { expect } from 'chai';
import { deepCopy } from 'common-sk/modules/object';
import { eventPromise, eventSequencePromise, setUpElementUnderTest } from '../../../infra-sk/modules/test_util';
import { DigestComparison, TriageRequestV3, TriageResponse } from '../rpc_types';
import { groupingsResponse } from '../search-page-sk/demo_data';
import { typicalDetails } from '../digest-details-sk/test_data';
import { DiffPageSk } from './diff-page-sk';
import { DiffPageSkPO } from './diff-page-sk_po';

describe('diff-page-sk', () => {
  const newInstance = setUpElementUnderTest<DiffPageSk>('diff-page-sk');

  let diffPageSk: DiffPageSk;
  let diffPageSkPO: DiffPageSkPO;

  beforeEach(async () => {
    diffPageSk = newInstance();
    diffPageSkPO = new DiffPageSkPO(diffPageSk);

    fetchMock.getOnce('/json/v1/groupings', () => deepCopy(groupingsResponse));
    const digestComparison: DigestComparison = {
      left: deepCopy(typicalDetails),
      right: deepCopy(typicalDetails.refDiffs?.pos)!,
    };
    fetchMock.post('glob:/json/v2/diff*', digestComparison);

    // Wait for the above RPCs to complete.
    await eventSequencePromise(['end-task', 'end-task']);
  });

  afterEach(() => {
    expect(fetchMock.done()).to.be.true; // All mock RPCs called at least once.
    fetchMock.reset();
  });

  it('can triage', async () => {
    // This tests the wiring that passes the groupings returned by the /json/v1/groupings RPC to
    // the digest-details-sk element.
    const triageRequest: TriageRequestV3 = {
      deltas: [
        {
          grouping: {
            source_type: 'infra',
            name: 'dots-legend-sk_too-many-digests',
          },
          digest: '6246b773851984c726cb2e1cb13510c2',
          label_before: 'positive',
          label_after: 'negative',
        },
      ],
    };
    const triageResponse: TriageResponse = { status: 'ok' };
    fetchMock.post(
      { url: '/json/v3/triage', body: triageRequest },
      { status: 200, body: triageResponse },
    );

    const endTask = eventPromise('end-task');
    await diffPageSkPO.digestDetailsSkPO.triageSkPO.clickButton('negative');
    await endTask;
  });
});


text:
@interface MJCTabItem : UIButton

@property (nonatomic,assign) CGFloat itemHeight;
@property (nonatomic,strong) UIColor *itemBackColorSelected;
@property (nonatomic,copy) NSString *itemText;
@property (nonatomic,assign) CGFloat itemTextFontSize;
@property (nonatomic,strong) NSArray *itemTitleNormalColorArray;
@property (nonatomic,strong) NSArray *itemTitleSelectedColorArray;
@property (nonatomic,strong) UIColor *itemTitleNormalColor;
@property (nonatomic,strong) UIColor *itemTitleSelectedColor;
@property (nonatomic,strong) UIImage *itemBackNormalImage;
@property (nonatomic,strong) UIImage *itemBackSelectedImage;
@property (nonatomic,strong) NSArray *itemNormalBackImageArray;
@property (nonatomic,strong) NSArray *itemSelectedBackImageArray;
@property (nonatomic,strong) UIImage *itemImageNormal;
@property (nonatomic,strong) UIImage *tabItemImageSelected;
@property (nonatomic,strong) NSArray *tabItemNormalImageArray;
@property (nonatomic,strong) NSArray *tabItemSelectedImageArray;
@property(nonatomic)   UIEdgeInsets itemTextsEdgeInsets;
@property(nonatomic)   UIEdgeInsets itemImagesEdgeInsets;
@property(nonatomic,assign)   CGSize itemImageSize;
@property (nonatomic,assign) NSUInteger imageEffectStyles;
-(void)setupItemFrameTabX:(CGFloat)tabX tabY:(CGFloat)tabY tabH:(CGFloat)tabH;
@property (nonatomic,assign) BOOL  scaleLayoutEnabled;
@end


text:
@import ObjectiveC.runtime;

#import <ContentfulDeliveryAPI/CDAArray.h>
#import <ContentfulDeliveryAPI/CDAAsset.h>
#import <ContentfulDeliveryAPI/CDAContentType.h>
#import <ContentfulDeliveryAPI/CDAField.h>
#import <ContentfulDeliveryAPI/CDASyncedSpace.h>

#import "CDAClient+Private.h"
#import "CDAContentTypeRegistry.h"
#import "CDAEntry+Private.h"
#import "CDAPersistenceManager.h"
#import "CDAUtilities.h"

@interface CDAPersistenceManager () <CDASyncedSpaceDelegate>

@property (nonatomic) NSMutableDictionary* classesForEntries;
@property (nonatomic) CDAClient* client;
@property (nonatomic) BOOL hasChanged;
@property (nonatomic) NSMutableDictionary* mappingForEntries;
@property (nonatomic, copy) NSDictionary* query;
@property (nonatomic) CDASyncedSpace* syncedSpace;

@end

#pragma mark -

@implementation CDAPersistenceManager

+(void)seedFromBundleWithInitialCacheDirectory:(NSString*)initialCacheDirectory {
    NSString* cacheDirectory = CDACacheDirectory();

    if ([[NSFileManager defaultManager] contentsOfDirectoryAtPath:cacheDirectory error:nil].count > 0) {
        return;
    }

    NSArray* resources = [[NSBundle mainBundle] pathsForResourcesOfType:nil
                                                            inDirectory:initialCacheDirectory];

    for (NSString* resource in resources) {
        NSString* target = [cacheDirectory stringByAppendingPathComponent:resource.lastPathComponent];
        [[NSFileManager defaultManager] copyItemAtPath:resource toPath:target error:nil];
    }
}

#pragma mark -

-(Class)classForEntriesOfContentTypeWithIdentifier:(NSString *)identifier {
    return self.classesForEntries[identifier];
}

-(id<CDAPersistedAsset>)createPersistedAsset {
    return [self.classForAssets new];
}

-(id<CDAPersistedEntry>)createPersistedEntryForContentTypeWithIdentifier:(NSString *)identifier {
    return [self.classesForEntries[identifier] new];
}

-(id<CDAPersistedSpace>)createPersistedSpace {
    return [self.classForSpaces new];
}

-(void)deleteAssetWithIdentifier:(NSString*)identifier {
    [self doesNotRecognizeSelector:_cmd];
}

-(void)deleteEntryWithIdentifier:(NSString*)identifier {
    [self doesNotRecognizeSelector:_cmd];
}

-(NSArray *)fetchAssetsFromDataStore {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(id<CDAPersistedAsset>)fetchAssetWithIdentifier:(NSString*)identifier {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(NSArray *)fetchEntriesFromDataStore {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(id<CDAPersistedEntry>)fetchEntryWithIdentifier:(NSString*)identifier {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(id<CDAPersistedSpace>)fetchSpaceFromDataStore {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(void)handleAsset:(CDAAsset*)asset {
    id<CDAPersistedAsset> persistedAsset = [self fetchAssetWithIdentifier:asset.identifier];

    if (persistedAsset) {
        [self updatePersistedAsset:persistedAsset withAsset:asset];
    } else {
        [self persistedAssetForAsset:asset];
    }
}

-(void)handleEntry:(CDAEntry*)entry {
    id<CDAPersistedEntry> persistedEntry = [self fetchEntryWithIdentifier:entry.identifier];

    if (persistedEntry) {
        [self updatePersistedEntry:persistedEntry withEntry:entry];
    } else {
        [self persistedEntryForEntry:entry];
    }
}

-(void)handleResponseArray:(CDAArray*)array withSuccess:(void (^)())success {
    for (CDAEntry* entry in array.items) {
        [self handleEntry:entry];

        [entry resolveLinksWithIncludedAssets:nil
                                      entries:nil
                                   usingBlock:^CDAResource *(CDAResource *resource,
                                                             NSDictionary *assets,
                                                             NSDictionary *entries) {
                                       if ([resource isKindOfClass:[CDAAsset class]]) {
                                           [self handleAsset:(CDAAsset*)resource];
                                       }

                                       if ([resource isKindOfClass:[CDAEntry class]]) {
                                           [self handleEntry:(CDAEntry*)resource];
                                       }

                                       return resource;
                                   }];
    }

    [self saveDataStore];

    if (success) {
        success();
    }
}

-(NSArray *)identifiersOfHandledContentTypes {
    return self.classesForEntries.allKeys;
}

-(id)init {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(id)initWithClient:(CDAClient*)client {
    self = [super init];
    if (self) {
        self.classesForEntries = [@{} mutableCopy];
        self.client = client;
        self.mappingForEntries = [@{} mutableCopy];
    }
    return self;
}

-(id)initWithClient:(CDAClient *)client query:(NSDictionary *)query {
    self = [super init];
    if (self) {
        self.classesForEntries = [@{} mutableCopy];
        self.client = client;
        self.mappingForEntries = [@{} mutableCopy];
        self.query = query;
    }
    return self;
}

-(NSDictionary *)mappingForEntriesOfContentTypeWithIdentifier:(NSString *)identifier {
    NSDictionary* userDefinedMapping = self.mappingForEntries[identifier];

    if (!userDefinedMapping) {
        NSMutableArray* props = [[self propertiesForEntriesOfContentTypeWithIdentifier:identifier] mutableCopy];

        Protocol* proto = objc_getProtocol("CDAPersistedEntry");
        unsigned int definedPropsCount = 0;
        objc_property_t* definedProps = protocol_copyPropertyList(proto, &definedPropsCount);

        for (unsigned int i = 0; i < definedPropsCount; i++) {
            NSString* propName = [[NSString alloc] initWithCString:property_getName(definedProps[0]) encoding:NSUTF8StringEncoding];
            [props removeObject:propName];
        }

        NSMutableDictionary* automaticMapping = [@{} mutableCopy];

        CDAContentType* type = [self.client.contentTypeRegistry contentTypeForIdentifier:identifier];
        for (CDAField* field in type.fields) {
            if ([props containsObject:field.identifier]) {
                automaticMapping[[@"fields." stringByAppendingString:field.identifier]] = field.identifier;
            }
        }

        userDefinedMapping = [automaticMapping copy];
        [self setMapping:userDefinedMapping forEntriesOfContentTypeWithIdentifier:identifier];
    }

    return userDefinedMapping;
}

-(void)performInitalSynchronizationForQueryWithSuccess:(void (^)())success
                                               failure:(CDARequestFailureBlock)failure {
    NSDate* syncTimestamp = [self roundedCurrentDate];

    [self.client fetchEntriesMatching:self.query success:^(CDAResponse *response, CDAArray *array) {
        id<CDAPersistedSpace> space = [self fetchSpaceFromDataStore];
        space.lastSyncTimestamp = syncTimestamp;

        [self handleResponseArray:array withSuccess:success];
    } failure:failure];
}

-(void)performSubsequentSynchronizationWithSuccess:(void (^)())success
                                           failure:(CDARequestFailureBlock)failure {
    NSDate* syncTimestamp = [self roundedCurrentDate];
    NSMutableDictionary* query = [self.query mutableCopy];

    id<CDAPersistedSpace> space = [self fetchSpaceFromDataStore];
    if (space.lastSyncTimestamp) {
        query[@"sys.updatedAt[gt]"] = space.lastSyncTimestamp;
    }

    NSArray* knownAssetIds = [[self fetchAssetsFromDataStore] valueForKey:@"identifier"];
    NSDictionary* queryForAssets = @{ @"sys.id[in]": knownAssetIds,
                                      @"sys.updatedAt[gt]": space.lastSyncTimestamp };

    [self.client fetchEntriesMatching:query success:^(CDAResponse *response, CDAArray *entries) {
        space.lastSyncTimestamp = syncTimestamp;

        [self.client fetchAssetsMatching:queryForAssets
                                 success:^(CDAResponse *response, CDAArray *assets) {
                                     for (CDAAsset* asset in assets.items) {
                                         [self handleAsset:asset];
                                     }

                                     [self handleResponseArray:entries withSuccess:success];
                                 }
                                 failure:failure];
    } failure:failure];
}

-(void)performSynchronizationWithSuccess:(void (^)())success
                                 failure:(CDARequestFailureBlock)failure {
    NSAssert(self.classesForEntries.count > 0, @"At least one Entry class should be defined.");
    NSParameterAssert(self.classForAssets);
    NSParameterAssert(self.classForSpaces);
    NSParameterAssert(self.client);

    self.hasChanged = NO;

    if (self.query) {
        if (self.syncedSpace) {
            [self.syncedSpace performSynchronizationWithSuccess:^{
                [self performSubsequentSynchronizationWithSuccess:success failure:failure];
            } failure:failure];
        } else {
            [self.client initialSynchronizationMatching:@{ @"type": @"Deletion" } success:^(CDAResponse *response, CDASyncedSpace *space) {
                [self persistedSpaceForSpace:space];
                [self performInitalSynchronizationForQueryWithSuccess:success failure:failure];
            } failure:failure];
        }

        return;
    }

    if (!self.syncedSpace) {
        CDARequest* request = [self.client initialSynchronizationWithSuccess:^(CDAResponse *response,
                                                                               CDASyncedSpace *space) {
            [self persistedSpaceForSpace:space];

            for (CDAAsset* asset in space.assets) {
                [self persistedAssetForAsset:asset];
            }

            for (CDAEntry* entry in space.entries) {
                [self persistedEntryForEntry:entry];
            }

            [self saveDataStore];

            if (success) {
                success();
            }
        } failure:failure];

        if (request) {
            request = nil;
        }
        return;
    }

    [self.syncedSpace performSynchronizationWithSuccess:^{
        id<CDAPersistedSpace> space = [self fetchSpaceFromDataStore];
        space.lastSyncTimestamp = self.syncedSpace.lastSyncTimestamp;
        space.syncToken = self.syncedSpace.syncToken;

        [self saveDataStore];

        if (success) {
            success();
        }
    } failure:failure];
}

-(id<CDAPersistedAsset>)persistedAssetForAsset:(CDAAsset*)asset {
    id<CDAPersistedAsset> persistedAsset = [self createPersistedAsset];
    [self updatePersistedAsset:persistedAsset withAsset:asset];
    return persistedAsset;
}

-(id<CDAPersistedEntry>)persistedEntryForEntry:(CDAEntry*)entry {
    NSString* identifier = entry.contentType.identifier;
    if (!identifier) {
        return nil;
    }

    id<CDAPersistedEntry> persistedEntry = [self createPersistedEntryForContentTypeWithIdentifier:identifier];
    if (!persistedEntry) {
        return nil;
    }

    [self updatePersistedEntry:persistedEntry withEntry:entry];
    return persistedEntry;
}

-(id<CDAPersistedSpace>)persistedSpaceForSpace:(CDASyncedSpace*)space {
    id<CDAPersistedSpace> persistedSpace = [self createPersistedSpace];
    persistedSpace.lastSyncTimestamp = space.lastSyncTimestamp;
    persistedSpace.syncToken = space.syncToken;
    return persistedSpace;
}

-(NSArray *)propertiesForEntriesOfContentTypeWithIdentifier:(NSString *)identifier {
    [self doesNotRecognizeSelector:_cmd];
    return nil;
}

-(NSDate*)roundedCurrentDate {
    NSTimeInterval time = round([[NSDate date] timeIntervalSinceReferenceDate] / 60.0) * 60.0;
    return [NSDate dateWithTimeIntervalSinceReferenceDate:time];
}

-(void)saveDataStore {
    [self doesNotRecognizeSelector:_cmd];
}

-(void)setClass:(Class)classForEntries forEntriesOfContentTypeWithIdentifier:(NSString *)identifier {
    self.classesForEntries[identifier] = classForEntries;
}

-(void)setMapping:(NSDictionary *)mapping forEntriesOfContentTypeWithIdentifier:(NSString *)identifier {
    self.mappingForEntries[identifier] = mapping;
}

-(CDASyncedSpace *)syncedSpace {
    if (!_syncedSpace) {
        id<CDAPersistedSpace> persistedSpace = [self fetchSpaceFromDataStore];
        if (!persistedSpace) {
            return nil;
        }

        _syncedSpace = [CDASyncedSpace shallowSyncSpaceWithToken:persistedSpace.syncToken
                                                          client:self.client];
        _syncedSpace.delegate = self;
        _syncedSpace.lastSyncTimestamp = persistedSpace.lastSyncTimestamp;
    }

    return _syncedSpace;
}

-(void)updatePersistedAsset:(id<CDAPersistedAsset>)persistedAsset withAsset:(CDAAsset*)asset {
    persistedAsset.identifier = asset.identifier;
    persistedAsset.internetMediaType = asset.MIMEType;
    persistedAsset.url = asset.URL.absoluteString;

    if ([persistedAsset respondsToSelector:@selector(setWidth:)]) {
        persistedAsset.width = @(asset.size.width);
    }

    if ([persistedAsset respondsToSelector:@selector(setHeight:)]) {
        persistedAsset.height = @(asset.size.height);
    }
}

-(void)updatePersistedEntry:(id<CDAPersistedEntry>)persistedEntry withEntry:(CDAEntry*)entry {
    NSAssert([persistedEntry conformsToProtocol:@protocol(CDAPersistedEntry)],
             @"%@ does not conform to CDAPersistedEntry protocol.", persistedEntry);

    NSString* identifier = entry.contentType.identifier;
    if (!identifier) {
        return;
    }

    NSDictionary* mappingForEntries = [self mappingForEntriesOfContentTypeWithIdentifier:identifier];
    [entry mapFieldsToObject:persistedEntry usingMapping:mappingForEntries];
    persistedEntry.identifier = entry.identifier;
}

#pragma mark - CDASyncedSpaceDelegate

-(void)syncedSpace:(CDASyncedSpace *)space didCreateAsset:(CDAAsset *)asset {
    self.hasChanged = YES;

    [self persistedAssetForAsset:asset];
}

-(void)syncedSpace:(CDASyncedSpace *)space didCreateEntry:(CDAEntry *)entry {
    self.hasChanged = YES;

    [self persistedEntryForEntry:entry];
}

-(void)syncedSpace:(CDASyncedSpace *)space didDeleteAsset:(CDAAsset *)asset {
    self.hasChanged = YES;

    [self deleteAssetWithIdentifier:asset.identifier];
}

-(void)syncedSpace:(CDASyncedSpace *)space didDeleteEntry:(CDAEntry *)entry {
    self.hasChanged = YES;

    [self deleteEntryWithIdentifier:entry.identifier];
}

-(void)syncedSpace:(CDASyncedSpace *)space didUpdateAsset:(CDAAsset *)asset {
    self.hasChanged = YES;

    id<CDAPersistedAsset> persistedAsset = [self fetchAssetWithIdentifier:asset.identifier];

    if (!persistedAsset) {
        persistedAsset = [self createPersistedAsset];
    }

    [self updatePersistedAsset:persistedAsset withAsset:asset];
}

-(void)syncedSpace:(CDASyncedSpace *)space didUpdateEntry:(CDAEntry *)entry {
    NSString* identifier = entry.contentType.identifier;
    if (!identifier) {
        return;
    }

    self.hasChanged = YES;

    id<CDAPersistedEntry> persistedEntry = [self fetchEntryWithIdentifier:entry.identifier];

    if (!persistedEntry) {
        persistedEntry = [self createPersistedEntryForContentTypeWithIdentifier:identifier];
    }

    [self updatePersistedEntry:persistedEntry withEntry:entry];
}

@end


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.metrics.simple;

import com.yahoo.api.annotations.Beta;
import com.yahoo.metrics.simple.UntypedMetric.AssumedType;

/**
 * A gauge metric, i.e. a bucket of arbitrary sample values. Create a gauge
 * metric by declaring it with {@link MetricReceiver#declareGauge(String)} or
 * {@link MetricReceiver#declareGauge(String, Point)}.
 *
 * @author steinar
 */
@Beta
public class Gauge {

    private final Point defaultPosition;
    private final String name;
    private final MetricReceiver receiver;

    Gauge(String name, Point defaultPosition, MetricReceiver receiver) {
        this.name = name;
        this.defaultPosition = defaultPosition;
        this.receiver = receiver;
    }

    /**
     * Record a sample with default or no position.
     *
     * @param x
     *            sample value
     */
    public void sample(double x) {
        sample(x, defaultPosition);
    }

    /**
     * Record a sample at the given position.
     *
     * @param x
     *            sample value
     * @param p
     *            position/dimension values for the sample
     */
    public void sample(double x, Point p) {
        receiver.update(new Sample(new Measurement(x), new Identifier(name, p), AssumedType.GAUGE));
    }

    /**
     * Create a PointBuilder with the default dimension values reflecting those
     * given when this gauge was declared.
     *
     * @return a builder initialized with defaults from this metric instance
     */
    public PointBuilder builder() {
        return new PointBuilder(defaultPosition);
    }
}


text:
@class MHConvoreGroup;
@class MHConvoreMessage;
@class DetailViewController;

@interface ConvalotTopicsViewController : UITableViewController {

}
@property(nonatomic, retain) MHConvoreGroup *group;
@property(nonatomic, copy) NSArray *topics;
@property(nonatomic, retain) DetailViewController *detailViewController;

- (id)initWithStyle:(UITableViewStyle)style group:(MHConvoreGroup *)group;

- (void)newMessage:(MHConvoreMessage *)message;

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/warning"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/ic_dialog_browser_security_bad"
    android:drawablePadding="6dip"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:layout_marginLeft="12dip"
    android:layout_marginRight="12dip"
    android:minHeight="32dip"
    android:gravity="center_vertical"
    android:layout_marginBottom="4dip"
    android:layout_marginTop="4dip" />


text:
<?php

namespace umi\cache\exception;

/**
 * Создается исключение, если значение не является действительным ключем.
 * Это соответствует ошибкам, которые не могут быть обнаружены во время компиляции.
 */
class OutOfBoundsException extends \OutOfBoundsException implements IException
{
}


text:
/**
 *
 */
package com.nagasaqi.ui;

/**
 * @author praval
 *
 */
public class Invoker {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		InstrumentAdapter ia = new InstrumentAdapter();

	}

}


text:
expected_lines = {
    "account required pam_unix.so",
    "account sufficient @@pam_krb5@@/lib/security/pam_krb5.so",
    "auth [default=die success=done] @@pam_ccreds@@/lib/security/pam_ccreds.so action=validate use_first_pass",
    "auth [default=ignore success=1 service_err=reset] @@pam_krb5@@/lib/security/pam_krb5.so use_first_pass",
    "auth required pam_deny.so",
    "auth sufficient @@pam_ccreds@@/lib/security/pam_ccreds.so action=store use_first_pass",
    "auth sufficient pam_rootok.so",
    "auth sufficient pam_unix.so   likeauth try_first_pass",
    "password sufficient @@pam_krb5@@/lib/security/pam_krb5.so use_first_pass",
    "password sufficient pam_unix.so nullok sha512",
    "session optional @@pam_krb5@@/lib/security/pam_krb5.so",
    "session required pam_env.so conffile=/etc/pam/environment readenv=0",
    "session required pam_unix.so",
}
actual_lines = set(machine.succeed("cat /etc/pam.d/chfn").splitlines())

missing_lines = expected_lines - actual_lines
extra_lines = actual_lines - expected_lines
non_functional_lines = set([line for line in extra_lines if (line == "" or line.startswith("#"))])
unexpected_functional_lines = extra_lines - non_functional_lines

with subtest("All expected lines are in the file"):
    assert not missing_lines, f"Missing lines: {missing_lines}"

with subtest("All remaining lines are empty or comments"):
    assert not unexpected_functional_lines, f"Unexpected lines: {unexpected_functional_lines}"


text:
{% extends 'scheduler_web/base.html' %}
{% load staticfiles %}
{% block content %}
<h1> Add server </h1>
<form action="{% url 'addServer' %}" method="post">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="Submit" />
</form>
{% endblock %}


text:
package es.weso.wiFetcher.entities

case class Dataset (
    val id:String=""
 ){

  override def equals(o : Any) = o match {
    case that : Dataset => that.id.equals(id)
    case _ => false
  }

}


text:
package com.moser.jmxweb.web.model;

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

/**
 * MBeanEntryModel
 * <p/>
 * Author: Nicolas Moser
 * Date: 05.11.13
 * Time: 22:13
 */
public class MBeanEntryModel extends MBeanModel {

	private String name;

	private String mBeanClass;

	private String description;

	private List<MBeanAttributeModel> attributes = new ArrayList<MBeanAttributeModel>();

	private List<MBeanOperationModel> operations = new ArrayList<MBeanOperationModel>();

	/** Creates a new MBeanEntryModel instance. */
	public MBeanEntryModel() {

		super(MBeanModelType.ENTRY);
	}

	/**
	 * Getter for the MBean name.
	 *
	 * @return the name
	 */
	public String getName() {

		return name;
	}

	/**
	 * Setter for the MBean name.
	 *
	 * @param name
	 * 		the name to set
	 */
	public void setName(String name) {

		this.name = name;
	}

	/**
	 * Getter for the MBean description.
	 *
	 * @return the description
	 */
	public String getmBeanClass() {

		return mBeanClass;
	}

	/**
	 * Setter for the MBean class.
	 *
	 * @param mBeanClass
	 * 		the mBeanClass to set
	 */
	public void setmBeanClass(String mBeanClass) {

		this.mBeanClass = mBeanClass;
	}

	/**
	 * Getter for the MBean description.
	 *
	 * @return the description
	 */
	public String getDescription() {

		return description;
	}

	/**
	 * Setter for the MBean description.
	 *
	 * @param description
	 * 		the description to set
	 */
	public void setDescription(String description) {

		this.description = description;
	}

	/**
	 * Getter for the attribute list.
	 *
	 * @return the attribute list
	 */
	public List<MBeanAttributeModel> getAttributes() {

		return attributes;
	}

	/**
	 * Setter for the attribute list.
	 *
	 * @param attributes
	 * 		the attribute list to set
	 */
	protected void setAttributes(List<MBeanAttributeModel> attributes) {

		this.attributes = attributes;
	}

	/**
	 * Getter for the operation list.
	 *
	 * @return the operation list
	 */
	public List<MBeanOperationModel> getOperations() {

		return operations;
	}

	/**
	 * Setter for the operations list.
	 *
	 * @param operations
	 * 		the operations list to set
	 */
	protected void setOperations(List<MBeanOperationModel> operations) {

		this.operations = operations;
	}
}


text:
public class Sum implements Runnable {
    private final int UpperEnd;

    public Sum(int upperEnd) {
        UpperEnd = upperEnd;
    }

    @Override
    public void run() {
        for (int i = 0; i < UpperEnd; i++) {
            Main.bigSum.incrementAndGet();
        }
    }
}


text:
#ifndef __USART_H
#define __USART_H

void usart3_init(int baudrate);
void usart3_putc(uint8_t data);
void usart3_puts(uint8_t *str);
uint8_t usart3_getc();
int printf(const char *format, ...);

/* Debug print function */
#ifdef DEBUG_PRINT
	#define debug_print(x, ...) printf(x, ##__VA_ARGS__)
#else
	#define debug_print(x, ...) while(1);
#endif

#endif


text:
	<project name="MyNabaztag" default="compile.project">

	<!-- ===================== Property Definitions =========================== -->

	<property file="build.properties" />

	<!-- ==================== File and Directory Names ======================== -->

	<property name="lib.dir" value="${basedir}/lib" description="Location of the project libraries"/>
	<property name="src.dir" value="${basedir}/net" description="Location of the project sources"/>
	<property name="config.dir" value="${basedir}/config" description="Location of the configuration files"/>
	<property name="build.dir" value="${basedir}/build" description="" />
	<property name="web.dir" value="${build.dir}/WEB-INF" description="" />
	<property name="web.conf.dir" value="${web.dir}/conf" description="" />
	<property name="classes.dest" value="${web.dir}/classes" description="Destination directory for project classes"/>
	<property name="test.src.dir" value="${basedir}/test" description="Location of the test sources"/>
	<property name="test.classes.dest" value="${basedir}/build_test/classes" description="Destination directory for tests classes"/>
	<property name="test.report.dir" value="${basedir}/build_test/reports/junit" />

	<property name="tomcat.lib" value="${catalina.home}/common/lib" />
	<property name="deploy.war" value="${build.dir}/myNabaztag.war" />
	<property name="web.lib" value="${web.dir}/lib" />

	<tstamp>
		<format property="now" pattern="yyyy.MM.dd_kk:mm:ss" locale="en" />
	</tstamp>

	<path id="svn.classpath">
		<pathelement location="${COMMONDIR}/lib/svnant.jar" />
		<pathelement location="${COMMONDIR}/lib/svnClientAdapter.jar" />
		<pathelement location="${COMMONDIR}/lib/svnjavahl.jar" />
	</path>

	<target name="get.hostname">
		    <property environment="env"/>
			<condition property="hostname" value="${env.HOSTNAME}">
				<isset property="env.HOSTNAME"/>
			</condition>
			<condition property="hostname" value="${env.HOST}">
				<isset property="env.HOST"/>
			</condition>
			<exec executable="hostname" outputProperty="hostname" />
		</target>

		<target name="set.server" unless="server" depends="get.hostname" description="Sets the server prefix according to the current machine.">
			<condition property="server" value="PROD">
				<or>
					<equals arg1="${hostname}" arg2="angora" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="beveren" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="hotot" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="satin" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="thuringue" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="zibeline" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="bouscat" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="saxe" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="orylag" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="martre" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="renard" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="havane" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="parapluie" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="flandres" trim="true" casesensitive="false" />
				</or>
			</condition>

			<condition property="prod">
				<isset property="server"/>
			</condition>

			<condition property="server" value="S">
				<equals arg1="${hostname}" arg2="silence" trim="true" casesensitive="false" />
			</condition>

			<condition property="server" value="PP">
				<or>
					<equals arg1="${hostname}" arg2="mauve" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="pourpre" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="prune" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="mug" trim="true" casesensitive="false" />
					<equals arg1="${hostname}" arg2="lavande" trim="true" casesensitive="false" />
				</or>
			</condition>

			<condition property="server" value="">
				<not>
					<isset property="server"/>
				</not>
			</condition>
		</target>

	<!-- load the svn task -->
	<taskdef resource="svntask.properties" classpathref="svn.classpath" />

	<target name="svn.up">
		<svn username="${svn.username}" password="${svn.password}">
			<update dir="${basedir}" />
		</svn>
	</target>

	<!-- ==================== Clean Target ==================================== -->

	<target name="clean" description="Delete old classes...">
		<delete dir="${classes.dest}" />
		<delete dir="${test.classes.dest}" />
	</target>

	<!-- ==================== Compile Target ================================== -->

	<path id="Xlib.path" >
		<fileset dir="${COMMONDIR}/lib" excludes="${exclude.from.classpath}"/>
		<fileset dir="${COMMONDEVDIR}/lib" excludes="${exclude.from.classpath}"/>
		<fileset dir="${OSDIR}/lib" excludes="${exclude.from.classpath}"/>
		<fileset dir="${DBENGINEDIR}/lib" excludes="${exclude.from.classpath}"/>
	</path>

	<target name="OS.compile" description="gets the OS built">
		<echo message="===== START BUILDING OS =====" />
	    <ant antfile="${OSDIR}/build.xml" inheritAll="false" target="up.and.compile" >
	    	<property name="classes.dest" value="${classes.dest}"/>
	    	<property name="COMMONDIR" value="${COMMONDIR}"/>
	    	<property name="PROBESDIR" value="${PROBESDIR}"/>
	    	<property name="DBENGINEDIR" value="${DBENGINEDIR}"/>
	   	</ant>
	</target>

	<target name="OS.compile.test" description="gets the OS built">
		<echo message="===== START BUILDING OS TESTS =====" />
	    <ant antfile="${OSDIR}/build.xml" inheritAll="false" target="compile.tests" >
	    	<property name="test.classes.dest" value="${test.classes.dest}"/>
	    	<property name="COMMONDIR" value="${COMMONDIR}"/>
	    	<property name="PROBESDIR" value="${PROBESDIR}"/>
	    	<property name="DBENGINEDIR" value="${DBENGINEDIR}"/>
	   	</ant>
	</target>

	<target name="common.compile" description="gets the common dev built">
		<echo message="===== START BUILDING CommonDev =====" />
	    <ant antfile="${COMMONDEVDIR}/build.xml" inheritAll="false" target="up.and.compile">
	    	<property name="classes.dest" value="${classes.dest}"/>
	    	<property name="lib.dir" value="${OS.lib}" />
		</ant>
	</target>

	<target name="compile.project" depends="clean,set.server, OS.compile, common.compile, copy.config" description="Compile Java sources">
		<echo message="===== START BUILDING MyNabaztag =====" />
		<javac srcdir="${src.dir}" destdir="${classes.dest}" debug="on" nowarn="on" >
			<classpath>
				<fileset dir="${lib.dir}" excludes="${exclude.from.classpath}"/>
				<path refid="Xlib.path" />
			</classpath>
		</javac>
	</target>

	<target name="compile.tests" depends="clean,compile.project, OS.compile.test">
		<javac srcdir="${test.src.dir}" destdir="${test.classes.dest}" debug="on" nowarn="on" >
			<classpath>
				<fileset dir="${lib.dir}" excludes="${exclude.from.classpath}"/>
				<path refid="Xlib.path" />
				<pathelement location="${classes.dest}" />
			</classpath>
		</javac>
	</target>

	<target name="copy.config" depends="set.server">
		<!-- Copie des fichiers de configuration -->
		<echo message="Copie des fichiers de configuration '${server}'"/>
		<!-- We need to override the web.xml with MyNabaztag's -->
		<copy file="${config.dir}/my.constante.properties${server}" tofile="${classes.dest}/my.constante.properties" overwrite="true" />
		<copy todir="${classes.dest}" overwrite="true">
			<fileset dir="${config.dir}" casesensitive="yes" includes="my.constante-*.properties"/>
		</copy>
		<copy file="${config.dir}/web${server}.xml" tofile="${web.dir}/web.xml" overwrite="true" />
	</target>

	<target name="copy.resources">
		<!-- Copie des fichiers non-java dans build/WEB-INF/classes -->
		<copy todir="${classes.dest}/net" includeEmptyDirs="false">
			<fileset dir="${basedir}/net">
				<exclude name="**/*.java"/>
			</fileset>
		</copy>
	</target>

	<!-- ==================== Compilation des JSP =============================== -->
	<target name="compile.jsp" depends="compile.project" >
		<taskdef classname="org.apache.jasper.JspC" name="jasper2">
			<classpath id="jspc.classpath">
				<fileset dir="${catalina.home}/bin">
					<include name="*.jar" />
				</fileset>
				<fileset dir="${catalina.home}/server/lib">
					<include name="*.jar" />
				</fileset>
				<fileset dir="${tomcat.lib}">
					<include name="*.jar" />
				</fileset>
				<fileset dir="${java.home}/../lib/">
					<include name="tools.jar" />
				</fileset>
				<fileset dir="${lib.dir}" excludes="${exclude.from.classpath}"/>
			</classpath>
		</taskdef>

		<delete dir="${web.dir}/src/" />
		<mkdir dir="${web.dir}/classes" />
		<mkdir dir="${web.dir}/src" />

		<jasper2 validateXml="false" uriroot="${build.dir}"
		webXmlFragment="${web.dir}/generated_web.xml"
		addWebXmlMappings="true"
		outputDir="${web.dir}/src" />

		<javac srcdir="${web.dir}/src" destdir="${web.dir}/classes" debug="on" deprecation="on" excludes="**/*.smap">
			<classpath>
				<fileset dir="${lib.dir}" excludes="${exclude.from.classpath}"/>
				<!--fileset dir="${OS.lib}" excludes="${exclude.from.classpath}"/-->
				<pathelement location="${classes.dest}" />
				<pathelement location="${catalina.home}/common/classes" />
				<fileset dir="${tomcat.lib}">
					<include name="*.jar" />
				</fileset>
				<pathelement location="${catalina.home}/shared/classes" />
				<fileset dir="${catalina.home}/shared/lib">
					<include name="*.jar" />
				</fileset>
				<fileset dir="${catalina.home}/bin">
					<include name="*.jar" />
				</fileset>
			</classpath>
			<include name="**" />
			<exclude name="tags/**" />
			<exclude name="**/inc_005fjavascripts_jsp.java" />
			<exclude name="**/inc_005fheader_jsp.java" />
			<exclude name="**/inc_005fcss_jsp.java" />
			<exclude name="**/inc_005fnablifeMenu_jsp.java" />
		</javac>
	</target>

	<!-- ==================== cssy & jsy ================================== -->

	<!-- utilisé pour packager les javascripts et les CSS -->
	<property name="JSY_SRC_DIR"            value="${basedir}/build/include_js" />
	<property name="JSY_DIST_DIR"           value="${basedir}/build/include_js/dist" />
	<property name="CSSY_SRC_DIR"           value="${basedir}/build/include_css" />
	<property name="CSSY_DIST_DIR"          value="${basedir}/build/include_css/dist" />
	<property name="JSY_TMP_FILE"           value="${basedir}/build/tmp.js.css.txt" />
	<property name="JSY_CONFTOOLS_FILE_MIN" value="${JSY_DIST_DIR}/nabaztag.conftools.js" />
	<property name="JSY_NABAZTAG_FILE_MIN"  value="${JSY_DIST_DIR}/nabaztag.common.js" />
	<property name="JSY_JQUERY_FILES_MIN"   value="${JSY_DIST_DIR}/nabaztag.jquery.js" />
	<property name="JSY_NABLIFE_FILES_MIN"  value="${JSY_DIST_DIR}/nabaztag.nablife.js" />
	<property name="JSY_HOME_FILES_MIN"     value="${JSY_DIST_DIR}/nabaztag.home.js" />
	<property name="JSY_TERRIER_FILES_MIN"  value="${JSY_DIST_DIR}/nabaztag.terrier.js" />
	<property name="CSSY_BLUE_FILES_MIN"    value="${CSSY_DIST_DIR}/nabaztag.layout_blue.css" />
	<property name="CSSY_GREEN_FILES_MIN"   value="${CSSY_DIST_DIR}/nabaztag.layout_green.css" />
	<property name="CSSY_ORANGE_FILES_MIN"  value="${CSSY_DIST_DIR}/nabaztag.layout_orange.css" />
	<property name="CSSY_PINK_FILES_MIN"    value="${CSSY_DIST_DIR}/nabaztag.layout_pink.css" />
	<property name="CSSY_VIOLET_FILES_MIN"  value="${CSSY_DIST_DIR}/nabaztag.layout_violet.css" />
	<property name="CSSY_MODULES_FILES_MIN" value="${CSSY_DIST_DIR}/nabaztag.modules.css" />
	<property name="CSSY_LAYOUT_FILES_MIN"  value="${CSSY_DIST_DIR}/nabaztag.layout.css" />
	<property name="CSSY_PARTS_FILES_MIN"   value="${CSSY_DIST_DIR}/nabaztag.parts.css" />
	<property name="JSY_BUILD_DIR"          value="${basedir}/js-tools/" />

		<target name="cssy_nabaztag" description="Main CSS Files for my.nabaztag.com using Yahoo Compressor">
		<echo message="===== CSS =====" />

		<delete verbose="true">
			<fileset dir="${CSSY_DIST_DIR}" includes="*.*"/>
		</delete>

		<mkdir dir="${CSSY_DIST_DIR}" />

		<!-- CSS de base ***************************************************************************** -->

		<!-- création du css des modules -->
		<echo message="Minimizing to ${CSSY_MODULES_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/modules/" includes="*.css" />
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_MODULES_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du css du layout principal -->
		<echo message="Minimizing to ${CSSY_LAYOUT_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout/" includes="*.css" />
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_LAYOUT_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du css des differentes parties du site -->
		<echo message="Minimizing to ${CSSY_PARTS_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/part_layout/" includes="*.css" />
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_PARTS_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création des TEMPLATES DE COULEURS ***************************************************************************** -->

		<!-- création du fichier template BLUE -->
		<echo message="Minimizing to ${CSSY_BLUE_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout_blue/"  >
					<include name="*.css"/>
					<exclude name="layout.css"/>
				</fileset>
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_BLUE_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du fichier template GREEN -->
		<echo message="Minimizing to ${CSSY_GREEN_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout_green/"  >
					<include name="*.css"/>
					<exclude name="layout.css"/>
				</fileset>
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_GREEN_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du fichier template ORANGE -->
		<echo message="Minimizing to ${CSSY_ORANGE_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout_orange/"  >
					<include name="*.css"/>
					<exclude name="layout.css"/>
				</fileset>
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_ORANGE_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du fichier template PINK -->
		<echo message="Minimizing to ${CSSY_PINK_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout_pink/"  >
					<include name="*.css"/>
					<exclude name="layout.css"/>
				</fileset>
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_PINK_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<!-- création du fichier template VIOLET -->
		<echo message="Minimizing to ${CSSY_VIOLET_FILES_MIN}" />
			<concat destfile="${JSY_TMP_FILE}">
				<fileset dir="${CSSY_SRC_DIR}/layout_violet/"  >
					<include name="*.css"/>
					<exclude name="layout.css"/>
				</fileset>
			</concat>
			<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	            <arg line=" --type css -o ${CSSY_VIOLET_FILES_MIN} ${JSY_TMP_FILE}"/>
	        </java>

		<echo message="===== CSS END =====" />

	</target>

	<target name="jsy_nabaztag" description="Main JS File for my.nabaztag.com using Yahoo Compressor">
		<echo message="===== JAVASCRIPTS =====" />

		<delete verbose="true">
			<fileset dir="${JSY_DIST_DIR}" includes="*.*"/>
		</delete>

		<mkdir dir="${JSY_DIST_DIR}" />

		<!-- création du fichier "conftools" -->
		<echo message="Building ${JSY_CONFTOOLS_FILE_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="conftools/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_CONFTOOLS_FILE_MIN}" />
		<java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_CONFTOOLS_FILE_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<!-- création du fichier jquery avec ces plugins -->
		<echo message="Building ${JSY_JQUERY_FILES_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="jQuery/jquery-?.?*.js" />
			<fileset dir="${JSY_SRC_DIR}" includes="jQuery/plugins/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_JQUERY_FILES_MIN}" />
	    <java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_JQUERY_FILES_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<!-- création du fichier de scripts nabaztag.com -->
		<echo message="Building ${JSY_NABAZTAG_FILE_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="common/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_NABAZTAG_FILE_MIN}" />
	    <java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_NABAZTAG_FILE_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<!-- création du fichier myHome -->
		<echo message="Building ${JSY_HOME_FILES_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="myHome/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_HOME_FILES_MIN}" />
	    <java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_HOME_FILES_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<!-- création du fichier myNablife -->
		<echo message="Building ${JSY_NABLIFE_FILES_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="myNablife/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_NABLIFE_FILES_MIN}" />
	    <java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_NABLIFE_FILES_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<!-- création du fichier myTerrier -->
		<echo message="Building ${JSY_TERRIER_FILES_MIN}" />
		<concat destfile="${JSY_TMP_FILE}">
			<fileset dir="${JSY_SRC_DIR}" includes="myTerrier/*.js" />
		</concat>
		<echo message="Minimizing to ${JSY_TERRIER_FILES_MIN}" />
	    <java jar="${JSY_BUILD_DIR}/yuicompressor-2.2.5.jar" fork="true">
	        <arg line=" --type js -o ${JSY_TERRIER_FILES_MIN} ${JSY_TMP_FILE}"/>
	    </java>

		<delete file="${JSY_TMP_FILE}" />

	    <echo message="===== JAVASCRIPTS END =====" />
	</target>

	<!-- Build the WAR file. depends="compile.all,cssy_nabaztag,jsy_nabaztag" -->
	  <target name="build.war" description="Builds the WAR file." depends="compile.jsp,cssy_nabaztag,jsy_nabaztag">
	    <echo message="===== START BUILDING WAR FILE =====" />
	    <delete file="${deploy.war}"/>
	    <war destfile="${deploy.war}" webxml="${web.dir}/web.xml" duplicate="fail">
	      <webinf dir="${web.dir}">
	      	<exclude name="src/" />
	      </webinf>
			<fileset dir="${build.dir}" includes="${include.in.war}"/>
			<lib dir="${lib.dir}" excludes="${exclude.from.warlib}"/>
	    	<lib dir="${COMMONDIR}/lib" excludes="${exclude.from.warlib}"/>
	    	<lib dir="${OSDIR}/lib" excludes="${exclude.from.warlib}"/>
	    	<lib dir="${DBENGINEDIR}/lib" excludes="${exclude.from.warlib}"/>
	      <metainf dir="${build.dir}/META-INF"/>
	    </war>
	    <echo message="===== END BUILDING WAR FILE =====" />
	  </target>

	<path id="tomcat.ant.classpath">
	 	<pathelement location="${OSDIR}/lib/catalina-ant.jar" />
	</path>
	<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="tomcat.ant.classpath"/>

	<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="tomcat.ant.classpath"/>

	<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" classpathref="tomcat.ant.classpath" />

	<!-- Deploys and reload the WebApp -->
	<target name="deployOnly" depends="build.war" description="Hot deploys the WAR file to each tomcats.">
		<deploy url="http://${host}:${port}/manager" username="admin" password="${password}" path="/vl" war="${deploy.war}"/>
		<reload url="http://${host}:${port}/manager" username="admin" password="${password}" path="/vl" />
		<delete file="${deploy.war}"/>
	</target>

	<!-- unDeploys, Deploys and reload the WebApp -->
	<target name="redeploy" description="Hot deploys the WAR file to each tomcats.">
	    <echo message="===== DEPLOYING THE WAR FILE  =====" />
		<undeploy url="http://${host}:${port}/manager" username="admin" password="${password}" path="/vl"/>
		<deploy url="http://${host}:${port}/manager" username="admin" password="${password}" path="/vl" war="${deploy.war}"/>
		<reload url="http://${host}:${port}/manager" username="admin" password="${password}" path="/vl" />
	  	<delete file="${deploy.war}"/>
	</target>
	<target name="hotDeploy" depends="build.war, redeploy"/>

	<!-- JUnit reports publication -->
	<target name="tests" depends="compile.tests">

		<mkdir dir="${test.report.dir}" />

		<junit fork="yes" printsummary="no" haltonfailure="no" failureproperty="junit.failure.db">
	    	<jvmarg value="-Xmx2048m" />

			<classpath>
				<fileset dir="${lib.dir}" />
				<path refid="Xlib.path" />
				<pathelement location="${classes.dest}" />
				<pathelement location="${test.classes.dest}" />
				<pathelement location="${test.src.dir}" />
			</classpath>

			<formatter type="xml" />

			<sysproperty key="silence" value="true"/>
	        <sysproperty key="net.violet.platform.datamodel.factories.impl" value="net.violet.platform.datamodel.factories.implementations.FactoryImpl"/>
	        <sysproperty key="log4j.configuration" value="log4j-cli.properties"/>

			<batchtest fork="yes" todir="${test.report.dir}">
				<fileset dir="${test.src.dir}">
					<include name="**/datamodel/*Test.java" />
					<include name="**/datamodel/factories/implementations/*Test.java" />
					<include name="**/daemons/crawlers/gestion/*Test.java" />
					<exclude name="**/DBTest.java" />
				</fileset>
			</batchtest>
		</junit>

		<junit fork="yes" printsummary="no" haltonfailure="no" failureproperty="junit.failure">
	    	<jvmarg value="-Xmx2048m" />

			<classpath>
				<fileset dir="${lib.dir}" />
				<path refid="Xlib.path" />
				<pathelement location="${classes.dest}" />
				<pathelement location="${test.classes.dest}" />
				<pathelement location="${src.dir}" />
			</classpath>

			<formatter type="xml" />

			<sysproperty key="silence" value="true"/>
	        <sysproperty key="net.violet.platform.datamodel.factories.impl" value="net.violet.platform.datamodel.factories.mock.FactoryMock"/>
	        <sysproperty key="log4j.configuration" value="log4j-cli.properties"/>

			<batchtest fork="yes" todir="${test.report.dir}">
				<fileset dir="${test.src.dir}">
					<include name="**/*Test.java" />
					<!-- Classes de base (ou autre) qui ne sont pas des tests -->
					<exclude name="**/ActionTest.java" />
					<exclude name="**/CrawlerTest.java" />
					<exclude name="**/datamodel/*.java" />
					<exclude name="**/datamodel/factories/implementations/*.java" />
					<exclude name="**/daemons/crawlers/gestion/*Test.java" />
					<exclude name="**/CacheNodeTest.java" />
					<exclude name="**/VioletApiComponentTest.java" />
				</fileset>
			</batchtest>
		</junit>

		<!-- Generate Junit report -->
		<mkdir dir="${test.report.dir}/html" />
		<junitreport todir="${test.report.dir}">
			<fileset dir="${test.report.dir}">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="frames" todir="${test.report.dir}/html" />
		</junitreport>

	    <antcall target="archive.reports"/>

		<!-- Erreur si un test a échoué. -->
		<fail message="JUnit datamodel tests failed" if="junit.failure.db"/>
		<fail message="JUnit tests failed" if="junit.failure"/>
	</target>

	<target name="archive.reports" if="reports.archive.dir">
		<!-- Copy report -->
		<tstamp>
			<format property="now" pattern="yyyy.MM.dd_kk:mm:ss" locale="en" />
		</tstamp>

	    <copy todir="${reports.archive.dir}/${now}">
	        <fileset dir="${test.report.dir}"/>
	    </copy>
	    <exec executable="/usr/bin/unlink">
		   	<arg value="${reports.archive.dir}/_latest"/>
		</exec>
	    <exec executable="/bin/ln">
		   	<arg value="-s"/>
		   	<arg value="${reports.archive.dir}/${now}"/>
		   	<arg value="${reports.archive.dir}/_latest"/>
		</exec>
	</target>

	</project>


text:
package cz.vhromada.catalog.web.show.controller;

import cz.vhromada.catalog.facade.ShowFacade;
import cz.vhromada.catalog.web.common.AbstractResultController;
import cz.vhromada.catalog.web.event.ControllerEvent;
import cz.vhromada.catalog.web.flow.CatalogFlow;
import cz.vhromada.catalog.web.mapper.ShowMapper;
import cz.vhromada.catalog.web.show.mo.ShowMO;
import cz.vhromada.web.wicket.controller.Flow;

import org.apache.wicket.model.IModel;
import org.mapstruct.factory.Mappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * A class represents controller for adding show.
 *
 * @author Vladimir Hromada
 */
@Component("addShowConfirmController")
public class AddShowConfirmController extends AbstractResultController<IModel<ShowMO>> {

    /**
     * Facade for shows
     */
    private ShowFacade showFacade;

    /**
     * Mapper for shows
     */
    private final ShowMapper showMapper;

    /**
     * Creates a new instance of AddShowConfirmController.
     *
     * @param showFacade facade for shows
     * @throws IllegalArgumentException if facade for shows is null
     */
    @Autowired
    public AddShowConfirmController(final ShowFacade showFacade) {
        Assert.notNull(showFacade, "Facade for shows mustn't be null.");

        this.showFacade = showFacade;
        this.showMapper = Mappers.getMapper(ShowMapper.class);
    }

    @Override
    public void handle(final IModel<ShowMO> data) {
        addResults(showFacade.add(showMapper.mapBack(data.getObject())));

        if (processResult()) {
            getUi().fireEvent(new ControllerEvent(CatalogFlow.SHOWS_LIST, null));
        }
    }

    @Override
    public Flow getFlow() {
        return CatalogFlow.SHOWS_ADD_CONFIRM;
    }

}


text:
const initialState= {
  scene: {},
};

export default function reducer(state = initialState, action = {}) {
  switch(action.type) {
    case 'Search': {
      return {
        ...state,
        scene: action.scene,
      };
    }
    default:
      return state;
  }
}