text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Restaurant</title>
  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/main.css" media="screen" type="text/css">
  <link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=Playball' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/style-portfolio.css">
  <link rel="stylesheet" href="css/picto-foundry-food.css" />
  <link rel="stylesheet" href="css/jquery-ui.css">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/font-awesome.min.css" rel="stylesheet">
  <link rel="icon" href="favicon-1.ico" type="image/x-icon">

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
          Toggle navigation

        </button>
        X Restaurant

WELCOME

ABOUT

MENU

MY ORDER

BREAD

FEATURED

CONTACT

Welcome to X Restaurant

" Best in the city "

      <button type="button" class="btn btn-default" id="order">Make order</button>
      OR
      <button type="button" class="btn btn-default" id="login">LogIn</button>

        <form action="#" method="POST">

            Name:
            <input type="text" id="name">

            Password:
            <input type="password" id="password">

        </form>

If you want to join our restaurant commutnity

        <button type="button" class="btn btn-default dropdown-toggle" id="register">Register</button>

About us

Restaurant is a place for simplicity. Good food, good beer, and good service. Simple is the name of the game, and we're good at finding it in all the right places, even in your dining experience. We're a small group from Denver, Colorado who make simple food possible. Come join us and see what simplicity tastes like.

Our Breakfast Menu

OUR BREAD

We love the smell of fresh baked bread. Each loaf is handmade at the crack of dawn, using only the simplest of ingredients to bring out smells and flavors that beckon the whole block. Stop by anytime and experience simplicity at its finest.

Our Featured Dishes Menu

Have a look to our dishes!

Each food is handmade at the crack of dawn, using only the simplest of ingredients to bring out smells and flavors that beckon the whole block. Stop by anytime and experience simplicity at its finest.

                      ...

                      ...

                      ...

Registration!

                    <form id="contact-us" method="post" action="reserve.php">

                            <input type="text" name="first_name" id="first_name" required="required" class="form" placeholder="First Name" />
                            <input type="text" name="last_name" id="last_name" required="required" class="form" placeholder="Last Name" />
                            <input type="text" name="state" id="state" required="required" class="form" placeholder="State" />
                            <input type="text" name="datepicker" id="datepicker" required="required" class="form" placeholder="Reservation Date" />

                            <button type="submit" id="submit" name="submit" class=" form-btn form-btn1 semibold">Reserve</button>

                            <input type="text" name="phone" id="phone" required="required" class="form" placeholder="Phone" />
                            <input type="text" name="guest" id="guest" required="required" class="form" placeholder="Number of guests" />
                            <input type="email" name="email" id="email" required="required" class="form" placeholder="Email" />
                            <input type="text" name="subject" id="subject" required="required" class="form" placeholder="Subject" />

                    </form>

            FOLLOW

            OR DIAL
            (941) 883-335-6524

                        <form id="contact-us" method="post" action="contact.php">

                                <input type="text" name="name" id="name" required="required" class="form" placeholder="Name" />

                                <input type="email" name="email" id="email" required="required" class="form" placeholder="Email" />

                                <input type="text" name="subject" id="subject" required="required" class="form" placeholder="Subject" />

                                <textarea name="message" id="message" class="form textarea"  placeholder="Message"></textarea>

                                <button type="submit" id="submit" name="submit" class="form-btn semibold">Send Message</button>

                        </form>

© Restaurant 2014

BACK TO TOP

BUILT WITH CARE BY US


text:
/* ************************************************************************** */
/*                                                                            */
/*                                                                            */
/*    SkeletonBlueprint.hpp                          oooooo       oooooo      */
/*                                                 oooooooooo   oooooooooo    */
/*                                                         o%%%%%o            */
/*                                                         %:::::%            */
/*                                                        %:::::::%           */
/*    This file is part of the                             %:::::%            */
/*    Lums library.                                         %%%%%             */
/*                                                                            */
/* ************************************************************************** */

#ifndef LUMS_SKELETON_BLUEPRINT_HPP
#define LUMS_SKELETON_BLUEPRINT_HPP

#include <LumsInclude/Provider.hpp>
#include <LumsInclude/Binary/BObject.hpp>
#include <LumsInclude/Skeleton/SkeletonData.hpp>
#include <LumsInclude/Skeleton/Skeleton.hpp>

namespace lm
{
    class SkeletonBlueprint
    {
    public:
        SkeletonBlueprint();
        void        loadBinary(const BObject& object);
        void        load(const std::string& path, bool resource = true);
        Skeleton    create() const;
        ~SkeletonBlueprint();

    private:
        SkeletonData    _data;
    };

    using SkeletonProvider = Provider<SkeletonBlueprint>;
}

#endif

redpajama_set_name: RedPajamaGithub


text:
package io.squark.yggdrasil.jsx.cache;

import io.squark.yggdrasil.jsx.servlet.Response;

import java.io.Serializable;

public class CacheObject implements Serializable {
    private Response response;
    private String payload;

    public CacheObject(Response response, String payload) {
        this.response = response;
        this.payload = payload;
    }

    public Response getResponse() {
        return response;
    }

    public String getPayload() {
        return payload;
    }
}


text:
"""
Credit for demo setup: Gusto development team
"""
from gusto import *
from firedrake import IcosahedralSphereMesh, cos, sin, SpatialCoordinate, \
    FunctionSpace, parameters
from firedrake.petsc import PETSc
from argparse import ArgumentParser
from hybridization import HybridizedShallowWaterSolver
import sys

day = 24.*60.*60.

ref_dt = {3: 1800.,
          4: 900.,
          5: 450.,
          6: 225.,
          7: 112.5}

PETSc.Log.begin()
parser = ArgumentParser(description="""Williamson test case 6 (triangles).""",
                        add_help=False)

parser.add_argument("--refinements",
                    default=3,
                    type=int,
                    choices=[3, 4, 5, 6, 7],
                    help="Number of icosahedral refinements.")

parser.add_argument("--hybridization",
                    action="store_true",
                    help="Use a hybridized shallow water solver.")

parser.add_argument("--test",
                    action="store_true",
                    help="Enable a quick test run.")

parser.add_argument("--profile",
                    action="store_true",
                    help="Turn on profiling for a 20 time-step run.")

parser.add_argument("--dumpfreq",
                    default=24,
                    type=int,
                    action="store",
                    help="Dump frequency of output files.")

parser.add_argument("--help",
                    action="store_true",
                    help="Show help.")

args, _ = parser.parse_known_args()

if args.help:
    help = parser.format_help()
    PETSc.Sys.Print("%s\n" % help)
    sys.exit(1)

if args.profile:
    # Ensures accurate timing of parallel loops
    parameters["pyop2_options"]["lazy_evaluation"] = False
    tmax = 20*ref_dt[args.refinements]

if args.test:
    tmax = ref_dt[args.refinements]

if not args.test and not args.profile:
    tmax = 14*day

refinements = args.refinements
dt = ref_dt[refinements]
hybrid = bool(args.hybridization)
PETSc.Sys.Print("""
Problem parameters:\n
Test case: Williamson test case 6 (triangles)\n
Hybridized shallow water solver: %s,\n
Refinements: %s,\n
Profiling: %s,\n
Test run: %s,\n
Dump frequency: %s.\n
""" % (hybrid, refinements, bool(args.profile),
       bool(args.test), args.dumpfreq))

PETSc.Sys.Print("Initializing problem with dt: %s and tmax: %s.\n" % (dt,
                                                                      tmax))

R = 6371220.
H = 8000.

mesh = IcosahedralSphereMesh(radius=R,
                             refinement_level=refinements)
x = SpatialCoordinate(mesh)
mesh.init_cell_orientations(x)

fieldlist = ['u', 'D']
timestepping = TimesteppingParameters(dt=dt)

if hybrid:
    dirname = 'hybrid_sw_rossby_wave_ll_ref%s_dt%s' % (refinements, dt)
else:
    dirname = 'sw_rossby_wave_ll_ref%s_dt%s' % (refinements, dt)

output = OutputParameters(dirname=dirname,
                          dumpfreq=args.dumpfreq,
                          dumplist_latlon=['D'])
parameters = ShallowWaterParameters(H=H)
diagnostics = Diagnostics(*fieldlist)
diagnostic_fields = [CourantNumber()]

state = State(mesh, horizontal_degree=1,
              family="BDM",
              timestepping=timestepping,
              output=output,
              parameters=parameters,
              diagnostics=diagnostics,
              fieldlist=fieldlist,
              diagnostic_fields=diagnostic_fields)

# interpolate initial conditions
# Initial/current conditions
u0 = state.fields("u")
D0 = state.fields("D")
omega = 7.848e-6  # note lower-case, not the same as Omega
K = 7.848e-6
g = parameters.g
Omega = parameters.Omega

theta, lamda = latlon_coords(mesh)

u_zonal = R*omega*cos(theta) + R*K*(cos(theta)**3)*(4*sin(theta)**2 - cos(theta)**2)*cos(4*lamda)
u_merid = -R*K*4*(cos(theta)**3)*sin(theta)*sin(4*lamda)

uexpr = sphere_to_cartesian(mesh, u_zonal, u_merid)

def Atheta(theta):
    return 0.5*omega*(2*Omega + omega)*cos(theta)**2 + 0.25*(K**2)*(cos(theta)**8)*(5*cos(theta)**2 + 26 - 32/(cos(theta)**2))

def Btheta(theta):
    return (2*(Omega + omega)*K/30)*(cos(theta)**4)*(26 - 25*cos(theta)**2)

def Ctheta(theta):
    return 0.25*(K**2)*(cos(theta)**8)*(5*cos(theta)**2 - 6)

Dexpr = H + (R**2)*(Atheta(theta) + Btheta(theta)*cos(4*lamda) + Ctheta(theta)*cos(8*lamda))/g

# Coriolis
fexpr = 2*Omega*x[2]/R
V = FunctionSpace(mesh, "CG", 1)
f = state.fields("coriolis", V)
f.interpolate(fexpr)  # Coriolis frequency (1/s)

u0.project(uexpr, form_compiler_parameters={'quadrature_degree': 8})
D0.interpolate(Dexpr)

state.initialise([('u', u0),
                  ('D', D0)])

ueqn = EulerPoincare(state, u0.function_space())
Deqn = AdvectionEquation(state, D0.function_space(),
                         equation_form="continuity")

advected_fields = []
advected_fields.append(("u", ThetaMethod(state, u0, ueqn)))
advected_fields.append(("D", SSPRK3(state, D0, Deqn)))

# Set up linear solver
if hybrid:
    linear_solver = HybridizedShallowWaterSolver(state)

else:
    parameters = {'ksp_type': 'gmres',
                  'pc_type': 'fieldsplit',
                  'pc_fieldsplit_type': 'schur',
                  'ksp_type': 'gmres',
                  'ksp_max_it': 100,
                  'ksp_gmres_restart': 50,
                  'pc_fieldsplit_schur_fact_type': 'FULL',
                  'pc_fieldsplit_schur_precondition': 'selfp',
                  'fieldsplit_0': {'ksp_type': 'preonly',
                                   'pc_type': 'bjacobi',
                                   'sub_pc_type': 'ilu'},
                  'fieldsplit_1': {'ksp_type': 'cg',
                                   'pc_type': 'gamg',
                                   'ksp_rtol': 1e-8,
                                   'mg_levels': {'ksp_type': 'chebyshev',
                                                 'ksp_max_it': 2,
                                                 'pc_type': 'bjacobi',
                                                 'sub_pc_type': 'ilu'}}}

    # Shallow water solver from Gusto, but with hybridization turned off
    linear_solver = ShallowWaterSolver(state, solver_parameters=parameters,
                                       overwrite_solver_parameters=True)

# Set up forcing
sw_forcing = ShallowWaterForcing(state)

# Build time stepper
stepper = CrankNicolson(state, advected_fields, linear_solver,
                        sw_forcing)

PETSc.Sys.Print("Starting simulation...\n")
stepper.run(t=0, tmax=tmax)


text:
3Sum
====
https://oj.leetcode.com/problems/3sum/

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.

Note:
Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c)
The solution set must not contain duplicate triplets.
    For example, given array S = {-1 0 1 2 -1 -4},

    A solution set is:
    (-1, 0, 1)
    (-1, -1, 2)


text:
// NOTE: On Windows the only screensaver notification is SC_SCREENSAVE that works only for top-level active window so we use timer...

#include <cppdevtk/gui/config.hpp>
#if (CPPDEVTK_DISABLE_CPPDEVTK_WARNINGS && CPPDEVTK_COMPILER_MSVC)
#	pragma warning(disable: 4459)	// C4459: declaration of 'item' hides global declaration
#endif

#include <cppdevtk/gui/screensaver.hpp>
#if (!CPPDEVTK_PLATFORM_WINDOWS)
#	error "This file is Windows specific!!!"
#endif

#include <cppdevtk/base/system_exception.hpp>
#include <cppdevtk/base/verify.h>
#include <cppdevtk/base/cassert.hpp>
#include <cppdevtk/base/logger.hpp>
#include <cppdevtk/base/tchar.hpp>
#include <cppdevtk/base/tstring_conv.hpp>
#include <cppdevtk/base/on_block_exit.hpp>
#include <cppdevtk/base/dbc.hpp>
#include <cppdevtk/base/unused.hpp>

#include <QtCore/QSysInfo>
#include <QtCore/QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtWidgets/QApplication>
#else
#include <QtGui/QApplication>
#endif

#include <cstddef>

static BOOL CALLBACK StopScreenSaverWndProc(HWND hwnd, LPARAM lParam);

using ::cppdevtk::base::SuppressUnusedWarning;

namespace cppdevtk {
namespace gui {

using base::ErrorCode;
using base::GetLastSystemErrorCode;
using base::MakeSystemErrorCode;
using base::Exception;
using ::std::exception;

void ScreenSaver::Uninit() {
	timer_.stop();
}

bool ScreenSaver::Lock() {
	restore_ = GetScreenSaveSecure(isScreenSaverSecure_);
	bool commit = false;
	CPPDEVTK_ON_BLOCK_EXIT_BEGIN((&commit)(&restore_)) {
		if (!commit) {
			restore_ = false;
		}
	}
	CPPDEVTK_ON_BLOCK_EXIT_END

	if (!SetScreenSaveSecure(TRUE)) {
		CPPDEVTK_LOG_ERROR("SetScreenSaveSecure() failed");
		return false;
	}

	if (!SetActive(true)) {
		CPPDEVTK_LOG_ERROR("failed to activate screensaver");
		return false;
	}

	commit = true;
	return true;
}

bool ScreenSaver::SetActive(bool active) {
	if (active) {
#		if 0
		const LRESULT kLResult = SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
		if (kLResult == 0) {
			CPPDEVTK_LOG_ERROR("failed to SendMessage() WM_SYSCOMMAND + SC_SCREENSAVE to HWND_BROADCAST"
					<< "; errorCode: " << GetLastSystemErrorCode().ToString());
			return false;
		}
#		else
		// GetDesktopWindow() is not documented to fail
		const LRESULT kLResult = SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
		if (kLResult != 0) {
			CPPDEVTK_LOG_ERROR("failed to SendMessage() WM_SYSCOMMAND + SC_SCREENSAVE to DesktopWindow; kLResult: " << kLResult
					<< "; errorCode: " << GetLastSystemErrorCode().ToString());
			return false;
		}
#		endif
	}
	else {
		// Please see:
		// - How to force a screen saver to close once started:
		// https://support.microsoft.com/en-us/help/140723/how-to-force-a-screen-saver-to-close-once-started-in-windows-nt-window
		// - How do I start, detect and stop screen savers?: http://bobmoore.mvps.org/win32/w32tip22.htm

		HDESK hScreenSaverDesktop = OpenDesktop(CPPDEVTK_T("Screen-saver"), 0, FALSE,
				(DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS));
		if (hScreenSaverDesktop != NULL) {
			CPPDEVTK_LOG_DEBUG("the screensaver runs on its own desktop");

			CPPDEVTK_ON_BLOCK_EXIT_BEGIN((&hScreenSaverDesktop)) {
				if (!CloseDesktop(hScreenSaverDesktop)) {
					CPPDEVTK_LOG_WARN("Failed to CloseDesktop; errorCode: " << GetLastSystemErrorCode().ToString());
				}
			}
			CPPDEVTK_ON_BLOCK_EXIT_END

			if (!EnumDesktopWindows(hScreenSaverDesktop, StopScreenSaverWndProc, 0)) {
				CPPDEVTK_LOG_ERROR("failed to EnumDesktopWindows() for hScreenSaverDesktop; errorCode: "
						<< GetLastSystemErrorCode().ToString());
				return false;
			}
		}
		else {
			try {
				if (!IsActive()) {
					CPPDEVTK_LOG_DEBUG("screensaver already not active");
					return true;
				}
			}
			catch (const ::std::runtime_error& exc) {
				CPPDEVTK_LOG_ERROR("IsActive() failed; exc: " << Exception::GetDetailedInfo(exc));
				SuppressUnusedWarning(exc);
				return false;
			}

			CPPDEVTK_LOG_DEBUG("the screensaver runs on the default desktop");

			HWND hForegroundWindow = GetForegroundWindow();
			if (hForegroundWindow != NULL) {
				const LRESULT kLResult = SendMessage(hForegroundWindow, WM_CLOSE, 0, 0);
				if (kLResult != 0) {
					CPPDEVTK_LOG_ERROR("failed to SendMessage() WM_CLOSE to ForegroundWindow; kLResult: " << kLResult
							<< "; errorCode: " << GetLastSystemErrorCode().ToString());
					return false;
				}
			}
			else {
				CPPDEVTK_LOG_DEBUG("screensaver window lost activation (screensaver already deactivated)");
			}
		}
	}

	Refresh();

	return true;
}

bool ScreenSaver::IsActive() const {
	BOOL isScreenSaverRunning = FALSE;
	if (!SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &isScreenSaverRunning, 0)) {
		throw CPPDEVTK_SYSTEM_EXCEPTION_W_EC_WA(GetLastSystemErrorCode(),
				"SystemParametersInfo() failed for SPI_GETSCREENSAVERRUNNING");
	}
	return isScreenSaverRunning;
}

void ScreenSaver::Refresh() {
	bool wasActive = isActive_;

	try {
		isActive_ = IsActive();
	}
	catch (const ::std::runtime_error& exc) {
		CPPDEVTK_LOG_ERROR("IsActive() failed; exc: " << Exception::GetDetailedInfo(exc));
		SuppressUnusedWarning(exc);
		return;
	}

	if (isActive_ != wasActive) {
		if (!isActive_) {
			if (restore_) {
				if (!SetScreenSaveSecure(isScreenSaverSecure_)) {
					CPPDEVTK_LOG_WARN("failed to restore isScreenSaverSecure_");
				}
				restore_ = false;
			}
		}

		Q_EMIT ActiveChanged(isActive_);
	}
}

ScreenSaver::ScreenSaver(): QObject(), ::cppdevtk::base::MeyersSingleton<ScreenSaver>(), timer_(), isActive_(IsActive()),
		restore_(false), isScreenSaverSecure_(FALSE) {
	CPPDEVTK_DBC_CHECK_PRECONDITION_W_MSG((qApp != NULL), "qApp is NULL; please create app first");

	timer_.setInterval(1000);
	timer_.setSingleShot(false);
	CPPDEVTK_VERIFY(connect(&timer_, SIGNAL(timeout()), SLOT(Refresh())));
	CPPDEVTK_VERIFY(connect(qApp, SIGNAL(aboutToQuit()), SLOT(Uninit())));
	timer_.start();
}

ScreenSaver::~ScreenSaver() {
	CPPDEVTK_ASSERT(!timer_.isActive() && "Call Uninit() before leaving main()");
}

bool ScreenSaver::SetScreenSaveSecure(BOOL value) {
#	ifndef SPI_SETSCREENSAVESECURE
#	define SPI_SETSCREENSAVESECURE 0x0077
#	endif

	CPPDEVTK_ASSERT((value == TRUE) || (value == FALSE));

	if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
		if (!SystemParametersInfo(SPI_SETSCREENSAVESECURE, value, NULL, (SPIF_UPDATEINIFILE | SPIF_SENDCHANGE))) {
			CPPDEVTK_LOG_ERROR("SystemParametersInfo() failed for SPI_SETSCREENSAVESECURE; errorCode: "
					<< GetLastSystemErrorCode().ToString());
			return false;
		}
	}
	else {
		HKEY hKey = NULL;
		LONG retCode = RegOpenKeyEx(HKEY_CURRENT_USER, CPPDEVTK_T("Control Panel\\Desktop"), 0, KEY_WRITE, &hKey);
		if (retCode != ERROR_SUCCESS) {
			CPPDEVTK_LOG_ERROR("Failed to open Desktop registry key for writing; errorCode: "
					<< MakeSystemErrorCode(retCode).ToString());
			return false;
		}
		CPPDEVTK_ON_BLOCK_EXIT_BEGIN((&hKey)) {
			LONG retCode = RegCloseKey(hKey);
			if (retCode != ERROR_SUCCESS) {
				CPPDEVTK_LOG_WARN("Failed to close Desktop registry key; errorCode: "
						<< MakeSystemErrorCode(retCode).ToString());
			}
		}
		CPPDEVTK_ON_BLOCK_EXIT_END

		const base::tstring kNumber = CPPDEVTK_Q2T(QString::number(value));
		CPPDEVTK_ASSERT(kNumber.length() == 1);
		retCode = RegSetValueEx(hKey, CPPDEVTK_T("ScreenSaverIsSecure"), 0, REG_SZ,
				(BYTE*)kNumber.c_str(), (DWORD)((kNumber.length() + 1) * sizeof(tchar)));
		if (retCode != ERROR_SUCCESS) {
			CPPDEVTK_LOG_ERROR("Failed to write ScreenSaverIsSecure registry value; errorCode: "
					<< MakeSystemErrorCode(retCode).ToString());
			return false;
		}
	}

	return true;
}

bool ScreenSaver::GetScreenSaveSecure(BOOL& isScreenSaverSecure) {
#	ifndef SPI_GETSCREENSAVESECURE
#	define SPI_GETSCREENSAVESECURE 0x0076
#	endif

	if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
		if (!SystemParametersInfo(SPI_GETSCREENSAVESECURE, 0, &isScreenSaverSecure, 0)) {
			CPPDEVTK_LOG_ERROR("SystemParametersInfo() failed for SPI_GETSCREENSAVESECURE; errorCode: "
					<< GetLastSystemErrorCode().ToString());
			return false;
		}
	}
	else {
		HKEY hKey = NULL;
		LONG retCode = RegOpenKeyEx(HKEY_CURRENT_USER, CPPDEVTK_T("Control Panel\\Desktop"), 0, KEY_READ, &hKey);
		if (retCode != ERROR_SUCCESS) {
			CPPDEVTK_LOG_ERROR("Failed to open Desktop registry key for reading; errorCode: "
					<< MakeSystemErrorCode(retCode).ToString());
			return false;
		}
		CPPDEVTK_ON_BLOCK_EXIT_BEGIN((&hKey)) {
			LONG retCode = RegCloseKey(hKey);
			if (retCode != ERROR_SUCCESS) {
				CPPDEVTK_LOG_WARN("Failed to close Desktop registry key; errorCode: "
						<< MakeSystemErrorCode(retCode).ToString());
			}
		}
		CPPDEVTK_ON_BLOCK_EXIT_END

		DWORD valueType = 0;
		BYTE buf[((1 + 1) + 1) * sizeof(tchar)] = {0};
		DWORD cbData = sizeof(buf) - sizeof(tchar);
		retCode = RegQueryValueEx(hKey, CPPDEVTK_T("ScreenSaverIsSecure"), NULL, &valueType, buf, &cbData);
		if (retCode != ERROR_SUCCESS) {
			CPPDEVTK_LOG_ERROR("Failed to read ScreenSaverIsSecure registry value; errorCode: "
					<< MakeSystemErrorCode(retCode).ToString());
			return false;
		}
		if (valueType != REG_SZ) {
			CPPDEVTK_LOG_ERROR("ScreenSaverIsSecure registry value does not have expected type");
			return false;
		}

		const QString kScreenSaverIsSecure = CPPDEVTK_T2Q((tchar*)buf);
		bool convOk = false;
		isScreenSaverSecure = kScreenSaverIsSecure.toInt(&convOk);
		if (!convOk) {
			CPPDEVTK_LOG_ERROR("Failed to convert ScreenSaverIsSecure registry value '" << kScreenSaverIsSecure << "' to BOOL");
			return false;
		}
	}

	CPPDEVTK_ASSERT((isScreenSaverSecure == TRUE) || (isScreenSaverSecure == FALSE));
	return true;
}

}	// namespace gui
}	// namespace cppdevtk

BOOL CALLBACK StopScreenSaverWndProc(HWND hwnd, LPARAM lParam) {
	SuppressUnusedWarning(lParam);

	if (IsWindowVisible(hwnd)) {
		const LRESULT kLResult = SendMessage(hwnd, WM_CLOSE, 0, 0);
		if (kLResult != 0) {
			CPPDEVTK_LOG_ERROR("failed to SendMessage() WM_CLOSE to hwnd: " << hwnd << "; kLResult: " << kLResult
					<< "; errorCode: " << ::cppdevtk::base::GetLastSystemErrorCode().ToString());
			return FALSE;
		}
	}
	return TRUE;
}


text:
package org.jetbrains.idea.devkit.inspections;

import com.intellij.testFramework.TestDataPath;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.DevkitJavaTestsUtil;

@TestDataPath("$CONTENT_ROOT/testData/inspections/useGray")
public class UseGrayInspectionTest extends UseGrayInspectionTestBase {

  @Override
  protected String getBasePath() {
    return DevkitJavaTestsUtil.TESTDATA_PATH + "inspections/useGray";
  }

  @Override
  protected @NotNull String getFileExtension() {
    return "java";
  }

  public void testUseGrayConstantWhenAwtColorUsed() {
    doTest();
  }
}


text:
require 'wrappers/timing'

#
# == HeaderYearPicker
#
# Pattern to pick handled header yers
# Header years are intended to manage groups of seasons referred to the
# same period. EG For the same year there are more than one seasons owned by different federations
#
# @author   Leega
#
class HeaderYearPicker

  # These must be initialized on creation:
  attr_reader :season_list

  # These can be edited later on:
  #attr_accessor :season

  # Initialization
  #
  # == Params:
  # An instance of season
  #
  def initialize()
    @season_list = []
  end
  #-- --------------------------------------------------------------------------
  #++

  # Pick handled header years
  #
  def find(starting_from = 2000, ending_at = Date.today.month <= 9 ? Date.today.year - 1 : Date.today.year)
    @season_list = manually(starting_from, ending_at)
  end

  # Pick handled header years
  #
  def manually(starting_from = 2000, ending_at = Date.today.month <= 9 ? Date.today.year - 1 : Date.today.year)
    # TODO Find out managed seasons
    #@season_list << '2016-2017' if starting_from <= '2016-2017'
    #@season_list << '2017-2018'
    #@season_list << '2018-2019'
    #@season_list << '2019-2020' if Date.today() >= Date.parse('20191001')
    #@season_list << '2020-2021' if Date.today() >= Date.parse('20201001')
    season_list = []
    (starting_from..ending_at).to_a.each do |year|
      header_year = year.to_s + '/' + (year + 1).to_s
      season_list << header_year
    end
    # In reverse order
    season_list.reverse
  end

  # Pick handled header years reading from DB
  #
  def from_db(starting_from = 2000, ending_at = Date.today.month <= 9 ? Date.today.year - 1 : Date.today.year)
    season_list = []
    season_list
  end
  #-- --------------------------------------------------------------------------
  #++
end


text:
define(['lodash', './expression'], function (_, Expression) {

    /**
     * Constructor for ArrayInitExpression
     * @param {Object} args - Arguments to create the ArrayInitExpression
     * @constructor
     */
    var ArrayInitExpression = function (args) {
        Expression.call(this, 'ArrayInitExpression');
    };

    ArrayInitExpression.prototype = Object.create(Expression.prototype);
    ArrayInitExpression.prototype.constructor = ArrayInitExpression;

    /**
     * initialize ArrayInitExpression from json object
     * @param {Object} jsonNode to initialize from
     */
    ArrayInitExpression.prototype.initFromJson = function (jsonNode) {
        var self = this;
        var generatedExpression = '[';
        _.each(jsonNode.children, function (childNode) {
            var child = self.getFactory().createFromJson(childNode);
            self.addChild(child);
            child.initFromJson(childNode);
            generatedExpression += child.getExpression() + ",";
        });
        this.setExpression(generatedExpression.replace(/,\s*$/, "") + ']', {doSilently: true});
    };

    ArrayInitExpression.prototype.generateExpression = function () {
        this._expression = this.getVariableReferenceName()
    };

    return ArrayInitExpression;
});


text:
<resources>
    <string name="app_name">Khelkund</string>

    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="title_activity_home">Home</string>

    <string name="title_home">Home</string>

    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>

    <string name="action_example">Leaderboard</string>

    <string name="title_activity_login">Sign in</string>

    <!-- Strings related to login -->
    <string name="prompt_email">Email</string>
    <string name="prompt_password">Password</string>
    <string name="action_sign_in">Sign in</string>
    <string name="action_sign_in_short">Sign in</string>

    <string name="error_invalid_email">This email address is invalid</string>
    <string name="error_invalid_password">This password is too short</string>
    <string name="error_incorrect_password">This password is incorrect. Have you verified your email address?</string>
    <string name="error_field_required">This field is required</string>
    <string name="title_activity_register">Register</string>

    <string name="facebook_app_id">794318567264645</string>
    <string name="TWITTER_KEY">N1J0SKJLkMAoQe2kERO9LaX6j</string>
    <string name="TWITTER_SECRET">ehmqbKoGROgCV2Ynk8jL9TsC7laL5xPvjMWXti9xZBSdO7zgqP</string>
    <string name="SHORT_APP_URL">http://goo.gl/cNyTpp</string>

    <string name="title_activity_view_team">My Team</string>

    <string name="title_activity_edit_team">Modify Your Team</string>
    <string name="title_activity_create_team">Create your team</string>
    <string name="title_activity_player_details">Player Details</string>

<!-- TODO: Remove or change this placeholder text -->

    <string name="title_activity_player_pool">Select Player</string>
    <string name="title_activity_pick5_match">Pick\'em 5</string>
    <string name="title_activity_leaderboard">Leaderboard</string>
    <string name="title_activity_feedback">Submit Feedback</string>
    <string name="title_activity_how_to_play">"How To Play"</string>
    <string name="title_activity_licences">Licences</string>
    <string name="title_activity_about_us">About Us</string>
    <string name="title_activity_schedule">Schedule</string>
    <string name="title_activity_scoring_chart">Scoring Chart</string>
    <string name="title_activity_terms_and_policy">Terms And Policy</string>
    <string name="title_activity_prizes">Prizes</string>
    <string name="title_activity_create_private_league">Create a new Private League</string>
    <string name="title_activity_private_league_home">Your Private Leagues</string>
    <string name="title_activity_how_to_play_activity2">How To Play</string>
    <string name="title_activity_private_league_leaderboard">Private League Leaderboard</string>
    <string name="title_activity_twitter_feed">Twitter Feed</string>
    <string name="title_activity_tutorial">Khelkund</string>

    <string name="title_activity_pick5_list">Pick\'em 5 Challenges</string>

<!-- TODO: Remove or change this placeholder text -->
    <string name="hello_blank_fragment">Hello blank fragment</string>
    <string name="title_activity_promotions">Promotions</string>
    <string name="title_activity_share_referral_code">Share Referral Code</string>
</resources>


text:
<?php
  include_once 'includes/dbConnect.php';
  include_once 'includes/functions.php';

  session_start();

  // Set permission restrictions here
?>

<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Gentallela Alela! | </title>

    <?php include("includes/genericCSS.php"); ?>

    <link href="vendors/google-code-prettify/bin/prettify.min.css" rel="stylesheet">

       <?php include("includes/navPanel.php"); ?>

Inbox Design Some examples to get you started

                    <input type="text" class="form-control" placeholder="Search for...">

                      <button class="btn btn-default" type="button">Go!</button>

Inbox DesignUser Mail

Settings 1

Settings 2

                        <button id="compose" class="btn btn-sm btn-success btn-block" type="button">COMPOSE</button>

Dennis Mugo 3.00 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

Jane Nobert 4.09 PM

To Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

Musimbi Anne 4.09 PM

CC Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

Jon Dibbs 4.09 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

                              .

Debbis & Raymond 4.09 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

                              .

Debbis & Raymond 4.09 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

Dennis Mugo 3.00 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

Jane Nobert 4.09 PM

Ut enim ad minim veniam, quis nostrud exercitation enim ad minim veniam, quis nostrud exercitation...

                                <button class="btn btn-sm btn-primary" type="button"> Reply</button>
                                <button class="btn btn-sm btn-default" type="button"  data-placement="top" data-toggle="tooltip" data-original-title="Forward"></button>
                                <button class="btn btn-sm btn-default" type="button" data-placement="top" data-toggle="tooltip" data-original-title="Print"></button>
                                <button class="btn btn-sm btn-default" type="button" data-placement="top" data-toggle="tooltip" data-original-title="Trash"></button>

 8:02 PM 12 FEB 2014

 Donec vitae leo at sem lobortis porttitor eu consequat risus. Mauris sed congue orci. Donec ultrices faucibus rutrum.

                                Jon Doe
                                (jon.doe@gmail.com) to
                                me

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                              Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Riusmod tempor incididunt ut labor erem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
                              nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
                              mollit anim id est laborum.

Modesed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
                              velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

                               3 attachments —
                              Download all attachments |
                              View all images

                                  image-name.jpg

                                12KB

                                  View -
                                  Download

                                  img_name.jpg

                                40KB

                                  View -
                                  Download

                                  img_name.jpg

                                30KB

                                  View -
                                  Download

                            <button class="btn btn-sm btn-primary" type="button"> Reply</button>
                            <button class="btn btn-sm btn-default" type="button"  data-placement="top" data-toggle="tooltip" data-original-title="Forward"></button>
                            <button class="btn btn-sm btn-default" type="button" data-placement="top" data-toggle="tooltip" data-original-title="Print"></button>
                            <button class="btn btn-sm btn-default" type="button" data-placement="top" data-toggle="tooltip" data-original-title="Trash"></button>

        <?php include("includes/footer.php"); ?>

        New Message
        <button type="button" class="close compose-close">
          ×
        </button>

Huge

Normal

Small

              <input class="span2" placeholder="URL" type="text" data-edit="createLink" />
              <button class="btn" type="button">Add</button>

            <input type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" />

        <button id="send" class="btn btn-sm btn-success" type="button">Send</button>

    <?php include("includes/genericJS.php"); ?>

    >


text:
require 'test_helper'

class RemoteMercuryTest < Test::Unit::TestCase
  def setup
    Base.gateway_mode = :test

    @gateway = MercuryGateway.new(fixtures(:mercury))

    @amount = 100

    @mc_track2 = "5499990123456781=13051015432198712345"
    @disc_track2 = "6011000997235373=11085025432198712345"
    @visa_track2 = "4003000123456781=13055025432198712345"
    @amex_track2 = "373953244361001=11085025432198712345"

    @mc = CreditCard.new(
      :brand => "master",
      :number => "5499990123456781",
      :verification_value => "123",
      :month => 8,
      :year => 2013,
      :first_name => 'Fred',
      :last_name => 'Brooks')
    @discover = CreditCard.new(
        :brand => "discover",
        :number => "6011000997235373",
        :verification_value => "123",
        :month => 8,
        :year => 2013,
        :first_name => 'Fred',
        :last_name => 'Brooks')
    @amex = CreditCard.new(
      :brand => "american_express",
      :number => "373953244361001",
      :verification_value => "123",
      :month => 8,
      :year => 2013,
      :first_name => 'Fred',
      :last_name => 'Brooks')
    @visa = CreditCard.new(
      :brand => "visa",
      :number => "4003000123456781",
      :verification_value => "123",
      :month => 8,
      :year => 2013,
      :first_name => 'Fred',
      :last_name => 'Brooks')

    @declined_card = credit_card('4000300011112220')

    @invoice = 100

    @options_with_billing = {
      :merchant => '999',
      :description => "Open Dining Mercury Integration v1.0",
      :billing_address => {
        :address1 => '4 Corporate Square',
        :zip => '30329'
      }
    }
    @options = {
      :merchant => 'test',
      :description => "Open Dining Mercury Integration v1.0"
    }
    @full_options = {
      :order_id => '1',
      :ip => '123.123.123.123',
      :merchant => "Open Dining",
      :description => "Open Dining Integration",
      :customer => "Tim",
      :tax => "5",
      :billing_address => {
        :address1 => '4 Corporate Square',
        :zip => '30329'
      }
    }

    @visa_partial_card = CreditCard.new(:number => "4005550000000480", :month => 12, :year => 2015)
    @visa_partial_track2 = "4005550000000480=15125025432198712345"

    @disc_partial_card = CreditCard.new(:number => "6011900212345677", :month => 12, :year => 2015)
    @disc_partial_track2 = "6011900212345677=15125025432198712345"
  end

  def test_visa_pre_auth_and_capture_swipe
    invoice = 500
    assert visa_response = @gateway.authorize(100, @visa_track2,
      @options.merge(:order_id => invoice, :invoice => invoice))
    assert_success visa_response
    assert_equal '1.00', visa_response.params['authorize']

    assert visa_capture = @gateway.capture(100, visa_response.authorization,
      CreditCard.new(:number => visa_response.params["acct_no"],
        :month => visa_response.params["exp_date"][0..1],
        :year => visa_response.params["exp_date"][-2..-1]),
      @options.merge(:order_id => visa_response.params["ref_no"], :invoice => invoice,
      :acq_ref_data => visa_response.params['acq_ref_data']))
    assert_success visa_capture
    assert_equal '1.00', visa_capture.params['authorize']
  end

  def test_mastercard_pre_auth_and_capture_with_void_sale_swipe
    invoice = 501
    assert mc_response = @gateway.authorize(200, @mc_track2,
      @options.merge(:order_id => invoice, :invoice => invoice))
    assert_success mc_response
    assert_equal '2.00', mc_response.params['authorize']

    assert mc_capture = @gateway.capture(200, mc_response.authorization,
      CreditCard.new(:number => mc_response.params["acct_no"],
        :month => mc_response.params["exp_date"][0..1],
        :year => mc_response.params["exp_date"][-2..-1]),
      @options.merge(:order_id => mc_response.params['ref_no'], :invoice => invoice,
        :acq_ref_data => mc_response.params['acq_ref_data']))
    assert_success mc_capture
    assert_equal '2.00', mc_capture.params['authorize']

    assert void_response = @gateway.void(200, mc_capture.authorization,
      CreditCard.new(:number => mc_capture.params["acct_no"],
        :month => mc_capture.params["exp_date"][0..1],
        :year => mc_capture.params["exp_date"][-2..-1]),
      @options.merge(:order_id => mc_capture.params['ref_no'], :invoice => mc_capture.params['invoice_no']))

    assert_success void_response
    assert_equal '2.00', void_response.params['purchase']
    assert_equal 'VoidSale', void_response.params['tran_code']
  end

  def test_visa_pre_auth_and_capture_manual
    invoice = 502
    assert response = @gateway.authorize(300, @visa, @options.merge(:order_id => invoice, :invoice => invoice))
    assert_success response
    assert_equal '3.00', response.params['authorize']

    assert capture = @gateway.capture(300, response.authorization, @visa,
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture
    assert_equal '3.00', capture.params['authorize']
  end

  def test_mastercard_pre_auth_and_capture_manual
    invoice = 503
    assert mc_response = @gateway.authorize(400, @mc, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))
    assert_success mc_response
    assert_equal '4.00', mc_response.params['authorize']

    assert mc_capture = @gateway.capture(400, mc_response.authorization, @mc,
      @options.merge(:order_id => mc_response.params['ref_no'], :invoice => mc_response.params['invoice_no'],
      :acq_ref_data => mc_response.params['acq_ref_data'], :tip => 150))
    assert_success mc_capture
    assert_equal '5.50', mc_capture.params['authorize']
  end

  def test_visa_voice_auth_manual
    invoice = 504
    assert response = @gateway.voice_authorize(650, "123456", @visa, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))

    assert_success response
    assert_equal 'Success', response.message
  end

  def test_amex_pre_auth_and_disconnect_manual
    invoice = 505
    assert response = @gateway.authorize(125, @amex, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))
    assert_success response
    assert_equal '1.25', response.params['authorize']

    # this is a disconnect test, so we save the response for the next test
    assert capture = @gateway.capture(125, response.authorization, @amex,
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture
    assert_equal '1.25', capture.params['authorize']

    assert capture2 = @gateway.capture(125, response.authorization, @amex,
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture2
    assert_equal '1.25', capture2.params['authorize']

    assert capture3 = @gateway.capture(125, response.authorization, @amex,
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture3
    assert_equal '1.25', capture3.params['authorize']
  end

  def test_discover_pre_auth_and_capture_and_adjust_manual
    invoice = 506
    assert response = @gateway.authorize(225, @discover, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))
    assert_success response
    assert_equal '2.25', response.params['authorize']

    assert capture = @gateway.capture(225, response.authorization, @discover,
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture
    assert_equal '2.25', capture.params['authorize']

    assert adjustment = @gateway.adjust(225, response.authorization, @discover,
      @options.merge(:order_id => capture.params['ref_no'], :invoice => capture.params['invoice_no'],
      :acq_ref_data => capture.params['acq_ref_data'], :tip => 175))
    assert_success adjustment
    assert_equal '4.00', adjustment.params['authorize']
  end

  def test_visa_return_void_return_swipe
    invoice = 507
    assert response = @gateway.credit(375, @visa_track2, @options.merge(:order_id => invoice, :invoice => invoice))
    assert_success response
    assert_equal '3.75', response.params['purchase']

    assert void_response = @gateway.void(375, response.authorization,
      CreditCard.new(:number => response.params["acct_no"],
        :month => response.params["exp_date"][0..1],
        :year => response.params["exp_date"][-2..-1]),
      @options.merge(:order_id => response.params['ref_no'], :invoice => response.params['invoice_no'],
        :void => 'VoidReturn'))

    assert_success void_response
    assert_equal '3.75', void_response.params['purchase']
    assert_equal 'VoidReturn', void_response.params['tran_code']
  end

  def test_mastercard_return_manual
    invoice = 508
    assert response = @gateway.credit(425, @mc, @options.merge(:order_id => invoice, :invoice => invoice))
    assert_success response
    assert_equal '4.25', response.params['purchase']
  end

  def test_visa_pre_auth_failure_swipe
    invoice = 509
    assert response = @gateway.authorize(1100, @visa_track2, @options.merge(:order_id => invoice, :invoice => invoice))
    assert_failure response
    assert_equal "DECLINE", response.message
  end

  def test_mastercard_pre_auth_date_failure_manual
    invoice = 510
    @mc.month = 13
    @mc.year = 2001
    assert response = @gateway.authorize(575, @mc, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))
    assert_failure response
    assert_equal "INVLD EXP DATE", response.message
  end

  def test_visa_sale_swipe
    invoice = 511
    assert response = @gateway.purchase(50, @visa_track2, @options.merge(:order_id => invoice, :invoice => invoice))

    assert_success response
    assert_equal "0.50", response.params["purchase"]
  end

  def test_mastercard_sale_manual
    invoice = 512
    assert response = @gateway.purchase(75, @mc_track2, @options.merge(:order_id => invoice, :invoice => invoice))

    assert_success response
    assert_equal "0.75", response.params["purchase"]
  end

  def test_visa_preauth_avs_cvv_manual
    invoice = 513
    assert response = @gateway.authorize(333, @visa, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))

    assert_success response
    assert_equal response.avs_result, {"code" => "Y", "postal_match" => "Y", "street_match" => "Y",
      "message" => "Street address and 5-digit postal code match."}
  end

  def test_mastercard_bad_preauth_avs_cvv_manual
    invoice = 513
    @mc.month = 8
    @mc.year = 2013
    @mc.verification_value = 321
    @options_with_billing[:billing_address] = {:address => "wrong address", :zip => "12345"}

    assert response = @gateway.authorize(444, @mc, @options_with_billing.merge(:order_id => invoice, :invoice => invoice))

    assert_success response
    assert_equal response.avs_result, {"code" => "N", "postal_match" => "N", "street_match" => "N",
      "message" => "Street address and postal code do not match."}

  end

  def test_batch_summary_and_close
    assert response = @gateway.batch_summary

    assert_success response
    pars = response.params
    assert close = @gateway.batch_close(:batch_no => pars["batch_no"],
      :batch_item_count =>pars["batch_item_count"],
      :net_batch_total => pars["net_batch_total"],
      :credit_purchase_count => pars["credit_purchase_count"],
      :credit_purchase_amount => pars["credit_purchase_amount"],
      :credit_return_count => pars["credit_return_count"],
      :credit_return_amount => pars["credit_return_amount"],
      :debit_purchase_count => pars["debit_purchase_count"],
      :debit_purchase_amount => pars["debit_purchase_amount"],
      :debit_return_count => pars["debit_return_count"],
      :debit_return_amount => pars["debit_return_amount"])

    assert_equal "OK TEST", close.params["text_response"]
  end

  def test_preauth_partial_auth_visa
    @invoice = 156
    assert response = @gateway.authorize(2354, @visa_partial_track2, @options.merge(:invoice => @invoice, :order_id => @invoice))

    assert_success response

    assert capture = @gateway.capture(2000,
      response.authorization,
      CreditCard.new(:number => response.params["acct_no"],
        :month => response.params["exp_date"][0..1],
        :year => response.params["exp_date"][-2..-1]),
      @options.merge(:order_id => response.params["ref_no"], :invoice => @invoice,
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture

    assert reverse = @gateway.void(2000,
      response.authorization,
      @visa_partial_card,
      @options.merge(:order_id => capture.params["ref_no"], :invoice => @invoice,
      :acq_ref_data => capture.params['acq_ref_data'], :process_data => capture.params["process_data"]))
    assert_success reverse
  end

  def test_preauth_partial_discover
    @invoice = 157
    assert response = @gateway.authorize(2307, @disc_partial_track2, @options.merge(:invoice => @invoice, :order_id => @invoice))
    assert_success response

    assert capture = @gateway.capture(2000,
      response.authorization,
      CreditCard.new(:number => response.params["acct_no"],
        :month => response.params["exp_date"][0..1],
        :year => response.params["exp_date"][-2..-1]),
      @options.merge(:order_id => response.params["ref_no"], :invoice => @invoice,
      :acq_ref_data => response.params['acq_ref_data']))
    assert_success capture

    assert reverse = @gateway.void(2000,
      response.authorization,
      @disc_partial_card,
      @options.merge(:order_id => capture.params["ref_no"], :invoice => @invoice,
      :acq_ref_data => capture.params['acq_ref_data'], :process_data => capture.params["process_data"]))
    assert_success reverse
  end
end


text:
Report Exporting Service
===============================

[![Build Status](https://travis-ci.org/mdalp/reportexport.svg?branch=master)](https://travis-ci.org/mdalp/reportexport)

version number: 0.0.3
author: Marcello Dalponte

Overview
--------

A Flask microservice that produces reports out of a database in xml and pdf format.

Installation / Usage
--------------------

To install use pip:

    $ pip install reportexport

Or clone the repo:

    $ git clone https://github.com/mdalp/reportexport.git
    $ python setup.py install

To run:

    $ REPORTEXPORT_DATABASE=postgresql://myuser:passwd@localhost/mydb make run

Contributing
------------

This is a sketch project as such it is open to a number of improvements, among which:

 1. Dinamically calculate the left indent space in the pdf report
 2. Add the currency to the prices in the report
 3. Improve the comparison between pdfs in the test utils to detect format changes

 To install requirements for dev:

    $ make devinstall

To run tests:

    $ make tests


text:
package be.cegeka.batchers.taxcalculator.application.config;

import be.cegeka.batchers.taxcalculator.application.ApplicationInitializer;
import org.springframework.context.annotation.Bean;

public class EmployeeGeneratorTestConfig extends EmployeeGeneratorConfig {

    @Bean
    @Override
    public ApplicationInitializer applicationInitializer() {
        ApplicationInitializer applicationInitializer = super.applicationInitializer();
        applicationInitializer.setGenerateEmployees(false);

        return applicationInitializer;
    }

    @Bean
    public String smtp_username() {
        return "username";
    }

    @Bean
    public String smtp_password() {
        return "password";
    }

    @Bean
    public String smtp_port() {
        return "2500";
    }

    @Bean
    public String smtp_server() {
        return "localhost";
    }
}


text:
package com.seanbright.osgi.launcher;

public class FrameworkNotFoundException extends Exception
{
	public FrameworkNotFoundException(String message)
	{
		super(message);
	}
}


text:
from nose.tools import eq_

from ..comment import Comment

def test_immutability():
    c = Comment("foo")
    b = Comment(c)
    eq_(id(c), id(b))

def test_empty_constructor():
    c = Comment()
    eq_(c, "")
    eq_(c.deleted, False)

def test_deleted_constructor():
    c = Comment("", deleted=True)
    eq_(c, "")
    eq_(c.deleted, True)

def test_full_constructor():
    c = Comment("Foobar!", deleted=False)
    eq_(c, "Foobar!")
    eq_(c.deleted, False)

def test_serialize():
    c = Comment("Foobar!", deleted=False)
    c2 = Comment.deserialize(c.serialize())
    eq_(c2.deleted, False)


text:
package net.metanotion.util;

/*
public void func(final long var) {
	try {
		logger.debug("");
	}
}
breaks object parameter mapper.
need to work on this.
*/

public final class TestObject {
	public TestObject() { }
	public TestObject(int foo) { }
	public int aMethod(String foo, Integer bar, float baz) {
		int tricky = 5;
		return 0;
	}
	public Object anotherMethod(@javax.inject.Named("awef") int awef, int oops) {
		return null;
	}
}


text:
angular.module('utils').value('tokenGenerator',
    {
        generate: function generateToken(length) {
            var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            var result = '';
            for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
            return result;
        }
    }
);


text:
<?php

namespace Tbm\Peval\Operator;

use Tbm\Peval\Operator\AbstractOperator;
use Tbm\Peval\Types\Double;
use Tbm\Peval\Types\String;

/**
 * The multiplication operator.
 */
class MultiplicationOperator extends AbstractOperator
{
	/**
	 * Default constructor.
	 */
	function __construct()
    {
		parent::__construct(new String("*"), 6);
	}

    /**
     * Evaluates two double operands.
     *
     * @param \Tbm\Peval\Types\Double $leftOperand
     * @param \Tbm\Peval\Types\Double $rightOperand
     * @internal param $leftOperand The left operand being evaluated.
     *            The left operand being evaluated.
     * @internal param $rightOperand The right operand being evaluated.
     *            The right operand being evaluated.
     * @return String
     */
	public function evaluate2Doubles(Double $leftOperand, Double $rightOperand) {
		$rtnValue = new Double($leftOperand->getValue() * $rightOperand->getValue());

		return $rtnValue;
	}
}


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

/* Cookie
------------------ */

var Cookie = function (key, value, options) {
	if (!key) throw new Error ('Cookie requires a key');

	options = options || {};

	this.key = key;
	this.value = value;
	this.expires = options.expires;
	this.path = options.path;
	this.domain = options.domain;
	this.http_only = options.http_only;
}

Cookie.prototype.to_cookie_string = function () {
	var str;

	if (str = this.key) {
		str += '=' + this.value;

		if (this.expires && this.expires instanceof Date) str += '; expires=' + this.expires.toUTCString ();
		if (this.path) str += '; path=' + encodeURIComponent (this.path);
		if (this.domain) str += '; domain=' + this.domain;
		if (this.http_only) str += '; HttpOnly';
	}

	return str;
}

Cookie.prototype.valueOf = function () {
	return this.value;
}

Cookie.prototype.toString = function () {
	return this.value;
}

/* CookieHandler
------------------ */

var CookieHandler = function () {
	this._cookies = {};
}

CookieHandler.prototype.get_cookie = function (key) {
	return this._cookies[key];
};

CookieHandler.prototype.set_cookie = function (key, value, options) {
	this._cookies[key] = new Cookie (key, value, options);
};

CookieHandler.prototype.add_cookie = function (cookie) {
	if (!(cookie instanceof Cookie)) throw new Error ('CookieHandler.add_cookie() requires an object of type Cookie');
	this._cookies[cookie.key] = cookie;
};

CookieHandler.prototype.get_all_cookies = function () {
	return this._cookies;
};

/* exports
------------------ */

exports.Cookie = Cookie;

exports.load = function (request, response) {
	if (!(request instanceof http.IncomingMessage)) throw new Error ('First value passed to load() must be of type http.IncomingMessage');
	if (!(response instanceof http.ServerResponse)) throw new Error ('Second value passed to load() must be of type http.ServerResponse');

	var handler = new CookieHandler (),
		cookie_str;

	if (cookie_str = request.headers.cookie) {
		var pairs = cookie_str.split (/\s*;\s*/);

		for (var i in pairs) {
			var data = pairs[i].split ('=', 2);
			handler.set_cookie (data[0], data[1]);
		}
	}

	var orig_sendHeader = response.sendHeader;

	response.sendHeader = function (status, headers) {
		var new_headers = [];

		if (headers.constructor == Object) {
			for (var i in headers) new_headers.push ([i, headers[i]]);
		} else if (headers.constructor == Array) {
			new_headers = headers;
		}

		var cookies = handler.get_all_cookies ();
		for (var i in cookies) new_headers.push (['Set-Cookie', cookies[i].to_cookie_string ()]);

		orig_sendHeader.call (response, status, new_headers);
	};

	return handler;
};


text:
@interface CYSearchView : UIView

@property (nonatomic, copy) void (^cancleBlock)();

- (void)endEdit;

@end


text:
var helper = require('./lib/message-helper');
var Characteristic = require('./characteristic').Characteristic;

function Service(peripheral, uuid) {
    var self = this;
    var gattip = peripheral.gattip();
    var characteristics = {};

    helper.requireUUID('Service', 'uuid', uuid);
    this.uuid = uuid;
    this.type = 's';

    this.isPrimary = true; //TODO: read from remote
    // TODO: this.includedServices = {};

    this.peripheral = function () {
        return peripheral;
    };
    this.gattip = function () {
        return gattip;
    };
    this.getAllCharacteristics = function () {
        return characteristics;
    };
    this.findCharacteristic = function (uuid) {
        return characteristics[uuid];
    };
    this.addCharacteristicWithUUID = function (characteristicUUID, properties) {
        var characteristic = new Characteristic(self, characteristicUUID, properties);
        return characteristics[characteristicUUID] = characteristic;
    };

    this.addCharacteristic = function (characteristic) {
        characteristics[characteristic.uuid] = characteristic;
    };
}

exports.Service = Service;


text:
#ifndef __ELI_LINE_H__
#define __ELI_LINE_H__

#include <stdio.h>

struct Line {
    char str[BUFSIZ];
    struct Line *prev, *next;
};

struct Line* line_new(const char *str, size_t len);
void line_free(struct Line *line);
size_t line_len(struct Line *line);
void line_pushback(struct Line *line, const char *str, size_t cnt);
void line_insert(struct Line *line, size_t ndx, char c);
void line_erase(struct Line *line, size_t ndx);

#endif /* __ELI_LINE_H__ */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using System.Web.SessionState;
using System.Configuration;

namespace WebEditor
{
    /// <summary>
    /// Summary description for ImageProcessor
    /// </summary>
    public class ImageProcessor : IHttpHandler, IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            // parse the filename
            int gameId = Int32.Parse(context.Request["gameId"]);
            string filename = context.Request["image"];

            string uploadPath = Services.FileManagerLoader.GetFileManager().UploadPath(gameId);

            if (Config.AzureFiles)
            {
                context.Response.Redirect(ConfigurationManager.AppSettings["AzureFilesBase"] + uploadPath + "/" + filename, false);
                context.ApplicationInstance.CompleteRequest();
                return;
            }

            string path = Path.Combine(uploadPath, filename);
            if (!File.Exists(path)) return;

            Image fullsizeImg = Image.FromFile(path);

            int width, height = 0;
            Int32.TryParse(context.Request["w"], out width);
            Int32.TryParse(context.Request["h"], out height);

            context.Response.Clear();
            context.Response.BufferOutput = true;
            string format = fullsizeImg.RawFormat.ToString();
            // Set correct content type header
            if (ImageFormat.Jpeg.Equals(fullsizeImg.RawFormat))
                context.Response.ContentType = "image/jpeg";
            else if (ImageFormat.Png.Equals(fullsizeImg.RawFormat))
                context.Response.ContentType = "image/png";
            else if (ImageFormat.Gif.Equals(fullsizeImg.RawFormat))
                context.Response.ContentType = "image/gif";
            else if (ImageFormat.Tiff.Equals(fullsizeImg.RawFormat))
                context.Response.ContentType = "image/tiff";
            else if (ImageFormat.Bmp.Equals(fullsizeImg.RawFormat))
                context.Response.ContentType = "image/bmp";
            else
                context.Response.ContentType = "image";  //default -- when MIME Type not known

            if (height > 0 && width > 0)
            {
                // resize as per the height width requested
                if (height >= fullsizeImg.Height && width >= fullsizeImg.Width)
                    fullsizeImg.Save(context.Response.OutputStream, ImageFormat.Jpeg);
                else
                {
                    // Maintain aspect ratio.
                    float widthPerc = (float)width / (float)fullsizeImg.Width;
                    float heightPerc = (float)height / (float)fullsizeImg.Height;
                    float resizePerc = heightPerc < widthPerc ? heightPerc : widthPerc;
                    height = (int)(fullsizeImg.Height * resizePerc);
                    width = (int)(fullsizeImg.Width * resizePerc);

                    Bitmap bmp = new Bitmap(width, height);
                    Graphics objGraphics = Graphics.FromImage(bmp);
                    objGraphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.GammaCorrected;
                    objGraphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
                    objGraphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
                    objGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                    objGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

                    objGraphics.DrawImage(fullsizeImg, 0, 0, bmp.Width, bmp.Height);
                    bmp.Save(context.Response.OutputStream, ImageFormat.Jpeg);
                    objGraphics.Dispose();
                    bmp.Dispose();
                }
            }
            else
            {
                fullsizeImg.Save(context.Response.OutputStream, ImageFormat.Jpeg);
            }

            fullsizeImg.Dispose();

            context.Response.Flush();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}


text:
<?php

/**
 * CInlineAction represents an action that is defined as a controller method.
 *
 * The method name is like 'actionXYZ' where 'XYZ' stands for the action name.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @version $Id: CInlineAction.php 2799 2011-01-01 19:31:13Z qiang.xue $
 * @package system.web.actions
 * @since 1.0
 */
class CInlineAction extends CAction
{
	/**
	 * Runs the action.
	 * The action method defined in the controller is invoked.
	 * This method is required by {@link CAction}.
	 */
	public function run()
	{
		$controller=$this->getController();
		$methodName='action'.$this->getId();
		$method=new ReflectionMethod($controller,$methodName);
		if(($n=$method->getNumberOfParameters())>0)
		{
			$params=array();
			foreach($method->getParameters() as $i=>$param)
			{
				$name=$param->getName();
				if(isset($_GET[$name]))
				{
					if($param->isArray())
						$params[]=is_array($_GET[$name]) ? $_GET[$name] : array($_GET[$name]);
					else if(!is_array($_GET[$name]))
						$params[]=$_GET[$name];
					else
						throw new CHttpException(400,Yii::t('yii','Your request is invalid.'));
				}
				else if($param->isDefaultValueAvailable())
					$params[]=$param->getDefaultValue();
				else
					throw new CHttpException(400,Yii::t('yii','Your request is invalid.'));
			}
			$method->invokeArgs($controller,$params);
		}
		else
			$controller->$methodName();
	}
}


text:
Bower Dependencies:
- angular
- angular-mocks
- angular-resource
- angular-animate
- angular-ui-router
- angular-bootstrap
- bootstrap
- angular-file-upload
- angular-dragdrop

Npm and bower needed to be installed.

Run "npm start" to install needed dependencies and start a local server.

Author: Dimitris Kirakakis


text:
<script type="text/javascript">
    function framepop() {
        if (top.frames.length != 0){
            if(qstring('source') == 'embed')
                top.location = 'embed_docusign/' + window.location.search;
            else
                top.location = 'get_status_and_docs/' + window.location.search;
        }
    }
</script>
<script>
    function qstring( name )
    {
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( window.location.href );
        if( results == null )
            return "";
        else
            return results[1];
    }
</script>
<body onload="framepop();">
</body>


text:
namespace Toggl.Core.Sync
{
    public sealed class StateMachineEntryPoints
    {
        public StateResult StartPullSync { get; } = new StateResult();
        public StateResult StartPushSync { get; } = new StateResult();
        public StateResult StartCleanUp { get; } = new StateResult();
        public StateResult StartPullTimeEntries { get; } = new StateResult();
    }
}


text:
import {getService, registerServiceBuilder} from '../../../src/service';
import {hasOwn} from '../../../src/utils/object';
import {parseLinker} from './linker';
import {
  parseQueryString,
  parseUrlDeprecated,
  removeParamsFromSearch,
} from '../../../src/url';

import {user} from '../../../src/log';

const TAG = 'amp-analytics/linker-reader';

export class LinkerReader {
  /**
   * @param {!Window} win
   */
  constructor(win) {
    /** @private {!Window} */
    this.win_ = win;

    /** @private {!Object<string, ?Object<string, string>>} */
    this.linkerParams_ = {};
  }

  /**
   * Get the LINKER_PARAM(name, id) value from url and clean the value
   * @param {string} name
   * @param {string} id
   * @return {?string}
   */
  get(name, id) {
    if (!name || !id) {
      user().error(TAG, 'LINKER_PARAM requires two params, name and id');
      return null;
    }

    if (!hasOwn(this.linkerParams_, name)) {
      this.linkerParams_[name] = this.parseAndCleanQueryString_(name);
    }

    if (this.linkerParams_[name] && this.linkerParams_[name][id]) {
      return this.linkerParams_[name][id];
    }

    return null;
  }

  /**
   * Parse the url get the key value pair for the linker name
   * and remove the LINKER_PARAM from window location
   * @param {string} name
   * @return {?Object<string, string>}
   */
  parseAndCleanQueryString_(name) {
    const parsedUrl = parseUrlDeprecated(this.win_.location.href);
    const params = parseQueryString(parsedUrl.search);
    if (!hasOwn(params, name)) {
      // Linker param not found.
      return null;
    }
    const value = params[name];

    this.removeLinkerParam_(parsedUrl, name);
    return parseLinker(value);
  }

  /**
   * Remove the linker param from the current url
   * @param {!Location} url
   * @param {string} name
   */
  removeLinkerParam_(url, name) {
    if (!this.win_.history.replaceState) {
      // Can't replace state. Ignore
      return;
    }
    const searchUrl = url.search;
    const removedLinkerParamSearchUrl = removeParamsFromSearch(searchUrl, name);
    const newHref =
      url.origin +
      url.pathname +
      removedLinkerParamSearchUrl +
      (url.hash || '');
    this.win_.history.replaceState(null, '', newHref);
  }
}

/**
 * @param {!Window} win
 */
export function installLinkerReaderService(win) {
  registerServiceBuilder(win, 'amp-analytics-linker-reader', LinkerReader);
}

/**
 * @param {!Window} win
 * @return {!LinkerReader}
 */
export function linkerReaderServiceFor(win) {
  return getService(win, 'amp-analytics-linker-reader');
}


text:
package com.alipay.dw.jstorm.example.sequence;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;

import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.generated.AlreadyAliveException;
import backtype.storm.generated.InvalidTopologyException;
import backtype.storm.generated.TopologyAssignException;
import backtype.storm.topology.BoltDeclarer;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;

import com.alibaba.jstorm.utils.JStormUtils;
import com.alipay.dw.jstorm.example.sequence.bean.Pair;
import com.alipay.dw.jstorm.example.sequence.bean.TradeCustomer;
import com.alipay.dw.jstorm.example.sequence.bolt.MergeRecord;
import com.alipay.dw.jstorm.example.sequence.bolt.PairCount;
import com.alipay.dw.jstorm.example.sequence.bolt.SplitRecord;
import com.alipay.dw.jstorm.example.sequence.bolt.TotalCount;
import com.alipay.dw.jstorm.example.sequence.spout.SequenceSpout;

public class SequenceTopology {
	private static Logger LOG = LoggerFactory.getLogger(SequenceTopology.class);

	public final static String TOPOLOGY_SPOUT_PARALLELISM_HINT = "spout.parallel";
	public final static String TOPOLOGY_BOLT_PARALLELISM_HINT = "bolt.parallel";

	public static void SetBuilder(TopologyBuilder builder, Map conf) {

		int spout_Parallelism_hint = JStormUtils.parseInt(
				conf.get(TOPOLOGY_SPOUT_PARALLELISM_HINT), 1);
		int bolt_Parallelism_hint = JStormUtils.parseInt(
				conf.get(TOPOLOGY_BOLT_PARALLELISM_HINT), 2);

		builder.setSpout(SequenceTopologyDef.SEQUENCE_SPOUT_NAME,
				new SequenceSpout(), spout_Parallelism_hint);

		boolean isEnableSplit = JStormUtils.parseBoolean(
				conf.get("enable.split"), false);

		if (isEnableSplit == false) {
			BoltDeclarer boltDeclarer = builder.setBolt(
					SequenceTopologyDef.TOTAL_BOLT_NAME, new TotalCount(),
					bolt_Parallelism_hint);

			// localFirstGrouping is only for jstorm
			// boltDeclarer.localFirstGrouping(SequenceTopologyDef.SEQUENCE_SPOUT_NAME);
			boltDeclarer
					.localOrShuffleGrouping(SequenceTopologyDef.SEQUENCE_SPOUT_NAME)
					.addConfiguration(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 3);
		} else {

			builder.setBolt(SequenceTopologyDef.SPLIT_BOLT_NAME,
					new SplitRecord(), bolt_Parallelism_hint)
					.localOrShuffleGrouping(
							SequenceTopologyDef.SEQUENCE_SPOUT_NAME);

			builder.setBolt(SequenceTopologyDef.TRADE_BOLT_NAME,
					new PairCount(), bolt_Parallelism_hint).shuffleGrouping(
					SequenceTopologyDef.SPLIT_BOLT_NAME,
					SequenceTopologyDef.TRADE_STREAM_ID);
			builder.setBolt(SequenceTopologyDef.CUSTOMER_BOLT_NAME,
					new PairCount(), bolt_Parallelism_hint).shuffleGrouping(
					SequenceTopologyDef.SPLIT_BOLT_NAME,
					SequenceTopologyDef.CUSTOMER_STREAM_ID);

			builder.setBolt(SequenceTopologyDef.MERGE_BOLT_NAME,
					new MergeRecord(), bolt_Parallelism_hint)
					.fieldsGrouping(SequenceTopologyDef.TRADE_BOLT_NAME,
							new Fields("ID"))
					.fieldsGrouping(SequenceTopologyDef.CUSTOMER_BOLT_NAME,
							new Fields("ID"));

			builder.setBolt(SequenceTopologyDef.TOTAL_BOLT_NAME,
					new TotalCount(), bolt_Parallelism_hint).noneGrouping(
					SequenceTopologyDef.MERGE_BOLT_NAME);
		}

		boolean kryoEnable = JStormUtils.parseBoolean(conf.get("kryo.enable"),
				false);
		if (kryoEnable == true) {
			System.out.println("Use Kryo ");
			boolean useJavaSer = JStormUtils.parseBoolean(
					conf.get("fall.back.on.java.serialization"), true);

			Config.setFallBackOnJavaSerialization(conf, useJavaSer);

			Config.registerSerialization(conf, TradeCustomer.class);
			Config.registerSerialization(conf, Pair.class);
		}

		// conf.put(Config.TOPOLOGY_DEBUG, false);
		// conf.put(ConfigExtension.TOPOLOGY_DEBUG_RECV_TUPLE, false);
		// conf.put(Config.STORM_LOCAL_MODE_ZMQ, false);

		int ackerNum = JStormUtils.parseInt(
				conf.get(Config.TOPOLOGY_ACKER_EXECUTORS), 1);
		Config.setNumAckers(conf, ackerNum);
		// conf.put(Config.TOPOLOGY_MAX_TASK_PARALLELISM, 6);
		// conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 20);
		// conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);

		int workerNum = JStormUtils.parseInt(conf.get(Config.TOPOLOGY_WORKERS),
				20);
		conf.put(Config.TOPOLOGY_WORKERS, workerNum);

	}

	public static void SetLocalTopology() throws Exception {
		TopologyBuilder builder = new TopologyBuilder();

		conf.put(TOPOLOGY_BOLT_PARALLELISM_HINT, Integer.valueOf(1));

		SetBuilder(builder, conf);

		LOG.debug("test");
		LOG.info("Submit log");
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("SplitMerge", conf, builder.createTopology());

		Thread.sleep(60000);

		cluster.killTopology("SplitMerge");

		cluster.shutdown();
	}

	public static void SetRemoteTopology() throws AlreadyAliveException,
			InvalidTopologyException, TopologyAssignException {

		String streamName = (String) conf.get(Config.TOPOLOGY_NAME);
		if (streamName == null) {
			streamName = "SequenceTest";
		}

		TopologyBuilder builder = new TopologyBuilder();

		SetBuilder(builder, conf);

		conf.put(Config.STORM_CLUSTER_MODE, "distributed");

		StormSubmitter.submitTopology(streamName, conf,
				builder.createTopology());

	}

	public static void SetDPRCTopology() throws AlreadyAliveException,
			InvalidTopologyException, TopologyAssignException {
		// LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder(
		// "exclamation");
		//
		// builder.addBolt(new TotalCount(), 3);
		//
		// Config conf = new Config();
		//
		// conf.setNumWorkers(3);
		// StormSubmitter.submitTopology("rpc", conf,
		// builder.createRemoteTopology());
		System.out
				.println("Please refer to com.alipay.dw.jstorm.example.drpc.ReachTopology");
	}

	private static Map conf = new HashMap<Object, Object>();

	public static void LoadProperty(String prop) {
		Properties properties = new Properties();

		try {
			InputStream stream = new FileInputStream(prop);
			properties.load(stream);
		} catch (FileNotFoundException e) {
			System.out.println("No such file " + prop);
		} catch (Exception e1) {
			e1.printStackTrace();

			return;
		}

		conf.putAll(properties);
	}

	public static void LoadYaml(String confPath) {

		Yaml yaml = new Yaml();

		try {
			InputStream stream = new FileInputStream(confPath);

			conf = (Map) yaml.load(stream);
			if (conf == null || conf.isEmpty() == true) {
				throw new RuntimeException("Failed to read config file");
			}

		} catch (FileNotFoundException e) {
			System.out.println("No such file " + confPath);
			throw new RuntimeException("No config file");
		} catch (Exception e1) {
			e1.printStackTrace();
			throw new RuntimeException("Failed to read config file");
		}

		return;
	}

	public static void LoadConf(String arg) {
		if (arg.endsWith("yaml")) {
			LoadYaml(arg);
		} else {
			LoadProperty(arg);
		}
	}

	public static boolean local_mode(Map conf) {
		String mode = (String) conf.get(Config.STORM_CLUSTER_MODE);
		if (mode != null) {
			if (mode.equals("local")) {
				return true;
			}
		}

		return false;

	}

	public static void main(String[] args) throws Exception {
		if (args.length == 0) {
			System.err.println("Please input configuration file");
			System.exit(-1);
		}

		LoadConf(args[0]);

		if (local_mode(conf)) {
			SetLocalTopology();
		} else {
			SetRemoteTopology();
		}

	}

}


text:
<dom-module id="x-dialog">
  <template>

{{headline}}

            <slot></slot>

  </template>

</dom-module>


text:
package org.supercsv.util;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import org.supercsv.exception.SuperCsvReflectionException;

/**
 * Provides useful utility methods for reflection.
 *
 * @author James Bassett
 * @author Fabian Seifert
 * @since 2.0.0
 */
public final class ReflectionUtils {

	public static final String SET_PREFIX = "set";
	public static final String GET_PREFIX = "get";
	public static final String IS_PREFIX = "is";

	/**
	 * A map of primitives and their associated wrapper classes, to cater for autoboxing.
	 */
	private static final Map<Class<?>, Class<?>> AUTOBOXING_CONVERTER = new HashMap<Class<?>, Class<?>>();
	static {
		AUTOBOXING_CONVERTER.put(long.class, Long.class);
		AUTOBOXING_CONVERTER.put(Long.class, long.class);
		AUTOBOXING_CONVERTER.put(int.class, Integer.class);
		AUTOBOXING_CONVERTER.put(Integer.class, int.class);
		AUTOBOXING_CONVERTER.put(char.class, Character.class);
		AUTOBOXING_CONVERTER.put(Character.class, char.class);
		AUTOBOXING_CONVERTER.put(byte.class, Byte.class);
		AUTOBOXING_CONVERTER.put(Byte.class, byte.class);
		AUTOBOXING_CONVERTER.put(short.class, Short.class);
		AUTOBOXING_CONVERTER.put(Short.class, short.class);
		AUTOBOXING_CONVERTER.put(boolean.class, Boolean.class);
		AUTOBOXING_CONVERTER.put(Boolean.class, boolean.class);
		AUTOBOXING_CONVERTER.put(double.class, Double.class);
		AUTOBOXING_CONVERTER.put(Double.class, double.class);
		AUTOBOXING_CONVERTER.put(float.class, Float.class);
		AUTOBOXING_CONVERTER.put(Float.class, float.class);
	}

	// no instantiation
	private ReflectionUtils() {
	}

	/**
	 * Returns the getter method associated with the object's field.
	 *
	 * @param object
	 *            the object
	 * @param fieldName
	 *            the name of the field
	 * @return the getter method
	 * @throws NullPointerException
	 *             if object or fieldName is null
	 * @throws SuperCsvReflectionException
	 *             if the getter doesn't exist or is not visible
	 */
	public static Method findGetter(final Object object, final String fieldName) {
		if( object == null ) {
			throw new NullPointerException("object should not be null");
		} else if( fieldName == null ) {
			throw new NullPointerException("fieldName should not be null");
		}

		final Class<?> clazz = object.getClass();

		// find a standard getter
		final String standardGetterName = getMethodNameForField(GET_PREFIX, fieldName);
		Method getter = findGetterWithCompatibleReturnType(standardGetterName, clazz, false);

		// if that fails, try for an isX() style boolean getter
		if( getter == null ) {
			final String booleanGetterName = getMethodNameForField(IS_PREFIX, fieldName);
			getter = findGetterWithCompatibleReturnType(booleanGetterName, clazz, true);
		}

		if( getter == null ) {
			throw new SuperCsvReflectionException(
				String
					.format(
						"unable to find getter for field %s in class %s - check that the corresponding nameMapping element matches the field name in the bean",
						fieldName, clazz.getName()));
		}

		return getter;
	}

	/**
	 * Helper method for findGetter() that finds a getter with the supplied name, optionally enforcing that the method
	 * must have a Boolean/boolean return type. Developer note: this method could have accepted an actual return type to
	 * enforce, but it was more efficient to cater for only Booleans (as they're the only type that has differently
	 * named getters).
	 *
	 * @param getterName
	 *            the getter name
	 * @param clazz
	 *            the class
	 * @param enforceBooleanReturnType
	 *            if true, the method must return a Boolean/boolean, otherwise it's return type doesn't matter
	 * @return the getter, or null if none is found
	 */
	private static Method findGetterWithCompatibleReturnType(final String getterName, final Class<?> clazz,
		final boolean enforceBooleanReturnType) {

		for( final Method method : clazz.getMethods() ) {

			if( !getterName.equalsIgnoreCase(method.getName()) || method.getParameterTypes().length != 0
				|| method.getReturnType().equals(void.class) ) {
				continue; // getter must have correct name, 0 parameters and a return type
			}

			if( !enforceBooleanReturnType || boolean.class.equals(method.getReturnType())
				|| Boolean.class.equals(method.getReturnType()) ) {
				return method;
			}

		}

		return null;
	}

	/**
	 * Returns the setter method associated with the object's field.
	 *

	 * This method handles any autoboxing/unboxing of the argument passed to the setter (e.g. if the setter type is a
	 * primitive {@code int} but the argument passed to the setter is an {@code Integer}) by looking for a setter with
	 * the same type, and failing that checking for a setter with the corresponding primitive/wrapper type.
	 *

	 * It also allows for an argument type that is a subclass or implementation of the setter type (when the setter type
	 * is an {@code Object} or {@code interface} respectively).
	 *
	 * @param object
	 *            the object
	 * @param fieldName
	 *            the name of the field
	 * @param argumentType
	 *            the type to be passed to the setter
	 * @return the setter method
	 * @throws NullPointerException
	 *             if object, fieldName or fieldType is null
	 * @throws SuperCsvReflectionException
	 *             if the setter doesn't exist or is not visible
	 */
	public static Method findSetter(final Object object, final String fieldName, final Class<?> argumentType) {
		if( object == null ) {
			throw new NullPointerException("object should not be null");
		} else if( fieldName == null ) {
			throw new NullPointerException("fieldName should not be null");
		} else if( argumentType == null ) {
			throw new NullPointerException("argumentType should not be null");
		}

		final String setterName = getMethodNameForField(SET_PREFIX, fieldName);
		final Class<?> clazz = object.getClass();

		// find a setter compatible with the supplied argument type
		Method setter = findSetterWithCompatibleParamType(clazz, setterName, argumentType);

		// if that failed, try the corresponding primitive/wrapper if it's a type that can be autoboxed/unboxed
		if( setter == null && AUTOBOXING_CONVERTER.containsKey(argumentType) ) {
			setter = findSetterWithCompatibleParamType(clazz, setterName, AUTOBOXING_CONVERTER.get(argumentType));
		}

		if( setter == null ) {
			throw new SuperCsvReflectionException(
				String
					.format(
						"unable to find method %s(%s) in class %s - check that the corresponding nameMapping element matches the field name in the bean, "
							+ "and the cell processor returns a type compatible with the field", setterName,
						argumentType.getName(), clazz.getName()));
		}

		return setter;
	}

	/**
	 * Helper method for findSetter() that returns the setter method of the supplied name, whose parameter type is
	 * compatible with the supplied argument type (will allow an object of that type to be used when invoking the
	 * setter), or returns <tt>null</tt> if no match is found. Preference is given to setters whose parameter type is an
	 * exact match, but if there is none, then the first compatible method found is returned.
	 *
	 * @param clazz
	 *            the class containing the setter
	 * @param setterName
	 *            the name of the setter
	 * @param argumentType
	 *            the type to be passed to the setter
	 * @return the setter method, or null if none is found
	 */
	private static Method findSetterWithCompatibleParamType(final Class<?> clazz, final String setterName,
		final Class<?> argumentType) {

		Class<?> actualType = clazz;
		Method compatibleSetter = null;
		while( actualType != null && compatibleSetter == null ) {
			Method[] methods = actualType.getDeclaredMethods();
			for( Method method : methods ) {
				if( !setterName.equalsIgnoreCase(method.getName()) || method.getParameterTypes().length != 1 ) {
					continue; // setter must have correct name and only 1 parameter
				}

				final Class<?> parameterType = method.getParameterTypes()[0];
				if( parameterType.equals(argumentType) ) {
					return method;
				} else if( parameterType.isAssignableFrom(argumentType) ) {
					compatibleSetter = method; // potential match, but keep looking for exact match
				}
			}
			actualType = actualType.getSuperclass();
		}

		return compatibleSetter;
	}

	/**
	 * Gets the camelcase getter/setter method name for a field.
	 *
	 * @param prefix
	 *            the method prefix
	 * @param fieldName
	 *            the field name
	 * @return the method name
	 */
	private static String getMethodNameForField(final String prefix, final String fieldName) {
		return prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
	}
}


text:
	<form id="info_form" action="{:u('article_cate/edit')}" method="post">

			{:L('article_cate_parent')} :

				<select class="J_cate_select mr10" data-pid="0" data-uri="{:U('article_cate/ajax_getchilds')}" data-selected="{$info.spid}"></select>
				<input type="hidden" name="pid" id="J_cate_id" />

			{:L('article_cate_name')} :
			<input type="text" name="name" id="name" class="input-text" value="{$info.name}" size="30">

			{:L('article_cate_type')} :

				<input type="radio" name="type" value="0" <if condition="$info.type eq 0">checked</if>> {:L('article_cate_type_0')}
                <input type="radio" name="type" value="1" <if condition="$info.type eq 1">checked</if>> {:L('article_cate_type_1')}

			{:L('article_cate_img')} :

                <input type="text" name="img" id="J_img" class="input-text fl mr10" size="30" value="{:attach($info['img'], 'article_cate')}">

{:L('upload')}

                <notempty name="info['img']"></notempty>

			{:L('enabled')} :

				<input type="radio" name="status" value="1" <if condition="$info.status eq 1">checked</if> > {:L('yes')}
				<input type="radio" name="status" value="0" <if condition="$info.status eq 0">checked</if> > {:L('no')}

			{:L('seo_title')} :
			<input type="text" name="seo_title" id="seo_title" class="input-text" value="{$info.seo_title}" size="50">

			{:L('seo_keys')} :
			<input type="text" name="seo_keys" id="seo_keys" class="input-text" value="{$info.seo_keys}" size="50">

			{:L('seo_desc')} :
			<textarea name="seo_desc" style="width:300px; height:50px;">{$info.seo_desc}</textarea>

	<input type="hidden" name="id" value="{$info.id}" />
	</form>


text:
namespace MinaGlosor.Web.Models.AdminCommands
{
    public interface IAdminCommandHandler<in TCommand>
        where TCommand : IAdminCommand
    {
        object Run(TCommand command);
    }
}


text:
opkg-cl install --force-depends --add-arch brcm2708:10 /packages/*.ipk
echo "Ignore libc errors, everything for usbip and the config system should be setup now!"


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="battery_saver_mode_color">#ff2196f3</color>
</resources>


text:
class CustomFieldLookup < CustomField

  Settings = %w(lookup_class_name lookup_field lookup_method autocomplete multiselect)
  LIMIT = 50 # autocomplete

  #
  # Ensure serialization is activated when custom lookup fields are created/updated
  after_save { apply_serialization }

  # Renders the value
  #------------------------------------------------------------------------------
  def render(value)
    value && lookup_values(value).map(&lookup_method.to_sym).join(', ')
  end

  # Prepares values for listing in a select box
  #------------------------------------------------------------------------------
  def lookup_values_for_selection
    lookup_values.map{|item| [item.send(lookup_method), item.send(lookup_field)]}.sort_by{|x,y| x[0] <=> y[0]}
  end

  # Looks up a set of values given a list of ids
  # If value is empty it should return all results
  #------------------------------------------------------------------------------
  def lookup_values(value=nil)
    klass = lookup_class
    if klass.methods.include?(:lookup_values)
      # use the custom search class
      klass.lookup_values(value)
    else
      # assume it's an ActiveRecord object that has Ransack on it
      items = klass.my
      items = items.limit(LIMIT) if autocomplete?
      items = items.search("#{lookup_field}_in" => value) # value can be array or string
      items.result
    end
  end

  # Returns class to lookup
  # Note: lookup_class_name can be table or model name e.g. 'contact' or 'contacts'
  #------------------------------------------------------------------------------
  def lookup_class
    lookup_class_name.tableize.classify.constantize
  end

  # Convenience methods for settings
  #------------------------------------------------------------------------------
  Settings.each do |name|
    define_method name do
      settings["#{name}"]
    end
    define_method "#{name}=" do |value|
      settings["#{name}"] = value
    end
  end

  # Define boolean settings methods for convenience
  #------------------------------------------------------------------------------
  %w(autocomplete multiselect).each do |name|
    define_method "#{name}?" do
      settings["#{name}"] == '1'
    end
  end

  # Multiselect lookup_fields need to serialize their data properly
  #------------------------------------------------------------------------------
  #   1) store data as an Array by turning on serialization on the class of the ActiveRecord object this field relates to
  #   2) parse select2 input into a proper array by overriding the mutator on the ActiveRecord object this field relates to
  def apply_serialization

    klass_name = self.field_group.try(:klass_name)
    return if klass_name.blank?
    klass = klass_name.constantize

    if self.multiselect?

      #
      # For lookup fields that are multiselect, turn on ActiveRecord serialization on the object class
      if !klass.serialized_attributes.keys.include?(self.name)
        klass.serialize(self.name.to_sym, Array)
        Rails.logger.debug("FfcrmLookupField: Serializing #{self.name} as Array for #{klass}.")
      end

      #
      # Override the mutator on the object class to ensure items are serialized correctly
      # ["", "steve,jim,bob"] becomes ["steve", "jim", "bob"]
      attr = self.name
      unless klass.instance_methods.include?(:"#{attr}=")
        klass.class_eval <<-READER, __FILE__, __LINE__ + 1
          define_method "#{attr}=" do |value|
            write_attribute( attr, value.join(',').split(',').reject(&:blank?) )
          end
        READER
        Rails.logger.debug("FfcrmLookupField: overriding #{attr}= for #{klass} to handle select2 input.")
      end

    end

  end

end


text:
from flask import Flask, request, render_template
import plivohelper
import os

response_server = Flask("ResponseServer")
response_server.debug = True

@response_server.errorhandler(404)
def page_not_found(error):
    """error page"""
    print "404 page not found"
    return 'This URL does not exist', 404

@response_server.route('/ringing/', methods=['GET', 'POST'])
def ringing():
    """ringing URL"""
    # Post params- 'to': ringing number, 'request_uuid': request id given at the time of api call
    print "We got a ringing notification"
    return "OK"

@response_server.route('/hangup/', methods=['GET', 'POST'])
def hangup():
    """hangup URL"""
    # Post params- 'request_uuid': request id given at the time of api call,
    #               'CallUUID': unique id of call, 'reason': reason of hangup
    print "We got a hangup notification"
    return "OK"

@response_server.route('/waitmusic/', methods=['GET', 'POST'])
def waitmusic():
    if request.method == 'POST':
        print request.form.items()
    else:
        print request.args.items()
    r = plivohelper.Response()
    r.addSpeak("Please wait")
    r.addSpeak("Be patient")
    #r.addPlay("http://127.0.0.1:5000/static/duck.mp3")
    r.addPlay("/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome.wav")
    print "RESTXML Response => %s" % r
    return render_template('response_template.xml', response=r)

@response_server.route('/answered/', methods=['GET', 'POST'])
def answered():
    # Post params- 'CallUUID': unique id of call, 'Direction': direction of call,
    #               'To': Number which was called, 'From': calling number,
    #               If Direction is outbound then 2 additional params:
    #               'ALegUUID': Unique Id for first leg,
    #               'ALegRequestUUID': request id given at the time of api call

    if request.method == 'POST':
        try:
            print "CallUUID: %s" % request.form['CallUUID']
        except:
            pass
    else:
        try:
            print "CallUUID: %s" % request.args['CallUUID']
        except:
            pass
    r = plivohelper.Response()
    p = r.addConference("plivo", muted=False,
                        enterSound="beep:2", exitSound="beep:1",
                        startConferenceOnEnter=True, endConferenceOnExit=True,
                        waitSound="http://127.0.0.1:5000/waitmusic/",
                        timeLimit=60, hangupOnStar=True)
    print "RESTXML Response => %s" % r
    return render_template('response_template.xml', response=r)

if __name__ == '__main__':
    if not os.path.isfile("templates/response_template.xml"):
        print "Error : Can't find the XML template : templates/response_template.xml"
    else:
        response_server.run(host='127.0.0.1', port=5000)