text:
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { Injectable } from '@angular/core';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { CoreEventsProvider } from '@providers/events';
import { CoreLoggerProvider } from '@providers/logger';
import { CoreSitesProvider } from '@providers/sites';

/**
 * Interface that all message output handlers must implement.
 */
export interface AddonMessageOutputHandler extends CoreDelegateHandler {
    /**
     * The name of the processor. E.g. 'airnotifier'.
     */
    processorName: string;

    /**
     * Returns the data needed to render the handler.
     *
     * @param processor The processor object.
     * @return Data.
     */
    getDisplayData(processor: any): AddonMessageOutputHandlerData;
}

/**
 * Data needed to render a message output handler. It's returned by the handler.
 */
export interface AddonMessageOutputHandlerData {
    /**
     * Handler's priority.
     */
    priority: number;

    /**
     * Name of the page to load for the handler.
     */
    page: string;

    /**
     * Label to display for the handler.
     */
    label: string;

    /**
     * Name of the icon to display for the handler.
     */
    icon: string;

    /**
     * Params to pass to the page.
     */
    pageParams?: any;
}

/**
 * Delegate to register processors (message/output) to be used in places like notification preferences.
 */
 @Injectable()
 export class AddonMessageOutputDelegate extends CoreDelegate {

     protected handlerNameProperty = 'processorName';

     constructor(protected loggerProvider: CoreLoggerProvider, protected sitesProvider: CoreSitesProvider,
             protected eventsProvider: CoreEventsProvider) {
         super('AddonMessageOutputDelegate', loggerProvider, sitesProvider, eventsProvider);
     }

    /**
     * Get the display data of the handler.
     *
     * @param processor The processor object.
     * @return Data.
     */
    getDisplayData(processor: any): AddonMessageOutputHandlerData {
        return this.executeFunctionOnEnabled(processor.name, 'getDisplayData', processor);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.glaf.base.modules.website.springmvc;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.glaf.base.config.BaseConfiguration;
import com.glaf.base.modules.sys.model.SysUser;
import com.glaf.base.modules.sys.service.ComplexUserService;
import com.glaf.base.modules.sys.service.SysUserService;
import com.glaf.base.online.domain.UserOnline;
import com.glaf.base.online.service.UserOnlineService;
import com.glaf.base.utils.ContextUtil;
import com.glaf.core.config.Configuration;
import com.glaf.core.config.SystemConfig;
import com.glaf.core.security.DigestUtil;
import com.glaf.core.util.RequestUtils;

@Controller("/public/auth")
@RequestMapping("/public/auth")
public class UserAuthController {

	protected static final Log logger = LogFactory
			.getLog(UserAuthController.class);

	protected static Configuration conf = BaseConfiguration.create();

	protected SysUserService sysUserService;

	protected ComplexUserService complexUserService;

	protected UserOnlineService userOnlineService;

	public UserAuthController() {

	}

	@ResponseBody
	@RequestMapping
	public byte[] auth(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		String json = request.getParameter("json");
		JSONObject jsonObject = JSON.parseObject(json);
		JSONObject result = new JSONObject();
		String actorId = jsonObject.getString("x");
		String password = jsonObject.getString("y");
		String email = jsonObject.getString("email");
		if (sysUserService.findByMail(email) != null) {
			result.put("status", 500);
			result.put("message", "邮箱已经存在,请换个再来!");
			return result.toJSONString().getBytes("UTF-8");
		}
		SysUser user = sysUserService.findByAccount(actorId);
		int status = 0;
		if (user != null) {
			// 用户已经存在,验证用户名及密码是否正确
			String pwd = DigestUtil.digestString(password, "MD5");
			if (pwd != null && !user.getPassword().equals(pwd)) {
				status = 500;
				result.put("status", 500);
				result.put("message", "密码不匹配");
			} else if (user.getBlocked() == 1) {
				status = 500;
				result.put("status", 500);
				result.put("message", "帐号已经禁止");
			} else {
				status = 200;
				result.put("status", 200);
				result.put("message", "验证通过");
			}
		} else {
			user = new SysUser();
			user.setAccount(actorId);

			try {
				String pwd = DigestUtil.digestString(password, "MD5");
				user.setPassword(pwd);
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			long deptId = 0;
			if (jsonObject.containsKey("deptId")) {
				deptId = Long.parseLong(jsonObject.getString("deptId"));
			}
			user.setDeptId(deptId);

			user.setName(jsonObject.getString("name"));
			if (user.getName() == null) {
				user.setName(actorId);
			}
			user.setMobile(jsonObject.getString("mobile"));
			user.setEmail(jsonObject.getString("email"));
			user.setUserType(0);
			user.setAccountType(2);
			user.setEvection(0);
			user.setCreateTime(new Date());
			user.setLastLoginTime(new Date());
			user.setLastChangePasswordDate(new Date());
			user.setIsChangePassword(0);
			user.setCreateBy("website");
			user.setUpdateBy("website");
			List<String> roleCodes = new java.util.ArrayList<String>();
			roleCodes.add("website");
			try {
				if (complexUserService.createUser(user, roleCodes)) {
					status = 200;
				}
			} catch (Exception ex) {
				status = 500;
				logger.error(ex);
			}
			if (status == 200) {// 保存成功
				result.put("status", 200);
				result.put("message", "注册成功");
			} else if (status == 500) {
				result.put("status", 500);
				result.put("message", "注册失败");
			}
		}

		if (status == 200) {

			HttpSession session = request.getSession(true);
			ContextUtil.put(actorId, user);// 传入全局变量
			RequestUtils.setLoginUser(request, response, "default", actorId);

			java.util.Random random = new java.util.Random();
			String token = org.apache.commons.codec.digest.DigestUtils
					.md5Hex(actorId)
					+ Math.abs(random.nextInt(9999))
					+ com.glaf.core.util.UUID32.getUUID()
					+ Math.abs(random.nextInt(9999));
			result.put("actorId", actorId);
			result.put("token", token);

			try {
				if (user.getLoginCount() != null) {
					user.setLoginCount(user.getLoginCount() + 1);
				} else {
					user.setLoginCount(1);
				}

				// 登录成功,修改最近一次登录时间
				user.setLastLoginDate(new Date());
				sysUserService.updateUser(user);

				UserOnline online = new UserOnline();
				online.setActorId(user.getActorId());
				online.setName(user.getName());
				online.setCheckDate(new Date());
				online.setLoginDate(new Date());
				online.setLoginIP(RequestUtils.getIPAddress(request));
				online.setSessionId(session.getId());
				userOnlineService.login(online);
			} catch (Exception ex) {
				ex.printStackTrace();
				logger.error(ex);
			}
		}

		return result.toJSONString().getBytes("UTF-8");
	}

	/**
	 * 登录
	 *
	 * @param request
	 * @param modelMap
	 * @return
	 */
	@RequestMapping("/login")
	public ModelAndView login(HttpServletRequest request,
			HttpServletResponse response) {
		String ip = RequestUtils.getIPAddress(request);
		/**
		 * 允许从指定的机器上通过用户名密码登录
		 */
		if (StringUtils.contains(conf.get("login.allow.ip", "127.0.0.1"), ip)
				|| StringUtils.contains(
						SystemConfig.getString("login.allow.ip", "127.0.0.1"),
						ip)) {
			String actorId = request.getParameter("x");
			String password = request.getParameter("y");
			HttpSession session = request.getSession(true);
			java.util.Random random = new java.util.Random();
			String rand = Math.abs(random.nextInt(999999))
					+ com.glaf.core.util.UUID32.getUUID()
					+ Math.abs(random.nextInt(999999));
			session = request.getSession(true);
			if (session != null) {
				session.setAttribute("x_y", rand);
			}
			String url = request.getContextPath() + "/mx/login/doLogin?x="
					+ actorId + "&y=" + rand + password;
			try {
				response.sendRedirect(url);
				return null;
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return new ModelAndView("/modules/login");
	}

	@ResponseBody
	@RequestMapping("/register")
	public byte[] register(HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		String json = request.getParameter("json");
		JSONObject jsonObject = JSON.parseObject(json);
		JSONObject result = new JSONObject();
		String actorId = jsonObject.getString("x");
		String password = jsonObject.getString("y");
		String email = jsonObject.getString("email");
		if (sysUserService.findByMail(email) != null) {
			result.put("status", 500);
			result.put("message", "邮箱已经存在,请换个再来!");
			return result.toJSONString().getBytes("UTF-8");
		}
		SysUser user = sysUserService.findByAccount(actorId);
		int status = 0;
		if (user != null) {
			status = 400;
			result.put("status", 400);
			result.put("message", "用户已经存在!");
		} else {
			user = new SysUser();
			user.setAccount(actorId);

			try {
				String pwd = DigestUtil.digestString(password, "MD5");
				user.setPassword(pwd);
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			long deptId = 0;
			if (jsonObject.containsKey("deptId")) {
				deptId = Long.parseLong(jsonObject.getString("deptId"));
			}
			user.setDeptId(deptId);

			user.setName(jsonObject.getString("name"));
			if (user.getName() == null) {
				user.setName(actorId);
			}
			user.setMobile(jsonObject.getString("mobile"));
			user.setEmail(jsonObject.getString("email"));
			user.setUserType(0);
			user.setAccountType(2);
			user.setEvection(0);
			user.setCreateTime(new Date());
			user.setLastLoginTime(new Date());
			user.setLastChangePasswordDate(new Date());
			user.setIsChangePassword(0);
			user.setCreateBy("website");
			user.setUpdateBy("website");
			List<String> roleCodes = new java.util.ArrayList<String>();
			roleCodes.add("website");
			try {
				if (complexUserService.createUser(user, roleCodes)) {
					status = 200;
				}
			} catch (Exception ex) {
				status = 500;
				logger.error(ex);
			}
			if (status == 200) {// 保存成功
				result.put("status", 200);
				result.put("message", "注册成功");
			} else if (status == 500) {
				result.put("status", 500);
				result.put("message", "注册失败");
			}
		}

		return result.toJSONString().getBytes("UTF-8");
	}

	@javax.annotation.Resource
	public void setComplexUserService(ComplexUserService complexUserService) {
		this.complexUserService = complexUserService;
	}

	@javax.annotation.Resource
	public void setSysUserService(SysUserService sysUserService) {
		this.sysUserService = sysUserService;
	}

	@javax.annotation.Resource
	public void setUserOnlineService(UserOnlineService userOnlineService) {
		this.userOnlineService = userOnlineService;
	}

}


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

<title>org.robolectric.util.concurrent</title>
<meta name="date" content="2017-04-26">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.robolectric.util.concurrent

Package containing concurrency related utility classes.

See: Description

Class Summary

Class
Description

RoboExecutorService
Deprecated

Use RoboExecutorService instead.

Package org.robolectric.util.concurrent Description

Package containing concurrency related utility classes.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes


text:
export function sortByName(a, b) {
  return a.name.localeCompare(b.name);
}

export function sortByGroupRole(a, b) {
  return a.groupRole.localeCompare(b.groupRole);
}


text:
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>

    <dimen name="login_margin1">39dp</dimen>
    <dimen name="login_margin2">24dp</dimen>
    <dimen name="login_margin3">117dp</dimen>
    <dimen name="login_margin4">17dp</dimen>
    <dimen name="login_margin5">13dp</dimen>
    <dimen name="login_margin6">120dp</dimen>
    <dimen name="login_margin7">60dp</dimen>
    <dimen name="login_margin8">113dp</dimen>
    <dimen name="login_padding">15dp</dimen>
    <dimen name="login_width1">219dp</dimen>
    <dimen name="login_width2">173dp</dimen>
    <dimen name="login_width3">97dp</dimen>
    <dimen name="login_height1">38dp</dimen>
    <dimen name="login_height2">36dp</dimen>
    <dimen name="login_height3">24dp</dimen>
    <dimen name="login_height4">24dp</dimen>
    <dimen name="login_height5">27dp</dimen>

    <dimen name="register_padding">8dp</dimen>
    <dimen name="register_margin1">40dp</dimen>
    <dimen name="register_margin2">27dp</dimen>
    <dimen name="register_width1">221dp</dimen>
    <dimen name="register_width2">173dp</dimen>
    <dimen name="register_height1">38dp</dimen>
    <dimen name="register_height2">36dp</dimen>
    <dimen name="register_height3">32dp</dimen>

    <dimen name="edit_margin1">22dp</dimen>
    <dimen name="edit_margin2">17dp</dimen>
    <dimen name="edit_margin3">15dp</dimen>
    <dimen name="edit_margin4">19dp</dimen>

    <dimen name="edit_border_width">7dp</dimen>
    <dimen name="edit_width1">110dp</dimen>
    <dimen name="edit_height1">110dp</dimen>
    <dimen name="edit_height2">36dp</dimen>

    <dimen name="drawer_margin1">15dp</dimen>
    <dimen name="drawer_width">205dp</dimen>
    <dimen name="drawer_width1">105dp</dimen>
    <dimen name="drawer_width2">75dp</dimen>
    <dimen name="drawer_border_width">5dp</dimen>
    <dimen name="drawer_height1">75dp</dimen>
    <dimen name="drawer_height2">8dp</dimen>

    <dimen name="person_margin1">22dp</dimen>
    <dimen name="person_margin2">176dp</dimen>
    <dimen name="person_margin3">20dp</dimen>
    <dimen name="person_margin4">11dp</dimen>
    <dimen name="person_border_width">7dp</dimen>
    <dimen name="person_width1">110dp</dimen>
    <dimen name="person_width2">173dp</dimen>
    <dimen name="person_height1">110dp</dimen>
    <dimen name="person_height2">32dp</dimen>
    <dimen name="person_height3">36dp</dimen>

    <!--<dimen name="create_margin1">21dp</dimen>-->
    <!--<dimen name="create_margin2">11dp</dimen>-->
    <!--<dimen name="create_margin3">32dp</dimen>-->
    <!--<dimen name="create_margin4">20dp</dimen>-->
    <!--<dimen name="create_margin5">8dp</dimen>-->
    <!--<dimen name="create_margin6">20dp</dimen>-->
    <!--<dimen name="create_minWidth">60dp</dimen>-->
    <!--<dimen name="create_width1">59dp</dimen>-->
    <!--<dimen name="create_height">108dp</dimen>-->
    <!--<dimen name="create_height1">87dp</dimen>-->

    <!--these items use same values-->
    <dimen name="create_margin1">28dp</dimen>
    <dimen name="create_margin2">14dp</dimen>
    <dimen name="create_margin3">43dp</dimen>
    <!--<dimen name="create_margin4">27dp</dimen>-->
    <dimen name="create_margin4">12dp</dimen>
    <dimen name="create_margin5">10dp</dimen>
    <dimen name="create_margin6">26dp</dimen>
    <dimen name="create_margin7">40dp</dimen>
    <dimen name="create_margin8">14dp</dimen>
    <dimen name="create_margin9">30dp</dimen>
    <dimen name="create_margin10">20dp</dimen>
    <dimen name="create_margin11">3dp</dimen>
    <dimen name="create_minWidth">80dp</dimen>
    <dimen name="create_width1">78dp</dimen>
    <dimen name="create_height">144dp</dimen>
    <dimen name="create_height1">116dp</dimen>

    <!--<dimen name="add_margin1">15dp</dimen>-->
    <!--<dimen name="add_width1">188dp</dimen>-->
    <!--<dimen name="add_height1">35dp</dimen>-->
    <dimen name="add_margin1">20dp</dimen>
    <dimen name="add_width1">251dp</dimen>
    <dimen name="add_height1">46dp</dimen>

    <dimen name="title_margin">2dp</dimen>
    <dimen name="title_width">56dp</dimen>

    <!--<dimen name="add_item_margin1">22dp</dimen>-->
    <!--<dimen name="add_item_margin2">2dp</dimen>-->
    <!--<dimen name="add_item_margin3">20dp</dimen>-->
    <!--<dimen name="add_item_margin4">4dp</dimen>-->
    <!--<dimen name="add_item_margin5">2dp</dimen>-->
    <!--<dimen name="add_item_margin6">27dp</dimen>-->
    <!--<dimen name="add_item_width1">44dp</dimen>-->
    <!--<dimen name="add_item_height">28dp</dimen>-->
    <!--<dimen name="add_item_height1">62dp</dimen>-->
    <dimen name="add_item_margin1">29dp</dimen>
    <dimen name="add_item_margin2">3dp</dimen>
    <dimen name="add_item_margin3">27dp</dimen>
    <dimen name="add_item_margin4">5dp</dimen>
    <dimen name="add_item_margin5">2dp</dimen>
    <dimen name="add_item_margin6">36dp</dimen>
    <dimen name="add_item_margin7">2dp</dimen>
    <dimen name="add_item_width1">58dp</dimen>
    <dimen name="add_item_height">90dp</dimen>
    <dimen name="add_item_height1">83dp</dimen>

    <!--<dimen name="addbooklist_margin1">26dp</dimen>-->
    <!--<dimen name="addbooklist_margin2">8dp</dimen>-->
    <!--<dimen name="addbooklist_width1">7dp</dimen>-->
    <!--<dimen name="addbooklist_height">47dp</dimen>-->
    <!--<dimen name="addbooklist_height1">7dp</dimen>-->
    <dimen name="addbooklist_margin1">34dp</dimen>
    <dimen name="addbooklist_margin2">10dp</dimen>
    <dimen name="addbooklist_width1">9dp</dimen>
    <dimen name="addbooklist_height">63dp</dimen>
    <dimen name="addbooklist_height1">9dp</dimen>

    <!--<dimen name="book_item_margin1">19dp</dimen>-->
    <!--<dimen name="book_item_margin2">8dp</dimen>-->
    <!--<dimen name="book_item_margin3">90dp</dimen>-->
    <!--<dimen name="book_item_margin4">7dp</dimen>-->
    <!--<dimen name="book_item_margin5">6dp</dimen>-->
    <!--<dimen name="book_item_margin6">2dp</dimen>-->
    <!--<dimen name="book_item_width1">44dp</dimen>-->
    <!--<dimen name="book_item_height">79dp</dimen>-->
    <!--<dimen name="book_item_height1">62dp</dimen>-->

    <!--these items use same values-->
    <dimen name="book_item_margin1">25dp</dimen>
    <dimen name="book_item_margin2">10dp</dimen>
    <dimen name="book_item_margin3">120dp</dimen>
    <dimen name="book_item_margin4">5dp</dimen>
    <dimen name="book_item_margin5">7dp</dimen>
    <dimen name="book_item_margin6">3dp</dimen>
    <dimen name="book_item_margin7">22dp</dimen>
    <dimen name="book_item_margin8">20dp</dimen>
    <dimen name="book_item_margin9">10dp</dimen>
    <dimen name="book_item_margin10">22dp</dimen>
    <dimen name="book_item_width1">58dp</dimen>
    <dimen name="book_item_width2">35dp</dimen>
    <dimen name="book_item_height">105dp</dimen>
    <dimen name="book_item_height1">83dp</dimen>

    <!--<dimen name="chapter_item_margin1">26dp</dimen>-->
    <!--<dimen name="chapter_item_margin2">7dp</dimen>-->
    <!--<dimen name="chapter_item_margin3">8dp</dimen>-->
    <!--<dimen name="chapter_item_width1">7dp</dimen>-->
    <!--<dimen name="chapter_item_height">47dp</dimen>-->
    <!--<dimen name="chapter_item_height1">7dp</dimen>-->
    <dimen name="chapter_item_margin1">34dp</dimen>
    <dimen name="chapter_item_margin2">9dp</dimen>
    <dimen name="chapter_item_margin3">10dp</dimen>
    <dimen name="chapter_item_width1">9dp</dimen>
    <dimen name="chapter_item_height">63dp</dimen>
    <dimen name="chapter_item_height1">9dp</dimen>

    <!--<dimen name="feedback_margin1">6dp</dimen>-->
    <!--<dimen name="feedback_width1">54dp</dimen>-->
    <!--<dimen name="feedback_height1">24dp</dimen>-->
    <!--<dimen name="feedback_padding1">6dp</dimen>-->
    <!--<dimen name="feedback_padding2">3dp</dimen>-->
    <dimen name="feedback_margin1">8dp</dimen>
    <dimen name="feedback_width1">72dp</dimen>
    <dimen name="feedback_height1">32dp</dimen>
    <dimen name="feedback_padding1">8dp</dimen>
    <dimen name="feedback_padding2">4dp</dimen>

    <dimen name="fab_margin1">8dp</dimen>
    <dimen name="fab_margin2">15dp</dimen>
    <dimen name="bookshelf_height1">3dp</dimen>
    <dimen name="bookshelf_height2">2dp</dimen>

    <dimen name="reading_margin1">8dp</dimen>
    <dimen name="reading_margin2">23dp</dimen>
    <dimen name="reading_margin3">8dp</dimen>

    <dimen name="reading_height1">140dp</dimen>

    <dimen name="dev_margin1">3dp</dimen>
    <dimen name="dev_margin2">48dp</dimen>
    <dimen name="dev_width1">32dp</dimen>
    <dimen name="dev_width2">12dp</dimen>
    <dimen name="dev_height1">32dp</dimen>
    <dimen name="dev_height2">12dp</dimen>
    <dimen name="dev_padding1">9dp</dimen>
    <dimen name="dev_padding2">12dp</dimen>
    <dimen name="dev_padding3">3dp</dimen>
    <dimen name="dev_padding4">6dp</dimen>

    <dimen name="plan_margin1">11dp</dimen>
    <!--<dimen name="plan_margin1">0dp</dimen>-->

    <dimen name="plan_margin2">11dp</dimen>
    <dimen name="plan_margin3">4dp</dimen>
    <dimen name="plan_margin4">15dp</dimen>
    <dimen name="plan_width1">173dp</dimen>
    <dimen name="plan_width2">45dp</dimen>
    <dimen name="plan_height1">30dp</dimen>

    <!--<dimen name="reading_item_margin1">22dp</dimen>-->
    <!--<dimen name="reading_item_margin2">2dp</dimen>-->
    <!--<dimen name="reading_item_margin3">15dp</dimen>-->
    <!--<dimen name="reading_item_margin4">8dp</dimen>-->
    <!--<dimen name="reading_item_margin5">13dp</dimen>-->
    <!--<dimen name="reading_item_width1">68dp</dimen>-->
    <!--<dimen name="reading_item_width2">44dp</dimen>-->
    <!--<dimen name="reading_item_height1">68dp</dimen>-->
    <!--<dimen name="reading_item_height2">62dp</dimen>-->
    <dimen name="reading_item_margin1">29dp</dimen>
    <dimen name="reading_item_margin2">3dp</dimen>
    <dimen name="reading_item_margin3">20dp</dimen>
    <dimen name="reading_item_margin4">6dp</dimen>
    <dimen name="reading_item_margin5">17dp</dimen>
    <dimen name="reading_item_margin6">8dp</dimen>
    <dimen name="reading_item_margin">17dp</dimen>
    <dimen name="reading_item_width1">90dp</dimen>
    <dimen name="reading_item_width2">58dp</dimen>
    <dimen name="reading_item_height1">90dp</dimen>
    <dimen name="reading_item_height2">83dp</dimen>

    <dimen name="guide_margin">30dp</dimen>

    <!--these items have not been used-->
    <dimen name="about_width">113dp</dimen>
    <dimen name="about_height">113dp</dimen>
    <dimen name="about_margin1">15dp</dimen>
    <dimen name="about_margin2">15dp</dimen>
    <dimen name="about_margin3">45dp</dimen>
    <dimen name="about_margin4">38dp</dimen>

    <!--字体大小,不知是否改缩小至0.75X-->
    <dimen name="login_text_size1">22sp</dimen>
    <dimen name="login_text_size2">17sp</dimen>
    <dimen name="login_text_size3">18sp</dimen>
    <dimen name="login_text_size4">22sp</dimen>

    <dimen name="register_text_size1">17sp</dimen>

    <dimen name="edit_text_size1">27sp</dimen>
    <dimen name="edit_text_size2">22sp</dimen>

    <dimen name="drawer_text_size1">21sp</dimen>
    <dimen name="drawer_text_size2">11sp</dimen>

    <dimen name="person_text_size1">27sp</dimen>
    <dimen name="person_text_size2">22sp</dimen>
    <dimen name="person_text_size3">32sp</dimen>

    <dimen name="create_text_size1">20sp</dimen>
    <dimen name="create_text_size2">13sp</dimen>
    <dimen name="create_text_size3">14sp</dimen>
    <dimen name="create_text_size4">18sp</dimen>

    <dimen name="title_text_size1">18sp</dimen>

    <dimen name="add_item_text_size1">19sp</dimen>
    <dimen name="add_item_text_size2">13sp</dimen>

    <dimen name="addbooklist_text_size1">18sp</dimen>

    <dimen name="book_item_text_size1">15sp</dimen>
    <dimen name="book_item_text_size2">13sp</dimen>
    <dimen name="book_item_text_size3">19sp</dimen>

    <dimen name="chapter_item_text_size1">18sp</dimen>

    <dimen name="feedback_text_size1">14sp</dimen>

    <dimen name="reading_text_size1">22sp</dimen>
    <dimen name="reading_text_size2">14sp</dimen>

    <dimen name="dev_text_size1">12sp</dimen>
    <dimen name="dev_text_size2">14sp</dimen>

    <dimen name="plan_text_size1">18sp</dimen>
    <dimen name="plan_text_size2">12sp</dimen>

    <dimen name="reading_item_text_size1">15sp</dimen>
    <dimen name="reading_item_text_size2">22sp</dimen>
    <dimen name="reading_item_text_size3">15sp</dimen>

    <dimen name="about_text_size1">26sp</dimen>
    <dimen name="about_text_size2">23sp</dimen>
    <dimen name="about_text_size3">22sp</dimen>

    <dimen name="circle_radius">30dp</dimen>

</resources>


text:
ones = [''] +
  %w(one two three four five six seven eight nine) +
  %w(ten eleven twelve thirteen fourteen fifteen) +
  %w(sixteen seventeen eighteen nineteen)
tens = ['',''] + %w(twenty thirty forty fifty sixty seventy eighty ninety)
sum = 0
(1..1000).each do |i|
  if i >= 1000
    sum += ones[i/1000].length
    sum += 'thousand'.length
    i %= 1000
    sum += 'and'.length unless 0 == i
  end
  if i >= 100
    sum += ones[i/100].length
    sum += 'hundred'.length
    i %= 100
    sum += 'and'.length unless 0 == i
  end
  if i >= 20
    sum += tens[i/10].length
    sum += ones[i%10].length
  else
    sum += ones[i].length
  end
end
puts sum


text:
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */

namespace Piwik\Updates;

use Piwik\Common;
use Piwik\Config;
use Piwik\Updater;
use Piwik\Updates;

/**
 */
class Updates_0_6_3 extends Updates
{
    static function getSql()
    {
        return array(
            'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
				CHANGE `location_ip` `location_ip` INT UNSIGNED NOT NULL'                   => 1054,
            'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '`
				CHANGE `caller_ip` `caller_ip` INT UNSIGNED'                                => array(1054, 1146),
        );
    }

    static function update()
    {
        $config = Config::getInstance();
        $dbInfos = $config->database;
        if (!isset($dbInfos['schema'])) {
            try {
                if (is_writable(Config::getLocalConfigPath())) {
                    $config->database = $dbInfos;
                    $config->forceSave();
                } else {
                    throw new \Exception('mandatory update failed');
                }
            } catch (\Exception $e) {
            }
        }

        Updater::updateDatabase(__FILE__, self::getSql());
    }
}


text:
from __future__ import absolute_import
import re
import json
import copy

from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.fetcher.rtmp import RTMP
from svtplay_dl.fetcher.hls import HLS, hlsparse
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.subtitle import subtitle
from svtplay_dl.error import ServiceError

class Dr(Service, OpenGraphThumbMixin):
    supported_domains = ['dr.dk']

    def get(self, options):
        data = self.get_urldata()

        if self.exclude(options):
            yield ServiceError("Excluding video")
            return

        match = re.search(r'resource:[ ]*"([^"]*)",', data)
        if match:
            resource_url = match.group(1)
            resource_data = self.http.request("get", resource_url).content
            resource = json.loads(resource_data)
            streams = self.find_stream(options, resource)
            for i in streams:
                yield i
        else:
            match = re.search(r'resource="([^"]*)"', data)
            if not match:
                yield ServiceError("Cant find resource info for this video")
                return
            resource_url = "http:%s" % match.group(1)
            resource_data = self.http.request("get", resource_url).text
            resource = json.loads(resource_data)

            if "SubtitlesList" in resource:
                suburl = resource["SubtitlesList"][0]["Uri"]
                yield subtitle(copy.copy(options), "wrst", suburl)
            if "Data" in resource:

                streams = self.find_stream(options, resource)
                for i in streams:
                    yield i
            else:
                for stream in resource['Links']:
                    if stream["Target"] == "HDS":
                        streams = hdsparse(copy.copy(options), self.http.request("get", stream["Uri"], params={"hdcore": "3.7.0"}).text, stream["Uri"])
                        if streams:
                            for n in list(streams.keys()):
                                yield streams[n]
                    if stream["Target"] == "HLS":
                        streams = hlsparse(stream["Uri"], self.http.request("get", stream["Uri"]).text)
                        for n in list(streams.keys()):
                            yield HLS(copy.copy(options), streams[n], n)
                    if stream["Target"] == "Streaming":
                        options.other = "-v -y '%s'" % stream['Uri'].replace("rtmp://vod.dr.dk/cms/", "")
                        rtmp = "rtmp://vod.dr.dk/cms/"
                        yield RTMP(copy.copy(options), rtmp, stream['Bitrate'])

    def find_stream(self, options, resource):
        tempresource = resource['Data'][0]['Assets']
        # To find the VideoResource, they have Images as well
        for resources in tempresource:
            if resources['Kind'] == 'VideoResource':
                links = resources['Links']
                break
        for i in links:
            if i["Target"] == "Ios" or i["Target"] == "HLS":
                streams = hlsparse(i["Uri"], self.http.request("get", i["Uri"]).text)
                for n in list(streams.keys()):
                    yield HLS(copy.copy(options), streams[n], n)
            else:
                if i["Target"] == "Streaming":
                    options.other = "-y '%s'" % i["Uri"].replace("rtmp://vod.dr.dk/cms/", "")
                    rtmp = "rtmp://vod.dr.dk/cms/"
                    yield RTMP(copy.copy(options), rtmp, i["Bitrate"])


text:
<?php

namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;

use GuzzleHttp\Psr7\Uri;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Parser\OriginResponseParser;
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DownloadMediaPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;

class DownloadMediaPluginTest extends TestCase
{
    /**
     * @var \Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DownloadMediaPlugin
     */
    protected $plugin;

    protected function setUp(): void
    {
        parent::setUp();

        $this->plugin = new DownloadMediaPlugin();
    }

    public function testNormal()
    {
        $rocket = new Rocket();
        $rocket->setParams([])->setPayload(new Collection(['media_url' => 'https://yansongda.cn']));

        $result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

        $radar = $result->getRadar();

        self::assertEquals(OriginResponseParser::class, $result->getDirection());
        self::assertEquals('GET', $radar->getMethod());
        self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
    }

    public function testNormalNoDownloadUrl()
    {
        $rocket = new Rocket();
        $rocket->setParams([])->setPayload(new Collection());

        self::expectException(InvalidParamsException::class);
        self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS);

        $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
    }
}


text:
![Build Status](https://img.shields.io/circleci/project/github/victorhqc/color-indent/master.svg) ![License](https://img.shields.io/apm/l/color-indent.svg) ![Version](https://img.shields.io/apm/v/color-indent.svg) ![Downloads](https://img.shields.io/apm/dm/color-indent.svg)

Use colors to show in a non intrusive manner different indentation levels.

![Color Indent](https://i.imgur.com/5HmsYHQ.png)

## Installation

You can install via `apm`:
```sh
apm install color-indent
```

Or, just search for `color-indent` inside Atom's package panel.

## Features
I once saw something like this some years ago. Unfortunately I don't remember where, but since I
always wanted it, I'm building it now.

- Choose your own color.
- Use a custom width.
- Choose identation depth.

## Usage
Just type and see how the tabulation color is filled.

![Color Indent animation](https://i.imgur.com/RfDGOyQ.gif)

Choose a custom color

![Custom color](https://i.imgur.com/bID1oSf.gif)

You can also toggle the colors if you need to deactivate it or reactivate it quickly.
Go to the Atom Command Palette and choose `color-indent: toggle`.


text:
define([
    '../core',
    '../var/rnotwhite',
    '../var/strundefined',
    '../core/access',
    './support',
    '../selector'
], function(jQuery, rnotwhite, strundefined, access, support) {

    var nodeHook,
        boolHook,
        attrHandle = jQuery.expr.attrHandle;

    jQuery.fn.extend({
        attr: function(name, value) {
            return access(this, jQuery.attr, name, value, arguments.length > 1);
        },

        removeAttr: function(name) {
            return this.each(function() {
                jQuery.removeAttr(this, name);
            });
        }
    });

    jQuery.extend({
        attr: function(elem, name, value) {
            var hooks,
                ret,
                nType = elem.nodeType;

            // don't get/set attributes on text, comment and attribute nodes
            if (!elem || nType === 3 || nType === 8 || nType === 2) {
                return;
            }

            // Fallback to prop when attributes are not supported
            if (typeof elem.getAttribute === strundefined) {
                return jQuery.prop(elem, name, value);
            }

            // All attributes are lowercase
            // Grab necessary hook if one is defined
            if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
                name = name.toLowerCase();
                hooks = jQuery.attrHooks[name] ||
                (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook);
            }

            if (value !== undefined) {

                if (value === null) {
                    jQuery.removeAttr(elem, name);

                } else if (hooks && 'set' in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
                    return ret;

                } else {
                    elem.setAttribute(name, value + '');
                    return value;
                }

            } else if (hooks && 'get' in hooks && (ret = hooks.get(elem, name)) !== null) {
                return ret;

            } else {
                ret = jQuery.find.attr(elem, name);

                // Non-existent attributes return null, we normalize to undefined
                return ret == null ?
                    undefined :
                    ret;
            }
        },

        removeAttr: function(elem, value) {
            var name,
                propName,
                i = 0,
                attrNames = value && value.match(rnotwhite);

            if (attrNames && elem.nodeType === 1) {
                while ((name = attrNames[i++])) {
                    propName = jQuery.propFix[name] || name;

                    // Boolean attributes get special treatment (#10870)
                    if (jQuery.expr.match.bool.test(name)) {
                        // Set corresponding property to false
                        elem[propName] = false;
                    }

                    elem.removeAttribute(name);
                }
            }
        },

        attrHooks: {
            type: {
                set: function(elem, value) {
                    if (!support.radioValue && value === 'radio' &&
                        jQuery.nodeName(elem, 'input')) {
                        var val = elem.value;
                        elem.setAttribute('type', value);
                        if (val) {
                            elem.value = val;
                        }
                        return value;
                    }
                }
            }
        }
    });

// Hooks for boolean attributes
    boolHook = {
        set: function(elem, value, name) {
            if (value === false) {
                // Remove boolean attributes when set to false
                jQuery.removeAttr(elem, name);
            } else {
                elem.setAttribute(name, name);
            }
            return name;
        }
    };
    jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
        var getter = attrHandle[name] || jQuery.find.attr;

        attrHandle[name] = function(elem, name, isXML) {
            var ret, handle;
            if (!isXML) {
                // Avoid an infinite loop by temporarily removing this function from the getter
                handle = attrHandle[name];
                attrHandle[name] = ret;
                ret = getter(elem, name, isXML) != null ?
                    name.toLowerCase() :
                    null;
                attrHandle[name] = handle;
            }
            return ret;
        };
    });

});


text:
Welcome to the checkout screen.

On the left you can see the store address, the order for the current table,
      and information regarding the totals of the check.

On the right you can see where you can cash a checkout. Currently only cash is
      accepted. Clicking on cash, will enable the number buttons. Enter a cash amount greater
      than the total listed on the left side and then click on the cash out button.

Once a check is cashed out, the totals on the left will be updated and
      the check will be closed out.

To return to the order screen, click on the main menu button.

{{storeName}}

{{address}}

{{city}}, {{state}} {{zipCode}}

{{checkStatus}}

{{item.dish}}

{{item.cost}}

{{item.notes}}

Tax: {{tax}}

Total: {{total}}

Recommended Tip: {{tip}}

Total with Tip: {{recommendedTotal}}

Paid: {{paid}}

Change: {{change}}

        <button type="button" ng-hide="menu" ng-click="categorySelect()" class="btn btn-default choices">Main Menu</button>
        <button type="button" ng-click="cash()" class="btn btn-default choices">Cash</button>
        <button type="button" disabled class="btn btn-default choices">Credit Card</button>
        <button type="button" disabled class="btn btn-default choices">Print Invididual Check</button>

        <input type="text" class="cash-control" ng-model="cashAmount">

        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(1)" class="btn btn-default choices">1</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(2)" class="btn btn-default choices">2</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(3)" class="btn btn-default choices">3</button>
        <button type="button" ng-disabled="cashStatus" ng-click="clear()" class="btn btn-default choices">C</button>

        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(4)" class="btn btn-default choices">4</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(5)" class="btn btn-default choices">5</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(6)" class="btn btn-default choices">6</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(0)" class="btn btn-default choices">0</button>

        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(7)" class="btn btn-default choices">7</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(8)" class="btn btn-default choices">8</button>
        <button type="button" ng-disabled="cashStatus" ng-click="numberClick(9)" class="btn btn-default choices">9</button>
        <button type="button" ng-disabled="cashStatus" ng-click="addDecimal()" class="btn btn-default choices">.</button>

      <button type="button" ng-disabled="fullyPaid" ng-click="calculate()" class="btn btn-default choices">Cash Out</button>


text:
// =======================================================================
// pam-facial-auth
// FacialAuth
//
// Created by Devin Conley
// =======================================================================

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <map>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <opencv2/opencv.hpp>
#include <ctime>

#include "Utils.h"
#include "FaceRecWrapper.h"

/* expected hook */
PAM_EXTERN int pam_sm_setcred( pam_handle_t * pamh, int flags, int argc, const char ** argv )
{
	return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_acct_mgmt( pam_handle_t * pamh, int flags, int argc, const char ** argv )
{
	return PAM_SUCCESS;
}

/* expected hook, this is where custom stuff happens */
PAM_EXTERN int pam_sm_authenticate( pam_handle_t * pamh, int flags, int argc, const char ** argv )
{
	// First verify we can get username
	const char * user;
	int ret = pam_get_user( pamh, &user, "Username: " );
	if ( ret != PAM_SUCCESS )
	{
		return ret;
	}
	std::string username( user );

	// Get config
	std::map<std::string, std::string> config;

	Utils::GetConfig( "/etc/pam-facial-auth/config", config );

	// Parse non-string values
	std::time_t timeout   = std::stoi( config["timeout"] );
	double      threshold = std::stod( config["threshold"] );
	bool        imCapture = config["imageCapture"] == "true";

	// Load model
	FaceRecWrapper frw = FaceRecWrapper();
	frw.Load( "/etc/pam-facial-auth/model" );

	// Setup / loop control
	std::time_t      start = std::time( NULL );
	std::string      imagePathLast;
	cv::VideoCapture vc;
	if ( imCapture && !vc.open( 0 ) )
	{
		printf( "Could not open camera.\n" );
		return PAM_AUTH_ERR;
	}
	printf( "Starting facial recognition for %s...\n", username.c_str() );

	while ( std::time( NULL ) - start < timeout )
	{
		cv::Mat im;

		if ( imCapture ) // Take image actively
		{
			vc.read( im );
			cv::cvtColor( im, im, CV_BGR2GRAY );
		}
		else // Check existing directory for stream of images
		{
			// Find most recent image
			std::string imagePath = config["imageDir"];
			std::string temp;

			// Walk subdirectories
			std::vector<std::string> dates;
			std::vector<std::string> nullVec;
			Utils::WalkDirectory( config["imageDir"], nullVec, dates );

			// Get most recent daily folder, assuming named under yyyy-MM-dd
			for ( std::vector<std::string>::iterator it = dates.begin(); it != dates.end(); ++it )
			{
				if ( *it > temp )
				{
					temp = *it;
				}
			}
			imagePath += "/" + temp;

			// Walk image files
			std::vector<std::string> times;
			Utils::WalkDirectory( imagePath, times, nullVec );

			temp = "";
			// Get most recent image, assuming named under HH-mm-ss.ext
			for ( std::vector<std::string>::iterator it = times.begin(); it != times.end(); ++it )
			{
				if ( *it > temp )
				{
					temp = *it;
				}
			}
			imagePath += "/" + temp;

			// Check if new image
			if ( imagePath == imagePathLast )
			{
				continue;
			}
			imagePathLast = imagePath;

			im = cv::imread( imagePath, CV_LOAD_IMAGE_GRAYSCALE );
		}
		if ( !im.size().area() > 0 )
		{
			continue;
		}

		// Do prediction
		double confidence = 0.0;
		int    prediction = -1;
		frw.Predict( im, prediction, confidence );

		printf( "Predicted: %d, %s (%f)\n",
			prediction, frw.GetLabelName( prediction ).c_str(), confidence );

		if ( confidence < threshold && frw.GetLabelName( prediction ) == username )
		{
			return PAM_SUCCESS;
		}
	}

	printf( "Timeout on face authentication... \n" );
	return PAM_AUTH_ERR;
}


text:
namespace SimpleInjector.Tests.Unit.Diagnostics
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SimpleInjector.Diagnostics;

    [TestClass]
    public class ContainerDebugViewProxyTests
    {
        [TestMethod]
        public void Ctor_Always_Succeeds()
        {
            new ContainerDebugViewProxy(new Container());
        }

        [TestMethod]
        public void Cctor_LoadingDiagnosticsAssembly_Succeeds()
        {
            // When the static exception field is set, the cctor failed to initialize.
            if (ContainerDebugViewProxy.Exception != null)
            {
                throw ContainerDebugViewProxy.Exception;
            }
        }

        [TestMethod]
        public void RetrievingItems_Always_Succeeds()
        {
            // Arrange
            var proxy = new ContainerDebugViewProxy(new Container());

            // Act
            var items = proxy.Items;
        }

        [TestMethod]
        public void Options_Always_ReturnsTheOptionsFromTheContainer()
        {
            // Arrange
            var container = new Container();

            var proxy = new ContainerDebugViewProxy(container);

            // Act
            var options = proxy.Options;

            // Assert
            Assert.AreSame(container.Options, options);
        }
    }
}


text:
'use strict';

const path = require('path');

let normalizePathSep;
if (path.sep == '/') {
  normalizePathSep = filePath => filePath;
} else {
  normalizePathSep = filePath => filePath.replace(/\//g, path.sep);
}

module.exports = normalizePathSep;


text:
<?php
namespace Cachet\Test\Backend;

use Cachet\Backend;
use Cachet\Item;

/**
 * @group backend
 */
class ShardingTest extends \Cachet\Test\BackendTestCase
{
    use \Cachet\Test\IteratorBackendTest;

    public function getBackend()
    {
        $backend1 = new Backend\Memory();
        $backend2 = new Backend\Memory();
        $backend3 = new Backend\Memory();
        $sharding = new Backend\Sharding(array($backend1, $backend2, $backend3));
        return $sharding;
    }

    public function testSetGetInternal()
    {
        $backend1 = new Backend\Memory();
        $backend2 = new Backend\Memory();
        $backend3 = new Backend\Memory();
        $sharding = new Backend\Sharding(array($backend1, $backend2, $backend3));

        // These keys are known to hash into the different backends in order.
        // The test is slightly brittle as a result - if the hashing algo changes,
        // new keys will have to be used.
        $key1 = 'a';
        $key2 = 'q';
        $key3 = 'c';

        $sharding->set(new Item('cache', $key1, 'yup'));
        $sharding->set(new Item('cache', $key2, 'qux'));
        $sharding->set(new Item('cache', $key3, 'bar'));

        // xxx ends up in backend 1
        $this->assertNotNull($backend1->get('cache', $key1));
        $this->assertNull($backend2->get('cache', $key1));
        $this->assertNull($backend3->get('cache', $key1));

        // qqq ends up in backend 2
        $this->assertNull($backend1->get('cache', $key2));
        $this->assertNotNull($backend2->get('cache', $key2));
        $this->assertNull($backend3->get('cache', $key2));

        // nnn ends up in backend 3
        $this->assertNull($backend1->get('cache', $key3));
        $this->assertNull($backend2->get('cache', $key3));
        $this->assertNotNull($backend3->get('cache', $key3));

        $this->assertNotNull($sharding->get('cache', $key1));
        $this->assertNotNull($sharding->get('cache', $key2));
        $this->assertNotNull($sharding->get('cache', $key3));
    }

    public function testSetDeleteInternal()
    {
        $backend1 = new Backend\Memory();
        $backend2 = new Backend\Memory();
        $sharding = new Backend\Sharding(array($backend1, $backend2));

        $sharding->set(new Item('cache', 'foo', 'bar'));
        $this->assertCount(0, $backend1->data);
        $this->assertCount(1, $backend2->data);

        $sharding->delete('cache', 'foo');

        $this->assertNull($backend1->get('cache', 'foo'));
        $this->assertNull($backend2->get('cache', 'foo'));
    }

    public function testFlushInternal()
    {
        $backend1 = new Backend\Memory();
        $backend1->set(new Item('cache', 'foo', 'bar'));
        $backend2 = new Backend\Memory();
        $backend2->set(new Item('cache', 'baz', 'qux'));

        $sharding = new Backend\Sharding(array($backend1, $backend2));
        $sharding->flush('cache');

        $this->assertNull($backend1->get('cache', 'foo'));
        $this->assertNull($backend2->get('cache', 'baz'));
    }
}


text:
package storage::emc::isilon::snmp::mode::clusterusage;

use base qw(centreon::plugins::templates::counter);

use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);

sub custom_status_output {
    my ($self, %options) = @_;

    my $msg = 'status: ' . $self->{result_values}->{status};
    return $msg;
}

sub custom_status_calc {
    my ($self, %options) = @_;

    $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
    return 0;
}

sub custom_usage_perfdata {
    my ($self, %options) = @_;

    my $label = 'ifs_used';
    my $value_perf = $self->{result_values}->{used};
    if (defined($self->{instance_mode}->{option_results}->{free})) {
        $label = 'ifs_free';
        $value_perf = $self->{result_values}->{free};
    }

    my %total_options = ();
    if ($self->{instance_mode}->{option_results}->{units} eq '%') {
        $total_options{total} = $self->{result_values}->{total};
        $total_options{cast_int} = 1;
    }

    $self->{output}->perfdata_add(label => $label, unit => 'B',
                                  value => $value_perf,
                                  warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
                                  critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
                                  min => 0, max => $self->{result_values}->{total});
}

sub custom_usage_threshold {
    my ($self, %options) = @_;

    my ($exit, $threshold_value);
    $threshold_value = $self->{result_values}->{used};
    $threshold_value = $self->{result_values}->{free} if (defined($self->{instance_mode}->{option_results}->{free}));
    if ($self->{instance_mode}->{option_results}->{units} eq '%') {
        $threshold_value = $self->{result_values}->{prct_used};
        $threshold_value = $self->{result_values}->{prct_free} if (defined($self->{instance_mode}->{option_results}->{free}));
    }
    $exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
    return $exit;
}

sub custom_usage_output {
    my ($self, %options) = @_;

    my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
    my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
    my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
    my $msg = sprintf("IFS Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
                   $total_size_value . " " . $total_size_unit,
                   $total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
                   $total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
    return $msg;
}

sub custom_usage_calc {
    my ($self, %options) = @_;

    $self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
    $self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
    $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
    $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
    $self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};

    return 0;
}

sub set_counters {
    my ($self, %options) = @_;

    $self->{maps_counters_type} = [
        { name => 'cluster', type => 0, cb_prefix_output => 'prefix_cluster_output', message_separator => ' - ' },
    ];

    $self->{maps_counters}->{cluster} = [
        { label => 'status', threshold => 0, set => {
                key_values => [ { name => 'status' } ],
                closure_custom_calc => $self->can('custom_status_calc'),
                closure_custom_output => $self->can('custom_status_output'),
                closure_custom_perfdata => sub { return 0; },
                closure_custom_threshold_check => \&catalog_status_threshold,
            }
        },
        { label => 'health', set => {
                key_values => [ { name => 'health' } ],
                output_template => 'Node health: %.2f%%',
                perfdatas => [
                    { label => 'health', value => 'health', template => '%.2f',
                      min => 0, max => 100, unit => '%' },
                ],
            }
        },
        { label => 'ifs-usage', set => {
                key_values => [ { name => 'used' }, { name => 'total' } ],
                closure_custom_calc => $self->can('custom_usage_calc'),
                closure_custom_output => $self->can('custom_usage_output'),
                closure_custom_perfdata => $self->can('custom_usage_perfdata'),
                closure_custom_threshold_check => $self->can('custom_usage_threshold'),
            }
        },
    ];
}

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $options{options}->add_options(arguments => {
        'warning-status:s'    => { name => 'warning_status', default => '%{status} =~ /attn/' },
        'critical-status:s'   => { name => 'critical_status', default => '%{status} =~ /down|invalid/' },
        'units:s'             => { name => 'units', default => '%' },
        'free'                => { name => 'free' },
    });

    return $self;
}

sub check_options {
    my ($self, %options) = @_;
    $self->SUPER::check_options(%options);

    $self->change_macros(macros => ['warning_status', 'critical_status']);
}

sub prefix_cluster_output {
    my ($self, %options) = @_;

    return "Cluster ";
}

my %mapping_health = (
    0 => 'ok',
    1 => 'attn',
    2 => 'down',
    3 => 'invalid',
);

my $mapping = {
    clusterHealth       => { oid => '.1.3.6.1.4.1.12124.1.1.2', map => \%mapping_health },
    nodeCount           => { oid => '.1.3.6.1.4.1.12124.1.1.4' },
    onlineNodes         => { oid => '.1.3.6.1.4.1.12124.1.1.6' },
    ifsTotalBytes       => { oid => '.1.3.6.1.4.1.12124.1.3.1' },
    ifsUsedBytes        => { oid => '.1.3.6.1.4.1.12124.1.3.2' },
    ifsAvailableBytes   => { oid => '.1.3.6.1.4.1.12124.1.3.3' },
};

my $oid_clusterStatus = '.1.3.6.1.4.1.12124.1.1';
my $oid_ifsFilesystem = '.1.3.6.1.4.1.12124.1.3';

sub manage_selection {
    my ($self, %options) = @_;

    $self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $oid_clusterStatus },
                                                                   { oid => $oid_ifsFilesystem },
                                                         ],
                                                         nothing_quit => 1, return_type => 1);

    my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => '0');

    my @online_nodes = split(/,/, $result->{onlineNodes});
    my $health = scalar(@online_nodes) * 100 / $result->{nodeCount};

    $self->{cluster} = {
        status => $result->{clusterHealth},
        health => $health,
        total => $result->{ifsTotalBytes},
        used => $result->{ifsUsedBytes},
    };
}

1;

__END__

=head1 MODE

Check cluster usages.

=over 8

=item B<--filter-counters>

Only display some counters (regexp can be used).
Example: --filter-counters='^status$'

=item B<--warning-status>

Set warning threshold for status (Default: '%{status} =~ /attn/).
Can used special variables like: %{status}

=item B<--critical-status>

Set critical threshold for status (Default: '%{status} =~ /down|invalid/').
Can used special variables like: %{status}

=item B<--warning-*>

Threshold warning.
Can be: 'ifs-usage', 'health'.

=item B<--critical-*>

Threshold critical.
Can be: 'ifs-usage', 'health'.

=item B<--units>

Units of thresholds (Default: '%') ('%', 'B').

=item B<--free>

Thresholds are on free space left.

=back

=cut


text:
$(document).ready(function(){

	$('.submitBtn').attr('disabled', true);
	initTodoSort();
});

function initTodoSort()
{
	/* nested sortables
	------------------------------------------------------------------------- */
	var todo_serialized;
	$('#nestable').nestedSortable({
		listType: 'ul',
		handle: 'div',
		items: 'li',
		placeholder: 'ns-helper',
		opacity: .8,
		handle: '.ns-title',
		toleranceElement: '> div',
		forcePlaceholderSize: true,
		tabSize: 15,
		update: function() {
			enableSaveAndUpdateOutput();
		}
	});
}

function idFoundInSortList(id)
{
	var id = parseInt(id);
	var thisId = 0;
	var returntype = false;

	$("#nestable li").each(function( index ) {
		 thisId = parseInt($(this).attr("data-id"));

		 if(id == thisId)
		 {
			returntype = true;
		 }
	});

	return returntype;
}

function enableSaveAndUpdateOutput()
{
	//var submitUrl = $("form").attr("action");
	//var todoOrder = JSON.stringify($('#nestable').nestedSortable('toArray'));

	//$.post( "test.php", { todoOrder: todoOrder })
	//	.done(function( data ) {
	//		alert( "Data Loaded: " + data );
	//	}
	//);

	$("#serializedOutput").val(JSON.stringify($('#nestable').nestedSortable('toArray')));
	$('.submitBtn').attr('disabled', false);

	$.post(
		$("form").attr("action"),
		$("form").serialize(),
		function(data, textStatus, jqXHR) {
			//alert("Success.");
		}).fail(function(jqXHR, textStatus, errorThrown) {
			alert("Sorry, an error prevented your changes from saving. Please try again.");
		}
	);
}


text:
!!! note "See also"

    - [Example Google Style Python Docstrings][1]

    - [Example NumPy Style Python Docstrings][2]

[1]: http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html#example-google
[2]: http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy

This is a module named `example.py`, which represents
how to write the docstrings of `module`, `function`, `class` and `method`.

~~~
# -*- coding: utf-8 -*-
"""Short description of module.

Long description of module.
Can be multiline.
"""

def example_create(name, age=0, sex='male', **kwargs):
    """Short description of function.

    Long description of function.
    Can be multiline too.

    # Arguments
        name: `any`. Description of name.
        age: `int`. Description of age. Defaults to zero.
            If it is multiline then must indent the following lines.
        sex: `str`. Description of sex. Defaults to 'male'.
        **kwargs: `dict`.

    # Return
        `Person`: an instance object of `Person` class with given information.

    # Note
        Here is note.

    # Examples
        Here is examples.
        ```
        jzm = example_create('jzm')
        batman = example_create('Bruce Wayne', 28, 'male')
        ```

    """
    pass

Class Person(object):
    """Short description of class.

    Long description of class.
    Can be multiline too.

    # Arguments
        name: `any`. Description of name.
        age: `int`. Description of age. Defaults to zero.
            If it is multiline then must indent the following lines.
        sex: `str`. Description of sex. Defaults to 'male'.
        **kwargs: `dict`.

    # Note
        Here is note.

    # Examples
        Here is examples.
        ```
        jzm = Person('jzm')
        batman = Person('Bruce Wayne', 28, 'male')
        ```

    """

    def __init__(self, name, age=0, sex='male', **kwargs):
        pass

    def speak(self, message):
        """Short description of method.

        Long description of method.
        Can be multiline too.

        # Arguments
            message: `str`. Description of message.

        # Return
            `None`.

        # Note
            Here is note.

        # Examples
            Here is examples.
            ```
            batman = example_create('Bruce Wayne', 28, 'male')
            batman.speak('I am batman!')
            ```
        """
        pass
~~~

<!--

~~~
# -*- coding: utf-8 -*-
"""Example Sophon style docstrings.

# Sophon style Python docstrings
    这个模板用来阐述如何编写Sophon风格的Python docstrings。
    因为Sophon风格的Python docstrings主要由Sophon来解析成Markdown文本,
    所以Sophon风格的Python docstrings采取了类Markdown的写法,
    绝大部分的Markdown文本都会被原样保留,比如:粗体、斜体、超链接、图片链接、
    列表、引用、表格、代码框等等,但是除了以下几样会被Sophon解析的时候进行加工:

    - 小节标题。一个小节的标题由一个井号与一行字符串组成,该小节的所有内容从该标题的第二行开始。
    与Markdown不同,小节的内容必须比该小节的标题向右多一个缩进(4个空格宽度)。
    所有的小节标题都会被解析成加粗文本,比如:
    ```text
    # Example
        This is some contents of "Example" section.
    ```
    会被Sophon解析成如下的Markdown文本:
    ```text
    **Example**
    This is some contents of "Example" section.
    ```

    - 小节列表。直接看例子:
    ```text
    # Arguments
        a: `int`. Description of a.
        b: `str`. Description of b.
            Here is still description of b.
        c: `any`.
    ```

# Example
    例子小节可以使用"Example"或者"Examples"作为小节标题。
    小节的内容支持任何Markdown格式的文本。
    Examples can be given using either the ``Example`` or ``Examples``
    sections. Sections support any Markdown formatting.

如果某个小节后面有向左缩进了的文本,则表示该小节的末尾到此为止。
另外如果某个小节后面有另外一个小节标题,则表示一个新的小节被创建了。
Section breaks are created by resuming unindented text. Section breaks
are also implicitly created anytime a new section starts.

# Attributes
    module_level_variable1: `int`. Module level variables are only documented in
        the ``Attributes`` section of the module docstring.

"""

module_level_variable1 = 12345

module_level_variable2 = 98765
"""int: Module level variable documented inline.

The docstring may span multiple lines. The type may optionally be specified
on the first line, separated by a colon.
"""

def function_with_types_in_docstring(param1, param2):
    """Example function with types documented in the docstring.

    `PEP 484`_ type annotations are supported. If attribute, parameter, and
    return types are annotated according to `PEP 484`_, they do not need to be
    included in the docstring:

    Args:
        param1 (int): The first parameter.
        param2 (str): The second parameter.

    Returns:
        bool: The return value. True for success, False otherwise.

    .. _PEP 484:
        https://www.python.org/dev/peps/pep-0484/

    """
~~~
-->


text:
This section describes how to deploy an application on a BMS.

## Install and Start Nginx

1.  Run the  **yum install nginx**  command to install Nginx and enter  **y**  as prompted.

    If the information shown in the following figure is displayed, Nginx is installed successfully.

    ![](figures/2-5.png)

2.  Enter  **systemctl start nginx.service**  to start Nginx.

    >![](/images/icon-note.gif) **NOTE:**
    >This command applies to CentOS 7.4 64-bit, which is used as an example.

3.  Enter  **wget http://127.0.0.1**  to test Nginx.

    ![](figures/2-5-2.png)

## Access the Default Web Page

Open a browser and enter http://_BMS EIP_  in the address box. If the Nginx welcome page is displayed, Nginx is installed successfully.


text:
describe('test/it.todo error throwing', () => {
  it('it throws error when given no arguments', () => {
    expect(() => {
      // @ts-expect-error
      it.todo();
    }).toThrow('Todo must be called with only a description.');
  });
  it('it throws error when given more than one argument', () => {
    expect(() => {
      // @ts-expect-error: Testing runtime errors here
      it.todo('test1', () => {});
    }).toThrow('Todo must be called with only a description.');
  });
  it('it throws error when given none string description', () => {
    expect(() => {
      it.todo(() => {});
    }).toThrow('Todo must be called with only a description.');
  });
});


text:
package org.intellij.plugins.xsltDebugger.impl;

import java.net.URI;
import java.util.List;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.swing.Icon;

import org.intellij.plugins.xsltDebugger.VMPausedException;
import org.intellij.plugins.xsltDebugger.XsltDebuggerSession;
import org.intellij.plugins.xsltDebugger.rt.engine.Debugger;
import org.intellij.plugins.xsltDebugger.rt.engine.DebuggerStoppedException;
import org.intellij.plugins.xsltDebugger.rt.engine.Value;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ColoredTextContainer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.PlatformIcons;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.frame.XCompositeNode;
import com.intellij.xdebugger.frame.XNavigatable;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.frame.XValueChildrenList;
import com.intellij.xdebugger.frame.XValueNode;
import com.intellij.xdebugger.frame.XValuePlace;

public class XsltStackFrame extends XStackFrame
{
	private final Debugger.Frame myFrame;
	private final XsltDebuggerSession myDebuggerSession;
	private XSourcePosition myPosition;

	public XsltStackFrame(Debugger.Frame frame, XsltDebuggerSession debuggerSession)
	{
		myFrame = frame;
		myDebuggerSession = debuggerSession;
		myPosition = XsltSourcePosition.create(frame);
	}

	@Override
	public Object getEqualityObject()
	{
		return XsltStackFrame.class;
	}

	@Override
	public XDebuggerEvaluator getEvaluator()
	{
		return myFrame instanceof Debugger.StyleFrame ? new MyEvaluator((Debugger.StyleFrame) myFrame) : null;
	}

	@Override
	public XSourcePosition getSourcePosition()
	{
		return myPosition;
	}

	@Override
	public void customizePresentation(ColoredTextContainer component)
	{
		if(myDebuggerSession.getCurrentState() == Debugger.State.SUSPENDED)
		{
			try
			{
				_customizePresentation(component);
			}
			catch(VMPausedException ignore)
			{
			}
			catch(DebuggerStoppedException ignore)
			{
			}
		}
	}

	private void _customizePresentation(ColoredTextContainer component)
	{
		final Debugger.Frame frame = myFrame;
		if(frame instanceof Debugger.StyleFrame)
		{
			component.append(((Debugger.StyleFrame) frame).getInstruction(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
		}
		else if(frame instanceof Debugger.SourceFrame)
		{
			component.append(((Debugger.SourceFrame) frame).getXPath(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
		}
		component.append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);

		try
		{
			final VirtualFile file = VfsUtil.findFileByURL(new URI(frame.getURI()).toURL());
			if(file != null)
			{
				component.append(file.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
				if(frame.getLineNumber() > 0)
				{
					component.append(":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
				}

				component.setToolTipText(file.getPresentableUrl());
			}
			else
			{
				component.append(frame.getURI() + ":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
			}
		}
		catch(Exception e)
		{
			component.append(frame.getURI() + ":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
		}
	}

	@Override
	public void computeChildren(@Nonnull XCompositeNode node)
	{
		try
		{
			if(myFrame instanceof Debugger.StyleFrame)
			{
				final List<Debugger.Variable> variables = ((Debugger.StyleFrame) myFrame).getVariables();
				final XValueChildrenList list = new XValueChildrenList();
				for(final Debugger.Variable variable : variables)
				{
					list.add(variable.getName(), new MyValue(variable));
				}
				node.addChildren(list, true);
			}
			else
			{
				super.computeChildren(node);
			}
		}
		catch(VMPausedException e)
		{
			node.setErrorMessage(VMPausedException.MESSAGE);
		}
	}

	public Debugger.Frame getFrame()
	{
		return myFrame;
	}

	private static class MyValue extends XValue
	{
		private final Debugger.Variable myVariable;

		public MyValue(Debugger.Variable variable)
		{
			myVariable = variable;
		}

		@Override
		public void computePresentation(@Nonnull XValueNode node, @Nonnull XValuePlace place)
		{
			final Debugger.Variable.Kind kind = myVariable.getKind();
			Icon icon = null;
			if(myVariable.isGlobal())
			{
				if(kind == Debugger.Variable.Kind.VARIABLE)
				{
					icon = PlatformIcons.FIELD_ICON;
				}
				else
				{
					icon = PlatformIcons.PROPERTY_ICON;
				}
			}
			else if(kind == Debugger.Variable.Kind.VARIABLE)
			{
				icon = PlatformIcons.VARIABLE_ICON;
			}
			else if(kind == Debugger.Variable.Kind.PARAMETER)
			{
				icon = PlatformIcons.PARAMETER_ICON;
			}

			final Value v = myVariable.getValue();
			if(v.getType() == Value.XPathType.STRING)
			{
				node.setPresentation(icon, v.getType().getName(), "'" + String.valueOf(v.getValue()) + "'", false);
			}
			else
			{
				final boolean hasChildren = myVariable.getValue().getValue() instanceof Value.NodeSet;
				node.setPresentation(icon, v.getType().getName(), String.valueOf(v.getValue()), hasChildren);
			}
		}

		@Override
		public void computeChildren(@Nonnull XCompositeNode node)
		{
			if(myVariable.getValue().getValue() instanceof Value.NodeSet)
			{
				final Value.NodeSet set = (Value.NodeSet) myVariable.getValue().getValue();
				final XValueChildrenList list = new XValueChildrenList();
				for(final Value.Node n : set.getNodes())
				{
					list.add(n.myXPath, new NodeValue(n));
				}
				node.addChildren(list, false);
			}
			super.computeChildren(node);
		}

		@Override
		public String getEvaluationExpression()
		{
			return "$" + myVariable.getName();
		}

		@Override
		public void computeSourcePosition(@Nonnull XNavigatable navigatable)
		{
			navigatable.setSourcePosition(XsltSourcePosition.create(myVariable));
		}

		static String clipValue(String stringValue)
		{
			return stringValue.length() < 100 ? stringValue : stringValue.substring(0, 100) + "...";
		}

		private static class NodeValue extends XValue
		{
			private final Value.Node myNode;

			public NodeValue(Value.Node n)
			{
				myNode = n;
			}

			@Override
			public void computeSourcePosition(@Nonnull XNavigatable navigatable)
			{
				navigatable.setSourcePosition(XsltSourcePosition.create(myNode));
			}

			@Override
			public void computePresentation(@Nonnull XValueNode node, @Nonnull XValuePlace place)
			{
				node.setPresentation(null, "node", myNode.myStringValue, false);
			}
		}
	}

	private static class MyEvaluator extends XDebuggerEvaluator
	{
		private final Debugger.StyleFrame myFrame;

		public MyEvaluator(Debugger.StyleFrame frame)
		{
			myFrame = frame;
		}

		@Override
		public boolean isCodeFragmentEvaluationSupported()
		{
			return false;
		}

		@Override
		public void evaluate(@Nonnull String expression, XEvaluationCallback callback, @Nullable XSourcePosition expressionPosition)
		{
			try
			{
				final Value eval = myFrame.eval(expression);
				callback.evaluated(new MyValue(new ExpressionResult(eval)));
			}
			catch(VMPausedException e)
			{
				callback.errorOccurred(VMPausedException.MESSAGE);
			}
			catch(Debugger.EvaluationException e)
			{
				callback.errorOccurred(e.getMessage() != null ? e.getMessage() : e.toString());
			}
		}

		private static class ExpressionResult implements Debugger.Variable
		{
			private final Value myValue;

			public ExpressionResult(Value value)
			{
				myValue = value;
			}

			@SuppressWarnings({"ConstantConditions"})
			public String getURI()
			{
				return null;
			}

			public int getLineNumber()
			{
				return -1;
			}

			public boolean isGlobal()
			{
				return false;
			}

			public Kind getKind()
			{
				return Kind.EXPRESSION;
			}

			public String getName()
			{
				return "result";
			}

			public Value getValue()
			{
				return myValue;
			}
		}
	}
}


text:
package hsup

import (
	"errors"
	"fmt"
	"log"
	"net/url"
	"os/exec"
	"strconv"

	"github.com/fsouza/go-dockerclient"
	"github.com/heroku/hsup/diag"
	"github.com/opencontainers/runc/libcontainer"
)

const DefaultPort = "5000"

type DynoState int

const (
	Stopped DynoState = iota
	Started
	Retiring
	Retired
)

type DynoInput int
type IPInfo func() (ip string, port int)

const (
	Retire DynoInput = iota
	Restart
	Exited
	StayStarted
)

var ErrExecutorComplete = errors.New("Executor complete")

type Executor struct {
	Args        []string
	DynoDriver  DynoDriver
	Release     *Release
	ProcessID   int
	ProcessType string
	Status      chan *ExitStatus
	Complete    chan struct{}
	LogplexURL  *url.URL
	Binds       map[string]string

	// simple and abspath dyno driver properties
	cmd       *exec.Cmd
	waiting   chan struct{}
	logsRelay *relay

	// docker dyno driver properties
	container *docker.Container

	// libcontainer dyno driver properties
	initExitStatus chan *ExitStatus
	initProcess    *libcontainer.Process

	// FSM Fields
	OneShot  bool
	State    DynoState
	NewInput chan DynoInput

	// Status API fields
	IPInfo IPInfo
}

func (ex *Executor) dlog(values ...interface{}) {
	diag.Log(append(
		[]interface{}{"Executor", ex.Name(), fmt.Sprintf("%p", ex)},
		values...)...)
}

func (ex *Executor) Trigger(input DynoInput) {
	ex.dlog("trigger", input)
	select {
	case ex.NewInput <- input:
	case <-ex.Complete:
	}
}

func (ex *Executor) wait() {
	if s := ex.DynoDriver.Wait(ex); ex.Status != nil {
		log.Println("Executor exits:", ex.Name(), "exit code:", s.Code)
		ex.Status <- s
	}
	ex.Trigger(Exited)
}

func (ex *Executor) Tick() (err error) {
	ex.dlog("waiting for tick... (current state:", ex.State.String()+")")
	input := <-ex.NewInput
	ex.dlog("ticking with input", ex.State)

	start := func() error {
		log.Printf("%v: starting\n", ex.Name())
		if err = ex.DynoDriver.Start(ex); err != nil {
			log.Printf("%v: start fails: %#+v", ex.Name(), err)
			if ex.OneShot {
				go ex.Trigger(Retire)
			} else {
				go ex.Trigger(Restart)
			}
			return err
		}

		ex.dlog("started")
		ex.State = Started
		go ex.wait()
		return nil
	}

again:
	switch ex.State {
	case Retired:
		close(ex.Complete)
		return ErrExecutorComplete
	case Retiring:
		switch input {
		case Exited:
			ex.State = Retired
			goto again
		case Retire:
			return ex.DynoDriver.Stop(ex)
		default:
			return nil
		}
	case Stopped:
		switch input {
		case Retire:
			ex.State = Retired
			goto again
		case Exited:
			if ex.OneShot {
				ex.State = Retired
				goto again
			}

			return start()
		case StayStarted:
			fallthrough
		case Restart:
			return start()
		default:
			panic(fmt.Sprintln("Invalid input", input))
		}
	case Started:
		switch input {
		case Retire:
			ex.State = Retiring
			goto again
		case Exited:
			ex.State = Stopped
			goto again
		case Restart:
			return ex.DynoDriver.Stop(ex)
		default:
			panic(fmt.Sprintln("Invalid input", input))
		}
	default:
		panic(fmt.Sprintln("Invalid state", ex.State))
	}
}

func (ex *Executor) Name() string {
	return ex.ProcessType + "." + strconv.Itoa(ex.ProcessID)
}

// Convenience function to return an empty LogplexURL string when
// there *url.URL is nil.
//
// This is necessitated because of the repeated conversions between
// url.URL and string when dealing with hsup.Startup serialization
// constraints.
func (ex *Executor) logplexURLString() string {
	if ex.LogplexURL == nil {
		return ""
	}

	return ex.LogplexURL.String()
}

func (ex *Executor) bindPairs() []string {
	pairs := make([]string, len(ex.Binds))

	i := 0
	for k, v := range ex.Binds {
		pairs[i] = fmt.Sprintf("%s:%s", k, v)
		i++
	}

	return pairs
}


text:
package com.adyen.model.nexo;

import io.swagger.v3.oas.annotations.media.Schema;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
import java.util.Arrays;

/**
 *
Java class for DocumentQualifierType.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <simpleType name="DocumentQualifierType">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="SaleReceipt"/>
 *     <enumeration value="CashierReceipt"/>
 *     <enumeration value="CustomerReceipt"/>
 *     <enumeration value="Document"/>
 *     <enumeration value="Voucher"/>
 *     <enumeration value="Journal"/>
 *   </restriction>
 * </simpleType>
 *

 */
@XmlType(name = "DocumentQualifierType")
@XmlEnum
public enum DocumentQualifierType {

    /**
     * Where the POI system print the Sale receipt when requested by the Sale Terminal.
     */
    @XmlEnumValue("SaleReceipt")
    @Schema(description = "Where the POI system print the Sale receipt when requested by the Sale Terminal.")
    SALE_RECEIPT("SaleReceipt"),

    /**
     * Where the Sale system print the Cashier copy of the Payment receipt when requested by the POI Terminal.
     */
    @XmlEnumValue("CashierReceipt")
    @Schema(description = "Where the Sale system print the Cashier copy of the Payment receipt when requested by the POI Terminal.")
    CASHIER_RECEIPT("CashierReceipt"),

    /**
     * Where you print the Customer Payment receipt that could be located on the Sale Terminal or in some cases a restricted Customer Sale ticket on the POI Terminal.
     */
    @XmlEnumValue("CustomerReceipt")
    @Schema(description = "Where you print the Customer Payment receipt that could be located on the Sale Terminal or in some cases a restricted Customer Sale ticket on the POI Terminal.")
    CUSTOMER_RECEIPT("CustomerReceipt"),

    /**
     * When the POI System wants to print specific document (check, dynamic currency conversion ...).  Used by the Sale System when the printer is not located on the
     */
    @XmlEnumValue("Document")
    @Schema(description = "When the POI System wants to print specific document (check, dynamic currency conversion ...).  Used by the Sale System when the printer is not located on the")
    DOCUMENT("Document"),

    /**
     * Coupons, voucher or special ticket generated by the POI or the Sale System and to be printed.
     */
    @XmlEnumValue("Voucher")
    @Schema(description = "Coupons, voucher or special ticket generated by the POI or the Sale System and to be printed.")
    VOUCHER("Voucher"),

    /**
     * When the POI or the Sale System wants to store a messageType on the journal printer or electronic journal of the Sale Terminal (it is sometimes a Sale
     */
    @XmlEnumValue("Journal")
    @Schema(description = "When the POI or the Sale System wants to store a message on the journal printer or electronic journal of the Sale Terminal (it is sometimes a Sale")
    JOURNAL("Journal");
    private final String value;

    DocumentQualifierType(String v) {
        value = v;
    }

    /**
     * Value string.
     *
     * @return the string
     */
    public String value() {
        return value;
    }

    /**
     * From value document qualifier type.
     *
     * @param v the v
     * @return the document qualifier type
     */
    public static DocumentQualifierType fromValue(String v) {
        return Arrays.stream(values()).
                filter(s -> s.value.equals(v)).
                findFirst().orElseThrow(() -> new IllegalArgumentException(v));
    }

}


text:
package com.wci.tt.jpa.infomodels;

import static org.junit.Assert.assertTrue;

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

import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.wci.tt.jpa.JpaSupport;
import com.wci.umls.server.helpers.CopyConstructorTester;
import com.wci.umls.server.helpers.EqualsHashcodeTester;
import com.wci.umls.server.helpers.GetterSetterTester;
import com.wci.umls.server.helpers.ProxyTester;
import com.wci.umls.server.helpers.XmlSerializationTester;

/**
 * Unit testing for {@link NdcPropertiesListModel}.
 */
public class NdcPropertiesListModelUnitTest extends JpaSupport {

  /** The model object to test. */
  private NdcPropertiesListModel object;

  /** the test fixture l1. */
  private List<NdcPropertiesModel> l1;

  /** the test fixture l2. */
  private List<NdcPropertiesModel> l2;

  /**
   * Setup class.
   */
  @BeforeClass
  public static void setupClass() {
    // do nothing
  }

  /**
   * Setup.
   *
   * @throws Exception the exception
   */
  @Before
  public void setup() throws Exception {
    object = new NdcPropertiesListModel();
    ProxyTester tester = new ProxyTester(new NdcPropertiesModel());
    l1 = new ArrayList<>();
    l1.add((NdcPropertiesModel) tester.createObject(1));
    l2 = new ArrayList<>();
    l2.add((NdcPropertiesModel) tester.createObject(2));
  }

  /**
   * Test getter and setter methods of model object.
   *
   * @throws Exception the exception
   */
  @Test
  public void testModelGetSet() throws Exception {
    Logger.getLogger(getClass()).debug("TEST " + name.getMethodName());
    GetterSetterTester tester = new GetterSetterTester(object);
    tester.test();
  }

  /**
   * Test equals and hashcode methods.
   *
   * @throws Exception the exception
   */
  @Test
  public void testModelEqualsHashcode() throws Exception {
    Logger.getLogger(getClass()).debug("TEST " + name.getMethodName());
    EqualsHashcodeTester tester = new EqualsHashcodeTester(object);
    tester.include("list");

    tester.proxy(List.class, 1, l1);
    tester.proxy(List.class, 2, l2);
    assertTrue(tester.testIdentityFieldEquals());
    assertTrue(tester.testNonIdentityFieldEquals());
    assertTrue(tester.testIdentityFieldNotEquals());
    assertTrue(tester.testIdentityFieldHashcode());
    assertTrue(tester.testNonIdentityFieldHashcode());
    assertTrue(tester.testIdentityFieldDifferentHashcode());
  }

  /**
   * Test copy constructor.
   *
   * @throws Exception the exception
   */
  @Test
  public void testModelCopy() throws Exception {
    Logger.getLogger(getClass()).debug("TEST " + name.getMethodName());
    CopyConstructorTester tester = new CopyConstructorTester(object);
    tester.proxy(List.class, 1, l1);
    tester.proxy(List.class, 2, l2);
    assertTrue(tester.testCopyConstructor(NdcPropertiesListModel.class));
  }

  /**
   * Test XML serialization.
   *
   * @throws Exception the exception
   */
  @Test
  public void testModelXmlSerialization() throws Exception {
    Logger.getLogger(getClass()).debug("TEST " + name.getMethodName());
    XmlSerializationTester tester = new XmlSerializationTester(object);
    tester.proxy(List.class, 1, l1);
    tester.testXmlSerialization();
  }

  /**
   * Teardown.
   */
  @After
  public void teardown() {
    // do nothing
  }

  /**
   * Teardown class.
   */
  @AfterClass
  public static void teardownClass() {
    // do nothing
  }

}


text:
drop schema if exists test cascade;

create schema test;

SET search_path = test;


text: © Copyright Adrian Jost


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycologia 23: 360 (1931)

#### Original name
Aecidium vinnulum H.S. Jacks. & Holw.

### Remarks
null


text:
<?php

/**
 * Completely truncate a thread of comments.
 *
 * @package quip
 * @subpackage processors
 */
class QuipThreadTruncateProcessor extends modObjectProcessor {
    public $classKey = 'quipThread';
    public $permission = 'quip.thread_view';
    public $languageTopics = array('quip:default');

    /** @var quipThread $thread */
    public $thread;

    public function initialize() {
        $thread = $this->getProperty('thread');
        if (empty($thread)) return $this->modx->lexicon('quip.thread_err_ns');
        $this->thread = $this->modx->getObject($this->classKey,$thread);
        if (empty($this->thread)) return $this->modx->lexicon('quip.thread_err_nf');
        if (!$this->thread->checkPolicy('truncate')) return $this->modx->lexicon('access_denied');
        return parent::initialize();
    }

    public function process() {
        return $this->thread->truncate() ? $this->success() : $this->failure('quip.thread_err_truncate');
    }
}
return 'QuipThreadTruncateProcessor';