text:
/**
 * @module ol/proj
 */
import {getDistance} from './sphere.js';
import {applyTransform} from './extent.js';
import {modulo} from './math.js';
import EPSG3857 from './proj/EPSG3857.js';
import EPSG4326 from './proj/EPSG4326.js';
import Projection from './proj/Projection.js';
import Units from './proj/Units.js';
import * as projections from './proj/projections.js';
import {add as addTransformFunc, clear as clearTransformFuncs, get as getTransformFunc} from './proj/transforms.js';

/**
 * Meters per unit lookup table.
 * @const
 * @type {Object.<ol.proj.Units, number>}
 * @api
 */
export const METERS_PER_UNIT = Units.METERS_PER_UNIT;

/**
 * @param {Array.<number>} input Input coordinate array.
 * @param {Array.<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension.
 * @return {Array.<number>} Output coordinate array (new array, same coordinate
 *     values).
 */
export function cloneTransform(input, opt_output, opt_dimension) {
  let output;
  if (opt_output !== undefined) {
    for (let i = 0, ii = input.length; i < ii; ++i) {
      opt_output[i] = input[i];
    }
    output = opt_output;
  } else {
    output = input.slice();
  }
  return output;
}

/**
 * @param {Array.<number>} input Input coordinate array.
 * @param {Array.<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension.
 * @return {Array.<number>} Input coordinate array (same array as input).
 */
export function identityTransform(input, opt_output, opt_dimension) {
  if (opt_output !== undefined && input !== opt_output) {
    for (let i = 0, ii = input.length; i < ii; ++i) {
      opt_output[i] = input[i];
    }
    input = opt_output;
  }
  return input;
}

/**
 * Add a Projection object to the list of supported projections that can be
 * looked up by their code.
 *
 * @param {ol.proj.Projection} projection Projection instance.
 * @api
 */
export function addProjection(projection) {
  projections.add(projection.getCode(), projection);
  addTransformFunc(projection, projection, cloneTransform);
}

/**
 * @param {Array.<ol.proj.Projection>} projections Projections.
 */
export function addProjections(projections) {
  projections.forEach(addProjection);
}

/**
 * Fetches a Projection object for the code specified.
 *
 * @param {ol.ProjectionLike} projectionLike Either a code string which is
 *     a combination of authority and identifier such as "EPSG:4326", or an
 *     existing projection object, or undefined.
 * @return {ol.proj.Projection} Projection object, or null if not in list.
 * @api
 */
export function get(projectionLike) {
  let projection = null;
  if (projectionLike instanceof Projection) {
    projection = projectionLike;
  } else if (typeof projectionLike === 'string') {
    const code = projectionLike;
    projection = projections.get(code);
  }
  return projection;
}

/**
 * Get the resolution of the point in degrees or distance units.
 * For projections with degrees as the unit this will simply return the
 * provided resolution. For other projections the point resolution is
 * by default estimated by transforming the 'point' pixel to EPSG:4326,
 * measuring its width and height on the normal sphere,
 * and taking the average of the width and height.
 * A custom function can be provided for a specific projection, either
 * by setting the `getPointResolution` option in the
 * {@link ol.proj.Projection} constructor or by using
 * {@link ol.proj.Projection#setGetPointResolution} to change an existing
 * projection object.
 * @param {ol.ProjectionLike} projection The projection.
 * @param {number} resolution Nominal resolution in projection units.
 * @param {ol.Coordinate} point Point to find adjusted resolution at.
 * @param {ol.proj.Units=} opt_units Units to get the point resolution in.
 * Default is the projection's units.
 * @return {number} Point resolution.
 * @api
 */
export function getPointResolution(projection, resolution, point, opt_units) {
  projection = get(projection);
  let pointResolution;
  const getter = projection.getPointResolutionFunc();
  if (getter) {
    pointResolution = getter(resolution, point);
  } else {
    const units = projection.getUnits();
    if (units == Units.DEGREES && !opt_units || opt_units == Units.DEGREES) {
      pointResolution = resolution;
    } else {
      // Estimate point resolution by transforming the center pixel to EPSG:4326,
      // measuring its width and height on the normal sphere, and taking the
      // average of the width and height.
      const toEPSG4326 = getTransformFromProjections(projection, get('EPSG:4326'));
      let vertices = [
        point[0] - resolution / 2, point[1],
        point[0] + resolution / 2, point[1],
        point[0], point[1] - resolution / 2,
        point[0], point[1] + resolution / 2
      ];
      vertices = toEPSG4326(vertices, vertices, 2);
      const width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));
      const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));
      pointResolution = (width + height) / 2;
      const metersPerUnit = opt_units ?
        Units.METERS_PER_UNIT[opt_units] :
        projection.getMetersPerUnit();
      if (metersPerUnit !== undefined) {
        pointResolution /= metersPerUnit;
      }
    }
  }
  return pointResolution;
}

/**
 * Registers transformation functions that don't alter coordinates. Those allow
 * to transform between projections with equal meaning.
 *
 * @param {Array.<ol.proj.Projection>} projections Projections.
 * @api
 */
export function addEquivalentProjections(projections) {
  addProjections(projections);
  projections.forEach(function(source) {
    projections.forEach(function(destination) {
      if (source !== destination) {
        addTransformFunc(source, destination, cloneTransform);
      }
    });
  });
}

/**
 * Registers transformation functions to convert coordinates in any projection
 * in projection1 to any projection in projection2.
 *
 * @param {Array.<ol.proj.Projection>} projections1 Projections with equal
 *     meaning.
 * @param {Array.<ol.proj.Projection>} projections2 Projections with equal
 *     meaning.
 * @param {ol.TransformFunction} forwardTransform Transformation from any
 *   projection in projection1 to any projection in projection2.
 * @param {ol.TransformFunction} inverseTransform Transform from any projection
 *   in projection2 to any projection in projection1..
 */
export function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {
  projections1.forEach(function(projection1) {
    projections2.forEach(function(projection2) {
      addTransformFunc(projection1, projection2, forwardTransform);
      addTransformFunc(projection2, projection1, inverseTransform);
    });
  });
}

/**
 * Clear all cached projections and transforms.
 */
export function clearAllProjections() {
  projections.clear();
  clearTransformFuncs();
}

/**
 * @param {ol.proj.Projection|string|undefined} projection Projection.
 * @param {string} defaultCode Default code.
 * @return {ol.proj.Projection} Projection.
 */
export function createProjection(projection, defaultCode) {
  if (!projection) {
    return get(defaultCode);
  } else if (typeof projection === 'string') {
    return get(projection);
  } else {
    return /** @type {ol.proj.Projection} */ (projection);
  }
}

/**
 * Creates a {@link ol.TransformFunction} from a simple 2D coordinate transform
 * function.
 * @param {function(ol.Coordinate): ol.Coordinate} coordTransform Coordinate
 *     transform.
 * @return {ol.TransformFunction} Transform function.
 */
export function createTransformFromCoordinateTransform(coordTransform) {
  return (
    /**
     * @param {Array.<number>} input Input.
     * @param {Array.<number>=} opt_output Output.
     * @param {number=} opt_dimension Dimension.
     * @return {Array.<number>} Output.
     */
    function(input, opt_output, opt_dimension) {
      const length = input.length;
      const dimension = opt_dimension !== undefined ? opt_dimension : 2;
      const output = opt_output !== undefined ? opt_output : new Array(length);
      let point, i, j;
      for (i = 0; i < length; i += dimension) {
        point = coordTransform([input[i], input[i + 1]]);
        output[i] = point[0];
        output[i + 1] = point[1];
        for (j = dimension - 1; j >= 2; --j) {
          output[i + j] = input[i + j];
        }
      }
      return output;
    });
}

/**
 * Registers coordinate transform functions to convert coordinates between the
 * source projection and the destination projection.
 * The forward and inverse functions convert coordinate pairs; this function
 * converts these into the functions used internally which also handle
 * extents and coordinate arrays.
 *
 * @param {ol.ProjectionLike} source Source projection.
 * @param {ol.ProjectionLike} destination Destination projection.
 * @param {function(ol.Coordinate): ol.Coordinate} forward The forward transform
 *     function (that is, from the source projection to the destination
 *     projection) that takes a {@link ol.Coordinate} as argument and returns
 *     the transformed {@link ol.Coordinate}.
 * @param {function(ol.Coordinate): ol.Coordinate} inverse The inverse transform
 *     function (that is, from the destination projection to the source
 *     projection) that takes a {@link ol.Coordinate} as argument and returns
 *     the transformed {@link ol.Coordinate}.
 * @api
 */
export function addCoordinateTransforms(source, destination, forward, inverse) {
  const sourceProj = get(source);
  const destProj = get(destination);
  addTransformFunc(sourceProj, destProj, createTransformFromCoordinateTransform(forward));
  addTransformFunc(destProj, sourceProj, createTransformFromCoordinateTransform(inverse));
}

/**
 * Transforms a coordinate from longitude/latitude to a different projection.
 * @param {ol.Coordinate} coordinate Coordinate as longitude and latitude, i.e.
 *     an array with longitude as 1st and latitude as 2nd element.
 * @param {ol.ProjectionLike=} opt_projection Target projection. The
 *     default is Web Mercator, i.e. 'EPSG:3857'.
 * @return {ol.Coordinate} Coordinate projected to the target projection.
 * @api
 */
export function fromLonLat(coordinate, opt_projection) {
  return transform(coordinate, 'EPSG:4326',
    opt_projection !== undefined ? opt_projection : 'EPSG:3857');
}

/**
 * Transforms a coordinate to longitude/latitude.
 * @param {ol.Coordinate} coordinate Projected coordinate.
 * @param {ol.ProjectionLike=} opt_projection Projection of the coordinate.
 *     The default is Web Mercator, i.e. 'EPSG:3857'.
 * @return {ol.Coordinate} Coordinate as longitude and latitude, i.e. an array
 *     with longitude as 1st and latitude as 2nd element.
 * @api
 */
export function toLonLat(coordinate, opt_projection) {
  const lonLat = transform(coordinate,
    opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326');
  const lon = lonLat[0];
  if (lon < -180 || lon > 180) {
    lonLat[0] = modulo(lon + 180, 360) - 180;
  }
  return lonLat;
}

/**
 * Checks if two projections are the same, that is every coordinate in one
 * projection does represent the same geographic point as the same coordinate in
 * the other projection.
 *
 * @param {ol.proj.Projection} projection1 Projection 1.
 * @param {ol.proj.Projection} projection2 Projection 2.
 * @return {boolean} Equivalent.
 * @api
 */
export function equivalent(projection1, projection2) {
  if (projection1 === projection2) {
    return true;
  }
  const equalUnits = projection1.getUnits() === projection2.getUnits();
  if (projection1.getCode() === projection2.getCode()) {
    return equalUnits;
  } else {
    const transformFunc = getTransformFromProjections(projection1, projection2);
    return transformFunc === cloneTransform && equalUnits;
  }
}

/**
 * Searches in the list of transform functions for the function for converting
 * coordinates from the source projection to the destination projection.
 *
 * @param {ol.proj.Projection} sourceProjection Source Projection object.
 * @param {ol.proj.Projection} destinationProjection Destination Projection
 *     object.
 * @return {ol.TransformFunction} Transform function.
 */
export function getTransformFromProjections(sourceProjection, destinationProjection) {
  const sourceCode = sourceProjection.getCode();
  const destinationCode = destinationProjection.getCode();
  let transformFunc = getTransformFunc(sourceCode, destinationCode);
  if (!transformFunc) {
    transformFunc = identityTransform;
  }
  return transformFunc;
}

/**
 * Given the projection-like objects, searches for a transformation
 * function to convert a coordinates array from the source projection to the
 * destination projection.
 *
 * @param {ol.ProjectionLike} source Source.
 * @param {ol.ProjectionLike} destination Destination.
 * @return {ol.TransformFunction} Transform function.
 * @api
 */
export function getTransform(source, destination) {
  const sourceProjection = get(source);
  const destinationProjection = get(destination);
  return getTransformFromProjections(sourceProjection, destinationProjection);
}

/**
 * Transforms a coordinate from source projection to destination projection.
 * This returns a new coordinate (and does not modify the original).
 *
 * See {@link ol.proj.transformExtent} for extent transformation.
 * See the transform method of {@link ol.geom.Geometry} and its subclasses for
 * geometry transforms.
 *
 * @param {ol.Coordinate} coordinate Coordinate.
 * @param {ol.ProjectionLike} source Source projection-like.
 * @param {ol.ProjectionLike} destination Destination projection-like.
 * @return {ol.Coordinate} Coordinate.
 * @api
 */
export function transform(coordinate, source, destination) {
  const transformFunc = getTransform(source, destination);
  return transformFunc(coordinate, undefined, coordinate.length);
}

/**
 * Transforms an extent from source projection to destination projection.  This
 * returns a new extent (and does not modify the original).
 *
 * @param {ol.Extent} extent The extent to transform.
 * @param {ol.ProjectionLike} source Source projection-like.
 * @param {ol.ProjectionLike} destination Destination projection-like.
 * @return {ol.Extent} The transformed extent.
 * @api
 */
export function transformExtent(extent, source, destination) {
  const transformFunc = getTransform(source, destination);
  return applyTransform(extent, transformFunc);
}

/**
 * Transforms the given point to the destination projection.
 *
 * @param {ol.Coordinate} point Point.
 * @param {ol.proj.Projection} sourceProjection Source projection.
 * @param {ol.proj.Projection} destinationProjection Destination projection.
 * @return {ol.Coordinate} Point.
 */
export function transformWithProjections(point, sourceProjection, destinationProjection) {
  const transformFunc = getTransformFromProjections(sourceProjection, destinationProjection);
  return transformFunc(point);
}

/**
 * Add transforms to and from EPSG:4326 and EPSG:3857.  This function is called
 * by when this module is executed and should only need to be called again after
 * `clearAllProjections()` is called (e.g. in tests).
 */
export function addCommon() {
  // Add transformations that don't alter coordinates to convert within set of
  // projections with equal meaning.
  addEquivalentProjections(EPSG3857.PROJECTIONS);
  addEquivalentProjections(EPSG4326.PROJECTIONS);
  // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
  // coordinates and back.
  addEquivalentTransforms(
    EPSG4326.PROJECTIONS,
    EPSG3857.PROJECTIONS,
    EPSG3857.fromEPSG4326,
    EPSG3857.toEPSG4326);
}

addCommon();


text:
Ext.define('SlateAdminTheme.override.app.Application', {
    override: 'Ext.app.Application',

    onBeforeLaunch: function() {
        Ext.setGlyphFontFamily('FontAwesome');
        this.callParent(arguments);
    }
});

redpajama_set_name: RedPajamaGithub


text:
class TemporaryFile
{
public:
  TemporaryFile();
  TemporaryFile(std::string const & namePrefix, std::string const & nameSuffix);

  TemporaryFile(TemporaryFile const &) = delete;
  TemporaryFile & operator=(TemporaryFile const &) = delete;

  ~TemporaryFile();

  std::string const & GetFilePath() const
  {
    return m_filePath;
  }

  void WriteData(std::string const & data);

private:
  std::string m_filePath;
};


text:
<?php

namespace MwBundle\Service;

use AppBundle\Filter\FilterInterface;
use Knp\Component\Pager\Pagination\PaginationInterface;
use MwBundle\Entity\Doorverwijzing;

interface DoorverwijzingDaoInterface
{
    /**
     * @param int             $page
     * @param FilterInterface $filter
     *
     * @return PaginationInterface
     */
    public function findAll($page = null, FilterInterface $filter = null);

    /**
     * @param int $id
     *
     * @return Doorverwijzing
     */
    public function find($id);

    /**
     * @param Doorverwijzing $entity
     */
    public function create(Doorverwijzing $entity);

    /**
     * @param Doorverwijzing $entity
     */
    public function update(Doorverwijzing $entity);
}


text:
package com.ppdai.mobi.publish.controller;

import com.ppdai.mobi.publish.config.WebAppConfigurer;
import com.ppdai.mobi.publish.entity.App;
import com.ppdai.mobi.publish.entity.ErrorHandler;
import com.ppdai.mobi.publish.entity.Info;
import com.ppdai.mobi.publish.repository.AppRepository;
import com.ppdai.mobi.publish.repository.InfoRepository;
import com.ppdai.mobi.publish.service.StorageService;
import com.ppdai.mobi.publish.utils.IPAUtils;
import freemarker.cache.URLTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.time.LocalDate;
import java.util.*;

@RestController
@RequestMapping(value = "apps")
public class AppsController {

    @Autowired
    private InfoRepository infoRepository;
    @Autowired
    private AppRepository appRepository;

    private final StorageService storageService;

    @Autowired
    private ResourceLoader resourceLoader;

    @Autowired
    private Configuration freemarkerConfig;

    @Autowired
    public AppsController(StorageService storageService) {
        this.storageService = storageService;
        File fp = new File(WebAppConfigurer.storagePath);
        if (!fp.exists()) {
            fp.mkdirs();
        }
    }

    @GetMapping("/files/{filename:.+}")
    @ResponseBody
    public ResponseEntity<?> serveFile(@PathVariable String filename) {
        Resource resource = storageService.loadAsResource(filename);
        if (filename.endsWith(".png")) {
            return ResponseEntity
                    .ok()
                    .body(resource);
        } else {
            return ResponseEntity
                    .ok()
                    .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename)
                    .body(resource);
        }
    }

    @RequestMapping(value = "")
    public List<Info> findAll(@RequestParam(value = "platform", defaultValue = "ios") String platform,
                              @RequestParam(value = "bundleID", defaultValue = "") String bundleID,
                              HttpServletRequest request) {
        List<Info> infos = infoRepository.findAll();
        mapIconAndUrlForInfo(infos, request);
        return infos;
    }

    @RequestMapping(value = "/{platform}/{page}")
    public List<App> appsOfPlatformWithPage(@PathVariable("platform") String platform,
                                            @PathVariable(value = "page", required = false) int page,
                                            HttpServletRequest request) {
        Pageable pageable = new PageRequest(page, 5);
        List<App> apps = appRepository.findByPlatform(platform, pageable);
        mapIconAndUrlForApp(apps, request);
        return apps;
    }

    @RequestMapping(value = "/{platform}/{bundleId:.+}/{page}")
    public List<Info> infoOfPlatformAndBundleIdWithPage(@PathVariable("platform") String platform,
                                                        @PathVariable("bundleId") String bundleId,
                                                        @PathVariable(value = "page", required = false) int page,
                                                        HttpServletRequest request) {
        Pageable pageable = new PageRequest(page, 5);
        List<Info> infos = infoRepository.findInfoByPlatformAndBundleIdOrderByUploadTimeDesc(platform, bundleId, pageable);
        mapIconAndUrlForInfo(infos, request);
        return infos;
    }

    @RequestMapping(value = "/plist/{guid}")
    public void infoOfGuid(@PathVariable("guid") String guid, HttpServletRequest request, HttpServletResponse response) {
        Info info = infoRepository.findInfoByGuid(guid);
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("guid", info.getGuid());
        model.put("name", info.getName());
        model.put("bundleID", info.getBundleId());
        model.put("version", info.getVersion());
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/apps/files";
        model.put("basePath", basePath);

        Resource resource = new ClassPathResource("template.plist");

        freemarkerConfig.setTemplateLoader(new URLTemplateLoader() {
            @Override
            protected URL getURL(String s) {
                try {
                    return resource.getURL();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
        try {
            Template template = freemarkerConfig.getTemplate("template.plist");
            String content = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
            response.getWriter().write(content);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TemplateException e) {
            e.printStackTrace();
        }
    }

    @RequestMapping(value = "upload", method = RequestMethod.POST)
    public Info upload(@RequestParam("package") MultipartFile file,
                       @RequestParam("changelog") String changelog) {
        if (!file.isEmpty()) {
            //存储文件
            String originalFilename = file.getOriginalFilename();
            String filePath = WebAppConfigurer.storagePath;
            File targetFile = new File(filePath + originalFilename);

            try {
                FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
                BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
                bufferedOutputStream.write(file.getBytes());
                bufferedOutputStream.flush();
                bufferedOutputStream.close();
                fileOutputStream.flush();
                fileOutputStream.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            //转换app并插入到数据库
            Info info = parseAppAndInsertToDb(targetFile, changelog);
            //修改名称
            storeApp(targetFile, info.getGuid());
            return info;
        }
        return null;
    }

    public Info parseAppAndInsertToDb(File file, String changelog) {
        String guid = UUID.randomUUID().toString();
        Info info = null;
        if (file.getAbsolutePath().endsWith(".ipa")) {
            //从ipa包中获取包信息
            info = parseIpa(file);
            //解压icon文件
            extractIpaIcon(file, guid);
        } else if (file.getAbsolutePath().endsWith("apk")) {
            //TODO:android
            info = parseApk(file);
        }

        if (info != null) {
            info.setGuid(guid);
            info.setChangelog(changelog);
            info.setUploadTime(new Date());
            return infoRepository.save(info);
        }
        return null;

    }

    private Info parseIpa(File file) {
        try {
            Map<String, String> map = IPAUtils.getIpaInfoMap(file);
            Info info = new Info();
            info.setPlatform("ios");
            info.setBuild(map.get("CFBundleVersion"));
            info.setBundleId(map.get("CFBundleIdentifier"));
            info.setVersion(map.get("CFBundleShortVersionString"));
            info.setName(map.get("CFBundleName"));
            return info;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

    private Info parseApk(File file) {

        return null;
    }

    private void storeApp(File file, String guid) {
        String end = file.getName().substring(file.getName().lastIndexOf("."));
        file.renameTo(new File(file.getParent() + "/" + guid + end));
    }

    private void extractIpaIcon(File file, String guid) {
        try {
            IPAUtils.extractIpaIcon(file, WebAppConfigurer.storagePath, guid);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void mapIconAndUrlForInfo(List<Info> infos, HttpServletRequest request) {
        for (Info info:infos) {
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/apps/";
            info.setIcon(basePath + "files/" + info.getGuid() + ".png");
            info.setUrl("itms-services://?action=download-manifest&url=" + basePath + "plist/" + info.getGuid());
        }
    }

    private void mapIconAndUrlForApp(List<App> apps, HttpServletRequest request) {
        for (App app:apps) {
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/apps/";
            app.setIcon(basePath + "files/" + app.getGuid() + ".png");
            app.setUrl("itms-services://?action=download-manifest&url=" + basePath + "plist/" + app.getGuid());
        }
    }

    public ErrorHandler errorHandler(String error) {
        return new ErrorHandler(error);
    }

}


text:
namespace VSPackageInstaller.Cache
{
    using System;

    internal interface IExtensionDataItemView
    {
        Guid ExtensionId { get; }

        String Title { get; }

        String Description { get; }

        String Version { get; }

        String Author { get; }

        String Link { get; }

        String Installer { get; }

        String VsixId { get; }
    }
}


text:
<?php /* Smarty version Smarty-3.1.19, created on 2016-06-02 18:22:56
         compiled from "/Applications/MAMP/htdocs/victor_espinet/prestashop/admin312fiugpn/themes/default/template/controllers/products/prices.tpl" */ ?>
<?php /*%%SmartyHeaderCode:5506505957505d604957c1-90037025%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' =>
  array (
    'cb70f9813ee02489311e9ae75d3b26270f1e4e6e' =>
    array (
      0 => '/Applications/MAMP/htdocs/victor_espinet/prestashop/admin312fiugpn/themes/default/template/controllers/products/prices.tpl',
      1 => 1452091828,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '5506505957505d604957c1-90037025',
  'function' =>
  array (
  ),
  'variables' =>
  array (
    'link' => 0,
    'ecotax_tax_excl' => 0,
    'country_display_tax_label' => 0,
    'tax_exclude_taxe_option' => 0,
    'currency' => 0,
    'product' => 0,
    'priceDisplayPrecisionFormat' => 0,
    'pack' => 0,
    'taxesRatesByGroup' => 0,
    'tax_by_group' => 0,
    'ecotaxTaxRate' => 0,
    'tax_rules_groups' => 0,
    'tax_rules_group' => 0,
    'ps_use_ecotax' => 0,
    'unit_price' => 0,
    'ps_tax' => 0,
    'specificPriceModificationForm' => 0,
    'combinations' => 0,
    'combination' => 0,
    'multi_shop' => 0,
    'admin_one_shop' => 0,
    'shops' => 0,
    'shop' => 0,
    'currencies' => 0,
    'curr' => 0,
    'countries' => 0,
    'country' => 0,
    'groups' => 0,
    'group' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.19',
  'unifunc' => 'content_57505d60a71391_50672210',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_57505d60a71391_50672210')) {function content_57505d60a71391_50672210($_smarty_tpl) {?>

<?php $_smarty_tpl->_capture_stack[0][] = array('default', 'priceDisplayPrecisionFormat', null); ob_start(); ?><?php echo (('%.').(@constant('_PS_PRICE_DISPLAY_PRECISION_'))).('f');?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>

	<input type="hidden" name="submitted_tabs[]" value="Prices" />

<?php echo smartyTranslate(array('s'=>'Product price'),$_smarty_tpl);?>

	<div class="alert alert-info" <?php if (!$_smarty_tpl->tpl_vars['country_display_tax_label']->value||$_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?>style="display:none;"<?php }?>>
		<?php echo smartyTranslate(array('s'=>'You must enter either the pre-tax retail price, or the retail price with tax. The input field will be automatically calculated.'),$_smarty_tpl);?>

	<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/check_fields.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_tab'=>"Prices"), 0);?>

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"wholesale_price",'type'=>"default"), 0);?>

			<span class="label-tooltip" data-toggle="tooltip" title="<?php echo smartyTranslate(array('s'=>'The wholesale price is the price you paid for the product. Do not include the tax.'),$_smarty_tpl);?>
"><?php if (!$_smarty_tpl->tpl_vars['country_display_tax_label']->value||$_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?><?php echo smartyTranslate(array('s'=>'Wholesale price'),$_smarty_tpl);?>
<?php } else { ?><?php echo smartyTranslate(array('s'=>'Pre-tax wholesale price'),$_smarty_tpl);?>
<?php }?>

				<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

				<input maxlength="27" name="wholesale_price" id="wholesale_price" type="text" value="<?php ob_start();?><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['toolsConvertPrice'][0][0]->toolsConvertPrice(array('price'=>$_smarty_tpl->tpl_vars['product']->value->wholesale_price),$_smarty_tpl);?>
<?php $_tmp1=ob_get_clean();?><?php echo sprintf($_smarty_tpl->tpl_vars['priceDisplayPrecisionFormat']->value,$_tmp1);?>
" onchange="this.value = this.value.replace(/,/g, '.');" />

			<?php if (isset($_smarty_tpl->tpl_vars['pack']->value)&&$_smarty_tpl->tpl_vars['pack']->value->isPack($_smarty_tpl->tpl_vars['product']->value->id)) {?>
<?php ob_start();?><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['toolsConvertPrice'][0][0]->toolsConvertPrice(array('price'=>sprintf($_smarty_tpl->tpl_vars['priceDisplayPrecisionFormat']->value,$_smarty_tpl->tpl_vars['pack']->value->noPackWholesalePrice($_smarty_tpl->tpl_vars['product']->value->id))),$_smarty_tpl);?>
<?php $_tmp2=ob_get_clean();?><?php echo smartyTranslate(array('s'=>'The sum of wholesale prices of the products in the pack is %s%s%s','sprintf'=>array($_smarty_tpl->tpl_vars['currency']->value->prefix,$_tmp2,$_smarty_tpl->tpl_vars['currency']->value->suffix)),$_smarty_tpl);?>

<?php }?>

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"price",'type'=>"price"), 0);?>

			<span class="label-tooltip" data-toggle="tooltip" title="<?php echo smartyTranslate(array('s'=>'The pre-tax retail price is the price for which you intend sell this product to your customers. It should be higher than the pre-tax wholesale price: the difference between the two will be your margin.'),$_smarty_tpl);?>
"><?php if (!$_smarty_tpl->tpl_vars['country_display_tax_label']->value||$_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?><?php echo smartyTranslate(array('s'=>'Retail price'),$_smarty_tpl);?>
<?php } else { ?><?php echo smartyTranslate(array('s'=>'Pre-tax retail price'),$_smarty_tpl);?>
<?php }?>

				<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

				<input type="hidden" id="priceTEReal" name="price" value="<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['toolsConvertPrice'][0][0]->toolsConvertPrice(array('price'=>$_smarty_tpl->tpl_vars['product']->value->price),$_smarty_tpl);?>
"/>
				<input size="11" maxlength="27" id="priceTE" name="price_displayed" type="text" value="<?php ob_start();?><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['toolsConvertPrice'][0][0]->toolsConvertPrice(array('price'=>$_smarty_tpl->tpl_vars['product']->value->price),$_smarty_tpl);?>
<?php $_tmp3=ob_get_clean();?><?php echo sprintf('%.6f',$_tmp3);?>
" onchange="noComma('priceTE'); $('#priceTEReal').val(this.value);" onkeyup="$('#priceType').val('TE'); $('#priceTEReal').val(this.value.replace(/,/g, '.')); if (isArrowKey(event)) return; calcPriceTI();" />

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"id_tax_rules_group",'type'=>"default"), 0);?>

			<?php echo smartyTranslate(array('s'=>'Tax rule:'),$_smarty_tpl);?>

					<select onchange="javascript:calcPrice(); unitPriceWithTax('unit');" name="id_tax_rules_group" id="id_tax_rules_group" <?php if ($_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?>disabled="disabled"<?php }?> >
						<option value="0"><?php echo smartyTranslate(array('s'=>'No Tax'),$_smarty_tpl);?>
</option>
					<?php  $_smarty_tpl->tpl_vars['tax_rules_group'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['tax_rules_group']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['tax_rules_groups']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['tax_rules_group']->key => $_smarty_tpl->tpl_vars['tax_rules_group']->value) {
$_smarty_tpl->tpl_vars['tax_rules_group']->_loop = true;
?>
						<option value="<?php echo $_smarty_tpl->tpl_vars['tax_rules_group']->value['id_tax_rules_group'];?>
" <?php if ($_smarty_tpl->tpl_vars['product']->value->getIdTaxRulesGroup()==$_smarty_tpl->tpl_vars['tax_rules_group']->value['id_tax_rules_group']) {?>selected="selected"<?php }?> >
					<?php echo smarty_modifier_htmlentitiesUTF8($_smarty_tpl->tpl_vars['tax_rules_group']->value['name']);?>

						</option>
					<?php } ?>
					</select>

					<a class="btn btn-link confirm_leave" href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getAdminLink('AdminTaxRulesGroup'), ENT_QUOTES, 'UTF-8', true);?>
&addtax_rules_group&id_product=<?php echo $_smarty_tpl->tpl_vars['product']->value->id;?>
"<?php if ($_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?> disabled="disabled"<?php }?>>
						 <?php echo smartyTranslate(array('s'=>'Create new tax'),$_smarty_tpl);?>

	<?php if ($_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?>

				<?php echo smartyTranslate(array('s'=>'Taxes are currently disabled:'),$_smarty_tpl);?>

				<a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getAdminLink('AdminTaxes'), ENT_QUOTES, 'UTF-8', true);?>
"><?php echo smartyTranslate(array('s'=>'Click here to open the Taxes configuration page.'),$_smarty_tpl);?>

				<input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['product']->value->getIdTaxRulesGroup();?>
" name="id_tax_rules_group" />

	<?php }?>
	<div class="form-group" <?php if (!$_smarty_tpl->tpl_vars['ps_use_ecotax']->value) {?> style="display:none;"<?php }?>>

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"ecotax",'type'=>"default"), 0);?>

			<span class="label-tooltip" data-toggle="tooltip" title="<?php echo smartyTranslate(array('s'=>'The ecotax is a local set of taxes intended to "promote ecologically sustainable activities via economic incentives". It is already included in retail price: the higher this ecotax is, the lower your margin will be.'),$_smarty_tpl);?>
"><?php echo smartyTranslate(array('s'=>'Ecotax (tax incl.)'),$_smarty_tpl);?>

			<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

			<input maxlength="27" id="ecotax" name="ecotax" type="text" value="<?php echo sprintf($_smarty_tpl->tpl_vars['priceDisplayPrecisionFormat']->value,$_smarty_tpl->tpl_vars['product']->value->ecotax);?>
" onkeyup="$('#priceType').val('TI');if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, '.'); if (parseInt(this.value) > getE('priceTE').value) this.value = getE('priceTE').value; if (isNaN(this.value)) this.value = 0;" />

	<div class="form-group" <?php if (!$_smarty_tpl->tpl_vars['country_display_tax_label']->value||$_smarty_tpl->tpl_vars['tax_exclude_taxe_option']->value) {?>style="display:none;"<?php }?> >
		<?php echo smartyTranslate(array('s'=>'Retail price with tax'),$_smarty_tpl);?>

			<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

			<input id="priceType" name="priceType" type="hidden" value="TE" />
			<input id="priceTI" name="priceTI" type="text" value="" onchange="noComma('priceTI');" maxlength="27" onkeyup="$('#priceType').val('TI');if (isArrowKey(event)) return;  calcPriceTE();" />

		<?php if (isset($_smarty_tpl->tpl_vars['pack']->value)&&$_smarty_tpl->tpl_vars['pack']->value->isPack($_smarty_tpl->tpl_vars['product']->value->id)) {?>
<?php ob_start();?><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['toolsConvertPrice'][0][0]->toolsConvertPrice(array('price'=>sprintf($_smarty_tpl->tpl_vars['priceDisplayPrecisionFormat']->value,$_smarty_tpl->tpl_vars['pack']->value->noPackPrice($_smarty_tpl->tpl_vars['product']->value->id))),$_smarty_tpl);?>
<?php $_tmp4=ob_get_clean();?><?php echo smartyTranslate(array('s'=>'The sum of prices of the products in the pack is %s%s%s','sprintf'=>array($_smarty_tpl->tpl_vars['currency']->value->prefix,$_tmp4,$_smarty_tpl->tpl_vars['currency']->value->suffix)),$_smarty_tpl);?>

<?php }?>

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"unit_price",'type'=>"unit_price"), 0);?>

			<span class="label-tooltip" data-toggle="tooltip" title="<?php echo smartyTranslate(array('s'=>'When selling a pack of items, you can indicate the unit price for each item of the pack. For instance, "per bottle" or "per pound".'),$_smarty_tpl);?>
"><?php echo smartyTranslate(array('s'=>'Unit price (tax excl.)'),$_smarty_tpl);?>

				<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

				<input id="unit_price" name="unit_price" type="text" value="<?php echo sprintf('%.6f',$_smarty_tpl->tpl_vars['unit_price']->value);?>
" maxlength="27" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, '.'); unitPriceWithTax('unit');"/>
				<?php echo smartyTranslate(array('s'=>'per'),$_smarty_tpl);?>

				<input id="unity" name="unity" type="text" value="<?php echo smarty_modifier_htmlentitiesUTF8($_smarty_tpl->tpl_vars['product']->value->unity);?>
"  maxlength="255" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>

	<?php if (isset($_smarty_tpl->tpl_vars['product']->value->unity)&&$_smarty_tpl->tpl_vars['product']->value->unity) {?>

				<?php echo smartyTranslate(array('s'=>'or'),$_smarty_tpl);?>

					<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
0.00<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

					<?php echo smartyTranslate(array('s'=>'per'),$_smarty_tpl);?>
 <?php echo $_smarty_tpl->tpl_vars['product']->value->unity;?>
<?php if ($_smarty_tpl->tpl_vars['ps_tax']->value&&$_smarty_tpl->tpl_vars['country_display_tax_label']->value) {?> <?php echo smartyTranslate(array('s'=>'(tax incl.)'),$_smarty_tpl);?>
<?php }?>

	<?php }?>

<?php echo $_smarty_tpl->getSubTemplate ("controllers/products/multishop/checkbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('field'=>"on_sale",'type'=>"default"), 0);?>

					<input type="checkbox" name="on_sale" id="on_sale" <?php if ($_smarty_tpl->tpl_vars['product']->value->on_sale) {?>checked="checked"<?php }?> value="1" />
					<?php echo smartyTranslate(array('s'=>'Display the "on sale" icon on the product page, and in the text found within the product listing.'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Final retail price:'),$_smarty_tpl);?>

					<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>

					0.00
					<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

					<span<?php if (!$_smarty_tpl->tpl_vars['ps_tax']->value) {?> style="display:none;"<?php }?>> (<?php echo smartyTranslate(array('s'=>'tax incl.'),$_smarty_tpl);?>
)

				<span<?php if (!$_smarty_tpl->tpl_vars['ps_tax']->value) {?> style="display:none;"<?php }?> >
				<?php if ($_smarty_tpl->tpl_vars['country_display_tax_label']->value) {?>
					/
				<?php }?>
					<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>

					<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

					<?php if ($_smarty_tpl->tpl_vars['country_display_tax_label']->value) {?>(<?php echo smartyTranslate(array('s'=>'tax excl.'),$_smarty_tpl);?>
)<?php }?>

		<a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getAdminLink('AdminProducts'), ENT_QUOTES, 'UTF-8', true);?>
<?php if (isset($_REQUEST['page'])&&$_REQUEST['page']>1) {?>&submitFilterproduct=<?php echo intval($_REQUEST['page']);?>
<?php }?>" class="btn btn-default"> <?php echo smartyTranslate(array('s'=>'Cancel'),$_smarty_tpl);?>

		<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"> <?php echo smartyTranslate(array('s'=>'Save'),$_smarty_tpl);?>
</button>
		<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled"> <?php echo smartyTranslate(array('s'=>'Save and stay'),$_smarty_tpl);?>
</button>

<?php if (isset($_smarty_tpl->tpl_vars['specificPriceModificationForm']->value)) {?>

<?php echo smartyTranslate(array('s'=>'Specific prices'),$_smarty_tpl);?>

		<?php echo smartyTranslate(array('s'=>'You can set specific prices for clients belonging to different groups, different countries, etc.'),$_smarty_tpl);?>

				 <?php echo smartyTranslate(array('s'=>'Add a new specific price'),$_smarty_tpl);?>

				 <?php echo smartyTranslate(array('s'=>'Cancel new specific price'),$_smarty_tpl);?>

				<label class="control-label col-lg-2" for="<?php if (!$_smarty_tpl->tpl_vars['multi_shop']->value) {?>spm_currency_0<?php } else { ?>sp_id_shop<?php }?>"><?php echo smartyTranslate(array('s'=>'For'),$_smarty_tpl);?>

					<?php if (!$_smarty_tpl->tpl_vars['multi_shop']->value) {?>
						<input type="hidden" name="sp_id_shop" value="0" />
					<?php } else { ?>

							<select name="sp_id_shop" id="sp_id_shop">
								<?php if (!$_smarty_tpl->tpl_vars['admin_one_shop']->value) {?><option value="0"><?php echo smartyTranslate(array('s'=>'All shops'),$_smarty_tpl);?>
</option><?php }?>
								<?php  $_smarty_tpl->tpl_vars['shop'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['shop']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['shops']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['shop']->key => $_smarty_tpl->tpl_vars['shop']->value) {
$_smarty_tpl->tpl_vars['shop']->_loop = true;
?>
								<option value="<?php echo $_smarty_tpl->tpl_vars['shop']->value['id_shop'];?>
"><?php echo smarty_modifier_htmlentitiesUTF8($_smarty_tpl->tpl_vars['shop']->value['name']);?>
</option>
								<?php } ?>
							</select>

					<?php }?>

							<select name="sp_id_currency" id="spm_currency_0" onchange="changeCurrencySpecificPrice(0);">
								<option value="0"><?php echo smartyTranslate(array('s'=>'All currencies'),$_smarty_tpl);?>
</option>
								<?php  $_smarty_tpl->tpl_vars['curr'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['curr']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['currencies']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['curr']->key => $_smarty_tpl->tpl_vars['curr']->value) {
$_smarty_tpl->tpl_vars['curr']->_loop = true;
?>
								<option value="<?php echo $_smarty_tpl->tpl_vars['curr']->value['id_currency'];?>
"><?php echo smarty_modifier_htmlentitiesUTF8($_smarty_tpl->tpl_vars['curr']->value['name']);?>
</option>
								<?php } ?>
							</select>

							<select name="sp_id_country" id="sp_id_country">
								<option value="0"><?php echo smartyTranslate(array('s'=>'All countries'),$_smarty_tpl);?>
</option>
								<?php  $_smarty_tpl->tpl_vars['country'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['country']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['countries']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['country']->key => $_smarty_tpl->tpl_vars['country']->value) {
$_smarty_tpl->tpl_vars['country']->_loop = true;
?>
								<option value="<?php echo $_smarty_tpl->tpl_vars['country']->value['id_country'];?>
"><?php echo smarty_modifier_htmlentitiesUTF8($_smarty_tpl->tpl_vars['country']->value['name']);?>
</option>
								<?php } ?>
							</select>

							<select name="sp_id_group" id="sp_id_group">
								<option value="0"><?php echo smartyTranslate(array('s'=>'All groups'),$_smarty_tpl);?>
</option>
								<?php  $_smarty_tpl->tpl_vars['group'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['group']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['groups']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['group']->key => $_smarty_tpl->tpl_vars['group']->value) {
$_smarty_tpl->tpl_vars['group']->_loop = true;
?>
								<option value="<?php echo $_smarty_tpl->tpl_vars['group']->value['id_group'];?>
"><?php echo $_smarty_tpl->tpl_vars['group']->value['name'];?>
</option>
								<?php } ?>
							</select>

				<?php echo smartyTranslate(array('s'=>'Customer'),$_smarty_tpl);?>

					<input type="hidden" name="sp_id_customer" id="id_customer" value="0" />

						<input type="text" name="customer" value="<?php echo smartyTranslate(array('s'=>'All customers'),$_smarty_tpl);?>
" id="customer" autocomplete="off" />

			<?php if (count($_smarty_tpl->tpl_vars['combinations']->value)!=0) {?>

				<?php echo smartyTranslate(array('s'=>'Combination:'),$_smarty_tpl);?>

					<select id="sp_id_product_attribute" name="sp_id_product_attribute">
						<option value="0"><?php echo smartyTranslate(array('s'=>'Apply to all combinations'),$_smarty_tpl);?>
</option>
					<?php  $_smarty_tpl->tpl_vars['combination'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['combination']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['combinations']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['combination']->key => $_smarty_tpl->tpl_vars['combination']->value) {
$_smarty_tpl->tpl_vars['combination']->_loop = true;
?>
						<option value="<?php echo $_smarty_tpl->tpl_vars['combination']->value['id_product_attribute'];?>
"><?php echo $_smarty_tpl->tpl_vars['combination']->value['attributes'];?>
</option>
					<?php } ?>
					</select>

			<?php }?>

				<?php echo smartyTranslate(array('s'=>'Available'),$_smarty_tpl);?>

								<?php echo smartyTranslate(array('s'=>'from'),$_smarty_tpl);?>

								<input type="text" name="sp_from" class="datepicker" value="" style="text-align: center" id="sp_from" />

								<?php echo smartyTranslate(array('s'=>'to'),$_smarty_tpl);?>

								<input type="text" name="sp_to" class="datepicker" value="" style="text-align: center" id="sp_to" />

				<?php echo smartyTranslate(array('s'=>'Starting at'),$_smarty_tpl);?>

						<?php echo smartyTranslate(array('s'=>'unit'),$_smarty_tpl);?>

						<input type="text" name="sp_from_quantity" id="sp_from_quantity" value="1" />

				<?php echo smartyTranslate(array('s'=>'Product price'),$_smarty_tpl);?>

					<?php if ($_smarty_tpl->tpl_vars['country_display_tax_label']->value) {?>
						<?php echo smartyTranslate(array('s'=>'(tax excl.)'),$_smarty_tpl);?>

					<?php }?>

								<?php echo $_smarty_tpl->tpl_vars['currency']->value->prefix;?>
<?php echo $_smarty_tpl->tpl_vars['currency']->value->suffix;?>

								<input type="text" disabled="disabled" name="sp_price" id="sp_price" value="<?php echo sprintf($_smarty_tpl->tpl_vars['priceDisplayPrecisionFormat']->value,$_smarty_tpl->tpl_vars['product']->value->price);?>
" />

								<?php echo smartyTranslate(array('s'=>'Leave base price:'),$_smarty_tpl);?>

								<input type="checkbox" id="leave_bprice" name="leave_bprice"  value="1" checked="checked"  />

				<?php echo smartyTranslate(array('s'=>'Apply a discount of'),$_smarty_tpl);?>

							<input type="text" name="sp_reduction" id="sp_reduction" value="0.00"/>

							<select name="sp_reduction_type" id="sp_reduction_type">
								<option value="amount" selected="selected"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currency']->value->name, ENT_QUOTES, 'UTF-8', true);?>
</option>
								<option value="percentage"><?php echo smartyTranslate(array('s'=>'%'),$_smarty_tpl);?>
</option>
							</select>

							<select name="sp_reduction_tax" id="sp_reduction_tax">
								<option value="0"><?php echo smartyTranslate(array('s'=>'Tax excluded'),$_smarty_tpl);?>
</option>
								<option value="1" selected="selected"><?php echo smartyTranslate(array('s'=>'Tax included'),$_smarty_tpl);?>
</option>
							</select>

				<?php echo smartyTranslate(array('s'=>'Rule'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Combination'),$_smarty_tpl);?>

				<?php if ($_smarty_tpl->tpl_vars['multi_shop']->value) {?><?php echo smartyTranslate(array('s'=>'Shop'),$_smarty_tpl);?>
	<?php }?>
				<?php echo smartyTranslate(array('s'=>'Currency'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Country'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Group'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Customer'),$_smarty_tpl);?>

				<?php if ($_smarty_tpl->tpl_vars['country_display_tax_label']->value) {?>
					<?php echo smartyTranslate(array('s'=>'Fixed price (tax excl.)'),$_smarty_tpl);?>

				<?php } else { ?>
					<?php echo smartyTranslate(array('s'=>'Fixed price'),$_smarty_tpl);?>

				<?php }?>
				<?php echo smartyTranslate(array('s'=>'Impact'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Period'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'From (quantity)'),$_smarty_tpl);?>

				<?php echo smartyTranslate(array('s'=>'Action'),$_smarty_tpl);?>

			<?php echo $_smarty_tpl->tpl_vars['specificPriceModificationForm']->value;?>

			<?php }?>
<?php }} ?>


text:
require 'test_helper'

class MatadarTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
module Main where

import Data.Char
import Network.HTTP
import Data.Maybe
import Control.Concurrent

import System.IO
import Control.Monad

import Data.Time.Clock
import Data.Time.Calendar

-- import Data.List.Split

import System.Environment
import System.Directory

import ResultsParsing
import Geocoding

import Streaming
import qualified Streaming.Prelude as S

main :: IO ()
main =
    sequence_ $ fmap processDate ["properties"]

processDate :: String -> IO ()
processDate date = do
    allFiles <- listFiles date
    let allProperties = S.mapM fileToProperties $ S.each allFiles
        flattenedPropertiesWithPrice = S.filter hasPrice $ S.concat allProperties
    S.print $  propertiesWithGeocoding flattenedPropertiesWithPrice

-- propertiesWithGeocoding :: [ParsedProperty] -> IO [(ParsedProperty, Maybe LatLng)]
propertiesWithGeocoding
  :: Stream (Of ParsedProperty) IO r
     -> Stream (Of (ParsedProperty, Maybe LatLng)) IO r
propertiesWithGeocoding properties = do
    let batchProperties = S.mapped S.toList $ chunksOf 100 properties
    S.concat $ S.concat $ S.mapM geocodeAddresses batchProperties
    -- concat here flattens a stream of lists of as into a stream of as
    -- and a stream of maybe as into a stream of as

openURL :: String -> IO String
openURL x = getResponseBody =<< simpleHTTP (getRequest x)

geocodeAddresses :: [ParsedProperty] -> IO (Maybe [(ParsedProperty, Maybe LatLng)])
geocodeAddresses properties = do
    let addresses = fmap location properties
    mapQuestKey <- getEnv "MAP_QUEST_KEY"
    geocodeResponse <- openURL $ mapQuestUrl mapQuestKey addresses
    return $ fmap (zip properties) (geocodeResponseToResults geocodeResponse)

listFiles :: String -> IO [FilePath]
listFiles folder = do
    files <- listDirectory folder
    return $ fmap (\file -> folder ++ "/" ++ file) files

fileToProperties :: FilePath -> IO [ParsedProperty]
fileToProperties path = do
    contents <- readFile path
    return $ parsePage contents

hasPrice :: ParsedProperty -> Bool
hasPrice property = isJust (price property)


text:
from msrest.serialization import Model

class ParameterGroupingPostOptionalParameters(Model):
    """
    Additional parameters for the postOptional operation.
    """

    _required = []

    def __init__(self, *args, **kwargs):
        """ParameterGroupingPostOptionalParameters

        :param str custom_header
        :param int query: Query parameter with default. Default value: 30 .
        """
        self.custom_header = None
        self.query = None

        super(ParameterGroupingPostOptionalParameters, self).__init__(*args, **kwargs)


text:
<?php
ini_set('display_errors', 'On');
//ob_start("ob_gzhandler");
error_reporting(E_ALL);

// start the session
session_start();

// database connection config
$dbHost = 'localhost';
$dbUser = 'root';
$dbPass = '';
$dbName = 'phpwebco_shop';

// setting up the web root and server root for
// this shopping cart application
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];

$webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
$srvRoot  = str_replace('library/config.php', '', $thisFile);

define('WEB_ROOT', $webRoot);
define('SRV_ROOT', $srvRoot);

// these are the directories where we will store all
// category and product images
define('CATEGORY_IMAGE_DIR', 'images/category/');
define('PRODUCT_IMAGE_DIR',  'images/product/');

// some size limitation for the category
// and product images

// all category image width must not
// exceed 75 pixels
define('MAX_CATEGORY_IMAGE_WIDTH', 75);

// do we need to limit the product image width?
// setting this value to 'true' is recommended
define('LIMIT_PRODUCT_WIDTH',     true);

// maximum width for all product image
define('MAX_PRODUCT_IMAGE_WIDTH', 300);

// the width for product thumbnail
define('THUMBNAIL_WIDTH',         75);

if (!get_magic_quotes_gpc()) {
	if (isset($_POST)) {
		foreach ($_POST as $key => $value) {
			$_POST[$key] =  trim(addslashes($value));
		}
	}

	if (isset($_GET)) {
		foreach ($_GET as $key => $value) {
			$_GET[$key] = trim(addslashes($value));
		}
	}
}

// since all page will require a database access
// and the common library is also used by all
// it's logical to load these library here
require_once 'database.php';
require_once 'common.php';

// get the shop configuration ( name, addres, etc ), all page need it
$shopConfig = getShopConfig();
?>


text:
import asynctest
from metadoc.install import install_nltk_sets

class MetadocInstallTest(asynctest.TestCase):
  def setUp(self):
    return

  @asynctest.ignore_loop
  def test_install(self):
    install_nltk_sets()


text:
using TestFunction = int (*)();

int main(int argc, char** argv) {
  if (argc < 2) {
    std::cerr << "Library name not provided" << std::endl;
    return 1;
  }
  char* name = argv[1];
  void* handle = dlopen(name, RTLD_NOW);
  if (handle == nullptr) {
    std::cerr << dlerror() << std::endl;
    return 1;
  }

  TestFunction get_sum =
      reinterpret_cast<TestFunction>(dlsym(handle, "GetSum"));
  if (get_sum == nullptr) {
    std::cerr << "GetSum method not found" << std::endl;
    return 1;
  }

  std::cout << get_sum() << std::endl;
  return 0;
}


text:
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 *    InteractiveTablePanel.java
 *    Copyright (C) 2011-2013 University of Waikato, Hamilton, New Zealand
 */

package weka.gui.beans;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;

/**
 * Provides a panel using an interactive table model.
 *
 * @author Mark Hall (mhall{[at]}penthao{[dot]}com)
 * @version $Revision: 10893 $
 */
public class InteractiveTablePanel extends JPanel {

  /** For serialization */
  private static final long serialVersionUID = 4495705463732140410L;

  /** Holds column names */
  protected String[] m_columnNames;

  /** The table itself */
  protected JTable m_table;

  /** Scroll panel for the table */
  protected JScrollPane m_scroller;

  /** Model for the table */
  protected InteractiveTableModel m_tableModel;

  /**
   * Constructor
   *
   * @param colNames the names of the columns
   */
  public InteractiveTablePanel(String[] colNames) {
    m_columnNames = colNames;
    initComponent();
  }

  /**
   * Initializes the component
   */
  public void initComponent() {
    m_tableModel = new InteractiveTableModel(m_columnNames);
    m_tableModel
      .addTableModelListener(new InteractiveTablePanel.InteractiveTableModelListener());
    m_table = new JTable();
    m_table.setModel(m_tableModel);
    m_table.setSurrendersFocusOnKeystroke(true);
    if (!m_tableModel.hasEmptyRow()) {
      m_tableModel.addEmptyRow();
    }

    InteractiveTableModel model = (InteractiveTableModel) m_table.getModel();
    m_scroller = new javax.swing.JScrollPane(m_table);
    m_table.setPreferredScrollableViewportSize(new java.awt.Dimension(500, 80));
    TableColumn hidden =
      m_table.getColumnModel().getColumn(model.m_hidden_index);
    hidden.setMinWidth(2);
    hidden.setPreferredWidth(2);
    hidden.setMaxWidth(2);
    hidden.setCellRenderer(new InteractiveRenderer(model.m_hidden_index));

    setLayout(new BorderLayout());
    add(m_scroller, BorderLayout.CENTER);
  }

  /**
   * Get the JTable component
   *
   * @return the JTable
   */
  public JTable getTable() {
    return m_table;
  }

  /**
   * Highlight the last row in the table
   *
   * @param row the row
   */
  public void highlightLastRow(int row) {
    int lastrow = m_tableModel.getRowCount();
    if (row == lastrow - 1) {
      m_table.setRowSelectionInterval(lastrow - 1, lastrow - 1);
    } else {
      m_table.setRowSelectionInterval(row + 1, row + 1);
    }

    m_table.setColumnSelectionInterval(0, 0);
  }

  /**
   * Renderer for the InteractiveTablePanel
   */
  class InteractiveRenderer extends DefaultTableCellRenderer {

    private static final long serialVersionUID = 6186813827783402502L;

    /** The index of the interactive column */
    protected int m_interactiveColumn;

    /**
     * Constructor
     *
     * @param interactiveColumn the column that is interactive (i.e. you can
     *          press return to generate a new row from it)
     */
    public InteractiveRenderer(int interactiveColumn) {
      m_interactiveColumn = interactiveColumn;
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
      boolean isSelected, boolean hasFocus, int row, int column) {
      Component c =
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
          row, column);
      if (column == m_interactiveColumn && hasFocus) {
        if ((InteractiveTablePanel.this.m_tableModel.getRowCount() - 1) == row
          && !InteractiveTablePanel.this.m_tableModel.hasEmptyRow()) {
          InteractiveTablePanel.this.m_tableModel.addEmptyRow();
        }

        highlightLastRow(row);
      }

      return c;
    }
  }

  /**
   * Listener for the InteractiveTablePanel
   */
  public class InteractiveTableModelListener implements TableModelListener {
    @Override
    public void tableChanged(TableModelEvent evt) {
      if (evt.getType() == TableModelEvent.UPDATE) {
        int column = evt.getColumn();
        int row = evt.getFirstRow();
        m_table.setColumnSelectionInterval(column + 1, column + 1);
        m_table.setRowSelectionInterval(row, row);
      }
    }
  }
}


text:
package com.ociweb.iot.examples;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ociweb.gl.api.GreenCommandChannel;
import com.ociweb.gl.api.PubSubListener;
import com.ociweb.iot.grove.lcd_rgb.Grove_LCD_RGB;
import com.ociweb.iot.maker.FogCommandChannel;
import com.ociweb.iot.maker.FogRuntime;
import com.ociweb.gl.api.StateChangeListener;
import com.ociweb.pronghorn.pipe.ChannelReader;
import com.ociweb.pronghorn.util.Appendables;

public class DisplayController implements PubSubListener, StateChangeListener<PumpState> {

	private final FogCommandChannel commandChannel;
	public PumpState activeState = PumpState.Idle;
	private final String topicTank;
	private final String topicPump;
	private final String topicTotal;
	private static final Logger loggger = LoggerFactory.getLogger(DisplayController.class);

	private long   lastTankTime;
	private int    lastTankDepth;
	private String lastTankFuel;

	private long   lastPumpTime;
	private String lastPumpFuel;
	private int    lastPumpPrice;
	private int    lastPumpUnits;

	private String lastTotalName;
	private int    lastTotalPrice;
	private int    lastTotalUnits;

	private String showingNow = "";

	public DisplayController(FogRuntime runtime, String topicTank, String topicPump, String topicTotal) {
		this.commandChannel = runtime.newCommandChannel(GreenCommandChannel.DYNAMIC_MESSAGING);
		this.topicTank = topicTank;
		this.topicPump = topicPump;
		this.topicTotal = topicTotal;

	}

	@Override
	public boolean message(CharSequence topic, ChannelReader payload) {

		if (topic.equals(topicTank)) { //.toString().equals(topicTank.toString())) {

			lastTankTime = payload.readLong();
			lastTankDepth = payload.readInt();
			lastTankFuel = payload.readUTF();

		}

		if (topic.equals(topicPump)) {

			lastPumpTime = payload.readLong();
			lastPumpFuel = payload.readUTF();
			lastPumpPrice = payload.readInt();
			lastPumpUnits = payload.readInt();

		}

		if (topic.equals(topicTotal)) {

			//now that we have the total the previous running values are no longer valid
			lastPumpTime = 0;
			lastPumpUnits = 0;

			long totalTime = payload.readLong();
			lastTotalName = payload.readUTF();
			int price = payload.readInt();
			lastTotalUnits = payload.readInt();

			lastTotalPrice = (price*lastTotalUnits)/100;

		}

		repaint();
		return true;
	}

	@Override
	public boolean stateChange(PumpState oldState, PumpState newState) {
		activeState = newState;

		repaint();
		return true;
	}

	private void repaint() {

		StringBuilder target = new StringBuilder();
		switch (activeState) {
			case Idle:
				buildTankDisplay(target);
				break;
			case Pump:
				buildPumpingDisplay(target);
				break;
			case Receipt:
				buildReceiptDisplay(target);
				break;
			default:
				loggger.error("error skipped unknown state :"+activeState);
		}

		String newText = target.toString();
		if (!newText.equals(showingNow)) {

			Grove_LCD_RGB.commandForColor(commandChannel, 255, 255, 200);
			Grove_LCD_RGB.commandForText(commandChannel, newText);
			showingNow = newText;

		}
	}

	private void buildReceiptDisplay(StringBuilder target) {

			if (null!=lastTotalName) {
				target.append(lastTotalName);
			}
			target.append(" total \n");

			Appendables.appendFixedDecimalDigits(target, lastTotalUnits/100, 1000);
			target.append('.');
			Appendables.appendFixedDecimalDigits(target, lastTotalUnits%100, 10);

			target.append(" ");

			target.append("$");
			Appendables.appendFixedDecimalDigits(target, lastTotalPrice/100, 1000);
			target.append('.');
			Appendables.appendFixedDecimalDigits(target, lastTotalPrice%100, 10);
	}

	private void buildPumpingDisplay(StringBuilder target) {

			target.append(lastPumpFuel);
			target.append("\n");

			target.append("");
			Appendables.appendFixedDecimalDigits(target, lastPumpUnits/100, 100);
			target.append('.');
			Appendables.appendFixedDecimalDigits(target, lastPumpUnits%100, 10);

			int cents = (lastPumpUnits*lastPumpPrice)/100;
			target.append(" $");
			Appendables.appendFixedDecimalDigits(target, cents/100, 100);
			target.append('.');
			Appendables.appendFixedDecimalDigits(target, cents%100, 10);

	}

	private void buildTankDisplay(StringBuilder target) {

			if (null!=lastTankFuel) {
				target.append(lastTankFuel).append(" tank");
				target.append('\n');
				Appendables.appendFixedDecimalDigits(target, lastTankDepth, 1000);
				target.append(" cm2 volume");
			} else {
				target.append("No tank data\n");
			}

	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        metadata-complete="true"
        version="3.0">

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:/spring/*-context.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- ************************ Servlets section *********************** -->

    <servlet>
        <servlet-name>WebAppServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <!--param-value>/WEB-INF/spring/servlet-context.xml</param-value-->
            <param-value></param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>WebAppServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- ************************ Filters section ************************ -->

    <!--filter>
        <filter-name>RemoteIpFilter</filter-name>
        <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
        <init-param>
            <param-name>remoteIpHeader</param-name>
            <param-value>x-forwarded-for</param-value>
        </init-param>
        <init-param>
            <param-name>remoteIpProxiesHeader</param-name>
            <param-value>x-forwarded-by</param-value>
        </init-param>
        <init-param>
            <param-name>protocolHeader</param-name>
            <param-value>x-forwarded-proto</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>RemoteIpFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping-->

    <filter>
        <display-name>CommonFilter</display-name>
        <filter-name>CommonFilter</filter-name>
        <filter-class>com.googlecode.common.web.CommonFilter</filter-class>
        <init-param>
            <param-name>appDomain</param-name>
            <param-value>.common-admin.appspot.com</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CommonFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <display-name>SigninFilter</display-name>
        <filter-name>SigninFilter</filter-name>
        <filter-class>com.googlecode.common.admin.web.SigninFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SigninFilter</filter-name>
        <url-pattern>/admin.html</url-pattern>
        <url-pattern>/profile.html</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <display-name>Common Admin Demo</display-name>

    <welcome-file-list>
        <welcome-file>admin.html</welcome-file>
    </welcome-file-list>

</web-app>


text:
using System;

namespace BenchmarkDotNet.Tasks
{
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
    public class TaskAttribute : Attribute
    {
        public BenchmarkTask Task { get; }

        public TaskAttribute(
            int processCount = 3,
            BenchmarkMode mode = BenchmarkMode.Throughput,
            BenchmarkPlatform platform = BenchmarkPlatform.CurrentPlatform,
            BenchmarkJitVersion jitVersion = BenchmarkJitVersion.CurrentJit,
            BenchmarkFramework framework = BenchmarkFramework.Current,
            int warmupIterationCount = 5,
            int targetIterationCount = 10
            )
        {
            Task = new BenchmarkTask(
                processCount,
                new BenchmarkConfiguration(mode, platform, jitVersion, framework),
                new BenchmarkSettings(warmupIterationCount, targetIterationCount));
        }
    }
}


text:
/**
 * Created by lja on 2015/12/2.
 */
(function (angular) {
	'use strict';

	angular.module('desktop').controller('desktopBodyController',
		['$scope', 'desktopBodyDataService', 'platformControllerFactory',
		 function ($scope, dataService, platformControllerFactory) {

			 $scope.name = 'document.body';

			 platformControllerFactory.initController($scope, dataService);

		 }]);
})(angular);


text:
import os, datetime, socket

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))

def abspath(*args):
    """convert relative paths to absolute paths relative to PROJECT_ROOT"""
    return os.path.join(PROJECT_ROOT, *args)

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = ()

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'sideloader',
        'USER': 'postgres',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '',
    }
}

ALLOWED_HOSTS = ['*']

TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True

MEDIA_ROOT = abspath('media')
MEDIA_URL = '/media/'

STATIC_ROOT = abspath('static')
STATIC_URL = '/static/'

STATICFILES_DIRS = ()

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

SECRET_KEY = 'SIDELO4D3R'

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'sideloader.urls'

WSGI_APPLICATION = 'sideloader.wsgi.application'

TEMPLATE_DIRS = (
    abspath('templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'gunicorn',
    #'raven.contrib.django.raven_compat',
    'social.apps.django_app.default',
    'crispy_forms',
    'sideloader',
)

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

BROKER_URL = 'redis://localhost:6379/0'

LOGIN_REDIRECT_URL = '/'

CRISPY_TEMPLATE_PACK = 'bootstrap3'
SESSION_COOKIE_AGE = 1209600

SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'

SIDELOADER_DOMAIN = socket.getfqdn()
SIDELOADER_FROM = 'Sideloader <no-reply@%s>' % SIDELOADER_DOMAIN
SIDELOADER_PACKAGEURL = "http://%s/packages" % SIDELOADER_DOMAIN

SLACK_TOKEN = None
SLACK_CHANNEL = ''
SLACK_HOST = 'foo.slack.com'

try:
    from local_settings import *
except ImportError:
    pass


text:
layout: post
title: "mechanize useage"
description: ""
category: Web
tags: [Rails]
---

[Mechanize (http://mechanize.rubyforge.org/GUIDE_rdoc.html#label-Getting+Started+With+Mechanize)](http://mechanize.rubyforge.org/GUIDE_rdoc.html#label-Getting+Started+With+Mechanize)

### example

**baidu search**:

    require  "mechanize"
    agent = Mechanize.new
    page = agent.get("http://www.baidu.com")
    result_page = page.form_with(name: "f") do |form|
    form["wd"] = "ruby"
    end.submit

**login cms**:

    agent = Mechanize.new
    page = agent.get("http://cms.stage.lanshizi.com/admin/login")
    login_form = page.form_with(action: "/admin/login") do |form|
      form["admin_user[username]"] = "sa"
      form["admin_user[password]"] = "sa"
    end
    cms_page = login_form.submit
    if message = cms_page.at(".flash_alert")
      p message.text
    else
      p cms_page
    end

**captcha 破解**

 * 破解破解验证码 captcha
 * 破解同个客户端获取captcha图片并且保存
 * 破解RTesseract 解释图片

  **code**:

    @agent.get(@captcha_url).save("captcha.jpg")
    @app_list_page = @agent.get(@login_url).form_with(id: "loginForm") do |f|
    f.action = "/accounts/signin/"
      f["username"] = @username
      f["password"] = @password
      f["captcha"] = RTesseract.new("captcha.jpg").to_s.strip
    end.click_button


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Anales Soc. Esp. Hist. Nat. 10:227. 1881

#### Original name
null

### Remarks
null


text:
import {Component} from '@angular/core';

@Component({
  selector: 'modules',
  template: `<router-outlet></router-outlet>`
})
export class Modules {

  constructor() {
  }
}


text:
import React from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter, Route } from 'react-router-dom';

import AppContainer from './containers/AppContainer';

import store from './state/store';

ReactDom.render((
  <Provider store={store}>
    <BrowserRouter>
      <Route path="/" component={AppContainer}>
        {/* <Route path="login" component={LoginContainer}></Route> */}
      </Route>
    </BrowserRouter>
  </Provider>
), document.getElementById('application'));


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IOperator.cs" company="bbv Software Services AG">
//   Copyright (c) 2014 - 2020
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace ErrorHandling.Workshop.FirstExercise
{
    public interface IOperator
    {
        string CommandName { get; }

        int Calculate(int firstNumber, int secondNumber);
    }
}


text:
"""Implentation of Brocade SVI service Plugin."""

from oslo.config import cfg
from oslo.utils import excutils

from neutron.common import constants as l3_constants
from neutron.i18n import _LE, _LI
from neutron.openstack.common import log as logging
from neutron.plugins.ml2 import db
from neutron.plugins.ml2.drivers.brocade.db import models as brocade_db
from neutron.plugins.ml2.drivers.brocade.nos import nosdriver as driver
from neutron.services.l3_router import l3_router_plugin as router

DEVICE_OWNER_ROUTER_INTF = l3_constants.DEVICE_OWNER_ROUTER_INTF
DEVICE_OWNER_ROUTER_GW = l3_constants.DEVICE_OWNER_ROUTER_GW
DEVICE_OWNER_FLOATINGIP = l3_constants.DEVICE_OWNER_FLOATINGIP

ML2_BROCADE = [cfg.StrOpt('address', default='',
                          help=_('The address of the host to SSH to')),
               cfg.StrOpt('username', default='admin',
                          help=_('The SSH username to use')),
               cfg.StrOpt('password', default='password', secret=True,
                          help=_('The SSH password to use')),
               cfg.StrOpt('rbridge_id', default=1,
                          help=_('Rbridge id of provider edge router(s)')),
               ]

cfg.CONF.register_opts(ML2_BROCADE, "ml2_brocade")

LOG = logging.getLogger(__name__)

class BrocadeSVIPlugin(router.L3RouterPlugin):
    """Brocade SVI service Plugin."""

    def __init__(self):
        """Initialize Brocade Plugin

        Specify switch address and db configuration.
        """
        super(BrocadeSVIPlugin, self).__init__()
        self._switch = None
        self._driver = None
        self.brocade_init()

    def brocade_init(self):
        """Brocade specific initialization."""
        LOG.debug("brocadeSVIPlugin::brocade_init()")

        self._switch = {'address': cfg.CONF.ml2_brocade.address,
                        'username': cfg.CONF.ml2_brocade.username,
                        'password': cfg.CONF.ml2_brocade.password,
                        'rbridge_id': cfg.CONF.ml2_brocade.rbridge_id
                        }
        self._driver = driver.NOSdriver()
        LOG.info(_LI("rbridge id %s"), self._switch['rbridge_id'])

    def create_router(self, context, router):
        """Creates a vrf on NOS device."""
        LOG.debug("BrocadeSVIPlugin.create_router called: ")
        with context.session.begin(subtransactions=True):
            new_router = super(BrocadeSVIPlugin, self).create_router(context,
                                                                     router)
            # Router on VDX
            try:
                switch = self._switch
                self._driver.create_router(switch['address'],
                                           switch['username'],
                                           switch['password'],
                                           switch['rbridge_id'],
                                           str(new_router['id']))
            except Exception:
                with excutils.save_and_reraise_exception():
                    with context.session.begin(subtransactions=True):
                        super(BrocadeSVIPlugin, self).delete_router(
                            context,
                            new_router['id'])

        LOG.debug("BrocadeSVIPlugin.create_router: "
                  "router created on VDX switch")
        return new_router

    def delete_router(self, context, router_id):
        """Delete a vrf on NOS device."""
        router = super(BrocadeSVIPlugin, self).get_router(context, router_id)
        super(BrocadeSVIPlugin, self).delete_router(context, router_id)

        switch = self._switch
        self._driver.delete_router(switch['address'],
                                   switch['username'],
                                   switch['password'],
                                   switch['rbridge_id'],
                                   str(router['id']))

    def add_router_interface(self, context, router_id, interface_info):
        """creates svi on NOS device and assigns ip addres to SVI."""
        LOG.debug("BrocadeSVIPlugin.add_router_interface on VDX: "
                  "router_id=%(router_id)s "
                  "interface_info=%(interface_info)r",
                  {'router_id': router_id, 'interface_info': interface_info})

        with context.session.begin(subtransactions=True):

            info = super(BrocadeSVIPlugin, self).add_router_interface(
                context, router_id, interface_info)

            port = db.get_port(context.session, info["port_id"])

            # shutting down neutron port to allow NOS to do Arp/Routing
            port['admin_state_up'] = False
            port['port'] = port
            self._core_plugin.update_port(context, info["port_id"], port)

            interface_info = info
            subnet = self._core_plugin._get_subnet(context,
                                                   interface_info["subnet_id"])
            cidr = subnet["cidr"]
            net_addr, net_len = self.net_addr(cidr)
            gateway_ip = subnet["gateway_ip"]
            network_id = subnet['network_id']
            bnet = brocade_db.get_network(context, network_id)
            vlan_id = bnet['vlan']
            gateway_ip_cidr = gateway_ip + '/' + str(net_len)
            LOG.debug("Allocated cidr %(cidr)s from the pool, "
                      "network_id %(net_id)s "
                      "bnet %(bnet)s "
                      "vlan %(vlan_id)d ", {'cidr': gateway_ip_cidr,
                                            'net_id': network_id,
                                            'bnet': bnet,
                                            'vlan_id': int(vlan_id)})
            port_filters = {'network_id': [network_id],
                            'device_owner': [DEVICE_OWNER_ROUTER_INTF]}
            port_count = self._core_plugin.get_ports_count(context,
                                                           port_filters)
            LOG.info(_LI("BrocadeSVIPlugin.add_router_interface ports_count "
                         "%d"),
                     port_count)

            # port count is checked against 2 since the current port is already
            # added to db
            if port_count == 2:
                # This subnet is already part of some router
                # (this is not supported in this version of brocade svi plugin)
                msg = _("BrocadeSVIPlugin: adding redundant router interface "
                        "is not supported")
                LOG.error(msg)
                raise Exception(msg)

        try:
            switch = self._switch
            self._driver.create_svi(switch['address'],
                                    switch['username'],
                                    switch['password'],
                                    switch['rbridge_id'],
                                    vlan_id,
                                    gateway_ip_cidr,
                                    str(router_id))
        except Exception:
            LOG.error(_LE("Failed to create Brocade resources to add router "
                          "interface. info=%(info)s, router_id=%(router_id)s"),
                      {"info": info, "router_id": router_id})
            with excutils.save_and_reraise_exception():
                with context.session.begin(subtransactions=True):
                    self.remove_router_interface(context, router_id,
                                                 interface_info)
        return info

    def remove_router_interface(self, context, router_id, interface_info):
        """Deletes svi from NOS device."""
        LOG.debug("BrocadeSVIPlugin.remove_router_interface called: "
                  "router_id=%(router_id)s "
                  "interface_info=%(interface_info)r",
                  {'router_id': router_id, 'interface_info': interface_info})

        with context.session.begin(subtransactions=True):
            info = super(BrocadeSVIPlugin, self).remove_router_interface(
                context, router_id, interface_info)
            try:
                subnet = self._core_plugin._get_subnet(context,
                                                       info['subnet_id'])
                cidr = subnet['cidr']
                net_addr, net_len = self.net_addr(cidr)
                gateway_ip = subnet['gateway_ip']
                network_id = subnet['network_id']
                bnet = brocade_db.get_network(context, network_id)
                vlan_id = bnet['vlan']
                gateway_ip_cidr = gateway_ip + '/' + str(net_len)
                LOG.debug("remove_router_interface removed cidr %(cidr)s"
                          " from the pool,"
                          " network_id %(net_id)s bnet %(bnet)s"
                          " vlan %(vlan_id)d",
                          {'cidr': gateway_ip_cidr,
                           'net_id': network_id,
                           'bnet': bnet,
                           'vlan_id': int(vlan_id)})
                switch = self._switch
                self._driver.delete_svi(switch['address'],
                                        switch['username'],
                                        switch['password'],
                                        switch['rbridge_id'],
                                        vlan_id,
                                        gateway_ip_cidr,
                                        str(router_id))
            except Exception:
                with excutils.save_and_reraise_exception():
                    LOG.error(_LE("Fail remove of interface from brocade "
                                  "router interface. info=%(info)s, "
                                  "router_id=%(router_id)s"),
                              {"info": info, "router_id": router_id})
        return True

    @staticmethod
    def net_addr(addr):
        """Get network address prefix and length from a given address."""
        if addr is None:
            return None, None
        nw_addr, nw_len = addr.split('/')
        nw_len = int(nw_len)
        return nw_addr, nw_len


text:
from mongoengine import Document, StringField, EmbeddedDocumentListField, DateTimeField, BooleanField

from .time_interval import TimeIntervalModel
from .node import NodeDefinitionModel
from .factor import FactorDefinitionModel

class WorkflowDefinitionModel(Document):
    workflow_id = StringField(required=True, min_length=1, max_length=512)
    name = StringField(required=True, min_length=1, max_length=512)
    description = StringField(required=True, min_length=1, max_length=4096)
    nodes = EmbeddedDocumentListField(document_type=NodeDefinitionModel, required=False)
    factors = EmbeddedDocumentListField(document_type=FactorDefinitionModel, required=True)
    owner = StringField(required=False, min_length=1, max_length=512)
    online = BooleanField(required=True)
    monitor = BooleanField(required=True)

    meta = {
        'collection': 'workflow_definitions',
        'indexes': [{'fields': ['workflow_id']}],
        'ordering': ['workflow_id']
    }

class WorkflowStatusModel(Document):
    workflow_id = StringField(required=True, min_length=1, max_length=512)
    last_updated = DateTimeField(required=True)
    last_accessed = DateTimeField(required=False)

    # Time ranges requested for computation for this workflow
    requested_intervals = EmbeddedDocumentListField(document_type=TimeIntervalModel, required=False)

    # Actual ranges that have been computed. Note that this can be empty to begin with
    # calculated_intervals = EmbeddedDocumentListField(document_type=TimeIntervalModel, required=False)

    meta = {
        'collection': 'workflow_status',
        'indexes': [{'fields': ['workflow_id']}],
        'ordering': ['workflow_id']
    }


text:
Set up - OSX
================================
1. Clone the skypekit repository into /usr/local
    git clone git@git.assembla.com:00xx105-cohaesusism.skypekit.git /usr/local/skypekit
2. Clone Igor to wherever you would like it
    git clone git@git.assembla.com:00xx105-cohaesusism.igor.git
3. Install dependencies to allow you to build the Igor virtual environment
    sudo easy_install pip
    sudo pip install virtualenv
4. Change into the root of your Igor clone
5. Set up the virtual environment
    virtualenv venv --no-site-packages --distribute
    source venv/bin/activate
    pip install -r requirements.txt


text:
var test = require('tape')
var path = require('path')
var from = require('./')
var fs   = require('fs')

var tmp = path.resolve(
  __dirname, 'tmp.txt'
)

function fromString(string) {
  return from(function(size, next) {
    if (string.length <= 0) return next()
    var chunk = string.slice(0, size)
    string = string.slice(size)
    next(null, chunk)
  })
}

test('from2', function(t) {
  var contents = fs.readFileSync(__filename, 'utf8')
  var stream = fromString(contents)

  stream
    .pipe(fs.createWriteStream(tmp))
    .on('close', function() {
      t.equal(fs.readFileSync(tmp, 'utf8'), contents)
      fs.unlinkSync(tmp)
      t.end()
    })
})

test('old mode', function(t) {
  var contents = fs.readFileSync(__filename, 'utf8')
  var stream = fromString(contents)
  var buffer = ''

  stream.on('data', function(data) {
    buffer += data
  }).on('end', function() {
    t.equal(buffer, contents)
    t.end()
  })
})


text: This is the profile


text:
package com.hybris.guestbook.page;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class SignGuestBook implements GuestBookPage {

    private static final String SIGN = "/";
    private static final String PAGE_ID = "guestbook-home";
    private static final String FIRSTNAME = "firstname";
    private static final String LASTNAME = "lastname";
    private static final String SIGN_GUESTBOOK = "signGuestbook";

    @Override
    public String getUri() {
        return SIGN;
    }

    @Override
    public String getPageId() {
        return PAGE_ID;
    }

    public String getFirstname() {
        return FIRSTNAME;
    }

    public String getLastname() {
        return LASTNAME;
    }

    public String getSignGuestbook() {
        return SIGN_GUESTBOOK;
    }

}


text:
@interface OrgMockitoInternalUtilRemoveFirstLine : NSObject

#pragma mark Public

- (instancetype)init;

- (NSString *)ofWithNSString:(NSString *)text;

@end

J2OBJC_EMPTY_STATIC_INIT(OrgMockitoInternalUtilRemoveFirstLine)

FOUNDATION_EXPORT void OrgMockitoInternalUtilRemoveFirstLine_init(OrgMockitoInternalUtilRemoveFirstLine *self);

FOUNDATION_EXPORT OrgMockitoInternalUtilRemoveFirstLine *new_OrgMockitoInternalUtilRemoveFirstLine_init() NS_RETURNS_RETAINED;

J2OBJC_TYPE_LITERAL_HEADER(OrgMockitoInternalUtilRemoveFirstLine)

#endif // _OrgMockitoInternalUtilRemoveFirstLine_H_