text:
package com.sien.lib.databmob.db;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import com.sien.lib.databmob.beans.AimTypeVO;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
 * DAO for table "AIM_TYPE_VO".
*/
public class AimTypeVODao extends AbstractDao<AimTypeVO, Long> {

    public static final String TABLENAME = "AIM_TYPE_VO";

    /**
     * Properties of entity AimTypeVO.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "ID");
        public final static Property TypeName = new Property(1, String.class, "typeName", false, "TYPE_NAME");
        public final static Property Desc = new Property(2, String.class, "desc", false, "DESC");
        public final static Property Customed = new Property(3, Boolean.class, "customed", false, "CUSTOMED");
        public final static Property Recyclable = new Property(4, Boolean.class, "recyclable", false, "RECYCLABLE");
        public final static Property Priority = new Property(5, Integer.class, "priority", false, "PRIORITY");
        public final static Property Period = new Property(6, Integer.class, "period", false, "PERIOD");
        public final static Property TargetPeriod = new Property(7, Integer.class, "targetPeriod", false, "TARGET_PERIOD");
        public final static Property FinishStatus = new Property(8, Integer.class, "finishStatus", false, "FINISH_STATUS");
        public final static Property FinishPercent = new Property(9, Integer.class, "finishPercent", false, "FINISH_PERCENT");
        public final static Property StartTime = new Property(10, java.util.Date.class, "startTime", false, "START_TIME");
        public final static Property EndTime = new Property(11, java.util.Date.class, "endTime", false, "END_TIME");
        public final static Property ModifyTime = new Property(12, java.util.Date.class, "modifyTime", false, "MODIFY_TIME");
        public final static Property Active = new Property(13, Boolean.class, "active", false, "ACTIVE");
        public final static Property FirstExtra = new Property(14, String.class, "firstExtra", false, "FIRST_EXTRA");
        public final static Property SecondExtra = new Property(15, String.class, "secondExtra", false, "SECOND_EXTRA");
        public final static Property PlanProject = new Property(16, Boolean.class, "planProject", false, "PLAN_PROJECT");
        public final static Property Cover = new Property(17, String.class, "cover", false, "COVER");
    }

    public AimTypeVODao(DaoConfig config) {
        super(config);
    }

    public AimTypeVODao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"AIM_TYPE_VO\" (" + //
                "\"ID\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                "\"TYPE_NAME\" TEXT," + // 1: typeName
                "\"DESC\" TEXT," + // 2: desc
                "\"CUSTOMED\" INTEGER," + // 3: customed
                "\"RECYCLABLE\" INTEGER," + // 4: recyclable
                "\"PRIORITY\" INTEGER," + // 5: priority
                "\"PERIOD\" INTEGER," + // 6: period
                "\"TARGET_PERIOD\" INTEGER," + // 7: targetPeriod
                "\"FINISH_STATUS\" INTEGER," + // 8: finishStatus
                "\"FINISH_PERCENT\" INTEGER," + // 9: finishPercent
                "\"START_TIME\" INTEGER," + // 10: startTime
                "\"END_TIME\" INTEGER," + // 11: endTime
                "\"MODIFY_TIME\" INTEGER," + // 12: modifyTime
                "\"ACTIVE\" INTEGER," + // 13: active
                "\"FIRST_EXTRA\" TEXT," + // 14: firstExtra
                "\"SECOND_EXTRA\" TEXT," + // 15: secondExtra
                "\"PLAN_PROJECT\" INTEGER," + // 16: planProject
                "\"COVER\" TEXT);"); // 17: cover
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"AIM_TYPE_VO\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, AimTypeVO entity) {
        stmt.clearBindings();

        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }

        String typeName = entity.getTypeName();
        if (typeName != null) {
            stmt.bindString(2, typeName);
        }

        String desc = entity.getDesc();
        if (desc != null) {
            stmt.bindString(3, desc);
        }

        Boolean customed = entity.getCustomed();
        if (customed != null) {
            stmt.bindLong(4, customed ? 1L: 0L);
        }

        Boolean recyclable = entity.getRecyclable();
        if (recyclable != null) {
            stmt.bindLong(5, recyclable ? 1L: 0L);
        }

        Integer priority = entity.getPriority();
        if (priority != null) {
            stmt.bindLong(6, priority);
        }

        Integer period = entity.getPeriod();
        if (period != null) {
            stmt.bindLong(7, period);
        }

        Integer targetPeriod = entity.getTargetPeriod();
        if (targetPeriod != null) {
            stmt.bindLong(8, targetPeriod);
        }

        Integer finishStatus = entity.getFinishStatus();
        if (finishStatus != null) {
            stmt.bindLong(9, finishStatus);
        }

        Integer finishPercent = entity.getFinishPercent();
        if (finishPercent != null) {
            stmt.bindLong(10, finishPercent);
        }

        java.util.Date startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindLong(11, startTime.getTime());
        }

        java.util.Date endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindLong(12, endTime.getTime());
        }

        java.util.Date modifyTime = entity.getModifyTime();
        if (modifyTime != null) {
            stmt.bindLong(13, modifyTime.getTime());
        }

        Boolean active = entity.getActive();
        if (active != null) {
            stmt.bindLong(14, active ? 1L: 0L);
        }

        String firstExtra = entity.getFirstExtra();
        if (firstExtra != null) {
            stmt.bindString(15, firstExtra);
        }

        String secondExtra = entity.getSecondExtra();
        if (secondExtra != null) {
            stmt.bindString(16, secondExtra);
        }

        Boolean planProject = entity.getPlanProject();
        if (planProject != null) {
            stmt.bindLong(17, planProject ? 1L: 0L);
        }

        String cover = entity.getCover();
        if (cover != null) {
            stmt.bindString(18, cover);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, AimTypeVO entity) {
        stmt.clearBindings();

        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }

        String typeName = entity.getTypeName();
        if (typeName != null) {
            stmt.bindString(2, typeName);
        }

        String desc = entity.getDesc();
        if (desc != null) {
            stmt.bindString(3, desc);
        }

        Boolean customed = entity.getCustomed();
        if (customed != null) {
            stmt.bindLong(4, customed ? 1L: 0L);
        }

        Boolean recyclable = entity.getRecyclable();
        if (recyclable != null) {
            stmt.bindLong(5, recyclable ? 1L: 0L);
        }

        Integer priority = entity.getPriority();
        if (priority != null) {
            stmt.bindLong(6, priority);
        }

        Integer period = entity.getPeriod();
        if (period != null) {
            stmt.bindLong(7, period);
        }

        Integer targetPeriod = entity.getTargetPeriod();
        if (targetPeriod != null) {
            stmt.bindLong(8, targetPeriod);
        }

        Integer finishStatus = entity.getFinishStatus();
        if (finishStatus != null) {
            stmt.bindLong(9, finishStatus);
        }

        Integer finishPercent = entity.getFinishPercent();
        if (finishPercent != null) {
            stmt.bindLong(10, finishPercent);
        }

        java.util.Date startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindLong(11, startTime.getTime());
        }

        java.util.Date endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindLong(12, endTime.getTime());
        }

        java.util.Date modifyTime = entity.getModifyTime();
        if (modifyTime != null) {
            stmt.bindLong(13, modifyTime.getTime());
        }

        Boolean active = entity.getActive();
        if (active != null) {
            stmt.bindLong(14, active ? 1L: 0L);
        }

        String firstExtra = entity.getFirstExtra();
        if (firstExtra != null) {
            stmt.bindString(15, firstExtra);
        }

        String secondExtra = entity.getSecondExtra();
        if (secondExtra != null) {
            stmt.bindString(16, secondExtra);
        }

        Boolean planProject = entity.getPlanProject();
        if (planProject != null) {
            stmt.bindLong(17, planProject ? 1L: 0L);
        }

        String cover = entity.getCover();
        if (cover != null) {
            stmt.bindString(18, cover);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }

    @Override
    public AimTypeVO readEntity(Cursor cursor, int offset) {
        AimTypeVO entity = new AimTypeVO( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // typeName
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc
            cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0, // customed
            cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0, // recyclable
            cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // priority
            cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // period
            cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // targetPeriod
            cursor.isNull(offset + 8) ? null : cursor.getInt(offset + 8), // finishStatus
            cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9), // finishPercent
            cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)), // startTime
            cursor.isNull(offset + 11) ? null : new java.util.Date(cursor.getLong(offset + 11)), // endTime
            cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12)), // modifyTime
            cursor.isNull(offset + 13) ? null : cursor.getShort(offset + 13) != 0, // active
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // firstExtra
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // secondExtra
            cursor.isNull(offset + 16) ? null : cursor.getShort(offset + 16) != 0, // planProject
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17) // cover
        );
        return entity;
    }

    @Override
    public void readEntity(Cursor cursor, AimTypeVO entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setTypeName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setCustomed(cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0);
        entity.setRecyclable(cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0);
        entity.setPriority(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
        entity.setPeriod(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
        entity.setTargetPeriod(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
        entity.setFinishStatus(cursor.isNull(offset + 8) ? null : cursor.getInt(offset + 8));
        entity.setFinishPercent(cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9));
        entity.setStartTime(cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)));
        entity.setEndTime(cursor.isNull(offset + 11) ? null : new java.util.Date(cursor.getLong(offset + 11)));
        entity.setModifyTime(cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12)));
        entity.setActive(cursor.isNull(offset + 13) ? null : cursor.getShort(offset + 13) != 0);
        entity.setFirstExtra(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setSecondExtra(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setPlanProject(cursor.isNull(offset + 16) ? null : cursor.getShort(offset + 16) != 0);
        entity.setCover(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
     }

    @Override
    protected final Long updateKeyAfterInsert(AimTypeVO entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }

    @Override
    public Long getKey(AimTypeVO entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(AimTypeVO entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }

}


text:
package org.basex.query.var;

import static org.basex.query.QueryError.*;
import static org.basex.query.QueryText.*;

import org.basex.query.*;
import org.basex.query.ann.*;
import org.basex.query.expr.*;
import org.basex.query.scope.*;
import org.basex.query.util.*;
import org.basex.query.util.list.*;
import org.basex.query.value.*;
import org.basex.query.value.type.*;
import org.basex.util.*;

/**
 * Static variable to which an expression can be assigned.
 *
 * @author BaseX Team 2005-20, BSD License
 * @author Leo Woerteler
 */
public final class StaticVar extends StaticDecl {
  /** If this variable can be bound from outside the query. */
  public final boolean external;
  /** Flag for lazy evaluation. */
  private final boolean lazy;

  /** Bound value. */
  Value value;

  /**
   * Constructor for a variable declared in a query.
   * @param vs variable scope
   * @param anns annotations
   * @param var variable
   * @param expr expression to be bound
   * @param external external flag
   * @param doc xqdoc string
   */
  StaticVar(final VarScope vs, final AnnList anns, final Var var, final Expr expr,
      final boolean external, final String doc) {
    super(anns, var.name, var.declType, vs, doc, var.info);
    this.expr = expr;
    this.external = external;
    lazy = anns.contains(Annotation._BASEX_LAZY);
  }

  @Override
  public void comp(final CompileContext cc) throws QueryException {
    if(expr == null) throw VAREMPTY_X.get(info, name());
    if(dontEnter) throw CIRCVAR_X.get(info, name());
    if(compiled) return;
    compiled = true;

    dontEnter = true;
    cc.pushScope(vs);
    try {
      expr = expr.compile(cc);
    } catch(final QueryException qe) {
      // error: set most general sequence type
      declType = SeqType.ITEM_ZM;
      if(lazy) {
        expr = cc.error(qe, expr);
        return;
      }
      throw qe.notCatchable();
    } finally {
      cc.removeScope(this);
      dontEnter = false;
    }

    // by default, pre-evaluate deterministic, non-lazy expressions
    if(expr instanceof Value || !(lazy || expr.has(Flag.NDT))) cc.replaceWith(expr, value(cc.qc));
  }

  /**
   * Evaluates this variable.
   * @param qc query context
   * @return value of this variable
   * @throws QueryException query exception
   */
  Value value(final QueryContext qc) throws QueryException {
    if(dontEnter) throw CIRCVAR_X.get(info, name());

    if(lazy) {
      if(!compiled) throw Util.notExpected(this + " was not compiled.");
    } else {
      if(expr == null) throw VAREMPTY_X.get(info, name());
    }

    if(value != null) return value;
    dontEnter = true;

    final int fp = vs.enter(qc);
    try {
      return bindValue(expr.value(qc), qc);
    } catch(final QueryException qe) {
      if(lazy) qe.notCatchable();
      throw qe;
    } finally {
      VarScope.exit(fp, qc);
      dontEnter = false;
    }
  }

  /**
   * Ensures that the variable expression is not updating.
   * @throws QueryException query exception
   */
  void checkUp() throws QueryException {
    if(expr != null && expr.has(Flag.UPD)) throw UPNOT_X.get(info, description());
  }

  /**
   * Binds an external value and casts it to the declared type (if specified).
   * @param val value to bind
   * @param qc query context
   * @throws QueryException query exception
   */
  void bind(final Value val, final QueryContext qc) throws QueryException {
    if(!external || compiled) return;
    bindValue(declType == null || declType.instance(val) ? val :
      declType.cast(val, qc, sc, info), qc);
  }

  /**
   * Binds the specified value to the variable.
   * @param val value to be set
   * @param qc query context
   * @return self reference
   * @throws QueryException query exception
   */
  private Value bindValue(final Value val, final QueryContext qc) throws QueryException {
    expr = val;
    value = val;
    if(declType != null) declType.treat(val, name, qc, info);
    return value;
  }

  @Override
  public boolean visit(final ASTVisitor visitor) {
    return expr == null || expr.accept(visitor);
  }

  @Override
  public byte[] id() {
    return Token.concat(Token.DOLLAR, name.id());
  }

  /**
   * Returns the name of the variable.
   * @return name
   */
  private String name() {
    return Strings.concat(Token.DOLLAR, name.string());
  }

  /**
   * Indicates if the expression bound to this variable has one of the specified compiler
   * properties.
   * @param flags flags
   * @return result of check
   * @see Expr#has(Flag...)
   */
  boolean has(final Flag... flags) {
    if(dontEnter || expr == null) return false;
    dontEnter = true;
    final boolean res = expr.has(flags);
    dontEnter = false;
    return res;
  }

  @Override
  public String description() {
    return "variable declaration";
  }

  @Override
  public void plan(final QueryPlan plan) {
    plan.add(plan.create(this, NAME, name.string()), expr);
  }

  @Override
  public String toString() {
    final TokenBuilder tb = new TokenBuilder().add(DECLARE).add(' ').add(anns);
    tb.add(VARIABLE).add(' ').add(name());
    if(declType != null) tb.add(' ').add(AS).add(' ').add(declType);
    if(external) tb.add(' ').add(EXTERNAL);
    if(expr != null) tb.add(' ').add(ASSIGN).add(' ').add(expr);
    return tb.add(';').toString();
  }
}

redpajama_set_name: RedPajamaGithub


text:
DrBayes is a [naive Bayes classifier](https://en.wikipedia.org/wiki/Naive_Bayes_classifier). It is intended as a tutorial for:

- [probabilistic classification](https://en.wikipedia.org/wiki/Probabilistic_classification) with incomplete information
- using [pandas](http://pandas.pydata.org/) to work around missing data
- using CSV and JSON files for table and dictionary storage

## quickstart

1. [Clone this repository](https://help.github.com/articles/cloning-a-repository/) to any folder on your machine.
2. Open a terminal and `cd` to that folder.
3. Enter `python DrBayes.py` to run Python interactively.

DrBayes will:

- ask you several yes/no questions
- diagnose you with one of the conditions in [Symptoms.csv](Symptoms.csv)
- assign you a doctor from [Doctors.json](Doctors.json)

## how it works

Before asking any questions, DrBayes has
[prior beliefs](https://en.wikipedia.org/wiki/Prior_probability)
about your health. After each answer, DrBayes updates its beliefs using
[Bayesian inference](https://en.wikipedia.org/wiki/Bayesian_inference).

Suppose that, among patients who suffer from *Boneitis*,

- 99% report joint pain
- 20% report cold skin
- 5% report numbness
- 1% report multiple shadows

Each of these numbers can be interpreted as a
[conditional probability](https://en.wikipedia.org/wiki/Conditional_probability):

```
P(patient reports "joint pain" | patient has Boneitis) = 0.99
```
Given that you have reported joint pain, the
[likelihood](https://en.wikipedia.org/wiki/Likelihood_function)
that you have Boneitits is:

```
L( you have Boneitits | you reported "joint pain" ) = 0.99
```

The general algorithm after each question is:

```
new_beliefs = old_beliefs * likelihood
new_beliefs /= sum(new_beliefs)
```
The last step ensures that all probabilities sum to 1.

Missing values in Symptoms.csv will be filled with [null values](http://pandas.pydata.org/pandas-docs/stable/missing_data.html) and ignored during calculations. If the patient declines to answer a question, then DrBayes will ignore that question and continue.


text:
Data from <https://github.com/ewels/MultiQC/issues/737>

Description:

For completeness below the code used to run the TIN module, and the results have been attached. (the txt file `*out.summary.txt` contains the summary of the sample (i.e. median + SD), the xls [actually, also a tab delim txt] file `*out.tin.xls` the TIN score per transcript).

```console
[guidoh@localhost P15-1-6h]$ tin.py -i P15-1-6h_Aligned.sortedByCoord.out.bam -r /mnt/files/guido/INDEX/STAR/Housekeeping_TranscriptsHuman2158.bed
@ 2021-06-10 11:44:04: Get BAM file(s) ...
Total 1 BAM file(s):
        P15-1-6h_Aligned.sortedByCoord.out.bam
@ 2021-06-10 11:44:04: Processing P15-1-6h_Aligned.sortedByCoord.out.bam
[guidoh@localhost P15-1-6h]$
```


text:
package xmlobject.extensions.interfaceFeature.readOnlyBean.checkin;

import interfaceFeature.xbean.readOnlyBean.purchaseOrder.PurchaseOrderDocument ;
import interfaceFeature.xbean.readOnlyBean.purchaseOrder.PurchaseOrderType;
import interfaceFeature.xbean.readOnlyBean.purchaseOrder.Items;

import java.math.BigDecimal;
import junit.framework.*;

public class ReadOnlyTest extends TestCase{

      public  ReadOnlyTest(String s){
            super(s);
        }
    public void test(){

         PurchaseOrderDocument poDoc ;

         poDoc= PurchaseOrderDocument.Factory.newInstance();
         PurchaseOrderType po=poDoc.addNewPurchaseOrder();
         int LEN=20;

         Items.Item[] it= new Items.Item[LEN];
         for (int i=0; i< LEN; i++){
                it[i]=Items.Item.Factory.newInstance();
                it[i].setUSPrice(new BigDecimal(""+ 4 ));
         }
         Items items= Items.Factory.newInstance();
            items.setItemArray(it);
         po.setItems(items);

         StringBuffer sb = new StringBuffer();
        sb.append(
                "<pur:purchaseOrder xmlns:pur=\"http://xbean.interface_feature/readOnlyBean/PurchaseOrder\">");

        sb.append("<pur:items>");

        StringBuffer sbContent = new StringBuffer();
        for (int i = 0; i < LEN; i++)
            sbContent.append("<pur:item><pur:USPrice>4</pur:USPrice></pur:item>");

        int pos = sb.length();
        sb.append("</pur:items></pur:purchaseOrder>");

        String sExpected = sb.subSequence(0, pos) +
                sbContent.toString() +
                sb.subSequence(pos, sb.length());

        assertEquals( sExpected, poDoc.xmlText());

        try{
            poDoc.setPrice(10);

        }catch (Exception t){
            t.printStackTrace(System.err);
            System.exit(-1);
        }

       assertTrue ( !poDoc.validate() );
    }

}


text:
var MY_PROJECT_TASKS_ROUTE = (function(){

    var pageSize  = 20,
        pageCount = 0,
        ownerName = '',
        projectName = '',
        projectData = null,
        taskCounts = null,
        userName = null,
        $container = null;

    function loadProject(){
        var path = '/api/user/' + ownerName + '/project/' + projectName;
        var successed = function(data){
            if(data.data){
                coding.showProjectBreadcrumb(data.data);
                projectData = data.data;
                getUserTaskCount();
                loadProcessingTasks();
                loadDoneTasks();
            }
        }
       coding.get(path,successed);
    }

    function getUserTaskCount() {
        var path = '/api/project/' + projectData.id + '/task/user/count';
        var successed = function(data){
            if(data.data){
                taskCounts = data.data;
            }
            loadMembers();
        };
        coding.get(path,successed);
    }

    function loadMembers(){
        var path = '/api/project/' + projectData.id + '/members?page=1&pageSize=9999';
        var successed = function(data){
            if(data.data){
                setMenu(data.data);
            }
        };
        coding.get(path, successed);
    }
    function setMenu(data){
        // 只显示有任务的人员
        var tasks = [];
        var current_user = null;
        var selected_user = null;

        for(var i =0;i<data.list.length;i++){
            var cnt = 0;
            data.list[i].user.avatar = coding.assetPath(data.list[i].user.avatar);
            if(taskCounts && taskCounts.length){
                for(var j = 0; j<taskCounts.length;j++){
                    if(data.list[i].user_id == taskCounts[j].user){
                         cnt = taskCounts[j].processing+taskCounts[j].done;
                    }
                }
            }
            data.list[i].task_count = cnt;
            if(data.list[i].user_id*1 == router.current_user.id*1)
                current_user = data.list[i];
            if(data.list[i].user.global_key == userName)
                selected_user = data.list[i].user;
            if(cnt) // 只显示有任务的
                tasks.push(data.list[i]);
        }

        var tData = {userName:ownerName,
            projectName:projectName,
            selected_user: selected_user,
            current_user:current_user,
            list:tasks,
            projectHomeURL: coding.projectHomePath(ownerName, projectName)
        };
        var rendered = Mustache.render($('#theader').html(), tData);
        $("nav.main-navbar").after(rendered);

    }

    function loadProcessingTasks(){
        var path = '/api/user/' + ownerName + '/project/' + projectName + '/tasks';
        if(userName){
            path += '/user/'+userName;
        }
        path +='/processing?page=1&pageSize=9999';
        coding.get(path, assembleProcessingDOM);
    }

    function loadDoneTasks(){
        coding.loading();
        var path = '/api/user/' + ownerName + '/project/' + projectName + '/tasks';
        if(userName){
            path += '/user/'+userName;
        }
        path += '/done';

        pageCount++;

        path += '?page=' + pageCount + '&' + 'pageSize='+pageSize;
        coding.get(path, assembleDoneDOM, null, coding.loadingDone);
    }

    function assembleProcessingDOM(data) {
        if(data.data.list&&data.data.list.length){
            data.data.list[0].hideFirstLine = true;
        }

        if(data.data.list.length){
            $("#processing-container").show();
        }else{
            $("#processing-container").hide();
        }

        $("#tprocessing").html('');
        if(data.data.list.length){
            $("#task_container").show();
        }

        assembleDOM(data.data, '#tprocessing', '#tlist');
    }
    function assembleDoneDOM(data) {
        if(pageCount === 1 && data.data.list&&data.data.list.length){
            data.data.list[0].hideFirstLine = true;
        }
        if(pageCount == 1){

            if(data.data.list.length){
                $('#done-container').show();
            } else {
                $('#done-container').hide();
            }
        }
        if(data.data.list.length){
            $("#task_container").show();
        }
        assembleDOM(data.data, '#tdone', '#tlist');
    }
    function assembleDOM(data, container, template){
        if(!data || !data.list || !data.list.length) return;
        data.projectHomeURL = coding.projectHomePath(ownerName, projectName);

        for (var index = 0; index < data.list.length; index++) {
            var element = data.list[index];
            data.list[index].project_name = projectName;

            var d = moment(element.created_at);
            var dt = moment(element.deadline, "YYYY-MM-DD");

            data.list[index].deadline_display = dt.format("MM/DD")
            data.list[index].display = d.fromNow();

            data.list[index].owner.avatar = coding.assetPath(data.list[index].owner.avatar);

            var deadline_style = '';
            if(element.status == 2){
                deadline_style = 'done';
            } else if (moment().add(1, 'days').format("YYYYMMDD") == dt.format("YYYYMMDD")){
                deadline_style = 'tomorrow';
            } else if (moment().format("YYYYMMDD") == dt.format("YYYYMMDD")){
                deadline_style = 'today';
            } else if (moment().format("YYYYMMDD") > dt.format("YYYYMMDD")){
                deadline_style = 'expired';
            }
            data.list[index].deadline_style = deadline_style;
            data.list[index].isDone = element.status == 2;

            data.list[index].priority_list = [];
            for(var t = 0; t<element.priority;t++)
                data.list[index].priority_list.push({color:'#f24b4b', image:'priority.png'});
            for(var t = 0; t<3-element.priority;t++)
                data.list[index].priority_list.push({color:'#c3d3da', image:'priority_gray.png'});
            data.list[index].priority_list[0].isFirst = true;
        }

        var rendered = Mustache.render($(template).html(), data);
        $(container).append(rendered);
    }

    function updateTaskStatus(e){
        e.preventDefault();
        var status = this.checked ? 2 : 1;
        var id = $(this).attr('data-task-id');
        var path = '/api/task/'+id+'/status';
        coding.put(path, {status: status}, function(data){
            pageCount = 0;
            $("#tprocessing").html('');
            $("#tdone").html('');
            loadProcessingTasks();
            loadDoneTasks();
        });
    }

    function hideTaskHeader(event) {
        var clickTarget = $(event.target);
        var isOpened = $("#taskHeader").hasClass("in");
        if (isOpened && (!clickTarget.hasClass("nav-content text-md"))) {
            $("#taskHeader").collapse('hide');
        }
    }

    return {
        template_url: '/views/my_project_tasks.html',
        context: ".container",
        before_enter: function(user, project, member){
            $('#navigator').find('.li-project').addClass('active');
            $('#navigator').find(".li-project img").attr('src','/images/icons/project_active.png');
            pageCount = 0;
            $('#tprocessing').html('');
            $('#tdone').html('');
            $("#task_container").hide();
        },
        on_enter: function(user, project, member){
            ownerName = user;
            projectName = project;
            userName = member;

            $("#create_task").attr('href', coding.projectHomePath(ownerName, projectName)+'/task/create');

            loadProject();

            var element = $("#load_more");
            element.on('click', function(e){
                e.preventDefault();
                loadDoneTasks();
            });

            $(document).on('change', '.task-status-checkbox', updateTaskStatus);

            $(document).click(hideTaskHeader);

        },
        on_exit: function(){
            $(document).off('click', hideTaskHeader);
            $(document).off('change', '.task-status-checkbox');
            $('#navigator').find('li').removeClass('active');
            $('#navigator').find(".li-project img").attr('src','/images/icons/project.png');
            $('.project_header').remove();
            $("#taskHeader").remove();
            coding.showBanner();
        }
    }

})();


text:
namespace RDKit {

void MolDraw2DCairo::initDrawing() {
  if (dp_cr) {
    if (cairo_get_reference_count(dp_cr) > 0) {
      cairo_destroy(dp_cr);
    }
    dp_cr = nullptr;
  }
  cairo_surface_t *surf =
      cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width(), height());
  dp_cr = cairo_create(surf);
  cairo_surface_destroy(surf);  // dp_cr has a reference to this now;
  cairo_set_line_cap(dp_cr, CAIRO_LINE_CAP_BUTT);
  if (!text_drawer_) {
    initTextDrawer(df_noFreetype);
  } else {
#ifdef RDK_BUILD_FREETYPE_SUPPORT
    if (df_noFreetype) {
      dynamic_cast<MolDraw2D_detail::DrawTextCairo *>(text_drawer_.get())
          ->setCairoContext(dp_cr);
    } else {
      MolDraw2D_detail::DrawTextFTCairo *dt =
          dynamic_cast<MolDraw2D_detail::DrawTextFTCairo *>(text_drawer_.get());
      dt->setCairoContext(dp_cr);
    }
#else
    dynamic_cast<MolDraw2D_detail::DrawTextCairo *>(text_drawer_.get())
        ->setCairoContext(dp_cr);
#endif
  }
}

void MolDraw2DCairo::initTextDrawer(bool noFreetype) {
  double max_fnt_sz = drawOptions().maxFontSize;
  double min_fnt_sz = drawOptions().minFontSize;

  if (noFreetype) {
    text_drawer_.reset(
        new MolDraw2D_detail::DrawTextCairo(max_fnt_sz, min_fnt_sz, dp_cr));
  } else {
#ifdef RDK_BUILD_FREETYPE_SUPPORT
    try {
      text_drawer_.reset(new MolDraw2D_detail::DrawTextFTCairo(
          max_fnt_sz, min_fnt_sz, drawOptions().fontFile, dp_cr));
    } catch (std::runtime_error &e) {
      BOOST_LOG(rdWarningLog)
          << e.what() << std::endl
          << "Falling back to native Cairo text handling." << std::endl;
      text_drawer_.reset(
          new MolDraw2D_detail::DrawTextCairo(max_fnt_sz, min_fnt_sz, dp_cr));
    }
#else
    text_drawer_.reset(
        new MolDraw2D_detail::DrawTextCairo(max_fnt_sz, min_fnt_sz, dp_cr));
#endif
  }
  if (drawOptions().baseFontSize > 0.0) {
    text_drawer_->setBaseFontSize(drawOptions().baseFontSize);
  }
}

// ****************************************************************************
void MolDraw2DCairo::finishDrawing() {}

// ****************************************************************************
void MolDraw2DCairo::setColour(const DrawColour &col) {
  PRECONDITION(dp_cr, "no draw context");
  MolDraw2D::setColour(col);
  cairo_set_source_rgba(dp_cr, col.r, col.g, col.b, col.a);
}

// ****************************************************************************
void MolDraw2DCairo::drawLine(const Point2D &cds1, const Point2D &cds2,
                              bool rawCoords) {
  PRECONDITION(dp_cr, "no draw context");
  Point2D c1 = rawCoords ? cds1 : getDrawCoords(cds1);
  Point2D c2 = rawCoords ? cds2 : getDrawCoords(cds2);

  double width = getDrawLineWidth();
  std::string dashString = "";

  cairo_set_line_width(dp_cr, width);

  const DashPattern &dashes = dash();
  if (dashes.size()) {
    auto *dd = new double[dashes.size()];
    std::copy(dashes.begin(), dashes.end(), dd);
    cairo_set_dash(dp_cr, dd, dashes.size(), 0);
    delete[] dd;
  } else {
    cairo_set_dash(dp_cr, nullptr, 0, 0);
  }

  cairo_move_to(dp_cr, c1.x, c1.y);
  cairo_line_to(dp_cr, c2.x, c2.y);
  cairo_stroke(dp_cr);
}

// ****************************************************************************
void MolDraw2DCairo::drawWavyLine(const Point2D &cds1, const Point2D &cds2,
                                  const DrawColour &col1, const DrawColour &,
                                  unsigned int nSegments, double vertOffset,
                                  bool rawCoords) {
  PRECONDITION(dp_cr, "no draw context");
  PRECONDITION(nSegments > 1, "too few segments");

  auto segments =
      MolDraw2D_detail::getWavyLineSegments(cds1, cds2, nSegments, vertOffset);

  double width = getDrawLineWidth();
  cairo_set_line_width(dp_cr, width);
  cairo_set_dash(dp_cr, nullptr, 0, 0);
  setColour(col1);

  auto c1 = std::get<0>(segments[0]);
  c1 = rawCoords ? c1 : getDrawCoords(c1);

  cairo_move_to(dp_cr, c1.x, c1.y);
  for (unsigned int i = 0; i < nSegments; ++i) {
    auto cpt1 = std::get<1>(segments[i]);
    cpt1 = rawCoords ? cpt1 : getDrawCoords(cpt1);
    auto cpt2 = std::get<2>(segments[i]);
    cpt2 = rawCoords ? cpt2 : getDrawCoords(cpt2);
    auto segpt = std::get<3>(segments[i]);
    segpt = rawCoords ? segpt : getDrawCoords(segpt);
    cairo_curve_to(dp_cr, cpt1.x, cpt1.y, cpt2.x, cpt2.y, segpt.x, segpt.y);
  }
  cairo_stroke(dp_cr);
}

// ****************************************************************************
void MolDraw2DCairo::drawPolygon(const std::vector<Point2D> &cds,
                                 bool rawCoords) {
  PRECONDITION(dp_cr, "no draw context");
  PRECONDITION(cds.size() >= 3, "must have at least three points");

  double width = getDrawLineWidth();

  cairo_line_cap_t olinecap = cairo_get_line_cap(dp_cr);
  cairo_line_join_t olinejoin = cairo_get_line_join(dp_cr);

  cairo_set_line_cap(dp_cr, CAIRO_LINE_CAP_BUTT);
  cairo_set_line_join(dp_cr, CAIRO_LINE_JOIN_BEVEL);
  cairo_set_dash(dp_cr, nullptr, 0, 0);
  cairo_set_line_width(dp_cr, width);

  if (!cds.empty()) {
    Point2D lc = rawCoords ? cds.front() : getDrawCoords(cds.front());
    cairo_move_to(dp_cr, lc.x, lc.y);
    for (unsigned int i = 1; i < cds.size(); ++i) {
      Point2D lci = rawCoords ? cds[i] : getDrawCoords(cds[i]);
      cairo_line_to(dp_cr, lci.x, lci.y);
    }
  }

  if (fillPolys()) {
    cairo_close_path(dp_cr);
    cairo_fill_preserve(dp_cr);
  }
  cairo_stroke(dp_cr);
  cairo_set_line_cap(dp_cr, olinecap);
  cairo_set_line_join(dp_cr, olinejoin);
}

// ****************************************************************************
void MolDraw2DCairo::clearDrawing() {
  MolDraw2D::clearDrawing();
  PRECONDITION(dp_cr, "no draw context");
  setColour(drawOptions().backgroundColour);
  cairo_rectangle(dp_cr, offset().x, offset().y, width(), height());
  cairo_fill(dp_cr);
}

// ****************************************************************************
namespace {
cairo_status_t grab_str(void *closure, const unsigned char *data,
                        unsigned int len) {
  auto *str_ptr = (std::string *)closure;
  (*str_ptr) += std::string((const char *)data, len);
  return CAIRO_STATUS_SUCCESS;
}
}  // namespace
std::string MolDraw2DCairo::getDrawingText() const {
  PRECONDITION(dp_cr, "no draw context");
  std::string res = "";
  cairo_surface_t *surf = cairo_get_target(dp_cr);
  cairo_surface_write_to_png_stream(surf, &grab_str, (void *)&res);
  res = addMetadataToPNG(res);
  return res;
};

void MolDraw2DCairo::writeDrawingText(const std::string &fName) const {
  PRECONDITION(dp_cr, "no draw context");
  auto png = getDrawingText();
  std::ofstream outs(fName.c_str(), std::ios_base::binary | std::ios_base::out);
  if (!outs || outs.bad()) {
    BOOST_LOG(rdErrorLog) << "Failed to write PNG file " << fName << std::endl;
    return;
  }
  outs.write(png.c_str(), png.size());
};

std::string MolDraw2DCairo::addMetadataToPNG(const std::string &png) const {
  if (d_metadata.empty()) {
    return png;
  }

  return RDKit::addMetadataToPNGString(png, d_metadata);
}

// ****************************************************************************
namespace {
void addMoleculeMetadata(
    const ROMol &mol, int confId,
    std::vector<std::pair<std::string, std::string>> &metadata, unsigned idx) {
  // it's legal to repeat a tag, but a lot of software doesn't show all values
  // so we append a suffix to disambiguate when necessary
  std::string suffix = "";
  if (idx) {
    suffix = (boost::format("%d") % idx).str();
  }
  std::string pkl;
  MolPickler::pickleMol(mol, pkl);
  metadata.push_back(
      std::make_pair(augmentTagName(PNGData::pklTag + suffix), pkl));

  bool includeStereo = true;
  if (mol.getNumConformers()) {
    bool kekulize = false;
    auto molb = MolToV3KMolBlock(mol, includeStereo, confId, kekulize);
    metadata.push_back(
        std::make_pair(augmentTagName(PNGData::molTag + suffix), molb));
  }
  // MolToCXSmiles() is missing the feature that lets us specify confIds
  auto smiles = MolToCXSmiles(mol);
  metadata.push_back(
      std::make_pair(augmentTagName(PNGData::smilesTag + suffix), smiles));
}
void addReactionMetadata(
    const ChemicalReaction &rxn,
    std::vector<std::pair<std::string, std::string>> &metadata) {
  std::string pkl;
  ReactionPickler::pickleReaction(rxn, pkl);
  metadata.push_back(std::make_pair(augmentTagName(PNGData::rxnPklTag), pkl));
  metadata.push_back(std::make_pair(augmentTagName(PNGData::rxnSmartsTag),
                                    ChemicalReactionToRxnSmarts(rxn)));
}
}  // namespace

void MolDraw2DCairo::updateMetadata(const ROMol &mol, int confId) {
  addMoleculeMetadata(mol, confId, d_metadata, d_numMetadataEntries);
  ++d_numMetadataEntries;
}
void MolDraw2DCairo::updateMetadata(const ChemicalReaction &rxn) {
  addReactionMetadata(rxn, d_metadata);
}

}  // namespace RDKit


text:
<?php

$params = require(__DIR__ . '/params.php');

$db = file_exists ( __DIR__ . '/db-local.php') ? require(__DIR__ . '/db-local.php') : require(__DIR__ . '/db.php');
$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'components' => [

        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'i31021ii14i',
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'user' => [
            'identityClass' => 'app\models\Users',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => $db,

        //âõîä ÷åðåç ñîö.ñåòè
        'eauth' => array(
            'class' => 'nodge\eauth\EAuth',
            'popup' => true, // Use the popup window instead of redirecting.
            'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache' on production environments.
            'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited.
            'httpClient' => array(
                // uncomment this to use streams in safe_mode
                //'useStreamsFallback' => true,
            ),
            'services' => array(
                'facebook' => array(
                    // register your app here: https://developers.facebook.com/apps/
                    'class' => 'nodge\eauth\services\FacebookOAuth2Service',
                    'clientId' => '938925966188399',
                    'clientSecret' => '75b0c836a9ce4befcd0577292d46d2c9',
                ),
                'vkontakte' => array(
                    // register your app here: https://vk.com/editapp?act=create&site=1
                    'class' => 'nodge\eauth\services\VKontakteOAuth2Service',
                    'clientId' => '5129094',
                    'clientSecret' => 'v69bSiDxoXvOZ3hg06d4',
                ),
            ),
        ),

        'i18n' => array(
            'translations' => array(
                'eauth' => array(
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@eauth/messages',
                ),
            ),
        ),
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\debug\Module';

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';
}

return $config;


text:
import sys
import radical.pilot as rp

# ##############################################################################
# #104: Some ExecWorker(s) out of memory with a bag of 4096 tasks
# ##############################################################################

# ATTENTION:
#
# This test consumes about 20   CPU hours on stampede -- it is thus not run as
# part of the usual issue testing.

# NOTE:
#
# as is, this script will not be able to reproduce issue #104

#------------------------------------------------------------------------------
#
def pilot_state_cb (pilot, state) :
    """ this callback is invoked on all pilot state changes """

    print "[Callback]: ComputePilot '%s' state: %s." % (pilot.uid, state)

    if  state == rp.FAILED :
        sys.exit (1)

#------------------------------------------------------------------------------
#
def unit_state_change_cb (unit, state) :
    """ this callback is invoked on all unit state changes """

    print "[Callback]: ComputeUnit  '%s' state: %s." % (unit.uid, state)

    if  state == rp.FAILED :
        sys.exit (1)

#------------------------------------------------------------------------------
#
# Create a new session. A session is the 'root' object for all other
# RADICAL-Pilot objects. It encapsualtes the MongoDB connection(s) as
# well as security crendetials.
session = rp.Session()

try:

    # Add a Pilot Manager. Pilot managers manage one or more ComputePilots.
    pmgr = rp.PilotManager(session=session)

    # Register our callback with the PilotManager. This callback will get
    # called every time any of the pilots managed by the PilotManager
    # change their state.
    pmgr.register_callback(pilot_state_cb)

    # Define a 2-core local pilot that runs for 10 minutes.
    pdesc = rp.ComputePilotDescription()
    pdesc.resource = "xsede.stampede"
    pdesc.project  = "TG-MCB090174"
    pdesc.runtime  = 30
    pdesc.cores    = 4096

    # Launch the pilot.
    pilot = pmgr.submit_pilots(pdesc)

    # Create a workload of 8 ComputeUnits (tasks). Each compute unit
    # uses /bin/cat to concatenate two input files, file1.dat and
    # file2.dat. The output is written to STDOUT. cu.environment is
    # used to demonstrate how to set environment variables withih a
    # ComputeUnit - it's not strictly necessary for this example. As
    # a shell script, the ComputeUnits would look something like this:
    #
    #    export INPUT1=file1.dat
    #    export INPUT2=file2.dat
    #    /bin/cat $INPUT1 $INPUT2
    #
    compute_units = []

    for unit_count in range(0, 4 * 4096):
        cu = rp.ComputeUnitDescription()
        cu.executable = "/bin/sleep"
        cu.arguments = ["60"]
        cu.cores = 1

        compute_units.append(cu)

    # Combine the ComputePilot, the ComputeUnits and a scheduler via
    # a UnitManager object.
    umgr = rp.UnitManager(
        session=session,
        scheduler=rp.SCHED_DIRECT_SUBMISSION)

    # Register our callback with the UnitManager. This callback will get
    # called every time any of the units managed by the UnitManager
    # change their state.
    umgr.register_callback(unit_state_change_cb)

    # Add the previsouly created ComputePilot to the UnitManager.
    umgr.add_pilots(pilot)

    # Submit the previously created ComputeUnit descriptions to the
    # PilotManager. This will trigger the selected scheduler to start
    # assigning ComputeUnits to the ComputePilots.
    units = umgr.submit_units(compute_units)

    # Wait for all compute units to finish.
    umgr.wait_units()

    for unit in umgr.get_units():
        # Print some information about the unit.
        print "%s" % str(unit)

        # Get the stdout and stderr streams of the ComputeUnit.
        print "  STDOUT: %s" % unit.stdout
        print "  STDERR: %s" % unit.stderr

    # Cancel all pilots.
    pmgr.cancel_pilots()
    pmgr.wait_pilots()

except Exception as e:
    print "TEST FAILED"
    raise

finally:
    # Remove session from database
    session.close()

# ------------------------------------------------------------------------------


text:
//
//  nswyFollowViewController.m
//  nswy-1
//
//  Created by Mac on 16/12/2.
//  Copyright © 2016年 HBNXWLKJ. All rights reserved.
//

#import "nswyFollowViewController.h"
#import "nswyFollowCell.h"
#import "PYSearch.h"
#import "PYTempViewController.h"
#import "PellTableViewSelect.h"
#import <CoreText/CoreText.h>
#import "nswyCategaryController.h"
@interface nswyFollowViewController ()<PYSearchViewControllerDelegate,UISearchBarDelegate>
/**搜索框*/
@property (nonatomic,strong) UISearchBar * serachBar;

@end

@implementation nswyFollowViewController
static NSString * followCell = @"followCell";
/**
 *设置searchBar
 */
- (void)setUpSearchBar{
     UISearchBar * searchBar = [[UISearchBar alloc]init];
    searchBar.placeholder = @"搜索你要关注的内容或专家";
    searchBar.searchBarStyle = UISearchBarStyleMinimal;
    self.serachBar = searchBar;
    self.serachBar.delegate = self;
    [self.view addSubview:self.serachBar];
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{
    //跳转:
    ZJLog(@"跳转");
    // 1.创建热门搜索
    NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
    // 2. 创建控制器
    PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"搜索编程语言" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
        // 开始搜索执行以下代码
        // 如:跳转到指定控制器
        [searchViewController.navigationController pushViewController:[[PYTempViewController alloc] init] animated:YES];
    }];
    // 3. 设置风格
    // 选择热门搜索
        searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag; // 热门搜索风格根据选择
        searchViewController.searchHistoryStyle = PYHotSearchStyleDefault; // 搜索历史风格为default

    // 4. 设置代理
    searchViewController.delegate = self;
    // 5. 跳转到搜索控制器

    [self.navigationController pushViewController:searchViewController animated:YES];
    return NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpSearchBar];
     self.tableView.showsVerticalScrollIndicator = NO;

    UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"添加关注"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(addFoucs:)];

    self.navigationItem.leftBarButtonItem = item;

   UIButton * titleBtn= [UIButton buttonWithType:UIButtonTypeCustom];
   [titleBtn setFrame:CGRectMake(0, 0, 130, 44)];

    /**
     *  不自动拉伸内部对象 自动布局使用
     */
    // titleBtn.translatesAutoresizingMaskIntoConstraints = !titleBtn.translatesAutoresizingMaskIntoConstraints;
    titleBtn.imageEdgeInsets = UIEdgeInsetsMake(0,100, 0, 0);
    titleBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -30, 0, 0);

//    [titleBtn titleRectForContentRect:CGRectMake(0, 0, 100, 40)];
    [titleBtn setTitle:@"全部关注" forState:UIControlStateNormal];
    [titleBtn setImage:[UIImage imageNamed:@"箭头上"] forState:UIControlStateNormal];
      [titleBtn setImage:[UIImage imageNamed:@"箭头下"] forState:UIControlStateSelected];
    [titleBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [titleBtn addTarget:self action:@selector(selectFocus:) forControlEvents:UIControlEventTouchUpInside];
      ZJLog(@"%@",NSStringFromCGRect([titleBtn imageRectForContentRect:CGRectMake(100, 0, 24, 24 )]));
//    [titleBtn setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
//        [titleBtn setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical];
    self.navigationItem.titleView =titleBtn;

  //  self.tableView.contentInset = UIEdgeInsetsMake(40, 0, 0, 0);

    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([nswyFollowCell class]) bundle:[NSBundle mainBundle]] forCellReuseIdentifier:followCell];

    NSArray *familyNames = [UIFont familyNames];
    for( NSString *familyName in familyNames )
    {
        NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
        for( NSString *fontName in fontNames )
        {
            printf( "\tFont: %s \n", [fontName UTF8String] );
        }
    }

}

-(void)addFoucs:(UIBarButtonItem * )item{

    ZJlogFunction;
    nswyCategaryController * categary = [[nswyCategaryController alloc]initWithStyle:UITableViewStyleGrouped];
    [self.navigationController pushViewController:categary animated:YES];
}

-(void)viewDidLayoutSubviews{
    self.tableView.frame = CGRectMake(0, 40, ZJScreenW, ZJScreenH-40);
    self.serachBar.frame = CGRectMake(0,-40, ZJScreenW, 40);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (!indexPath.row) {
        UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

        cell.imageView.image = [UIImage imageNamed:@"圈子"];
        cell.textLabel.text = @"圈子";

        return cell;
    }
    nswyFollowCell * cell = [tableView dequeueReusableCellWithIdentifier:followCell forIndexPath:indexPath];
    cell.imageView.image = GetImage(@"物种");
   // cell.imageView.backgroundColor = [UIColor redColor];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 80;
}

#pragma mark - PYSearchViewControllerDelegate 搜索框
- (void)searchViewController:(PYSearchViewController *)searchViewController searchTextDidChange:(UISearchBar *)seachBar searchText:(NSString *)searchText
{
    if (searchText.length) { // 与搜索条件再搜索
        // 根据条件发送查询(这里模拟搜索)
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // 搜素完毕
            // 显示建议搜索结果
            NSMutableArray *searchSuggestionsM = [NSMutableArray array];
            for (int i = 0; i < arc4random_uniform(5) + 10; i++) {
                NSString *searchSuggestion = [NSString stringWithFormat:@"搜索建议 %d", i];
                [searchSuggestionsM addObject:searchSuggestion];
            }
            // 返回
            searchViewController.searchSuggestions = searchSuggestionsM;
        });
    }
}

#pragma mark -PellTableViewSelect 关注
- (void)selectFocus:(UIButton *)sender{
    ZJLog(@"%i",sender.selected);
    sender.selected =!sender.selected;
    NSArray * arr =@[@"全部关注",@"关注的服务",@"关注的物种",@"关注的商品",@"关注的知识",@"关注的资讯"];
    [PellTableViewSelect addPellTableViewSelectWithWindowFrame:CGRectMake(sender.frame.origin.x,sender.frame.origin.y , 150,150) selectData:arr images:nil action:^(NSInteger index) {
        NSLog(@"选择%ld",index);
        if (sender.selected) {
              sender.selected = NO;
        }

        [sender setTitle:arr[index] forState:UIControlStateNormal];

       //[sender setImage:[UIImage imageNamed:@"箭头向上"] forState:UIControlStateNormal];

    } animated:YES];

}
#pragma mark 文字转图片
#define CONTENT_MAX_WIDTH   300.0f

+(UIImage *)imageFromText:(NSArray*) arrContent withFont: (CGFloat)fontSize
{
    // set the font type and size
    UIFont *font = [UIFont systemFontOfSize:fontSize];
    NSMutableArray *arrHeight = [[NSMutableArray alloc] initWithCapacity:arrContent.count];

    CGFloat fHeight = 0.0f;
    for (NSString *sContent in arrContent) {
        CGRect stringSize = [sContent boundingRectWithSize:CGSizeMake(CONTENT_MAX_WIDTH, 10000) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : font} context:nil];
       // CGSize stringSize = [sContent sizeWithFont:font constrainedToSize:CGSizeMake(CONTENT_MAX_WIDTH, 10000) lineBreakMode:UILineBreakModeWordWrap];
        [arrHeight addObject:[NSNumber numberWithFloat:stringSize.size.height]];

        fHeight += stringSize.size.height;
    }

    CGSize newSize = CGSizeMake(CONTENT_MAX_WIDTH+20, fHeight+50);

    UIGraphicsBeginImageContextWithOptions(newSize,NO,0.0);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetCharacterSpacing(ctx, 10);
    CGContextSetTextDrawingMode (ctx, kCGTextFillStroke);
    CGContextSetRGBFillColor (ctx, 0.1, 0.2, 0.3, 1); // 6
    CGContextSetRGBStrokeColor (ctx, 0, 0, 0, 1);

    int nIndex = 0;
    CGFloat fPosY = 20.0f;
    for (NSString *sContent in arrContent) {
        NSNumber *numHeight = [arrHeight objectAtIndex:nIndex];
        CGRect rect = CGRectMake(10, fPosY, CONTENT_MAX_WIDTH , [numHeight floatValue]);

       // [sContent drawInRect:rect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
        [sContent drawInRect:rect withAttributes:@{NSFontAttributeName: font }];

        fPosY += [numHeight floatValue];
        nIndex++;
    }
    // transfer image
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;

}

UIImage * GetImage( NSString * str) {
    CGSize Size = CGSizeMake(60, 60);
    UIGraphicsBeginImageContextWithOptions(Size,NO,0.0);
    double width; CGContextRef context; CGPoint textPosition; CFAttributedStringRef attrString;
    // Initialize those variables.
   const char * N = [str UTF8String];
    CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, N, kCFStringEncodingUTF8 );

    //只绘制150字节 的字符串
    width =60;
    context = UIGraphicsGetCurrentContext();

    CGContextTranslateCTM(context, 0, Size.height);

    CGContextScaleCTM(context, 1.0, -1.0);

    //起始位置
    textPosition = CGPointMake(0.0, 15.0);
    //字形
    //CFStringRef fontName =CFSTR(/*"Papyrus"*/"HanziPenSC-W3");
    //iosfonts.com
    /**
     *  HanWangFangSongMedium
     *
     *  HanWangShinSuMedium
     *
     *  HanWangWCL10
     */
    CFStringRef fontName =CFSTR("HanWangWCL10");
    CTFontRef  font =
    CTFontCreateWithName(fontName, 30, NULL);
    //笔调重描痕迹
    CGFloat number = 3.0;

    CFNumberRef strokeWidth = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &number  );
    //笔调颜色重描痕迹
    CGColorSpaceRef space =   CGColorSpaceCreateDeviceRGB();
    CGFloat components[] = {0.5,0.5,1.0,1};
    CGColorRef color = CGColorCreate(space, components);
    // Controls vertical text positioning
    CGFloat superScriptnumber = 1;

    CFNumberRef superScript = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &superScriptnumber  );
    //kCTUnderlineStyleAttributeName
    /**
     *    kCTUnderlineStyleNone           = 0x00,
     kCTUnderlineStyleSingle         = 0x01,
     kCTUnderlineStyleThick          = 0x02,
     kCTUnderlineStyleDouble         = 0x09
     */
    CGFloat UnderlineStylenumber =kCTUnderlineStyleNone|kCTUnderlinePatternSolid ;

    CFNumberRef UnderlineStyle = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &UnderlineStylenumber  );
    //kCTUnderlineColorAttributeName
    CGColorSpaceRef Underlinespace =   CGColorSpaceCreateDeviceRGB();
    CGFloat Underlinecomponents[] = {0.0,0.5,0.5,1};
    CGColorRef Underlinecolor = CGColorCreate(Underlinespace, Underlinecomponents);
    //kCTVerticalFormsAttributeName 文字方向
    CFBooleanRef t = kCFBooleanFalse;

    CFStringRef keys[] = { kCTFontAttributeName,kCTStrokeWidthAttributeName ,kCTStrokeColorAttributeName,kCTSuperscriptAttributeName,kCTUnderlineColorAttributeName,kCTUnderlineStyleAttributeName,kCTVerticalFormsAttributeName/*,kCTGlyphInfoAttributeName*/ };

    CFTypeRef values[] = { font ,strokeWidth,color,superScript,Underlinecolor, UnderlineStyle  ,t/*,info*/};

    CFDictionaryRef attributes =

    CFDictionaryCreate(kCFAllocatorDefault,(const void**)&keys,

                       (const void**)&values,sizeof(keys)/sizeof(keys[0]) ,

                       &kCFTypeDictionaryKeyCallBacks,

                       &kCFTypeDictionaryValueCallBacks);

    attrString =   CFAttributedStringCreate(kCFAllocatorDefault, string, attributes);

    // Create a typesetter using the attributed string.
    CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedString(attrString);

    // Find a break for line from the beginning of the string to the given width.
    CFIndex start = 0;
    CFIndex count = CTTypesetterSuggestLineBreak(typesetter, start, width);

    // Use the returned character count (to the break) to create the line.
    CTLineRef line = CTTypesetterCreateLine(typesetter, CFRangeMake(start, count));

    // Get the offset needed to center the line.
    float flush = 0.5; // centered
    double penOffset = CTLineGetPenOffsetForFlush(line, flush, width);

    // Move the given text drawing position by the calculated offset and draw the line.
    CGContextSetTextPosition(context, textPosition.x + penOffset, textPosition.y);
    CTLineDraw(line, context);

    // Move the index beyond the line break.
  //  start += count;
    CGColorRelease(color);
    CGColorRelease(Underlinecolor);
    CGColorSpaceRelease(Underlinespace);
    CGColorSpaceRelease(space);
    // transfer image
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
     return image;
}

@end


text:
[![Maven Package](https://github.com/yev/seleniumMvnScreenshot/actions/workflows/maven-publish.yml/badge.svg)](https://github.com/yev/seleniumMvnScreenshot/actions/workflows/maven-publish.yml)

# Welcome to the repository for Selenium auto screenshots for failed TestNg tests
-----------

This is an open source framework integrating TestNG, Selenium 2 and maven, giving you a possibilty to  automatically store **screenshots**, taken for every **failed** test in **maven** target folder, for their further investigation.

It features:

* Taking a **screenshot** of a **failed test**
* Including the **screenshot** to an **email sent** by your **CI-build**.
* Stocking taken **screenshots** in easy managable way

Getting started
-----------

###Configuration

1. Put this jar to your classpath and annotate your class with special annotation ([see below](#annotation)).
2. No third-party dependencies.

### How to use
--
 1. Adding the following maven dependency in you ```pom.xml``` file:

    ```xml
    <dependency>
      <groupId>com.github.yev</groupId>
      <artifactId>screenshot</artifactId>
      <version>1.1</version>
    </dependency>
    ```

 2.  Adding next annotation: ```@org.testng.annotations.Listeners(org.yev.selenium.testng.FailTestScreenshotListener.class)``` to your TestNG Selenium class:

    ![listener example](https://raw.githubusercontent.com/yev/seleniumMvnScreenshot/master/docs/ListenerExample.png)

 3. 	Subsequently the plugin will find by reflection the **WebDriver instance** you are using and will do the rest for you.

### Result
--
After running your TestNg selenium tests with Maven, you will find for each failed test the screenshot which was taken automatically when this particular test failed.

![maven target dir example](https://raw.githubusercontent.com/yev/seleniumMvnScreenshot/master/docs/mvnTargerFolder.png)

### Integration with Jenkins build
--
It could be very useful to get the screenshot of failed test directly with email alert notification sent by Jenkins, when build becomes unstable.

For our example case the jenkins config will be following:

![jenkins conf example](https://raw.githubusercontent.com/yev/seleniumMvnScreenshot/master/docs/selenium_Config_Jenkins_.png)


text:
package ru.shutoff.caralarm;

import android.content.SharedPreferences;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Locale;

abstract public class AddressRequest {

    static final String GOOGLE_URL = "https://maps.googleapis.com/maps/api/geocode/json?latlng=$1,$2&sensor=false&language=$3";
    static final String OSM_URL = "http://nominatim.openstreetmap.org/reverse?lat=$1&lon=$2&osm_type=N&format=json&address_details=0&accept-language=$3";

    abstract void addressResult(String[] address);

    Request request;

    void getAddress(SharedPreferences preferences, String lat, String lng) {
        if (preferences.getString("map_type", "").equals("OSM")) {
            request = new OsmRequest();
            request.exec(lat, lng);
            return;
        }
        request = new GoogleRequest();
        request.exec(lat, lng);
    }

    abstract class Request extends HttpTask {
        abstract void exec(String lat, String lng);
    }

    class GoogleRequest extends Request {

        void exec(String lat, String lng) {
            latitude = lat;
            longitude = lng;
            execute(GOOGLE_URL, latitude, longitude, Locale.getDefault().getLanguage());
        }

        String latitude;
        String longitude;

        @Override
        void result(JSONObject data) throws JSONException {

            JSONArray res = data.getJSONArray("results");
            if (res.length() == 0) {
                String status = data.getString("status");
                if ((status != null) && status.equals("OVER_QUERY_LIMIT")) {
                    request = new GoogleRequest();
                    request.pause = 1000;
                    request.exec(latitude, longitude);
                    return;
                }
            }

            if (res.length() == 0){
                String[] p = new String[1];
                p[0] = latitude + "," + longitude;
                addressResult(p);
                return;
            }

            int i;
            for (i = 0; i < res.length(); i++) {
                JSONObject addr = res.getJSONObject(i);
                JSONArray types = addr.getJSONArray("types");
                int n;
                for (n = 0; n < types.length(); n++) {
                    if (types.getString(n).equals("street_address"))
                        break;
                }
                if (n < types.length())
                    break;
            }
            if (i >= res.length())
                i = 0;

            JSONObject addr = res.getJSONObject(i);
            String[] parts = addr.getString("formatted_address").split(", ");
            JSONArray components = addr.getJSONArray("address_components");
            for (i = 0; i < components.length(); i++) {
                JSONObject component = components.getJSONObject(i);
                JSONArray types = component.getJSONArray("types");
                int n;
                for (n = 0; n < types.length(); n++) {
                    if (types.getString(n).equals("postal_code"))
                        break;
                }
                if (n >= types.length())
                    continue;
                String name = component.getString("long_name");
                for (n = 0; n < parts.length; n++) {
                    if (name.equals(parts[n]))
                        parts[n] = null;
                }
            }
            int to = 0;
            for (i = 0; i < parts.length; i++) {
                if (parts[i] == null)
                    continue;
                to++;
            }
            String[] p = new String[to];
            to = 0;
            for (i = 0; i < parts.length; i++) {
                if (parts[i] == null)
                    continue;
                p[to++] = parts[i];
            }
            addressResult(p);
        }

        @Override
        void error() {
            addressResult(null);
        }
    }

    class OsmRequest extends Request {

        @Override
        void exec(String lat, String lon) {
            execute(OSM_URL, lat, lon, Locale.getDefault().getLanguage());
        }

        @Override
        void result(JSONObject res) throws JSONException {
            JSONObject address = res.getJSONObject("address");
            String[] parts = res.getString("display_name").split(", ");
            String[] result = new String[parts.length - 2];
            for (int i = 0; i < result.length; i++) {
                result[i] = parts[i];
            }
            try {
                String house_number = address.getString("house_number");
                for (int i = 0; i < result.length - 1; i++) {
                    if (result[i].equals(house_number)) {
                        result[i] = result[i + 1];
                        result[i + 1] = house_number;
                        break;
                    }
                }
            } catch (Exception ex) {
                // ignore
            }
            addressResult(result);
        }

        @Override
        void error() {
            addressResult(null);
        }
    }
}


text:
SYNONYM

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

#### Published in
Fl. peruv. prodr. 1:8, t. 9. 1798

#### Original name
null

### Remarks
null


text:
<link href="/Views/templates/minnie_daisy/style.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Cookie' rel='stylesheet' type='text/css'>

Sunteti invitati la petrecere!

                Daria implineste

                3 ani

Data: 28 Feb 2015, ora 18:00

                Locatie: Prichindelul Vesel

                Strada Campului nr. 176, Cluj-Napoca


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

using Xamarin.Forms;
using XF_Stopwatch.Models;

namespace XF_Stopwatch.Views
{
    public partial class ResultPage : ContentPage
    {
        public ResultPage(ObservableCollection<LapTime> laptime)
        {
            InitializeComponent();
            this.BindingContext = laptime;
        }

        protected override void OnDisappearing()
        {
            base.OnDisappearing();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
     <!-- selected -->
     <item android:state_selected="true"
        android:drawable="@drawable/ic_lockok_off" />
     <!-- pressed -->
     <item android:state_pressed="true"
        android:drawable="@drawable/ic_lockok_off" />
    <!-- focused -->
    <item android:state_focused="true"
        android:drawable="@drawable/ic_lockok_off" />
    <!-- default -->
    <item android:drawable="@drawable/ic_lockok_on" />

</selector>


text:
package com.zjhcsoft.uac.account.whitelist.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.zjhcsoft.uac.account.user.entity.User;

@Entity
@Table(name = "U_WHITE_LIST")
@SequenceGenerator(name = "seq_u_white_list", sequenceName = "SEQ_U_WHITE_LIST")
public class WhiteList {
	private Long id;
	private User user;// 主账号
	private Date startDate;// 开始日期
	private Date endDate;// 结束日期

	@Id
	@GeneratedValue(generator = "seq_u_white_list", strategy = GenerationType.SEQUENCE)
	public Long getId() {
		return id;
	}

	@ManyToOne
	@JoinColumn(name = "user_id")
	public User getUser() {
		return user;
	}

	@Column(columnDefinition = "DATE")
	public Date getStartDate() {
		return startDate;
	}

	@Column(columnDefinition = "DATE")
	public Date getEndDate() {
		return endDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

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

	public void setUser(User user) {
		this.user = user;
	}

}


text:
package info

import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"

	"github.com/golang/glog"
	"github.com/julienschmidt/httprouter"
	"github.com/prebid/prebid-server/config"
	"github.com/prebid/prebid-server/openrtb_ext"
)

const (
	statusActive   string = "ACTIVE"
	statusDisabled string = "DISABLED"
)

// NewBiddersDetailEndpoint builds a handler for the /info/bidders/<bidder> endpoint.
func NewBiddersDetailEndpoint(bidders config.BidderInfos, aliases map[string]string) httprouter.Handle {
	responses, err := prepareBiddersDetailResponse(bidders, aliases)
	if err != nil {
		glog.Fatalf("error creating /info/bidders/<bidder> endpoint response: %v", err)
	}

	return func(w http.ResponseWriter, _ *http.Request, ps httprouter.Params) {
		bidder := ps.ByName("bidderName")

		if response, ok := responses[bidder]; ok {
			w.Header().Set("Content-Type", "application/json")
			if _, err := w.Write(response); err != nil {
				glog.Errorf("error writing response to /info/bidders/%s: %v", bidder, err)
			}
		} else {
			w.WriteHeader(http.StatusNotFound)
		}
	}
}

func prepareBiddersDetailResponse(bidders config.BidderInfos, aliases map[string]string) (map[string][]byte, error) {
	details, err := mapDetails(bidders, aliases)
	if err != nil {
		return nil, err
	}

	responses, err := marshalDetailsResponse(details)
	if err != nil {
		return nil, err
	}

	all, err := marshalAllResponse(responses)
	if err != nil {
		return nil, err
	}
	responses["all"] = all

	return responses, nil
}

func mapDetails(bidders config.BidderInfos, aliases map[string]string) (map[string]bidderDetail, error) {
	details := map[string]bidderDetail{}

	for bidderName, bidderInfo := range bidders {
		details[bidderName] = mapDetailFromConfig(bidderInfo)
	}

	for aliasName, bidderName := range aliases {
		aliasBaseInfo, aliasBaseInfoFound := details[bidderName]
		if !aliasBaseInfoFound {
			return nil, fmt.Errorf("base adapter %s for alias %s not found", bidderName, aliasName)
		}

		aliasInfo := aliasBaseInfo
		aliasInfo.AliasOf = bidderName
		details[aliasName] = aliasInfo
	}

	return details, nil
}

func marshalDetailsResponse(details map[string]bidderDetail) (map[string][]byte, error) {
	responses := map[string][]byte{}

	for bidder, detail := range details {
		json, err := json.Marshal(detail)
		if err != nil {
			return nil, fmt.Errorf("unable to marshal info for bidder %s: %v", bidder, err)
		}
		responses[bidder] = json
	}

	return responses, nil
}

func marshalAllResponse(responses map[string][]byte) ([]byte, error) {
	responsesJSON := make(map[string]json.RawMessage, len(responses))

	for k, v := range responses {
		responsesJSON[k] = json.RawMessage(v)
	}

	json, err := json.Marshal(responsesJSON)
	if err != nil {
		return nil, fmt.Errorf("unable to marshal info for bidder all: %v", err)
	}
	return json, nil
}

type bidderDetail struct {
	Status       string        `json:"status"`
	UsesHTTPS    *bool         `json:"usesHttps,omitempty"`
	Maintainer   *maintainer   `json:"maintainer,omitempty"`
	Capabilities *capabilities `json:"capabilities,omitempty"`
	AliasOf      string        `json:"aliasOf,omitempty"`
}

type maintainer struct {
	Email string `json:"email"`
}

type capabilities struct {
	App  *platform `json:"app,omitempty"`
	Site *platform `json:"site,omitempty"`
}

type platform struct {
	MediaTypes []string `json:"mediaTypes"`
}

func mapDetailFromConfig(c config.BidderInfo) bidderDetail {
	var bidderDetail bidderDetail

	if c.Maintainer != nil {
		bidderDetail.Maintainer = &maintainer{
			Email: c.Maintainer.Email,
		}
	}

	if c.IsEnabled() {
		bidderDetail.Status = statusActive

		usesHTTPS := strings.HasPrefix(strings.ToLower(c.Endpoint), "https://")
		bidderDetail.UsesHTTPS = &usesHTTPS

		if c.Capabilities != nil {
			bidderDetail.Capabilities = &capabilities{}

			if c.Capabilities.App != nil {
				bidderDetail.Capabilities.App = &platform{
					MediaTypes: mapMediaTypes(c.Capabilities.App.MediaTypes),
				}
			}

			if c.Capabilities.Site != nil {
				bidderDetail.Capabilities.Site = &platform{
					MediaTypes: mapMediaTypes(c.Capabilities.Site.MediaTypes),
				}
			}
		}
	} else {
		bidderDetail.Status = statusDisabled
	}

	return bidderDetail
}

func mapMediaTypes(m []openrtb_ext.BidType) []string {
	mediaTypes := make([]string, len(m))

	for i, v := range m {
		mediaTypes[i] = string(v)
	}

	return mediaTypes
}


text:
layout: bidder
title: Edge Query X
description: Prebid for Edge Query X Adaptor
pbjs: true
biddercode: edgequeryx
media_types: display
gdpr_supported: true
schain_supported: true
usp_supported: true
enable_download: false
pbjs_version_notes: not ported to 5.x
---

### Note:
The Edge Query bidder adaptor requires setup and approval from the Edge Query team. Please reach out to your account manager for more information and start using it.

### Bid params

{: .table .table-bordered .table-striped }
| Name       | Scope    | Description                                                                                | Example                                                              | Type      |
|------------|----------|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|-----------|
| `accountId`| required | The account ID                                                                                | `test`                                                               | `string`  |
| `widgetId` | required | The widget ID                                                                                | `test`                                                               | `string`  |
| `domain`   | optional | The network domain (default see example)                                                                       | `'https://deep.edgequery.io'`                                        | `string`  |
| `appName`  | optional | Mobile application name                                                                                | `'Edge Query Preview'`                                           | `string`  |


text:
use strict;
use warnings;
use GD::Graph::bars;
use Data::Dumper;
use PerlIO::gzip;

if (scalar @ARGV==0) {
	print<<END;

Create a Linker Clipping Information Histogram

usage: $0 INPUT_FILE.FA OUTPUT_FILE.PNG

	INPUT_FILE.FA   = input file (in FASTA format, can be GZIPped)
	OUTPUT_FILE.PNG = histogram image

END
	exit 0;
}

#
# Read parameters
#
open(IN, "<:gzip(autopop)", "$ARGV[0]") or die "Cannot open input file $ARGV[0]\n";
open(OUT, ">$ARGV[1]") or die "Cannot create output file $ARGV[1]\n";
binmode OUT;

my %histogram ;

while (my $name = <IN>) {
	my $sequence = <IN> ;
	chomp $sequence;

	my $sequence_length = length($sequence);

	my $count;

	if ( index($name, "-")==-1 ) {
		#Assume this file is not collapsed, just count each seqeunce as 1
		$count = 1 ;
	} else  {
		#Assume file is collapsed (that is - sequence-ID has two numbers with a separating dash)
		($count) = $name =~ /^\>[^-]+\-(\d+)$/ ;

		# If the match failed, treat this fasta as not collapsed;
		$count = 1 if not defined $count ;
	}

	$histogram{$sequence_length} += $count ;
}

#Textual Output
if (0) {
	print "Length\tCount\n";
	foreach my $length_key ( sort { $a <=> $b } keys %histogram ) {
		print $length_key,"\t", $histogram{$length_key},"\n";
	}
	exit 0;
}

## Build the data as required by GD::Graph::bars.
## Data list has two items (each item is itself a list)
##   1. a list of x-axis labels (these are the keys from the histogram)
##   2. a list of values
my @data = (
	[ sort { $a <=> $b } keys %histogram ],
	[ map { $histogram{$_} } sort { $a <=> $b } keys %histogram ] ) ;

my $graph = new GD::Graph::bars (1000,800);

$graph->set(
	x_label => 'Length',
	y_label => 'Amount',
	title => 'Sequences lengths Distribution (after clipping)',
	bar_spacing => 10,
	transparent => 0,
	t_margin => 10,
	y_tick_number => 20,
	y_long_ticks => 1,
	)  or die $graph->error;

$graph->plot(\@data) or die $graph->error;
print OUT $graph->gd->png;

close IN;
close OUT;