text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Form\Extension;

use Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionScopeType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Twig\Environment;

final class CatalogPromotionScopeTypeExtension extends AbstractTypeExtension
{
    private array $scopeTypes = [];

    private array $scopeConfigurationTypes;

    public function __construct(iterable $scopeConfigurationTypes, private Environment $twig)
    {
        foreach ($scopeConfigurationTypes as $type => $formType) {
            $this->scopeConfigurationTypes[$type] = $formType::class;
            $this->scopeTypes['sylius.form.catalog_promotion.scope.' . $type] = $type;
        }
    }

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('type', ChoiceType::class, [
                'label' => 'sylius.ui.type',
                'choices' => $this->scopeTypes,
                'choice_attr' => function (?string $type) use ($builder): array {
                    return [
                        'data-configuration' => $this->twig->render(
                            '@SyliusAdmin/CatalogPromotion/Scope/' . $type . '.html.twig',
                            ['field' => $builder->create('configuration', $this->scopeConfigurationTypes[$type])->getForm()->createView()]
                        ),
                    ];
                },
            ])
        ;
    }

    public static function getExtendedTypes(): iterable
    {
        return [CatalogPromotionScopeType::class];
    }
}


text:
package io.github.phdbrown.cssparser;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
 * Scans the input stream for CSS syntax. Each Object that is a CSS component is recognized as a Token
 * and is handled by the {@link CSSParser parser}.
 * @author Phil Brown
 * @since 2:39:59 PM Dec 18, 2013
 */
public class Scanner implements ParserConstants
{
	/** Default charset */
	private String charset = "UTF-8";
	/** The current character that has been read by the buffer */
	private char C;
	/** Input stream reader */
	private BufferedReader source;

	//note that cursor, charInLine, and line may get thrown off by some at-rules that modify the input stream

	/** Used to remember the current index while reading through the input source. */
	private int cursor = 0;
	/** Used to note which on character in the current line an error has occured. */
	private int charInLine = 0;
	/** Keeps track of which line is being parsed. */
	private int line = 1;

	/** Keeps track of imports so no redundant calls are made */
	private List<String> imports = new ArrayList<String>();
	/** Keeps track of supports statements so no redundant calls are made */
	private List<String> supports = new ArrayList<String>();

	/** The input stream */
	private InputStream is;

	/** character that is used as a line delimeter. this is used for counting lines are characters in lines. */
	private char lineSeparator = Character.LINE_SEPARATOR;

	/**
	 * Constructor
	 * @param source
	 * @throws IOException
	 */
	public Scanner(InputStream source) throws IOException
	{
		this.is = source;
		this.source = new BufferedReader(new InputStreamReader(is, charset));
		getChar();

	}

	/**
	 * Append CSS to the end of the current css input stream.
	 * @param ruleSets
	 * @throws IOException
	 */
	public void include(String ruleSets) throws IOException
	{
		if (supports.contains(ruleSets))
			return;
		supports.add(ruleSets);
		//costly.
		StringBuilder builder = new StringBuilder();
		String read = source.readLine();
		while(read != null) {
		    //System.out.println(read);
			builder.append(read);
			read = source.readLine();
		}
		source.close();
	    String currentStreamContents = builder.toString();

	    this.is = new ByteArrayInputStream(String.format(Locale.US, "%s %s", currentStreamContents,ruleSets).getBytes());
	    this.source = new BufferedReader(new InputStreamReader(is, charset));
		//getChar();
	}

	/**
	 * Includes a stylesheet in the inputstream
	 * @param stylesheet
	 * @param name
	 * @throws IOException
	 */
	public void include(InputStream stylesheet, String name) throws IOException
	{

		if (imports.contains(name))
			return;

		imports.add(name);

		//costly.
		StringBuilder builder = new StringBuilder();
		String read = source.readLine();
		builder.append(C);//no
		while(read != null) {
		    System.out.println(read);
			builder.append(read);
			read = source.readLine();
		}
		source.close();
	    String currentStreamContents = builder.toString();
	    java.util.Scanner s = new java.util.Scanner(stylesheet).useDelimiter("\\A");
	    String newStreamContents = s.hasNext() ? s.next() : "";

	    this.is = new ByteArrayInputStream(String.format(Locale.US, "%s%s", newStreamContents,currentStreamContents).getBytes());
		this.source = new BufferedReader(new InputStreamReader(is, charset));
		getChar();

	}

	/**
	 * changes the charset
	 * @param charset
	 * @throws IOException
	 */
	public void changeCharset(String charset) throws IOException
	{
		if (this.charset.equalsIgnoreCase(charset))
			return;
		this.charset = charset;
		//change the charset

		//costly.
		StringBuilder builder = new StringBuilder();
		String read = source.readLine();
		while(read != null) {//This messes up cursor?
			builder.append(read);
			read = source.readLine();
		}
		charInLine = 1;
		source.close();
	    String currentStreamContents = builder.toString();
	    this.source = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(currentStreamContents.getBytes()), charset));
	    cursor++;
	    charInLine = 0;
	    line++;
	}

	/**
	 * Read the next character from the input stream
	 * @throws IOException
	 */
	private void getChar() throws IOException
	{
		C = (char) source.read();
		cursor++;
		charInLine++;
		if (C == lineSeparator)
		{
			line++;
			charInLine = 0;
		}
	}

	/**
	 * Read the next token from the input stream
	 * @return
	 * @throws IOException
	 */
	public Token nextToken() throws IOException
	{
		return nextToken(true);
	}

	/**
	 * Read the next token from the input stream
	 * @param ignoreWhitespace {@code true} to ignore whitespace, otherwise {@code false}
	 * @return
	 * @throws IOException
	 */
	public Token nextToken(boolean ignoreWhitespace) throws IOException
	{
		String attribute = "";

		if (ignoreWhitespace)
		{
			//get through whitespace
			while (Character.isWhitespace(C))
			{
				getChar();
			}
		}

		//Identifier or reserved word
		if (Character.isLetter(C) || C == '-' || C == '_')
		{
			while (Character.isLetter(C) || C == '-' || Character.isDigit(C) || C == '_')
			{
				attribute += C;
				getChar();
			}
			return new Token(lookup(attribute), attribute);
		}
		if (Character.isDigit(C))
		{
			while (Character.isDigit(C))
			{
				attribute += C;
				getChar();
			}
			return new Token(NUMBER, attribute);
		}
		switch (C)
		{
			case '/' : {//Slash or Comment
				getChar();
				if (C == '*')
				{
					boolean inComment = true;
					while (inComment)
					{
						getChar();
						if (C == '*')
						{
							getChar();
							if (C == '/')
							{
								inComment = false;
							}
							else
							{
								attribute += '*';
								attribute += C;
							}
						}
						else
						{
							attribute += C;
						}
					}
					getChar();
					return nextToken(ignoreWhitespace);//new Token(COMMENT, attribute);
				}
				return new Token(SLASH, null);
			}
			case '.' : {
				getChar();
				return new Token(DOT, null);
			}
			case '#' : {
				getChar();
				return new Token(HASH, null);
			}
			case '*' : {
				getChar();
				if (C == '=')
				{
					getChar();
					return new Token(TIMES_EQUAL, null);
				}
				return new Token(TIMES, null);
			}
			case ',' : {
				getChar();
				return new Token(COMMA, null);
			}
			case '>' : {
				getChar();
				return new Token(GT, null);
			}
			case '+' : {
				getChar();
				return new Token(PLUS, null);
			}
			case '[' : {
				getChar();
				return new Token(LEFTSQ, attribute);
			}
			case ']' : {
				getChar();
				return new Token(RIGHTSQ, attribute);
			}
			case '{' : {
				getChar();
				return new Token(LEFT_CURLY_BRACKET, attribute);
			}
			case '}' : {
				getChar();
				return new Token(RIGHT_CURLY_BRACKET, attribute);
			}
			case ':' : {
				getChar();
				if (C == ':')
				{
					getChar();
					return new Token(DOUBLE_COLON, null);
				}
				return new Token(COLON, null);
			}
			case '=' : {
				getChar();
				return new Token(EQUAL, null);
			}
			case '(' : {
				getChar();
				return new Token(LEFTPAREN, null);
			}
			case ')' : {
				getChar();
				return new Token(RIGHTPAREN, null);
			}
			case '~' : {
				getChar();
				if (C == '=')
				{
					getChar();
					return new Token(NOT_EQUAL, null);
				}
				return new Token(NOT,null);
			}
			case '|' : {
				getChar();
				if (C == '=')
				{
					getChar();
					return new Token(OR_EQUAL, null);
				}
				return new Token(OR,null);
			}
			case '^' : {
				getChar();
				if (C == '=')
				{
					getChar();
					return new Token(CARET_EQUAL, null);
				}
				return new Token(CARET,null);
			}
			case '$' : {
				getChar();
				if (C == '=')
				{
					getChar();
					return new Token(DOLLAR_EQUAL, null);
				}
				return new Token(DOLLAR,null);
			}
			case '@' : {
				getChar();
				if (Character.isLetter(C))
				{
					while (Character.isLetter(C) || C == '-')
					{
						attribute += C;
						getChar();
					}
					return new Token(AT_RULE, attribute);
				}
				return new Token(AT, null);
			}
			case ';' : {
				getChar();
				return new Token(SEMICOLON, null);
			}
			case '%' : {
				getChar();
				return new Token(PERCENT, null);
			}
			case ' ' : {
				getChar();
				return new Token(SPACE, null);
			}
			case '"' : {
				getChar();
				return new Token(DOUBLE_QUOTE, null);
			}
			case EOFCHAR : {
				return new Token(EOF, null);
			}
			default : {
				System.out.println(String.format(Locale.US, "Unexpected Token '%s'", String.valueOf(C)));
				getChar();
				return nextToken();
			}
		}
	}

	/**
	 * Get the Token for reserved word or identifier
	 * @param word
	 * @return
	 */
	private int lookup(String word)
	{
		for (int i = 1; i < RESERVEDWORD.length; i++)
		{
			if (word.equalsIgnoreCase(RESERVEDWORD[i]))
				return i;
		}
		return IDENTIFIER;
	}

	/**
	 * Get the current line number of the scanner
	 * @return
	 */
	public int getLineNumber()
	{
		return line;
	}

	/**
	 * Get the current character number of the scanner
	 * @return
	 */
	public int getCharacterNumber()
	{
		return cursor+1;
	}

	/**
	 * Get the current character number for the current line that is being scanned
	 * @return
	 */
	public int getCharacterNumberForCurrentLine()
	{
		return charInLine+1;
	}

	/**
	 * Get the line delimiter character
	 * @return
	 */
	public char getLineSeparator() {
		return lineSeparator;
	}

	/**
	 * Set the line delimiter character
	 * @param lineSeparator
	 */
	public void setLineSeparator(char lineSeparator) {
		this.lineSeparator = lineSeparator;
	}

}

redpajama_set_name: RedPajamaGithub


text:
@implementation IBAlertView

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle okTitle:(NSString *)okTitle dismissBlock:(void (^)(void))dismissBlock okBlock:(void (^)(void))okBlock {
    [[IBAlertView alertWithTitle:title message:message dismissTitle:dismissTitle okTitle:okTitle dismissBlock:dismissBlock okBlock:okBlock] show];
}

+ (id)alertWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle okTitle:(NSString *)okTitle dismissBlock:(void (^)(void))dismissBlock okBlock:(void (^)(void))okBlock {
    return [[IBAlertView alloc] initWithTitle:title message:message dismissTitle:dismissTitle okTitle:okTitle dismissBlock:dismissBlock okBlock:okBlock];
}

+ (void)showDismissWithTitle:(NSString *)title message:(NSString *)message {
    [self showDismissWithTitle:title message:message dismissBlock:nil];
}

+ (void)showDismissWithTitle:(NSString *)title message:(NSString *)message dismissBlock:(void (^)(void))dismissBlock {
    [[IBAlertView alertWithTitle:title message:message dismissTitle:NSLocalizedString(@"Dismiss", nil) okTitle:nil dismissBlock:dismissBlock okBlock:nil] show];
}

- (id)initWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle okTitle:(NSString *)okTitle dismissBlock:(void (^)(void))dismissBlock okBlock:(void (^)(void))okBlock {
    self = [super initWithTitle:title message:message delegate:self cancelButtonTitle:dismissTitle otherButtonTitles:okTitle, nil];

    if (self) {
        okCallback_ = [okBlock copy];
        dismissCallback_ = [dismissBlock copy];
    }

    return self;
}

+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle dismissBlock:(void (^)(void))dismissBlock {
    [[IBAlertView alertWithTitle:title message:message dismissTitle:dismissTitle dismissBlock:dismissBlock] show];
}

+ (id)alertWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle dismissBlock:(void (^)(void))dismissBlock {
    return [[IBAlertView alloc] initWithTitle:title message:message dismissTitle:dismissTitle dismissBlock:dismissBlock];
}

- (id)initWithTitle:(NSString *)title message:(NSString *)message dismissTitle:(NSString *)dismissTitle dismissBlock:(void (^)(void))dismissBlock {
    self = [super initWithTitle:title message:message delegate:self cancelButtonTitle:dismissTitle otherButtonTitles:nil];

    if (self) {
        dismissCallback_ = [dismissBlock copy];
    }

    return self;
}

#pragma mark -

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (self.numberOfButtons == 2) {
        if (buttonIndex == 0) {
            if (dismissCallback_) {
                dismissCallback_();
            }
        } else {
            if (okCallback_) {
                okCallback_();
            }
        }
    } else {
        if (dismissCallback_) {
            dismissCallback_();
        }
    }
}

@end


text:
package processing.sound;
import processing.core.PApplet;

public class Env {

	PApplet parent;
	private Engine m_engine;
	int[] m_nodeId = {-1, -1};
	private int[] m_busses;

	public Env (PApplet theParent) {
		this.parent = theParent;
		parent.registerMethod("dispose", this);
		m_engine.setPreferences(theParent, 512, 44100);
    	m_engine.start();
    	m_busses = m_engine.busConstructStereo();
	}

	public void play(SoundObject input, float attackTime, float sustainTime, float sustainLevel, float releaseTime){
		m_nodeId = m_engine.envelopePlay(input.returnId(), attackTime, sustainTime, sustainLevel, releaseTime, m_busses);
	}

	public int[] returnId(){
		return m_nodeId;
	}

	public void dispose(){
		m_engine.synthStop(m_nodeId);
	}
};


text:
chown -h root.system /sys/devices/platform/msm_hsusb/gadget/wakeup
chmod -h 220 /sys/devices/platform/msm_hsusb/gadget/wakeup

# Target as specified in build.prop at compile-time
target=`getprop ro.board.platform`

# Set platform variables
if [ -d /sys/devices/soc0 ]; then
    soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
    soc_id=`cat /sys/devices/soc0/soc_id` 2> /dev/null
else
    soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
fi

#
# soc_id may specify additional chip variants not captured in ro.board.platform
# so allow for additional target differentiation based on that
#
case $soc_id in
    "252")
        target="apq8092"
    ;;
    "253")
        target="apq8094"
    ;;
esac

#
# Allow persistent usb charging disabling
# User needs to set usb charging disabled in persist.usb.chgdisabled
#
usbchgdisabled=`getprop persist.usb.chgdisabled`
case "$usbchgdisabled" in
    "") ;; #Do nothing here
    * )
    case $target in
        "msm8660")
        echo "$usbchgdisabled" > /sys/module/pmic8058_charger/parameters/disabled
        echo "$usbchgdisabled" > /sys/module/smb137b/parameters/disabled
	;;
        "msm8960")
        echo "$usbchgdisabled" > /sys/module/pm8921_charger/parameters/disabled
	;;
    esac
esac

usbcurrentlimit=`getprop persist.usb.currentlimit`
case "$usbcurrentlimit" in
    "") ;; #Do nothing here
    * )
    case $target in
        "msm8960")
        echo "$usbcurrentlimit" > /sys/module/pm8921_charger/parameters/usb_max_current
	;;
    esac
esac

#
# Check ESOC for external MDM
#
# Note: currently only a single MDM is supported
#
if [ -d /sys/bus/esoc/devices ]; then
for f in /sys/bus/esoc/devices/*; do
    if [ -d $f ]; then
        esoc_name=`cat $f/esoc_name`
        if [ "$esoc_name" = "MDM9x25" -o "$esoc_name" = "MDM9x35" ]; then
            esoc_link=`cat $f/esoc_link`
            break
        fi
    fi
done
fi

#
# Allow USB enumeration with default PID/VID
#
baseband=`getprop ro.baseband`
debuggable=`getprop ro.debuggable`
echo 1  > /sys/class/android_usb/f_mass_storage/lun/nofua
usb_config=`getprop persist.sys.usb.config`
build_type=`getprop ro.build.type`
case "$usb_config" in
    "" | "adb" | "none") #USB persist config not set, select default configuration
      case "$esoc_link" in
          "HSIC")
              setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
              setprop persist.rmnet.mux enabled
          ;;
          "HSIC+PCIe")
              setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,rmnet_qti_ether,mass_storage,adb
          ;;
          "PCIe")
              setprop persist.sys.usb.config diag,diag_mdm,serial_tty,rmnet_qti_ether,mass_storage,adb
          ;;
          *)
          case "$baseband" in
              "mdm")
                   setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
              ;;
              "mdm2")
                   setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
              ;;
              "sglte")
                   setprop persist.sys.usb.config diag,diag_qsc,serial_smd,serial_tty,serial_hsuart,rmnet_hsuart,mass_storage,adb
              ;;
              "dsda" | "sglte2")
                   setprop persist.sys.usb.config diag,diag_mdm,diag_qsc,serial_hsic,serial_hsuart,rmnet_hsic,rmnet_hsuart,mass_storage,adb
              ;;
              "dsda2")
                   setprop persist.sys.usb.config diag,diag_mdm,diag_mdm2,serial_hsic,serial_hsusb,rmnet_hsic,rmnet_hsusb,mass_storage,adb
              ;;
              *)
		case "$target" in
                        "msm8916")
                            setprop persist.sys.usb.config diag,serial_smd,rmnet_bam,adb
                        ;;
                        "apq8094" | "apq8092")
                            setprop persist.sys.usb.config diag,adb
                        ;;
                        "msm8994" | "msm8992")
                            if [ -z "$debuggable" -o "$debuggable" = "1" ]; then
                                setprop persist.sys.usb.config mtp,adb
                            else
                                setprop persist.sys.usb.config mtp
                            fi
                        ;;
                        "msm8909")
                            setprop persist.sys.usb.config diag,serial_smd,rmnet_qti_bam,adb
                        ;;
                        *)
                            setprop persist.sys.usb.config diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb
                        ;;
                    esac
              ;;
          esac
          ;;
      esac
    ;;
    * ) ;; #USB persist config exists, do nothing
esac

#
# Do target specific things
#
case "$target" in
    "msm8974")
# Select USB BAM - 2.0 or 3.0
        echo ssusb > /sys/bus/platform/devices/usb_bam/enable
    ;;
    "apq8084")
	if [ "$baseband" == "apq" ]; then
		echo "msm_hsic_host" > /sys/bus/platform/drivers/xhci_msm_hsic/unbind
	fi
    ;;
    "msm8226")
         if [ -e /sys/bus/platform/drivers/msm_hsic_host ]; then
             if [ ! -L /sys/bus/usb/devices/1-1 ]; then
                 echo msm_hsic_host > /sys/bus/platform/drivers/msm_hsic_host/unbind
             fi
         fi
    ;;
    "msm8994" | "msm8992")
        echo BAM2BAM_IPA > /sys/class/android_usb/android0/f_rndis_qc/rndis_transports
    ;;
esac

#
# set module params for embedded rmnet devices
#
rmnetmux=`getprop persist.rmnet.mux`
case "$baseband" in
    "mdm" | "dsda" | "sglte2")
        case "$rmnetmux" in
            "enabled")
                    echo 1 > /sys/module/rmnet_usb/parameters/mux_enabled
                    echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
                    echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
            ;;
        esac
        echo 1 > /sys/module/rmnet_usb/parameters/rmnet_data_init
        # Allow QMUX daemon to assign port open wait time
        chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
    ;;
    "dsda2")
          echo 2 > /sys/module/rmnet_usb/parameters/no_rmnet_devs
          echo hsicctl,hsusbctl > /sys/module/rmnet_usb/parameters/rmnet_dev_names
          case "$rmnetmux" in
               "enabled") #mux is neabled on both mdms
                      echo 3 > /sys/module/rmnet_usb/parameters/mux_enabled
                      echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
                      echo 17 > write /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
               ;;
               "enabled_hsic") #mux is enabled on hsic mdm
                      echo 1 > /sys/module/rmnet_usb/parameters/mux_enabled
                      echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
                      echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
               ;;
               "enabled_hsusb") #mux is enabled on hsusb mdm
                      echo 2 > /sys/module/rmnet_usb/parameters/mux_enabled
                      echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
                      echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
               ;;
          esac
          echo 1 > /sys/module/rmnet_usb/parameters/rmnet_data_init
          # Allow QMUX daemon to assign port open wait time
          chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
    ;;
esac

#
# Add support for exposing lun0 as cdrom in mass-storage
#
cdromname="/system/etc/cdrom_install.iso"
case "$target" in
	"msm8226" | "msm8610" | "msm8916")
		case $soc_hwplatform in
			"QRD")
				echo "mounting usbcdrom lun"
				echo $cdromname > /sys/class/android_usb/android0/f_mass_storage/rom/file
				chmod 0444 /sys/class/android_usb/android0/f_mass_storage/rom/file
				;;
		esac
		;;
esac

#
# Initialize RNDIS Diag option. If unset, set it to 'none'.
#
diag_extra=`getprop persist.sys.usb.config.extra`
if [ "$diag_extra" == "" ]; then
	setprop persist.sys.usb.config.extra none
fi


text:
layout: post
title: python基本使用
category: artical
tags: [IC, LNA]
---
- 使用国内镜像下载pip
```
pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install turtle --trusted-host mirrors.aliyun.com
```

- jupyter
···
pip install ipython --upgrade

···
- virtualenv
可以对不同程序创建不同的运行环境。
- virtualenv env #安装env
- env\Scripts\activate #进入env
- deactivate #退出虚拟env


text:
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.

Example 1:
```
Input:nums = [1,1,1], k = 2
Output: 2
```
Note:
1. The length of the array is in range [1, 20,000].
2. The range of numbers in the array is [-1000, 1000] and the range of the integer k is [-1e7, 1e7].


text:
package com.wlitsoft.javademo.springrabbitmqquickstart;

import org.junit.Test;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by liliang on 2017/7/5.
 */
@Service
public class MQProducer {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @Test
    public void sendDataToQueue(String queueKey,Object object){
        this.amqpTemplate.convertAndSend(queueKey,object);
    }
}


text:
import alt from '../alt';

class QueryActions {
  constructor() {
    this.generateActions(
      'receivedQuery',
      'receivedQueries',
      'fetchSavedQueries',
      'fetchedSavedQueries',
      'selectQuery',
      'destroyQuery',
      'createQuery'
    );
  }
}

export default alt.createActions(QueryActions);


text:
package org.apache.sysml.lops;

import org.apache.sysml.lops.LopProperties.ExecLocation;
import org.apache.sysml.lops.LopProperties.ExecType;
import org.apache.sysml.lops.compile.JobType;
import org.apache.sysml.parser.Expression.DataType;
import org.apache.sysml.parser.Expression.ValueType;

public class Compression extends Lop
{
	public static final String OPCODE = "compress";

	public enum CompressConfig {
		TRUE,
		FALSE,
		AUTO;
		public boolean isEnabled() {
			return this == TRUE || this == AUTO;
		}
	}

	public Compression(Lop input, DataType dt, ValueType vt, ExecType et) {
		super(Lop.Type.Checkpoint, dt, vt);
		this.addInput(input);
		input.addOutput(this);

		boolean breaksAlignment = false;
		boolean aligner = false;
		boolean definesMRJob = false;

		lps.addCompatibility(JobType.INVALID);
		lps.setProperties( inputs, et, ExecLocation.ControlProgram, breaksAlignment, aligner, definesMRJob );
	}

	@Override
	public String toString() {
		return "Compress";
	}

	@Override
	public String getInstructions(String input1, String output) {
		StringBuilder sb = new StringBuilder();
		sb.append( getExecType() );
		sb.append( Lop.OPERAND_DELIMITOR );
		sb.append( OPCODE );
		sb.append( OPERAND_DELIMITOR );
		sb.append( getInputs().get(0).prepInputOperand(input1));
		sb.append( OPERAND_DELIMITOR );
		sb.append( prepOutputOperand(output));
		return sb.toString();
	}
}


text:
package ch.vrsg.edu.webservice.application.ws;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import javax.inject.Inject;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.ws.LogicalMessage;
import javax.xml.ws.handler.LogicalHandler;
import javax.xml.ws.handler.LogicalMessageContext;
import javax.xml.ws.handler.MessageContext;

import org.apache.log4j.Logger;

/**
 * Der {@code LogicalHandler} liest alle Daten aus den Paylod
 * ({@code LogicalMessageContext}) des SOAP Body einer SOAP Message aus
 * und schreibt diese Informationen ins Log.
 * <p/>
 *
 * @author René Anderes
 * @see {@link https://jax-ws.java.net/articles/handlers_introduction.html}
 *
 */
public class PayloadLoggingHandler implements LogicalHandler<LogicalMessageContext> {

    @Inject
    private Logger logger;

    @Override
    public void close(MessageContext context) {
        // nothing to do...
    }

    @Override
    public boolean handleFault(LogicalMessageContext context) {
        return processMessage(context);
    }

    @Override
    public boolean handleMessage(LogicalMessageContext context) {
        return processMessage(context);
    }

    private boolean processMessage(final LogicalMessageContext context) {
        if (!logger.isTraceEnabled()) {
            return true;
        }
        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        try {
            if (isOutboundProperty(context)) {
                outputStream.write("Outbound message:\n".getBytes());
            } else {
                outputStream.write("Inbound message:\n".getBytes());
            }
            final LogicalMessage lm = context.getMessage();
            final Source payload = lm.getPayload();
            printSource(payload, outputStream);
            logger.trace(outputStream.toString());
        } catch (IOException | TransformerException e) {
            logger.warn(e);
        }
        return true;
    }

    private Boolean isOutboundProperty(final LogicalMessageContext context) {
        return (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    }

    private void printSource(final Source payload, final OutputStream outputStream) throws TransformerException {
        final TransformerFactory factory = TransformerFactory.newInstance();
        final Transformer transformer = factory.newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        final Result result = new StreamResult(outputStream);
        transformer.transform(payload, result);
    }
}


text:
Sudoku
======

Introduction
------------

Just for fun, I am attempting to write a sudoko solver program in different languages.
I did the first implementation in Haskell because it keeps me honest by making difficult to take questionable shortcuts.

The current implementation uses a combination of Depth First Search with a repeated applications of single elimination rules (naked single).
It solves all the sudokus from project Euler and a the list of hard sudokus from Peter Norvig.

For the specifics on each implementation follow the link:

* [Haskell] (haskell/README.md)
* [Clojure] (clojure/README.md)


text:
<!DOCTYPE html>

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

      <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    <title>Ligue 1 - Evolution des principaux clubs</title>
    <link rel="icon" href="img/ballon.png" />

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/grayscale.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">

                </button>

                        A PROPOS

                        Contact

                      CARTE FRANCE

                      BAR CHART

LIGUE 1

Evolution des performances des principaux club professionel français de foot

A PROPOS DE NOTRE PROJET

Projet d'évolution des clubs de Ligue 1 :  liste des clubs, variables et années

Contactez nous

Pour plus d'informations

                joanna.bujoli@gmail.com

                         Github

 <select  id ="selecte" onchange="update(this.value)">
        <option value="X2009">Budget 2009</option>
        <option value="X2010">Budget 2010</option>
        <option value="X2011"> Budget 2011 </option>
        <option value="X2012" > Budget 2012 </option>
        <option value="X2013" selected="selected">Budget 2013</option>
        <option class="select-dash" disabled="disabled">----</option>
        <option value="X2009.1">Recette 2009</option>
        <option value="X2010.1">Recette 2010</option>
        <option value="X2011.1">Recette 2011</option>
        <option value="X2012.1">Recette 2012</option>
      </select>

 Informations sur le club :

Bar Chart

 Informations sur le club :

         <select  id ="selecte1" onchange="update2(this.value)">
           <option class="select-dash" disabled="disabled">Années</option>
           <option value="2009" >2009</option>
           <option value="2010" >2010</option>
           <option value="2011">2011</option>
           <option value="2012" >2012</option>
           <option value="2013" selected="selected">2013</option>
         </select>
         <select  id ="selecte2" onchange="update2(this.value)">
           <option class="select-dash" disabled="disabled">Variables </option>
           <option value="points" selected="selected">Points</option>
            <option value="joues">Nb matchs joués</option>
           <option value="gagnes">Nb matchs gagnés</option>
            <option value="nuls">Nb matchs nuls</option>
             <option value="perdus">Nb matchs perdus</option>
              <option value="marques">Nb buts marqués</option>
               <option value="encaisses">Nb buts encaissés</option>
         </select>

Copyright © Joanna B. 2015


text:
namespace mojo {
template <>
struct StructTraits<chromecast::shell::mojom::BitstreamAudioCodecsInfoDataView,
                    chromecast::BitstreamAudioCodecsInfo> {
  static int32_t codecs(const chromecast::BitstreamAudioCodecsInfo& info) {
    return info.codecs;
  }

  static int32_t spatial_rendering(
      const chromecast::BitstreamAudioCodecsInfo& info) {
    return info.spatial_rendering;
  }

  static bool Read(
      chromecast::shell::mojom::BitstreamAudioCodecsInfoDataView input,
      chromecast::BitstreamAudioCodecsInfo* output) {
    output->codecs = input.codecs();
    output->spatial_rendering = input.spatial_rendering();
    return true;
  }
};
}  // namespace mojo

#endif  // CHROMECAST_COMMON_MOJOM_APPLICATION_MEDIA_CAPABILITIES_TRAITS_H_


text: Some code snippets for daily work


text:
namespace blink {

class StylePath;

class CSSPathValue : public CSSValue {
public:
    static CSSPathValue* create(PassRefPtr<StylePath>);
    static CSSPathValue* create(PassOwnPtr<SVGPathByteStream>);

    static CSSPathValue& emptyPathValue();

    StylePath* stylePath() const { return m_stylePath.get(); }
    String customCSSText() const;

    bool equals(const CSSPathValue&) const;

    DECLARE_TRACE_AFTER_DISPATCH();

    const SVGPathByteStream& byteStream() const { return m_stylePath->byteStream(); }

private:
    CSSPathValue(PassRefPtr<StylePath>);

    RefPtr<StylePath> m_stylePath;
};

DEFINE_CSS_VALUE_TYPE_CASTS(CSSPathValue, isPathValue());

} // namespace blink

#endif // CSSPathValue_h


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">

    <!--New From-->
    <form name="SalesReport" type="single" target="checkReportBy" title=""
          header-row-style="header-row" default-table-style="table" target-window="_BLANK">
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-time type="date"/></field>
        <field name="reportBy" title="${uiLabelMap.BirtOrderReportReportBy}">
            <drop-down>
                <option key="day" description="${uiLabelMap.CommonDays}"></option>
                <option key="week" description="${uiLabelMap.CommonWeeks}"></option>
                <option key="month" description="${uiLabelMap.CommonMonths}"></option>
            </drop-down>
        </field>
        <field name="exportType" title="${uiLabelMap.BirtOrderReportFormatType}">
            <drop-down>
                <option key="pdf" description="PDF"></option>
                <option key="excel" description="Excel"></option>
                <option key="html" description="HTML"></option>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="btn btn-default btn-sm"><submit button-type="button"/></field>
    </form>

    <form name="NetBeforeOverheadReport" type="single" target="NetBeforeOverheadReport.pdf" title=""
          header-row-style="header-row" default-table-style="table" target-window="_BLANK">
        <field name="productStoreId">
            <drop-down allow-empty="false">
                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
                <entity-options entity-name="ProductStore" description="${storeName} [${productStoreId}]">
                    <entity-order-by field-name="storeName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="btn btn-default btn-sm"><submit button-type="button"/></field>
    </form>

    <form name="ProductDemandReport" type="single" target="ProductDemandReport.pdf" title=""
          header-row-style="header-row" default-table-style="table" target-window="_BLANK">
        <field name="productStoreId">
            <drop-down allow-empty="false">
                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
                <entity-options entity-name="ProductStore" description="${storeName} [${productStoreId}]">
                    <entity-order-by field-name="storeName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="btn btn-default btn-sm"><submit button-type="button"/></field>
    </form>

    <form name="OrderByReferrer" type="single" target="OrderByReferrer.pdf" target-window="_BLANK">
        <!--field name="referrerUrl"><text-find default-option="contains"/></field-->
        <field name="referrerUrl" title=" "><display description="${uiLabelMap.BirtOrderReportAllReferrer}"></display></field>
        <field name="submit" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
    </form>
    <form name="SaleOrdersByChannel" type="single" target="OrdersByChannel.pdf" target-window="_BLANK">
        <field name="SalesChannel" title="${uiLabelMap.OrderSalesChannel}">
            <drop-down allow-empty="false">
                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
                <entity-options description="${description}" entity-name="Enumeration" key-field-name="description">
                    <entity-constraint name="enumTypeId" operator="equals" value="ORDER_SALES_CHANNEL"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submit" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
    </form>
    <form name="SaleOrderDiscountCode" type="single" target="OrderDiscountCode.pdf" target-window="_BLANK">
        <field name="discountCodeUrl" title=" "><display description="${uiLabelMap.BirtOrderReportAllOrderItemsWithDiscountCode}"></display></field>
        <field name="submit" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
    </form>
    <form name="Last3MonthsSalesReport" type="single" target="Last3MonthsSalesReport.pdf" target-window="_BLANK">
        <field name="submit" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
    </form>
    <form name="CouponSalesReport" type="single" target="CouponSalesReport.pdf" target-window="_BLANK">
        <field name="submit" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
    </form>
</forms>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GenericRegex
{
    class SeqExpression<T> : ExpressionBase<T>
    {
        public SeqExpression(IEnumerable<ExpressionBase<T>> expressions)
        {
            _expressions = expressions.ToList();
        }

        readonly List<ExpressionBase<T>> _expressions;

        public IReadOnlyCollection<ExpressionBase<T>> Expressions => _expressions;

        internal override IEnumerable<MatchContext<T>> Match(MatchContext<T> context)
        {
            return Match(context, 0);
        }

        IEnumerable<MatchContext<T>> Match(MatchContext<T> context, int position)
        {
            if (position < _expressions.Count)
            {
                foreach (var newContext in _expressions[position].Match(context))
                {
                    foreach (var resultingContext in Match(newContext, position + 1))
                    {
                        yield return resultingContext;
                    }
                }
            }
            else
            {
                yield return context;
            }
        }

        public override string ToString() => $"Seq({string.Join(", ", _expressions)})";
    }
}


text:
@implementation RYGridCellModel

- (void)resetStatus {
    self.isSelected = NO;
    self.orderIndex = -1;
}

@end


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
  <title>Gearpump Client Commandline - Gearpump 0.7.2 Documentation</title>

   <meta name="description" content="Gearpump Client Commandline">

  <link rel="stylesheet" href="css/bootstrap-3.3.5.min.css">

  <link rel="stylesheet" href="css/main.css">
  <link rel="stylesheet" href="css/pygments-default.css">

        Gearpump
          0.7.2

Overview

            Introduction

Submit Your 1st Application

Client Command Line

Basic Concepts

Technical Highlights

Reliable Message Delivery

Performance

Gearpump Internals

            Deploying

Deployment

Docker

Local

Standalone

YARN

High Availability

Reliable Message Delivery

Configuration

Security

            Programming Guide

Write Your 1st App

Customized Message Passing

Scala API

Java API

RESTful API

Gearpump Connectors

Storm Compatibility

            More

How to Contribute

Coding Style

FAQ

About

Gearpump Client Commandline

The commands can be found at: “bin” folder of Gearpump binary.

NOTE: on MS Windows platform, please use window shell gear.bat script instead. bash script doesn’t work well in cygwin/mingw.

Submit an new application

You can use the command gear under the bin directory to submit, query and terminate an application:

gear app [-namePrefix <application name prefix>] [-conf <custom gearpump config file>] -jar xx.jar MainClass <arg1> <arg2> ...

List all running applications

To list all running applications:

gear info  [-conf <custom gearpump config file>]

Kill a running application

To kill an application:

gear kill -appid <application id>  [-conf <custom gearpump config file>]

Submit a storm application to Gearpump Cluster

For example, to submit a storm application jar:

storm -verbose -config storm.yaml -jar storm-starter-${STORM_VERSION}.jar storm.starter.ExclamationTopology exclamation

Storm Compatibility Guide

Start Gearpump Cluster on YARN

To start a Gearpump Cluster on YARN, you can:

yarnclient launch -package /usr/lib/gearpump/gearpump-2.11-0.7.2.zip

/usr/lib/gearpump/gearpump-2.11-0.7.2.zip should be available on HDFS.

Please check YARN Deployment Guide for more information.

Start a local cluster

Masters and workers will be started in one machine:

local

Check Deployment Guide for Local Cluster for more information.

Start master daemons

master -ip <Ip address> -port <port where this master is hooking>

Please check Deployment for Standalone mode for more information.

Start worker daemons

worker

Please check Deployment for Standalone mode for more information.

Start UI server

To start UI server, you can:

services  [-master <host:port>]


text:
@interface Stop : NSObject

@property (nonatomic, strong) NSNumber * stopLat;
@property (nonatomic, strong) NSNumber * stopLon;
@property (nonatomic, strong) NSString * stopId;
@property (nonatomic, strong) NSString * stopName;
@property (nonatomic, strong) NSString * stopDesc;
@property (nonatomic, strong) NSNumber * locationType;
@property (nonatomic, strong) NSString * zoneId;
@property (nonatomic, strong) NSArray  * routes;

- (void)addStop:(Stop *)stop;
- (id)initWithDB:(FMDatabase *)fmdb;
- (void)cleanupAndCreate;
- (void)receiveRecord:(NSDictionary *)aRecord;
- (void)updateStopWithRoutes:(NSArray *)routes withStopId:(NSString *)stopId;
- (void)updateRoutes;
+ (NSArray *)getAllStops;

@end


text:
from oslib.command import Command
from oslib import OSLibError

import oslib.decrypt_windows_passwd

import getpass

class GetWindowsPassword(Command):
    object = 'instance'
    verb = 'getwinpass'

    def __init__(self):
        super(GetWindowsPassword, self).__init__()
        self.key = None

    def fill_parser(self, parser):
        parser.add_option("-f", "--key_file", dest="key_file", help="key file", default=None)

    def execute(self, *args, **kwargs):
        key_file = kwargs.pop('key_file')
        if key_file is None:
            key_file = self.ctxt.key_file

        instance = self.ec2_object.get()

        #Open your keyfile
        if self.key is None:
            try:
                self.key = oslib.decrypt_windows_passwd.import_rsa_key(key_file, None)
            except ValueError:
                passphrase = getpass.getpass('Encrypted Key Password (leave blank if none): ')
                self.key = oslib.decrypt_windows_passwd.import_rsa_key(key_file, passphrase)

        password_data = self.ctxt.cnx_ec2.get_password_data(instance.id)

        if password_data is None or len(password_data) < 1:
            raise OSLibError("invalid password data")

        return oslib.decrypt_windows_passwd.decryptPassword(self.key, password_data)


text:
#if !defined( OVR_ScrollManager_h )
#define OVR_ScrollManager_h

#include "Kernel/OVR_Math.h"

namespace OVR {

template< typename _type_, int _size_ >
class CircularArrayT
{
public:
	static const int MAX = _size_;

	CircularArrayT() :
		HeadIndex( 0 ),
		Num( 0 )
	{
	}

	int				GetIndex( const int offset ) const
	{
		int idx = HeadIndex + offset;
		if ( idx >= _size_ )
		{
			idx -= _size_;
		}
		else if ( idx < 0 )
		{
			idx += _size_;
		}
		return idx;
	}

	_type_ &		operator[] ( int const idx )
	{
		return Buffer[GetIndex( -idx )];
	}
	_type_ const &	operator[] ( int const idx ) const
	{
		return Buffer[GetIndex( -idx )];
	}

	bool			IsEmpty() const { return Num == 0; }
	int				GetHeadIndex() const { return GetIndex( 0 ); }
	int				GetTailIndex() const { return IsEmpty() ? GetIndex( 0 ) : GetIndex( - ( Num - 1 ) ); }

	_type_ const &	GetHead() const { return operator[]( 0 ); }
	_type_ const &	GetTail() const { return operator[]( Num - 1 ); }

	int				GetNum() const { return Num; }

	void			Clear()
	{
		HeadIndex = 0;
		Num = 0;
	}

	void			Append( _type_ const & obj )
	{
		if ( Num > 0 )
		{
			HeadIndex = GetIndex( 1 );
		}
		Buffer[HeadIndex] = obj;
		if ( Num < _size_ )
		{
			Num++;
		}
	}

private:
	_type_	Buffer[_size_];
	int		HeadIndex;
	int		Num;
};

enum eScrollType
{
	HORIZONTAL_SCROLL,
	VERTICAL_SCROLL
};

enum eScrollDirectionLockType
{
	NO_LOCK = 0,
	HORIZONTAL_LOCK,
	VERTICAL_LOCK
};

enum eScrollState
{
	SMOOTH_SCROLL,			// Regular smooth scroll
	WRAP_AROUND_SCROLL,		// Wrap around scroll : begin to end or end to begin
	BOUNCE_SCROLL			// Bounce back scroll, when user pulls
};

struct OvrScrollBehavior
{
	float 	FrictionPerSec;
	float 	Padding; 				// Padding at the beginning and end of the scroll bounds
	float 	WrapAroundScrollOffset; // Tells how scrolling should be pulled beyond its bounds to consider for wrap around
	float 	WrapAroundHoldTime; 	// Tells how long you need to hold at WrapAroundScrollOffset, in order to consider as wrap around event
	float 	WrapAroundSpeed;
	float 	AutoVerticalSpeed;

	OvrScrollBehavior()
	: FrictionPerSec( 5.0f )
	, Padding( 1.0f )
	, WrapAroundHoldTime( 0.4f )
	, WrapAroundSpeed( 7.0f )
	, AutoVerticalSpeed( 5.5f )
	{
		WrapAroundScrollOffset = Padding * 0.75f; // 75% of Padding
	}

	void SetPadding( float value )
	{
		Padding = value;
		WrapAroundScrollOffset = Padding * 0.75f;
	}
};

class OvrScrollManager
{
public:
			OvrScrollManager( eScrollType type );

	void 	Frame( float deltaSeconds, unsigned int controllerState );

	void 	TouchDown();
	void 	TouchUp();
	void 	TouchRelative( Vector3f touchPos );

	bool 	IsOutOfBounds() 		const;
	bool 	IsOutOfWrapBounds()		const;
	bool 	IsScrolling() 			const 			{ return TouchIsDown || AutoScrollInFwdDir || AutoScrollBkwdDir; }
	bool	IsTouchIsDown()			const			{ return TouchIsDown; }
	bool	IsWrapAroundEnabled() 	const			{ return WrapAroundEnabled; }

	void 	SetMaxPosition( float position ) 		{ MaxPosition = position; }
	void 	SetPosition( float position ) 			{ Position = position; }
	void 	SetVelocity( float velocity ) 			{ Velocity = velocity; }
	void	SetTouchIsDown( bool value )			{ TouchIsDown = value; }
	void	SetScrollPadding( float value )			{ ScrollBehavior.SetPadding( value ); }
	void	SetWrapAroundEnable( bool value )		{ WrapAroundEnabled = value; }
	void	SetRestrictedScrollingData( bool isRestricted, eScrollDirectionLockType touchLock, eScrollDirectionLockType controllerLock );

	float 	GetPosition() 					const 	{ return Position; }
	float 	GetMaxPosition()				const 	{ return MaxPosition; }
	float	GetVelocity()					const	{ return Velocity; }
	bool 	GetIsWrapAroundTimeInitiated() 	const 	{ return IsWrapAroundTimeInitiated; }
	float 	GetRemainingTimeForWrapAround() const 	{ return RemainingTimeForWrapAround; }
	float 	GetWrapAroundScrollOffset()		const	{ return ScrollBehavior.WrapAroundScrollOffset; }
	float 	GetWrapAroundHoldTime()			const	{ return ScrollBehavior.WrapAroundHoldTime; }
	float  	GetWrapAroundAlphaChange();

	void 	SetEnableAutoForwardScrolling( bool value );
	void 	SetEnableAutoBackwardScrolling( bool value );

private:
	struct delta_t
	{
		delta_t() : d( 0.0f ), t( 0.0f ) { }
		delta_t( float const d_, float const t_ ) : d( d_ ), t( t_ ) { }

		float	d;	// distance moved
		float	t;	// time stamp
	};

	eScrollType 							CurrentScrollType; // Is it horizontal scrolling or vertical scrolling
	OvrScrollBehavior						ScrollBehavior;
	float 									MaxPosition;

	bool 									TouchIsDown;
	Vector3f 								LastTouchPosistion;
	// Keeps track of last few(=5) touch movement information
	CircularArrayT< delta_t, 5 > 			Deltas;
	// Current State - smooth scrolling, wrap around and bounce back
	eScrollState 							CurrentScrollState;

	float 									Position;
	float 									Velocity;
	// Delta time is accumulated and scrolling physics will be done in iterations of 0.016f seconds, to stop scrolling at right spot
	float 									AccumulatedDeltaTimeInSeconds;

	bool									WrapAroundEnabled;
	bool 									IsWrapAroundTimeInitiated;
	float 									RemainingTimeForWrapAround;

	// Controller Input
	bool									AutoScrollInFwdDir;
	bool									AutoScrollBkwdDir;
	bool									IsHorizontalScrolling;

	float 									PrevAutoScrollVelocity;

	bool									RestrictedScrolling;
	eScrollDirectionLockType				TouchDirectionLocked;
	eScrollDirectionLockType				ControllerDirectionLocked;

	// Returns the velocity that stops scrolling in proper place, over an item rather than in between items.
	float 									GetModifiedVelocity( const float inVelocity );
	void									PerformWrapAroundOnScrollFinish();
	bool									NeedsJumpDuringWrapAround();
};

} // namespace OVR

#endif // OVR_ScrollManager_h


text:
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Kentico.Kontent.Delivery.Abstractions
{
    /// <summary>
    /// Interface implemented for processing inline content items in HTML
    /// </summary>
    public interface IInlineContentItemsProcessor
    {
        /// <summary>
        /// Processes HTML input and returns it with inline content items replaced with resolvers output.
        /// </summary>
        /// <param name="value">HTML code</param>
        /// <param name="usedContentItems">Content items referenced as inline content items</param>
        /// <returns>HTML with inline content items replaced with resolvers output</returns>
        Task<string> ProcessAsync(string value, Dictionary<string, object> usedContentItems);

        /// <summary>
        /// Removes all content items from given HTML content.
        /// </summary>
        /// <param name="value">HTML content</param>
        /// <returns>HTML without inline content items</returns>
        Task<string> RemoveAllAsync(string value);
    }
}


text:
package com.intellij.formatting.engine;

import com.intellij.formatting.*;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import javax.annotation.Nonnull;

public class FormatProcessorUtils {

  private static int calcShift(@Nonnull final IndentInside oldIndent,
                               @Nonnull final IndentInside newIndent,
                               @Nonnull final CommonCodeStyleSettings.IndentOptions options)
  {
    if (oldIndent.equals(newIndent)) return 0;
    return newIndent.getSpacesCount(options) - oldIndent.getSpacesCount(options);
  }

  public static int replaceWhiteSpace(final FormattingModel model,
                                      @Nonnull final LeafBlockWrapper block,
                                      int shift,
                                      final CharSequence _newWhiteSpace,
                                      final CommonCodeStyleSettings.IndentOptions options
  ) {
    final WhiteSpace whiteSpace = block.getWhiteSpace();
    final TextRange textRange = whiteSpace.getTextRange();
    final TextRange wsRange = textRange.shiftRight(shift);
    final String newWhiteSpace = _newWhiteSpace.toString();
    TextRange newWhiteSpaceRange = model instanceof FormattingModelEx
                                   ? ((FormattingModelEx) model).replaceWhiteSpace(wsRange, block.getNode(), newWhiteSpace)
                                   : model.replaceWhiteSpace(wsRange, newWhiteSpace);

    shift += newWhiteSpaceRange.getLength() - textRange.getLength();

    if (block.isLeaf() && whiteSpace.containsLineFeeds() && block.containsLineFeeds()) {
      final TextRange currentBlockRange = block.getTextRange().shiftRight(shift);

      IndentInside oldBlockIndent = whiteSpace.getInitialLastLineIndent();
      IndentInside whiteSpaceIndent = IndentInside.createIndentOn(IndentInside.getLastLine(newWhiteSpace));
      final int shiftInside = calcShift(oldBlockIndent, whiteSpaceIndent, options);

      if (shiftInside != 0 || !oldBlockIndent.equals(whiteSpaceIndent)) {
        final TextRange newBlockRange = model.shiftIndentInsideRange(block.getNode(), currentBlockRange, shiftInside);
        shift += newBlockRange.getLength() - block.getLength();
      }
    }
    return shift;
  }

}


text:
namespace GLplus
{

void CheckGLErrors();

struct ObjectHandle
{
    GLuint mHandle;
    ObjectHandle(){ mHandle = 0; }
    ObjectHandle(const ObjectHandle& other) = delete;
    ObjectHandle& operator=(const ObjectHandle& other) = delete;
    ObjectHandle(ObjectHandle&& other){ std::swap(mHandle, other.mHandle); }
    ObjectHandle& operator=(ObjectHandle&& other){ std::swap(mHandle, other.mHandle); }
};

class Shader
{
    ObjectHandle mHandle;
    GLenum mShaderType;

public:
    Shader(GLenum shaderType);
    Shader(const Shader&) = delete;
    Shader& operator=(const Shader&) = delete;
    Shader(Shader&&) = default;
    Shader& operator=(Shader&&) = default;
    ~Shader();

    void Compile(const GLchar* source);

    GLenum GetShaderType() const;

    GLuint GetGLHandle() const;
};

class Program
{
    ObjectHandle mHandle;
    std::shared_ptr<Shader> mFragmentShader;
    std::shared_ptr<Shader> mVertexShader;

public:
    static Program FromFiles(const char* vShaderFile, const char* fShaderFile);

    Program();
    Program(const Program&) = delete;
    Program& operator=(const Program&) = delete;
    Program(Program&&) = default;
    Program& operator=(Program&&) = default;
    ~Program();

    void Attach(const std::shared_ptr<Shader>& shader);
    void Link();

    bool TryGetAttributeLocation(const GLchar* name, GLint& loc) const;
    GLint GetAttributeLocation(const GLchar* name) const;

    bool TryGetUniformLocation(const GLchar* name, GLint& loc) const;
    GLint GetUniformLocation(const GLchar* name) const;

    void UploadInt(const GLchar* name, GLuint value) const;
    void UploadInt(GLint location, GLuint value) const;

    void UploadFloat(const GLchar* name, GLfloat value) const;
    void UploadFloat(GLint location, GLfloat value) const;

    void UploadVec2(const GLchar* name, GLfloat v0, GLfloat v1) const;
    void UploadVec2(GLint location, GLfloat v0, GLfloat v1) const;
    void UploadVec2(const GLchar* name, const GLfloat* const values) const;
    void UploadVec2(GLint location, const GLfloat* values) const;

    void UploadVec4(const GLchar* name, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const;
    void UploadVec4(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const;
    void UploadVec4(const GLchar* name, const GLfloat* const values) const;
    void UploadVec4(GLint location, const GLfloat* values) const;

    void UploadMatrix4(const GLchar* name, GLboolean transpose, const GLfloat* values) const;
    void UploadMatrix4(GLint location, GLboolean transpose, const GLfloat* values) const;

    GLuint GetGLHandle() const;
};

class ScopedProgramBind
{
    ObjectHandle mOldProgram;

public:
    ScopedProgramBind(const Program& bound);
    ~ScopedProgramBind();
};

class Buffer
{
    ObjectHandle mHandle;
    GLenum mTarget;

public:
    Buffer(GLenum target);
    Buffer(const Buffer&) = delete;
    Buffer& operator=(const Buffer&) = delete;
    Buffer(Buffer&&) = default;
    Buffer& operator=(Buffer&&) = default;
    ~Buffer();

    void Upload(GLsizeiptr size, const GLvoid* data, GLenum usage);

    GLenum GetTarget() const;

    GLuint GetGLHandle() const;
};

class ScopedBufferBind
{
    ObjectHandle mOldBuffer;
    GLenum mTarget;

public:
    ScopedBufferBind(const Buffer& bound);
    ~ScopedBufferBind();
};

class VertexArray
{
    ObjectHandle mHandle;
    std::unordered_map<GLuint, std::shared_ptr<Buffer> > mVertexBuffers;
    std::shared_ptr<Buffer> mIndexBuffer;
    GLenum mIndexType = 0;

public:
    VertexArray();
    VertexArray(const VertexArray&) = delete;
    VertexArray& operator=(const VertexArray&) = delete;
    VertexArray(VertexArray&&) = default;
    VertexArray& operator=(VertexArray&&) = default;
    ~VertexArray();

    void SetAttribute(
            GLuint index,
            const std::shared_ptr<Buffer>& buffer,
            GLint size,
            GLenum type,
            GLboolean normalized,
            GLsizei stride,
            GLsizei offset);

    void SetIndexBuffer(
            const std::shared_ptr<Buffer>& buffer,
            GLenum type);

    GLenum GetIndexType() const;

    GLuint GetGLHandle() const;
};

class ScopedVertexArrayBind
{
    ObjectHandle mOldVertexArray;

public:
    ScopedVertexArrayBind(const VertexArray& bound);
    ~ScopedVertexArrayBind();
};

class Texture2D
{
    ObjectHandle mHandle;
    int mWidth;
    int mHeight;

public:
    enum LoadFlags
    {
        NoFlags = 0,
        InvertY
    };

    Texture2D();
    Texture2D(const Texture2D&) = delete;
    Texture2D& operator=(const Texture2D&) = delete;
    Texture2D(Texture2D&&) = default;
    Texture2D& operator=(Texture2D&&) = default;
    ~Texture2D();

    void LoadImage(const char* filename, unsigned int flags);
    void CreateStorage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);

    int GetWidth() const;
    int GetHeight() const;

    GLuint GetGLHandle() const;
};

class ScopedTextureBind
{
    ObjectHandle mOldTexture;
    GLint mOldTextureIndex;
    GLenum mTextureIndex;

public:
    ScopedTextureBind(const Texture2D& bound, GLenum textureIndex);
    ~ScopedTextureBind();
};

class RenderBuffer
{
    ObjectHandle mHandle;

public:
    RenderBuffer();
    RenderBuffer(const RenderBuffer&) = delete;
    RenderBuffer& operator=(const RenderBuffer&) = delete;
    RenderBuffer(RenderBuffer&&) = default;
    RenderBuffer& operator=(RenderBuffer&&) = default;
    ~RenderBuffer();

    void CreateStorage(GLenum internalformat, GLsizei width, GLsizei height);

    GLuint GetGLHandle() const;
};

class ScopedRenderBufferBind
{
    ObjectHandle mOldRenderBuffer;

public:
    ScopedRenderBufferBind(const RenderBuffer& bound);
    ~ScopedRenderBufferBind();
};

class FrameBuffer
{
    ObjectHandle mHandle;

    struct Attachment
    {
        Attachment(const std::shared_ptr<Texture2D>&);
        Attachment(const std::shared_ptr<RenderBuffer>&);
        std::shared_ptr<Texture2D> mTextureAttachment;
        std::shared_ptr<RenderBuffer> mRenderBufferAttachment;
    };

    std::unordered_map<GLenum, Attachment> mAttachments;

public:
    FrameBuffer();
    FrameBuffer(const FrameBuffer&) = delete;
    FrameBuffer& operator=(const FrameBuffer&) = delete;
    FrameBuffer(FrameBuffer&&) = default;
    FrameBuffer& operator=(FrameBuffer&&) = default;
    ~FrameBuffer();

    void Attach(GLenum attachment, const std::shared_ptr<Texture2D>& texture);
    void Attach(GLenum attachment, const std::shared_ptr<RenderBuffer>& renderBuffer);

    void Detach(GLenum attachment);

    GLenum GetStatus() const;
    void ValidateStatus() const;

    GLuint GetGLHandle() const;
};

class DefaultFrameBuffer { };

// TODO: Make it possible to choose between the DRAW/READ framebuffer
class ScopedFrameBufferBind
{
    ObjectHandle mOldFrameBuffer;

public:
    ScopedFrameBufferBind(const FrameBuffer& bound);
    ScopedFrameBufferBind(DefaultFrameBuffer);
    ~ScopedFrameBufferBind();
};

constexpr size_t SizeFromGLType(GLenum type)
{
    return type == GL_UNSIGNED_INT   ? sizeof(GLuint)   :
           type == GL_INT            ? sizeof(GLint)    :
           type == GL_UNSIGNED_SHORT ? sizeof(GLushort) :
           type == GL_SHORT          ? sizeof(GLshort)  :
           type == GL_UNSIGNED_BYTE  ? sizeof(GLubyte)  :
           type == GL_BYTE           ? sizeof(GLbyte)   :
           throw "Unimplemented Type";
}

void DrawArrays(GLenum mode, GLint first, GLsizei count);

void DrawElements(GLenum mode, GLenum indexType, GLint first, GLsizei count);

} // end namespace GLplus

#endif // GLPLUS_H


text:
package features

import (
	"context"
	"strings"
	"time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/wait"
	kubeclient "knative.dev/pkg/client/injection/kube/client"
	"knative.dev/pkg/system"
	"knative.dev/reconciler-test/pkg/feature"
)

func KafkaChannelLease() *feature.Feature {
	f := feature.NewFeatureNamed("KafkaChannel lease")

	f.Assert("verify lease name", verifyLeaseAcquired(
		"kafkachannel-controller.knative.dev.eventing-kafka.pkg.channel.consolidated.reconciler.controller.reconciler.00-of-01",
	))

	return f
}

func KafkaSourceLease() *feature.Feature {
	f := feature.NewFeatureNamed("KafkaSource lease")

	f.Assert("verify lease name", verifyLeaseAcquired(
		"kafka-controller.knative.dev.eventing-kafka.pkg.source.reconciler.source.reconciler.00-of-01",
	))

	return f
}

func verifyLeaseAcquired(name string) feature.StepFn {
	return func(ctx context.Context, t feature.T) {
		err := wait.Poll(time.Second, time.Minute, func() (done bool, err error) {
			lease, err := kubeclient.Get(ctx).
				CoordinationV1().
				Leases(system.Namespace()).
				Get(ctx, name, metav1.GetOptions{})
			if err != nil {
				t.Fatal("failed to get lease %s/%s: %v", system.Namespace(), name, err)
			}

			return lease.Spec.HolderIdentity != nil &&
				strings.HasPrefix(*lease.Spec.HolderIdentity, "kafka-controller"), nil
		})
		if err != nil {
			t.Fatal(err)
		}
	}
}


text:
<?php

namespace Salexandru\Command;

interface CommandInterface
{

    /**
     * @param Context $context
     * @return void
     */
    public function setContext(Context $context);

    /**
     * @return Context|null
     */
    public function getContext();

    /**
     * @return boolean
     */
    public function hasContext();

    /**
     * @return string
     */
    public function getName();
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 LinkedIn Corporation -->
<!-- All Rights Reserved. -->
<!-- -->
<!-- Licensed under the BSD 2-Clause License (the "License").  See License in the project root -->
<!-- for license information. -->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <import type="android.view.View"/>

        <variable
            name="sourceVideo"
            type="com.linkedin.android.litr.demo.data.SourceMedia" />

        <variable
            name="sourceAudio"
            type="com.linkedin.android.litr.demo.data.SourceMedia" />

        <variable
            name="targetMedia"
            type="com.linkedin.android.litr.demo.data.TargetMedia" />

        <variable
            name="transformationState"
            type="com.linkedin.android.litr.demo.data.TransformationState" />

        <variable
            name="transcodingConfigPresenter"
            type="com.linkedin.android.litr.demo.data.TranscodingConfigPresenter" />

        <variable
            name="transformationPresenter"
            type="com.linkedin.android.litr.demo.data.TransformationPresenter" />

    </data>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <include layout="@layout/section_pick_video"
                android:id="@+id/section_pick_video"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:sourceMedia="@{sourceVideo}"/>

            <include layout="@layout/section_pick_audio"
                android:id="@+id/section_pick_audio"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:sourceMedia="@{sourceAudio}"/>

            <Button
                android:id="@+id/button_transcode"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/transcode"
                android:enabled="@{sourceVideo.uri != null && sourceAudio.uri != null && targetMedia != null && (transformationState.state != transformationState.STATE_RUNNING)}"
                android:padding="@dimen/cell_padding"
                android:onClick="@{() -> transformationPresenter.muxVideoAndAudio(sourceVideo, sourceAudio, targetMedia, transformationState)}"/>

            <include layout="@layout/section_transformation_progress"
                android:id="@+id/section_transformation_progress"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="@{transformationState.state == transformationState.STATE_IDLE ? View.GONE : View.VISIBLE}"
                app:transformationState="@{transformationState}"
                app:presenter="@{transformationPresenter}"/>

            <Button
                android:id="@+id/button_play"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/play"
                android:enabled="@{transformationState.state == transformationState.STATE_COMPLETED}"
                android:padding="@dimen/cell_padding"
                android:onClick="@{() -> transformationPresenter.play(targetMedia.contentUri)}"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/cell_padding"
                android:text="@{transformationState.stats}"
                android:visibility="@{transformationState.state == transformationState.STATE_RUNNING || transformationState.stats == null ? View.GONE : View.VISIBLE}"/>

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

</layout>


text:
var materials = [
  'Hydrogen',
  'Helium',
  'Lithium',
  'Beryllium'
];

var materialsLength1 = materials.map(function(material) {
  return material.length;
});

var materialsLength2 = materials.map((material) => {
  return material.length;
});

var materialsLength3 = materials.map(material => material.length);

console.log(materialsLength1)
console.log(materialsLength2)
console.log(materialsLength3)


text:
//-----------------------------------------------------------------------
// <copyright file="RemoteConfigSpec.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2020 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2020 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using Akka.Remote.Transport.DotNetty;
using Akka.TestKit;
using Akka.Util.Internal;
using Xunit;
using System.Net;
using Akka.Remote.Transport;
using static Akka.Util.RuntimeDetector;
using FluentAssertions;

namespace Akka.Remote.Tests
{

    public class RemoteConfigSpec : AkkaSpec
    {
        public RemoteConfigSpec():base(@"
                akka.actor.provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                akka.remote.dot-netty.tcp.port = 0
            ") {}

        [Fact]
        public void Remoting_should_contain_correct_configuration_values_in_ReferenceConf()
        {
            var remoteSettings = RARP.For(Sys).Provider.RemoteSettings;

            Assert.False(remoteSettings.LogReceive);
            Assert.False(remoteSettings.LogSend);
            Assert.False(remoteSettings.UntrustedMode);
            Assert.Empty(remoteSettings.TrustedSelectionPaths);
            Assert.Equal(TimeSpan.FromSeconds(10), remoteSettings.ShutdownTimeout);
            Assert.Equal(TimeSpan.FromSeconds(2), remoteSettings.FlushWait);
            Assert.Equal(TimeSpan.FromSeconds(10), remoteSettings.StartupTimeout);
            Assert.Equal(TimeSpan.FromSeconds(5), remoteSettings.RetryGateClosedFor);
            Assert.Equal("akka.remote.default-remote-dispatcher", remoteSettings.Dispatcher);
            Assert.True(remoteSettings.UsePassiveConnections);
            Assert.Equal(TimeSpan.FromMilliseconds(50), remoteSettings.BackoffPeriod);
            Assert.Equal(TimeSpan.FromSeconds(0.3d), remoteSettings.SysMsgAckTimeout);
            Assert.Equal(TimeSpan.FromSeconds(2), remoteSettings.SysResendTimeout);
            Assert.Equal(20000, remoteSettings.SysMsgBufferSize);
            Assert.Equal(TimeSpan.FromMinutes(3), remoteSettings.InitialSysMsgDeliveryTimeout);
            Assert.Equal(TimeSpan.FromDays(5), remoteSettings.QuarantineDuration);
            Assert.Equal(TimeSpan.FromDays(2), remoteSettings.QuarantineSilentSystemTimeout);
            Assert.Equal(TimeSpan.FromSeconds(30), remoteSettings.CommandAckTimeout);
            Assert.Single(remoteSettings.Transports);
            Assert.Equal(typeof(TcpTransport), Type.GetType(remoteSettings.Transports.Head().TransportClass));
            Assert.Equal(typeof(PhiAccrualFailureDetector), Type.GetType(remoteSettings.WatchFailureDetectorImplementationClass));
            Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchHeartBeatInterval);
            Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchHeartbeatExpectedResponseAfter);
            Assert.Equal(TimeSpan.FromSeconds(1), remoteSettings.WatchUnreachableReaperInterval);
            Assert.Equal(10, remoteSettings.WatchFailureDetectorConfig.GetDouble("threshold", 0));
            Assert.Equal(200, remoteSettings.WatchFailureDetectorConfig.GetDouble("max-sample-size", 0));
            Assert.Equal(TimeSpan.FromSeconds(10), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause", null));
            Assert.Equal(TimeSpan.FromMilliseconds(100), remoteSettings.WatchFailureDetectorConfig.GetTimeSpan("min-std-deviation", null));

            var remoteSettingsAdaptersStandart = new List<KeyValuePair<string, Type>>()
            {
                new KeyValuePair<string, Type>("gremlin", typeof(FailureInjectorProvider)),
                new KeyValuePair<string, Type>("trttl", typeof(ThrottlerProvider))
            };

            var remoteSettingsAdapters =
                remoteSettings.Adapters.Select(kv => new KeyValuePair<string, Type>(kv.Key, Type.GetType(kv.Value)));

            Assert.Empty(remoteSettingsAdapters.Except(remoteSettingsAdaptersStandart));

            remoteSettings.Config.GetString("akka.remote.log-frame-size-exceeding", null).ShouldBe("off");
        }

        [Fact]
        public void Remoting_should_be_able_to_parse_AkkaProtocol_related_config_elements()
        {
            var settings = new AkkaProtocolSettings(RARP.For(Sys).Provider.RemoteSettings.Config);

            Assert.Equal(typeof(DeadlineFailureDetector), Type.GetType(settings.TransportFailureDetectorImplementationClass));
            Assert.Equal(TimeSpan.FromSeconds(4), settings.TransportHeartBeatInterval);
            Assert.Equal(TimeSpan.FromSeconds(120), settings.TransportFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause", null));
        }

        [Fact]
        public void Remoting_should_contain_correct_heliosTCP_values_in_ReferenceConf()
        {
            var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");
            var s = DotNettyTransportSettings.Create(c);

            Assert.Equal(TimeSpan.FromSeconds(15), s.ConnectTimeout);
            s.ConnectTimeout.Should().Be(new AkkaProtocolSettings(RARP.For(Sys).Provider.RemoteSettings.Config).HandshakeTimeout);
            Assert.Null(s.WriteBufferHighWaterMark);
            Assert.Null(s.WriteBufferLowWaterMark);
            Assert.Equal(256000, s.SendBufferSize.Value);
            Assert.Equal(256000, s.ReceiveBufferSize.Value);
            Assert.Equal(128000, s.MaxFrameSize);
            Assert.Equal(4096, s.Backlog);
            Assert.True(s.TcpNoDelay);
            Assert.True(s.TcpKeepAlive);
            Assert.Equal("off-for-windows", c.GetString("tcp-reuse-addr", null));
            Assert.True(string.IsNullOrEmpty(c.GetString("hostname", null)));
            Assert.Null(s.PublicPort);
            Assert.Equal(2, s.ServerSocketWorkerPoolSize);
            Assert.Equal(2, s.ClientSocketWorkerPoolSize);
            Assert.False(s.BackwardsCompatibilityModeEnabled);
            Assert.False(s.DnsUseIpv6);
            Assert.False(s.LogTransport);
            Assert.False(s.EnableSsl);
        }

        [Fact]
        public void When_remoting_works_in_Mono_ip_enforcement_should_be_defaulted_to_true()
        {
            if (!IsMono) return; // skip IF NOT using Mono
            var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");
            var s = DotNettyTransportSettings.Create(c);

            Assert.True(s.EnforceIpFamily);
        }

        [Fact]
        public void When_remoting_works_not_in_Mono_ip_enforcement_should_be_defaulted_to_false()
        {
            if (IsMono) return; // skip IF using Mono
            var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");
            var s = DotNettyTransportSettings.Create(c);

            Assert.False(s.EnforceIpFamily);
        }

        [Fact]
        public void Remoting_should_contain_correct_socket_worker_pool_configuration_values_in_ReferenceConf()
        {
            var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");

            // server-socket-worker-pool
            {
                var pool = c.GetConfig("server-socket-worker-pool");
                Assert.Equal(2, pool.GetInt("pool-size-min", 0));
                Assert.Equal(1.0d, pool.GetDouble("pool-size-factor", 0));
                Assert.Equal(2, pool.GetInt("pool-size-max", 0));
            }

            //client-socket-worker-pool
            {
                var pool = c.GetConfig("client-socket-worker-pool");
                Assert.Equal(2, pool.GetInt("pool-size-min", 0));
                Assert.Equal(1.0d, pool.GetDouble("pool-size-factor", 0));
                Assert.Equal(2, pool.GetInt("pool-size-max", 0));
            }
        }

        [Fact]
        public void Remoting_should_contain_correct_hostname_values_in_ReferenceConf()
        {
           var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");
           var s = DotNettyTransportSettings.Create(c);

           //Non-specified hostnames should default to IPAddress.Any
           Assert.Equal(IPAddress.Any.ToString(), s.Hostname);
           Assert.Equal(IPAddress.Any.ToString(), s.PublicHostname);
        }

        [Fact]
        public void Remoting_should_contain_correct_BatchWriter_settings_in_ReferenceConf()
        {
            var c = RARP.For(Sys).Provider.RemoteSettings.Config.GetConfig("akka.remote.dot-netty.tcp");
            var s = DotNettyTransportSettings.Create(c);

            s.BatchWriterSettings.EnableBatching.Should().BeTrue();
            s.BatchWriterSettings.MaxExplicitFlushes.Should().Be(BatchWriterSettings.DefaultMaxPendingWrites);
        }
   }
}


text:
package ides.link.androidlifecycles;

import android.arch.lifecycle.LifecycleActivity;
import android.arch.lifecycle.ViewModelProviders;
import android.os.SystemClock;
import android.os.Bundle;
import android.widget.Chronometer;

import ides.link.androidlifecycles.models.ChronometerViewModel;

public class MainActivity extends LifecycleActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // The ViewModelStore provides a new ViewModel or one previously created
        ChronometerViewModel chronometerViewModel =
                ViewModelProviders.of(this).get(ChronometerViewModel.class);
        // this refers to an instance of LifecycleOwner. The framework keeps the ViewModel alive as
        // long as the scope of the LifecycleOwner is alive. A ViewModel is not destroyed if its
        // owner is destroyed for a configuration change, such as screen rotation.
        // The new instance of the owner re-connects to the existing ViewModel

        Chronometer chronometer = (Chronometer) findViewById(R.id.chronometer);

        if (chronometerViewModel.getStartDate() == null) {
            // If the start date is not defined, it's a new ViewModel so set it.
            long date = SystemClock.elapsedRealtime();
            chronometerViewModel.setStartDate(date);
            chronometer.setBase(date);

        } else {
            // Otherwise the ViewModel has been retained, set the chronometer's base to the original
            // starting time.
            chronometer.setBase(chronometerViewModel.getStartDate());
        }
        chronometer.start();
    }
}


text:
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"

/** @addtogroup STM32F4xx_HAL_Driver
  * @{
  */

/** @defgroup PCCARD
  * @brief PCCARD driver modules
  * @{
  */
#ifdef HAL_PCCARD_MODULE_ENABLED
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/** @defgroup PCCARD_Private_Functions
  * @{
  */

/** @defgroup PCCARD_Group1 Initialization and de-initialization functions
  * @brief    Initialization and Configuration functions
  *
  @verbatim
  ==============================================================================
          ##### PCCARD Initialization and de-initialization functions #####
  ==============================================================================
  [..]
    This section provides functions allowing to initialize/de-initialize
    the PCCARD memory

@endverbatim
  * @{
  */

/**
  * @brief  Perform the PCCARD memory Initialization sequence
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @param  ComSpaceTiming: Common space timing structure
  * @param  AttSpaceTiming: Attribute space timing structure
  * @param  IOSpaceTiming: IO space timing structure
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming)
{
  /* Check the PCCARD controller state */
  if(hpccard == NULL)
  {
     return HAL_ERROR;
  }

  if(hpccard->State == HAL_PCCARD_STATE_RESET)
  {
    /* Initialize the low level hardware (MSP) */
    HAL_PCCARD_MspInit(hpccard);
  }

  /* Initialize the PCCARD state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  /* Initialize PCCARD control Interface */
  FMC_PCCARD_Init(hpccard->Instance, &(hpccard->Init));

  /* Init PCCARD common space timing Interface */
  FMC_PCCARD_CommonSpace_Timing_Init(hpccard->Instance, ComSpaceTiming);

  /* Init PCCARD attribute space timing Interface */
  FMC_PCCARD_AttributeSpace_Timing_Init(hpccard->Instance, AttSpaceTiming);

  /* Init PCCARD IO space timing Interface */
  FMC_PCCARD_IOSpace_Timing_Init(hpccard->Instance, IOSpaceTiming);

  /* Enable the PCCARD device */
  __FMC_PCCARD_ENABLE(hpccard->Instance);

  /* Update the PCCARD state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  return HAL_OK;

}

/**
  * @brief  Perform the PCCARD memory De-initialization sequence
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval HAL status
  */
HAL_StatusTypeDef  HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard)
{
  /* De-Initialize the low level hardware (MSP) */
  HAL_PCCARD_MspDeInit(hpccard);

  /* Configure the PCCARD registers with their reset values */
  FMC_PCCARD_DeInit(hpccard->Instance);

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_RESET;

  /* Release Lock */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  PCCARD MSP Init
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval None
  */
__weak void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard)
{
  /* NOTE : This function Should not be modified, when the callback is needed,
            the HAL_PCCARD_MspInit could be implemented in the user file
   */
}

/**
  * @brief  PCCARD MSP DeInit
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval None
  */
__weak void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard)
{
  /* NOTE : This function Should not be modified, when the callback is needed,
            the HAL_PCCARD_MspDeInit could be implemented in the user file
   */
}

/**
  * @}
  */

/** @defgroup PCCARD_Group2 Input and Output functions
  * @brief    Input Output and memory control functions
  *
  @verbatim
  ==============================================================================
                    ##### PCCARD Input and Output functions #####
  ==============================================================================
  [..]
    This section provides functions allowing to use and control the PCCARD memory

@endverbatim
  * @{
  */

/**
  * @brief  Read Compact Flash's ID.
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @param  CompactFlash_ID: Compact flash ID structure.
  * @param  pStatus: pointer to compact flash status
  * @retval HAL status
  *
  */
HAL_StatusTypeDef HAL_CF_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus)
{
  uint32_t timeout = 0xFFFF, index;
  uint8_t status;

  /* Process Locked */
  __HAL_LOCK(hpccard);

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return HAL_BUSY;
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  /* Initialize the CF status */
  *pStatus = CF_READY;

  /* Send the Identify Command */
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD)  = 0xECEC;

  /* Read CF IDs and timeout treatment */
  do
  {
     /* Read the CF status */
     status = *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);

     timeout--;
  }while((status != 0x58) && timeout);

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }
  else
  {
     /* Read CF ID bytes */
    for(index = 0; index < 16; index++)
    {
      CompactFlash_ID[index] = *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_DATA);
    }
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  /* Process unlocked */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  Read sector from PCCARD memory
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @param  pBuffer: pointer to destination read buffer
  * @param  SectorAddress: Sector address to read
  * @param  pStatus: pointer to CF status
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_CF_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus)
{
  uint32_t timeout = 0xFFFF, index = 0;
  uint8_t status;

  /* Process Locked */
  __HAL_LOCK(hpccard);

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return HAL_BUSY;
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  /* Initialize CF status */
  *pStatus = CF_READY;

  /* Set the parameters to write a sector */
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_CYLINDER_HIGH) = (uint16_t)0x00;
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_SECTOR_COUNT)  = ((uint16_t)0x0100 ) | ((uint16_t)SectorAddress);
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD)    = (uint16_t)0xE4A0;

  do
  {
    /* wait till the Status = 0x80 */
    status =  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }while((status == 0x80) && timeout);

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }

  timeout = 0xFFFF;

  do
  {
    /* wait till the Status = 0x58 */
    status =  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }while((status != 0x58) && timeout);

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }

  /* Read bytes */
  for(; index < CF_SECTOR_SIZE; index++)
  {
    *(uint16_t *)pBuffer++ = *(uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR);
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  /* Process unlocked */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  Write sector to PCCARD memory
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @param  pBuffer: pointer to source write buffer
  * @param  SectorAddress: Sector address to write
  * @param  pStatus: pointer to CF status
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_CF_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress,  uint8_t *pStatus)
{
  uint32_t timeout = 0xFFFF, index = 0;
  uint8_t status;

  /* Process Locked */
  __HAL_LOCK(hpccard);

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return HAL_BUSY;
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  /* Initialize CF status */
  *pStatus = CF_READY;

  /* Set the parameters to write a sector */
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_CYLINDER_HIGH) = (uint16_t)0x00;
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_SECTOR_COUNT)  = ((uint16_t)0x0100 ) | ((uint16_t)SectorAddress);
  *(__IO uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD)    = (uint16_t)0x30A0;

  do
  {
    /* Wait till the Status = 0x58 */
    status =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }while((status != 0x58) && timeout);

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }

  /* Write bytes */
  for(; index < CF_SECTOR_SIZE; index++)
  {
    *(uint16_t *)(CF_IO_SPACE_PRIMARY_ADDR) = *(uint16_t *)pBuffer++;
  }

  do
  {
    /* Wait till the Status = 0x50 */
    status =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }while((status != 0x50) && timeout);

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  /* Process unlocked */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  Erase sector from PCCARD memory
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @param  SectorAddress: Sector address to erase
  * @param  pStatus: pointer to CF status
  * @retval HAL status
  */
HAL_StatusTypeDef  HAL_CF_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus)
{
  uint32_t timeout = 0x400;
  uint8_t status;

  /* Process Locked */
  __HAL_LOCK(hpccard);

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return HAL_BUSY;
  }

  /* Update the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  /* Initialize CF status */
  *pStatus = CF_READY;

  /* Set the parameters to write a sector */
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_CYLINDER_LOW)  = 0x00;
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_CYLINDER_HIGH) = 0x00;
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_SECTOR_NUMBER) = SectorAddress;
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_SECTOR_COUNT)  = 0x01;
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_CARD_HEAD)     = 0xA0;
  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD)    = CF_ERASE_SECTOR_CMD;

  /* wait till the CF is ready */
  status =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);

  while((status != 0x50) && timeout)
  {
    status =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }

  if(timeout == 0)
  {
    *pStatus = CF_TIMEOUT_ERROR;
  }

  /* Check the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  /* Process unlocked */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  Reset the PCCARD memory
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_CF_Reset(PCCARD_HandleTypeDef *hpccard)
{

  /* Process Locked */
  __HAL_LOCK(hpccard);

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return HAL_BUSY;
  }

  /* Provide an SW reset and Read and verify the:
   - CF Configuration Option Register at address 0x98000200 --> 0x80
   - Card Configuration and Status Register	at address 0x98000202 --> 0x00
   - Pin Replacement Register  at address 0x98000204 --> 0x0C
   - Socket and Copy Register at address 0x98000206 --> 0x00
  */

  /* Check the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_BUSY;

  *(__IO uint8_t *)(0x98000202) = 0x01;

  /* Check the PCCARD controller state */
  hpccard->State = HAL_PCCARD_STATE_READY;

  /* Process unlocked */
  __HAL_UNLOCK(hpccard);

  return HAL_OK;
}

/**
  * @brief  This function handles PCCARD device interrupt request.
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval HAL status
*/
void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard)
{
  /* Check PCCARD interrupt Rising edge flag */
  if(__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_RISING_EDGE))
  {
    /* PCCARD interrupt callback*/
    HAL_PCCARD_ITCallback(hpccard);

    /* Clear PCCARD interrupt Rising edge pending bit */
    __FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_RISING_EDGE);
  }

  /* Check PCCARD interrupt Level flag */
  if(__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_LEVEL))
  {
    /* PCCARD interrupt callback*/
    HAL_PCCARD_ITCallback(hpccard);

    /* Clear PCCARD interrupt Level pending bit */
    __FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_LEVEL);
  }

  /* Check PCCARD interrupt Falling edge flag */
  if(__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FALLING_EDGE))
  {
    /* PCCARD interrupt callback*/
    HAL_PCCARD_ITCallback(hpccard);

    /* Clear PCCARD interrupt Falling edge pending bit */
    __FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_FALLING_EDGE);
  }

  /* Check PCCARD interrupt FIFO empty flag */
  if(__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FEMPT))
  {
    /* PCCARD interrupt callback*/
    HAL_PCCARD_ITCallback(hpccard);

    /* Clear PCCARD interrupt FIFO empty pending bit */
    __FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_FEMPT);
  }

}

/**
  * @brief  PCCARD interrupt feature callback
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval None
  */
__weak void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard)
{
  /* NOTE : This function Should not be modified, when the callback is needed,
            the HAL_PCCARD_ITCallback could be implemented in the user file
   */
}

/**
  * @}
  */

/** @defgroup PCCARD_Group4 State functions
 *  @brief   Peripheral State functions
 *
@verbatim
  ==============================================================================
                      ##### PCCARD State functions #####
  ==============================================================================
  [..]
    This subsection permits to get in run-time the status of the PCCARD controller
    and the data flow.

@endverbatim
  * @{
  */

/**
  * @brief  return the PCCARD controller state
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval HAL state
  */
HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard)
{
  return hpccard->State;
}

/**
  * @brief  Get the compact flash memory status
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval New status of the CF operation. This parameter can be:
  *          - CompactFlash_TIMEOUT_ERROR: when the previous operation generate
  *            a Timeout error
  *          - CompactFlash_READY: when memory is ready for the next operation
  *
  */
CF_StatusTypedef HAL_CF_GetStatus(PCCARD_HandleTypeDef *hpccard)
{
  uint32_t timeout = 0x1000000, status_CF;

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return CF_ONGOING;
  }

  status_CF =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);

  while((status_CF == CF_BUSY) && timeout)
  {
    status_CF =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);
    timeout--;
  }

  if(timeout == 0)
  {
    status_CF =  CF_TIMEOUT_ERROR;
  }

  /* Return the operation status */
  return (CF_StatusTypedef) status_CF;
}

/**
  * @brief  Reads the Compact Flash memory status using the Read status command
  * @param  hpccard: pointer to a PCCARD_HandleTypeDef structure that contains
  *                the configuration information for PCCARD module.
  * @retval The status of the Compact Flash memory. This parameter can be:
  *          - CompactFlash_BUSY: when memory is busy
  *          - CompactFlash_READY: when memory is ready for the next operation
  *          - CompactFlash_ERROR: when the previous operation gererates error
  */
CF_StatusTypedef HAL_CF_ReadStatus(PCCARD_HandleTypeDef *hpccard)
{
  uint8_t data = 0, status_CF = CF_BUSY;

  /* Check the PCCARD controller state */
  if(hpccard->State == HAL_PCCARD_STATE_BUSY)
  {
     return CF_ONGOING;
  }

  /* Read status operation */
  data =  *(__IO uint8_t *)(CF_IO_SPACE_PRIMARY_ADDR | CF_STATUS_CMD_ALTERNATE);

  if((data & CF_TIMEOUT_ERROR) == CF_TIMEOUT_ERROR)
  {
    status_CF = CF_TIMEOUT_ERROR;
  }
  else if((data & CF_READY) == CF_READY)
  {
    status_CF = CF_READY;
  }

  return (CF_StatusTypedef) status_CF;
}

/**
  * @}
  */

/**
  * @}
  */
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
#endif /* HAL_PCCARD_MODULE_ENABLED */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
! { dg-do compile }
! This tests the fix for the regression PR25785, where line 7 started
! generating an assumed size error.
! Contributed by Dale Ranta  <dir@lanl.gov>
      subroutine my_sio_file_write_common(data_c1)
        character,   intent(in), optional :: data_c1(*)
        if (present(data_c1)) then
        endif
      end subroutine my_sio_file_write_common