text:
{-# LANGUAGE ForeignFunctionInterface, GeneralizedNewtypeDeriving #-}

module Numerical.HBLAS.BLAS.FFI.Level1  where

import Foreign.Ptr
import Foreign()
import Foreign.C.Types
import Data.Complex

type AsumFunFFI el res = CInt -> Ptr el -> CInt -> IO res
foreign import ccall unsafe "cblas_sasum" cblas_sasum_unsafe::
  AsumFunFFI Float Float
foreign import ccall unsafe "cblas_dasum" cblas_dasum_unsafe::
  AsumFunFFI Double Double
foreign import ccall unsafe "cblas_scasum" cblas_scasum_unsafe::
  AsumFunFFI (Complex Float) Float
foreign import ccall unsafe "cblas_dzasum" cblas_dzasum_unsafe::
  AsumFunFFI (Complex Double) Double

foreign import ccall "cblas_sasum" cblas_sasum_safe::
  AsumFunFFI Float Float
foreign import ccall "cblas_dasum" cblas_dasum_safe ::
  AsumFunFFI Double Double
foreign import ccall "cblas_scasum" cblas_scasum_safe ::
  AsumFunFFI (Complex Float) Float
foreign import ccall "cblas_dzasum" cblas_dzasum_safe ::
  AsumFunFFI (Complex Double) Double
--Float  cblas_sasum (  CInt n,   Float  *x,   CInt incx);
--Double cblas_dasum (  CInt n,   Double *x,   CInt incx);
--Float  cblas_scasum(  CInt n,   Float  *x,   CInt incx);
--Double cblas_dzasum(  CInt n,   Double *x,   CInt incx);

type AxpyFunFFI scale el = CInt -> scale -> Ptr el -> CInt -> Ptr el -> CInt -> IO ()
foreign import ccall unsafe "cblas_saxpy" cblas_saxpy_unsafe::
  AxpyFunFFI Float Float
foreign import ccall unsafe "cblas_daxpy" cblas_daxpy_unsafe::
  AxpyFunFFI Double Double
foreign import ccall unsafe "cblas_caxpy" cblas_caxpy_unsafe::
  AxpyFunFFI (Ptr (Complex Float )) (Complex Float )
foreign import ccall unsafe "cblas_zaxpy" cblas_zaxpy_unsafe::
  AxpyFunFFI (Ptr (Complex Double)) (Complex Double)

foreign import ccall "cblas_saxpy" cblas_saxpy_safe::
  AxpyFunFFI Float Float
foreign import ccall "cblas_daxpy" cblas_daxpy_safe::
  AxpyFunFFI Double Double
foreign import ccall "cblas_caxpy" cblas_caxpy_safe::
  AxpyFunFFI (Ptr (Complex Float )) (Complex Float )
foreign import ccall "cblas_zaxpy" cblas_zaxpy_safe::
  AxpyFunFFI (Ptr (Complex Double)) (Complex Double)
--void cblas_saxpy(  CInt n,   Float alpha,   Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_daxpy(  CInt n,   Double alpha,   Double *x,   CInt incx, Double *y,   CInt incy);
--void cblas_caxpy(  CInt n,   Float *alpha,   Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_zaxpy(  CInt n,   Double *alpha,   Double *x,   CInt incx, Double *y,   CInt incy);

type CopyFunFFI el = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> IO ()
foreign import ccall unsafe "cblas_scopy" cblas_scopy_unsafe ::
    CopyFunFFI Float
foreign import ccall unsafe "cblas_dcopy" cblas_dcopy_unsafe ::
    CopyFunFFI Double
foreign import ccall unsafe "cblas_ccopy" cblas_ccopy_unsafe ::
    CopyFunFFI (Complex Float)
foreign import ccall unsafe "cblas_zcopy" cblas_zcopy_unsafe ::
    CopyFunFFI (Complex Double)

foreign import ccall "cblas_scopy" cblas_scopy_safe ::
    CopyFunFFI Float
foreign import ccall "cblas_dcopy" cblas_dcopy_safe ::
    CopyFunFFI Double
foreign import ccall "cblas_ccopy" cblas_ccopy_safe ::
    CopyFunFFI (Complex Float)
foreign import ccall "cblas_zcopy" cblas_zcopy_safe ::
    CopyFunFFI (Complex Double)
--void cblas_scopy(  CInt n,   Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_dcopy(  CInt n,   Double *x,   CInt incx, Double *y,   CInt incy);
--void cblas_ccopy(  CInt n,   Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_zcopy(  CInt n,   Double *x,   CInt incx, Double *y,   CInt incy);

--dot products
type NoScalarDotFunFFI el res = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> IO res
-- type ScalarDotFunFFI el res = CInt -> el -> Ptr el -> CInt -> Ptr el -> CInt -> IO res
type SdsdotFortranFunFFI el res = Ptr CInt -> Ptr el -> Ptr el -> Ptr CInt -> Ptr el -> Ptr CInt -> IO res
foreign import ccall "sdsdot_" cblas_sdsdot_safe :: SdsdotFortranFunFFI Float Float
foreign import ccall "cblas_dsdot" cblas_dsdot_safe :: NoScalarDotFunFFI Float Double
foreign import ccall "cblas_sdot" cblas_sdot_safe :: NoScalarDotFunFFI Float Float
foreign import ccall "cblas_ddot" cblas_ddot_safe :: NoScalarDotFunFFI Double Double

foreign import ccall unsafe "sdsdot_" cblas_sdsdot_unsafe :: SdsdotFortranFunFFI Float Float
foreign import ccall unsafe "cblas_dsdot" cblas_dsdot_unsafe :: NoScalarDotFunFFI Float Double
foreign import ccall unsafe "cblas_sdot" cblas_sdot_unsafe :: NoScalarDotFunFFI Float Float
foreign import ccall unsafe "cblas_ddot" cblas_ddot_unsafe :: NoScalarDotFunFFI Double Double
--Float  cblas_sdsdot(  CInt n,   Float alpha,   Float *x,   CInt incx,   Float *y,   CInt incy);
--Double cblas_dsdot (  CInt n,   Float *x,   CInt incx,   Float *y,   CInt incy);
--Float  cblas_sdot(  CInt n,   Float  *x,   CInt incx,   Float  *y,   CInt incy);
--Double cblas_ddot(  CInt n,   Double *x,   CInt incx,   Double *y,   CInt incy);

--complex dot products that CONJUGATE end in C, others end in U
type ComplexDotFunFFI el = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> Ptr el -> IO ()
foreign import ccall "cblas_cdotu_sub" cblas_cdotu_safe :: ComplexDotFunFFI (Complex Float)
foreign import ccall "cblas_cdotc_sub" cblas_cdotc_safe :: ComplexDotFunFFI (Complex Float)
foreign import ccall "cblas_zdotu_sub" cblas_zdotu_safe :: ComplexDotFunFFI (Complex Double)
foreign import ccall "cblas_zdotc_sub" cblas_zdotc_safe :: ComplexDotFunFFI (Complex Double)

foreign import ccall unsafe "cblas_cdotu_sub" cblas_cdotu_unsafe :: ComplexDotFunFFI (Complex Float)
foreign import ccall unsafe "cblas_cdotc_sub" cblas_cdotc_unsafe :: ComplexDotFunFFI (Complex Float)
foreign import ccall unsafe "cblas_zdotu_sub" cblas_zdotu_unsafe :: ComplexDotFunFFI (Complex Double)
foreign import ccall unsafe "cblas_zdotc_sub" cblas_zdotc_unsafe :: ComplexDotFunFFI (Complex Double)
--void cblas_cdotu(CInt n, void *x, CInt incx, void *y, CInt incy, void *res);
--void cblas_cdotc(CInt n, void *x, CInt incx, void *y, CInt incy, void *res);
--void cblas_zdotu(CInt n, void *x, CInt incx, void *y, CInt incy, void *res);
--void cblas_zdotc(CInt n, void *x, CInt incx, void *y, CInt incy, void *res);

--Computes the Euclidean norm of a vector.
type Nrm2FunFFI el res = CInt -> Ptr el -> CInt -> IO res
foreign import ccall "cblas_snrm2" cblas_snrm2_safe :: Nrm2FunFFI Float Float
foreign import ccall "cblas_dnrm2" cblas_dnrm2_safe :: Nrm2FunFFI Double Double
foreign import ccall "cblas_scnrm2" cblas_scnrm2_safe :: Nrm2FunFFI (Complex Float) Float
foreign import ccall "cblas_dznrm2" cblas_dznrm2_safe :: Nrm2FunFFI (Complex Double) Double

foreign import ccall unsafe "cblas_snrm2" cblas_snrm2_unsafe :: Nrm2FunFFI Float Float
foreign import ccall unsafe "cblas_dnrm2" cblas_dnrm2_unsafe :: Nrm2FunFFI Double Double
foreign import ccall unsafe "cblas_scnrm2" cblas_scnrm2_unsafe :: Nrm2FunFFI (Complex Float) Float
foreign import ccall unsafe "cblas_dznrm2" cblas_dznrm2_unsafe :: Nrm2FunFFI (Complex Double) Double
--Float  cblas_snrm2 (  CInt N,   Float  *X,   CInt incX);
--Double cblas_dnrm2 (  CInt N,   Double *X,   CInt incX);
--Float  cblas_scnrm2(  CInt N,   void  *X,   CInt incX);
--Double cblas_dznrm2(  CInt N,   void  *X,   CInt incX);

--Performs rotation of points in the plane.
type RotFunFFI el = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> el -> el -> IO ()
foreign import ccall "cblas_srot" cblas_srot_safe :: RotFunFFI Float
foreign import ccall "cblas_drot" cblas_drot_safe :: RotFunFFI Double

foreign import ccall unsafe "cblas_srot" cblas_srot_unsafe :: RotFunFFI Float
foreign import ccall unsafe "cblas_drot" cblas_drot_unsafe :: RotFunFFI Double
--void cblas_srot(  CInt N, Float *X,   CInt incX, Float *Y,   CInt incY,   Float c,   Float s);
--void cblas_drot(  CInt N, Double *X,   CInt incX, Double *Y,   CInt incY,   Double c,   Double  s);

type RotgFunFFI el = Ptr el -> Ptr el -> Ptr el -> Ptr el -> IO ()
foreign import ccall "cblas_srotg" cblas_srotg_safe :: RotgFunFFI Float
foreign import ccall "cblas_drotg" cblas_drotg_safe :: RotgFunFFI Double

foreign import ccall unsafe "cblas_srotg" cblas_srotg_unsafe :: RotgFunFFI Float
foreign import ccall unsafe "cblas_drotg" cblas_drotg_unsafe :: RotgFunFFI Double
--void cblas_srotg(Float *a, Float *b, Float *c, Float *s);
--void cblas_drotg(Double *a, Double *b, Double *c, Double *s);

type RotmFunFFI el = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> Ptr el -> IO ()
foreign import ccall "cblas_srotm" cblas_srotm_safe :: RotmFunFFI Float
foreign import ccall "cblas_drotm" cblas_drotm_safe :: RotmFunFFI Double

foreign import ccall unsafe "cblas_srotm" cblas_srotm_unsafe :: RotmFunFFI Float
foreign import ccall unsafe "cblas_drotm" cblas_drotm_unsafe :: RotmFunFFI Double
--void cblas_srotm(  CInt N, Float *X,   CInt incX, Float *Y,   CInt incY,   Float *P);
--void cblas_drotm(  CInt N, Double *X,   CInt incX, Double *Y,   CInt incY,   Double *P);

type RotmgFunFFI el = Ptr el -> Ptr el -> Ptr el -> el -> Ptr el -> IO ()
foreign import ccall "cblas_srotmg" cblas_srotmg_safe :: RotmgFunFFI Float
foreign import ccall "cblas_drotmg" cblas_drotmg_safe :: RotmgFunFFI Double

foreign import ccall unsafe "cblas_srotmg" cblas_srotmg_unsafe :: RotmgFunFFI Float
foreign import ccall unsafe "cblas_drotmg" cblas_drotmg_unsafe :: RotmgFunFFI Double
--void cblas_srotmg(Float *d1, Float *d2, Float *b1,   Float b2, Float *P);
--void cblas_drotmg(Double *d1, Double *d2, Double *b1,   Double b2, Double *P);

type ScalFunFFI scale el = CInt -> scale -> Ptr el -> CInt -> IO ()
foreign import ccall "cblas_sscal" cblas_sscal_safe :: ScalFunFFI Float Float
foreign import ccall "cblas_dscal" cblas_dscal_safe :: ScalFunFFI Double Double
foreign import ccall "cblas_cscal" cblas_cscal_safe :: ScalFunFFI (Ptr (Complex Float)) (Complex Float)
foreign import ccall "cblas_zscal" cblas_zscal_safe :: ScalFunFFI (Ptr (Complex Double)) (Complex Double)
foreign import ccall "cblas_csscal" cblas_csscal_safe :: ScalFunFFI Float (Complex Float)
foreign import ccall "cblas_zdscal" cblas_zdscal_safe :: ScalFunFFI Double (Complex Double)

foreign import ccall unsafe "cblas_sscal" cblas_sscal_unsafe :: ScalFunFFI Float Float
foreign import ccall unsafe "cblas_dscal" cblas_dscal_unsafe :: ScalFunFFI Double Double
foreign import ccall unsafe "cblas_cscal" cblas_cscal_unsafe :: ScalFunFFI (Ptr (Complex Float)) (Complex Float)
foreign import ccall unsafe "cblas_zscal" cblas_zscal_unsafe :: ScalFunFFI (Ptr (Complex Double)) (Complex Double)
foreign import ccall unsafe "cblas_csscal" cblas_csscal_unsafe :: ScalFunFFI Float (Complex Float)
foreign import ccall unsafe "cblas_zdscal" cblas_zdscal_unsafe :: ScalFunFFI Double (Complex Double)
--void cblas_sscal(  CInt N,   Float alpha, Float *X,   CInt incX);
--void cblas_dscal(  CInt N,   Double alpha, Double *X,   CInt incX);
--void cblas_cscal(  CInt N,   Float *alpha, Float *X,   CInt incX);
--void cblas_zscal(  CInt N,   Double *alpha, Double *X,   CInt incX);
--void cblas_csscal(  CInt N,   Float alpha, Float *X,   CInt incX);
--void cblas_zdscal(  CInt N,   Double alpha, Double *X,   CInt incX);

type SwapFunFFI el = CInt -> Ptr el -> CInt -> Ptr el -> CInt -> IO ()
foreign import ccall "cblas_sswap" cblas_sswap_safe :: SwapFunFFI Float
foreign import ccall "cblas_dswap" cblas_dswap_safe :: SwapFunFFI Double
foreign import ccall "cblas_cswap" cblas_cswap_safe :: SwapFunFFI (Complex Float)
foreign import ccall "cblas_zswap" cblas_zswap_safe :: SwapFunFFI (Complex Double)

foreign import ccall unsafe "cblas_sswap" cblas_sswap_unsafe :: SwapFunFFI Float
foreign import ccall unsafe "cblas_dswap" cblas_dswap_unsafe :: SwapFunFFI Double
foreign import ccall unsafe "cblas_cswap" cblas_cswap_unsafe :: SwapFunFFI (Complex Float)
foreign import ccall unsafe "cblas_zswap" cblas_zswap_unsafe :: SwapFunFFI (Complex Double)
--void cblas_sswap(  CInt n, Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_dswap(  CInt n, Double *x,   CInt incx, Double *y,   CInt incy);
--void cblas_cswap(  CInt n, Float *x,   CInt incx, Float *y,   CInt incy);
--void cblas_zswap(  CInt n, Double *x,   CInt incx, Double *y,   CInt incy);

type IamaxFunFFI el = CInt -> Ptr el -> CInt -> IO CInt
foreign import ccall "cblas_isamax" cblas_isamax_safe :: IamaxFunFFI Float
foreign import ccall "cblas_idamax" cblas_idamax_safe :: IamaxFunFFI Double
foreign import ccall "cblas_icamax" cblas_icamax_safe :: IamaxFunFFI (Complex Float)
foreign import ccall "cblas_izamax" cblas_izamax_safe :: IamaxFunFFI (Complex Double)

foreign import ccall unsafe "cblas_isamax" cblas_isamax_unsafe :: IamaxFunFFI Float
foreign import ccall unsafe "cblas_idamax" cblas_idamax_unsafe :: IamaxFunFFI Double
foreign import ccall unsafe "cblas_icamax" cblas_icamax_unsafe :: IamaxFunFFI (Complex Float)
foreign import ccall unsafe "cblas_izamax" cblas_izamax_unsafe :: IamaxFunFFI (Complex Double)
--CBLAS_INDEX cblas_isamax(  CInt n,   Float  *x,   CInt incx);
--CBLAS_INDEX cblas_idamax(  CInt n,   Double *x,   CInt incx);
--CBLAS_INDEX cblas_icamax(  CInt n,   Float  *x,   CInt incx);
--CBLAS_INDEX cblas_izamax(  CInt n,   Double *x,   CInt incx);

{-
these aren't provided by Accelerate frameowkr on OSX, not sure about other platforms

but easy to write portable substitute I think?
-}
--type IaminFunFFI el = CInt -> Ptr el -> CInt -> IO CInt
--foreign import ccall "cblas_isamin" cblas_isamin_safe :: IaminFunFFI Float
--foreign import ccall "cblas_idamin" cblas_idamin_safe :: IaminFunFFI Double
--foreign import ccall "cblas_icamin" cblas_icamin_safe :: IaminFunFFI (Complex Float)
--foreign import ccall "cblas_izamin" cblas_izamin_safe :: IaminFunFFI (Complex Double)

--foreign import ccall unsafe "cblas_isamin" cblas_isamin_unsafe :: IaminFunFFI Float
--foreign import ccall unsafe "cblas_idamin" cblas_idamin_unsafe :: IaminFunFFI Double
--foreign import ccall unsafe "cblas_icamin" cblas_icamin_unsafe :: IaminFunFFI (Complex Float)
--foreign import ccall unsafe "cblas_izamin" cblas_izamin_unsafe :: IaminFunFFI (Complex Double)

--CBLAS_INDEX cblas_isamin(  CInt n,   Float  *x,   CInt incx);
--CBLAS_INDEX cblas_idamin(  CInt n,   Double *x,   CInt incx);
--CBLAS_INDEX cblas_icamin(  CInt n,   Float  *x,   CInt incx);
--CBLAS_INDEX cblas_izamin(  CInt n,   Double *x,   CInt incx);


text:
package no.cantara.csdb.errorhandling;

import org.springframework.http.HttpStatus;

public class AppExceptionCode {

	//USER EXCEPTIONS
	public static final AppException USER_UNAUTHORIZED_6000 = new AppException(HttpStatus.UNAUTHORIZED, 6000, "Unauthorized", "Unauthorized", "");

	//APPLICATION EXCEPTIONS
	public static final AppException APP_ILLEGAL_7000 = new AppException(HttpStatus.FORBIDDEN, 7000, "Illegal Application.", "Application is invalid", "");

	//MISC
	public static final AppException MISC_MISSING_PARAMS_9998 = new AppException(HttpStatus.BAD_REQUEST, 9998, "Missing required parameters", "Missing required parameters", "");

}

redpajama_set_name: RedPajamaGithub


text:
title: What happens if I don't get the scholarship?
date: 2017-09-22 21:41:00 +0000
categories: Cost
---

If you are not approved for a scholarship, you are always welcome to reapply for future course scholarships. Additionally, you can pay the upfront cost for the course.


text:
#ifndef LIBXMP_MIXER_H
#define LIBXMP_MIXER_H

#define SMIX_C4NOTE	6864

#define SMIX_NUMVOC	128	/* default number of softmixer voices */
#define SMIX_SHIFT	16
#define SMIX_MASK	0xffff

#define FILTER_SHIFT	16

/* Anticlick ramps */
#define SLOW_ATTACK_SHIFT 4
#define SLOW_ATTACK	(1 << SLOW_ATTACK_SHIFT)
#define SLOW_RELEASE	16

struct mixer_voice {
	int chn;		/* channel number */
	int root;		/* */
	unsigned int age;	/* */
	int note;		/* */
	int pan;		/* */
	int vol;		/* */
	int period;		/* current period */
	int pos;		/* position in sample */
	int pos0;		/* position in sample before mixing */
	int frac;		/* interpolation */
	int fidx;		/* function index */
	int ins;		/* instrument number */
	int smp;		/* sample number */
	int end;		/* loop end */
	int act;		/* nna info & status of voice */
	int sleft;		/* last left sample output, in 32bit */
	int sright;		/* last right sample output, in 32bit */
	void *sptr;		/* sample pointer */

	struct {
		int r1;		/* filter variables */
		int r2;
		int l1;
		int l2;
		int a0;
		int b0;
		int b1;
		int cutoff;
		int resonance;
	} filter;

	int attack;		/* ramp up anticlick */
	int sample_loop;	/* set if sample has looped */
};

int	mixer_on		(struct context_data *, int, int, int);
void	mixer_off		(struct context_data *);
void    mixer_setvol		(struct context_data *, int, int);
void    mixer_seteffect		(struct context_data *, int, int, int);
void    mixer_setpan		(struct context_data *, int, int);
int	mixer_numvoices		(struct context_data *, int);
void	mixer_softmixer		(struct context_data *);
void	mixer_reset		(struct context_data *);
void	mixer_setpatch		(struct context_data *, int, int);
void	mixer_voicepos		(struct context_data *, int, int, int);
int	mixer_getvoicepos	(struct context_data *, int);
void	mixer_setnote		(struct context_data *, int, int);
void	mixer_setbend		(struct context_data *, int, int);

#endif /* LIBXMP_MIXER_H */


text:
package org.motechproject.server.alerts.domain;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.ektorp.support.TypeDiscriminator;
import org.joda.time.DateTime;
import org.motechproject.commons.couchdb.model.MotechBaseDataObject;
import org.motechproject.commons.date.util.DateUtil;

import java.util.HashMap;
import java.util.Map;

@TypeDiscriminator("doc.type === 'Alert'")
public class Alert extends MotechBaseDataObject implements Comparable<Alert> {

    private String id;
    private String externalId;
    private String name;
    private AlertType alertType;
    private DateTime dateTime;
    private int priority;
    private AlertStatus status;
    private String description;
    private Map<String, String> data = new HashMap<String, String>();

    public Alert() {
    }

    public Alert(String externalId, String name, String description, AlertType alertType, AlertStatus status, int priority, Map<String, String> data) {
        this(externalId, alertType, status, priority, data);
        this.name = name;
        this.description = description;
    }

    public Alert(String externalId, AlertType alertType, AlertStatus status, int priority, Map<String, String> data) {
        this.externalId = externalId;
        this.alertType = alertType;
        this.status = status;
        this.priority = priority;
        this.dateTime = DateUtil.now();
        if (data != null) {
            this.data.putAll(data);
        }
    }

    public String getId() {
        return id;
    }

    public String getExternalId() {
        return externalId;
    }

    public String getName() {
        return name;
    }

    public AlertType getAlertType() {
        return alertType;
    }

    public DateTime getDateTime() {
        return DateUtil.setTimeZoneUTC(dateTime);
    }

    @JsonIgnore
    public long getDateTimeInMillis() {
        return getDateTime().getMillis();
    }

    public int getPriority() {
        return priority;
    }

    public AlertStatus getStatus() {
        return status;
    }

    public String getDescription() {
        return description;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setExternalId(String externalId) {
        this.externalId = externalId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDateTime(DateTime dateTime) {
        this.dateTime = dateTime;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public void setStatus(AlertStatus status) {
        this.status = status;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setAlertType(AlertType alertType) {
        this.alertType = alertType;
    }

    @Override
    public int hashCode() {
        return this.getId().hashCode();
    }

    @Override
    public boolean equals(Object that) {
        if (that == null || that.getClass() != this.getClass()) { return false; }
        return this.getId().equals(((Alert) that).getId());
    }

    @Override
    public int compareTo(Alert o) {
        return Integer.valueOf(this.priority).compareTo(o.priority);
    }

    public Map<String, String> getData() {
        return data;
    }

    public void setData(Map<String, String> data) {
        this.data = data;
    }
}


text:
using Microsoft.Extensions.Logging;
using System.IO.Pipelines;

namespace SmtpPilot.Server.Communication
{
    public interface IMailClientFactory
    {
        IMailClient CreateClient(IDuplexPipe pipe, ILoggerFactory loggerFactory);
    }
}


text:
#ifndef HALM_USB_MSC_DEFS_H_
#define HALM_USB_MSC_DEFS_H_
/*----------------------------------------------------------------------------*/
#include <xcore/bits.h>
#include <xcore/memory.h>
#include <stdint.h>
/*----------------------------------------------------------------------------*/
#define MSC_CONTROL_EP_SIZE 64
#define MSC_DATA_EP_SIZE    64
#define MSC_DATA_EP_SIZE_HS 512

#define MSC_BLOCK_SIZE      512
#define DATA_QUEUE_SIZE     (MSC_BLOCK_SIZE / MSC_DATA_EP_SIZE + 1)
/*----------------------------------------------------------------------------*/
enum
{
  SCSI_TEST_UNIT_READY        = 0x00,
  SCSI_REQUEST_SENSE          = 0x03,
  SCSI_FORMAT_UNIT            = 0x04,
  SCSI_READ6                  = 0x08,
  SCSI_WRITE6                 = 0x0A,
  SCSI_INQUIRY                = 0x12,
  SCSI_MODE_SELECT6           = 0x15,
  SCSI_MODE_SENSE6            = 0x1A,
  SCSI_START_STOP_UNIT        = 0x1B,
  SCSI_MEDIUM_REMOVAL         = 0x1E,
  SCSI_READ_FORMAT_CAPACITIES = 0x23,
  SCSI_READ_CAPACITY10        = 0x25,
  SCSI_READ10                 = 0x28,
  SCSI_WRITE10                = 0x2A,
  SCSI_VERIFY10               = 0x2F,
  SCSI_MODE_SELECT10          = 0x55,
  SCSI_MODE_SENSE10           = 0x5A,
  SCSI_READ12                 = 0xA8,
  SCSI_WRITE12                = 0xAA
};

/* Sense Key */
enum
{
  SCSI_SK_NO_SENSE            = 0x00,
  SCSI_SK_RECOVERED_ERROR     = 0x01,
  SCSI_SK_NOT_READY           = 0x02,
  SCSI_SK_MEDIUM_ERROR        = 0x03,
  SCSI_SK_HARDWARE_ERROR      = 0x04,
  SCSI_SK_ILLEGAL_REQUEST     = 0x05,
  SCSI_SK_UNIT_ATTENTION      = 0x06,
  SCSI_SK_DATA_PROTECT        = 0x07,
  SCSI_SK_BLANK_CHECK         = 0x08,
  SCSI_SK_VENDOR_SPECIFIC     = 0x09,
  SCSI_SK_COPY_ABORTED        = 0x0A,
  SCSI_SK_ABORTED_COMMAND     = 0x0B,
  SCSI_SK_VOLUME_OVERFLOW     = 0x0D,
  SCSI_SK_MISCOMPARE          = 0x0E,
  SCSI_SK_COMPLETED           = 0x0F
};

/* Sense Key 0x00 */
#define SCSI_ASC_NOSENSE                0x0000

/* Sense Key 0x02 */
#define SCSI_ASC_NR_MEDIUMNOTPRESENT    0x3A00

/* Sense Key 0x03 */
#define SCSI_ASC_ME_WRITEFAULT          0x0300
#define SCSI_ASC_ME_READERROR           0x1100

/* Sense Key 0x05 */
#define SCSI_ASC_IR_INVALIDCOMMAND      0x2000
#define SCSI_ASC_IR_LBAOUTOFRANGE       0x2100
#define SCSI_ASC_IR_INVALIDFIELDINCBA   0x2400
#define SCSI_ASC_IR_INVALIDLUN          0x2500

/* Sense Key 0x06 */
#define SCSI_ASC_UA_READYTRANSITION     0x2800

/* Sense Key 0x07 */
#define SCSI_ASC_WP_COMMANDNOTALLOWED   0x2700
/*----------------------------------------------------------------------------*/
enum
{
  MSC_SUBCLASS_COMMAND_SET_NOT_REPORTED = 0x00,
  MSC_SUBCLASS_RBC                      = 0x01,
  MSC_SUBCLASS_MMC5                     = 0x02,
  MSC_SUBCLASS_UFI                      = 0x04,
  MSC_SUBCLASS_SCSI                     = 0x06,
  MSC_SUBCLASS_LSDFS                    = 0x07,
  MSC_SUBCLASS_IEEE1667                 = 0x08
};

enum
{
  MSC_PROTOCOL_CBI_INT                  = 0x00,
  MSC_PROTOCOL_CBI                      = 0x01,
  MSC_PROTOCOL_BBB                      = 0x50,
  MSC_PROTOCOL_UAS                      = 0x62,
  MSC_PROTOCOL_VENDOR_SPECIFIC          = 0xFF
};
/*----------------------------------------------------------------------------*/
enum
{
  MSC_REQUEST_RESET                     = 0xFF,
  MSC_REQUEST_GET_MAX_LUN               = 0xFE
};
/*----------------------------------------------------------------------------*/
/*
 * Possible values of the Prevent field in a
 * Prevent/Allow Medium Removal command.
 */
enum
{
  PAMR_UNLOCK                           = 0x00,
  PAMR_LOCK                             = 0x01
};

/*
 * Possible values of the Peripheral Device Type field in a response to a
 * Inquiry command.
 */
enum
{
  PDT_DIRECT_ACCESS_BLOCK_DEVICE        = 0x00,
  PDT_SEQUENTIAL_ACCESS_DEVICE          = 0x01,
  PDT_PRINTER_DEVICE                    = 0x02,
  PDT_PROCESSOR_DEVICE                  = 0x03,
  PDT_WRITE_ONCE_DEVICE                 = 0x04,
  PDT_CD_DVD_DEVICE                     = 0x05,
  PDT_OPTICAL_MEMORY_DEVICE             = 0x07,
  PDT_MEDIA_CHANGER_DEVICE              = 0x08,
  PDT_STORAGE_ARRAY_CONTROLLER_DEVICE   = 0x0C,
  PDT_ENCLOSURE_SERVICES_DEVICE         = 0x0D,
  PDT_SIMPLIFIED_DIRECT_ACCESS_DEVICE   = 0x0E,
  PDT_OPTICAL_CARD_RW_DEVICE            = 0x0F,
  PDT_BRIDGE_CONTROLLER_COMMANDS        = 0x10,
  PDT_OBJECT_BASED_STORAGE_DEVICE       = 0x11,
  PDT_AUTOMATION_DRIVE_INTERFACE        = 0x12,
  PDT_SECURITY_MANAGER_DEVICE           = 0x13,
  PDT_WELL_KNOWN_LOGICAL_UNIT           = 0x1E,
  PDT_UNKNOWN_DEVICE                    = 0x1F
};

/* Enable Vital Product Data */
#define INQUIRY_EVPD                    BIT(0)
/* Removable Medium Bit set to one indicates that the medium is removable */
#define INQUIRY_FLAGS_0_RMB             BIT(7)
/* Response Data Format */
#define INQUIRY_FLAGS_1_RDF(value)      BIT_FIELD((value), 0)
/* Hierarchical Support */
#define INQUIRY_FLAGS_1_HISUP           BIT(4)
/* Normal ACA bit: support of the ACA task attribute */
#define INQUIRY_FLAGS_1_NORMACA         BIT(5)
/* PROTECT bit: the logical unit supports type 1, 2 or 3 protection */
#define INQUIRY_FLAGS_2_PROTECT         BIT(0)
/* Third-Party Copy: the device supports third-party copy commands */
#define INQUIRY_FLAGS_2_3PC             BIT(3)
/* Target Port Group Support: the support for asymmetric logcal unit access */
#define INQUIRY_FLAGS_2_TPGS(value)     BIT_FIELD((value), 4)
/*
 * Access Controls Coordinator: the device contains an access controls
 * coordinator, that may be addressed through this logical unit.
 */
#define INQUIRY_FLAGS_2_ACC             BIT(6)
/* SCC Supported bit: the device contains an embedded storage controller */
#define INQUIRY_FLAGS_2_SCCS            BIT(7)
/*
 * Multi Port: the device contains two or more ports and conforms
 * to the multi-port requirements.
 */
#define INQUIRY_FLAGS_3_MULTIP          BIT(4)
/* Enclosure Services: the device contains an embedded enclosure services */
#define INQUIRY_FLAGS_3_ENCSERV         BIT(6)
/* Command Queuing */
#define INQUIRY_FLAGS_4_CMDQUE          BIT(1)

#define MEDIUMREMOVAL_FLAGS_PREVENT_MASK \
    BIT_FIELD(MASK(2), 0)
#define MEDIUMREMOVAL_FLAGS_PREVENT_VALUE(value) \
    FIELD_VALUE((value), MEDIUMREMOVAL_FLAGS_PREVENT_MASK, 0)

#define READ6_LBA_MASK                  MASK(21)
#define READ10_RARC                     BIT(2)
#define READ10_FUA                      BIT(3)
#define READ10_DPO                      BIT(4)
#define READ10_RDPROTECT_MASK           BIT_FIELD(MASK(3), 5)
#define READ12_GROUP_NUMBER_MASK        BIT_FIELD(MASK(5), 0)

#define READCAPACITY10_FLAGS_0_RELADR   BIT(0)
#define READCAPACITY10_FLAGS_1_PMI      BIT(0)

#define SENSE_FLAGS_ILI                 BIT(5)
#define SENSE_FLAGS_EOM                 BIT(6)
#define SENSE_FLAGS_FILEMARK            BIT(7)

#define VERIFY10_BYTCHK_MASK            BIT_FIELD(MASK(2), 1)
#define VERIFY10_DPO                    BIT(4)
#define VERIFY10_VRPROTECT_MASK         BIT_FIELD(MASK(3), 5)
#define VERIFY10_GROUP_NUMBER_MASK      BIT_FIELD(MASK(5), 0)
/*----------------------------------------------------------------------------*/
#define CBW_FLAG_DIRECTION_TO_HOST      BIT(7)
#define CBW_SIGNATURE                   TO_LITTLE_ENDIAN_32(0x43425355)
#define CSW_SIGNATURE                   TO_LITTLE_ENDIAN_32(0x53425355)

enum
{
  CSW_CMD_PASSED  = 0x00,
  CSW_CMD_FAILED  = 0x01,
  CSW_PHASE_ERROR = 0x02
};

struct CBW
{
  uint32_t signature;
  uint32_t tag;
  uint32_t dataTransferLength;
  uint8_t flags;
  uint8_t lun;
  uint8_t cbLength;
  uint8_t cb[16];
} __attribute__((packed));

struct CSW
{
  uint32_t signature;
  uint32_t tag;
  uint32_t dataResidue;
  uint8_t status;
} __attribute__((packed));
/*----------------------------------------------------------------------------*/
struct InquiryData
{
  uint8_t peripheralDeviceType;
  uint8_t flags0; /* RMB */
  uint8_t version;
  uint8_t flags1; /* NormACA, HiSup, Response Data Format */
  uint8_t additionalLength; /* N - 4 */
  uint8_t flags2; /* SCCS, ACC, TPGS, 3PC, PROPTECT */
  uint8_t flags3; /* EncServ, VS, MultiP, ADDR16 */
  uint8_t flags4; /* WBUS16, SYNC, CmdQue, VS */
  uint8_t vendorIdentification[8];
  uint8_t productIdentification[16];
  uint8_t productRevisionLevel[4];
} __attribute__((packed));

struct ModeParameterHeader6
{
  uint8_t modeDataLength;
  uint8_t mediumType;
  uint8_t deviceSpecificParameter;
  uint8_t blockDescriptorLength;
} __attribute__((packed));

struct ModeParameterHeader10
{
  uint16_t modeDataLength;
  uint8_t mediumType;
  uint8_t deviceSpecificParameter;
  uint8_t flags;
  uint8_t reserved;
  uint16_t blockDescriptorLength;
} __attribute__((packed));

struct ModeSense6Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint8_t pageCode;
  uint8_t subpageCode;
  uint8_t allocationLength;
  uint8_t control;
} __attribute__((packed));

struct ModeSense10Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint8_t pageCode;
  uint8_t subpageCode;
  uint8_t reserved[3];
  uint16_t allocationLength;
  uint8_t control;
} __attribute__((packed));

struct PreventAllowMediumRemovalCommand
{
  uint8_t operationCode;
  uint8_t flags0;
  uint8_t reserved0[2];
  uint8_t flags1;
  uint8_t reserved1[4];
  uint8_t control;
} __attribute__((packed));

struct Read6Command
{
  uint8_t operationCode;
  uint8_t logicalBlockAddress[3];
  uint8_t transferLength;
  uint8_t control;
} __attribute__((packed));

struct Read10Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint32_t logicalBlockAddress;
  uint8_t groupNumber;
  uint16_t transferLength;
  uint8_t control;
} __attribute__((packed));

struct Read12Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint32_t logicalBlockAddress;
  uint32_t transferLength;
  uint8_t groupNumber;
  uint8_t control;
} __attribute__((packed));

struct ReadCapacity10Command
{
  uint8_t operationCode;
  uint8_t flags0;
  uint32_t lba;
  uint8_t reserved[2];
  uint8_t flags1;
  uint8_t control;
} __attribute__((packed));

struct RequestSenseData
{
  uint8_t responseCode;
  uint8_t reserved;
  uint8_t flags;
  uint32_t information;
  uint8_t additionalSenseLength;
  uint32_t commandInformation;
  uint8_t additionalSenseCode;
  uint8_t additionalSenseCodeQualifier;
  uint8_t fieldReplacableUnitCode;
  uint8_t senseKeyData[3];
  uint8_t senseData[];
} __attribute__((packed));

struct ReadCapacityData
{
  uint32_t lastLogicalBlockAddress;
  uint32_t blockLength;
} __attribute__((packed));

struct Verify10Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint32_t logicalBlockAddress;
  uint8_t groupNumber;
  uint16_t verificationLength;
  uint8_t control;
} __attribute__((packed));

struct Write6Command
{
  uint8_t operationCode;
  uint8_t logicalBlockAddress[3];
  uint8_t transferLength;
  uint8_t control;
} __attribute__((packed));

struct Write10Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint32_t logicalBlockAddress;
  uint8_t groupNumber;
  uint16_t transferLength;
  uint8_t control;
} __attribute__((packed));

struct Write12Command
{
  uint8_t operationCode;
  uint8_t flags;
  uint32_t logicalBlockAddress;
  uint32_t transferLength;
  uint8_t groupNumber;
  uint8_t control;
} __attribute__((packed));
/*----------------------------------------------------------------------------*/
struct CapacityListHeader
{
  uint8_t reserved[3];
  uint8_t capacityListLength;
} __attribute__((packed));

struct CapacityDescriptor
{
  uint32_t numberOfBlocks;
  uint8_t flags;
  uint8_t blockLength[3];
} __attribute__((packed));

struct ReadFormatCapacitiesData
{
  struct CapacityListHeader header;
  struct CapacityDescriptor descriptors[];
} __attribute__((packed));
/*----------------------------------------------------------------------------*/
#endif /* HALM_USB_MSC_DEFS_H_ */


text:
<?php

namespace Applisun\CompteBundle\EventDispatcher\Subscriber;

use Applisun\CompteBundle\EventDispatcher\Event\OperationEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
 * Class OperationSubscriber
 * @package Applisun\CompteBundle\EventDispatcher\Subscriber
 */
class OperationSubscriber implements EventSubscriberInterface
{
    /**
     * @return array
     */
    public static function getSubscribedEvents()
    {
        return array(
            OperationEvents::PRE_ADD => array('onPreAdd', 10),
            OperationEvents::POST_ADD => array('onPostAdd', 0),
        );
    }

    public function onPreAdd(GenericEvent $event)
    {
        $operation = $event->getSubject();

        // do something with $operation
    }

    public function onPostAdd(GenericEvent $event)
    {
        $operation = $event->getSubject();

        //var_dump($operation->getMontant());exit;
    }
}


text:
{{<layout}}

{{$pageTitle}} GOV.UK prototype kit {{/pageTitle}}

{{$head}}
	{{>includes/head}}
	{{>includes/scripts}}
{{/head}}

{{$content}}

View or share your driving licence information

Prototype for View or share your driving licence information service, with redesigns of complete service and also including new share code, inclusion of Certificate of Professional Competence (CPC), Tachograph card, and validation.

AB testing

Lock out pages

CPC & Tacho

A

Clean short version

Clean long version

B

Boxed short version

Boxed long version

A

Adding extra content

B

adding extra tab

{{/content}}

{{/layout}}


text:
window.onload = function() {
  var shim = require('./shim');
  var video = require('./video');

  function readSingleFile(e) {
    var file = e.target.files[0];
    if (!file) {
      return;
    }
    var reader = new FileReader();
    reader.onload = function(e) {
      var contents = e.target.result;
      video.setMessage(contents);
    };
    reader.readAsText(file);
  }

  document.getElementById('file-input').addEventListener('change', readSingleFile, false);
};


text:
source "../mylibs/commons.sh"
checkroot
trap 'error ${LINENO} "Create quota limited database failed"' ERR
DEBUG=on #enable/disable debug
if [ $# = 2 ]; then
    dbname="${1}"
    dbsize="${2}"
else
    if [ $# = 1 ]; then
	dbname="${1}"
    else
        while true; do
            printf "Please input database name: "
            read dbname
            if [ "${dbname}X" != "X" ]; then
                break;
            fi
        done
    fi

    printf "please input database size [1gb]: "
    read dbsize
    if [ "${dbsize}X" = "X" ]; then
	dbsize="1gb";
    fi
fi
debug "dbname=${dbname}, quota=${dbsize}"
cd /var/lib/mysql
zfs create -o mountpoint=/mysqldata/${dbname} -o quota=${dbsize} mysqldata/${dbname}
chown -R mysql:mysql /mysqldata/${dbname}
chmod -R 700 /mysqldata/${dbname}
mysql -e "create database ${dbname};"
mv ${dbname}/db.opt /mysqldata/${dbname}
mv ${dbname} /tmp
rm -rf /tmp/${dbname}
ln -s /mysqldata/${dbname} /var/lib/mysql
restorecon -R -v /mysqldata
msg echo "Done"


text:
package ruolan.com.myhearts.contant;

/**
 * Created by Administrator on 2016/10/20.
 * <p>
 * 该项目使用的数据接口   接口来源于抓取获取到的,禁止用于任何商业用途,如果有侵犯他人的接口
 * 请告知我删除。
 */
public class HttpUrlPaths {

    public static final String BASE_URL = "http://api.xinliji.me/";

    /**
     * userid=54442&cuserid=54442
     */
    public static final String USER_DETAIL_INFO = BASE_URL + "consultant/consultantProfile";

    //首页轮播图  type=consultant
    public static final String HOME_BANNER = BASE_URL + "com/loadBanner_v2";

    //首页推荐咨询师   http://api.xinliji.me/consultant/loadRecommendedConsultants
    public static final String HOME_RECOMMENT = BASE_URL + "consultant/loadRecommendedConsultants";

    //首页跑马灯    http://api.xinliji.me/com/loadActionLabels
    public static final String HOME_MARQUEE = BASE_URL + "com/loadActionLabels";

    //查看更多   userid=54442   分页加载  page
    public static final String SCAN_MORE = BASE_URL + "psychology/loadency";

    //新闻详情  userid=54442   id
    public static final String NEWS_USER_DETAIL = BASE_URL + "psychology/encydetail";

    //新闻webview  userid=54442   id
    public static final String NEWS_DETAIL = "http://console.xinliji.me/psychology/encypage";

    //首页  推荐两个
    public static final String HOME_RECOMMENT_ONE_BANNER = BASE_URL + "multimedia/recommandLiveShow";
    public static final String HOME_RECOMMENT_TWO_BANNER = BASE_URL + "psychology/dailyExam";

    //首页我要倾诉  咨询url
    public static final String HOME_POUR_OUT_CONSULT_URL = BASE_URL + "consultant/loadWebcallConsultants";

    //tag  http://api.xinliji.me/consultant/loadTags  分类
    public static final String ALL_CATEGORY_TAG = BASE_URL + "consultant/loadTags";

    //http://api.xinliji.me/consultant/loadFreeWebcallConsultants  免费体验
    public static final String FREE_TRIAL = BASE_URL + "consultant/loadFreeWebcallConsultants";

    //情感测试
    public static final String AFFECTIVE_TEST = BASE_URL + "psychology/randomExams";

    //咨询列表     userid=0
    public static final String SERACH_LIST = BASE_URL + "consultant/searchConsultants";

    //http://api.xinliji.me/social/loadGroupCatgs  群主分类
    public static final String LORD_CATEGORY = BASE_URL + "social/loadGroupCatgs";

    //http://api.xinliji.me/social/loadRecommendGroups  群组的两个轮播图
    public static final String LORD_BANNER = BASE_URL + "social/loadRecommendGroups";

    // 心事   userid = 54442
    //labelid=0&type=1&page=1&userid=0  最新
    //labelid=0&type=2&page=1&userid=0

    //labelid=2&type=1&page=1&userid=0
    //labelid=1&type=1&page=1&userid=0  其他
    public static final String THOUGHTS_URL = BASE_URL + "social/nearuserevents_v3";

    //心事详情界面   eventid=27051&userid=0
    public static final String THOUGHTS_DETAIL_URL = BASE_URL + "social/usereventdetails_v3";

    //心事详情评论URL  type=user_event&eventid=27051&userid=0
    public static final String THOUGHTS_DETAIL_COMMENT_URL = BASE_URL + "social/loadeventcomments";

    //page=1&userid=0&searchtype=0  亲子教育
    //catgId=1&page=1&userid=0 情绪困扰
    //catgId=4&page=1&userid=0 青春成长
    //catgId=5&page=1&userid=0
    //catgId=1&page=2&userid=0
    public static final String LORD_DETAIL_URL = BASE_URL + "social/loadGroupsByCatg";

    //?userid=0&groupid=309   群组详情
    public static final String LORD_GROUP_DETAIL_URL = BASE_URL + "social/groupinfo";

    //群成员url   page=1&groupid=309
    public static final String LORD_MEMBER_DETAILE_URL = BASE_URL + "social/groupmembers";

    //群成员详情 cuserid=0&userid=112730
    public static final String LORD_GROUP_MEMBER_DETAIL = "user/profile?cuserid=0&userid=112730";

    //直播url
    public static final String DOUYU_API = "http://capi.douyucdn.cn/api/v1/";

    //  page=1&userid=114726
    //直播url
    public static final String LIVING_STREAMING_URL = BASE_URL + "multimedia/loadLiveList_v3";

    //type=live
    public static final String LIVING_STREAMING_BANNER_URL = BASE_URL + "com/loadBanner_v2";

    /**
     * lol  dota2  炉石
     *
     * @param channelTag
     * @return
     */
    public static String getDouyuSubChannelBaseTag(int channelTag, int limit, int offset) {
        return DOUYU_API + "live/" + channelTag + "?&limit=" + limit + "&offset=" + offset;
    }

    /**
     * 推荐直播api
     *
     * @return
     */
    public static String getDouyuLiveChannel(int limit, int offset) {
        return DOUYU_API + "live?&limit=" + limit + "&offset=" + offset;
    }

    /**
     * 所有api
     *
     * @return
     */
    public static String getDouyuAllSubChannels() {
        return DOUYU_API + "getColumnDetail?shortName=game";
    }

    public static final String COMPUTER_BASE_URL = "http://121.42.174.82/api/catalogs/";

    public static final String COMPUTER_BASE_DETAIL = "http://121.42.174.82/api/articles/";

    /**
     * 获取到新闻资讯列表
     *
     * @param type       资讯类型
     * @param startIndex 开始位置
     * @param endIndex   结束位置
     * @return url
     */
    public static String getNewsData(String type, int startIndex, int endIndex) {
        return COMPUTER_BASE_URL + type + "/articles?startIndex=" + startIndex + "&endIndex=" + endIndex;
    }

    /**
     * 获取到新闻轮播图列表
     *
     * @param type 资讯类型
     * @return url
     */
    public static String getNewBanner(String type) {
        return COMPUTER_BASE_URL + type +
                "/articles/headline?startIndex=0&endIndex=5";
    }

    public static String getNewsDetailUrl(String id) {
        return COMPUTER_BASE_DETAIL + id;
    }

    //头条轮播  url
    //http://121.42.174.82/api/catalogs/higo/articles/headline?startIndex=0&endIndex=5
//头条咨询 url   分页加载startIndex      endIndex(这两个参数)
    // http://121.42.174.82/api/catalogs/higo/articles?startIndex=0&endIndex=19

//玩家轮播
    //  http://121.42.174.82/api/catalogs/player/articles/headline?startIndex=0&endIndex=5
//玩家咨询
    // http://121.42.174.82/api/catalogs/player/articles?startIndex=0&endIndex=19

//业界轮播
    // http://121.42.174.82/api/catalogs/look/articles/headline?startIndex=0&endIndex=5
//业界咨询
    // http://121.42.174.82/api/catalogs/look/articles?startIndex=0&endIndex=19

//科技宅轮播
    //  http://121.42.174.82/api/catalogs/indoorsfun/articles/headline?startIndex=0&endIndex=5
//科技宅咨询
    // http://121.42.174.82/api/catalogs/indoorsfun/articles?startIndex=0&endIndex=19

}


text:
package models

import java.sql.Connection

case class RemoveCategoryName(
  categoryId: Long, localeId: Long
) {
  def remove()(implicit conn: Connection, categoryNameRepo: CategoryNameRepo) {
    categoryNameRepo.remove(categoryId, localeId)
  }
}


text:
namespace extensions {
namespace util {

void MaybeApplyChromeBadge(content::BrowserContext* context,
                           const std::string& extension_id,
                           gfx::ImageSkia* icon_out) {
  DCHECK(context);
  DCHECK(icon_out);

  Profile* profile = Profile::FromBrowserContext(context);
  // Only apply Chrome badge for the primary profile.
  if (!chromeos::ProfileHelper::IsPrimaryProfile(profile) ||
      !multi_user_util::IsProfileFromActiveUser(profile)) {
    return;
  }

  arc::ArcAuthService* arc_auth_service = arc::ArcAuthService::Get();
  // Only apply Chrome badge when ARC service is enabled.
  if (!arc_auth_service ||
      arc_auth_service->state() != arc::ArcAuthService::State::ACTIVE) {
    return;
  }

  // No badge on Chrome browser or the Play store app.
  if (extension_id == extension_misc::kChromeAppId ||
      extension_id == ArcSupportHost::kHostAppId) {
    return;
  }

  const ExtensionRegistry* registry = ExtensionRegistry::Get(context);
  if (!registry)
    return;

  const Extension* extension = registry->GetInstalledExtension(extension_id);
  // Only badge Chrome apps that can open in a tab. Platform apps can only be
  // opened in a window.
  if (!extension || extension->is_platform_app())
    return;

  const gfx::ImageSkia* badge_image =
      ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
          IDR_ARC_DUAL_ICON_BADGE);
  DCHECK(badge_image);

  gfx::ImageSkia resized_badge_image = *badge_image;
  if (badge_image->size() != icon_out->size()) {
    resized_badge_image = gfx::ImageSkiaOperations::CreateResizedImage(
        *badge_image, skia::ImageOperations::RESIZE_BEST, icon_out->size());
  }
  *icon_out = gfx::ImageSkiaOperations::CreateSuperimposedImage(
      *icon_out, resized_badge_image);
  return;
}

}  // namespace util
}  // namespace extensions


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('@angular/core');
var ticket_1 = require('../modules/ticket');
var FormComponent = (function () {
    function FormComponent() {
        this.ticket = new ticket_1.Ticket();
        this.teste = new ticket_1.Ticket();
        this.tickets = [];
        this.status = [
            {
                id: 1,
                descricao: 'TO DO'
            },
            {
                id: 2,
                descricao: 'DOING'
            },
            {
                id: 3,
                descricao: 'DONE'
            }
        ];
    }
    FormComponent.prototype.ngOnInit = function () {
    };
    FormComponent.prototype.adicionar = function (t) {
        if (!t.atualizando) {
            var ticket = new ticket_1.Ticket();
            ticket.id = new Date().getTime();
            ticket.nome = t.nome;
            ticket.descricao = t.descricao;
            ticket.status = t.status;
            ticket.atualizando = false;
            this.tickets.push(ticket);
            this.ticket = new ticket_1.Ticket();
        }
        else {
            t.atualizando = false;
            this.ticket = new ticket_1.Ticket();
        }
    };
    FormComponent.prototype.remover = function (t) {
        this.tickets.splice(this.tickets.indexOf(t), 1);
    };
    FormComponent.prototype.atualizar = function (t) {
        t.atualizando = true;
        this.ticket = t;
    };
    FormComponent = __decorate([
        core_1.Component({
            selector: 'form-component',
            templateUrl: 'app/main/templates/form.template.html'
        }),
        __metadata('design:paramtypes', [])
    ], FormComponent);
    return FormComponent;
}());
exports.FormComponent = FormComponent;
//# sourceMappingURL=form.component.js.map


text:
package net.troja.eve.esi.api;

import net.troja.eve.esi.ApiException;
import net.troja.eve.esi.ApiClient;
import net.troja.eve.esi.Configuration;
import net.troja.eve.esi.Pair;

import javax.ws.rs.core.GenericType;

import net.troja.eve.esi.model.CharacterPlanetResponse;
import net.troja.eve.esi.model.CharacterPlanetsResponse;
import net.troja.eve.esi.model.CorporationCustomsOfficesResponse;
import net.troja.eve.esi.model.PlanetFactorySchematicResponse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PlanetaryInteractionApi {
    private ApiClient apiClient;

    public PlanetaryInteractionApi() {
        this(Configuration.getDefaultApiClient());
    }

    public PlanetaryInteractionApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Get colonies Returns a list of all planetary colonies owned by a
     * character. --- This route is cached for up to 600 seconds SSO Scope:
     * esi-planets.manage_planets.v1
     *
     * @param characterId
     *            An EVE character ID (required)
     * @param datasource
     *            The server name you would like data from (optional, default to
     *            tranquility)
     * @param ifNoneMatch
     *            ETag from a previous request. A 304 will be returned if this
     *            matches the current ETag (optional)
     * @param token
     *            Access token to use if unable to set a header (optional)
     * @return List<CharacterPlanetsResponse>
     * @throws ApiException
     *             if fails to make API call
     */
    public List<CharacterPlanetsResponse> getCharactersCharacterIdPlanets(Integer characterId, String datasource,
            String ifNoneMatch, String token) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'characterId' when calling getCharactersCharacterIdPlanets");
        }

        // create path and map variables
        String localVarPath = "/v1/characters/{character_id}/planets/".replaceAll("\\{format\\}", "json").replaceAll(
                "\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()));

        // query params
        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        if (ifNoneMatch != null)
            localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = { "application/json" };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "evesso" };

        GenericType<List<CharacterPlanetsResponse>> localVarReturnType = new GenericType<List<CharacterPlanetsResponse>>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * Get colony layout Returns full details on the layout of a single
     * planetary colony, including links, pins and routes. Note: Planetary
     * information is only recalculated when the colony is viewed through the
     * client. Information will not update until this criteria is met. --- This
     * route is cached for up to 600 seconds SSO Scope:
     * esi-planets.manage_planets.v1
     *
     * @param characterId
     *            An EVE character ID (required)
     * @param planetId
     *            Planet id of the target planet (required)
     * @param datasource
     *            The server name you would like data from (optional, default to
     *            tranquility)
     * @param ifNoneMatch
     *            ETag from a previous request. A 304 will be returned if this
     *            matches the current ETag (optional)
     * @param token
     *            Access token to use if unable to set a header (optional)
     * @return CharacterPlanetResponse
     * @throws ApiException
     *             if fails to make API call
     */
    public CharacterPlanetResponse getCharactersCharacterIdPlanetsPlanetId(Integer characterId, Integer planetId,
            String datasource, String ifNoneMatch, String token) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'characterId' is set
        if (characterId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'characterId' when calling getCharactersCharacterIdPlanetsPlanetId");
        }

        // verify the required parameter 'planetId' is set
        if (planetId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'planetId' when calling getCharactersCharacterIdPlanetsPlanetId");
        }

        // create path and map variables
        String localVarPath = "/v3/characters/{character_id}/planets/{planet_id}/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "character_id" + "\\}", apiClient.escapeString(characterId.toString()))
                .replaceAll("\\{" + "planet_id" + "\\}", apiClient.escapeString(planetId.toString()));

        // query params
        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        if (ifNoneMatch != null)
            localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = { "application/json" };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "evesso" };

        GenericType<CharacterPlanetResponse> localVarReturnType = new GenericType<CharacterPlanetResponse>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * List corporation customs offices List customs offices owned by a
     * corporation --- This route is cached for up to 3600 seconds --- Requires
     * one of the following EVE corporation role(s): Director SSO Scope:
     * esi-planets.read_customs_offices.v1
     *
     * @param corporationId
     *            An EVE corporation ID (required)
     * @param datasource
     *            The server name you would like data from (optional, default to
     *            tranquility)
     * @param ifNoneMatch
     *            ETag from a previous request. A 304 will be returned if this
     *            matches the current ETag (optional)
     * @param page
     *            Which page of results to return (optional, default to 1)
     * @param token
     *            Access token to use if unable to set a header (optional)
     * @return List<CorporationCustomsOfficesResponse>
     * @throws ApiException
     *             if fails to make API call
     */
    public List<CorporationCustomsOfficesResponse> getCorporationsCorporationIdCustomsOffices(Integer corporationId,
            String datasource, String ifNoneMatch, Integer page, String token) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'corporationId' is set
        if (corporationId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'corporationId' when calling getCorporationsCorporationIdCustomsOffices");
        }

        // create path and map variables
        String localVarPath = "/v1/corporations/{corporation_id}/customs_offices/".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "corporation_id" + "\\}", apiClient.escapeString(corporationId.toString()));

        // query params
        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));

        if (ifNoneMatch != null)
            localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = { "application/json" };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "evesso" };

        GenericType<List<CorporationCustomsOfficesResponse>> localVarReturnType = new GenericType<List<CorporationCustomsOfficesResponse>>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * Get schematic information Get information on a planetary factory
     * schematic --- This route is cached for up to 3600 seconds
     *
     * @param schematicId
     *            A PI schematic ID (required)
     * @param datasource
     *            The server name you would like data from (optional, default to
     *            tranquility)
     * @param ifNoneMatch
     *            ETag from a previous request. A 304 will be returned if this
     *            matches the current ETag (optional)
     * @return PlanetFactorySchematicResponse
     * @throws ApiException
     *             if fails to make API call
     */
    public PlanetFactorySchematicResponse getUniverseSchematicsSchematicId(Integer schematicId, String datasource,
            String ifNoneMatch) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'schematicId' is set
        if (schematicId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'schematicId' when calling getUniverseSchematicsSchematicId");
        }

        // create path and map variables
        String localVarPath = "/v1/universe/schematics/{schematic_id}/".replaceAll("\\{format\\}", "json").replaceAll(
                "\\{" + "schematic_id" + "\\}", apiClient.escapeString(schematicId.toString()));

        // query params
        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasource", datasource));

        if (ifNoneMatch != null)
            localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = { "application/json" };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] {};

        GenericType<PlanetFactorySchematicResponse> localVarReturnType = new GenericType<PlanetFactorySchematicResponse>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }
}


text:
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
#include "hstcal.h"
# include "hstio.h"
# include <time.h>
# include "acs.h"
# include "acscorr.h"
# include "calacs.h"
# include "hstcalerr.h"

/* This routine gets info from the primary header of the science file,
   and it calls routines to get calibration switches and reference file
   names.

   Warren Hack, 1998 May 26:
    Revised to work with ACS data.
*/

int GetSciInfo (ACSInfo *acs, CalSwitch *sci_sw, RefFileInfo *sciref) {

/* arguments:
ACSInfo *acs         i: calibration flags and other info
CalSwitch *sci_sw     o: all calibration switches (0 or 1) for science file
RefFileInfo *sciref  io: list of keyword,filename pairs for science file
*/

	extern int status;

	IODescPtr im;		/* descriptor for an image */
	Hdr phdr;		/* primary header */
	int nextend;		/* number of FITS extensions in rawfile */

    char targname[CHAR_LINE_LENGTH];

    int GetKeyStr (Hdr *, char *, int, char *, char *, int);
	int GetKeyInt (Hdr *, char *, int, int, int *);
	int GetFlags (CalSwitch *, Hdr *);
	int SciFlags (ACSInfo *, CalSwitch *, Hdr *, RefFileInfo *);

	/* Read primary header of rawfile into phdr. */
	initHdr (&phdr);
	im = openInputImage (acs->rawfile, "", 0);
	if (hstio_err()) {
		sprintf (MsgText, "Member \"%s\" is not present", acs->rawfile);
		trlerror (MsgText);
	    return (status = OPEN_FAILED);
	}
	getHeader (im, &phdr);		/* get primary header */
	if (hstio_err()) {
		sprintf (MsgText, "Could not open PRIMARY header for \"%s\" ", acs->rawfile);
		trlerror (MsgText);
        return (status = OPEN_FAILED);
    }
	closeImage (im);

	/* Get generic parameters. */

	/* Find out how many extensions there are in this file. */
	if (GetKeyInt (&phdr, "NEXTEND", USE_DEFAULT, EXT_PER_GROUP, &nextend))
	    return (status);
	acs->nchips = nextend / EXT_PER_GROUP;

	/* Get binning and gain info.  We really only need this for the CCD. */
	if (GetKeyInt (&phdr, "BINAXIS1", USE_DEFAULT, 1, &acs->scibin[0]))
	    return (status);
	if (GetKeyInt (&phdr, "BINAXIS2", USE_DEFAULT, 1, &acs->scibin[1]))
	    return (status);
    /*
	if (GetKeyInt (&phdr, "CCDGAIN", USE_DEFAULT, 1, &acs->scigain))
	    return (status);
    */
	acs->samebin = 1;	/* default */

    if (GetKeyStr (&phdr, "TARGNAME", USE_DEFAULT, "", targname, CHAR_LINE_LENGTH))
        return (status);
    if (strncmp(targname,"BIAS",4) == 0){
        acs->readnoise_only = 1;
    }

	/* Get calibration switches, and check that reference files exist. */
	if (GetFlags (sci_sw, &phdr))
	    return (status);
	if (SciFlags (acs, sci_sw, &phdr, sciref))
	    return (status);

	freeHdr (&phdr);
	return (status);
}


text:
Package that easily converts collection of models to a datagrid table. The main goal of the package is to build for you a table with sorting and filters per column. You are defining the grid structure in your controller, pass the datagrid to the view and show it there. This will give you a really clean views, just a single line to show the table + filters + sorting + pagination. Keep in mind that filtering and sorting the data is up to you!

## Features
- Composer installable
- PSR4 auto-loading
- Has filters row
- Has columns sort order
- Easily can add action column with edit/delete/whatever links
- Ability to modify cell data via closure function
- Bootstrap friendly
- Each column has data attributes based on a column data key

## Requires
Build to be used with Laravel only!

## Installation
Require package at your composer.json file like so
```json
{
    "require": {
        "aginev/datagrid": "3"
    }
}
```

Tell composer to update your dependencies
```sh
composer update
```

Or in terminal
```sh
composer require aginev/datagrid
```

## HOWTO
Let's consider that we have users and user roles (roles) table at our system.

### Users table

**id:** primary key

**role_id:** foreign key to roles table primary key

**email:** user email added used as username

**first_name:** user first name

**last_name:** user last name

**password:** hashed password

**created_at:** when it's created

**updated_at:** when is the latest update

### Roles Table

**id:** primary key

**title:** Role title e.g. Administrators Access

**created_at:** when it's created

**updated_at:** when is the latest update

We need a table with all the users data, their roles, edit and delete links at the last column at the table, filters and sort links at the very top, pagination at the very bottom.

```php
<?php

// Grab all the users with their roles
// NB!!! At the next line you are responsible for data filtration and sorting!
$users = User::with('role')->paginate(25);

// Create Datagrid instance
// You need to pass the users and the URL query params that the package is using
$grid = new \Datagrid($users, Request::get('f', []));

// Or if you do not want to use the alias
//$grid = new \Aginev\Datagrid\Datagrid($users, Request::get('f', []));

// Then we are starting to define columns
$grid
	->setColumn('first_name', 'First Name', [
		// Will be sortable column
		'sortable'    => true,
		// Will have filtered
		'has_filters' => true
	])
	->setColumn('email', 'Email', [
		'sortable'    => true,
		'has_filters' => true,
		// Wrapper closure will accept two params
		// $value is the actual cell value
		// $row are the all values for this row
		'wrapper'     => function ($value, $row) {
			return '<a href="mailto:' . $value . '">' . $value . '</a>';
		}
	])
	->setColumn('role_id', 'Role', [
		// If you want to have role_id in the URL query string but you need to show role.name as value (dot notation for the user/role relation)
		'refers_to'   => 'role.name',
		'sortable'    => true,
		'has_filters' => true,
		// Pass array of data to the filter. It will generate select field.
		'filters'     => Role::all()->lists('title', 'id'),
		// Define HTML attributes for this column
		'attributes'  => [
            'class'         => 'custom-class-here',
            'data-custom'   => 'custom-data-attribute-value',
        ],
	])
	->setColumn('created_at', 'Created', [
		'sortable'    => true,
		'has_filters' => true,
		'wrapper'     => function ($value, $row) {
			// The value here is still Carbon instance, so you can format it using the Carbon methods
			return $value;
		}
	])
	->setColumn('updated_at', 'Updated', [
		'sortable'    => true,
		'has_filters' => true
	])
	// Setup action column
	->setActionColumn([
		'wrapper' => function ($value, $row) {
			return '<a href="' . action('HomeController@index', $row->id) . '" title="Edit" class="btn btn-xs"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
					<a href="' . action('HomeController@index', $row->id) . '" title="Delete" data-method="DELETE" class="btn btn-xs text-danger" data-confirm="Are you sure?"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>';
		}
	]);

// Finally, pass the grid object to the view
return view('grid', ['grid' => $grid]);
```

Let's show the grid in the view. grid-table param is not required, and it's the id of the table.
```blade
...
{!! $grid->show('grid-table') !!}
...
```

### Modifying Default View

```sh
php artisan vendor:publish --provider="Aginev\Datagrid\DatagridServiceProvider" --tag="views"
```

This will copy the view to `resources/views/vendor/datagrid/datagrid.blade.php`. Editing this file you will be able to modify the grid view as you like with no chance to loose your changes.

### Modifying Config

```sh
php artisan vendor:publish --provider="Aginev\Datagrid\DatagridServiceProvider" --tag="config"
```

This will copy the config to `config/datagrid.php`.

## License
MIT - http://opensource.org/licenses/MIT


text:
import React from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux';
import ConfigureStore from './store';
import Navigation from './navigation';

const store = new ConfigureStore();
export class App extends React.Component {
  render() {
    return (
      <Provider store={store}>
        <Navigation title="navigation" />
      </Provider>
    );
  }
}
ReactDom.render(<App />, document.getElementById('root'));


text:
import * as constants from '../constants';

const initialState = {
  currentDate: null,
  currtentStartWeek: null,
  currentWeek: null,
  currentMonth: null,
  currentWeekFirstDay: null,
  currentWeekLastDay: null,
  recipes: [],
  weekDays: ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'],
  weekEndDays: ['samedi', 'dimanche'],
  weeksRecipes: {}
};

export default function populateWeek (state = initialState, action) {
  switch (action.type) {
    case constants.POPULATE_WEEK: {
      let recipesUnused = state.recipes;
      let recipesForThisWeek = [];

      state.weekDays.map(day => {
        const randomRecipe = Math.floor(Math.random() * recipesUnused.length);
        const recipe = recipesUnused[randomRecipe];
        if (recipe) {
          recipesUnused = recipesUnused.filter((e, i) => i !== randomRecipe);
          recipesForThisWeek.push({
            day,
            isWeekEnd: state.weekEndDays.indexOf(day) !== -1,
            name: recipe.name,
            season: recipe.season
          });
        }
      });

      const weeksRecipes = Object.assign({}, state.weeksRecipes, {
        [state.currtentStartWeek]: recipesForThisWeek
      });

      return Object.assign({}, state, {
        weeksRecipes
      });
    }

    case constants.FETCH_DATA: {
      return Object.assign({}, state, {
        recipes: action.data.recipes
      });
    }

    case constants.SET_CURRENT_DATE: {
      return Object.assign({}, state, {
        currentDate: action.currentDate,
        currtentStartWeek: action.currtentStartWeek,
        currentWeek: action.currentWeek,
        currentWeekFirstDay: action.currentWeekFirstDay,
        currentWeekLastDay: action.currentWeekLastDay
      });
    }

    default:
      return state;
  }
}


text:
import raptureAPI
import multipart
import json
import time
import base64

# TODO These need to be parameters

repo = '//nightly_python'

blobRepoUri = 'blob:'+repo
docRepoUri = 'document:'+repo
seriesRepoUri = 'series:'+repo

site = 'localhost:8665/rapture'
username = 'rapture'
password = 'rapture'
rapture = raptureAPI.raptureAPI(site, username, password)
user2 = "User2"

def test_entitlements():
    ent = "/data/write/"+repo[2:]
    group = "Group"
    documentUri = "document:"+repo+"/test/doc"

    if 'valid' in rapture.context and rapture.context['valid']:
        print 'Logged in successfully '
    else:
        print "Login unsuccessful"
        assert false

    config = " {} USING MONGODB {prefix=\"nightly\"}"
    if(rapture.doDoc_DocRepoExists(docRepoUri)):
        rapture.doDoc_DeleteDocRepo(docRepoUri)
    rapture.doDoc_CreateDocRepo(docRepoUri, "NREP "+config)

    if rapture.doAdmin_DoesUserExist(user2):
        print "user exists"
    else:
        rapture.doAdmin_AddUser(user2, "Another User", multipart.MD5(user2), "user@incapture.net");
    rapture.doAdmin_ResetUserPassword(user2, multipart.MD5(user2));
    rapture.doEntitlement_DeleteEntitlementGroup(group)
    rapture.doEntitlement_DeleteEntitlement(ent)
    rapture2 = raptureAPI.raptureAPI(site, user2, user2)

    permitted = rapture2.doUser_IsPermitted('doc.putDoc', documentUri)
    assert permitted, "Unrestricted"

    rapture.doEntitlement_AddEntitlement(ent, group)
    rapture.doEntitlement_AddEntitlementGroup(group)
    rapture.doEntitlement_AddGroupToEntitlement(ent, group)

    assert rapture.doEntitlement_GetEntitlementGroup(group)['users'] == []
    gg = rapture.doEntitlement_GetEntitlement(ent)['groups']
#    assert rapture.doEntitlement_GetEntitlement(ent).getGroups().contains(group)

    permitted = rapture2.doUser_IsPermitted('doc.putDoc', documentUri)
    assert not permitted, "Access not yet granted"

    rapture.doEntitlement_AddUserToEntitlementGroup(group, user2)
    permitted = rapture2.doUser_IsPermitted('doc.putDoc', documentUri)
    assert permitted, "Access is now granted"

    rapture.doEntitlement_RemoveUserFromEntitlementGroup(group, user2)
    permitted = rapture2.doUser_IsPermitted('doc.putDoc', documentUri)
    assert not permitted, "Access no longer granted"
    rapture.doEntitlement_DeleteEntitlementGroup(group)
    rapture.doEntitlement_DeleteEntitlement(ent)

    permitted = rapture2.doUser_IsPermitted('doc.putDoc', documentUri)
    assert permitted, "Unrestricted"


text:
import re

from corehq.apps.app_manager import id_strings
from corehq.apps.app_manager.suite_xml import const
from corehq.apps.app_manager.suite_xml import xml_models as sx
from corehq.apps.app_manager.xpath import (
    CaseXPath,
    CommCareSession,
    IndicatorXpath,
    LedgerdbXpath,
    LocationXpath,
    UsercaseXPath,
    XPath,
    dot_interpolate,
)
from corehq.apps.hqmedia.models import CommCareMultimedia

CASE_PROPERTY_MAP = {
    # IMPORTANT: if you edit this you probably want to also edit
    # the corresponding map in cloudcare
    # (corehq/apps/cloudcare/static/cloudcare/js/backbone/cases.js)
    'external-id': 'external_id',
    'date-opened': 'date_opened',
    'status': '@status',
    'name': 'case_name',
    'owner_id': '@owner_id',
}

def get_column_generator(app, module, detail, column, sort_element=None,
                         order=None, detail_type=None, parent_tab_nodeset=None):
    cls = get_class_for_format(column.format)  # cls will be FormattedDetailColumn or a subclass of it
    return cls(app, module, detail, column, sort_element, order,
               detail_type=detail_type, parent_tab_nodeset=parent_tab_nodeset)

def get_class_for_format(slug):
    return get_class_for_format._format_map.get(slug, FormattedDetailColumn)
get_class_for_format._format_map = {}

class register_format_type(object):

    def __init__(self, slug):
        self.slug = slug

    def __call__(self, klass):
        get_class_for_format._format_map[self.slug] = klass
        return klass

def get_column_xpath_generator(app, module, detail, column):
    cls = get_class_for_type(column.field_type)  # cls will be BaseXpathGenerator or a subclass
    return cls(app, module, detail, column)

def get_class_for_type(slug):
    return get_class_for_type._type_map.get(slug, BaseXpathGenerator)
get_class_for_type._type_map = {}

class register_type_processor(object):

    def __init__(self, slug):
        self.slug = slug

    def __call__(self, klass):
        get_class_for_type._type_map[self.slug] = klass
        return klass

class BaseXpathGenerator(object):

    def __init__(self, app, module, detail, column):
        self.app = app
        self.module = module
        self.detail = detail
        self.column = column
        self.id_strings = id_strings

    @property
    def xpath(self):
        return self.column.field

class FormattedDetailColumn(object):

    header_width = None
    template_width = None
    template_form = None

    SORT_TYPE = 'string'

    def __init__(self, app, module, detail, column, sort_element=None,
                 order=None, detail_type=None, parent_tab_nodeset=None):
        self.app = app
        self.module = module
        self.detail = detail
        self.detail_type = detail_type
        self.column = column
        self.sort_element = sort_element
        self.order = order
        self.id_strings = id_strings
        self.parent_tab_nodeset = parent_tab_nodeset

    def has_sort_node_for_nodeset_column(self):
        return self.parent_tab_nodeset and self.detail.sort_nodeset_columns_for_detail()

    @property
    def locale_id(self):
        return self.id_strings.detail_column_header_locale(
            self.module, self.detail_type, self.column,
        )

    @property
    def header(self):
        header = sx.Header(
            text=sx.Text(locale_id=self.locale_id),
            width=self.header_width
        )
        return header

    @property
    def variables(self):
        variables = {}
        if re.search(r'\$lang', self.xpath_function):
            variables['lang'] = self.id_strings.current_language()
        return variables

    @property
    def template(self):
        template = sx.Template(
            text=sx.Text(xpath_function=self.xpath_function),
            form=self.template_form,
            width=self.template_width,
        )

        if self.column.useXpathExpression:
            xpath = sx.CalculatedPropertyXPath(function=self.xpath)
            if re.search(r'\$lang', self.xpath):
                xpath.variables.node.append(
                    sx.CalculatedPropertyXPathVariable(
                        name='lang',
                        locale_id=self.id_strings.current_language()
                    ).node
                )
            xpath_variable = sx.XPathVariable(name='calculated_property', xpath=xpath)
            template.text.xpath.variables.node.append(xpath_variable.node)

        if self.variables:
            for key, value in sorted(self.variables.items()):
                template.text.xpath.variables.node.append(
                    sx.XPathVariable(name=key, locale_id=value).node
                )

        return template

    @property
    def sort_node(self):
        if not (self.app.enable_multi_sort and
                (self.detail.display == 'short' or self.has_sort_node_for_nodeset_column())
                ):
            return

        sort = None

        if self.sort_xpath_function:
            if self.sort_element and self.sort_element.type == 'index':
                sort_type = self.sort_element.type
            else:
                sort_type = self.SORT_TYPE

            sort = sx.Sort(
                text=sx.Text(xpath_function=self.sort_xpath_function),
                type=sort_type,
            )

            if self.column.useXpathExpression:
                xpath = sx.CalculatedPropertyXPath(function=self.xpath)
                if re.search(r'\$lang', self.xpath):
                    xpath.variables.node.append(
                        sx.CalculatedPropertyXPathVariable(
                            name='lang',
                            locale_id=self.id_strings.current_language()
                        ).node
                    )
                xpath_variable = sx.XPathVariable(name='calculated_property', xpath=xpath)
                sort.text.xpath.variables.node.append(xpath_variable.node)

        if self.sort_element:
            if not sort:
                sort_type = {
                    'date': 'string',
                    'plain': 'string',
                    'distance': 'double'
                }.get(self.sort_element.type, self.sort_element.type)

                sort_calculation = self.sort_element.sort_calculation
                if sort_calculation:
                    sort_xpath = sort_calculation
                else:
                    sort_xpath = self.xpath_function

                sort = sx.Sort(
                    text=sx.Text(xpath_function=sort_xpath),
                    type=sort_type,
                )
                if not sort_calculation and self.column.useXpathExpression:
                    xpath = sx.CalculatedPropertyXPath(function=self.xpath)
                    if re.search(r'\$lang', self.xpath):
                        xpath.variables.node.append(
                            sx.CalculatedPropertyXPathVariable(
                                name='lang', locale_id=self.id_strings.current_language()
                            ).node
                        )
                    xpath_variable = sx.XPathVariable(name='calculated_property', xpath=xpath)
                    sort.text.xpath.variables.node.append(xpath_variable.node)

            if self.sort_element.type == 'distance':
                sort.text.xpath_function = self.evaluate_template(Distance.SORT_XPATH_FUNCTION)

            sort.order = self.order
            sort.direction = self.sort_element.direction
            sort.blanks = self.sort_element.blanks

            # Flag field as index by making order "-2"
            # this is for the CACHE_AND_INDEX toggle
            # (I know, I know, it's hacky - blame Clayton)
            if sort.type == 'index':
                sort.type = 'string'
                sort.order = -2

        return sort

    @property
    def xpath(self):
        if self.column.useXpathExpression:
            return self.column.field
        return get_column_xpath_generator(self.app, self.module, self.detail,
                                          self.column).xpath

    XPATH_FUNCTION = "{xpath}"

    def evaluate_template(self, template):
        if template:
            return template.format(
                xpath='$calculated_property' if self.column.useXpathExpression else self.xpath,
                app=self.app,
                module=self.module,
                detail=self.detail,
                column=self.column
            )

    @property
    def xpath_function(self):
        return self.evaluate_template(self.XPATH_FUNCTION)

    @property
    def hidden_header(self):
        return sx.Header(
            text=sx.Text(),
            width=0,
        )

    @property
    def hidden_template(self):
        return sx.Template(
            text=sx.Text(xpath_function=self.sort_xpath_function),
            width=0,
        )

    SORT_XPATH_FUNCTION = None

    @property
    def sort_xpath_function(self):
        return self.evaluate_template(self.SORT_XPATH_FUNCTION)

    @property
    def fields(self):
        print_id = None
        if self.detail.print_template:
            print_id = self.column.field

        if self.app.enable_multi_sort:
            yield sx.Field(
                header=self.header,
                template=self.template,
                sort_node=self.sort_node,
                print_id=print_id,
            )
        elif self.sort_xpath_function and self.detail.display == 'short':
            yield sx.Field(
                header=self.header,
                template=self.hidden_template,
                print_id=print_id,
            )
            yield sx.Field(
                header=self.hidden_header,
                template=self.template,
                print_id=print_id,
            )
        else:
            yield sx.Field(
                header=self.header,
                template=self.template,
                print_id=print_id,
            )

class HideShortHeaderColumn(FormattedDetailColumn):

    @property
    def header(self):
        if self.detail.display == 'short' or self.has_sort_node_for_nodeset_column():
            header = sx.Header(
                text=sx.Text(),
                width=self.template_width
            )
        else:
            header = super(HideShortHeaderColumn, self).header
        return header

class HideShortColumn(HideShortHeaderColumn):

    @property
    def template_width(self):
        if self.detail.display == 'short' or self.has_sort_node_for_nodeset_column():
            return 0

@register_format_type('plain')
class Plain(FormattedDetailColumn):
    pass

@register_format_type('date')
class Date(FormattedDetailColumn):
    XPATH_FUNCTION = "if({xpath} = '', '', format-date(date({xpath}), '{column.date_format}'))"
    SORT_XPATH_FUNCTION = "{xpath}"

@register_format_type('time-ago')
class TimeAgo(FormattedDetailColumn):
    XPATH_FUNCTION = "if({xpath} = '', '', string(int((today() - date({xpath})) div {column.time_ago_interval})))"
    SORT_XPATH_FUNCTION = "{xpath}"

@register_format_type('distance')
class Distance(FormattedDetailColumn):
    XPATH_FUNCTION = "if(here() = '' or {xpath} = '', '', concat(round(distance({xpath}, here()) div 100) div 10, ' km'))"
    SORT_XPATH_FUNCTION = "if({xpath} = '', 2147483647, round(distance({xpath}, here())))"
    SORT_TYPE = 'double'

@register_format_type('phone')
class Phone(FormattedDetailColumn):

    @property
    def template_form(self):
        if self.detail.display == 'long':
            return 'phone'

@register_format_type('enum')
class Enum(FormattedDetailColumn):
    def _make_xpath(self, type):
        return sx.XPathEnum.build(
            enum=self.column.enum,
            format=self.column.format,
            type=type,
            template=self._xpath_template(type),
            get_template_context=self._xpath_template_context(type),
            get_value=lambda key: self.id_strings.detail_column_enum_variable(self.module, self.detail_type,
                                                                              self.column, key))

    def _xpath_template(self, type):
        if type == 'sort':
            return "if(selected({xpath}, '{key}'), {i}, "
        if type == 'display':
            return "if(selected({xpath}, '{key}'), ${key_as_var}, ''), "
        raise ValueError('type must be in sort, display')

    def _xpath_template_context(self, type):
        return lambda item, i: {
            'key': item.key,
            'key_as_var': item.key_as_variable,
            'xpath': '$calculated_property' if self.column.useXpathExpression else self.xpath,
            'i': i,
        }

    @property
    def xpath_function(self):
        return self._make_xpath('display').function

    @property
    def sort_xpath_function(self):
        return self._make_xpath('sort').function

    @property
    def variables(self):
        return {v.name: v.value for v in self._make_xpath('display').variables}

@register_format_type('conditional-enum')
class ConditionalEnum(Enum):
    @property
    def sort_node(self):
        node = super(ConditionalEnum, self).sort_node
        if node:
            variables = self.variables
            for key in variables:
                node.text.xpath.node.append(
                    sx.XPathVariable(name=key, locale_id=variables[key]).node
                )
        return node

    def _xpath_template(self, type):
        return "if({key_as_condition}, {key_as_var_name}"

    def _xpath_template_context(self, type):
        return lambda item, i: {
            'key_as_condition': item.key_as_condition(self.xpath),
            'key_as_var_name': item.ref_to_key_variable(i, 'display')
        }

@register_format_type('enum-image')
class EnumImage(Enum):
    template_form = 'image'

    @property
    def header_width(self):
        return self.template_width

    @property
    def template_width(self):
        '''
        Set column width to accommodate widest image.
        '''
        width = 0
        if self.app.enable_case_list_icon_dynamic_width:
            for i, item in enumerate(self.column.enum):
                for path in item.value.values():
                    map_item = self.app.multimedia_map[path]
                    if map_item is not None:
                        image = CommCareMultimedia.get(map_item.multimedia_id)
                        if image is not None:
                            for media in image.aux_media:
                                width = max(width, media.media_meta['size']['width'])
        if width == 0:
            return '13%'
        return str(width)

    def _xpath_template(self, type):
        return "if({key_as_condition}, {key_as_var_name}"

    def _xpath_template_context(self, type):
        return lambda item, i: {
            'key_as_condition': item.key_as_condition(self.xpath),
            'key_as_var_name': item.ref_to_key_variable(i, type)
        }

@register_format_type('late-flag')
class LateFlag(HideShortHeaderColumn):
    template_width = "11%"

    XPATH_FUNCTION = "if({xpath} = '', '*', if(today() - date({xpath}) > {column.late_flag}, '*', ''))"

@register_format_type('invisible')
class Invisible(HideShortColumn):

    @property
    def header(self):
        """
        header given for an invisible column to enable its display as a sort field in sort menu even
        when missing amongst display properties for case list headers
        refer: http://manage.dimagi.com/default.asp?232411
        """
        if self.sort_element and self.sort_element.has_display_values():
            header = sx.Header(
                text=sx.Text(locale_id=self.locale_id),
                width=self.template_width
            )
        else:
            header = super(Invisible, self).header
        return header

    @property
    def locale_id(self):
        return self.id_strings.detail_column_header_locale(
            self.module, self.detail_type, self.column
        )

@register_format_type('filter')
class Filter(HideShortColumn):

    @property
    def fields(self):
        return []

@register_format_type('markdown')
class Markdown(FormattedDetailColumn):

    @property
    def template_form(self):
        if self.detail.display == 'long':
            return 'markdown'

@register_format_type('address')
class Address(HideShortColumn):
    template_form = 'address'
    template_width = 0

@register_format_type('picture')
class Picture(FormattedDetailColumn):
    template_form = 'image'

@register_format_type('audio')
class Audio(FormattedDetailColumn):
    template_form = 'audio'

@register_format_type('graph')
class Graph(FormattedDetailColumn):
    template_form = "graph"

    @property
    def template(self):
        def _locale_config(key):
            return self.id_strings.graph_configuration(
                self.module,
                self.detail_type,
                self.column,
                key
            )

        def _locale_series_config(index, key):
            return self.id_strings.graph_series_configuration(
                self.module,
                self.detail_type,
                self.column,
                index,
                key
            )

        def _locale_annotation(index):
            return self.id_strings.graph_annotation(
                self.module,
                self.detail_type,
                self.column,
                index
            )

        return sx.GraphTemplate.build(self.template_form, self.column.graph_configuration,
                                      locale_config=_locale_config, locale_series_config=_locale_series_config,
                                      locale_annotation=_locale_annotation)

@register_type_processor(const.FIELD_TYPE_ATTACHMENT)
class AttachmentXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        return const.FIELD_TYPE_ATTACHMENT + "/" + self.column.field_property

@register_type_processor(const.FIELD_TYPE_PROPERTY)
class PropertyXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        if self.column.model == 'product':
            return self.column.field

        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_absolute = indexes or property == '#owner_name'
        if use_absolute:
            case = CaseXPath('current()')
        else:
            case = CaseXPath('')

        if indexes and indexes[0] == 'user':
            case = CaseXPath(UsercaseXPath().case())
        elif indexes:
            instance_name = self.detail.get_instance_name(self.module)
            for index in indexes:
                case = case.index_id(index).case(instance_name=instance_name)

        if property == '#owner_name':
            return self.owner_name(case.property('@owner_id'))
        else:
            return case.property(property)

    @staticmethod
    def owner_name(owner_id):
        groups = XPath("instance('groups')/groups/group")
        group = groups.select('@id', owner_id)
        return XPath.if_(
            group.count().neq(0),
            group.slash('name'),
            XPath.if_(
                CommCareSession.userid.eq(owner_id),
                CommCareSession.username,
                XPath.string('')
            )
        )

@register_type_processor(const.FIELD_TYPE_INDICATOR)
class IndicatorXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        indicator_set, indicator = self.column.field_property.split('/', 1)
        instance_id = self.id_strings.indicator_instance(indicator_set)
        return IndicatorXpath(instance_id).instance().slash(indicator)

@register_type_processor(const.FIELD_TYPE_LOCATION)
class LocationXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        from corehq.apps.locations.util import parent_child
        hierarchy = parent_child(self.app.domain)
        return LocationXpath('commtrack:locations').location(self.column.field_property, hierarchy)

@register_type_processor(const.FIELD_TYPE_LEDGER)
class LedgerXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        session_case_id = 'case_id_case_{0}'.format(self.module.case_type)
        section = self.column.field_property

        return "if({0} = 0 or {1} = 0 or {2} = 0, '', {3})".format(
            LedgerdbXpath(session_case_id).ledger().count(),
            LedgerdbXpath(session_case_id).ledger().section(section).count(),
            LedgerdbXpath(session_case_id).ledger().section(section).entry('current()/@id').count(),
            LedgerdbXpath(session_case_id).ledger().section(section).entry('current()/@id')
        )

@register_type_processor(const.FIELD_TYPE_SCHEDULE)
class ScheduleXpathGenerator(BaseXpathGenerator):

    @property
    def xpath(self):
        return "${}".format(self.column.field_property)


text:
<?php

$GLOBALS['TL_LANG']['MOD']['videobox']['0'] = "VideoBox";
$GLOBALS['TL_LANG']['MOD']['videobox']['1'] = "Ce module permet de transformer votre TYPOlight en un système de gestion de vidéos.";

?>


text:
{% for article in object_list %}

        {{ article.title|striptags }}

    {{ article.resumen|safe|escape }}

    Publicado en la categoría

        {{ article.category }}

    Etiquetas:  {% for tag in article.tags.all %}{{ tag }} {% endfor %}
    <time class="post-date" itemprop="datePublished" datetime="{{ article.pub_date|date:'c' }}"> {{ article.pub_date }}</time>

{% endfor %}