text:
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.forms.formsets import formset_factory

class MockForm(forms.Form):

    text_input = forms.CharField(widget=forms.TextInput)
    email_input = forms.EmailField()
    url_input = forms.URLField()
    number_input = forms.IntegerField()
    password_input = forms.CharField(widget=forms.PasswordInput)
    checkbox_input = forms.BooleanField()
    hidden_input = forms.CharField(widget=forms.HiddenInput)
    multiple_hidden_input = forms.CharField(widget=forms.MultipleHiddenInput)
    file_input = forms.FileField(widget=forms.FileInput)
    clearable_file_input = forms.FileField()
    textarea = forms.CharField(widget=forms.Textarea)
    date_input = forms.DateField()
    datetime_input = forms.DateTimeField()
    time_input = forms.TimeField()
    split_datetime_widget = forms.DateTimeField(widget=forms.SplitDateTimeWidget)
    select = forms.ChoiceField((('option 1', 'Option 1'), ('option 2', 'Option 2')))
    null_boolean_select = forms.NullBooleanField()
    select_multiple = forms.ChoiceField((('option 1', 'Option 1'), ('option 2', 'Option 2')), widget=forms.SelectMultiple)
    checkbox_select_multiple = forms.ChoiceField((('option 1', 'Option 1'), ('option 2', 'Option 2')), widget=forms.CheckboxSelectMultiple)
    radio_select = forms.ChoiceField((('option 1', 'Option 1'), ('option 2', 'Option 2')), widget=forms.RadioSelect)
    select_date_widget = forms.DateField(widget=SelectDateWidget)

class MockForm2(forms.Form):
    field1 = forms.CharField(min_length=4, required=True)

MockFormSet = formset_factory(MockForm2, max_num=1, validate_max=True)


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

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title>Content</title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1265.21">

 Welcome to DIScover

 Understanding DIScover

    DIScover Overview

    Core Concepts

    DIScover Components

    DIScover in the Enterprise Environment

 Getting Started With DIScover

 The Model Browser Interface

 Querying an Information Model

 Working With Graphical Views

 Working With Source Code

 Impact Analysis

 Caliper

 Metrics

 Dormant

 Simplify.h

 Developer Xpress

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Opifer\ContentBundle\Block\Tool;

use Opifer\ContentBundle\Model\BlockInterface;

interface ToolsetMemberInterface
{
    /**
     * @param BlockInterface $block
     *
     * @return Tool
     */
    public function getTool(BlockInterface $block = null);
}


text:
@interface GitCommitOperation : GitOperation
{
}

- (void)parseData;
- (id)initWithRequest:(id)arg1;

@end


text:
<?php

namespace Magento\Bundle\Model\Product;

use Magento\Customer\Api\GroupManagementInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;

/**
 * Bundle Price Model
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class Price extends \Magento\Catalog\Model\Product\Type\Price
{
    /**
     * Fixed bundle price type
     */
    const PRICE_TYPE_FIXED = 1;

    /**
     * Dynamic bundle price type
     */
    const PRICE_TYPE_DYNAMIC = 0;

    /**
     * Flag which indicates - is min/max prices have been calculated by index
     *
     * @var bool
     */
    protected $_isPricesCalculatedByIndex;

    /**
     * Catalog data
     *
     * @var \Magento\Catalog\Helper\Data
     */
    protected $_catalogData = null;

    /**
     * Price constructor.
     *
     * @param \Magento\CatalogRule\Model\ResourceModel\RuleFactory $ruleFactory
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
     * @param \Magento\Customer\Model\Session $customerSession
     * @param \Magento\Framework\Event\ManagerInterface $eventManager
     * @param PriceCurrencyInterface $priceCurrency
     * @param GroupManagementInterface $groupManagement
     * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
     * @param \Magento\Catalog\Helper\Data $catalogData
     *
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
     */
    public function __construct(
        \Magento\CatalogRule\Model\ResourceModel\RuleFactory $ruleFactory,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        PriceCurrencyInterface $priceCurrency,
        GroupManagementInterface $groupManagement,
        \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory,
        \Magento\Framework\App\Config\ScopeConfigInterface $config,
        \Magento\Catalog\Helper\Data $catalogData
    ) {
        $this->_catalogData = $catalogData;
        parent::__construct(
            $ruleFactory,
            $storeManager,
            $localeDate,
            $customerSession,
            $eventManager,
            $priceCurrency,
            $groupManagement,
            $tierPriceFactory,
            $config
        );
    }

    /**
     * Is min/max prices have been calculated by index
     *
     * @return bool
     * @SuppressWarnings(PHPMD.BooleanGetMethodName)
     */
    public function getIsPricesCalculatedByIndex()
    {
        return $this->_isPricesCalculatedByIndex;
    }

    /**
     * Return product base price
     *
     * @param \Magento\Catalog\Model\Product $product
     * @return float
     */
    public function getPrice($product)
    {
        if ($product->getPriceType() == self::PRICE_TYPE_FIXED) {
            return $product->getData('price');
        } else {
            return 0;
        }
    }

    /**
     * Get Total price  for Bundle items
     *
     * @param \Magento\Catalog\Model\Product $product
     * @param null|float $qty
     * @return float
     */
    public function getTotalBundleItemsPrice($product, $qty = null)
    {
        $price = 0.0;
        if ($product->hasCustomOptions()) {
            $selectionIds = $this->getBundleSelectionIds($product);
            if ($selectionIds) {
                $selections = $product->getTypeInstance()->getSelectionsByIds($selectionIds, $product);
                $selections->addTierPriceData();
                $this->_eventManager->dispatch(
                    'prepare_catalog_product_collection_prices',
                    ['collection' => $selections, 'store_id' => $product->getStoreId()]
                );
                foreach ($selections->getItems() as $selection) {
                    if ($selection->isSalable()) {
                        $selectionQty = $product->getCustomOption('selection_qty_' . $selection->getSelectionId());
                        if ($selectionQty) {
                            $price += $this->getSelectionFinalTotalPrice(
                                $product,
                                $selection,
                                $qty,
                                $selectionQty->getValue()
                            );
                        }
                    }
                }
            }
        }
        return $price;
    }

    /**
     * Retrieve array of bundle selection IDs
     *
     * @param \Magento\Catalog\Model\Product $product
     * @return array
     */
    protected function getBundleSelectionIds(\Magento\Catalog\Model\Product $product)
    {
        $customOption = $product->getCustomOption('bundle_selection_ids');
        if ($customOption) {
            $selectionIds = unserialize($customOption->getValue());
            if (!empty($selectionIds) && is_array($selectionIds)) {
                return $selectionIds;
            }
        }
        return [];
    }

    /**
     * Get product final price
     *
     * @param   float                     $qty
     * @param   \Magento\Catalog\Model\Product $product
     * @return  float
     */
    public function getFinalPrice($qty, $product)
    {
        if ($qty === null && $product->getCalculatedFinalPrice() !== null) {
            return $product->getCalculatedFinalPrice();
        }

        $finalPrice = $this->getBasePrice($product, $qty);
        $product->setFinalPrice($finalPrice);
        $this->_eventManager->dispatch('catalog_product_get_final_price', ['product' => $product, 'qty' => $qty]);
        $finalPrice = $product->getData('final_price');

        $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
        $finalPrice += $this->getTotalBundleItemsPrice($product, $qty);

        $finalPrice = max(0, $finalPrice);
        $product->setFinalPrice($finalPrice);
        return $finalPrice;
    }

    /**
     * Returns final price of a child product
     *
     * @param \Magento\Catalog\Model\Product $product
     * @param float                      $productQty
     * @param \Magento\Catalog\Model\Product $childProduct
     * @param float                      $childProductQty
     * @return float
     */
    public function getChildFinalPrice($product, $productQty, $childProduct, $childProductQty)
    {
        return $this->getSelectionFinalTotalPrice($product, $childProduct, $productQty, $childProductQty, false);
    }

    /**
     * Retrieve Price considering tier price
     *
     * @param  \Magento\Catalog\Model\Product $product
     * @param  string|null                $which
     * @param  bool|null                  $includeTax
     * @param  bool                       $takeTierPrice
     * @return float|array
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function getTotalPrices($product, $which = null, $includeTax = null, $takeTierPrice = true)
    {
        // check calculated price index
        if ($product->getData('min_price') && $product->getData('max_price')) {
            $minimalPrice = $this->_catalogData->getTaxPrice($product, $product->getData('min_price'), $includeTax);
            $maximalPrice = $this->_catalogData->getTaxPrice($product, $product->getData('max_price'), $includeTax);
            $this->_isPricesCalculatedByIndex = true;
        } else {
            /**
             * Check if product price is fixed
             */
            $finalPrice = $product->getFinalPrice();
            if ($product->getPriceType() == self::PRICE_TYPE_FIXED) {
                $minimalPrice = $maximalPrice = $this->_catalogData->getTaxPrice($product, $finalPrice, $includeTax);
            } else {
                // PRICE_TYPE_DYNAMIC
                $minimalPrice = $maximalPrice = 0;
            }

            $options = $this->getOptions($product);
            $minPriceFounded = false;

            if ($options) {
                foreach ($options as $option) {
                    /* @var $option \Magento\Bundle\Model\Option */
                    $selections = $option->getSelections();
                    if ($selections) {
                        $selectionMinimalPrices = [];
                        $selectionMaximalPrices = [];

                        foreach ($option->getSelections() as $selection) {
                            /* @var $selection \Magento\Bundle\Model\Selection */
                            if (!$selection->isSalable()) {
                                /**
                                 * @todo CatalogInventory Show out of stock Products
                                 */
                                continue;
                            }

                            $qty = $selection->getSelectionQty();

                            $item = $product->getPriceType() == self::PRICE_TYPE_FIXED ? $product : $selection;

                            $selectionMinimalPrices[] = $this->_catalogData->getTaxPrice(
                                $item,
                                $this->getSelectionFinalTotalPrice(
                                    $product,
                                    $selection,
                                    1,
                                    $qty,
                                    true,
                                    $takeTierPrice
                                ),
                                $includeTax
                            );
                            $selectionMaximalPrices[] = $this->_catalogData->getTaxPrice(
                                $item,
                                $this->getSelectionFinalTotalPrice(
                                    $product,
                                    $selection,
                                    1,
                                    null,
                                    true,
                                    $takeTierPrice
                                ),
                                $includeTax
                            );
                        }

                        if (count($selectionMinimalPrices)) {
                            $selMinPrice = min($selectionMinimalPrices);
                            if ($option->getRequired()) {
                                $minimalPrice += $selMinPrice;
                                $minPriceFounded = true;
                            } elseif (true !== $minPriceFounded) {
                                $selMinPrice += $minimalPrice;
                                $minPriceFounded = false === $minPriceFounded ? $selMinPrice : min(
                                    $minPriceFounded,
                                    $selMinPrice
                                );
                            }

                            if ($option->isMultiSelection()) {
                                $maximalPrice += array_sum($selectionMaximalPrices);
                            } else {
                                $maximalPrice += max($selectionMaximalPrices);
                            }
                        }
                    }
                }
            }
            // condition is TRUE when all product options are NOT required
            if (!is_bool($minPriceFounded)) {
                $minimalPrice = $minPriceFounded;
            }

            $customOptions = $product->getOptions();
            if ($product->getPriceType() == self::PRICE_TYPE_FIXED && $customOptions) {
                foreach ($customOptions as $customOption) {
                    /* @var $customOption \Magento\Catalog\Model\Product\Option */
                    $values = $customOption->getValues();
                    if ($values) {
                        $prices = [];
                        foreach ($values as $value) {
                            /* @var $value \Magento\Catalog\Model\Product\Option\Value */
                            $valuePrice = $value->getPrice(true);

                            $prices[] = $valuePrice;
                        }
                        if (count($prices)) {
                            if ($customOption->getIsRequire()) {
                                $minimalPrice += $this->_catalogData->getTaxPrice($product, min($prices), $includeTax);
                            }

                            $multiTypes = [
                                \Magento\Catalog\Model\Product\Option::OPTION_TYPE_CHECKBOX,
                                \Magento\Catalog\Model\Product\Option::OPTION_TYPE_MULTIPLE,
                            ];

                            if (in_array($customOption->getType(), $multiTypes)) {
                                $maximalValue = array_sum($prices);
                            } else {
                                $maximalValue = max($prices);
                            }
                            $maximalPrice += $this->_catalogData->getTaxPrice($product, $maximalValue, $includeTax);
                        }
                    } else {
                        $valuePrice = $customOption->getPrice(true);

                        if ($customOption->getIsRequire()) {
                            $minimalPrice += $this->_catalogData->getTaxPrice($product, $valuePrice, $includeTax);
                        }
                        $maximalPrice += $this->_catalogData->getTaxPrice($product, $valuePrice, $includeTax);
                    }
                }
            }
            $this->_isPricesCalculatedByIndex = false;
        }

        if ($which == 'max') {
            return $maximalPrice;
        } elseif ($which == 'min') {
            return $minimalPrice;
        }

        return [$minimalPrice, $maximalPrice];
    }

    /**
     * Get Options with attached Selections collection
     *
     * @param \Magento\Catalog\Model\Product $product
     * @return \Magento\Bundle\Model\ResourceModel\Option\Collection
     */
    public function getOptions($product)
    {
        $product->getTypeInstance()->setStoreFilter($product->getStoreId(), $product);

        $optionCollection = $product->getTypeInstance()->getOptionsCollection($product);

        $selectionCollection = $product->getTypeInstance()->getSelectionsCollection(
            $product->getTypeInstance()->getOptionsIds($product),
            $product
        );

        return $optionCollection->appendSelections($selectionCollection, false, false);
    }

    /**
     * Calculate price of selection
     *
     * @param \Magento\Catalog\Model\Product $bundleProduct
     * @param \Magento\Catalog\Model\Product $selectionProduct
     * @param float|null                 $selectionQty
     * @param null|bool                  $multiplyQty      Whether to multiply selection's price by its quantity
     * @return float
     *
     * @see \Magento\Bundle\Model\Product\Price::getSelectionFinalTotalPrice()
     */
    public function getSelectionPrice($bundleProduct, $selectionProduct, $selectionQty = null, $multiplyQty = true)
    {
        return $this->getSelectionFinalTotalPrice($bundleProduct, $selectionProduct, 0, $selectionQty, $multiplyQty);
    }

    /**
     * Calculate selection price for front view (with applied special of bundle)
     *
     * @param \Magento\Catalog\Model\Product $bundleProduct
     * @param \Magento\Catalog\Model\Product $selectionProduct
     * @param float                    $qty
     * @return float
     */
    public function getSelectionPreFinalPrice($bundleProduct, $selectionProduct, $qty = null)
    {
        return $this->getSelectionPrice($bundleProduct, $selectionProduct, $qty);
    }

    /**
     * Calculate final price of selection
     * with take into account tier price
     *
     * @param  \Magento\Catalog\Model\Product $bundleProduct
     * @param  \Magento\Catalog\Model\Product $selectionProduct
     * @param  float                    $bundleQty
     * @param  float                    $selectionQty
     * @param  bool                       $multiplyQty
     * @param  bool                       $takeTierPrice
     * @return float
     */
    public function getSelectionFinalTotalPrice(
        $bundleProduct,
        $selectionProduct,
        $bundleQty,
        $selectionQty,
        $multiplyQty = true,
        $takeTierPrice = true
    ) {
        if (null === $bundleQty) {
            $bundleQty = 1.;
        }
        if ($selectionQty === null) {
            $selectionQty = $selectionProduct->getSelectionQty();
        }

        if ($bundleProduct->getPriceType() == self::PRICE_TYPE_DYNAMIC) {
            $price = $selectionProduct->getFinalPrice($takeTierPrice ? $selectionQty : 1);
        } else {
            if ($selectionProduct->getSelectionPriceType()) {
                // percent
                $product = clone $bundleProduct;
                $product->setFinalPrice($this->getPrice($product));
                $this->_eventManager->dispatch(
                    'catalog_product_get_final_price',
                    ['product' => $product, 'qty' => $bundleQty]
                );
                $price = $product->getData('final_price') * ($selectionProduct->getSelectionPriceValue() / 100);
            } else {
                // fixed
                $price = $selectionProduct->getSelectionPriceValue();
            }
        }

        if ($multiplyQty) {
            $price *= $selectionQty;
        }

        return min(
            $price,
            $this->_applyTierPrice($bundleProduct, $bundleQty, $price),
            $this->_applySpecialPrice($bundleProduct, $price)
        );
    }

    /**
     * Apply tier price for bundle
     *
     * @param   \Magento\Catalog\Model\Product $product
     * @param   float                    $qty
     * @param   float                    $finalPrice
     * @return  float
     */
    protected function _applyTierPrice($product, $qty, $finalPrice)
    {
        if ($qty === null) {
            return $finalPrice;
        }

        $tierPrice = $product->getTierPrice($qty);

        if (is_numeric($tierPrice)) {
            $tierPrice = $finalPrice - $finalPrice * ($tierPrice / 100);
            $finalPrice = min($finalPrice, $tierPrice);
        }

        return $finalPrice;
    }

    /**
     * Get product tier price by qty
     *
     * @param   float                    $qty
     * @param   \Magento\Catalog\Model\Product $product
     * @return  float|array
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    public function getTierPrice($qty, $product)
    {
        $allCustomersGroupId = $this->_groupManagement->getAllCustomersGroup()->getId();
        $prices = $product->getData('tier_price');

        if ($prices === null) {
            if ($attribute = $product->getResource()->getAttribute('tier_price')) {
                $attribute->getBackend()->afterLoad($product);
                $prices = $product->getData('tier_price');
            }
        }

        if ($prices === null || !is_array($prices)) {
            if ($qty !== null) {
                return $product->getPrice();
            }
            return [
                [
                    'price' => $product->getPrice(),
                    'website_price' => $product->getPrice(),
                    'price_qty' => 1,
                    'cust_group' => $allCustomersGroupId,
                ]
            ];
        }

        $custGroup = $this->_getCustomerGroupId($product);
        if ($qty) {
            $prevQty = 1;
            $prevPrice = 0;
            $prevGroup = $allCustomersGroupId;

            foreach ($prices as $price) {
                if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allCustomersGroupId) {
                    // tier not for current customer group nor is for all groups
                    continue;
                }
                if ($qty < $price['price_qty']) {
                    // tier is higher than product qty
                    continue;
                }
                if ($price['price_qty'] < $prevQty) {
                    // higher tier qty already found
                    continue;
                }
                if ($price['price_qty'] == $prevQty
                    && $prevGroup != $allCustomersGroupId
                    && $price['cust_group'] == $allCustomersGroupId
                ) {
                    // found tier qty is same as current tier qty but current tier group is ALL_GROUPS
                    continue;
                }

                if ($price['website_price'] > $prevPrice) {
                    $prevPrice = $price['website_price'];
                    $prevQty = $price['price_qty'];
                    $prevGroup = $price['cust_group'];
                }
            }

            return $prevPrice;
        } else {
            $qtyCache = [];
            foreach ($prices as $i => $price) {
                if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allCustomersGroupId) {
                    unset($prices[$i]);
                } elseif (isset($qtyCache[$price['price_qty']])) {
                    $j = $qtyCache[$price['price_qty']];
                    if ($prices[$j]['website_price'] < $price['website_price']) {
                        unset($prices[$j]);
                        $qtyCache[$price['price_qty']] = $i;
                    } else {
                        unset($prices[$i]);
                    }
                } else {
                    $qtyCache[$price['price_qty']] = $i;
                }
            }
        }

        return $prices ? $prices : [];
    }

    /**
     * Calculate and apply special price
     *
     * @param float  $finalPrice
     * @param float  $specialPrice
     * @param string $specialPriceFrom
     * @param string $specialPriceTo
     * @param mixed  $store
     * @return float
     */
    public function calculateSpecialPrice(
        $finalPrice,
        $specialPrice,
        $specialPriceFrom,
        $specialPriceTo,
        $store = null
    ) {
        if ($specialPrice !== null && $specialPrice != false) {
            if ($this->_localeDate->isScopeDateInInterval($store, $specialPriceFrom, $specialPriceTo)) {
                $specialPrice = $finalPrice * ($specialPrice / 100);
                $finalPrice = min($finalPrice, $specialPrice);
            }
        }

        return $finalPrice;
    }

    /**
     * Returns the lowest price after applying any applicable bundle discounts
     *
     * @param /Magento/Catalog/Model/Detail $bundleProduct
     * @param float|string $price
     * @param int          $bundleQty
     * @return float
     */
    public function getLowestPrice($bundleProduct, $price, $bundleQty = 1)
    {
        $price = (float)$price;
        return min(
            $price,
            $this->_applyTierPrice($bundleProduct, $bundleQty, $price),
            $this->_applySpecialPrice($bundleProduct, $price)
        );
    }
}


text:
package com.anysoftkeyboard.ime;

import android.graphics.Color;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.anysoftkeyboard.android.PowerSaving;
import com.anysoftkeyboard.overlay.OverlayData;
import com.anysoftkeyboard.overlay.OverlyDataCreator;
import com.anysoftkeyboard.rx.GenericOnError;
import com.menny.android.anysoftkeyboard.R;
import java.util.List;

public abstract class AnySoftKeyboardPowerSaving extends AnySoftKeyboardNightMode {
    private boolean mPowerState;
    private ToggleOverlayCreator mToggleOverlayCreator;

    @Override
    public void onCreate() {
        super.onCreate();

        addDisposable(
                PowerSaving.observePowerSavingState(getApplicationContext(), 0)
                        .subscribe(
                                powerState -> {
                                    mPowerState = powerState;
                                    setupInputViewWatermark();
                                },
                                GenericOnError.onError("Power-Saving icon")));

        addDisposable(
                PowerSaving.observePowerSavingState(
                                getApplicationContext(),
                                R.string.settings_key_power_save_mode_theme_control,
                                R.bool.settings_default_true)
                        .subscribe(
                                mToggleOverlayCreator::setToggle,
                                GenericOnError.onError("Power-Saving theme")));
    }

    @NonNull
    @Override
    protected List<Drawable> generateWatermark() {
        final List<Drawable> watermark = super.generateWatermark();
        if (mPowerState) {
            watermark.add(ContextCompat.getDrawable(this, R.drawable.ic_watermark_power_saving));
        }
        return watermark;
    }

    @Override
    protected OverlyDataCreator createOverlayDataCreator() {
        return mToggleOverlayCreator =
                new ToggleOverlayCreator(
                        super.createOverlayDataCreator(),
                        this,
                        new OverlayData(
                                Color.BLACK, Color.BLACK, Color.DKGRAY, Color.GRAY, Color.DKGRAY),
                        "PowerSaving");
    }
}


text:
package main

// tutorial01.c
// Code based on a tutorial at http://dranger.com/ffmpeg/tutorial01.html

// A small sample program that shows how to use libavformat and libavcodec to
// read video from a file.
//
// Use
//
// gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
//
// to build (assuming libavformat and libavcodec are correctly installed
// your system).
//
// Run using
//
// tutorial01 myvideofile.mpg
//
// to write the first five frames from "myvideofile.mpg" to disk in PPM
// format.
import (
	"fmt"
	"log"
	"os"
	"unsafe"

	"github.com/giorgisio/goav/swscale"

	"github.com/giorgisio/goav/avcodec"
	"github.com/giorgisio/goav/avformat"
	"github.com/giorgisio/goav/avutil"
)

// SaveFrame writes a single frame to disk as a PPM file
func SaveFrame(frame *avutil.Frame, width, height, frameNumber int) {
	// Open file
	fileName := fmt.Sprintf("frame%d.ppm", frameNumber)
	file, err := os.Create(fileName)
	if err != nil {
		log.Println("Error Reading")
	}
	defer file.Close()

	// Write header
	header := fmt.Sprintf("P6\n%d %d\n255\n", width, height)
	file.Write([]byte(header))

	// Write pixel data
	for y := 0; y < height; y++ {
		data0 := avutil.Data(frame)[0]
		buf := make([]byte, width*3)
		startPos := uintptr(unsafe.Pointer(data0)) + uintptr(y)*uintptr(avutil.Linesize(frame)[0])
		for i := 0; i < width*3; i++ {
			element := *(*uint8)(unsafe.Pointer(startPos + uintptr(i)))
			buf[i] = element
		}
		file.Write(buf)
	}
}

func main() {
	if len(os.Args) < 2 {
		fmt.Println("Please provide a movie file")
		os.Exit(1)
	}

	// Open video file
	pFormatContext := avformat.AvformatAllocContext()
	if avformat.AvformatOpenInput(&pFormatContext, os.Args[1], nil, nil) != 0 {
		fmt.Printf("Unable to open file %s\n", os.Args[1])
		os.Exit(1)
	}

	// Retrieve stream information
	if pFormatContext.AvformatFindStreamInfo(nil) < 0 {
		fmt.Println("Couldn't find stream information")
		os.Exit(1)
	}

	// Dump information about file onto standard error
	pFormatContext.AvDumpFormat(0, os.Args[1], 0)

	// Find the first video stream
	for i := 0; i < int(pFormatContext.NbStreams()); i++ {
		switch pFormatContext.Streams()[i].CodecParameters().AvCodecGetType() {
		case avformat.AVMEDIA_TYPE_VIDEO:

			// Get a pointer to the codec context for the video stream
			pCodecCtxOrig := pFormatContext.Streams()[i].Codec()
			// Find the decoder for the video stream
			pCodec := avcodec.AvcodecFindDecoder(avcodec.CodecId(pCodecCtxOrig.GetCodecId()))
			if pCodec == nil {
				fmt.Println("Unsupported codec!")
				os.Exit(1)
			}
			// Copy context
			pCodecCtx := pCodec.AvcodecAllocContext3()
			if pCodecCtx.AvcodecCopyContext((*avcodec.Context)(unsafe.Pointer(pCodecCtxOrig))) != 0 {
				fmt.Println("Couldn't copy codec context")
				os.Exit(1)
			}

			// Open codec
			if pCodecCtx.AvcodecOpen2(pCodec, nil) < 0 {
				fmt.Println("Could not open codec")
				os.Exit(1)
			}

			// Allocate video frame
			pFrame := avutil.AvFrameAlloc()

			// Allocate an AVFrame structure
			pFrameRGB := avutil.AvFrameAlloc()
			if pFrameRGB == nil {
				fmt.Println("Unable to allocate RGB Frame")
				os.Exit(1)
			}

			// Determine required buffer size and allocate buffer
			numBytes := uintptr(avcodec.AvpictureGetSize(avcodec.AV_PIX_FMT_RGB24, pCodecCtx.Width(),
				pCodecCtx.Height()))
			buffer := avutil.AvMalloc(numBytes)

			// Assign appropriate parts of buffer to image planes in pFrameRGB
			// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
			// of AVPicture
			avp := (*avcodec.Picture)(unsafe.Pointer(pFrameRGB))
			avp.AvpictureFill((*uint8)(buffer), avcodec.AV_PIX_FMT_RGB24, pCodecCtx.Width(), pCodecCtx.Height())

			// initialize SWS context for software scaling
			swsCtx := swscale.SwsGetcontext(
				pCodecCtx.Width(),
				pCodecCtx.Height(),
				(swscale.PixelFormat)(pCodecCtx.PixFmt()),
				pCodecCtx.Width(),
				pCodecCtx.Height(),
				avcodec.AV_PIX_FMT_RGB24,
				avcodec.SWS_BILINEAR,
				nil,
				nil,
				nil,
			)

			// Read frames and save first five frames to disk
			frameNumber := 1
			packet := avcodec.AvPacketAlloc()
			for pFormatContext.AvReadFrame(packet) >= 0 {
				// Is this a packet from the video stream?
				if packet.StreamIndex() == i {
					// Decode video frame
					response := pCodecCtx.AvcodecSendPacket(packet)
					if response < 0 {
						fmt.Printf("Error while sending a packet to the decoder: %s\n", avutil.ErrorFromCode(response))
					}
					for response >= 0 {
						response = pCodecCtx.AvcodecReceiveFrame((*avcodec.Frame)(unsafe.Pointer(pFrame)))
						if response == avutil.AvErrorEAGAIN || response == avutil.AvErrorEOF {
							break
						} else if response < 0 {
							fmt.Printf("Error while receiving a frame from the decoder: %s\n", avutil.ErrorFromCode(response))
							return
						}

						if frameNumber <= 5 {
							// Convert the image from its native format to RGB
							swscale.SwsScale2(swsCtx, avutil.Data(pFrame),
								avutil.Linesize(pFrame), 0, pCodecCtx.Height(),
								avutil.Data(pFrameRGB), avutil.Linesize(pFrameRGB))

							// Save the frame to disk
							fmt.Printf("Writing frame %d\n", frameNumber)
							SaveFrame(pFrameRGB, pCodecCtx.Width(), pCodecCtx.Height(), frameNumber)
						} else {
							return
						}
						frameNumber++
					}
				}

				// Free the packet that was allocated by av_read_frame
				packet.AvFreePacket()
			}

			// Free the RGB image
			avutil.AvFree(buffer)
			avutil.AvFrameFree(pFrameRGB)

			// Free the YUV frame
			avutil.AvFrameFree(pFrame)

			// Close the codecs
			pCodecCtx.AvcodecClose()
			(*avcodec.Context)(unsafe.Pointer(pCodecCtxOrig)).AvcodecClose()

			// Close the video file
			pFormatContext.AvformatCloseInput()

			// Stop after saving frames of first video straem
			break

		default:
			fmt.Println("Didn't find a video stream")
			os.Exit(1)
		}
	}
}


text:
using System.IO;

namespace test {
    class Program {
        static void Main(string[] args)
        {
            var highlighter = new Pygments.Highlighter();
            var src = File.ReadAllText(@"..\..\..\..\..\test\program.cs");
            File.WriteAllText("output.html", highlighter.HighlightToHtml(src, "c#", "vs", highlightLines: "7 8 9 10"));

        }
    }
}


text:
layout: page
title: Sobre
---

<p class="message">
  Este grupo dedica-se a coisas discretas. Simples e complexas.
</p>

Queremos codificar um mundo mais discreto e mais perfeito.

## Novidades

Fique atento!


text:
'use strict';

angular.module('<%= baseName %>')
  .config(['$routeProvider', function ($routeProvider) {
    $routeProvider
      .when('/<%= pluralize(name) %>', {
        templateUrl: 'views/<%= name %>/<%= pluralize(name) %>.html',
        controller: '<%= _.capitalize(name) %>Controller',
        resolve:{
          resolved<%= _.capitalize(name) %>: ['<%= _.capitalize(name) %>', function (<%= _.capitalize(name) %>) {
            return <%= _.capitalize(name) %>.query(function (objs) {
              // deal with Haskell Persistent json format
              for (var i = 0; i < objs.length; i++) {
                var obj = objs[i];
                obj.id = obj.key;
                delete obj.key;
                for (var prop in obj.value) {
                  obj[prop] = obj.value[prop];
                }
                delete obj.value;
              }
            });
          }]
        }
      })
    }]);


text:
define(['jquery', 'jquery-ui'], function ($) {
	'use strict';

	$.widget('ui.autocomplete', $.ui.autocomplete, {
		_resizeMenu: function () {
			var ul, lis, ulW, barW;
			if (isNaN(this.options.maxShowItems)) {
				return;
			}
			ul = this.menu.element
				.css({
					overflowX: '',
					overflowY: '',
					width: '',
					maxHeight: ''
				}); // Restore
			lis = ul.children('li').css('whiteSpace', 'nowrap');

			if (lis.length > this.options.maxShowItems) {
				ulW = ul.prop('clientWidth');
				ul.css({
					overflowX: 'hidden',
					overflowY: 'auto',
					maxHeight: lis.eq(0).outerHeight() * this.options.maxShowItems + 1
				}); // 1px for Firefox
				barW = ulW - ul.prop('clientWidth');
				ul.width('+=' + barW);
			}

			// Original code from jquery.ui.autocomplete.js _resizeMenu()
			ul.outerWidth(Math.max(
				ul.outerWidth() + 1,
				this.element.outerWidth()
			));
		}
	});

});


text:
var assert = require('assert'),
    error = require('../../../lib/error/index'),
    math = require('../../../index')();

describe('forEach', function() {

  it('should iterate over all elements of the matrix', function() {
    var m = math.matrix([1,2,3]);
    var output = [];
    math.forEach(m, function (value) { output.push(value); });
    assert.deepEqual(output, [1,2,3]);
  });

  it('should iterate deep over all elements in the array', function() {
    var arr = [1,2,3];
    var output = [];
    math.forEach(arr, function (value) { output.push(value); });
    assert.deepEqual(output, [1,2,3]);
  });

  it('should invoke callback with parameters value, index, obj', function() {
    var arr = [[1,2,3], [4,5,6]];
    var output = [];

    math.forEach(arr, function (value, index, obj) {
      output.push(math.clone([value, index, obj === arr]));
    });
    assert.deepEqual(output, [
      [1, [0, 0], true ],
      [2, [0, 1], true ],
      [3, [0, 2], true ],
      [4, [1, 0], true ],
      [5, [1, 1], true ],
      [6, [1, 2], true ]
    ]);
  });

  it('should throw an error if called with unsupported type', function() {
    assert.throws(function() { math.forEach(1, function() {}) });
    assert.throws(function() { math.forEach('arr', function() {}) });
  });

  it('should throw an error if called with invalid number of arguments', function() {
    assert.throws(function() { math.forEach([1, 2, 3]) });
  });

});


text:
layout:     post
title:      physical emotions
date:       2018-09-28 02:29:12
summary:
categories: drawing
---
![physical emotions](/images/diary/physical-emotions.png ".")


text:
/**
 * @module SoundJS
 */

// namespace:
this.createjs = this.createjs || {};

(function () {
	"use strict";

	/**
	 * Loader provides a mechanism to preload Web Audio content via PreloadJS or internally. Instances are returned to
	 * the preloader, and the load method is called when the asset needs to be requested.
	 *
	 * @class WebAudioLoader
	 * @param {String} loadItem The item to be loaded
	 * @extends XHRRequest
	 * @protected
	 */
	function Loader(loadItem) {
		this.AbstractLoader_constructor(loadItem, true, createjs.Types.SOUND);

	};
	var p = createjs.extend(Loader, createjs.AbstractLoader);

	/**
	 * web audio context required for decoding audio
	 * @property context
	 * @type {AudioContext}
	 * @static
	 */
	Loader.context = null;

// public methods
	p.toString = function () {
		return "[WebAudioLoader]";
	};

// private methods
	p._createRequest = function() {
		this._request = new createjs.XHRRequest(this._item, false);
		this._request.setResponseType("arraybuffer");
	};

	p._sendComplete = function (event) {
		// OJR we leave this wrapped in Loader because we need to reference src and the handler only receives a single argument, the decodedAudio
		Loader.context.decodeAudioData(this._rawResult,
	         createjs.proxy(this._handleAudioDecoded, this),
	         createjs.proxy(this._sendError, this));
	};

	/**
	* The audio has been decoded.
	* @method handleAudioDecoded
	* @param decoded
	* @protected
	*/
	p._handleAudioDecoded = function (decodedAudio) {
		this._result = decodedAudio;
		this.AbstractLoader__sendComplete();
	};

	createjs.WebAudioLoader = createjs.promote(Loader, "AbstractLoader");
}());


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
<current_observation version="1.0"
	 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd">
	<credit>NOAA's National Weather Service</credit>
	<credit_URL>http://weather.gov/</credit_URL>
	<image>
		<url>http://weather.gov/images/xml_logo.gif</url>
		<title>NOAA's National Weather Service</title>
		<link>http://weather.gov</link>
	</image>
	<suggested_pickup>15 minutes after the hour</suggested_pickup>
	<suggested_pickup_period>60</suggested_pickup_period>
	<location>Unknown Station</location>
	<station_id>SH464</station_id>
	<observation_time>Last Updated on Oct 12 2014, 1:00 am EST</observation_time>
        <observation_time_rfc822>Sun, 12 Oct 2014 01:00:00 -0500</observation_time_rfc822>
	<temperature_string>48.0 F (8.9 C)</temperature_string>
	<temp_f>48.0</temp_f>
	<temp_c>8.9</temp_c>
	<water_temp_f>48.0</water_temp_f>
	<water_temp_c>8.9</water_temp_c>
	<wind_string>North at 5.8 MPH (5.05 KT)</wind_string>
	<wind_dir>North</wind_dir>
	<wind_degrees>0</wind_degrees>
	<wind_mph>5.8</wind_mph>
	<wind_gust_mph>0.0</wind_gust_mph>
	<wind_kt>5.05</wind_kt>
	<pressure_string>1021.0 mb</pressure_string>
	<pressure_mb>1021.0</pressure_mb>
	<pressure_tendency_mb>0.0</pressure_tendency_mb>
	<dewpoint_string>41.0 F (5.0 C)</dewpoint_string>
	<dewpoint_f>41.0</dewpoint_f>
	<dewpoint_c>5.0</dewpoint_c>
	<windchill_string>45 F (7 C)</windchill_string>
      	<windchill_f>45</windchill_f>
      	<windchill_c>7</windchill_c>
	<visibility_mi>11.00</visibility_mi>
	<dominant_period_sec>0</dominant_period_sec>
	<average_period_sec>0.0</average_period_sec>
	<mean_wave_dir>North</mean_wave_dir>
	<mean_wave_degrees>0</mean_wave_degrees>
	<disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>
	<copyright_url>http://weather.gov/disclaimer.html</copyright_url>
	<privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>
</current_observation>


text:
<?php

/**
 * @uses       Zend_Service_DeveloperGarden_Client_AbstractClient
 * @uses       Zend_Service_DeveloperGarden_LocalSearch_SearchParameters
 * @uses       Zend_Service_DeveloperGarden_Request_LocalSearch_LocalSearchRequest
 * @uses       Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponse
 * @uses       Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_LocalSearch
    extends Zend_Service_DeveloperGarden_Client_AbstractClient
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-localsearch/services/localsearch?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/localsearch.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'LocalSearchResponseType' => 'Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType'
    );

    /**
     * localSearch with the given parameters
     *
     * @param Zend_Service_DeveloperGarden_LocalSearch_SearchParameters $searchParameters
     * @param integer $account
     * @return Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType
     */
    public function localSearch(
        Zend_Service_DeveloperGarden_LocalSearch_SearchParameters $searchParameters,
        $account = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_LocalSearch_LocalSearchRequest(
            $this->getEnvironment(),
            $searchParameters,
            $account
        );

        $result = $this->getSoapClient()->localSearch($request);

        $response = new Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponse($result);
        return $response->parse();
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="favicon.png">

    <title>Syncing Ship 2.0</title>

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

    <link href="css/sticky-footer-navbar.css" rel="stylesheet">

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

            </button>
            Syncing Ship 2.0

Home

About

Contact

                Templates

Vital Signs

Glucose Monitor

Patient1

Not iAdmit

Demographics

Name

		                                    First Name
		                                    <input type="test" class="form-control" id="first_name" placeholder="Enter first Name">

		                                    Last Name
		                                    <input type="text" class="form-control" id="last_name" placeholder="Enter last name">

		                                Date of Birth
		                                <input type="date" class="form-control" id="dob" placeholder="mm/dd/yyyy" />

Glucose Monitor

		                        Date
		                        <input type="test" class="form-control" id="glucose_monitor_date" placeholder="mm/dd/yyyy">

		                        Time
		                        <input type="test" class="form-control" id="glucose_monitor_time" placeholder="Enter Time">

		                        Random
		                        <input type="test" class="form-control" id="glucose_monitor_random" placeholder="Enter Random Measurement">

		                        Breakfast
		                        <input type="test" class="form-control" id="glucose_monitor_breakfast" placeholder="Enter Breakfast Measurement">

		                        Lunch
		                        <input type="test" class="form-control" id="glucose_monitor_lunch" placeholder="Enter Lunch Measurement">

		                        Dinner
		                        <input type="test" class="form-control" id="glucose_monitor_dinner" placeholder="Enter Dinner Measurement">

		                        Bedtime
		                        <input type="test" class="form-control" id="glucose_monitor_bedtime" placeholder="Enter Bedtime Measurement">

		                        Comments
		                        <input type="test" class="form-control" id="glucose_monitor_comments" placeholder="Enter Comments">

Your data has been submitted!

Data submission failed!

<button id="submit" class="btn btn-primary">Submit</button>

Syncing Ship 2.0© copyright 2013 all rights reserved.


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="John-PC" name="com.qinjun.autotest.tstest.cases.DemoCase" tests="2" failures="0" timestamp="12 Aug 2018 07:02:35 GMT" time="3.669" errors="2">
  <testcase name="test" time="2.651" classname="com.qinjun.autotest.tstest.cases.DemoCase">
    <error type="java.lang.NullPointerException">
      <![CDATA[java.lang.NullPointerException
	at com.qinjun.autotest.tstest.so.DemoSO.sendRequest(DemoSO.java:38)
	at com.qinjun.autotest.tstest.cases.DemoCase.test(DemoCase.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:110)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
]]>
    </error>
  </testcase> <!-- test -->
  <testcase name="test" time="1.018" classname="com.qinjun.autotest.tstest.cases.DemoCase">
    <error type="java.lang.NullPointerException">
      <![CDATA[java.lang.NullPointerException
	at com.qinjun.autotest.tstest.so.DemoSO.sendRequest(DemoSO.java:38)
	at com.qinjun.autotest.tstest.cases.DemoCase.test(DemoCase.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:782)
	at org.testng.TestRunner.run(TestRunner.java:632)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.run(TestNG.java:1064)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:110)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
]]>
    </error>
  </testcase> <!-- test -->
</testsuite> <!-- com.qinjun.autotest.tstest.cases.DemoCase -->


text:
import { User } from '../auth/user';
import { DatabaseInfo } from '../core/database_info';
import { JsonProtoSerializer } from '../remote/serializer';
import { MutationQueue } from './mutation_queue';
import { Persistence } from './persistence';
import { PersistencePromise } from './persistence_promise';
import { QueryCache } from './query_cache';
import { RemoteDocumentCache } from './remote_document_cache';
import { SimpleDbTransaction } from './simple_db';
/**
 * An IndexedDB-backed instance of Persistence. Data is stored persistently
 * across sessions.
 *
 * Currently the Firestore SDK only supports a single consumer of the database,
 * but browsers obviously support multiple tabs. IndexedDbPersistence ensures a
 * single consumer of the database via an "owner lease" stored in the database.
 *
 * On startup, IndexedDbPersistence assigns itself a random "ownerId" and writes
 * it to a special "owner" object in the database (if no entry exists already or
 * the current entry is expired). This owner lease is then verified inside every
 * transaction to ensure the lease has not been lost.
 *
 * If a tab opts not to acquire the owner lease (because there's an existing
 * non-expired owner) or loses the owner lease, IndexedDbPersistence enters a
 * failed state and all subsequent operations will automatically fail.
 *
 * The current owner regularly refreshes the owner lease with new timestamps to
 * prevent newly-opened tabs from taking over ownership.
 *
 * Additionally there is an optimization so that when a tab is closed, the owner
 * lease is released immediately (this is especially important to make sure that
 * a refreshed tab is able to immediately re-acquire the owner lease).
 * Unfortunately, IndexedDB cannot be reliably used in window.unload since it is
 * an asynchronous API. So in addition to attempting to give up the lease,
 * the owner writes its ownerId to a "zombiedOwnerId" entry in LocalStorage
 * which acts as an indicator that another tab should go ahead and take the
 * owner lease immediately regardless of the current lease timestamp.
 */
export declare class IndexedDbPersistence implements Persistence {
    /**
     * The name of the main (and currently only) IndexedDB database. this name is
     * appended to the prefix provided to the IndexedDbPersistence constructor.
     */
    static MAIN_DATABASE: string;
    private simpleDb;
    private started;
    private dbName;
    private localStoragePrefix;
    private ownerId;
    /**
     * Set to an Error object if we encounter an unrecoverable error. All further
     * transactions will be failed with this error.
     */
    private persistenceError;
    /** The setInterval() handle tied to refreshing the owner lease. */
    private ownerLeaseRefreshHandle;
    /** Our window.unload handler, if registered. */
    private windowUnloadHandler;
    private serializer;
    constructor(prefix: string, serializer: JsonProtoSerializer);
    start(): Promise<void>;
    shutdown(): Promise<void>;
    getMutationQueue(user: User): MutationQueue;
    getQueryCache(): QueryCache;
    getRemoteDocumentCache(): RemoteDocumentCache;
    runTransaction<T>(action: string, operation: (transaction: SimpleDbTransaction) => PersistencePromise<T>): Promise<T>;
    static isAvailable(): boolean;
    /**
     * Generates a string used as a prefix when storing data in IndexedDB and
     * LocalStorage.
     */
    static buildStoragePrefix(databaseInfo: DatabaseInfo): string;
    /**
     * Acquires the owner lease if there's no valid owner. Else returns a rejected
     * promise.
     */
    private tryAcquireOwnerLease();
    /** Checks the owner lease and deletes it if we are the current owner. */
    private releaseOwnerLease();
    /**
     * Checks the owner lease and returns a rejected promise if we are not the
     * current owner. This should be included in every transaction to guard
     * against losing the owner lease.
     */
    private ensureOwnerLease(txn);
    /**
     * Returns true if the provided owner exists, has a recent timestamp, and
     * isn't zombied.
     *
     * NOTE: To determine if the owner is zombied, this method reads from
     * LocalStorage which could be mildly expensive.
     */
    private validOwner(dbOwner);
    /**
     * Schedules a recurring timer to update the owner lease timestamp to prevent
     * other tabs from taking the lease.
     */
    private scheduleOwnerLeaseRefreshes();
    private stopOwnerLeaseRefreshes();
    /**
     * Attaches a window.unload handler that will synchronously write our
     * ownerId to a "zombie owner id" location in localstorage. This can be used
     * by tabs trying to acquire the lease to determine that the lease should be
     * acquired immediately even if the timestamp is recent. This is particularly
     * important for the refresh case (so the tab correctly re-acquires the owner
     * lease). LocalStorage is used for this rather than IndexedDb because it is
     * a synchronous API and so can be used reliably from an unload handler.
     */
    private attachWindowUnloadHook();
    private detachWindowUnloadHook();
    /**
     * Returns any recorded "zombied owner" (i.e. a previous owner that became
     * zombied due to their tab closing) from LocalStorage, or null if no such
     * record exists.
     */
    private getZombiedOwnerId();
    /**
     * Records a zombied owner (an owner that had its tab closed) in LocalStorage
     * or, if passed null, deletes any recorded zombied owner.
     */
    private setZombiedOwnerId(zombieOwnerId);
    private zombiedOwnerLocalStorageKey();
    private generateOwnerId();
}


text:
/* @flow */
'use strict';

import React from 'react';
import {Switch} from 'react-native';
import NativeBaseComponent from '../Base/NativeBaseComponent';
import computeProps from '../../Utils/computeProps';

export default class SwitchNB extends NativeBaseComponent {

    getInitialStyle() {
        return {
            switch: {

            }
        }
    }
    prepareRootProps() {
        var defaultProps = {
            style: this.getInitialStyle().switch
        };

        return computeProps(this.props, defaultProps);
    }

    render() {
        return(
            <Switch {...this.prepareRootProps()}/>
        );
    }
}


text:
using UnityEngine;
using System.Collections;

public class ActionCameraMove : ActionBase
{
	public float Duration = 2;
	public Camera TargetCamera;

	public override void Activate (GameObject entity)
	{
		StartCoroutine(SlowMove());
	}

	IEnumerator SlowMove()
	{
		float normalTime = 0;
		Vector3 startPos = TargetCamera.transform.position;
		Quaternion startRot = TargetCamera.transform.rotation;
		while (normalTime < 1)
		{
			normalTime += Time.deltaTime / Duration;
			TargetCamera.transform.position = Vector3.Lerp(startPos,transform.position,Duration);
			TargetCamera.transform.rotation = Quaternion.Lerp(startRot,transform.rotation,Duration);
			yield return null;
		}
		TargetCamera.transform.position = transform.position;
		TargetCamera.transform.rotation = transform.rotation;
	}

	public override void OnDrawGizmos ()
	{
		base.OnDrawGizmos ();
		if (TargetCamera == null){return;}
		Gizmos.DrawLine(TargetCamera.transform.position,transform.position);
	}

	public void OnDrawGizmosSelected()
	{
		if (TargetCamera == null){return;}

		//destination
		Gizmos.color = new Color(1,1,1,0.3f);
		Gizmos.matrix = transform.localToWorldMatrix;
		Gizmos.DrawFrustum(transform.position,TargetCamera.fieldOfView,Mathf.Min(TargetCamera.farClipPlane,100),Mathf.Max(1,TargetCamera.nearClipPlane),TargetCamera.aspect);

		for (int i = 0; i<4; i++)
		{
			Gizmos.color = new Color(1,1,1,0.1f);
			var matrix = Utility.MatrixLerp(TargetCamera.transform.localToWorldMatrix,transform.localToWorldMatrix,i/4f);
			Gizmos.matrix = matrix;
			Gizmos.DrawFrustum(TargetCamera.transform.position,TargetCamera.fieldOfView,Mathf.Min(TargetCamera.farClipPlane,100),Mathf.Max(1,TargetCamera.nearClipPlane),TargetCamera.aspect);
		}
	}
}


text:
<?php

class fORMColumn
{
	// The following constants allow for nice looking callbacks to static methods
	const configureEmailColumn  = 'fORMColumn::configureEmailColumn';
	const configureLinkColumn   = 'fORMColumn::configureLinkColumn';
	const configureNumberColumn = 'fORMColumn::configureNumberColumn';
	const configureRandomColumn = 'fORMColumn::configureRandomColumn';
	const encodeNumberColumn    = 'fORMColumn::encodeNumberColumn';
	const inspect               = 'fORMColumn::inspect';
	const generate              = 'fORMColumn::generate';
	const objectifyNumber       = 'fORMColumn::objectifyNumber';
	const prepareLinkColumn     = 'fORMColumn::prepareLinkColumn';
	const prepareNumberColumn   = 'fORMColumn::prepareNumberColumn';
	const reflect               = 'fORMColumn::reflect';
	const reset                 = 'fORMColumn::reset';
	const setEmailColumn        = 'fORMColumn::setEmailColumn';
	const setRandomStrings      = 'fORMColumn::setRandomStrings';
	const validateEmailColumns  = 'fORMColumn::validateEmailColumns';
	const validateLinkColumns   = 'fORMColumn::validateLinkColumns';

	/**
	 * Columns that should be formatted as email addresses
	 *
	 * @var array
	 */
	static private $email_columns = array();

	/**
	 * Columns that should be formatted as links
	 *
	 * @var array
	 */
	static private $link_columns = array();

	/**
	 * Columns that should be returned as fNumber objects
	 *
	 * @var array
	 */
	static private $number_columns = array();

	/**
	 * Columns that should be formatted as a random string
	 *
	 * @var array
	 */
	static private $random_columns = array();

	/**
	 * Composes text using fText if loaded
	 *
	 * @param  string  $message    The message to compose
	 * @param  mixed   $component  A string or number to insert into the message
	 * @param  mixed   ...
	 * @return string  The composed and possible translated message
	 */
	static private function compose($message)
	{
		$args = array_slice(func_get_args(), 1);

		if (class_exists('fText', FALSE)) {
			return call_user_func_array(
				array('fText', 'compose'),
				array($message, $args)
			);
		} else {
			return vsprintf($message, $args);
		}
	}

	/**
	 * Sets a column to be formatted as an email address
	 *
	 * @param  mixed  $class   The class name or instance of the class to set the column format
	 * @param  string $column  The column to format as an email address
	 * @return void
	 */
	static public function configureEmailColumn($class, $column)
	{
		$class     = fORM::getClass($class);
		$table     = fORM::tablize($class);
		$schema    = fORMSchema::retrieve($class);
		$data_type = $schema->getColumnInfo($table, $column, 'type');

		$valid_data_types = array('varchar', 'char', 'text');
		if (!in_array($data_type, $valid_data_types)) {
			throw new fProgrammerException(
				'The column specified, %1$s, is a %2$s column. Must be one of %3$s to be set as an email column.',
				$column,
				$data_type,
				join(', ', $valid_data_types)
			);
		}

		fORM::registerActiveRecordMethod(
			$class,
			'set' . fGrammar::camelize($column, TRUE),
			self::setEmailColumn
		);

		if (!fORM::checkHookCallback($class, 'post::validate()', self::validateEmailColumns)) {
			fORM::registerHookCallback($class, 'post::validate()', self::validateEmailColumns);
		}

		fORM::registerInspectCallback($class, $column, self::inspect);

		if (empty(self::$email_columns[$class])) {
			self::$email_columns[$class] = array();
		}

		self::$email_columns[$class][$column] = TRUE;
	}

	/**
	 * Sets a column to be formatted as a link
	 *
	 * @param  mixed  $class   The class name or instance of the class to set the column format
	 * @param  string $column  The column to format as a link
	 * @return void
	 */
	static public function configureLinkColumn($class, $column)
	{
		$class     = fORM::getClass($class);
		$table     = fORM::tablize($class);
		$schema    = fORMSchema::retrieve($class);
		$data_type = $schema->getColumnInfo($table, $column, 'type');

		$valid_data_types = array('varchar', 'char', 'text');
		if (!in_array($data_type, $valid_data_types)) {
			throw new fProgrammerException(
				'The column specified, %1$s, is a %2$s column. Must be one of %3$s to be set as a link column.',
				$column,
				$data_type,
				join(', ', $valid_data_types)
			);
		}

		fORM::registerActiveRecordMethod(
			$class,
			'prepare' . fGrammar::camelize($column, TRUE),
			self::prepareLinkColumn
		);

		if (!fORM::checkHookCallback($class, 'post::validate()', self::validateLinkColumns)) {
			fORM::registerHookCallback($class, 'post::validate()', self::validateLinkColumns);
		}

		fORM::registerReflectCallback($class, self::reflect);
		fORM::registerInspectCallback($class, $column, self::inspect);

		if (empty(self::$link_columns[$class])) {
			self::$link_columns[$class] = array();
		}

		self::$link_columns[$class][$column] = TRUE;
	}

	/**
	 * Sets a column to be returned as an fNumber object from calls to `get{ColumnName}()`
	 *
	 * @param  mixed  $class   The class name or instance of the class to set the column format
	 * @param  string $column  The column to return as an fNumber object
	 * @return void
	 */
	static public function configureNumberColumn($class, $column)
	{
		$class     = fORM::getClass($class);
		$table     = fORM::tablize($class);
		$schema    = fORMSchema::retrieve($class);
		$data_type = $schema->getColumnInfo($table, $column, 'type');

		$valid_data_types = array('integer', 'float');
		if (!in_array($data_type, $valid_data_types)) {
			throw new fProgrammerException(
				'The column specified, %1$s, is a %2$s column. Must be %3$s to be set as a number column.',
				$column,
				$data_type,
				join(', ', $valid_data_types)
			);
		}

		$camelized_column = fGrammar::camelize($column, TRUE);

		fORM::registerActiveRecordMethod(
			$class,
			'encode' . $camelized_column,
			self::encodeNumberColumn
		);

		fORM::registerActiveRecordMethod(
			$class,
			'prepare' . $camelized_column,
			self::prepareNumberColumn
		);

		fORM::registerReflectCallback($class, self::reflect);
		fORM::registerInspectCallback($class, $column, self::inspect);
		fORM::registerObjectifyCallback($class, $column, self::objectifyNumber);

		if (empty(self::$number_columns[$class])) {
			self::$number_columns[$class] = array();
		}

		self::$number_columns[$class][$column] = TRUE;
	}

	/**
	 * Sets a column to be a random string column - a random string will be generated when the record is saved
	 *
	 * @param  mixed   $class   The class name or instance of the class
	 * @param  string  $column  The column to set as a random column
	 * @param  string  $type    The type of random string, must be one of: `'alphanumeric'`, `'alpha'`, `'numeric'`, `'hexadecimal'`
	 * @param  integer $length  The length of the random string
	 * @return void
	 */
	static public function configureRandomColumn($class, $column, $type, $length)
	{
		$class     = fORM::getClass($class);
		$table     = fORM::tablize($class);
		$schema    = fORMSchema::retrieve($class);
		$data_type = $schema->getColumnInfo($table, $column, 'type');

		$valid_data_types = array('varchar', 'char', 'text');
		if (!in_array($data_type, $valid_data_types)) {
			throw new fProgrammerException(
				'The column specified, %1$s, is a %2$s column. Must be one of %3$s to be set as a random string column.',
				$column,
				$data_type,
				join(', ', $valid_data_types)
			);
		}

		$valid_types = array('alphanumeric', 'alpha', 'numeric', 'hexadecimal');
		if (!in_array($type, $valid_types)) {
			throw new fProgrammerException(
				'The type specified, %1$s, is an invalid type. Must be one of: %2$s.',
				$type,
				join(', ', $valid_types)
			);
		}

		if (!is_numeric($length) || $length < 1) {
			throw new fProgrammerException(
				'The length specified, %s, needs to be an integer greater than zero.',
				$length
			);
		}

		fORM::registerActiveRecordMethod(
			$class,
			'generate' . fGrammar::camelize($column, TRUE),
			self::generate
		);

		if (!fORM::checkHookCallback($class, 'pre::validate()', self::setRandomStrings)) {
			fORM::registerHookCallback($class, 'pre::validate()', self::setRandomStrings);
		}

		fORM::registerInspectCallback($class, $column, self::inspect);

		if (empty(self::$random_columns[$class])) {
			self::$random_columns[$class] = array();
		}

		self::$random_columns[$class][$column] = array('type' => $type, 'length' => (int) $length);
	}

	/**
	 * Encodes a number column by calling fNumber::__toString()
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @param  string        $method_name      The method that was called
	 * @param  array         $parameters       The parameters passed to the method
	 * @return string  The encoded number
	 */
	static public function encodeNumberColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
	{
		list ($action, $subject) = fORM::parseMethod($method_name);

		$column      = fGrammar::underscorize($subject);
		$class       = get_class($object);
		$schema      = fORMSchema::retrieve($class);
		$table       = fORM::tablize($class);
		$column_info = $schema->getColumnInfo($table, $column);
		$value       = $values[$column];

		if ($value instanceof fNumber) {
			if ($column_info['type'] == 'float') {
				$decimal_places = (isset($parameters[0])) ? (int) $parameters[0] : $column_info['decimal_places'];
				$value = $value->trunc($decimal_places)->__toString();
			} else {
				$value = $value->__toString();
			}
		}

		return fHTML::prepare($value);
	}

	/**
	 * Generates a new random value for the column
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @param  string        $method_name       The method that was called
	 * @param  array         $parameters        The parameters passed to the method
	 * @return string  The newly generated random value
	 */
	static public function generate($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
	{
		list ($action, $subject) = fORM::parseMethod($method_name);

		$column = fGrammar::underscorize($subject);
		$class  = get_class($object);
		$table  = fORM::tablize($class);

		$schema = fORMSchema::retrieve($class);
		$db     = fORMDatabase::retrieve($class, 'read');

		$settings = self::$random_columns[$class][$column];

		// Check to see if this is a unique column
		$unique_keys      = $schema->getKeys($table, 'unique');
		$is_unique_column = FALSE;
		foreach ($unique_keys as $unique_key) {
			if ($unique_key == array($column)) {
				$is_unique_column = TRUE;
				$sql = "SELECT %r FROM %r WHERE %r = %s";
				do {
					$value = fCryptography::randomString($settings['length'], $settings['type']);
				} while ($db->query($sql, $column, $table, $column, $value)->countReturnedRows());
			}
		}

		// If is is not a unique column, just generate a value
		if (!$is_unique_column) {
			$value = fCryptography::randomString($settings['length'], $settings['type']);
		}

		fActiveRecord::assign($values, $old_values, $column, $value);

		return $value;
	}

	/**
	 * Adds metadata about features added by this class
	 *
	 * @internal
	 *
	 * @param  string $class      The class being inspected
	 * @param  string $column     The column being inspected
	 * @param  array  &$metadata  The array of metadata about a column
	 * @return void
	 */
	static public function inspect($class, $column, &$metadata)
	{
		if (!empty(self::$email_columns[$class][$column])) {
			$metadata['feature'] = 'email';
		}

		if (!empty(self::$link_columns[$class][$column])) {
			$metadata['feature'] = 'link';
		}

		if (!empty(self::$random_columns[$class][$column])) {
			$metadata['feature'] = 'random';
		}

		if (!empty(self::$number_columns[$class][$column])) {
			$metadata['feature'] = 'number';
		}
	}

	/**
	 * Turns a numeric value into an fNumber object
	 *
	 * @internal
	 *
	 * @param  string $class   The class this value is for
	 * @param  string $column  The column the value is in
	 * @param  mixed  $value   The value
	 * @return mixed  The fNumber object or raw value
	 */
	static public function objectifyNumber($class, $column, $value)
	{
		if ((!is_string($value) && !is_numeric($value) && !is_object($value)) || !strlen(trim($value))) {
			return $value;
		}

		try {
			return new fNumber($value);

		// If there was some error creating the number object, just return the raw value
		} catch (fExpectedException $e) {
			return $value;
		}
	}

	/**
	 * Prepares a link column so that the link will work properly in an `a` tag
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @param  string        $method_name       The method that was called
	 * @param  array         $parameters        The parameters passed to the method
	 * @return string  The formatted link
	 */
	static public function prepareLinkColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
	{
		list ($action, $subject) = fORM::parseMethod($method_name);

		$column = fGrammar::underscorize($subject);
		$value  = $values[$column];

		// Fix domains that don't have the protocol to start
		if (strlen($value) && !preg_match('#^https?://|^/#iD', $value)) {
			$value = 'http://' . $value;
		}

		$value = fHTML::prepare($value);

		if (isset($parameters[0]) && $parameters[0] === TRUE) {
			return '' . $value . '';
		}

		return $value;
	}

	/**
	 * Prepares a number column by calling fNumber::format()
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @param  string        $method_name       The method that was called
	 * @param  array         $parameters        The parameters passed to the method
	 * @return string  The formatted link
	 */
	static public function prepareNumberColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
	{
		list ($action, $subject) = fORM::parseMethod($method_name);

		$column      = fGrammar::underscorize($subject);
		$class       = get_class($object);
		$table       = fORM::tablize($class);
		$schema      = fORMSchema::retrieve($class);
		$column_info = $schema->getColumnInfo($table, $column);
		$value       = $values[$column];

		if ($value instanceof fNumber) {
			if ($column_info['type'] == 'float') {
				$decimal_places = (isset($parameters[0])) ? (int) $parameters[0] : $column_info['decimal_places'];
				if ($decimal_places !== NULL) {
					$value = $value->trunc($decimal_places)->format();
				} else {
					$value = $value->format();
				}
			} else {
				$value = $value->format();
			}
		}

		return fHTML::prepare($value);
	}

	/**
	 * Adjusts the fActiveRecord::reflect() signatures of columns that have been configured in this class
	 *
	 * @internal
	 *
	 * @param  string  $class                 The class to reflect
	 * @param  array   &$signatures           The associative array of `{method name} => {signature}`
	 * @param  boolean $include_doc_comments  If doc comments should be included with the signature
	 * @return void
	 */
	static public function reflect($class, &$signatures, $include_doc_comments)
	{

		if (isset(self::$link_columns[$class])) {
			foreach(self::$link_columns[$class] as $column => $enabled) {
				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Prepares the value of " . $column . " for output into HTML\n";
					$signature .= " * \n";
					$signature .= " * This method will ensure all links that start with a domain name are preceeded by http://\n";
					$signature .= " * \n";
					$signature .= " * @param  boolean \$create_link  Will cause link to be automatically converted into an [a] tag\n";
					$signature .= " * @return string  The HTML-ready value\n";
					$signature .= " */\n";
				}
				$prepare_method = 'prepare' . fGrammar::camelize($column, TRUE);
				$signature .= 'public function ' . $prepare_method . '($create_link=FALSE)';

				$signatures[$prepare_method] = $signature;
			}
		}

		if (isset(self::$number_columns[$class])) {

			$table  = fORM::tablize($class);
			$schema = fORMSchema::retrieve($class);

			foreach(self::$number_columns[$class] as $column => $enabled) {
				$camelized_column = fGrammar::camelize($column, TRUE);
				$type             = $schema->getColumnInfo($table, $column, 'type');

				// Get and set methods
				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Gets the current value of " . $column . "\n";
					$signature .= " * \n";
					$signature .= " * @return fNumber  The current value\n";
					$signature .= " */\n";
				}
				$get_method = 'get' . $camelized_column;
				$signature .= 'public function ' . $get_method . '()';

				$signatures[$get_method] = $signature;

				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Sets the value for " . $column . "\n";
					$signature .= " * \n";
					$signature .= " * @param  fNumber|string|integer \$" . $column . "  The new value - don't use floats since they are imprecise\n";
					$signature .= " * @return fActiveRecord  The record object, to allow for method chaining\n";
					$signature .= " */\n";
				}
				$set_method = 'set' . $camelized_column;
				$signature .= 'public function ' . $set_method . '($' . $column . ')';

				$signatures[$set_method] = $signature;

				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Encodes the value of " . $column . " for output into an HTML form\n";
					$signature .= " * \n";
					$signature .= " * If the value is an fNumber object, the ->__toString() method will be called\n";
					$signature .= " * resulting in the value without any thousands separators\n";
					$signature .= " * \n";
					if ($type == 'float') {
						$signature .= " * @param  integer \$decimal_places  The number of decimal places to display - not passing any value or passing NULL will result in the intrisinc number of decimal places being shown\n";
					}
					$signature .= " * @return string  The HTML form-ready value\n";
					$signature .= " */\n";
				}
				$encode_method = 'encode' . $camelized_column;
				$signature .= 'public function ' . $encode_method . '(';
				if ($type == 'float') {
					$signature .= '$decimal_places=NULL';
				}
				$signature .= ')';

				$signatures[$encode_method] = $signature;

				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Prepares the value of " . $column . " for output into HTML\n";
					$signature .= " * \n";
					$signature .= " * If the value is an fNumber object, the ->format() method will be called\n";
					$signature .= " * resulting in the value including thousands separators\n";
					$signature .= " * \n";
					if ($type == 'float') {
						$signature .= " * @param  integer \$decimal_places  The number of decimal places to display - not passing any value or passing NULL will result in the intrisinc number of decimal places being shown\n";
					}
					$signature .= " * @return string  The HTML-ready value\n";
					$signature .= " */\n";
				}
				$prepare_method = 'prepare' . $camelized_column;
				$signature .= 'public function ' . $prepare_method . '(';
				if ($type == 'float') {
					$signature .= '$decimal_places=NULL';
				}
				$signature .= ')';

				$signatures[$prepare_method] = $signature;
			}
		}

		if (isset(self::$random_columns[$class])) {
			foreach(self::$random_columns[$class] as $column => $settings) {
				$signature = '';
				if ($include_doc_comments) {
					$signature .= "/**\n";
					$signature .= " * Generates a new random " . $settings['type'] . " character " . $settings['type'] . " string for " . $column . "\n";
					$signature .= " * \n";
					$signature .= " * If there is a UNIQUE constraint on the column and the value is not unique it will be regenerated until unique\n";
					$signature .= " * \n";
					$signature .= " * @return string  The randomly generated string\n";
					$signature .= " */\n";
				}
				$generate_method = 'generate' . fGrammar::camelize($column, TRUE);
				$signature .= 'public function ' . $generate_method . '()';

				$signatures[$generate_method] = $signature;
			}
		}
	}

	/**
	 * Resets the configuration of the class
	 *
	 * @internal
	 *
	 * @return void
	 */
	static public function reset()
	{
		self::$email_columns  = array();
		self::$link_columns   = array();
		self::$number_columns = array();
		self::$random_columns = array();
	}

	/**
	 * Sets the value for an email column, trimming the value if it is a valid email
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @param  string        $method_name       The method that was called
	 * @param  array         $parameters        The parameters passed to the method
	 * @return fActiveRecord  The record object, to allow for method chaining
	 */
	static public function setEmailColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
	{
		list ($action, $subject) = fORM::parseMethod($method_name);

		$column = fGrammar::underscorize($subject);
		$class  = get_class($object);

		if (count($parameters) < 1) {
			throw new fProgrammerException(
				'The method, %s(), requires at least one parameter',
				$method_name
			);
		}

		$email = $parameters[0];
		if (preg_match('#^\s*[a-z0-9\\.\'_\\-\\+]+@(?:[a-z0-9\\-]+\.)+[a-z]{2,}\s*$#iD', $email)) {
			$email = trim($email);
		}

		if ($email === '') {
			$email = NULL;
		}

		fActiveRecord::assign($values, $old_values, $column, $email);

		return $object;
	}

	/**
	 * Sets the appropriate column values to a random string if the object is new
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object            The fActiveRecord instance
	 * @param  array         &$values           The current values
	 * @param  array         &$old_values       The old values
	 * @param  array         &$related_records  Any records related to this record
	 * @param  array         &$cache            The cache array for the record
	 * @return string  The formatted link
	 */
	static public function setRandomStrings($object, &$values, &$old_values, &$related_records, &$cache)
	{
		if ($object->exists()) {
			return;
		}

		$class = get_class($object);
		$table = fORM::tablize($class);

		foreach (self::$random_columns[$class] as $column => $settings) {
			if (fActiveRecord::hasOld($old_values, $column) && $values[$column]) {
				continue;
			}
			self::generate(
				$object,
				$values,
				$old_values,
				$related_records,
				$cache,
				'generate' . fGrammar::camelize($column, TRUE),
				array()
			);
		}
	}

	/**
	 * Validates all email columns
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object                The fActiveRecord instance
	 * @param  array         &$values               The current values
	 * @param  array         &$old_values           The old values
	 * @param  array         &$related_records      Any records related to this record
	 * @param  array         &$cache                The cache array for the record
	 * @param  array         &$validation_messages  An array of ordered validation messages
	 * @return void
	 */
	static public function validateEmailColumns($object, &$values, &$old_values, &$related_records, &$cache, &$validation_messages)
	{
		$class = get_class($object);

		if (empty(self::$email_columns[$class])) {
			return;
		}

		foreach (self::$email_columns[$class] as $column => $enabled) {
			if (!strlen($values[$column])) {
				continue;
			}
			if (!preg_match('#^[a-z0-9\\.\'_\\-\\+]+@(?:[a-z0-9\\-]+\.)+[a-z]{2,}$#iD', $values[$column])) {
				$validation_messages[$column] = self::compose(
					'%sPlease enter an email address in the form name@example.com',
					fValidationException::formatField(fORM::getColumnName($class, $column))
				);
			}
		}
	}

	/**
	 * Validates all link columns
	 *
	 * @internal
	 *
	 * @param  fActiveRecord $object                The fActiveRecord instance
	 * @param  array         &$values               The current values
	 * @param  array         &$old_values           The old values
	 * @param  array         &$related_records      Any records related to this record
	 * @param  array         &$cache                The cache array for the record
	 * @param  array         &$validation_messages  An array of ordered validation messages
	 * @return void
	 */
	static public function validateLinkColumns($object, &$values, &$old_values, &$related_records, &$cache, &$validation_messages)
	{
		$class = get_class($object);

		if (empty(self::$link_columns[$class])) {
			return;
		}

		foreach (self::$link_columns[$class] as $column => $enabled) {
			if (!is_string($values[$column])) {
				continue;
			}

			$ip_regex       = '(?:(?:[01]?\d?\d|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d?\d|2[0-4]\d|25[0-5])';
			$hostname_regex = '[a-z]+(?:[a-z0-9\-]*[a-z0-9]\.?|\.)*';
			$domain_regex   = '([a-z]+([a-z0-9\-]*[a-z0-9])?\.)+[a-z]{2,}';
			if (!preg_match('#^(https?://(' . $ip_regex . '|' . $hostname_regex . ')(?=/|$)|' . $domain_regex . '(?=/|$)|/)#i', $values[$column])) {
				$validation_messages[$column] = self::compose(
					'%sPlease enter a link in the form http://www.example.com',
					fValidationException::formatField(fORM::getColumnName($class, $column))
				);
			}
		}
	}

	/**
	 * Forces use as a static class
	 *
	 * @return fORMColumn
	 */
	private function __construct() { }
}

/**
 * Copyright (c) 2008-2011 Will Bond <will@flourishlib.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */


text:
from __future__ import print_function, absolute_import
from numpy.distutils.misc_util import Configuration
from os.path import join
from tt.distutils import get_extra_fflags

TTFORT_DIR = '../tt-fort/'
PRIMME_DIR = '../tt-fort/primme'

TTEIGB_SRC = [
    'ttals.f90',
    'tt_eigb.f90',
]

def configuration(parent_package='', top_path=None):
    tteigb_src = [join(TTFORT_DIR, x) for x in TTEIGB_SRC]
    tteigb_src.append('tt_eigb.pyf')

    config = Configuration('eigb', parent_package, top_path)
    config.add_library(
        'primme',
        sources=[join(PRIMME_DIR, '*.c')] + [join(PRIMME_DIR, '*.f')],
        include_dirs=['.'],
    )
    config.add_extension(
        'tt_eigb',
        sources=tteigb_src,
        depends=[
            'primme',
            'mytt',
            'print_lib',
        ],
        libraries=[
            'primme',
            'mytt',
            'print_lib',
        ],
        extra_f90_compile_args=get_extra_fflags(),
    )

    return config

if __name__ == '__main__':
    print('This is the wrong setup.py to run')


text:
import { Component, OnDestroy } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ComplaintService } from '../../../providers/complaint.service';
import { ComplaintComponent } from '../../complaint/complaint.component';
import { LoaderStop } from '../../../providers/loaderstop.service';
@Component({
  selector: 'for-me',
 templateUrl: './forme.html',
  styleUrls:['./../../complaint/complaint.component.css']
})

export class SuggestionForMe extends ComplaintComponent implements OnDestroy{
  public statusId:any;

  public statusName:any[] = ["","New","Assigned","Inprogress","Closed","Reopen","Satisfied"];
  constructor(public cs: ComplaintService,
    public ls : LoaderStop,
    public router: Router,
    public route: ActivatedRoute) {
    super(cs,ls,router,route);
    if(this.url == "/suggestion/for-me") this.url = "/suggestion";
    if(this.complaintStatus) this.url = "/suggestion/status/" + this.complaintStatus;
    this.route.params.subscribe(param => {
      this.statusId = param['statusId'];
    });
  }

  ngOnDestroy(){
    this.ls.setLoader(true);
  }
}


text:
/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
 */

struct inflate_blocks_state;
typedef struct inflate_blocks_state FAR inflate_blocks_statef;

extern inflate_blocks_statef *inflate_blocks_new OF((
            z_streamp z,
            check_func c,               /* check function */
            uInt w));                   /* window size */

extern int inflate_blocks OF((
                                 inflate_blocks_statef *,
                                 z_streamp ,
                                 int));                      /* initial return code */

extern void inflate_blocks_reset OF((
                                        inflate_blocks_statef *,
                                        z_streamp ,
                                        uLongf *));                  /* check value on output */

extern int inflate_blocks_free OF((
                                      inflate_blocks_statef *,
                                      z_streamp));

extern void inflate_set_dictionary OF((
        inflate_blocks_statef *s,
        const Bytef *d,  /* dictionary */
        uInt  n));       /* dictionary length */

extern int inflate_blocks_sync_point OF((
        inflate_blocks_statef *s));


text:
module Spree
  class PropertyCategoryRequest
    def initialize(params, product)
      @params = params
      @product = product
    end

    def properties
      properties = []
      @params.values.each do |category|
        next unless category[:properties]
        category[:properties].values.each_with_index do |pp, i|
          next if pp[:key].blank?
          display = (pp[:display] == "1" ? true : false)
          measurement = pp[:measurement].blank? ? nil : pp[:measurement]
          property = {
            product: @product,
            property_name: pp[:key],
            value: pp[:value],
            display: display,
            position: i,
            measurement_unit: measurement
          }

          if category[:name].present?
            property.merge!({
              product_property_category_attributes: {
                position: category[:position],
                property_category_attributes: {
                  name: category[:name]
                }
              }
            })
          end
          properties << property
        end
      end
      properties
    end
  end
end


text:
package org.hibernate.example.compositeid;

/**
 * Subclass of the persistent entity @{link EntityWithCompositeId}.
 */
public class SubclassWithCompositeId extends EntityWithCompositeId {
}