text:
package com.ducetech.framework.web.util;

import ch.qos.logback.classic.ClassicConstants;
import com.ducetech.framework.annotation.MetaData;
import com.ducetech.framework.context.SpringContextHolder;
import com.ducetech.framework.support.service.DynamicConfigService;
import com.ducetech.framework.util.RandomUtil;
import com.ducetech.framework.web.filter.WebAppContextInitFilter;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.ClassUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URLEncoder;
import java.util.*;
import java.util.regex.Matcher;

public class ServletUtil {

    private final static Logger logger = LoggerFactory.getLogger(ServletUtil.class);

    // \b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),
    // 字符串在编译时会被转码一次,所以是 "\\b"
    // \B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔)
    static String phoneReg = "\\b(ip(hone|od)|android|opera m(ob|in)i" + "|windows (phone|ce)|blackberry"
            + "|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp" + "|laystation portable)|nokia|fennec|htc[-_]"
            + "|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
    static String tableReg = "\\b(ipad|tablet|(Nexus 7)|up.browser" + "|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
    //移动设备正则匹配:手机端、平板
    static java.util.regex.Pattern phonePat = java.util.regex.Pattern.compile(phoneReg, java.util.regex.Pattern.CASE_INSENSITIVE);
    static java.util.regex.Pattern tablePat = java.util.regex.Pattern.compile(tableReg, java.util.regex.Pattern.CASE_INSENSITIVE);

    /**
     * 取得带相同前缀的Request Parameters, copy from spring WebUtils.
     *
     * 返回的结果的Parameter名已去除前缀.
     */
    public static Map<String, Object> buildParameters(ServletRequest request) {
        Enumeration<?> paramNames = request.getParameterNames();
        Map<String, Object> params = new TreeMap<String, Object>();
        String prefix = "search_";
        while ((paramNames != null) && paramNames.hasMoreElements()) {
            String paramName = (String) paramNames.nextElement();
            if ("".equals(prefix) || paramName.startsWith(prefix)) {
                String unprefixed = paramName.substring(prefix.length());
                String[] values = request.getParameterValues(paramName);
                if ((values == null) || (values.length == 0)) {
                    // Do nothing, no values found at all.
                } else if (values.length > 1) {
                    params.put(unprefixed, values);
                } else {
                    String val = values[0];
                    if (StringUtils.isNotBlank(val)) {
                        params.put(unprefixed, val);
                    }
                }
            }
        }
        return params;
    }

    /**
     * 基于文件对象渲染文件下载响应
     * @param response
     * @param file
     */
    public static void renderFileDownload(HttpServletResponse response, File file) {
        OutputStream output = null;
        try {
            //中文文件名支持
            String encodedfileName = new String(file.getName().getBytes("UTF-8"), "ISO8859-1");
            response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedfileName + "\"");

            output = response.getOutputStream();
            FileUtils.copyFile(file, output);
            response.flushBuffer();
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        } finally {
            IOUtils.closeQuietly(output);
        }
    }

    private static Map<String, Map<String, Object>> entityValidationRulesMap = Maps.newHashMap();

    /**
     * 基于构建的哈希标识计算获取校验规则
     * @return
     */
    public static Map<String, Object> buildValidateRules(String entityClazz) {
        Map<String, Object> nameRules = entityValidationRulesMap.get(entityClazz);
        try {
            //开发模式则每次计算以便修改注解后及时生效
            if (nameRules == null || DynamicConfigService.isDevMode()) {
                nameRules = Maps.newHashMap();
                entityValidationRulesMap.put(entityClazz, nameRules);
                Class<?> clazz = ClassUtils.forName(entityClazz);

                Assert.notNull(clazz, "验证缓存数据错误");
                Set<Field> fields = Sets.newHashSet(clazz.getDeclaredFields());
                clazz = clazz.getSuperclass();
                while (!clazz.equals(Object.class)) {
                    fields.addAll(Sets.newHashSet(clazz.getDeclaredFields()));
                    clazz = clazz.getSuperclass();
                }

                for (Field field : fields) {
                    if (Modifier.isStatic(field.getModifiers()) || !Modifier.isPrivate(field.getModifiers())
                            || Collection.class.isAssignableFrom(field.getType())) {
                        continue;
                    }
                    String name = field.getName();
                    if ("id".equals(name) || "version".equals(name)) {
                        continue;
                    }
                    Map<String, Object> rules = Maps.newHashMap();

                    //TODO 优化嵌套属性处理
                    //如果是实体对象类型,一般表单元素name都定义为entity.id,因此额外追加对应id属性校验规则
                    //if (PersistableEntity.class.isAssignableFrom(field.getType())) {
                    //    nameRules.put(name + ".id", rules);
                    //}

                    MetaData metaData = field.getAnnotation(MetaData.class);
                    if (metaData != null) {
                        String tooltips = metaData.tooltips();
                        if (StringUtils.isNotBlank(tooltips)) {
                            rules.put("tooltips", tooltips);
                        }
                    }
                    if (rules.size() > 0) {
                        nameRules.put(name, rules);
                    }
                }

            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return nameRules;
    }

    public static Map<String, String> buildRequestInfoDataMap(HttpServletRequest request, boolean verbose) {

        Map<String, String> dataMap = Maps.newLinkedHashMap();

        //Request相关的参数、属性等数据组装
        dataMap.put("req.method", request.getMethod());
        dataMap.put(ClassicConstants.REQUEST_REQUEST_URI, request.getRequestURI());
        dataMap.put(ClassicConstants.REQUEST_USER_AGENT_MDC_KEY, request.getHeader("User-Agent"));

        String clientId = request.getHeader("X-Forwarded-For");
        if (StringUtils.isBlank(clientId)) {
            clientId = request.getRemoteHost();
        }
        dataMap.put("req.clientId", clientId);

        if (verbose) {
            dataMap.put(ClassicConstants.REQUEST_QUERY_STRING, request.getQueryString());
            dataMap.put("req.contextPath", request.getContextPath());
            dataMap.put(ClassicConstants.REQUEST_REMOTE_HOST_MDC_KEY, request.getRemoteHost());
            dataMap.put("req.remotePort", String.valueOf(request.getRemotePort()));
            dataMap.put("req.remoteUser", request.getRemoteUser());
            dataMap.put("req.localAddr", request.getLocalAddr());
            dataMap.put("req.localName", request.getLocalName());
            dataMap.put("req.localPort", String.valueOf(request.getLocalPort()));
            dataMap.put("req.serverName", request.getServerName());
            dataMap.put("req.serverPort", String.valueOf(request.getServerPort()));
            dataMap.put(ClassicConstants.REQUEST_X_FORWARDED_FOR, request.getHeader("X-Forwarded-For"));
            dataMap.put(ClassicConstants.REQUEST_REQUEST_URL, request.getRequestURL().toString());
        }

        Enumeration<?> paramNames = request.getParameterNames();
        while (paramNames.hasMoreElements()) {
            String paramName = (String) paramNames.nextElement();
            String paramValue = StringUtils.join(request.getParameterValues(paramName), ",");
            if (paramValue != null && paramValue.length() > 100) {
                paramValue = paramValue.substring(0, 100) + "...";
            }
            dataMap.put("req.param[" + paramName + "]", paramValue);
        }

        if (request instanceof MultipartHttpServletRequest) {
            // 转型为MultipartHttpRequest
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            // 获得上传的文件(根据前台的name名称得到上传的文件)
            MultiValueMap<String, MultipartFile> multiValueMap = multipartRequest.getMultiFileMap();
            for (String key : multiValueMap.keySet()) {
                dataMap.put("req.part[" + key + "]", multiValueMap.getFirst(key).getName());
            }
        }

        if (verbose) {
            Enumeration<?> headerNames = request.getHeaderNames();
            while (headerNames.hasMoreElements()) {
                String headerName = (String) headerNames.nextElement();
                dataMap.put("req.header[" + headerName + "]", request.getHeader(headerName));
            }

            Enumeration<?> attrNames = request.getAttributeNames();
            while (attrNames.hasMoreElements()) {
                String attrName = (String) attrNames.nextElement();
                Object attrValue = request.getAttribute(attrName);
                if (attrValue == null) {
                    attrValue = "NULL";
                }
                String attr = attrValue.toString();
                if (attr != null && attr.toString().length() > 100) {
                    attr = attr.substring(0, 100) + "...";
                }
                dataMap.put("req.attr[" + attrName + "]", attr);
            }

            HttpSession session = request.getSession(false);
            if (session != null) {
                Enumeration<?> sessionAttrNames = session.getAttributeNames();
                while (sessionAttrNames.hasMoreElements()) {
                    String attrName = (String) sessionAttrNames.nextElement();
                    Object attrValue = session.getAttribute(attrName);
                    if (attrValue == null) {
                        attrValue = "NULL";
                    }
                    String attr = attrValue.toString();
                    if (attr != null && attr.toString().length() > 100) {
                        attr = attr.toString().substring(0, 100) + "...";
                    }
                    dataMap.put("session.attr[" + attrName + "]", attr);
                }
            }
        }
        return dataMap;
    }

    private static String readFileUrlPrefix;

    /**
     * 文件显示URL前缀
     * @return
     */
    public static String getReadFileUrlPrefix() {
        if (readFileUrlPrefix == null) {
            DynamicConfigService dynamicConfigService = SpringContextHolder.getBean(DynamicConfigService.class);
            readFileUrlPrefix = dynamicConfigService.getString("read_file_url_prefix");
            if (StringUtils.isBlank(readFileUrlPrefix)) {
                readFileUrlPrefix = WebAppContextInitFilter.getInitedWebContextFullUrl();
            }
        }
        return readFileUrlPrefix;
    }

    /**
     * 将URL进行解析处理,如果http打头直接返回,否则添加文件访问路径前缀
     * @return
     */
    public static String parseReadFileUrl(String url) {
        if (StringUtils.isBlank(url)) {
            return null;
        }
        if (url.startsWith("http") || url.startsWith("itms-services://")) {
            return url;
        }
        return getReadFileUrlPrefix() + url;
    }

    /**
     * 将URL基于/切分,把路径中的中文部分做UTF8编码后再组装返回
     * @return
     */
    public static String encodeUtf8Url(String url) {
        if (url == null) {
            return null;
        }
        String[] splits = url.split("/");
        List<String> urls = Lists.newArrayList();
        try {
            for (String split : splits) {
                if (StringUtils.isNotBlank(split)) {
                    urls.add(URLEncoder.encode(split, "UTF-8"));
                } else {
                    urls.add("");
                }
            }
        } catch (UnsupportedEncodingException e) {
            logger.error(e.getMessage(), e);
        }
        return StringUtils.join(urls, "/");
    }

    private static String staticFileUploadDir;

    /**
     * 获取文件上传根目录:优先取write_upload_file_dir参数值,如果没有定义则取webapp/upload
     * @return 返回图片访问相对路径
     */
    public static String writeUploadFile(InputStream fis, String name, long length) {
        if (staticFileUploadDir == null) {
            DynamicConfigService dynamicConfigService = SpringContextHolder.getBean(DynamicConfigService.class);
            staticFileUploadDir = dynamicConfigService.getString("write_upload_file_dir");
            if (StringUtils.isBlank(staticFileUploadDir)) {
                staticFileUploadDir = WebAppContextInitFilter.getInitedWebContextRealPath();
            }
            if (staticFileUploadDir.endsWith(File.separator)) {
                staticFileUploadDir = staticFileUploadDir.substring(0, staticFileUploadDir.length() - 1);
            }
            logger.info("Setup file upload root dir:  {}", staticFileUploadDir);
        }

        //简便的做法用UUID作为主键,每次上传都会创建文件对象和数据记录,便于管理,但是存在相同文件重复保存情况
        String id = RandomUtil.UID();

        //加上年月日分组处理,一方面便于直观看出上传文件日期信息以便批量处理,另一方面合理分组控制目录的个数和层级避免单一目录下文件过多
        DateTime now = new DateTime();
        StringBuilder sb = new StringBuilder();
        int year = now.getYear();
        sb.append("/" + year);
        String month = "";
        int monthOfYear = now.getMonthOfYear();
        if (monthOfYear < 10) {
            month = "0" + monthOfYear;
        } else {
            month = "" + monthOfYear;
        }
        String day = "";
        int dayOfMonth = now.getDayOfMonth();
        if (dayOfMonth < 10) {
            day = "0" + dayOfMonth;
        } else {
            day = "" + dayOfMonth;
        }
        sb.append("/" + month);
        sb.append("/" + day);
        Assert.notNull(id, "id is required to buildInstance");
        sb.append("/" + id);

        String path = "/upload/" + sb + "/" + name;
        String fullPath = staticFileUploadDir + path;
        logger.debug("Saving upload file: {}", fullPath);
        try {
            FileUtils.copyInputStreamToFile(fis, new File(fullPath));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return path;

    }

    public static boolean isMobileAndroidClient(HttpServletRequest request) {
        String android = request.getParameter("_android_");
        if (BooleanUtils.toBoolean(android)) {
            return true;
        }
        String userAgent = request.getHeader("user-agent");
        if (StringUtils.isBlank(userAgent)) {
            return false;
        }
        if (userAgent.toLowerCase().contains("android")) {
            return true;
        }
        return false;
    }

    public static boolean isMobileIOSClient(HttpServletRequest request) {
        String ios = request.getParameter("_ios_");
        if (BooleanUtils.toBoolean(ios)) {
            return true;
        }
        String userAgent = request.getHeader("user-agent");
        if (StringUtils.isBlank(userAgent)) {
            return false;
        }
        userAgent = userAgent.toLowerCase();
        if (userAgent.contains("iphone") || userAgent.contains("ipod") || userAgent.contains("ipad")) {
            return true;
        }
        return false;
    }

    public static boolean isMobileClient(HttpServletRequest request) {
        //特殊参数处理
        String mobile = request.getParameter("_mobile_");
        if (BooleanUtils.toBoolean(mobile)) {
            return true;
        }
        String userAgent = request.getHeader("USER-AGENT");
        if (null == userAgent) {
            userAgent = "";
        }
        // 匹配
        Matcher matcherPhone = phonePat.matcher(userAgent);
        Matcher matcherTable = tablePat.matcher(userAgent);
        if (matcherPhone.find() || matcherTable.find()) {
            return true;
        } else {
            return false;
        }
    }

    public static boolean isMicroMessengerClient(HttpServletRequest request) {
        //特殊参数处理
        String mobile = request.getParameter("_weixin_");
        if (BooleanUtils.toBoolean(mobile)) {
            return true;
        }
        String userAgent = request.getHeader("user-agent");
        if (StringUtils.isBlank(userAgent)) {
            return false;
        }
        userAgent = userAgent.toLowerCase();
        if (userAgent.contains("micromessenger")) {
            return true;
        }

        return false;
    }
}


text:
package net.daergoth.coreapi.sensor;

import java.io.Serializable;

/**
 * Represents {@code Sensor} entities in the Core API.
 * The {@code DummySensorDTO} subclass is representing non-physical sensors.
 */
public class SensorDTO implements Serializable{

	private static final long serialVersionUID = -2105925091056611175L;

	private long Id;

	private String Name;

	private String Type;

	/**
	 * Getter for {@code Sensor}'s ID.
	 * @return the ID of the sensor
	 */
	public long getId() {
		return Id;
	}

	/**
	 * Setter for {@code Sensor}'s ID.
	 * @param id the new ID for the sensor
	 */
	public void setId(long id) {
		Id = id;
	}

	/**
	 * Getter for {@code Sensor}'s name.
	 * @return the name of the sensor
	 */
	public String getName() {
		return Name;
	}

	/**
	 * Setter for {@code Sensor}'s name.
	 * @param name the new name of the sensor
	 */
	public void setName(String name) {
		Name = name;
	}

	/**
	 * Getter for {@code Sensor}'s type.
	 * @return the type of the sensor
	 */
	public String getType() {
		return Type;
	}

	/**
	 * Setter for {@code Sensor}'s type.
	 * @param type the new type of the sensor
	 */
	public void setType(String type) {
		Type = type;
	}

}

redpajama_set_name: RedPajamaGithub


text:
import requests

def geocode(address):
    parameters = { 'address': address, 'sensor' : 'false '}
    base = 'http://maps.googleapis.com/maps/api/geocode/json'
    response = requests.get(base, params=parameters)
    answer = response.json()
    for key in sorted(answer['results'][0]['geometry']['location']):
        print(key, ' = ' , answer['results'][0]['geometry']['location'][key])

if __name__ == '__main__':
    geocode('2, Rue omar ben abdelaziz, Ben arous, Tunisia')


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Name:
    Base16 Atelier Heath Light

  Credits:
    Original Base16 color schemes by Chris Kempson
    gedit template by Jan T. Sott

  Installation:
    Copy style to the respective directories, replace GTK version if necessary!

    Linux:
      /usr/share/gtksourceview-2.0/language-specs
    Mac OS X (MacPorts):
      /opt/local/share/gtksourceview-2.0/language-specs
    Windows:
      %PROGRAMFILES%\gedit\share\gtksourceview-2.0\styles

  Base16 Project:
    https://github.com/chriskempson/base16
-->

<style-scheme id="base16-atelierheath-light" _name="Base16 Atelier Heath Light" version="1.0">

  <!-- Meta -->
  <author>Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)</author>
  <_description>Base16 Atelier Heath Light</_description>

  <!-- Palette -->
  <color name="base00" value="#1b181b"/>
  <color name="base01" value="#292329"/>
  <color name="base02" value="#695d69"/>
  <color name="base03" value="#776977"/>
  <color name="base04" value="#9e8f9e"/>
  <color name="base05" value="#ab9bab"/>
  <color name="base06" value="#d8cad8"/>
  <color name="base07" value="#f7f3f7"/>
  <color name="base08" value="#ca402b"/>
  <color name="base09" value="#a65926"/>
  <color name="base0A" value="#bb8a35"/>
  <color name="base0B" value="#918b3b"/>
  <color name="base0C" value="#159393"/>
  <color name="base0D" value="#516aec"/>
  <color name="base0E" value="#7b59c0"/>
  <color name="base0F" value="#cc33cc"/>

  <!-- Styles -->
  <style name="bracket-match" background="base06" bold="true"/>
  <style name="bracket-mismatch" background="base06" underline="true"/>
  <style name="css:at-rules" foreground="base0E"/>
  <style name="css:color" foreground="base02"/>
  <style name="css:keyword" foreground="base0A"/>
  <style name="current-line" background="base06"/>
  <style name="cursor" foreground="base04"/>
  <style name="def:base-n-integer" foreground="base09"/>
  <style name="def:boolean" foreground="base09"/>
  <style name="def:builtin" foreground="base09"/>
  <style name="def:character" foreground="base09"/>
  <style name="def:comment" foreground="base03"/>
  <style name="def:complex" foreground="base09"/>
  <style name="def:decimal" foreground="base09"/>
  <style name="def:doc-comment" foreground="base03"/>
  <style name="def:doc-comment-element" foreground="base03"/>
  <style name="def:error" foreground="base07" background="base08"/>
  <style name="def:floating-point" foreground="base09"/>
  <style name="def:function" foreground="base0D"/>
  <style name="def:identifier" foreground="base08"/>
  <style name="def:keyword" foreground="base0E"/>
  <style name="def:note" foreground="base03"/>
  <style name="def:number" foreground="base09"/>
  <style name="def:operator" foreground="base0C"/>
  <style name="def:preprocessor" foreground="base09"/>
  <style name="def:reserved" foreground="base0E"/>
  <style name="def:shebang" foreground="base03"/>
  <style name="def:special-char" foreground="base09"/>
  <style name="def:special-constant" foreground="base09"/>
  <style name="def:statement" foreground="base0E"/>
  <style name="def:string" foreground="base0B"/>
  <style name="def:type" foreground="base0A"/>
  <style name="draw-spaces" foreground="base05"/>
  <style name="html:dtd" foreground="base0B"/>
  <style name="html:tag" foreground="base08"/>
  <style name="js:function" foreground="base0D"/>
  <style name="line-numbers" foreground="base01" background="base06"/>
  <style name="perl:builtin" foreground="base0D"/>
  <style name="perl:include-statement" foreground="base0E"/>
  <style name="perl:special-variable" foreground="base09"/>
  <style name="perl:variable" foreground="base08"/>
  <style name="php:string" foreground="base0B"/>
  <style name="python:builtin-constant" foreground="base0E"/>
  <style name="python:builtin-function" foreground="base0D"/>
  <style name="python:module-handler" foreground="base0E"/>
  <style name="python:special-variable" foreground="base0E"/>
  <style name="ruby:attribute-definition" foreground="base0E"/>
  <style name="ruby:builtin" foreground="base08"/>
  <style name="ruby:class-variable" foreground="base08"/>
  <style name="ruby:constant" foreground="base08"/>
  <style name="ruby:global-variable" foreground="base0D"/>
  <style name="ruby:instance-variable" foreground="base08"/>
  <style name="ruby:module-handler" foreground="base0E"/>
  <style name="ruby:predefined-variable" foreground="base09"/>
  <style name="ruby:regex" foreground="base08"/>
  <style name="ruby:special-variable" foreground="base0E"/>
  <style name="ruby:symbol" foreground="base0B"/>
  <style name="rubyonrails:attribute-definition" foreground="base0E"/>
  <style name="rubyonrails:block-parameter" foreground="base09"/>
  <style name="rubyonrails:builtin" foreground="base08"/>
  <style name="rubyonrails:class-inherit" foreground="base0B"/>
  <style name="rubyonrails:class-name" foreground="base0A"/>
  <style name="rubyonrails:class-variable" foreground="base08"/>
  <style name="rubyonrails:complex-interpolation" foreground="base09"/>
  <style name="rubyonrails:constant" foreground="base08"/>
  <style name="rubyonrails:global-variable" foreground="base0D"/>
  <style name="rubyonrails:instance-variable" foreground="base08"/>
  <style name="rubyonrails:module-handler" foreground="base0E"/>
  <style name="rubyonrails:module-name" foreground="base0A"/>
  <style name="rubyonrails:predefined-variable" foreground="base09"/>
  <style name="rubyonrails:rails" foreground="base08"/>
  <style name="rubyonrails:regex" foreground="base08"/>
  <style name="rubyonrails:simple-interpolation" foreground="base09"/>
  <style name="rubyonrails:special-variable" foreground="base0E"/>
  <style name="rubyonrails:symbol" foreground="base0B"/>
  <style name="search-match" background="base06" bold="true" underline="true"/>
  <style name="selection" foreground="base01" background="base02"/>
  <style name="text" foreground="base01" background="base07"/>
  <style name="xml:attribute-name" foreground="base08"/>
  <style name="xml:doctype" foreground="base08"/>
  <style name="xml:element-name" foreground="base08"/>
  <style name="xml:namespace" foreground="base08"/>
  <style name="xml:tag" foreground="base08"/>

</style-scheme>


text:
<?php
/**
 * Message translations.
 *
 * This file is automatically generated by 'yiic message' command.
 * It contains the localizable messages extracted from source code.
 * You may modify this file by translating the extracted messages.
 *
 * Each array element represents the translation (value) of a message (key).
 * If the value is empty, the message is considered as not translated.
 * Messages that no longer need translation will have their translations
 * enclosed between a pair of '@@' marks.
 *
 * Message string can be used with plural forms format. Check i18n section
 * of the guide for details.
 *
 * NOTE, this file must be saved in UTF-8 encoding.
 */
return array (
		'Are you sure you want to delete this item?' => 'Haluatko varmasti poistaa tämän?',
		'Delete' => 'Poista',
		'Displaying {start}-{end} of 1 result.|Displaying {start}-{end} of {count} results.' => 'Näytetään {start}-{end} kaikkiaan 1 tuloksesta.|Näytetään {start}-{end} kaikkiaan {count} tuloksesta.',
		'Either "name" or "value" must be specified for CDataColumn.' => 'Joko "name" tai "value" tulee olla määritettynä CDataColumn-luokalle.',
		'Home' => 'Koti',
		'No results found.' => 'Ei tuloksia.',
		'Not set' => 'Ei asetettu',
		'Please specify the "attributes" property.' => 'Määritä "attributes"-ominaisuus.',
		'Please specify the "data" property.' => 'Määritä "data"-ominaisuus.',
		'Sort by: ' => 'Lajittelu: ',
		'The "dataProvider" property cannot be empty.' => '"dataProvider"-ominaisuus ei voi olla tyhjä.',
		'The attribute must be specified in the format of "Name:Type:Label", where "Type" and "Label" are optional.' => 'Attribuutti pitää määrittää muodossa "Name:Type:Label", jossa "Type" ja "Label" ovat valinnaisia.',
		'The button type "{type}" is not supported.' => 'Painikkeen tyyppiä "{type}" ei tueta.',
		'The column must be specified in the format of "Name:Type:Label", where "Type" and "Label" are optional.' => 'Sarake pitää määrittää muodossa "Name:Type:Label", jossa "Type" ja "Label" ovat valinnaisia.',
		'The property "itemView" cannot be empty.' => '"itemView"-ominaisuus ei voi olla tyhjä.',
		'The property filterSelector should be defined.' => 'filterSelector-ominaisuus tulisi olla määriteltynä.',
		'The property updateSelector should be defined.' => 'updateSelector-ominaisuus tulisi olla määriteltynä.',
		'Total 1 result.|Total {count} results.' => 'Yhteensä 1 tulos.|Yhteensä {count} tulosta.',
		'Update' => 'Päivitä',
		'View' => 'Näytä',
		'{class} must specify "model" and "{attribute}" or "{name}" property values.' => '{class}-luokan täytyy määrittää "model"- ja "{attribute}"- tai "{name}"-ominaisuuksien arvot.'
);


text:
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests creating new simple resource group.
#>
function Test-CreatesNewSimpleResourceGroup
{
    # Setup
    $rgname = Get-ResourceGroupName
    $location = Get-ProviderLocation ResourceManagement

    try
    {
        # Test
        $actual = New-AzureResourceGroup -Name $rgname -Location $location -Tags @{Name = "testtag"; Value = "testval"}
        $expected = Get-AzureResourceGroup -Name $rgname

        # Assert
        Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
        Assert-AreEqual $expected.Tags[0]["Name"] $actual.Tags[0]["Name"]
    }
    finally
    {
        # Cleanup
        Clean-ResourceGroup $rgname
    }
}

<#
.SYNOPSIS
Tests updates existing resource group.
#>
function Test-UpdatesExistingResourceGroup
{
    # Setup
    $rgname = Get-ResourceGroupName
    $location = Get-ProviderLocation ResourceManagement

    try
    {
        # Test update without tag
        Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "ResourceGroupNotFound: Resource group '$rgname' could not be found."

        $new = New-AzureResourceGroup -Name $rgname -Location $location

        # Test update with bad tag format
        Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}"
        # Test update with bad tag format
        Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{Name = "testtag"; Value = "testval"}, @{Name = "testtag"; Value = "testval2"} } "Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = `"tagName1`"; Value = `"tagValue1`"}, @{Name = `"tagName2`"; Value = `"tagValue2`"}"

        $actual = Set-AzureResourceGroup -Name $rgname -Tags @{Name = "testtag"; Value = "testval"}
        $expected = Get-AzureResourceGroup -Name $rgname

        # Assert
        Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
        Assert-AreEqual 0 $new.Tags.Count
        Assert-AreEqual $expected.Tags[0]["Name"] $actual.Tags[0]["Name"]
    }
    finally
    {
        # Cleanup
        Clean-ResourceGroup $rgname
    }
}

<#
.SYNOPSIS
Tests creating new simple resource group and deleting it via piping.
#>
function Test-CreatesAndRemoveResourceGroupViaPiping
{
    # Setup
    $rgname1 = Get-ResourceGroupName
    $rgname2 = Get-ResourceGroupName
    $location = Get-ProviderLocation ResourceManagement

    # Test
    New-AzureResourceGroup -Name $rgname1 -Location $location
    New-AzureResourceGroup -Name $rgname2 -Location $location

    Get-AzureResourceGroup | where {$_.ResourceGroupName -eq $rgname1 -or $_.ResourceGroupName -eq $rgname2} | Remove-AzureResourceGroup -Force

    # Assert
    Assert-Throws { Get-AzureResourceGroup -Name $rgname1 } "Provided resource group does not exist."
    Assert-Throws { Get-AzureResourceGroup -Name $rgname2 } "Provided resource group does not exist."
}

<#
.SYNOPSIS
Tests getting non-existing resource group.
#>
function Test-GetNonExistingResourceGroup
{
    # Setup
    $rgname = Get-ResourceGroupName

    Assert-Throws { Get-AzureResourceGroup -Name $rgname } "Provided resource group does not exist."
}

<#
.SYNOPSIS
Negative test. New resource group in non-existing location throws error.
#>
function Test-NewResourceGroupInNonExistingLocation
{
    # Setup
    $rgname = Get-ResourceGroupName

    Assert-Throws { New-AzureResourceGroup -Name $rgname -Location 'non-existing' }
}

<#
.SYNOPSIS
Negative test. New resource group in non-existing location throws error.
#>
function Test-RemoveNonExistingResourceGroup
{
    # Setup
    $rgname = Get-ResourceGroupName

    Assert-Throws { Remove-AzureResourceGroup $rgname -Force } "Provided resource group does not exist."
}

<#
.SYNOPSIS
Negative test. New resource group in non-existing location throws error.
#>
function Test-AzureTagsEndToEnd
{
    # Setup
    $tag1 = getAssetName
    $tag2 = getAssetName
    Clean-Tags

    # Create tag without values
    New-AzureTag $tag1

    $tag = Get-AzureTag $tag1
    Assert-AreEqual $tag1 $tag.Name

    # Add value to the tag (adding same value should pass)
    New-AzureTag $tag1 value1
    New-AzureTag $tag1 value1
    New-AzureTag $tag1 value2

    $tag = Get-AzureTag $tag1
    Assert-AreEqual 2 $tag.Values.Count

    # Create tag with values
    New-AzureTag $tag2 value1
    New-AzureTag $tag2 value2
    New-AzureTag $tag2 value3

    $tags = Get-AzureTag
    Assert-AreEqual 2 $tags.Count

    # Remove entire tag
    $tag = Remove-AzureTag $tag1 -Force -PassThru

    $tags = Get-AzureTag
    Assert-AreEqual $tag1 $tag.Name

    # Remove tag value
    $tag = Remove-AzureTag $tag2 value1 -Force -PassThru

    $tags = Get-AzureTag
    Assert-AreEqual 0 $tags.Count

    # Get a non-existing tag
    Assert-Throws { Get-AzureTag "non-existing" }

    Clean-Tags
}

<#
.SYNOPSIS
Tests registration of required template provider
#>
function Test-NewDeploymentAndProviderRegistration
{
    # Setup
    $rgname = Get-ResourceGroupName
    $rname = Get-ResourceName
    $location = Get-ProviderLocation ResourceManagement
    $template = "Microsoft.Cache.0.4.0-preview"
    $provider = "microsoft.cache"

    try
    {
        # Unregistering microsoft.cache to have clean state
        $subscription = [Microsoft.WindowsAzure.Commands.Utilities.Common.AzureProfile]::Instance.CurrentSubscription
        $client = New-Object Microsoft.Azure.Commands.Resources.Models.ResourcesClient $subscription

        # Verify provider is registered
        $providers = [Microsoft.WindowsAzure.Commands.Utilities.Common.AzureProfile]::Instance.CurrentSubscription.RegisteredResourceProvidersList
        if( $providers -Contains $provider )
        {
            $client.UnregisterProvider($provider)
        }

        # Test
        $deployment = New-AzureResourceGroup -Name $rgname -Location $location -GalleryTemplateIdentity $template -cacheName $rname -cacheLocation $location

        # Assert
        $client = New-Object Microsoft.Azure.Commands.Resources.Models.ResourcesClient $subscription
        $providers = [Microsoft.WindowsAzure.Commands.Utilities.Common.AzureProfile]::Instance.CurrentSubscription.RegisteredResourceProvidersList

        Assert-True { $providers -Contains $provider }

    }
    finally
    {
        # Cleanup
        Clean-ResourceGroup $rgname
    }
}

function Test-NewResourceGroupWithTemplateThenGetWithAndWithoutDetails
{
    # Setup
    $rgname = Get-ResourceGroupName
    $websiteName = Get-ResourceName
    $location = Get-ProviderLocation ResourceManagement
    $templateFile = "Resources\EmptyWebsiteTemplate.json"

    try
    {
        # Test
        $actual = New-AzureResourceGroup -Name $rgname -Location $location -TemplateFile $templateFile `
                    -siteName $websiteName -hostingPlanName "test" -siteLocation "West US" `
                    -Tag @{ Name = "testtag"; Value = "testval" }

        $expected1 = Get-AzureResourceGroup -Name $rgname
        # Assert
        Assert-AreEqual $expected1.ResourceGroupName $actual.ResourceGroupName
        Assert-AreEqual $expected1.Tags[0]["Name"] $actual.Tags[0]["Name"]
        Assert-AreEqual $expected1.Resources.Count 2

        $expected2 = Get-AzureResourceGroup
        # Assert
        Assert-AreEqual $expected2[0].Resources.Count 0

        $expected3 = Get-AzureResourceGroup -Detailed
        $names = $expected3 | Select-Object -ExpandProperty ResourceGroupName
        $index = [Array]::IndexOf($names, $expected1.ResourceGroupName)
        # Assert
        Assert-AreEqual $expected3[$index].Resources.Count 2
    }
    finally
    {
        # Cleanup
        Clean-ResourceGroup $rgname
    }
}


text:
package org.apache.kafka.streams.processor;

/**
 * A processor of key-value pair records.
 *
 * @param <K> the type of keys
 * @param <V> the type of values
 */
public interface Processor<K, V> {

    /**
     * Initialize this processor with the given context. The framework ensures this is called once per processor when the topology
     * that contains it is initialized.
     * <p>
     * If this processor is to be {@link #punctuate(long) called periodically} by the framework, then this method should
     * {@link ProcessorContext#schedule(long) schedule itself} with the provided context.
     *
     * @param context the context; may not be null
     */
    void init(ProcessorContext context);

    /**
     * Process the message with the given key and value.
     *
     * @param key the key for the message
     * @param value the value for the message
     */
    void process(K key, V value);

    /**
     * Perform any periodic operations, if this processor {@link ProcessorContext#schedule(long) schedule itself} with the context
     * during {@link #init(ProcessorContext) initialization}.
     *
     * @param timestamp the stream time when this method is being called
     */
    void punctuate(long timestamp);

    /**
     * Close this processor and clean up any resources.
     */
    void close();
}


text:
<?php

class EarthIT_CMIPREST_CollectionNameMindingSchemaObjectNamer
extends EarthIT_Schema_SimpleAbstractSchemaObjectNamer
{
	protected $next;
	public function __construct( EarthIT_Schema_SchemaObjectNamer $next ) {
		$this->next = $next;
	}

	public function formatName( $name, $plural=false, EarthIT_Schema $s=null ) {
		$this->next->formatName( $name, $plural, $s );
	}

	public function name( EarthIT_Schema_SchemaObject $obj, $plural=false, EarthIT_Schema $s=null ) {
		if( $plural and ($pluralName = $obj->getFirstPropertyValue(EarthIT_CMIPREST_NS::COLLECTION_NAME)) !== null ) {
			return $this->next->formatName($pluralName, false, $s);
		} else {
			return $this->next->name($obj, $plural, $s);
		}
	}
}


text:
package com.badlogic.gdx.math;

import java.io.Serializable;

import com.badlogic.gdx.utils.GdxRuntimeException;

/** A specialized 3x3 matrix that can represent sequences of 2D translations, scales, flips, rotations, and shears.
 * Affine transformations preserve straight lines, and parallel
 * lines remain parallel after the transformation. Operations on affine matrices are faster because the last row can always be
 * assumed (0, 0, 1).
 *
 * @author vmilea */
public final class Affine2 implements Serializable {
	private static final long serialVersionUID = 1524569123485049187L;

	public float m00 = 1, m01 = 0, m02 = 0;
	public float m10 = 0, m11 = 1, m12 = 0;

	// constant: m21 = 0, m21 = 1, m22 = 1

	/** Constructs an identity matrix. */
	public Affine2 () {
	}

	/** Constructs a matrix from the given affine matrix.
	 *
	 * @param other The affine matrix to copy. This matrix will not be modified. */
	public Affine2 (Affine2 other) {
		set(other);
	}

	/** Sets this matrix to the identity matrix
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 idt () {
		m00 = 1;
		m01 = 0;
		m02 = 0;
		m10 = 0;
		m11 = 1;
		m12 = 0;
		return this;
	}

	/** Copies the values from the provided affine matrix to this matrix.
	 * @param other The affine matrix to copy.
	 * @return This matrix for the purposes of chaining. */
	public Affine2 set (Affine2 other) {
		m00 = other.m00;
		m01 = other.m01;
		m02 = other.m02;
		m10 = other.m10;
		m11 = other.m11;
		m12 = other.m12;
		return this;
	}

	/** Copies the values from the provided matrix to this matrix.
	 * @param matrix The matrix to copy, assumed to be an affine transformation.
	 * @return This matrix for the purposes of chaining. */
	public Affine2 set (Matrix3 matrix) {
		float[] other = matrix.val;

		m00 = other[Matrix3.M00];
		m01 = other[Matrix3.M01];
		m02 = other[Matrix3.M02];
		m10 = other[Matrix3.M10];
		m11 = other[Matrix3.M11];
		m12 = other[Matrix3.M12];
		return this;
	}

	/** Copies the 2D transformation components from the provided 4x4 matrix. The values are mapped as follows:
	 *
	 *

	 *      [  M00  M01  M03  ]
	 *      [  M10  M11  M13  ]
	 *      [   0    0    1   ]
	 *

	 *
	 * @param matrix The source matrix, assumed to be an affine transformation within XY plane. This matrix will not be modified.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 set (Matrix4 matrix) {
		float[] other = matrix.val;

		m00 = other[Matrix4.M00];
		m01 = other[Matrix4.M01];
		m02 = other[Matrix4.M03];
		m10 = other[Matrix4.M10];
		m11 = other[Matrix4.M11];
		m12 = other[Matrix4.M13];
		return this;
	}

	/** Sets this matrix to a translation matrix.
	 * @param x The translation in x
	 * @param y The translation in y
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTranslation (float x, float y) {
		m00 = 1;
		m01 = 0;
		m02 = x;
		m10 = 0;
		m11 = 1;
		m12 = y;
		return this;
	}

	/** Sets this matrix to a translation matrix.
	 * @param trn The translation vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTranslation (Vector2 trn) {
		return setToTranslation(trn.x, trn.y);
	}

	/** Sets this matrix to a scaling matrix.
	 * @param scaleX The scale in x.
	 * @param scaleY The scale in y.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToScaling (float scaleX, float scaleY) {
		m00 = scaleX;
		m01 = 0;
		m02 = 0;
		m10 = 0;
		m11 = scaleY;
		m12 = 0;
		return this;
	}

	/** Sets this matrix to a scaling matrix.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToScaling (Vector2 scale) {
		return setToScaling(scale.x, scale.y);
	}

	/** Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
	 * @param degrees The angle in degrees.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToRotation (float degrees) {
		float cos = MathUtils.cosDeg(degrees);
		float sin = MathUtils.sinDeg(degrees);

		m00 = cos;
		m01 = -sin;
		m02 = 0;
		m10 = sin;
		m11 = cos;
		m12 = 0;
		return this;
	}

	/** Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
	 * @param radians The angle in radians.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToRotationRad (float radians) {
		float cos = MathUtils.cos(radians);
		float sin = MathUtils.sin(radians);

		m00 = cos;
		m01 = -sin;
		m02 = 0;
		m10 = sin;
		m11 = cos;
		m12 = 0;
		return this;
	}

	/** Sets this matrix to a rotation matrix that will rotate any vector in counter-clockwise direction around the z-axis.
	 * @param cos The angle cosine.
	 * @param sin The angle sine.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToRotation (float cos, float sin) {
		m00 = cos;
		m01 = -sin;
		m02 = 0;
		m10 = sin;
		m11 = cos;
		m12 = 0;
		return this;
	}

	/** Sets this matrix to a shearing matrix.
	 * @param shearX The shear in x direction.
	 * @param shearY The shear in y direction.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToShearing (float shearX, float shearY) {
		m00 = 1;
		m01 = shearX;
		m02 = 0;
		m10 = shearY;
		m11 = 1;
		m12 = 0;
		return this;
	}

	/** Sets this matrix to a shearing matrix.
	 * @param shear The shear vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToShearing (Vector2 shear) {
		return setToShearing(shear.x, shear.y);
	}

	/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for:
	 * idt().translate(x, y).rotate(degrees).scale(scaleX, scaleY)
	 * @param x The translation in x.
	 * @param y The translation in y.
	 * @param degrees The angle in degrees.
	 * @param scaleX The scale in y.
	 * @param scaleY The scale in x.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnRotScl (float x, float y, float degrees, float scaleX, float scaleY) {
		m02 = x;
		m12 = y;

		if (degrees == 0) {
			m00 = scaleX;
			m01 = 0;
			m10 = 0;
			m11 = scaleY;
		} else {
			float sin = MathUtils.sinDeg(degrees);
			float cos = MathUtils.cosDeg(degrees);

			m00 = cos * scaleX;
			m01 = -sin * scaleY;
			m10 = sin * scaleX;
			m11 = cos * scaleY;
		}
		return this;
	}

	/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for:
	 * idt().translate(trn).rotate(degrees).scale(scale)
	 * @param trn The translation vector.
	 * @param degrees The angle in degrees.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnRotScl (Vector2 trn, float degrees, Vector2 scale) {
		return setToTrnRotScl(trn.x, trn.y, degrees, scale.x, scale.y);
	}

	/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for:
	 * idt().translate(x, y).rotateRad(radians).scale(scaleX, scaleY)
	 * @param x The translation in x.
	 * @param y The translation in y.
	 * @param radians The angle in radians.
	 * @param scaleX The scale in y.
	 * @param scaleY The scale in x.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnRotRadScl (float x, float y, float radians, float scaleX, float scaleY) {
		m02 = x;
		m12 = y;

		if (radians == 0) {
			m00 = scaleX;
			m01 = 0;
			m10 = 0;
			m11 = scaleY;
		} else {
			float sin = MathUtils.sin(radians);
			float cos = MathUtils.cos(radians);

			m00 = cos * scaleX;
			m01 = -sin * scaleY;
			m10 = sin * scaleX;
			m11 = cos * scaleY;
		}
		return this;
	}

	/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for:
	 * idt().translate(trn).rotateRad(radians).scale(scale)
	 * @param trn The translation vector.
	 * @param radians The angle in radians.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnRotRadScl (Vector2 trn, float radians, Vector2 scale) {
		return setToTrnRotRadScl(trn.x, trn.y, radians, scale.x, scale.y);
	}

	/** Sets this matrix to a concatenation of translation and scale. It is a more efficient form for:
	 * idt().translate(x, y).scale(scaleX, scaleY)
	 * @param x The translation in x.
	 * @param y The translation in y.
	 * @param scaleX The scale in y.
	 * @param scaleY The scale in x.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnScl (float x, float y, float scaleX, float scaleY) {
		m00 = scaleX;
		m01 = 0;
		m02 = x;
		m10 = 0;
		m11 = scaleY;
		m12 = y;
		return this;
	}

	/** Sets this matrix to a concatenation of translation and scale. It is a more efficient form for:
	 * idt().translate(trn).scale(scale)
	 * @param trn The translation vector.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToTrnScl (Vector2 trn, Vector2 scale) {
		return setToTrnScl(trn.x, trn.y, scale.x, scale.y);
	}

	/** Sets this matrix to the product of two matrices.
	 * @param l Left matrix.
	 * @param r Right matrix.
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 setToProduct (Affine2 l, Affine2 r) {
		m00 = l.m00 * r.m00 + l.m01 * r.m10;
		m01 = l.m00 * r.m01 + l.m01 * r.m11;
		m02 = l.m00 * r.m02 + l.m01 * r.m12 + l.m02;
		m10 = l.m10 * r.m00 + l.m11 * r.m10;
		m11 = l.m10 * r.m01 + l.m11 * r.m11;
		m12 = l.m10 * r.m02 + l.m11 * r.m12 + l.m12;
		return this;
	}

	/** Inverts this matrix given that the determinant is != 0.
	 * @return This matrix for the purpose of chaining operations.
	 * @throws GdxRuntimeException if the matrix is singular (not invertible) */
	public Affine2 inv () {
		float det = det();
		if (det == 0) throw new GdxRuntimeException("Can't invert a singular affine matrix");

		float invDet = 1.0f / det;

		float tmp00 = m11;
		float tmp01 = -m01;
		float tmp02 = m01 * m12 - m11 * m02;
		float tmp10 = -m10;
		float tmp11 = m00;
		float tmp12 = m10 * m02 - m00 * m12;

		m00 = invDet * tmp00;
		m01 = invDet * tmp01;
		m02 = invDet * tmp02;
		m10 = invDet * tmp10;
		m11 = invDet * tmp11;
		m12 = invDet * tmp12;
		return this;
	}

	/** Postmultiplies this matrix with the provided matrix and stores the result in this matrix. For example:
	 *
	 *

	 * A.mul(B) results in A := AB
	 *

	 *
	 * @param other Matrix to multiply by.
	 * @return This matrix for the purpose of chaining operations together. */
	public Affine2 mul (Affine2 other) {
		float tmp00 = m00 * other.m00 + m01 * other.m10;
		float tmp01 = m00 * other.m01 + m01 * other.m11;
		float tmp02 = m00 * other.m02 + m01 * other.m12 + m02;
		float tmp10 = m10 * other.m00 + m11 * other.m10;
		float tmp11 = m10 * other.m01 + m11 * other.m11;
		float tmp12 = m10 * other.m02 + m11 * other.m12 + m12;

		m00 = tmp00;
		m01 = tmp01;
		m02 = tmp02;
		m10 = tmp10;
		m11 = tmp11;
		m12 = tmp12;
		return this;
	}

	/** Premultiplies this matrix with the provided matrix and stores the result in this matrix. For example:
	 *
	 *

	 * A.preMul(B) results in A := BA
	 *

	 *
	 * @param other The other Matrix to multiply by
	 * @return This matrix for the purpose of chaining operations. */
	public Affine2 preMul (Affine2 other) {
		float tmp00 = other.m00 * m00 + other.m01 * m10;
		float tmp01 = other.m00 * m01 + other.m01 * m11;
		float tmp02 = other.m00 * m02 + other.m01 * m12 + other.m02;
		float tmp10 = other.m10 * m00 + other.m11 * m10;
		float tmp11 = other.m10 * m01 + other.m11 * m11;
		float tmp12 = other.m10 * m02 + other.m11 * m12 + other.m12;

		m00 = tmp00;
		m01 = tmp01;
		m02 = tmp02;
		m10 = tmp10;
		m11 = tmp11;
		m12 = tmp12;
		return this;
	}

	/** Postmultiplies this matrix by a translation matrix.
	 * @param x The x-component of the translation vector.
	 * @param y The y-component of the translation vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 translate (float x, float y) {
		m02 += m00 * x + m01 * y;
		m12 += m10 * x + m11 * y;
		return this;
	}

	/** Postmultiplies this matrix by a translation matrix.
	 * @param trn The translation vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 translate (Vector2 trn) {
		return translate(trn.x, trn.y);
	}

	/** Premultiplies this matrix by a translation matrix.
	 * @param x The x-component of the translation vector.
	 * @param y The y-component of the translation vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preTranslate (float x, float y) {
		m02 += x;
		m12 += y;
		return this;
	}

	/** Premultiplies this matrix by a translation matrix.
	 * @param trn The translation vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preTranslate (Vector2 trn) {
		return preTranslate(trn.x, trn.y);
	}

	/** Postmultiplies this matrix with a scale matrix.
	 * @param scaleX The scale in the x-axis.
	 * @param scaleY The scale in the y-axis.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 scale (float scaleX, float scaleY) {
		m00 *= scaleX;
		m01 *= scaleY;
		m10 *= scaleX;
		m11 *= scaleY;
		return this;
	}

	/** Postmultiplies this matrix with a scale matrix.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 scale (Vector2 scale) {
		return scale(scale.x, scale.y);
	}

	/** Premultiplies this matrix with a scale matrix.
	 * @param scaleX The scale in the x-axis.
	 * @param scaleY The scale in the y-axis.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preScale (float scaleX, float scaleY) {
		m00 *= scaleX;
		m01 *= scaleX;
		m02 *= scaleX;
		m10 *= scaleY;
		m11 *= scaleY;
		m12 *= scaleY;
		return this;
	}

	/** Premultiplies this matrix with a scale matrix.
	 * @param scale The scale vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preScale (Vector2 scale) {
		return preScale(scale.x, scale.y);
	}

	/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
	 * @param degrees The angle in degrees
	 * @return This matrix for the purpose of chaining. */
	public Affine2 rotate (float degrees) {
		if (degrees == 0) return this;

		float cos = MathUtils.cosDeg(degrees);
		float sin = MathUtils.sinDeg(degrees);

		float tmp00 = m00 * cos + m01 * sin;
		float tmp01 = m00 * -sin + m01 * cos;
		float tmp10 = m10 * cos + m11 * sin;
		float tmp11 = m10 * -sin + m11 * cos;

		m00 = tmp00;
		m01 = tmp01;
		m10 = tmp10;
		m11 = tmp11;
		return this;
	}

	/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
	 * @param radians The angle in radians
	 * @return This matrix for the purpose of chaining. */
	public Affine2 rotateRad (float radians) {
		if (radians == 0) return this;

		float cos = MathUtils.cos(radians);
		float sin = MathUtils.sin(radians);

		float tmp00 = m00 * cos + m01 * sin;
		float tmp01 = m00 * -sin + m01 * cos;
		float tmp10 = m10 * cos + m11 * sin;
		float tmp11 = m10 * -sin + m11 * cos;

		m00 = tmp00;
		m01 = tmp01;
		m10 = tmp10;
		m11 = tmp11;
		return this;
	}

	/** Premultiplies this matrix with a (counter-clockwise) rotation matrix.
	 * @param degrees The angle in degrees
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preRotate (float degrees) {
		if (degrees == 0) return this;

		float cos = MathUtils.cosDeg(degrees);
		float sin = MathUtils.sinDeg(degrees);

		float tmp00 = cos * m00 - sin * m10;
		float tmp01 = cos * m01 - sin * m11;
		float tmp02 = cos * m02 - sin * m12;
		float tmp10 = sin * m00 + cos * m10;
		float tmp11 = sin * m01 + cos * m11;
		float tmp12 = sin * m02 + cos * m12;

		m00 = tmp00;
		m01 = tmp01;
		m02 = tmp02;
		m10 = tmp10;
		m11 = tmp11;
		m12 = tmp12;
		return this;
	}

	/** Premultiplies this matrix with a (counter-clockwise) rotation matrix.
	 * @param radians The angle in radians
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preRotateRad (float radians) {
		if (radians == 0) return this;

		float cos = MathUtils.cos(radians);
		float sin = MathUtils.sin(radians);

		float tmp00 = cos * m00 - sin * m10;
		float tmp01 = cos * m01 - sin * m11;
		float tmp02 = cos * m02 - sin * m12;
		float tmp10 = sin * m00 + cos * m10;
		float tmp11 = sin * m01 + cos * m11;
		float tmp12 = sin * m02 + cos * m12;

		m00 = tmp00;
		m01 = tmp01;
		m02 = tmp02;
		m10 = tmp10;
		m11 = tmp11;
		m12 = tmp12;
		return this;
	}

	/** Postmultiplies this matrix by a shear matrix.
	 * @param shearX The shear in x direction.
	 * @param shearY The shear in y direction.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 shear (float shearX, float shearY) {
		float tmp0 = m00 + shearY * m01;
		float tmp1 = m01 + shearX * m00;
		m00 = tmp0;
		m01 = tmp1;

		tmp0 = m10 + shearY * m11;
		tmp1 = m11 + shearX * m10;
		m10 = tmp0;
		m11 = tmp1;
		return this;
	}

	/** Postmultiplies this matrix by a shear matrix.
	 * @param shear The shear vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 shear (Vector2 shear) {
		return shear(shear.x, shear.y);
	}

	/** Premultiplies this matrix by a shear matrix.
	 * @param shearX The shear in x direction.
	 * @param shearY The shear in y direction.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preShear (float shearX, float shearY) {
		float tmp00 = m00 + shearX * m10;
		float tmp01 = m01 + shearX * m11;
		float tmp02 = m02 + shearX * m12;
		float tmp10 = m10 + shearY * m00;
		float tmp11 = m11 + shearY * m01;
		float tmp12 = m12 + shearY * m02;

		m00 = tmp00;
		m01 = tmp01;
		m02 = tmp02;
		m10 = tmp10;
		m11 = tmp11;
		m12 = tmp12;
		return this;
	}

	/** Premultiplies this matrix by a shear matrix.
	 * @param shear The shear vector.
	 * @return This matrix for the purpose of chaining. */
	public Affine2 preShear (Vector2 shear) {
		return preShear(shear.x, shear.y);
	}

	/** Calculates the determinant of the matrix.
	 * @return The determinant of this matrix. */
	public float det () {
		return m00 * m11 - m01 * m10;
	}

	/** Get the x-y translation component of the matrix.
	 * @param position Output vector.
	 * @return Filled position. */
	public Vector2 getTranslation (Vector2 position) {
		position.x = m02;
		position.y = m12;
		return position;
	}

	/** Check if the this is a plain translation matrix.
	 * @return True if scale is 1 and rotation is 0. */
	public boolean isTranslation () {
		return (m00 == 1 && m11 == 1 && m01 == 0 && m10 == 0);
	}

	/** Check if this is an indentity matrix.
	 * @return True if scale is 1 and rotation is 0. */
	public boolean isIdt () {
		return (m00 == 1 && m02 == 0 && m12 == 0 && m11 == 1 && m01 == 0 && m10 == 0);
	}

	/** Applies the affine transformation on a vector. */
	public void applyTo (Vector2 point) {
		float x = point.x;
		float y = point.y;
		point.x = m00 * x + m01 * y + m02;
		point.y = m10 * x + m11 * y + m12;
	}

	@Override
	public String toString () {
		return "[" + m00 + "|" + m01 + "|" + m02 + "]\n[" + m10 + "|" + m11 + "|" + m12 + "]\n[0.0|0.0|0.1]";
	}
}


text:
package jeight.lambda;

/**
 * @author Michael Gfeller
 */
public class RunnableTest {

    public static void main(String[] args) {

        System.out.println("--- runnable example ---");

        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("runnable 1 - as anon");
            }
        };

        Runnable r2 = () -> System.out.println("runnable 2 - as lambda");

        r1.run();
        r2.run();
    }
}


text:
using namespace std;

int main(void){
    //isso vai dar uma saida diferente da que é a do gabarito
    cout<< "Saida";
    return 0;
}


text:
package com.amazonaws.services.simpleworkflow.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.simpleworkflow.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * WorkflowTypeInfoMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class WorkflowTypeInfoMarshaller {

    private static final MarshallingInfo<StructuredPojo> WORKFLOWTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("workflowType").build();
    private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("status").build();
    private static final MarshallingInfo<String> DESCRIPTION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("description").build();
    private static final MarshallingInfo<java.util.Date> CREATIONDATE_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("creationDate").build();
    private static final MarshallingInfo<java.util.Date> DEPRECATIONDATE_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("deprecationDate").build();

    private static final WorkflowTypeInfoMarshaller instance = new WorkflowTypeInfoMarshaller();

    public static WorkflowTypeInfoMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(WorkflowTypeInfo workflowTypeInfo, ProtocolMarshaller protocolMarshaller) {

        if (workflowTypeInfo == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(workflowTypeInfo.getWorkflowType(), WORKFLOWTYPE_BINDING);
            protocolMarshaller.marshall(workflowTypeInfo.getStatus(), STATUS_BINDING);
            protocolMarshaller.marshall(workflowTypeInfo.getDescription(), DESCRIPTION_BINDING);
            protocolMarshaller.marshall(workflowTypeInfo.getCreationDate(), CREATIONDATE_BINDING);
            protocolMarshaller.marshall(workflowTypeInfo.getDeprecationDate(), DEPRECATIONDATE_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
namespace chromeos {

// A PpdMetadataManager is the class responsible for fetching and
// parsing PPD metadata to answer high-level queries about metadata.
//
// This class must be called from a sequenced context.
class COMPONENT_EXPORT(CHROMEOS_PRINTING) PpdMetadataManager {
 public:
  // Used by GetLocale().
  // Argument denotes success of setting metadata locale for |this|.
  using GetLocaleCallback = base::OnceCallback<void(bool)>;

  // Used by GetPrinters().
  // Arguments denote
  // *  whether the call succeeded and
  // *  upon success, ParsedPrinters as requested.
  using GetPrintersCallback =
      base::OnceCallback<void(bool, const ParsedPrinters&)>;

  // Used by FindAllEmmsAvailableInIndex().
  // Contains a map
  // *  whose keys are effective-make-and-model strings (provided by the
  //    caller) that are available in forward index metadata and
  // *  whose values contain the corresponding information read from the
  //    forward index metadata.
  using FindAllEmmsAvailableInIndexCallback = base::OnceCallback<void(
      const base::flat_map<std::string, ParsedIndexValues>&)>;

  // Used by FindDeviceInUsbIndex().
  // *  Contains the effective-make-and-model string corresponding to
  //    the vendor id / product id pair originally provided by caller.
  // *  The argument is empty if no appropriate effective-make-and-model
  //    string was found.
  using FindDeviceInUsbIndexCallback =
      base::OnceCallback<void(const std::string&)>;

  // Used by GetUsbManufacturerName().
  // *  Contains the unlocalized manufacturer name corresponding to the
  //    vendor id originally provided by caller.
  // *  The argument is empty if the manufacturer name is not found.
  using GetUsbManufacturerNameCallback =
      base::OnceCallback<void(const std::string&)>;

  // Assumes ownership of |config_cache|.
  static std::unique_ptr<PpdMetadataManager> Create(
      base::StringPiece browser_locale,
      base::Clock* clock,
      std::unique_ptr<PrinterConfigCache> config_cache);

  virtual ~PpdMetadataManager() = default;

  // Primes |this| with the best-fit locale advertised by the Chrome OS
  // Printing serving root. The best-fit locale is the one closest to
  // the |browser_locale| passed to Create(). "Closest" is an
  // implementation-defined concept.
  //
  // If a best-fit locale is already set in |this|, |this| invokes |cb|
  // immediately and indicates success.
  //
  // With few exceptions, caller must not call any other method of
  // |this| until the |cb| indicates success. Exceptional methods are
  // documented in this header file.
  //
  // See also: SetLocaleForTesting()
  virtual void GetLocale(GetLocaleCallback cb) = 0;

  // Calls |cb| with a list of manufacturers.
  // *  On success, the list is created from metadata no older than
  //    |age|.
  // *  On failure, the first argument to |cb| is set accordingly.
  virtual void GetManufacturers(
      base::TimeDelta age,
      PpdProvider::ResolveManufacturersCallback cb) = 0;

  // Calls |cb| with a map of printers made by |manufacturer|.
  // *  Caller must have previously successfully called
  //    GetManufacturers().
  // *  On success, the map is created from metadata no older than
  //    |age|.
  // *  On failure, the first argument to |cb| is set accordingly.
  virtual void GetPrinters(base::StringPiece manufacturer,
                           base::TimeDelta age,
                           GetPrintersCallback cb) = 0;

  // Calls |cb| with the subset of strings from |emms| that are
  // available in forward index metadata mapped to the corresponding
  // values read from forward index metadata.
  // *  Does not rely on prior call to GetLocale().
  // *  During operation, operates with metadata no older than |age|.
  // *  On failure, calls |cb| with an empty map.
  virtual void FindAllEmmsAvailableInIndex(
      const std::vector<std::string>& emms,
      base::TimeDelta age,
      FindAllEmmsAvailableInIndexCallback cb) = 0;

  // Searches USB index metadata for a printer with the given
  // |vendor_id| and |product_id|, calling |cb| with the appropriate
  // effective-make-and-model string if one is found.
  // *  Does not rely on prior call to GetLocale().
  // *  During operation, operates with metadata no older than |age|.
  // *  On failure, calls |cb| with an empty string.
  virtual void FindDeviceInUsbIndex(int vendor_id,
                                    int product_id,
                                    base::TimeDelta age,
                                    FindDeviceInUsbIndexCallback cb) = 0;

  // Searches the USB vendor ID map for a manufacturer with the given
  // |vendor_id|, calling |cb| with the name found (if any).
  // *  Does not rely on prior call to GetLocale().
  // *  During operation, operates with metadata no older than |age|.
  // *  On failure, calls |cb| with an empty string.
  virtual void GetUsbManufacturerName(int vendor_id,
                                      base::TimeDelta age,
                                      GetUsbManufacturerNameCallback cb) = 0;

  // Calls |cb| with the make and model of
  // |effective_make_and_model|.
  // *  On success, the split is performed against metadata no older than
  //    |age|.
  // *  On failure, the first argument to |cb| is set accordingly.
  //
  // The split is defined by the reverse index metadata that this method
  // fetches, appropriate to the |effective_make_and_model|.
  // Googlers: you may consult
  // go/cros-printing:ppd-metadata#reverse-index
  virtual void SplitMakeAndModel(base::StringPiece effective_make_and_model,
                                 base::TimeDelta age,
                                 PpdProvider::ReverseLookupCallback cb) = 0;

  // Returns a borrowed pointer to the PrinterConfigCache passed to
  // Create(); |this| retains ownership.
  virtual PrinterConfigCache* GetPrinterConfigCacheForTesting() const = 0;

  // Fakes a successful call to GetLocale(), setting the internal
  // locale of |this| to |locale|.
  //
  // This method is useful for bypassing a real call to GetLocale(),
  // which consumers of this class ordinarily must complete successfully
  // before calling any other method of |this|.
  virtual void SetLocaleForTesting(base::StringPiece locale) = 0;

  // Fakes a successful call to GetManufacturers(), providing |this|
  // with a list of manufacturers.
  //
  // This method returns true if |this| successfully parses and stores
  // off the list of |manufacturers_json|. Caller must verify that this
  // method returns true.
  virtual bool SetManufacturersForTesting(
      base::StringPiece manufacturers_json) = 0;

  // Returns the metadata locale currently set in |this|.
  virtual base::StringPiece ExposeMetadataLocaleForTesting() const = 0;
};

}  // namespace chromeos

#endif  // CHROMEOS_PRINTING_PPD_METADATA_MANAGER_H_


text:
/* global process require __dirname exports console */
/** makedir.js
 * How I make directories recursively in node.js
 *
 * If you pass it a directory that you want to exist, it will traverse
 * the directory tree up until it finds a directory that does exist,
 * and then it will go back down the directory structure making all
 * directories as needed.
 *
 * For example, if you have /home/james and you want to create
 * /home/james/node/repository/makedir,
 *
 * then it will look for
 *   /home/james/node/repository/makedir
 * then
 *   /home/james/node/repository
 * then
 *   /home/james/node then /home/james,
 * will find that directory, and
 * then it will create
 *   /home/james/node
 * and then
 *   /home/james/node/repository
 * and then
 *   /home/james/node/repository/makedir
 */

var fs = require('fs');
var path = require('path');
var rootdir = __dirname;

// do the actual directory making.  probably should add mode as a
// parameter somewhere

function makeme (dir,mode,cb){

    var callback = function(err,parent){
        //console.log('makeme: ',dir)
        if(err) throw new Error(err)
        if(parent){
            // replace root of dir with parent
            dir = path.join(parent,path.basename(dir));
        }
        fs.mkdir(dir,mode,function(err){
            if(err !== null){
                if( err.code === 'EEXIST'
                 && err.path === dir){
                    // make sure the directory really does exist
                    fs.stat(dir,function(staterr,stat){
                        // as mkdirP guys say, this is very strange
                        if(staterr || !stat.isDirectory()){
                            if(cb) cb(err);
                        }
                        if(cb) cb(null,dir);
                        return null;
                        // if the stat is good, do nothing.  some other processed did it
                    });

                }else{
                    console.log(err);
                    throw new Error(err);
                }
            }else{
                if(cb) cb(null,dir);
            }
            return 1;

        });
    };
    return callback;
};

//
// function to handle stat
//
function handleStatforPath(p, mode, parent,next){
    return function(exists){
        if(!exists){
            //console.log('no path ' + p + ' so recurse');
            return makedir(parent,
                           mode,
                           makeme(p,mode,next));
        }else{
             // console.log('have path, recursing ends at ',p);
            next();
        }
        return 1;
    };
}

// March 2012, cribbing some things from mkdirP --- file mode

// the function that gets exported, but doesn't actually do any directory making
// checks if a directory parent exists using stat.  If not, recurs into parent.
function makedir(p,mode,next){
    if (typeof mode === 'function' || mode === undefined) {
        next = mode;
        mode = 0777 & (~process.umask());
    }
    if (typeof mode === 'string') mode = parseInt(mode, 8);
    p = path.resolve(p);
    // recursively make sure that directory exists.
    //

    var parent = path.dirname(p);
    if(parent){
        fs.exists(p,handleStatforPath(p,mode,parent,next));
    }else{
        // following convention, if the path is actually a dot at this
        // point, prepend the current process root dir and carry on
        // back up the stack.
        //
        if(p === '.'){
            // replace . with rootdir
            p = rootdir;
            // recurse back up with that value
            return next(null,p)
        }

        //
        // not sure what is up.  path.dirname should create '.' for
        // parent of relative path names
        //
        console.log('in make parent dir, no parents left for : '+p+' try prepending the process root dir');
        throw new Error('parent failure ' + p);
    }
    return null;
}
exports.makedir = makedir;


text:
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//

using AnnuaireCertifies.Domaine;
using System.Linq;

namespace AnnuaireCertifies.Business.Depots
{
    public partial interface IDepotTraductionStatutMotif : IDepot<TraductionStatutMotif>
    {

        /// <summary>
        /// Récupère une liste des éléments.
        /// </summary>
        /// <returns>Liste des éléments trouvées.</returns>
        IQueryable<TraductionStatutMotif> GetAll(long langueId);

    }
}


text:
<!DOCTYPE html>

<TITLE>Manpage of POLKITD</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">

linux manpages

{"type":"documentation"}

POLKITD

Section: polkitd (8)
Updated: May 2009
Index
Return to Main Contents

NAME

polkitd - PolicyKit daemon

SYNOPSIS

polkitd

DESCRIPTION

polkitd

provides the
org.freedesktop.PolicyKit1
D-Bus service on the system message bus. Users or administrators should never need to start this daemon as it will be automatically started by
dbus-daemon(1)
whenever an application calls into the service.

AUTHOR

Written by David Zeuthen
davidz@redhat.com
with a lot of help from many others.

BUGS

Please send bug reports to either the distribution or the polkit-devel mailing list, see the link
m[blue]http://lists.freedesktop.org/mailman/listinfo/polkit-develm[]
on how to subscribe.

SEE ALSO

polkit(8)

Index

NAME

SYNOPSIS

DESCRIPTION

AUTHOR

BUGS

SEE ALSO

This document was created by
man2html,
using the manual pages.

Time: 05:34:28 GMT, December 24, 2015


text:
package org.apache.solr.highlight;

import java.net.URL;

import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.core.SolrInfoMBean;

/**
 *
 * @since solr 1.3
 */
public abstract class HighlightingPluginBase implements SolrInfoMBean
{
  protected long numRequests;
  protected SolrParams defaults;

  public void init(NamedList args) {
    if( args != null ) {
      Object o = args.get("defaults");
      if (o != null && o instanceof NamedList ) {
        defaults = SolrParams.toSolrParams((NamedList)o);
      }
    }
  }

  //////////////////////// SolrInfoMBeans methods //////////////////////

  public String getName() {
    return this.getClass().getName();
  }

  public abstract String getDescription();
  public abstract String getSource();

  public String getVersion() {
    return getClass().getPackage().getSpecificationVersion();
  }

  public Category getCategory()
  {
    return Category.HIGHLIGHTING;
  }

  public URL[] getDocs() {
    return null;  // this can be overridden, but not required
  }

  public NamedList getStatistics() {
    NamedList<Long> lst = new SimpleOrderedMap<Long>();
    lst.add("requests", numRequests);
    return lst;
  }
}


text:
package groxyconf

type HealthCheck interface {
	GetUri() string
	GetUnhealthyThreshold() string
	GetHealthyThreshold() string
}

type HealthCheckStruct struct {
	URI                string `yaml:"uri,omitempty"`
	UnhealthyThreshold string `yaml:"unhealthy_threshold,omitempty"`
	HealthyThreshold   string `yaml:"healthy_threshold,omitempty"`
}

func (this HealthCheckStruct) GetUri() string {
	return this.URI
}

func (this HealthCheckStruct) GetUnhealthyThreshold() string {
	return this.UnhealthyThreshold
}

func (this HealthCheckStruct) GetHealthyThreshold() string {
	return this.HealthyThreshold
}


text:
ALTER TABLE `addons`
    ADD COLUMN `is_offline` tinyint(1) unsigned NOT NULL DEFAULT 0;


text:
package uk.co.pilllogger.adapters;

/**
 * Created by nick on 25/10/13.
 */

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;
import uk.co.pilllogger.R;
import uk.co.pilllogger.activities.DialogActivity;
import uk.co.pilllogger.helpers.DateHelper;
import uk.co.pilllogger.helpers.NumberHelper;
import uk.co.pilllogger.models.Consumption;
import uk.co.pilllogger.models.Pill;
import uk.co.pilllogger.repositories.ConsumptionRepository;
import uk.co.pilllogger.state.State;
import uk.co.pilllogger.views.ColourIndicator;

/**
 * Created by nick on 22/10/13.
 */
public class AddConsumptionPillListAdapter extends ArrayAdapter<Pill> {

    private static final int NEW = 0;
    private static final int EXISTING = 1;
    private List<Pill> _pills;
    private IConsumptionSelected _consumptionSelectedListener;
    private Context _context;
    private int _resourceId;
    private final boolean _showNewPill;
    private final ConsumptionRepository _consumptionRepository;

    public void addOpenPill(Pill pill) {
        State.getSingleton().addOpenPill(pill);
        _consumptionSelectedListener.setDoneEnabled(true);
    }

    public void removeOpenPill(Pill pill) {
        State.getSingleton().removeOpenPill(pill);
        if (!(State.getSingleton().getOpenPills().size() > 0))
            _consumptionSelectedListener.setDoneEnabled(false);
    }

    public void clearOpenPillsList() {
        State.getSingleton().clearOpenPillsList();
        State.getSingleton().clearConsumpedPills();
        _consumptionSelectedListener.setDoneEnabled(false);
    }

    public AddConsumptionPillListAdapter(Context context, IConsumptionSelected activity, int textViewResourceId, List<Pill> pills, boolean showNewPill, ConsumptionRepository consumptionRepository) {
        super(context, textViewResourceId, pills);
        _consumptionSelectedListener = activity;
        _context = context;
        _pills = pills;
        _resourceId = textViewResourceId;
        _showNewPill = showNewPill;
        _consumptionRepository = consumptionRepository;
    }

    public static class ViewHolder {
        public View container;

        public ViewHolder(View view) {
            container = view;
        }
    }

    public static class NewViewHolder extends ViewHolder{
        @InjectView(R.id.pill_list_create_new) public TextView create_new;

        public NewViewHolder(View view){
            super(view);
            ButterKnife.inject(this, view);
            setTypeFace();
        }

        private void setTypeFace(){
            Typeface typeface = State.getSingleton().getTypeface();
            create_new.setTypeface(typeface);
        }
    }

    public static class ExistingViewHolder extends ViewHolder {
        @InjectView(R.id.pill_list_name) public TextView name;
        @InjectView(R.id.pill_list_size) public TextView size;
        @InjectView(R.id.pill_list_units) public TextView units;
        @InjectView(R.id.pill_list_last_taken) public TextView lastTaken;
        @InjectView(R.id.add_consumption_after_click_layout) public View buttonLayout;
        @InjectView(R.id.add_consumption_amount) public TextView amount;
        @InjectView(R.id.add_consumption_pill_colour) public ColourIndicator color;

        public ExistingViewHolder(View view){
            super(view);
            ButterKnife.inject(this, view);
        }
    }

    private void showNewPillDialog() {
        Intent intent = new Intent(_context, DialogActivity.class);
        intent.putExtra("DialogType", DialogActivity.DialogType.NewPill.ordinal());
        _context.startActivity(intent);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        ViewHolder holder = null;
        int rowType = getItemViewType(position);

        if (v == null) {
            LayoutInflater inflater = (LayoutInflater)_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            switch (rowType){
                case NEW:
                    v = inflater.inflate(R.layout.add_consumption_pill_list_new, null);
                    if(v != null){
                        holder = new NewViewHolder(v);
                        v.setTag(holder);
                    }
                    break;

                case EXISTING:
                    v = inflater.inflate(_resourceId, null);
                    if(v != null){
                        holder = new ExistingViewHolder(v);
                        v.setTag(holder);
                    }
                    break;
            }
        }
        else
            holder = (ViewHolder)v.getTag();

        switch(rowType) {
            case NEW:
                holder.container.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        showNewPillDialog();
                    }
                });
                break;

            case EXISTING:
                ExistingViewHolder existingViewHolder = (ExistingViewHolder) holder;
                Pill pill = _pills.get(position);
                if (pill != null && holder != null) {
                    existingViewHolder.name.setText(pill.getName());
                    if (pill.getSize() <= 0) {
                        existingViewHolder.size.setVisibility(View.INVISIBLE);
                        existingViewHolder.units.setVisibility(View.INVISIBLE);
                    } else {
                        existingViewHolder.size.setText(NumberHelper.getNiceFloatString(pill.getSize()));
                        existingViewHolder.units.setText(pill.getUnits());
                        existingViewHolder.size.setVisibility(View.VISIBLE);
                        existingViewHolder.units.setVisibility(View.VISIBLE);
                        Integer value = State.getSingleton().getOpenPills().get(pill);
                        existingViewHolder.amount.setText(value == null ? "0" : String.valueOf(value));
                        if (value != null) {
                            int colour = value > 0 ? _context.getResources().getColor(R.color.highlight_blue) : Color.TRANSPARENT;
                            existingViewHolder.container.setBackgroundColor(colour);
                        }
                        else {
                            existingViewHolder.container.setBackgroundColor(Color.TRANSPARENT);
                        }
                    }
                    existingViewHolder.color.setColour(pill.getColour());

                    Consumption latest = pill.getLatestConsumption();
                    if (latest != null) {
                        String prefix = _context.getString(R.string.last_taken_message_prefix);
                        String lastTaken = DateHelper.getRelativeDateTime(_context, latest.getDate());
                        existingViewHolder.lastTaken.setText(prefix + " " + lastTaken);
                    } else {
                        existingViewHolder.lastTaken.setText(_context.getString(R.string.no_consumptions_message));
                    }
                }
                View add = v.findViewById(R.id.add_consumption_add);
                add.setOnClickListener(new buttonClick(true, existingViewHolder.amount, holder.container, position, this));
                View minus = v.findViewById(R.id.add_consumption_minus);
                minus.setOnClickListener(new buttonClick(false, existingViewHolder.amount, holder.container, position, this));

        }
        return v;
    }

    @Override
    public int getCount() {
        int count = 0;

        if (_pills != null) {
            count = _pills.size();
        }

        return _showNewPill ? count + 1 : count;
    }

    @Override
    public int getItemViewType(int position) {
        return position == _pills.size() ? NEW : EXISTING;
    }

    @Override
    public int getViewTypeCount() {
        return 2;
    }

    public void updateAdapter(List<Pill> pills) {
        _pills = pills;
        this.notifyDataSetChanged();
    }

    public void clearConsumedPills() {
        State.getSingleton().clearConsumpedPills();
    }

    public void addConsumedPill(Pill pill) {
        State.getSingleton().addConsumedPill(pill);

        _consumptionSelectedListener.setDoneEnabled(State.getSingleton().getConsumptionPills().size() > 0);
    }

    public void removeConsumedPill(Pill pill) {
        State.getSingleton().removeConsumedPill(pill);

        _consumptionSelectedListener.setDoneEnabled(State.getSingleton().getConsumptionPills().size() > 0);
    }

    /*
    This is only used when pill selected first time and the pill is auto
    added to the conumption
     */
    public void addConsumedPillAtStart(int position) {
        Pill pill = _pills.get(position);
        State.getSingleton().addConsumedPillAtStart(pill);
    }

    /*
    This is only used when the pill is deselected to remove all instances
     */
    public void removeAllInstancesOfPill(int position) {
        Pill removePill = _pills.get(position);
        State.getSingleton().removeAllInstancesOfPill(removePill);
    }

    public List<Pill> getPillsConsumed() {
        return State.getSingleton().getConsumptionPills();
    }

    private class buttonClick implements View.OnClickListener {

        private boolean _add;
        private TextView _amount;
        private final View _row;
        private int _position;
        private AddConsumptionPillListAdapter _adapter;

        public buttonClick(boolean add, TextView amount, View row, int position, AddConsumptionPillListAdapter adapter) {
            _add = add;
            _amount = amount;
            _row = row;
            _position = position;
            _adapter = adapter;
        }

        @Override
        public void onClick(View view) {
            Pill pill = _pills.get(_position);
            Integer value = State.getSingleton().getOpenPills().get(pill);
            if(value == null) value = 0;

            int amount;
            if (_add) {
                amount = Integer.parseInt(_amount.getText().toString()) + 1;
                State.getSingleton().getOpenPills().put(pill, value + 1);
                _amount.setText(String.valueOf(amount));
                _adapter.addConsumedPill(pill);
            }
            else {
                amount = Integer.parseInt(_amount.getText().toString()) - 1;
                if (amount >= 0 && value > 0) {
                    State.getSingleton().getOpenPills().put(pill, value - 1);
                    _amount.setText(String.valueOf(amount));
                    _adapter.removeConsumedPill(pill);
                }
            }

            if(amount > 0){
                _row.setBackgroundColor(_context.getResources().getColor(R.color.highlight_blue));
            }
            else{
                _row.setBackgroundColor(Color.TRANSPARENT);
            }
        }
    }

    public interface IConsumptionSelected{
        void setDoneEnabled(boolean enabled);
    }
}


text:
layout: page
title: Getting Help
---

Need help with Qubes OS? Try these resources.

### [Search](https://duckduckgo.com/?q=Qubes+OS)

Add **Qubes OS** to refine your query, you might find just what you need.

### [QubesOS Mailing Lists]({{ site.url }}/wiki/QubesLists)

-   Please send all the questions regarding Qubes OS to one of [these]({{ site.url }}/wiki/QubesLists) mailing lists.
-   To subscribe to the user list, send a blank mail to `qubes-users+subscribe@googlegroups.com`.
-   By sending a message to the appropriate mailing list, you are not only giving others a chance to help you,
but you may also be helping others by starting a public discussion about a shared problem or interest.
-   **Please do not send questions to individual Qubes developers.**

### [QubesOS/qubes-wiki]({{ site.help_url }}/UserFaq#qubes-users-faq)

Search through the issues that the fine folks on the **Qubes Documentation** team
have answered, or ask your own at **qubes-users** mailinglist.

### [QubesOS/qubes-issues](https://github.com/QubesOS/qubes-issues/issues)

Search through the issues on the main Qubes OS development. Think you've
found a bug? File a new issue.

### [QubesOS on StackOverflow](https://stackoverflow.com/questions/tagged/Qubes+OS)

StackOverflow is a staple of any developer's diet. Check out the QubesOS tag
on StackOverflow for an answer to your question. Not there? Ask a new
question!

### [QubesOS IRC Channel](irc:irc.freenode.net/qubes)

Get together at **#qubes** on **irc.freenode.net**, the inofficial
QubesOS IRC channel.


text:
import * as vscode from 'vscode';

export const exists = async (resource: vscode.Uri): Promise<boolean> => {
	try {
		const stat = await vscode.workspace.fs.stat(resource);
		// stat.type is an enum flag
		return !!(stat.type & vscode.FileType.File);
	} catch {
		return false;
	}
};