text:
package com.jobxhub.server.service;

import com.jobxhub.common.Constants;
import com.jobxhub.common.exception.PingException;
import com.jobxhub.common.job.Action;
import com.jobxhub.common.job.Request;
import com.jobxhub.common.job.RequestFile;
import com.jobxhub.common.job.Response;
import com.jobxhub.common.util.CommonUtils;
import com.jobxhub.common.util.IOUtils;
import com.jobxhub.rpc.InvokeCallback;
import com.jobxhub.server.util.Parser;
import com.jobxhub.server.job.JobXInvoker;
import com.jobxhub.server.dto.Agent;
import com.jobxhub.server.dto.Job;
import com.jobxhub.server.dto.Record;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.concurrent.*;

import static com.jobxhub.common.Constants.*;

@Component
public class ExecuteService {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private RecordService recordService;

    @Autowired
    private JobService jobService;

    @Autowired
    private NoticeService noticeService;

    @Autowired
    private JobXInvoker caller;

    @Autowired
    private AgentService agentService;

    private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(16, 16, 600L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(65536));

    /**
     * 基本方式执行任务,按任务类型区分
     */
    public void executeJob(Job job, Constants.ExecType execType) {
        if (!checkJobPermission(job.getAgentId(), job.getUserId())) {
            return;
        }
        Agent agent = agentService.getAgent(job.getAgentId());
        job.setAgent(agent);
        JobType jobType = JobType.getJobType(job.getJobType());
        if (jobType.equals(JobType.SIMPLE)) {
            executeSimpleJob(job, execType);//单一任务
        }
        if (jobType.equals(JobType.FLOW)) {
            executeFlowJob(job, execType);//流程任务
        }
    }

    /**
     * 单一任务执行过程
     */
    private void executeSimpleJob(final Job job, final ExecType execType) {
        threadPoolExecutor.submit(new Runnable() {
            @Override
            public void run() {
                final Record record = new Record(job, execType,JobType.SIMPLE);

                record.setCommand(Parser.parse(job));

                InvokeCallback invokeCallback = new ExecuteCallback(job,execType,record);
                try {
                    checkPing(job, record);
                    Agent agent = job.getAgent();
                    Request request = Request.request(agent.getHost(),
                            agent.getPort(),
                            Action.EXECUTE,
                            agent.getPassword(),
                            job.getTimeout(),
                            agent.getProxyId());
                    request.putParam(Constants.PARAM_COMMAND_KEY, record.getCommand());
                    request.putParam(Constants.PARAM_PID_KEY, record.getPid());
                    request.putParam(Constants.PARAM_SUCCESSEXIT_KEY, job.getSuccessExit());
                    request.putParam(Constants.PARAM_TIMEOUT_KEY, job.getTimeout());
                    request.putParam(Constants.PARAM_EXECUSER_KEY, job.getExecUser());
                    caller.sentAsync(request,invokeCallback);
                } catch (Exception e) {
                    if ( !(e instanceof PingException) ) {
                        invokeCallback.caught(e);
                    }
                }
            }
        });
    }

    /**
     * 流程任务 按流程任务处理方式区分
     */
    private void executeFlowJob(Job job, ExecType execType) {
        //todo....
    }

    /**
     * 多执行器同时 现场执行过程
     */
    public void executeBatchJob(final Long userId, String command, String agentIds) {
        String[] arrayIds = agentIds.split(";");
        final Semaphore semaphore = new Semaphore(arrayIds.length);
        ExecutorService exec = Executors.newCachedThreadPool();
        for (String agentId : arrayIds) {
            Agent agent = agentService.getAgent(Long.parseLong(agentId));
            final Job job = new Job(userId, command, agent);
            job.setSuccessExit(StatusCode.SUCCESS_EXIT.getValue().toString());
            exec.submit(new Runnable() {
                @Override
                public void run() {
                    try {
                        semaphore.acquire();
                        executeSimpleJob(job, ExecType.BATCH);
                        semaphore.release();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
        exec.shutdown();
        while (true) {
            if (exec.isTerminated()) {
                if (logger.isInfoEnabled()) {
                    logger.info("[JobX]executeBatchJob done!");
                }
                break;
            }
        }
    }

    /**
     * 终止任务过程
     */
    public boolean killJob(final Record record) {
        if (record == null) return false;
        Job job = jobService.getById(record.getJobId());
        final Agent agent = agentService.getAgent(record.getAgentId());
        //现场执行的job
        if (record.getExecType().equals(ExecType.BATCH.getStatus())) {
            job = new Job(record.getUserId(),record.getCommand(),agent);
        }
        KillCallback killCallback = new KillCallback(job,record);
        try {
            Request request = Request.request(agent.getHost(),
                    agent.getPort(),
                    Action.KILL,
                    agent.getPassword(),
                    Constants.RPC_TIMEOUT,
                    agent.getProxyId());
            request.putParam(Constants.PARAM_PID_KEY, record.getPid());
            caller.sentAsync(request,killCallback);
            return true;
        } catch (Exception e) {
            if ( !(e instanceof PingException) ) {
                killCallback.caught(e);
                return false;
            }
        }
        return false;
    }

    private void responseToRecord(Response response, Record record) {
        record.setReturnCode(response.getExitCode());
        record.setMessage(response.getMessage());
        if (response.isSuccess()) {
            record.setSuccess(ResultStatus.SUCCESSFUL.getStatus());
        }else {
            record.setSuccess(ResultStatus.FAILED.getStatus());
        }
        int exitCode = response.getExitCode();
        if (exitCode == StatusCode.KILL.getValue()
                ||exitCode == StatusCode.OTHER_KILL.getValue()) {
            record.setStatus(RunStatus.STOPED.getStatus());
            record.setSuccess(ResultStatus.KILLED.getStatus());
        } else if (exitCode == StatusCode.TIME_OUT.getValue()) {
            record.setStatus(RunStatus.STOPED.getStatus());
            record.setSuccess(ResultStatus.TIMEOUT.getStatus());
        } else {
            record.setStatus(RunStatus.DONE.getStatus());
        }
        record.end();
    }

    public void lostToRecord(Record record) {
        record.setStatus(RunStatus.STOPED.getStatus());
        record.setSuccess(ResultStatus.LOST.getStatus());
        record.setEndTime(new Date());
        recordService.merge(record);
    }

    /**
     * 任务执行前 检测通信
     */
    private void checkPing(Job job, Record record) throws PingException {
        ConnStatus connStatus = ping(job.getAgent(),true);
        if (!connStatus.equals(ConnStatus.CONNECTED)) {
            //已完成
            record.setStatus(RunStatus.DONE.getStatus());
            record.setReturnCode(StatusCode.ERROR_PING.getValue());
            String format = "can't to communicate with agent:%s(%s:%d),execute job:%s failed";
            String content = String.format(format,
                    job.getAgent().getName(),
                    job.getAgent().getHost(),
                    job.getAgent().getPort(),
                    job.getJobName());
            record.setMessage(content);
            record.setSuccess(ResultStatus.LOST.getStatus());
            record.setEndTime(new Date());
            recordService.merge(record);
            throw new PingException(content);
        }
    }

    public Constants.ConnStatus ping(Agent agent, boolean update) {
        Response response = null;
        try {
            response = caller.sentSync(Request.request(
                    agent.getHost(),
                    agent.getPort(),
                    Action.PING,
                    agent.getPassword(),
                    Constants.RPC_TIMEOUT,
                    agent.getProxyId()));
        } catch (Exception e) {
            logger.error("[JobX]ping failed,host:{},port:{}", agent.getHost(), agent.getPort());
        }

        ConnStatus status = ConnStatus.DISCONNECTED;

        if (response != null) {
            if (response.isSuccess()) {
                status = ConnStatus.CONNECTED;
            }else {
                if (response.getResult().isEmpty()) {
                    status = ConnStatus.DISCONNECTED;
                }else {
                    status = ConnStatus.UNAUTHORIZED;
                }
            }

            //处理agent失联之后上报的log...
            if (!response.getResult().isEmpty()) {
                Map<String,String> result = response.getResult();
                for (Map.Entry<String,String> entry:result.entrySet()) {
                    if (entry.getKey().length() == 32) {
                        String log = entry.getValue();
                        if (CommonUtils.notEmpty(log)) {
                            String logInfo[] = log.split(IOUtils.FIELD_TERMINATED_BY);
                            String message = logInfo[0];
                            Integer exitCode = null;
                            Long entTime = null;
                            if (logInfo.length == 2) {
                                exitCode = Integer.parseInt(logInfo[1].split(IOUtils.TAB)[0]);
                                entTime = Long.parseLong(logInfo[1].split(IOUtils.TAB)[1]);
                            }
                            recordService.doLostLog(entry.getKey(),message,exitCode,entTime);
                        }
                    }
                }
            }
        }

        if (update) {
            agent.setStatus(status.getValue());
            agentService.updateStatus(agent);
        }

        return status;
    }

    public String getMacId(Agent agent) {
        try {
            Response response = caller.sentSync(Request.request(
                    agent.getHost(),
                    agent.getPort(),
                    Action.MACID,
                    agent.getPassword(),
                    Constants.RPC_TIMEOUT,
                    agent.getProxyId())
            );
            return response.getMessage();
        } catch (Exception e) {
            logger.error("[JobX]getguid failed,host:{},port:{}", agent.getHost(), agent.getPort());
            return null;
        }
    }

    public String path(Agent agent) {
        try {
           return caller.sentSync(
                   Request.request(
                    agent.getHost(),
                    agent.getPort(),
                    Action.PATH,
                    null,
                    Constants.RPC_TIMEOUT,
                    agent.getProxyId())
           ).getMessage();
        } catch (Exception e) {
            logger.error("[JobX]ping failed,host:{},port:{}", agent.getHost(), agent.getPort());
            return null;
        }
    }

    public Response listPath(Agent agent, String path) {
        return caller.sentSync(Request.request(
                agent.getHost(),
                agent.getPort(),
                Action.LISTPATH,
                agent.getPassword(),
                Constants.RPC_TIMEOUT,
                agent.getProxyId()).putParam(Constants.PARAM_LISTPATH_PATH_KEY,path));
    }

    /**
     * 修改密码
     */
    public boolean password(Agent agent, final String newPassword) {
        boolean ping = false;
        try {
            Response response = caller.sentSync(Request.request(
                    agent.getHost(),
                    agent.getPort(),
                    Action.PASSWORD,
                    agent.getPassword(),
                    Constants.RPC_TIMEOUT,
                    agent.getProxyId()
                    ).putParam(
                    Constants.PARAM_NEWPASSWORD_KEY,
                    newPassword)
            );
            ping = response.isSuccess();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ping;
    }

    /**
     * 监测执行器运行状态
     */
    public Response monitor(Agent agent) throws Exception {
        return caller.sentSync(
                Request.request(
                        agent.getHost(),
                        agent.getPort(),
                        Action.MONITOR,
                        agent.getPassword(),
                        Constants.RPC_TIMEOUT,
                        agent.getProxyId()
                ));
    }

    public Response upload(Agent agent, RequestFile requestFile) {
        Request request = Request.request(
                agent.getHost(),
                agent.getPort(),
                Action.UPLOAD,
                agent.getPassword(),
                null,
                agent.getProxyId());

        request.setUploadFile(requestFile);
        Response response = caller.sentSync(request);
        if (!response.isSuccess()) {
            response.setSuccess(response.getExitCode() == StatusCode.SUCCESS_EXIT.getValue());
        }
        return response;
    }

    /**
     * 校验任务执行权限
     */
    private boolean checkJobPermission(Long jobAgentId, Long userId) {
       /* if (userId == null) {
            return false;
        }
        User user = userService.getUserById(userId);
        //超级管理员拥有所有执行器的权限
        if (user != null && user.getRoleId() == 999) {
            return true;
        }
        String agentIds = userService.getUserById(userId).getAgentIds();
        agentIds = "," + agentIds + ",";
        String thisAgentId = "," + jobAgentId + ",";
        return agentIds.contains(thisAgentId);*/
       return true;
    }

    private void printLog(String str, Job job, String message) {
        if (message != null) {
            if (logger.isInfoEnabled()) {
                logger.info(str, job.getJobName(), job.getAgent().getHost(), job.getAgent().getPort(), message);
            }
        } else {
            if (logger.isInfoEnabled()) {
                logger.info(str, job.getJobName(), job.getAgent().getHost(), job.getAgent().getPort());
            }
        }
    }

    private String loggerError(String str, Job job, String message, Exception e) {
        String errorInfo = String.format(str, job.getJobName(), job.getAgent().getHost(), job.getAgent().getPort(), message);
        if (logger.isErrorEnabled()) {
            logger.error(errorInfo, e);
        }
        return errorInfo;
    }

    private void printLostJobInfo(Job job, String message) {

    }

    class ExecuteCallback implements InvokeCallback {
        private Record record;
        private ExecType execType;
        private Job job;

        public ExecuteCallback(Job job, ExecType execType, Record record) {
            this.job = job;
            this.record = record;
            this.execType = execType;
            //执行前先保存
            recordService.merge(record);
        }
        @Override
        public void done(Response response) {
            logger.info("[JobX]:execute response:{}", response.toString());
            try {
                responseToRecord(response,record);
                //api方式调度,回调结果数据给调用方
                job.callBack(response,execType);
                //防止返回的信息太大,往数据库存,有保存失败的情况发生
                recordService.merge(record);
                if (!response.isSuccess()) {
                    noticeService.notice(job, null);
                    printLog("execute failed:jobName:{} at host:{},port:{},info:{}", job, record.getMessage());
                } else {
                    printLog("execute successful:jobName:{} at host:{},port:{}", job, null);
                }

            } catch (Exception e) {
                //信息丢失,继续保存记录
                printLostJobInfo(job, record.getMessage());
                record.setMessage(null);
                recordService.merge(record);
                //发送警告信息
                noticeService.notice(job, e.getLocalizedMessage());
                loggerError("execute failed:jobName:%s at host:%s,port:%d,info:%s", job, e.getLocalizedMessage(), e);
            }
        }
        @Override
        public void caught(Throwable err) {
            //方法失联
            lostToRecord(record);
            noticeService.notice(job, "调用失败,获取不到返回结果集");
        }
    }

    class KillCallback implements InvokeCallback {
        private Record record;
        private Job job;
        public KillCallback(Job job,Record record) {
            this.job = job;
            this.record = record;
            record.setStatus(RunStatus.STOPPING.getStatus());
            recordService.merge(record);
        }

        @Override
        public void done(Response response) {
            record.setStatus(RunStatus.STOPED.getStatus());
            record.setEndTime(new Date());
            recordService.merge(record);
            printLog("killed successful :jobName:{} at host:{},port:{},pid:{}", job, record.getPid());
        }

        @Override
        public void caught(Throwable err) {
            record.setStatus(RunStatus.STOPED.getStatus());
            recordService.merge(record);
            printLog("killed successful :jobName:{} at host:{},port:{},pid:{}", job, record.getPid());
        }
    }
}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Revisioned (Apache Taverna Language APIs (Scufl2, Databundle) 0.15.1-incubating API)</title>
<meta name="date" content="2016-03-14">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.taverna.scufl2.api.annotation

Interface Revisioned

All Superinterfaces:

Cloneable, WorkflowBean

All Known Implementing Classes:

AbstractRevisioned, Profile, Workflow, WorkflowBundle

public interface Revisioned
extends WorkflowBean

A WorkflowBean that is revisioned.

 Revisions are expressed as a chain of Revisions linking to the
 Revision.getPreviousRevision()s. The Revision metadata also may
 include when and who did the revision.

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

Revision
getCurrentRevision()

Get the current Revision metadata.

URI
getIdentifier()

Returns the identifier of this bean.

Revision
newRevision()

Make a new Revision to mark structural changes to this workflow bean.

Revision
newRevision(URI revisionIdentifier)

Make a new Revision to mark structural changes to this workflow bean with
 the given identifier.

void
setCurrentRevision(Revision currentRevision)

Set the current Revision.

void
setIdentifier(URI workflowIdentifier)

Set the identifier.

Methods inherited from interface org.apache.taverna.scufl2.api.common.WorkflowBean

accept, clone

Method Detail

getCurrentRevision

Revision getCurrentRevision()

Get the current Revision metadata.

 The Revision typically contains information about when it was
 made, and links to the previous revision chain.

Returns:

setCurrentRevision

void setCurrentRevision(Revision currentRevision)

Set the current Revision.

 To preserve the existing revision chain, the new revision should point to
 the current revision using Revision.setPreviousRevision(Revision)

Parameters:

currentRevision - The Revision to be set

newRevision

Revision newRevision()

Make a new Revision to mark structural changes to this workflow bean.

 The identifier of the new getCurrentRevision() will also be
 identifying the Revisioned workflow bean and be returned from
 getIdentifier().

 The new revision will include the previous Revision as
 Revision.getPreviousRevision() and
 Revision.getGeneratedAtTime() on the new revision will match the
 current GregorianCalendar by default.

Returns:

The new getCurrentRevision(), for setting any further
         details.

newRevision

Revision newRevision(URI revisionIdentifier)

Make a new Revision to mark structural changes to this workflow bean with
 the given identifier.

 getIdentifier() will match the new identifier. The new
 getCurrentRevision() will include the previous revision as
 Revision.getPreviousRevision().

 Note, unlike the convenience method newRevision() this method
 will not update Revision.getGeneratedAtTime().

Parameters:

revisionIdentifier - The new workflow identifier

Returns:

The new getCurrentRevision(), for setting any further
         details.

setIdentifier

void setIdentifier(URI workflowIdentifier)

Set the identifier.

 This will delete any previous revisions in getCurrentRevision().
 To avoid loosing history, you might instead want to use
 newRevision(URI).

Parameters:

workflowIdentifier - the identifier

See Also:

getIdentifier(),
getCurrentRevision()

getIdentifier

URI getIdentifier()

Returns the identifier of this bean.

 This identifier matches the Revision.getIdentifier() of
 getCurrentRevision().

Returns:

the identifier

See Also:

#setIdentifier(URI)}

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.

redpajama_set_name: RedPajamaGithub


text:
logger "Hello world!"
echo "Hello and welcome to Aperture Science computer-aided enrichment center"


text:
(function (factory) {

  // CommonJS
  if (typeof exports == "object") {
    module.exports = factory(require("underscore"),
                             require("backbone"),
                             require("backgrid"),
                             require("backbone-pageable"));
  }
  // Browser
  else if (typeof _ !== "undefined" &&
           typeof Backbone !== "undefined" &&
           typeof Backgrid !== "undefined") {
    factory(_, Backbone, Backgrid);
  }

}(function (_, Backbone, Backgrid) {

  "use strict";

  /**
     PageHandle is a class that renders the actual page handles and reacts to
     click events for pagination.

     This class acts in two modes - control or discrete page handle modes. If
     one of the `is*` flags is `true`, an instance of this class is under
     control page handle mode. Setting a `pageIndex` to an instance of this
     class under control mode has no effect and the correct page index will
     always be inferred from the `is*` flag. Only one of the `is*` flags should
     be set to `true` at a time. For example, an instance of this class cannot
     simultaneously be a rewind control and a fast forward control. A `label`
     and a `title` template or a string are required to be passed to the
     constuctor under this mode. If a `title` template is provided, it __MUST__
     accept a parameter `label`. When the `label` is provided to the `title`
     template function, its result will be used to render the generated anchor's
     title attribute.

     If all of the `is*` flags is set to `false`, which is the default, an
     instance of this class will be in discrete page handle mode. An instance
     under this mode requires the `pageIndex` to be passed from the constructor
     as an option and it __MUST__ be a 0-based index of the list of page numbers
     to render. The constuctor will normalize the base to the same base the
     underlying PageableCollection collection instance uses. A `label` is not
     required under this mode, which will default to the equivalent 1-based page
     index calculated from `pageIndex` and the underlying PageableCollection
     instance. A provided `label` will still be honored however. The `title`
     parameter is also not required under this mode, in which case the default
     `title` template will be used. You are encouraged to provide your own
     `title` template however if you wish to localize the title strings.

     If this page handle represents the current page, an `active` class will be
     placed on the root list element.

     if this page handle is at the border of the list of pages, a `disabled`
     class will be placed on the root list element.

     Only page handles that are neither `active` nor `disabled` will respond to
     click events and triggers pagination.

     @class Backgrid.Extension.PageHandle
  */
  var PageHandle = Backgrid.Extension.PageHandle = Backbone.View.extend({

    /** @property */
    tagName: "li",

    /** @property */
    events: {
      "click a": "changePage"
    },

    /**
       @property {string|function(Object.<string, string>): string} title
       The title to use for the `title` attribute of the generated page handle
       anchor elements. It can be a string or an Underscore template function
       that takes a mandatory `label` parameter.
    */
    title: _.template('Page <%- label %>'),

    /**
       @property {boolean} isRewind Whether this handle represents a rewind
       control
    */
    isRewind: false,

    /**
       @property {boolean} isBack Whether this handle represents a back
       control
    */
    isBack: false,

    /**
       @property {boolean} isForward Whether this handle represents a forward
       control
    */
    isForward: false,

    /**
       @property {boolean} isFastForward Whether this handle represents a fast
       forward control
    */
    isFastForward: false,

    /**
       Initializer.

       @param {Object} options
       @param {Backbone.Collection} options.collection
       @param {number} pageIndex 0-based index of the page number this handle
       handles. This parameter will be normalized to the base the underlying
       PageableCollection uses.
       @param {string} [options.label] If provided it is used to render the
       anchor text, otherwise the normalized pageIndex will be used
       instead. Required if any of the `is*` flags is set to `true`.
       @param {string} [options.title]
       @param {boolean} [options.isRewind=false]
       @param {boolean} [options.isBack=false]
       @param {boolean} [options.isForward=false]
       @param {boolean} [options.isFastForward=false]

       ********	New Added Options *************
       @param {boolean} [options.scrollToTop=true]
       On Page change by default it scroll to top
    */
    initialize: function (options) {
      Backbone.View.prototype.initialize.apply(this, arguments);

      var collection = this.collection;
      var state = collection.state;
      var currentPage = state.currentPage;
      var firstPage = state.firstPage;
      var lastPage = state.lastPage;

      _.extend(this, _.pick(options,
                            ["isRewind", "isBack", "isForward", "isFastForward" , "scrollToTop",'paginationCache']));

      var pageIndex;
      if (this.isRewind) pageIndex = firstPage;
      else if (this.isBack) pageIndex = Math.max(firstPage, currentPage - 1);
      else if (this.isForward) pageIndex = Math.min(lastPage, currentPage + 1);
      else if (this.isFastForward) pageIndex = lastPage;
      else {
        pageIndex = +options.pageIndex;
        pageIndex = (firstPage ? pageIndex + 1 : pageIndex);
      }
      this.pageIndex = pageIndex;

      if (((this.isRewind || this.isBack) && currentPage == firstPage) ||
          ((this.isForward || this.isFastForward) && currentPage == lastPage)) {
        this.$el.addClass("disabled");
      }
      else if (!(this.isRewind ||
                 this.isBack ||
                 this.isForward ||
                 this.isFastForward) &&
               currentPage == pageIndex) {
        this.$el.addClass("active");
      }

      this.label = (options.label || (firstPage ? pageIndex : pageIndex + 1)) + '';
      var title = options.title || this.title;
      this.title = _.isFunction(title) ? title({label: this.label}) : title;
    },

    /**
       Renders a clickable anchor element under a list item.
    */
    render: function () {
      this.$el.empty();
      var anchor = document.createElement("a");
      anchor.href = '#';
      if (this.title) anchor.title = this.title;
      anchor.innerHTML = this.label;
      this.el.appendChild(anchor);
      this.delegateEvents();
      return this;
    },

    /**
       jQuery click event handler. Goes to the page this PageHandle instance
       represents. No-op if this page handle is currently active or disabled.
    */
    changePage: function (e) {
      e.preventDefault();
      var $el = this.$el;
      if (this.scrollToTop){
    	  $("body,html").animate({scrollTop:0},800);
      }
      if (!$el.hasClass("active") && !$el.hasClass("disabled") && !this.paginationCache) {
        this.collection.getPage(this.pageIndex);
      }else
    	  this.collection.getPage(this.pageIndex ,{cache : true});
      return this;
    }

  });

  /**
     Paginator is a Backgrid extension that renders a series of configurable
     pagination handles. This extension is best used for splitting a large data
     set across multiple pages. If the number of pages is larger then a
     threshold, which is set to 10 by default, the page handles are rendered
     within a sliding window, plus the rewind, back, forward and fast forward
     control handles. The individual control handles can be turned off.

     @class Backgrid.Extension.Paginator
  */
  Backgrid.Extension.Paginator = Backbone.View.extend({

    /** @property */
    className: "backgrid-paginator",

    /** @property */
    windowSize: 10,

    /**
       @property {Object.<string, Object.<string, string>>} controls You can
       disable specific control handles by omitting certain keys.
    */
    controls: {
      rewind: {
        label: "《",
        title: "First"
      },
      back: {
        label: "〈",
        title: "Previous"
      },
      forward: {
        label: "〉",
        title: "Next"
      },
      fastForward: {
        label: "》",
        title: "Last"
      }
    },

    /**
       @property {Backgrid.Extension.PageHandle} pageHandle. The PageHandle
       class to use for rendering individual handles
    */
    pageHandle: PageHandle,

    /** @property */
    goBackFirstOnSort: true,

    /**
       Initializer.

       @param {Object} options
       @param {Backbone.Collection} options.collection
       @param {boolean} [options.controls]
       @param {boolean} [options.pageHandle=Backgrid.Extension.PageHandle]
       @param {boolean} [options.goBackFirstOnSort=true]
    */
    initialize: function (options) {
      this.scrollToTop = options.scrollToTop || false;		//Added scrollToTop on  Page Change
      this.paginationCache = options.paginationCache || false;					//set cache on  Page Change. Need Cache boolean value for backbone.fetch-cache plugin
      this.controls = options.controls || this.controls;
      this.pageHandle = options.pageHandle || this.pageHandle;

      var collection = this.collection;
      this.listenTo(collection, "add", this.render);
      this.listenTo(collection, "remove", this.render);
      this.listenTo(collection, "reset", this.render);
      if ((options.goBackFirstOnSort || this.goBackFirstOnSort) &&
          collection.fullCollection) {
        this.listenTo(collection.fullCollection, "sort", function () {
          collection.getFirstPage();
        });
      }
    },

    _calculateWindow: function () {
      var collection = this.collection;
      var state = collection.state;

      // convert all indices to 0-based here
      var firstPage = state.firstPage;
      var lastPage = +state.lastPage;
      lastPage = Math.max(0, firstPage ? lastPage - 1 : lastPage);
      var currentPage = Math.max(state.currentPage, state.firstPage);
      currentPage = firstPage ? currentPage - 1 : currentPage;
      var windowStart = Math.floor(currentPage / this.windowSize) * this.windowSize;
      var windowEnd = Math.min(lastPage + 1, windowStart + this.windowSize);
      return [windowStart, windowEnd];
    },

    /**
       Creates a list of page handle objects for rendering.

       @return {Array.<Object>} an array of page handle objects hashes
    */
    makeHandles: function () {

      var handles = [];
      var collection = this.collection;

      var window = this._calculateWindow();
      var winStart = window[0], winEnd = window[1];

      for (var i = winStart; i < winEnd; i++) {
        handles.push(new this.pageHandle({
          collection: collection,
          pageIndex: i,
          scrollToTop : this.scrollToTop,
          paginationCache: this.paginationCache
        }));
      }

      var controls = this.controls;
      _.each(["back", "rewind", "forward", "fastForward"], function (key) {
        var value = controls[key];
        if (value) {
          var handleCtorOpts = {
            collection: collection,
            title: value.title,
            label: value.label,
            scrollToTop : this.scrollToTop,
            paginationCache: this.paginationCache
          };
          handleCtorOpts["is" + key.slice(0, 1).toUpperCase() + key.slice(1)] = true;
          var handle = new this.pageHandle(handleCtorOpts);
          if (key == "rewind" || key == "back") handles.unshift(handle);
          else handles.push(handle);
        }
      }, this);

      return handles;
    },

    /**
       Render the paginator handles inside an unordered list.
    */
    render: function () {
      this.$el.empty();

      if (this.handles) {
        for (var i = 0, l = this.handles.length; i < l; i++) {
          this.handles[i].remove();
        }
      }

      var handles = this.handles = this.makeHandles();

      var ul = document.createElement("ul");
      for (var i = 0; i < handles.length; i++) {
        ul.appendChild(handles[i].render().el);
      }

      this.el.appendChild(ul);

      return this;
    }

  });

}));


text:
DynamoRIO-ARM
=============

DynamoRIO for ARM

This project wil contain a version of DynamoRIO written for ARMv7 and will initially focus on performance enhancements possible due to hardware assistance or automated parallelism. To be developed on the Cortex A15.


text:
class MessageTemplateMatcher
  include Singleton

  # Given an error message like
  #
  # ````
  # Duplicate entry 'foo@example.com' for key 'index_users_on_email': UPDATE
  # `users` SET `name` = 'Sancho Sample', `crypted_password` = '349857346384697346',
  # `updated_at` = '2012-09-23 21:18:37', `email` = 'foo@example.com' WHERE
  # `id` = 123456 -- app/controllers/api/v1/user_controller.rb:35
  # ````
  #
  # this method returns only the error portion of the message, without replacing
  # query-specific information:
  #
  # ````
  # Duplicate entry 'foo@example.com' for key 'index_users_on_email'
  # ````
  #
  # This method is useful for removing PII that would appear in a full query but
  # not an error message.
  #
  # Returns `message` unmodified if there is no match.
  #
  # @param [String] class_name The name of the exception class.
  # @param [String] message The exception message.
  # @return [String] The exception message, error portion only, or the original
  #   message if no match was found.

  def matched_substring(class_name, message)
    format_iterator(class_name) do |rx, _|
      match = message.scan(rx).first
      return match if match
    end
    return message
  end

  # Given an error message like
  #
  # ````
  # Duplicate entry 'foo@example.com' for key 'index_users_on_email': UPDATE
  # `users` SET `name` = 'Sancho Sample', `crypted_password` = '349857346384697346',
  # `updated_at` = '2012-09-23 21:18:37', `email` = 'foo@example.com' WHERE
  # `id` = 123456 -- app/controllers/api/v1/user_controller.rb:35
  # ````
  #
  # this method returns only the error portion of the message, with all
  # query-specific information filtered:
  #
  # ````
  # Duplicate entry '[STRING]' for key '[STRING]'
  # ````
  #
  # This method is useful for removing PII and grouping similar exceptions under
  # the same filtered message.
  #
  # Returns `nil` if there is no match.
  #
  # @param [String] class_name The name of the exception class.
  # @param [String] message The exception message.
  # @return [String] The filtered exception message, or `nil` if no match was
  #   found.

  def sanitized_message(class_name, message)
    format_iterator(class_name) do |rx, replacement|
      return replacement if message =~ rx
    end
    return nil
  end

  private

  def format_iterator(class_name, &block)
    (message_templates[class_name] || []).each do |pair|
      if pair.kind_of?(String)
        format_iterator pair, &block
      elsif pair.kind_of?(Array)
        yield *pair
      end
    end
  end

  def message_templates
    @message_templates ||= @message_templates ||= YAML.load_file(Rails.root.join('data', 'message_templates.yml'))
  end
end


text:
<?php

namespace Gedmo\Exception;

use Gedmo\Exception;

/**
 * FeatureNotImplementedException
 *
 * @author Gustavo Falco <comfortablynumb84@gmail.com>
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 * @package Gedmo.Exception
 * @subpackage FeatureNotImplementedException
 * @link http://www.gediminasm.org
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class FeatureNotImplementedException
    extends \RuntimeException
    implements Exception
{}


text:
import itertools

from solum.common.policies import assembly
from solum.common.policies import base
from solum.common.policies import component
from solum.common.policies import extension
from solum.common.policies import languagepack
from solum.common.policies import operation
from solum.common.policies import pipeline
from solum.common.policies import plan
from solum.common.policies import sensor
from solum.common.policies import service
from solum.common.policies import trigger

def list_rules():
    return itertools.chain(
        assembly.list_rules(),
        base.list_rules(),
        component.list_rules(),
        extension.list_rules(),
        languagepack.list_rules(),
        operation.list_rules(),
        pipeline.list_rules(),
        plan.list_rules(),
        sensor.list_rules(),
        service.list_rules(),
        trigger.list_rules(),
    )


text:
/**
 *
 * @file sg_lib.c
 *
 * @details Initialization/Cleanup of library global data.
 *
 */

//////////////////////////////////////////////////////////////////

#include <sg.h>
#include "sg_lib__private.h"

//////////////////////////////////////////////////////////////////

struct _sg_lib__global_data
{
	sg_lib_utf8__global_data * pUtf8GlobalData;
	SG_string * pVersion;
};

static sg_lib__global_data gLibData = {NULL, 0};
static SG_bool gbLibDataInitialized = SG_FALSE;

// TODO remove this and the call to it, below.
sg_repo__vtable* SG_fs3__get_vtable(void);

//////////////////////////////////////////////////////////////////

void SG_lib__global_initialize(SG_context * pCtx)
{
	if (gbLibDataInitialized)
		SG_ERR_THROW_RETURN(SG_ERR_ALREADY_INITIALIZED);

#if defined(WINDOWS) && defined(DEBUG)

	// Send run-time warnings and errors to stderr (they go to debugger output by default)
	_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
	_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);

#if defined(WINDOWS_CRT_LEAK_CHECK)
	// Turn on Windows' C runtime library debug leak checking.
	// This causes _CrtDumpMemoryLeaks() to be called when our process exits.
	// You could accomplish the same thing by adding a call to _CrtDumpMemoryLeaks
	// to _sg_mem_dump_atexit.
	{
		int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
		flags |= _CRTDBG_LEAK_CHECK_DF;
		_CrtSetDbgFlag(flags);
	}
#endif // WINDOWS_CRT_LEAK_CHECK

#if defined(SG_REAL_BUILD)
	// Send assertion failures to stderr (don't raise a dialog) when performing an official build.
	// SG_REAL_BUILD gets defined by CMAKE if there's an environment variable SPRAWL_BUILDER = 1.
	_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
	_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
#endif // SG_REAL_BUILD

#endif // WINDOWS && DEBUG

	memset(&gLibData,0,sizeof(gLibData));

	// WARNING: We assume that it is possible for the caller to have created
	// WARNING: a properly-populated SG_context before the library is initialized.
	// WARNING:
	// WARNING: That is, that the creation of the SG_context MUST NOT require any
	// WARNING: character encoding, locale, and/or UTF-8 stuff.
	// WARNING:
	// WARNING: Also, there the SG_context creation MUST NOT require us to read
	// WARNING: any local settings.
	//
	// WARNING: We also assume that stuff in SG_malloc.c can be called before the
	// WARNING: library is initialized.

	// We assume that the character encoding/locale stuff should be initialized first
	// before anyone tries to access the disk (for local settings and etc) because
	// all of the SG_fsobj__ and SG_file__ routines convert UTF-8 SG_pathnames into
	// locale-based char* or wchar_t* buffers before accessing the filesystem.

	SG_ERR_CHECK(  sg_lib_utf8__global_initialize(pCtx, &gLibData.pUtf8GlobalData)  );
	SG_ERR_CHECK(  sg_pathname__global_initialize(pCtx)  );
	SG_ERR_CHECK(  sg_closet__global_initialize(pCtx)  );
	SG_ERR_CHECK(  sg_localsettings__global_initialize(pCtx)  );

	SG_ERR_CHECK(  SG_log__global_init(pCtx)  );

#ifndef SG_IOS
	SG_ERR_CHECK(  SG_curl__global_init(pCtx)  );
#endif

	// TODO remove this and its declaration, above.
    SG_ERR_CHECK(  SG_repo__install_implementation(pCtx,  SG_fs3__get_vtable())  );

	SG_ERR_CHECK(  SG_zing__init_template_caches(pCtx)  );

    {
        SG_int64 itime = -1;
        SG_ERR_CHECK(  SG_time__get_milliseconds_since_1970_utc(pCtx, &itime)  );
        SG_random__seed((SG_uint32) itime);
    }

	SG_ERR_CHECK(  SG_STRING__ALLOC(pCtx, &gLibData.pVersion)  );
	#ifdef BUILD_CSID
		#ifdef WD_DIRTY
			#define STATUSMARK "+"
		#else
			#define STATUSMARK ""
		#endif
		SG_ERR_CHECK(  SG_string__sprintf(pCtx, gLibData.pVersion,
			"%s.%s.%s.%s (%.10s%s) [%d-bit %s]%s",
			MAJORVERSION, MINORVERSION, REVVERSION, BUILDNUMBER, BUILD_CSID, STATUSMARK,
			(SG_uint32)(sizeof(void*) * 8), SG_PLATFORM, DEBUGSTRING)  );
	#else
		SG_ERR_CHECK(  SG_string__sprintf(pCtx, gLibData.pVersion,
			"%s.%s.%s.%s [%d-bit %s]%s",
			MAJORVERSION, MINORVERSION, REVVERSION, BUILDNUMBER,
			(SG_uint32)(sizeof(void*) * 8), SG_PLATFORM, DEBUGSTRING)  );
	#endif

	gbLibDataInitialized = SG_TRUE;

	return;

fail:
	// TODO 2013/01/07 I'm going to turn this off
	// TODO            and let the caller call cleanup
	// TODO            in *their* fail block.
	// TODO            This allows their failure code to
	// TODO            call SG_console() with the existing
	// TODO            UTF8 context/converters setup.
	// SG_ERR_IGNORE(  SG_lib__global_cleanup(pCtx)  );
	return;
}

void SG_lib__global_cleanup(SG_context * pCtx)
{
#ifndef SG_IOS
	SG_curl__global_cleanup();
	SG_uridispatch__global_cleanup(pCtx);
	SG_jscore__shutdown(pCtx);
#endif
    SG_zing__now_free_all_cached_templates(pCtx);
    SG_repo__free_implementation_plugin_list(pCtx);
	SG_log__global_cleanup();
	sg_localsettings__global_cleanup(pCtx);
	sg_closet__global_cleanup(pCtx);
	sg_pathname__global_cleanup(pCtx);
	sg_lib_utf8__global_cleanup(pCtx, &gLibData.pUtf8GlobalData);

	SG_STRING_NULLFREE(pCtx, gLibData.pVersion);

	memset(&gLibData,0,sizeof(gLibData));
	gbLibDataInitialized = SG_FALSE;
}

void SG_lib__version(SG_context * pCtx, const char **ppVersion)
{
	SG_ASSERT(pCtx!=NULL);
	SG_NULLARGCHECK_RETURN(ppVersion);
	if(!gbLibDataInitialized)
		SG_ERR_THROW2_RETURN(SG_ERR_UNINITIALIZED, (pCtx, "sglib has not been initialized"));
	*ppVersion = SG_string__sz(gLibData.pVersion);
}

//////////////////////////////////////////////////////////////////

void sg_lib__fetch_utf8_global_data(SG_context * pCtx, sg_lib_utf8__global_data ** ppUtf8GlobalData)
{
	SG_NULLARGCHECK_RETURN(ppUtf8GlobalData);

	if (!gLibData.pUtf8GlobalData)
		SG_ERR_THROW_RETURN(SG_ERR_UNINITIALIZED);

	*ppUtf8GlobalData = gLibData.pUtf8GlobalData;
}


text:
#ifndef QmitkBinaryThresholdToolGUI_h_Included
#define QmitkBinaryThresholdToolGUI_h_Included

#include "QmitkToolGUI.h"
#include <MitkSegmentationUIExports.h>
#include "mitkBinaryThresholdTool.h"

#include <QDoubleSpinBox>

class QSlider;
/**
  \ingroup org_mitk_gui_qt_interactivesegmentation_internal
  \brief GUI for mitk::BinaryThresholdTool.

  This GUI shows a slider to change the tool's threshold and an OK button to accept a preview for actual thresholding.

  There is only a slider for INT values in QT. So, if the working image has a float/double pixeltype, we need to convert
  the original float intensity into a respective int value for the slider. The slider range is then between 0 and 99.

  If the pixeltype is INT, then we do not need any conversion.

  Last contributor: $Author$
*/
class MitkSegmentationUI_EXPORT QmitkBinaryThresholdToolGUI : public QmitkToolGUI
{
  Q_OBJECT

  public:

    mitkClassMacro(QmitkBinaryThresholdToolGUI, QmitkToolGUI);
    itkFactorylessNewMacro(Self)
    itkCloneMacro(Self)

    void OnThresholdingIntervalBordersChanged(double lower, double upper, bool isFloat);
    void OnThresholdingValueChanged(double current);

  signals:

    /// \brief Emitted when threshold Accepted
    void thresholdAccepted();

    /// \brief Emitted when threshold Canceled
    void thresholdCanceled();

  public slots:

  protected slots:

    void OnNewToolAssociated(mitk::Tool*);
    void OnAcceptThresholdPreview();

    /// \brief Called when Spinner value has changed. Consider: Spinner contains DOUBLE values
    void OnSpinnerValueChanged();

    /// \brief Called when Slider value has changed. Consider: Slider contains INT values
    void OnSliderValueChanged(int value);

  protected:
    QmitkBinaryThresholdToolGUI();
    virtual ~QmitkBinaryThresholdToolGUI();

    /// \brief When Slider (int value) has changed, we need to convert it to a respective double value for the spinner
    double SliderIntToDouble(int val);

    /// \brief When Spinner (double value) has changed, we need to convert it to a respective int value for the slider
    int DoubleToSliderInt(double val);

    QSlider* m_Slider;
    QDoubleSpinBox* m_Spinner;

    /// \brief is image float or int?
    bool m_isFloat;

    double m_RangeMin;
    double m_RangeMax;
    double m_Range;

    /// \brief helper bool values to find out, which of the GUI elements has been touched by the user.
    bool m_ChangingSlider, m_ChangingSpinner;

    mitk::BinaryThresholdTool::Pointer m_BinaryThresholdTool;
};

#endif


text:
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("IT.BTS.PC.Base64Decoder")]
[assembly: AssemblyDescription("A BizTalk Pipeline Component designed to decode base64 streams")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Integration.Team")]
[assembly: AssemblyProduct("IT.BTS.PC.Base64Decoder")]
[assembly: AssemblyCopyright("Copyright © Integration.Team 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4f8e7f7b-94a7-47c2-b500-1a6b71588d2d")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var platforms;
var player;
var cursors;

function preload() {
    game.load.image('ground', 'assets/platform1.png');
    game.load.spritesheet('thehero', 'assets/dude.png', 32, 48);
}

function create() {
    platforms = game.add.group();
    platforms.enableBody = true;

    var ground = platforms.create(0, game.world.height - 20, 'ground');
    ground.scale.setTo(10, 10);
    ground.body.immovable = true;

    var ledge = platforms.create(400, 400, 'ground');
    ledge = platforms.create(-150, 250, 'ground');
    ledge.body.immovable = true;

    player = game.add.sprite(32, game.world.height - 150, 'thehero');

    game.physics.arcade.enable(player);

    player.body.bounce.y = 0.2;
    player.body.gravity.y = 300;
    player.body.collideWorldBounds = true;

    player.animations.add('left', [0, 1, 2, 3], 10, true);
    player.animations.add('right', [5, 6, 7, 8], 10, true);
    cursors = game.input.keyboard.createCursorKeys();

}

function update() {
    var hitPlatform = game.physics.arcade.collide(player, platforms);
    player.body.velocity.x = 0;

        if (cursors.left.isDown)
        {
            player.body.velocity.x = -150;
            player.animations.play('left');
        }
        else if (cursors.right.isDown)
        {
            player.body.velocity.x = 150;
            player.animations.play('right');
        }
        else
        {
            player.animations.stop();
            player.frame = 4;
        }

        if (cursors.up.isDown && player.body.touching.down && hitPlatform)
        {
            player.body.velocity.y = -350;
        }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Bretagne du sud</title>

        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="description" content="Bretagne sud" />
        <meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

  <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>

<link href="css/agency.css" rel="stylesheet">
        <link href="css/circuits.css" rel="stylesheet">

        <link rel="stylesheet" type="text/css" href="style.css" />

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation
                </button>
                French Motor Trip

                        Accueil

                        Circuits

                        FAQ

                        Contact

                        Mon Compte

                          <?php if(isset($_GET['id']) AND $_GET['id'] > 0) {

                            $getid = intval($_GET['id']);
                            $requser = $bdd->prepare('SELECT * FROM membres WHERE id=?');
                            $requser->execute(array($getid));
                            $userinfo = $requser->fetch();

                            ?>

<a href="edit_profil.php?id=<?php echo $_SESSION['id']?>">Aperçu de mon compte

<a href="mes_commandes.php?id=<?php echo $_SESSION['id']?>">Mes commandes

Deconnexion

                            <?php } else { ?>

Connexion

Inscription

                            <?php } ?>

Bretagne Sud

Présentation

Le charme de la Bretagne se mesure à l'audace de ses vieilles pierres. Ici une longère typique, là une chapelle restaurée à l'identique… le patrimoine bâti donne de l'allure aux villes qui l'abritent, et offre un témoignage vivant à ses visiteurs.

Quelle moto ?

Pour votre parcours nous vous proposons une Harley Davidson 1200 Sportser XL Custom.

Restaurant

Chez les Bretons , la cuisine est une affaire de famille à laquelle on tient de génération en génération. La Bretagne est une étape gastronomique majeure du paysage français. Pour les fins gourmets comme pour les amateurs, une cuisine inventive, originale, ludique, poétique et pleine de saveurs attend les habitués comme les connaisseurs de passage

Quel parcours ?

Vous découvrez les côtes de la bretagne du sud et ridez à travers les plus beaux villages de France. Les routes variées de cet itinéraire moto France vous emmènent au cœur de régions de charme comme la Bretagne. Vous découvrez de superbes monuments historiques comme la cathédrale de Quimper ou le village de Rochefort-en-Terre. Votre voyage à moto en France vous permet de profiter pleinement des joyaux culinaires. Vivez un voyage de charme en France à moto pour redécouvrir les trésors de l'histoire française.

Enjoy

Your

Trip !

                    <?php
                    require('connection.php');
                    $destination = "Bretagne du sud";

                    $reservation_bretagne_nord = $bdd->prepare('SELECT * FROM reservations WHERE destination=?');
                    $reservation_bretagne_nord->execute(array($destination));

                    require('date.php');
                    require('config.php');
                    $date = new Date();
                    $year = date('Y');
                    $dates = $date->getAll($year);
                    $nom = $date->getNom($year);
                    $verif_unique = $date->getVerif_unique($year);
                    $nb_personne = $date->getNb_personne($year);
                    ?>

       											Calendrier Bretagne du sud

<?php echo $year; ?>

                                        <?php foreach ($date->months as $id=>$m): ?>
                                            <a class="linkMonth" href="#" id="linkMonth<?php echo $id+1; ?>"><?php echo utf8_encode(substr(utf8_decode($m),0,10)); ?>
                                        <?php endforeach; ?>

                                    <?php $dates = current($dates); ?>
                                    <?php foreach ($dates as $m=>$days): ?>
                                    <div class="month relative" id="month<?php echo $m; ?>">

                                                <?php foreach ($date ->days as $d): ?>
                                                    <?php echo substr($d,0,10); ?>
                                                <?php endforeach; ?>

                                                <?php $end = end($days); foreach ($days as $d=>$w): ?>

                                                <?php $time = strtotime("$year-$m-$d"); ?>
                                                <?php if ($d==1 and $w != 1): ?>
                                                    <td colspan="<?php echo $w-1; ?>" class="padding">
                                                <?php endif; ?>

                                                <td
                                                  <?php if($time == strtotime(date('Y-m-d'))): ?> class="today" <?php endif; // Met en évidence quel jours nous sommes

                                                  $verif_nb_personne = 0;
                                                  if (isset($verif_unique[$time])) //Grosse boucle permettant d'afficher une couleur en fonction du nombre de personne inscrites
                                                  {
                                                  foreach ($verif_unique[$time] as $e):
                                                  reset($reservation_bretagne_nord);
                                                  $reservation_bretagne_nord = $bdd->prepare("SELECT * FROM reservations WHERE destination=?");
                                                  $reservation_bretagne_nord->execute(array($destination));
                                                  while ($donnees = $reservation_bretagne_nord->fetch()) {
                                                    if ($e == $donnees['verif_unique']): ?>
                                                      <?php $verif_nb_personne = $verif_nb_personne + $donnees['nb_personne'];
                                                  endif;
                                                  }
                                                  endforeach;
                                                  }
                                                  if($verif_nb_personne >= 10): ?> style="background-color: #c0392b" <?php endif;
                                                  if($verif_nb_personne > 0): ?> style="background-color: #2980b9" <?php endif;?>>

<?php echo $d; ?>

                                                <?php if ($w == 7): ?>

                                                <?php endif; ?>
                                                <?php endforeach; ?>
                                                <?php if ($end != 7): ?>
                                                    <td colspan="<?php echo 7-$end; ?>" class="padding">
                                                <?php endif; ?>

                                    <?php endforeach; ?>

Indisponible

Il reste de la place !

complet

Contactez Nous

Nous vous répondrons le plus rapidement possible !

                                                  <form name="sentMessage" id="contactForm" novalidate>

                                                                  <input type="text" class="form-control" placeholder="nom *" id="name" required data-validation-required-message="S'il vous plaît entrez votre nom.">

                                                                  <input type="email" class="form-control" placeholder="Email *" id="email" required data-validation-required-message="S'il vous plait entrez votre adresse mail.">

                                                                  <input type="tel" class="form-control" placeholder="Telephone *" id="phone" required data-validation-required-message="S'il vous plaît entrez votre numéro de téléphone.">

                                                                  <textarea class="form-control" placeholder="Message *" id="message" required data-validation-required-message="S'il vous plaît entrez un message."></textarea>

                                                              <button type="submit" class="btn btn-xl">Envoyer message</button>

                                                  </form>

                                                      Copyright © FrenchMotorTrip 2016

Conditions générales

Termes d'usage


text:
layout: page
title: Thanks For Your Message
permalink: /thanks/
---

Thanks for contacting us. We will reply as soon as possible.
Gracias por contactar con nosotros, le contestaremos lo antes posible.


text:
@implementation RACSignal

#pragma mark Lifecycle

+ (RACSignal *)create:(void (^)(id<RACSubscriber> subscriber))didSubscribe {
	return [RACDynamicSignal create:didSubscribe];
}

+ (RACSignal *)error:(NSError *)error {
	return [RACErrorSignal error:error];
}

+ (RACSignal *)never {
	return [[self create:^(id<RACSubscriber> subscriber) {
		// Do nothing. This will cause the signal to live indefinitely unless
		// interrupted in some way.
	}] setNameWithFormat:@"+never"];
}

+ (RACSignal *)empty {
	return [RACEmptySignal empty];
}

+ (RACSignal *)return:(id)value {
	return [RACReturnSignal return:value];
}

#pragma mark Subscription

- (void)attachSubscriber:(RACLiveSubscriber *)subscriber {
	NSCAssert(NO, @"This method must be overridden by subclasses.");
}

#pragma mark NSObject

- (NSString *)description {
	return [NSString stringWithFormat:@"<%@: %p> name: %@", self.class, self, self.name];
}

@end

@implementation RACSignal (Subscription)

- (RACDisposable *)subscribe:(id<RACSubscriber>)subscriber {
	RACLiveSubscriber *liveSubscriber;
	if (subscriber == nil) {
		liveSubscriber = [RACLiveSubscriber subscriberWithNext:nil error:nil completed:nil];
	} else {
		liveSubscriber = [RACLiveSubscriber subscriberForwardingToSubscriber:subscriber];
	}

	liveSubscriber.signal = self;

	[self attachSubscriber:liveSubscriber];
	return liveSubscriber.disposable;
}

- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock {
	return [self subscribeNext:nextBlock error:nil completed:nil];
}

- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock completed:(void (^)(void))completedBlock {
	return [self subscribeNext:nextBlock error:nil completed:completedBlock];
}

- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock {
	RACLiveSubscriber *subscriber = [RACLiveSubscriber subscriberWithNext:nextBlock error:errorBlock completed:completedBlock];
	subscriber.signal = self;

	[self attachSubscriber:subscriber];
	return subscriber.disposable;
}

- (RACDisposable *)subscribeError:(void (^)(NSError *error))errorBlock {
	return [self subscribeNext:nil error:errorBlock completed:nil];
}

- (RACDisposable *)subscribeCompleted:(void (^)(void))completedBlock {
	return [self subscribeNext:nil error:nil completed:completedBlock];
}

- (RACDisposable *)subscribeNext:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock {
	return [self subscribeNext:nextBlock error:errorBlock completed:nil];
}

- (RACDisposable *)subscribeError:(void (^)(NSError *))errorBlock completed:(void (^)(void))completedBlock {
	return [self subscribeNext:nil error:errorBlock completed:completedBlock];
}

- (void)subscribeSavingDisposable:(void (^)(RACDisposable *))saveDisposableBlock next:(void (^)(id x))nextBlock error:(void (^)(NSError *error))errorBlock completed:(void (^)(void))completedBlock {
	NSCParameterAssert(saveDisposableBlock != nil);

	RACLiveSubscriber *subscriber = [RACLiveSubscriber subscriberWithNext:nextBlock error:errorBlock completed:completedBlock];
	subscriber.signal = self;

	saveDisposableBlock(subscriber.disposable);
	[self attachSubscriber:subscriber];
}

@end

@implementation RACSignal (Debugging)

@dynamic name;

- (instancetype)setNameWithFormat:(NSString *)format, ... {
	// This implementation is copied from RACStream because lolvarargs.
	//
	// Once RACStream is actually removed, this will be the sole implementation.

#ifdef DEBUG
	NSCParameterAssert(format != nil);

	va_list args;
	va_start(args, format);

	NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
	va_end(args);

	self.name = str;
#endif

	return self;
}

- (RACSignal *)logAll {
	return [[[self logNext] logError] logCompleted];
}

- (RACSignal *)logNext {
	return [[self doNext:^(id x) {
		NSLog(@"%@ next: %@", self, x);
	}] setNameWithFormat:@"%@", self.name];
}

- (RACSignal *)logError {
	return [[self doError:^(NSError *error) {
		NSLog(@"%@ error: %@", self, error);
	}] setNameWithFormat:@"%@", self.name];
}

- (RACSignal *)logCompleted {
	return [[self doCompleted:^{
		NSLog(@"%@ completed", self);
	}] setNameWithFormat:@"%@", self.name];
}

@end

@implementation RACSignal (Testing)

static const NSTimeInterval RACSignalAsynchronousWaitTimeout = 10;

- (id)asynchronousFirstOrDefault:(id)defaultValue success:(BOOL *)success error:(NSError **)error {
	NSCAssert([NSThread isMainThread], @"%s should only be used from the main thread", __func__);

	__block id result = defaultValue;
	__block BOOL done = NO;

	// Ensures that we don't pass values across thread boundaries by reference.
	__block NSError *localError;
	__block BOOL localSuccess = YES;

	[[[[self
		take:1]
		timeout:RACSignalAsynchronousWaitTimeout onScheduler:[RACScheduler scheduler]]
		deliverOn:RACScheduler.mainThreadScheduler]
		subscribeNext:^(id x) {
			result = x;
			done = YES;
		} error:^(NSError *e) {
			if (!done) {
				localSuccess = NO;
				localError = e;
				done = YES;
			}
		} completed:^{
			done = YES;
		}];

	do {
		[NSRunLoop.mainRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
	} while (!done);

	if (success != NULL) *success = localSuccess;
	if (error != NULL) *error = localError;

	return result;
}

- (BOOL)asynchronouslyWaitUntilCompleted:(NSError **)error {
	BOOL success = NO;
	[[self ignoreValues] asynchronousFirstOrDefault:nil success:&success error:error];
	return success;
}

@end

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"

@implementation RACSignal (Deprecated)

+ (RACSignal *)createSignal:(RACDisposable * (^)(id<RACSubscriber> subscriber))didSubscribe {
	return [self create:^(id<RACSubscriber> subscriber) {
		[subscriber.disposable addDisposable:didSubscribe(subscriber)];
	}];
}

+ (RACSignal *)startEagerlyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block {
	NSCParameterAssert(scheduler != nil);
	NSCParameterAssert(block != NULL);

	RACSignal *signal = [self startLazilyWithScheduler:scheduler block:block];
	// Subscribe to force the lazy signal to call its block.
	[[signal publish] connect];
	return [signal setNameWithFormat:@"+startEagerlyWithScheduler:%@ block:", scheduler];
}

+ (RACSignal *)startLazilyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block {
	NSCParameterAssert(scheduler != nil);
	NSCParameterAssert(block != NULL);

	RACMulticastConnection *connection = [[RACSignal
		createSignal:^ id (id<RACSubscriber> subscriber) {
			block(subscriber);
			return nil;
		}]
		multicast:[RACReplaySubject subject]];

	return [[[RACSignal
		createSignal:^ id (id<RACSubscriber> subscriber) {
			[connection.signal subscribe:subscriber];
			[connection connect];
			return nil;
		}]
		subscribeOn:scheduler]
		setNameWithFormat:@"+startLazilyWithScheduler:%@ block:", scheduler];
}

@end

#pragma clang diagnostic pop


text:
<!DOCTYPE html>

  {% include head.html %}

    {% include sidebar.html %}

            {{ site.title }}
            {{ site.tagline }}

        {{ content }}


text:
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))

require 'chef/run_context'

describe Chef::Provider::Ohai do
  before(:each) do
    # Copied from client_spec
    @fqdn = "hostname.domainname"
    @hostname = "hostname"
    @platform = "example-platform"
    @platform_version = "example-platform"
    Chef::Config[:node_name] = @fqdn
    mock_ohai = {
      :fqdn => @fqdn,
      :hostname => @hostname,
      :platform => @platform,
      :platform_version => @platform_version,
      :data => {
        :origdata => "somevalue"
      },
      :data2 => {
        :origdata => "somevalue",
        :newdata => "somevalue"
      }
    }
    mock_ohai.stub!(:all_plugins).and_return(true)
    mock_ohai.stub!(:require_plugin).and_return(true)
    mock_ohai.stub!(:data).and_return(mock_ohai[:data],
                                      mock_ohai[:data2])
    Ohai::System.stub!(:new).and_return(mock_ohai)
    Chef::Platform.stub!(:find_platform_and_version).and_return({ "platform" => @platform,
                                                                  "platform_version" => @platform_version})
    # Fake node with a dummy save
    @node = Chef::Node.new(@hostname)
    @node.name(@fqdn)
    @node.stub!(:save).and_return(@node)
    @run_context = Chef::RunContext.new(@node, {})
    @new_resource = Chef::Resource::Ohai.new("ohai_reload")
    ohai = Ohai::System.new
    ohai.all_plugins
    @node.process_external_attrs(ohai.data,{})

    @provider = Chef::Provider::Ohai.new(@new_resource, @run_context)
  end

  describe "when reloading ohai" do
    before do
      @node[:origdata] = 'somevalue'
    end

    it "applies updated ohai data to the node" do
      @node[:origdata].should == 'somevalue'
      @node[:newdata].should be_nil
      @provider.action_reload
      @node[:origdata].should == 'somevalue'
      @node[:newdata].should == 'somevalue'
    end

    it "should reload a specific plugin and cause node to pick up new values" do
      @new_resource.plugin "someplugin"
      @provider.action_reload
      @node[:origdata].should == 'somevalue'
      @node[:newdata].should == 'somevalue'
    end
  end
end


text:
<?php

namespace tomzx\Collections\Test\EvictionPolicy;

use tomzx\Collections\EvictionPolicy\FirstInFirstOut;

class FirstInFirstOutTest extends \PHPUnit_Framework_TestCase {
	/**
	 * @var \tomzx\Collections\EvictionPolicy\FirstInFirstOut
	 */
	protected $evictionPolicy;

	public function setUp()
	{
		parent::setUp();

		$this->evictionPolicy = new FirstInFirstOut();
	}

	/**
	 * @dataProvider removeProvider
	 */
	public function testRemove($inputs, $outputs)
	{
		foreach ($inputs as $input) {
			$this->evictionPolicy->touch($input);
		}

		foreach ($outputs as $output) {
			$this->assertSame($output, $this->evictionPolicy->remove());
		}
		$this->assertSame(null, $this->evictionPolicy->remove());
	}

	public function removeProvider()
	{
		return [
			[[0], [0]],
			[[0, 1, 1, 0], [0, 1]],
			[[1, 0, 1, 0], [1, 0]],
			[[1, 2, 3, 4, 5, 1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],
		];
	}

	public function testTouch()
	{
		$this->evictionPolicy->touch(0);
	}
}


text:
#pragma once

#include "api_core.h"   // MUST BE BEFORE QtWidgets.h or any other Qt header.
#include "attribute.h"
#include "igui.h"
#include "coreservices/irawlistener.h"
#include "coreservices/iserial.h"

#include <QtCore/QBasicTimer>
#include <QtWidgets/QMenu>
#include <QtWidgets/QWidget>
#include <QtGui/qevent.h>
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMdiSubWindow>
#include "StreetMapObject.h"

namespace debugger {

class SlideAverageType {
public:
    SlideAverageType(int sz = 32) {
        size_ = sz;
        data_ = new double [2*sz];
        clear();
    }
    ~SlideAverageType() {
        delete [] data_;
    }
    void put(double v) {
        if (--pcur_ < data_) {
            pcur_ = &data_[size_ - 1];
        }
        avg_sum_ -= *pcur_;
        *pcur_ = *(pcur_ + size_) = v;
        avg_sum_ += v;
        if (avg_cnt_ < size_) {
            avg_cnt_++;
        }
    }
    double *getp() {
        return pcur_;
    }
    double get_avg() {
        return avg_cnt_ == 0 ? 0 : avg_sum_/avg_cnt_;
    }
    int size() {
        return avg_cnt_;
    }
    void clear() {
        pcur_ = &data_[size_];
        avg_cnt_ = 0;
        avg_sum_ = 0;
        memset(data_, 0, 2*size_*sizeof(double));
    }
private:
    int size_;
    double *data_;
    double *pcur_;
    double avg_cnt_;
    double avg_sum_;
};

class MapWidget : public QWidget,
                  public IRawListener {
    Q_OBJECT
public:
    MapWidget(IGui *igui, QWidget *parent);
    virtual ~MapWidget();

    /** IRawListener */
    virtual int updateData(const char *buf, int buflen);

signals:
    void signalRequestNetworkData();
    void signalUpdateGnssRaw();
public slots:
    void slotUpdateGnssRaw();
    void slotTilesUpdated(QRect);
    void slotRightClickMenu(const QPoint &p);
    void slotActionClear();
    void slotActionNightMode();

protected:
    void renderAll();
    void renderMinimap();
    void renderPosInfo(QPainter &p);
    void renderMainMap();
    void renderTrack(int trkIdx, QPainter &p);

    void resizeEvent(QResizeEvent *);
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *);
    void keyPressEvent(QKeyEvent *event);

private:
    IGui *igui_;
    ISerial *uart_;

    // Gnss parser's data
    char gnssBuf_[1 << 16];
    int gnssBufCnt_;
    int gnssBraceCnt_;
    Reg64Type gnssMagicNumber_;
    bool gnssIsParsing_;
    AttributeType gnssRawMeas_;

    bool bNewDataAvailable;

    StreetMap *m_normalMap;
    StreetMap *m_miniMap;
    bool pressed;
    QPoint pressPos;
    QFont fontPos;

    QSize mainmapSize;
    QPixmap mainmapPixmap;

    QSize posinfoSize;
    QPixmap posinfoPixmap;

    int minimapRadius;
    int minimapInnerRadius;
    QSize minimapSize;
    QPoint minimapPosition;
    QPoint minimapCenter;
    QPixmap minimapPixmap;
    QPixmap minimapPixmapMask;
    QMenu *contextMenu;
    bool invert;

    SlideAverageType gpsLat_;
    SlideAverageType gpsLon_;
};

class MapQMdiSubWindow : public QMdiSubWindow {
    Q_OBJECT
public:
    MapQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
                      QAction *act)
        : QMdiSubWindow(parent) {
        setAttribute(Qt::WA_DeleteOnClose);
        action_ = act;
        area_ = area;

        setWindowTitle(tr("Map"));
        setMinimumWidth(parent->size().width() / 2);
        setMinimumHeight(parent->size().height() / 2);
        QWidget *pnew = new MapWidget(igui, this);
        setWindowIcon(act->icon());
        act->setChecked(true);
        setWidget(pnew);
        area_->addSubWindow(this);
        show();
    }

protected:
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
        if (action_) {
            action_->setChecked(false);
        }
        area_->removeSubWindow(this);
        event_->accept();
    }
private:
    QAction *action_;
    QMdiArea *area_;
};

}  // namespace debugger


text:
var should = require('should'), // eslint-disable-line no-unused-vars
    utils = require('./utils'),
    thisCheck = require('../lib/checks/005-template-compile');

describe('005 Template compile', function () {
    describe('v1', function () {
        const options = {checkVersion: 'v1'};

        it('should output empty array for a theme with no templates', function (done) {
            utils.testCheck(thisCheck, 'is-empty', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output empty array for a theme with valid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v1/valid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v1/invalid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(4);

                failures[0].ref.should.eql('author.hbs');
                failures[0].message.should.match(/^Missing helper: "bla"/);

                failures[1].ref.should.eql('index.hbs');
                failures[1].message.should.match(/^The partial my-partial could not be found/);

                failures[2].ref.should.eql('page.hbs');
                failures[2].message.should.match(/^Parse error on line 2/);

                failures[3].ref.should.eql('post.hbs');
                failures[3].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('theme with partials and unknown helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v1/invalid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                done();
            }).catch(done);
        });

        it('theme with block partials', function (done) {
            utils.testCheck(thisCheck, 'theme-with-block-partials').then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.empty();
                done();
            }).catch(done);
        });
    });

    describe('v2', function () {
        const options = {checkVersion: 'v2'};

        it('should output empty array for a theme with no templates', function (done) {
            utils.testCheck(thisCheck, 'is-empty', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output empty array for a theme with valid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v2/valid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v2/invalid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(4);

                failures[0].ref.should.eql('author.hbs');
                failures[0].message.should.match(/^Missing helper: "bla"/);

                failures[1].ref.should.eql('index.hbs');
                failures[1].message.should.match(/^The partial my-partial could not be found/);

                failures[2].ref.should.eql('page.hbs');
                failures[2].message.should.match(/^Parse error on line 2/);

                failures[3].ref.should.eql('post.hbs');
                failures[3].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('theme with partials and unknown helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v2/invalid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                done();
            }).catch(done);
        });

        it('theme with block partials', function (done) {
            utils.testCheck(thisCheck, 'theme-with-block-partials').then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.empty();
                done();
            }).catch(done);
        });
    });

    describe('v3', function () {
        const options = {checkVersion: 'v3'};

        it('should output empty array for a theme with no templates', function (done) {
            utils.testCheck(thisCheck, 'is-empty', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output empty array for a theme with valid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v3/valid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v3/invalid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(4);

                failures[0].ref.should.eql('author.hbs');
                failures[0].message.should.match(/^Missing helper: "bla"/);

                failures[1].ref.should.eql('index.hbs');
                failures[1].message.should.match(/^The partial my-partial could not be found/);

                failures[2].ref.should.eql('page.hbs');
                failures[2].message.should.match(/^Parse error on line 2/);

                failures[3].ref.should.eql('post.hbs');
                failures[3].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('theme with partials and unknown helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v3/invalid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                done();
            }).catch(done);
        });

        it('theme with partials and known helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v3/valid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('theme with block partials', function (done) {
            utils.testCheck(thisCheck, 'theme-with-block-partials').then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.empty();
                done();
            }).catch(done);
        });
    });

    describe('v4', function () {
        const options = {checkVersion: 'v4'};

        it('should output empty array for a theme with no templates', function (done) {
            utils.testCheck(thisCheck, 'is-empty', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output empty array for a theme with valid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/valid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid templates', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(4);

                failures[0].ref.should.eql('author.hbs');
                failures[0].message.should.match(/^Missing helper: "bla"/);

                failures[1].ref.should.eql('index.hbs');
                failures[1].message.should.match(/^The partial my-partial could not be found/);

                failures[2].ref.should.eql('page.hbs');
                failures[2].message.should.match(/^Parse error on line 2/);

                failures[3].ref.should.eql('post.hbs');
                failures[3].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid partials', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-partial', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(1);

                failures[0].ref.should.eql('partials/invalid-partial.hbs');
                failures[0].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('should output errors for a theme with invalid folder partials', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-partial-folder', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(1);

                failures[0].ref.should.eql('partials/folder/invalid-partial.hbs');
                failures[0].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('should output errors for a theme in subfolders', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-folder', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(1);

                failures[0].ref.should.eql('folder/invalid-template.hbs');
                failures[0].message.should.match(/^Missing helper: "my-helper"/);

                done();
            }).catch(done);
        });

        it('theme with partials and unknown helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                done();
            }).catch(done);
        });

        it('theme with invalid inline partials', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-with-inline-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();
                output.results.fail['GS005-TPL-ERR'].failures.length.should.be.eql(1);
                output.results.fail['GS005-TPL-ERR'].failures[0].ref.should.be.eql('index.hbs');
                output.results.fail['GS005-TPL-ERR'].failures[0].message.should.containEql('myInlinePartial');

                done();
            }).catch(done);
        });

        it('theme with invalid inline partial', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-with-inline-partials-2', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                done();
            }).catch(done);
        });

        it('theme with inlined dynamic partial', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/invalid-with-dynamic-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();
                output.results.fail['GS005-TPL-ERR'].failures.length.should.be.eql(1);
                output.results.fail['GS005-TPL-ERR'].failures[0].ref.should.be.eql('post.hbs');
                output.results.fail['GS005-TPL-ERR'].failures[0].message.should.containEql('Inlined dynamic partials');

                done();
            }).catch(done);
        });

        it('theme with bloc dynamic partial', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/valid-with-dynamic-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('theme with partials and known helper', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/valid-with-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                done();
            }).catch(done);
        });

        it('theme with invalid block partials', function (done) {
            utils.testCheck(thisCheck, 'theme-with-block-partials').then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.empty();
                done();
            }).catch(done);
        });

        it('Detects missing partials in code flows', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/missing-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();
                output.results.pass.should.be.an.Array().which.is.empty();

                output.results.fail.should.be.an.Object().with.keys('GS005-TPL-ERR');
                output.results.fail['GS005-TPL-ERR'].should.be.a.ValidFailObject();

                var failures = output.results.fail['GS005-TPL-ERR'].failures;

                failures.length.should.eql(1);

                failures[0].ref.should.eql('index.hbs');
                failures[0].message.should.match(/^The partial missingpartial could not be found/);

                done();
            }).catch(done);
        });

        it('Lists but not wastes time on processing unused partials', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/unused-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                output.partials.should.be.an.Array().with.lengthOf(1);
                output.partials.should.containEql('mypartial');

                done();
            }).catch(done);
        });

        it('Ignores self referencing partials', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/recursive-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                output.results.pass.should.be.an.Array().with.lengthOf(1);
                output.results.pass.should.containEql('GS005-TPL-ERR');

                output.partials.should.be.an.Array().with.lengthOf(1);
                output.partials.should.containEql('recursive');

                done();
            }).catch(done);
        });

        it('lists used helpers', function (done) {
            utils.testCheck(thisCheck, '005-compile/v4/unused-partials', options).then(function (output) {
                output.should.be.a.ValidThemeObject();

                output.results.fail.should.be.an.Object().which.is.empty();

                let helperList = Object.keys(output.helpers);
                helperList.should.be.an.Array().with.lengthOf(1);
                helperList.should.containEql('cancel_link');

                done();
            }).catch(done);
        });
    });
});