text:
package jxl.read.biff;

import java.util.ArrayList;

import jxl.common.Assert;
import jxl.common.Logger;

import jxl.WorkbookSettings;
import jxl.biff.BuiltInName;
import jxl.biff.IntegerHelper;
import jxl.biff.RecordData;
import jxl.biff.StringHelper;

/**
 * Holds an excel name record, and the details of the cells/ranges it refers
 * to
 */
public class NameRecord extends RecordData
{
  /**
   * The logger
   */
  private static Logger logger = Logger.getLogger(NameRecord.class);

  /**
   * The name
   */
  private String name;

  /**
   * The built in name
   */
  private BuiltInName builtInName;

  /**
   * The 0-based index in the name table
   */
  private int index;

  /**
   * The 0-based index sheet reference for a record name
   *     0 is for a global reference
   */
  private int sheetRef = 0;

  /**
   * Indicates whether this is a biff8 name record.  Used during copying
   */
  private boolean isbiff8;

  /**
   * Dummy indicators for overloading the constructor
   */
  private static class Biff7 {};
  public static Biff7 biff7 = new Biff7();

  // Constants which refer to the name type
  private static final int commandMacro = 0xc;
  private static final int builtIn = 0x20;

  // Constants which refer to the parse tokens after the string
  private static final int cellReference = 0x3a;
  private static final int areaReference = 0x3b;
  private static final int subExpression = 0x29;
  private static final int union         = 0x10;

  /**
   * A nested class to hold range information
   */
  public class NameRange
  {
    /**
     * The first column
     */
    private int columnFirst;

    /**
     * The first row
     */
    private int rowFirst;

    /**
     * The last column
     */
    private int columnLast;

    /**
     * The last row
     */
    private int rowLast;

    /**
     * The first sheet
     */
    private int externalSheet;

    /**
     * Constructor
     *
     * @param s1 the sheet
     * @param c1 the first column
     * @param r1 the first row
     * @param c2 the last column
     * @param r2 the last row
     */
    NameRange(int s1, int c1, int r1, int c2, int r2)
    {
      columnFirst = c1;
      rowFirst = r1;
      columnLast = c2;
      rowLast = r2;
      externalSheet = s1;
    }

    /**
     * Accessor for the first column
     *
     * @return the index of the first column
     */
    public int getFirstColumn()
    {
      return columnFirst;
    }

    /**
     * Accessor for the first row
     *
     * @return the index of the first row
     */
    public int getFirstRow()
    {
      return rowFirst;
    }

    /**
     * Accessor for the last column
     *
     * @return the index of the last column
     */
    public int getLastColumn()
    {
      return columnLast;
    }

    /**
     * Accessor for the last row
     *
     * @return the index of the last row
     */
    public int getLastRow()
    {
      return rowLast;
    }

    /**
     * Accessor for the first sheet
     *
     * @return  the index of the external  sheet
     */
    public int getExternalSheet()
    {
      return externalSheet;
    }
  }

  /**
   * The ranges referenced by this name
   */
  private ArrayList ranges;

  /**
   * Constructs this object from the raw data
   *
   * @param t the raw data
   * @param ws the workbook settings
   * @param ind the index in the name table
   */
  NameRecord(Record t, WorkbookSettings ws, int ind)
  {
    super(t);
    index = ind;
    isbiff8 = true;

    try
    {
      ranges = new ArrayList();

      byte[] data = getRecord().getData();
      int option = IntegerHelper.getInt(data[0], data[1]);
      int length = data[3];
      sheetRef = IntegerHelper.getInt(data[8],data[9]);

      if ((option & builtIn) != 0)
      {
        builtInName = BuiltInName.getBuiltInName(data[15]);
      }
      else
      {
        name = StringHelper.getString(data, length, 15, ws);
      }

      if ((option & commandMacro) != 0)
      {
        // This is a command macro, so it has no cell references
        return;
      }

      int pos = length + 15;

      if (data[pos] == cellReference)
      {
        int sheet = IntegerHelper.getInt(data[pos + 1], data[pos + 2]);
        int row = IntegerHelper.getInt(data[pos + 3], data[pos + 4]);
        int columnMask = IntegerHelper.getInt(data[pos + 5], data[pos + 6]);
        int column = columnMask & 0xff;

        // Check that we are not dealing with offsets
        Assert.verify((columnMask & 0xc0000) == 0);

        NameRange r = new NameRange(sheet, column, row, column, row);
        ranges.add(r);
      }
      else if (data[pos] == areaReference)
      {
        int sheet1 = 0;
        int r1 = 0;
        int columnMask = 0;
        int c1 = 0;
        int r2 = 0;
        int c2 = 0;
        NameRange range = null;

        while (pos < data.length)
        {
          sheet1 = IntegerHelper.getInt(data[pos + 1], data[pos + 2]);
          r1 = IntegerHelper.getInt(data[pos + 3], data[pos + 4]);
          r2 = IntegerHelper.getInt(data[pos + 5], data[pos + 6]);

          columnMask = IntegerHelper.getInt(data[pos + 7], data[pos + 8]);
          c1 = columnMask & 0xff;

          // Check that we are not dealing with offsets
          Assert.verify((columnMask & 0xc0000) == 0);

          columnMask = IntegerHelper.getInt(data[pos + 9], data[pos + 10]);
          c2 = columnMask & 0xff;

          // Check that we are not dealing with offsets
          Assert.verify((columnMask & 0xc0000) == 0);

          range = new NameRange(sheet1, c1, r1,  c2, r2);
          ranges.add(range);

          pos += 11;
        }
      }
      else if (data[pos] == subExpression)
      {
        int sheet1 = 0;
        int r1 = 0;
        int columnMask = 0;
        int c1 = 0;
        int r2 = 0;
        int c2 = 0;
        NameRange range = null;

        // Consume unnecessary parsed tokens
        if (pos < data.length &&
            data[pos] != cellReference &&
            data[pos] != areaReference)
        {
          if (data[pos] == subExpression)
          {
            pos += 3;
          }
          else if (data[pos] == union)
          {
            pos += 1;
          }
        }

        while (pos < data.length)
        {
          sheet1 = IntegerHelper.getInt(data[pos + 1], data[pos + 2]);
          r1 = IntegerHelper.getInt(data[pos + 3], data[pos + 4]);
          r2 = IntegerHelper.getInt(data[pos + 5], data[pos + 6]);

          columnMask = IntegerHelper.getInt(data[pos + 7], data[pos + 8]);
          c1 = columnMask & 0xff;

          // Check that we are not dealing with offsets
          Assert.verify((columnMask & 0xc0000) == 0);

          columnMask = IntegerHelper.getInt(data[pos + 9], data[pos + 10]);
          c2 = columnMask & 0xff;

          // Check that we are not dealing with offsets
          Assert.verify((columnMask & 0xc0000) == 0);

          range = new NameRange(sheet1, c1, r1, c2, r2);
          ranges.add(range);

          pos += 11;

          // Consume unnecessary parsed tokens
          if (pos < data.length &&
              data[pos] != cellReference &&
              data[pos] != areaReference)
          {
            if (data[pos] == subExpression)
            {
              pos += 3;
            }
            else if (data[pos] == union)
            {
              pos += 1;
            }
          }
        }
      }
      else
      {
          String n = name != null ? name : builtInName.getName();
          logger.warn("Cannot read name ranges for " + n +
                      " - setting to empty");
          NameRange range = new NameRange(0,0,0,0,0);
          ranges.add(range);
      }
    }
    catch (Throwable t1)
    {
      // Generate a warning
      // Names are really a nice to have, and we don't want to halt the
      // reading process for functionality that probably won't be used
      logger.warn("Cannot read name");
      name = "ERROR";
    }
  }

  /**
   * Constructs this object from the raw data
   *
   * @param t the raw data
   * @param ws the workbook settings
   * @param ind the index in the name table
   * @param dummy dummy parameter to indicate a biff7 workbook
   */
  NameRecord(Record t, WorkbookSettings ws, int ind, Biff7 dummy)
  {
    super(t);
    index = ind;
    isbiff8 = false;

    try
    {
      ranges = new ArrayList();
      byte[] data = getRecord().getData();
      int length = data[3];
      sheetRef = IntegerHelper.getInt(data[8], data[9]);
      name = StringHelper.getString(data, length, 14, ws);

      int pos = length + 14;

      if (pos >= data.length)
      {
        // There appears to be nothing after the name, so return
        return;
      }

      if (data[pos] == cellReference)
      {
        int sheet = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
        int row = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
        int column = data[pos + 17];

        NameRange r = new NameRange(sheet, column, row, column, row);
        ranges.add(r);
      }
      else if (data[pos] == areaReference)
      {
        int sheet1 = 0;
        int r1 = 0;
        int c1 = 0;
        int r2 = 0;
        int c2 = 0;
        NameRange range = null;

        while (pos < data.length)
        {
          sheet1 = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
          r1 = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
          r2 = IntegerHelper.getInt(data[pos + 17], data[pos + 18]);

          c1 = data[pos + 19];
          c2 = data[pos + 20];

          range = new NameRange(sheet1, c1, r1, c2, r2);
          ranges.add(range);

          pos += 21;
        }
      }
      else if (data[pos] == subExpression)
      {
        int sheet1 = 0;
        int sheet2 = 0;
        int r1 = 0;
        int c1 = 0;
        int r2 = 0;
        int c2 = 0;
        NameRange range = null;

        // Consume unnecessary parsed tokens
        if (pos < data.length &&
            data[pos] != cellReference &&
            data[pos] != areaReference)
        {
          if (data[pos] == subExpression)
          {
            pos += 3;
          }
          else if (data[pos] == union)
          {
            pos += 1;
          }
        }

        while (pos < data.length)
        {
          sheet1 = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
          r1 = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
          r2 = IntegerHelper.getInt(data[pos + 17], data[pos + 18]);

          c1 = data[pos + 19];
          c2 = data[pos + 20];

          range = new NameRange(sheet1, c1, r1, c2, r2);
          ranges.add(range);

          pos += 21;

          // Consume unnecessary parsed tokens
          if (pos < data.length &&
              data[pos] != cellReference &&
              data[pos] != areaReference)
          {
            if (data[pos] == subExpression)
            {
              pos += 3;
            }
            else if (data[pos] == union)
            {
              pos += 1;
            }
          }
        }
      }
    }
    catch (Throwable t1)
    {
      // Generate a warning
      // Names are really a nice to have, and we don't want to halt the
      // reading process for functionality that probably won't be used
      logger.warn("Cannot read name.");
      name = "ERROR";
    }
  }

  /**
   * Gets the name
   *
   * @return the strings
   */
  public String getName()
  {
    return name;
  }

  /**
   * Gets the built in name
   *
   * @return the built in name
   */
  public BuiltInName getBuiltInName()
  {
    return builtInName;
  }

  /**
   * Gets the array of ranges for this name.  This method is public as it is
   * used from the writable side when copying ranges
   *
   * @return the ranges
   */
  public NameRange[] getRanges()
  {
    NameRange[] nr = new NameRange[ranges.size()];
    return (NameRange[]) ranges.toArray(nr);
  }

  /**
   * Accessor for the index into the name table
   *
   * @return the 0-based index into the name table
   */
  int getIndex()
  {
    return index;
  }

  /**
   * The 0-based index sheet reference for a record name
   *     0 is for a global reference
   *
   * @return the sheet reference for name formula
   */
  public int getSheetRef()
  {
    return sheetRef;
  }

  /**
   * Set the index sheet reference for a record name
   *     0 is for a global reference
   */
  public void setSheetRef(int i)
  {
    sheetRef = i;
  }

  /**
   * Called when copying a sheet.  Just returns the raw data
   *
   * @return the raw data
   */
  public byte[] getData()
  {
    return getRecord().getData();
  }

  /**
   * Called when copying to determine whether this is a biff8 name
   *
   * @return TRUE if this is a biff8 name record, FALSE otherwise
   */
  public boolean isBiff8()
  {
    return isbiff8;
  }

  /**
   * Queries whether this is a global name or not
   *
   * @return TRUE if this is a global name, FALSE otherwise
   */
  public boolean isGlobal()
  {
    return sheetRef == 0;
  }
}


text:
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model frontend\models\Activity */

switch(Yii::$app->session->get('role')) {
	case 'orghead':
		$this->title = 'Update an Activity';
		break;
	case 'administration':
		$this->title = ($model->rec_id == Yii::$app->session->get('rec_id')) ?
			'Update an Admin Activity' :
			strpos($model->status->status, 'request') !== false ? 'Approve Activity Request' :
			strpos($model->status->status, 'report') !== false ? 'Approve Activity Report' : 'Categorize Activity';
		break;
	case 'academe':
		$this->title = strpos($model->status->status, 'request') !== false ? 'Approve Activity Request' : 'Approve Activity Report';
	default:
		break;
}
$this->params['breadcrumbs'][] = ['label' => 'Activities', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>

<?= Html::encode($this->title) ?>

    <?= $this->render('_form', [
        'model' => $model,
    ]) ?>

redpajama_set_name: RedPajamaGithub


text:
package controllers;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;

import net.nationstatesplusplus.assembly.auth.Authentication;
import net.nationstatesplusplus.assembly.nation.MongoSettings;
import net.nationstatesplusplus.assembly.nation.NationSettings;
import net.nationstatesplusplus.assembly.util.DatabaseAccess;
import net.nationstatesplusplus.assembly.util.Utils;

import org.apache.commons.dbutils.DbUtils;
import org.joda.time.Duration;
import org.spout.cereal.config.yaml.YamlConfiguration;

import com.google.common.collect.Maps;
import com.limewoodMedia.nsapi.NationStates;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCursor;

import play.libs.Json;
import play.mvc.Result;
import play.mvc.Results;

public class NationController extends NationStatesController {

	public NationController(DatabaseAccess access, YamlConfiguration config, NationStates api) {
		super(access, config, api);
	}

	public Result retrieveSettings(String name) throws SQLException, ExecutionException {
		Utils.handleDefaultPostHeaders(request(), response());
		final int nationId = getDatabase().getNationId(name);
		if (nationId == -1) {
			return Results.badRequest();
		}
		String json = getDatabase().getNationSettingsCache().get(nationId);
		if (!json.isEmpty()) {
			return Results.ok(json).as("application/json");
		}
		return Results.noContent();
	}

	public Result getLastSettingsUpdate(String name) throws SQLException {
		return getLastUpdate("last_settings_update", name);
	}

	public Result getLastDataUpdate(String name) throws SQLException {
		return getLastUpdate("last_data_update", name);
	}

	private Result getLastUpdate(String column, String name) throws SQLException {
		final int nationId = getDatabase().getNationId(name);
		if (nationId == -1) {
			Utils.handleDefaultPostHeaders(request(), response());
			return Results.badRequest();
		}
		Connection conn = null;
		PreparedStatement select = null;
		ResultSet set = null;
		try {
			conn = getConnection();
			select = conn.prepareStatement("SELECT " + column + " FROM assembly.ns_settings WHERE id = ?");
			select.setInt(1, nationId);
			set = select.executeQuery();
			if (set.next()) {
				Map<String, Object> json = new HashMap<String, Object>(1);
				json.put("timestamp", set.getLong(1));
				Result r = Utils.handleDefaultGetHeaders(request(), response(), String.valueOf(json.hashCode()), "10");
				if (r != null) return r;
				return Results.ok(Json.toJson(json)).as("application/json");
			}
		} finally {
			DbUtils.closeQuietly(set);
			DbUtils.closeQuietly(select);
			DbUtils.closeQuietly(conn);
		}
		Result r = Utils.handleDefaultGetHeaders(request(), response(), "0000000", "10");
		if (r != null) return r;
		return Results.noContent();
	}

	public Result updateSettings() throws SQLException {
		Result result = Utils.validateRequest(request(), response(), getAPI(), getDatabase());
		if (result != null) {
			return result;
		}
		Utils.handleDefaultPostHeaders(request(), response());
		final String nation = Utils.getPostValue(request(), "nation");
		final String settings = Utils.getPostValue(request(), "settings");
		final int nationId = getDatabase().getNationId(nation);
		if (nationId == -1 || settings == null) {
			return Results.badRequest();
		}
		Connection conn = null;
		PreparedStatement select = null;
		ResultSet set = null;
		try {
			conn = getConnection();
			select = conn.prepareStatement("SELECT last_settings_update FROM assembly.ns_settings WHERE id = ?");
			select.setInt(1, nationId);
			set = select.executeQuery();
			if (set.next()) {
				PreparedStatement update = conn.prepareStatement("UPDATE assembly.ns_settings SET settings = ?, last_settings_update = ? WHERE id = ?");
				update.setString(1, settings);
				update.setLong(2, System.currentTimeMillis());
				update.setInt(3, nationId);
				update.executeUpdate();
				DbUtils.closeQuietly(update);
			} else {
				PreparedStatement insert = conn.prepareStatement("INSERT INTO assembly.ns_settings (id, settings, last_settings_update) VALUES (?, ?, ?)");
				insert.setInt(1, nationId);
				insert.setString(2, settings);
				insert.setLong(3, System.currentTimeMillis());
				insert.executeUpdate();
				DbUtils.closeQuietly(insert);
			}
			getDatabase().getNationSettingsCache().put(nationId, settings);
			return Results.ok();
		} finally {
			DbUtils.closeQuietly(set);
			DbUtils.closeQuietly(select);
			DbUtils.closeQuietly(conn);
		}
	}

	public Result retrieveData() throws SQLException {
		Result result = Utils.validateRequest(request(), response(), getAPI(), getDatabase());
		if (result != null) {
			return result;
		}
		Utils.handleDefaultPostHeaders(request(), response());
		final String nation = Utils.getPostValue(request(), "nation");
		final int nationId = getDatabase().getNationId(nation);
		if (nationId == -1) {
			return Results.badRequest();
		}
		Connection conn = null;
		PreparedStatement select = null;
		ResultSet set = null;
		try {
			conn = getConnection();
			select = conn.prepareStatement("SELECT data FROM assembly.ns_settings WHERE id = ?");
			select.setInt(1, nationId);
			set = select.executeQuery();
			if (set.next()) {
				String json = set.getString(1);
				if (!set.wasNull()) {
					return Results.ok(json).as("application/json");
				}
			}
		} finally {
			DbUtils.closeQuietly(set);
			DbUtils.closeQuietly(select);
			DbUtils.closeQuietly(conn);
		}
		return Results.noContent();
	}

	public Result getAuthCode() throws SQLException {
		Result result = Utils.validateRequest(request(), response(), getAPI(), getDatabase());
		if (result != null) {
			return result;
		}
		HashMap<String, Object> data = new HashMap<String, Object>();

		final int nationId = getDatabase().getNationId(Utils.getPostValue(request(), "nation"));
		Connection conn = null;
		try {
			conn = getConnection();
			PreparedStatement statement = conn.prepareStatement("SELECT auth, time from assembly.nation_auth WHERE nation_id = ? AND time > ? LIMIT 0, 1");
			statement.setInt(1, nationId);
			//No point giving user a code about to expire...
			statement.setLong(2, System.currentTimeMillis() + Duration.standardHours(1).getMillis());
			ResultSet set = statement.executeQuery();
			if (set.next()) {
				data.put("code", set.getString(1));
				data.put("expires", set.getLong(2));
			} else {
				data.put("code", getDatabase().generateAuthToken(nationId, true, null, 0));
				data.put("expires", System.currentTimeMillis() + Duration.standardDays(1).getMillis());
			}
			DbUtils.closeQuietly(set);
			DbUtils.closeQuietly(statement);
		} finally {
			DbUtils.closeQuietly(conn);
		}
		Utils.handleDefaultPostHeaders(request(), response());
		return Results.ok(Json.toJson(data)).as("application/json");
	}

	public Result updateData() throws SQLException {
		Result result = Utils.validateRequest(request(), response(), getAPI(), getDatabase());
		if (result != null) {
			return result;
		}
		Utils.handleDefaultPostHeaders(request(), response());
		final String nation = Utils.getPostValue(request(), "nation");
		final String data = Utils.getPostValue(request(), "data");
		final int nationId = getDatabase().getNationId(nation);
		if (nationId == -1 || data == null) {
			return Results.badRequest();
		}
		Connection conn = null;
		PreparedStatement select = null;
		ResultSet set = null;
		try {
			conn = getConnection();
			select = conn.prepareStatement("SELECT last_data_update FROM assembly.ns_settings WHERE id = ?");
			select.setInt(1, nationId);
			set = select.executeQuery();
			if (set.next()) {
				PreparedStatement update = conn.prepareStatement("UPDATE assembly.ns_settings SET data = ?, last_data_update = ? WHERE id = ?");
				update.setString(1, data);
				update.setLong(2, System.currentTimeMillis());
				update.setInt(3, nationId);
				update.executeUpdate();
				DbUtils.closeQuietly(update);
			} else {
				PreparedStatement insert = conn.prepareStatement("INSERT INTO assembly.ns_settings (id, data, last_data_update) VALUES (?, ?, ?)");
				insert.setInt(1, nationId);
				insert.setString(2, data);
				insert.setLong(3, System.currentTimeMillis());
				insert.executeUpdate();
				DbUtils.closeQuietly(insert);
			}
			return Results.ok();
		} finally {
			DbUtils.closeQuietly(set);
			DbUtils.closeQuietly(select);
			DbUtils.closeQuietly(conn);
		}
	}

	public Result retrieveForumSettings(String name) throws SQLException, ExecutionException {
		Utils.handleDefaultPostHeaders(request(), response());
		final int nationId = getDatabase().getNationId(name);
		if (nationId == -1) {
			return Results.badRequest();
		}
		NationSettings settings = getDatabase().getNationSettings(name, false);
		Map<String, Object> json = Maps.newHashMap();
		json.put("post_ids", settings.getValue("post_ids", true, Boolean.class));
		json.put("egosearch_ignore", settings.getValue("egosearch_ignore", true, Boolean.class));
		json.put("highlight_op_posts", settings.getValue("highlight_op_posts", true, Boolean.class));
		json.put("highlight_color_transparency", settings.getValue("highlight_color_transparency", 0.1, Double.class));
		json.put("highlight_color", settings.getValue("highlight_color", "#39EE00", String.class));
		json.put("floating_sidepanel", settings.getValue("floating_sidepanel", true, Boolean.class));
		return Results.ok(Json.toJson(json)).as("application/json");
	}

	public Result retrieveAllSettings(String name) throws SQLException {
		Utils.handleDefaultPostHeaders(request(), response());
		final int nationId = getDatabase().getNationId(name);
		if (nationId == -1) {
			return Results.badRequest();
		}
		String authToken = Utils.getPostValue(request(), "rss_token");
		if (authToken == null || authToken.isEmpty()) {
			return Results.badRequest();
		}
		int rssToken;
		try {
			rssToken = Integer.parseInt(authToken);
		} catch (NumberFormatException e) {
			return Results.unauthorized("Malformed rss token, expected integer");
		}

		Authentication auth = new Authentication(Utils.sanitizeName(name), nationId, rssToken, this.getDatabase());
		if (!auth.isValid()) {
			return Results.unauthorized("Invalid rss token");
		}

		NationSettings settings = getDatabase().getNationSettings(name, false);
		if (settings instanceof MongoSettings) {
			MongoSettings mongoSettings = (MongoSettings)settings;
			BasicDBObject find = new BasicDBObject("nation", Utils.sanitizeName(name));
			try (DBCursor cursor = mongoSettings.getCollection().find(find)) {
				if (cursor.hasNext()) {
					return Results.ok(Json.toJson(cursor.next().toMap())).as("application/json");
				}
			}
		}
		return Results.noContent();
	}
}


text:
struct __hlt_config {
    /// Number of worker threads to spawn.
    unsigned num_workers;

    /// Seconds to sleep when worker thread is idle.
    double time_idle;

    /// Secs o wait for threads to termintate after asking them to stop.
    double time_terminate;

    /// Stack size for worker threads.
    size_t thread_stack_size;

    /// Stack size for fibers.
    size_t fiber_stack_size;

    /// Maximum size of pool of recycalable fibers.
    size_t fiber_max_pool_size;

    /// File where debug output is to be sent. Default is stderr.
    const char* debug_out;

    /// Colon-separated list of debug stream.
    const char* debug_streams;

    /// 1 if profiling is enabled, 0 otherwise. Default is off.
    int8_t profiling;

    /// The smallest virtual thread number to use when hashing a thread
    /// context into the set of virtual threads. Default is 1.
    hlt_vthread_id vid_schedule_min;

    /// The largest virtual thread number to use when hashing a thread
    /// context into the set of virtual threads. Default is 100.
    hlt_vthread_id vid_schedule_max;

    /// A string specifying thread-to-core affinity with entries of the form
    /// "thread-name:core-number", separated by commas. No whitespace allowed
    /// anywhere. Set to NULL or empty string to disable any pinning. Default
    /// is the magic string "DEFAULT" which let's HILTI determine a pinning
    /// itself.
    const char* core_affinity;
};

/// Returns the current configuration. The returned value cannot be directly
/// modified. To change a setting, copy it by value and modify as desired.
/// The pass the new instance to hlt_config_set().
///
/// Returns: The current configuration.
extern const hlt_config* hlt_config_get();

/// Sets a new configuration for the libhilti. Normally, you should get the
/// current information from hlt_config_get() and only modify what you want
/// to change.
///
/// This function must only be called before hlt_init().
///
/// new_config: The new configuration. The passed in object will value-copied
/// internally so the instance can be deleted afterwards.
extern void hlt_config_set(const hlt_config* new_config);

/// Dumps out a debug representation of the current configuration state.
///
/// f: The file handle to write to.
extern void hlt_global_state_dump(FILE* f);

/// Dumps a debug reprenstation of the configuration state to the given file.
void hlt_config_dump(FILE* f);

/// XXX
extern hlt_config* __hlt_default_config();

#endif


text:
<?php
namespace RM\LinealesBundle\DependencyInjection;

use RM\AppBundle\DependencyInjection\DoctrineManager;
use RM\DiscretasBundle\Entity\Tipo;
use RM\DiscretasBundle\Entity\Vid;
use RM\DiscretasBundle\Entity\VidGrupoSegmento;
use RM\LinealesBundle\Entity\Vil;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

class Sociodemograficas
{
    /**
     * @var \Doctrine\Common\Persistence\ObjectManager
     */
    private $em;

    public function __construct(DoctrineManager $doctrine) {

        $this->em = $doctrine->getManager();

    }

    /**
     * @return array
     */
    public function  obtenerVariableSociodemograficas()
    {
        $socioDemograficasLineales  = $this->buscaVariablesSociodemograficasLineales();
        $socioDemograficasDiscretas = $this->buscaVariablesSociodemograficasDiscretas();

        return array_merge($socioDemograficasLineales, $socioDemograficasDiscretas);
    }

    /**
     * @param string $nombre
     * @return array
     */
    public function findVariablesSociodemograficasPorNombre($nombre = '')
    {
        if(empty($nombre)) {
            return $this->obtenerVariableSociodemograficas();
        }

        $lineales = $this->findVariablesSociodemograficasLinealesByNombre($nombre);
        $discretas = $this->findVariablesSociodemograficasDiscretasByNombre($nombre);

        return array_merge($lineales, $discretas );
    }

    /**
     * @return array
     */
    private function buscaVariablesSociodemograficasLineales()
    {
        $dql_lineales = "
            SELECT DISTINCT  vs.idVil as id, v.nombre as nombre, v.descripcion as descripcion, 0 as discreta
              FROM RMLinealesBundle:VilSegmento vs
              LEFT JOIN RMLinealesBundle:Vil v WITH (v.idVil = vs.idVil)
              LEFT JOIN RMDiscretasBundle:Tipo t WITH (v.tipo = t.id AND t.codigo = :codigoSociodemograficas)
        ";
        $query = $this->em->createQuery($dql_lineales)->setParameter('codigoSociodemograficas', Tipo::SOCIODEMOGRAFICO);
        $lineales =  $query->getResult();

        return $lineales;
    }

    /**
     * @return array
     */
    private function buscaVariablesSociodemograficasDiscretas()
    {
        $dql_discretas = "
            SELECT DISTINCT v.idVid as id, v.nombre as nombre, v.descripcion as descripcion, 1 AS discreta
              FROM RMDiscretasBundle:Vid v
            LEFT JOIN   RMDiscretasBundle:VidSegmento vs WITH (vs.estado > 0)
            LEFT JOIN RMDiscretasBundle:VidGrupoSegmento vgs WITH (v.idVid = vgs.idVid and vgs.idVidGrupoSegmento = vs.idVidGrupoSegmento and vgs.estado > 0 and vgs.personalizado = 1)
            LEFT JOIN RMDiscretasBundle:Tipo t WITH (v.tipo = t.id)
            WHERE t.codigo = :codigoSociodemograficas
        ";

        $query = $this->em->createQuery($dql_discretas)->setParameter('codigoSociodemograficas', Tipo::SOCIODEMOGRAFICO);
        $discretas = $query->getResult();

        return $discretas;
    }

    /**
     * @param $nombre
     * @return mixed
     */
    public function findVariablesSociodemograficasLinealesByNombre($nombre)
    {

        $dql_lineales = "
            SELECT DISTINCT  vs.idVil as id, v.nombre as nombre, v.descripcion as descripcion, 0 as discreta
              FROM RMLinealesBundle:VilSegmento vs
              LEFT JOIN RMLinealesBundle:Vil v WITH (v.idVil = vs.idVil)
              LEFT JOIN RMDiscretasBundle:Tipo t WITH (v.tipo = t.id AND t.codigo = :codigoSociodemograficas)
             WHERE v.nombre LIKE :nombre
        ";

        $query = $this->em->createQuery($dql_lineales)
            ->setParameter('codigoSociodemograficas', Tipo::SOCIODEMOGRAFICO)
            ->setParameter('nombre', sprintf('%%%s%%',$nombre));

        $lineales =  $query->getResult();

        return $lineales;
    }

    public function findVariablesSociodemograficasDiscretasByNombre($nombre)
    {
        $dql_discretas = "
            SELECT DISTINCT v.idVid as id, v.nombre as nombre, v.descripcion as descripcion, 1 AS discreta
              FROM RMDiscretasBundle:Vid v
            LEFT JOIN   RMDiscretasBundle:VidSegmento vs WITH (vs.estado > 0)
            LEFT JOIN RMDiscretasBundle:VidGrupoSegmento vgs WITH (v.idVid = vgs.idVid and vgs.idVidGrupoSegmento = vs.idVidGrupoSegmento and vgs.estado > 0 and vgs.personalizado = 1)
            LEFT JOIN RMDiscretasBundle:Tipo t WITH (v.tipo = t.id)
            WHERE t.codigo = :codigoSociodemograficas
            AND v.nombre LIKE :nombre
            ";

        $query = $this->em->createQuery($dql_discretas)
            ->setParameter('codigoSociodemograficas', Tipo::SOCIODEMOGRAFICO)
            ->setParameter('nombre', sprintf('%%%s%%',$nombre));

        $discretas = $query->getResult();

        return $discretas;
    }

    public function findDatosVariableSocioDemograficaLineal(Vil $variable = null)
    {
        if(! $variable instanceof Vil) {
            throw new InvalidArgumentException();
        }

        $datosVariable = $this->em->getRepository('RMLinealesBundle:VilSegmento')->findBy(
            [
                'idVil' => $variable->getidVil()
            ]
        );

        return $datosVariable;
    }

    public function findDatosVariableSociodemograficaDiscreta(Vid $variable = null)
    {
        if(!$variable instanceof Vid){
            throw new InvalidArgumentException();
        }

         $grupoSegmento = $this->em->getRepository('RMDiscretasBundle:VidGrupoSegmento')->findOneBy(
            [
                'idVid' => $variable->getIdVid()
            ]
        );

        $datosVariable = $this->em->getRepository('RMDiscretasBundle:VidSegmento')->findBy(
            [
                'idVidGrupoSegmento' => $grupoSegmento->getIdVidGrupoSegmento()
            ]
        );

        return $datosVariable;
    }

}

?>


text:
SELECT
    toleranzstufe.t_id AS tid,
    toleranzstufe.nbident,
    toleranzstufe.identifikator,
    toleranzstufe.geometrie,
    to_char(toleranzstufe.gueltigereintrag,'YYYYMMDD') AS gueltigereintrag,
    ts_art.itfcode AS art,
    toleranzstufe.art AS art_txt,
    CAST(toleranzstufe.t_datasetname AS INT) AS gem_bfs,
    0 AS los,
    aimport.importdate AS lieferdatum
FROM
    agi_dm01avso24.tseinteilung_toleranzstufe AS toleranzstufe
    LEFT JOIN agi_dm01avso24.t_ili2db_basket AS basket
        ON toleranzstufe.t_basket = basket.t_id
    LEFT JOIN agi_dm01avso24.tseinteilung_toleranzstufe_art AS ts_art
        ON toleranzstufe.art = ts_art.ilicode
    LEFT JOIN
    (
        SELECT
            max(importdate) AS importdate,
            dataset
        FROM
            agi_dm01avso24.t_ili2db_import
        GROUP BY
            dataset
    ) AS  aimport
        ON basket.dataset = aimport.dataset
;


text:
<?php

/**
 * This is the model class for table "{{FeedBack}}".
 *
 * The followings are the available columns in table '{{FeedBack}}':
 * @property integer $id
 * @property string $creation_date
 * @property string $change_date
 * @property string $name
 * @property string $email
 * @property string $theme
 * @property string $text
 * @property integer $type
 * @property integer $status
 * @property integer $ip
 * @property integer $category_id
 * @property string  $phone
 */
class FeedBack extends YModel
{

    const STATUS_NEW           = 0;
    const STATUS_PROCESS       = 1;
    const STATUS_FINISHED      = 2;
    const STATUS_ANSWER_SENDED = 3;

    const TYPE_DEFAULT = 0;

    const IS_FAQ_NO = 0;
    const IS_FAQ    = 1;

    /**
     * Returns the static model of the specified AR class.
     * @param string $className
     * @return FeedBack the static model class
     */
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return '{{feedback_feedback}}';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        return array(
            array('name, email, theme, text', 'required'),
            array('name, email, theme, text, phone', 'filter', 'filter' => array($obj = new CHtmlPurifier(), 'purify')),
            array('type, status, answer_user, is_faq, type, category_id', 'numerical', 'integerOnly' => true),
            array('is_faq', 'in', 'range' => array(0, 1)),
            array('status', 'in', 'range' => array_keys($this->statusList)),
            array('type', 'in', 'range' => array_keys($this->typeList)),
            array('name, email, phone', 'length', 'max' => 150),
            array('theme', 'length', 'max' => 250),
            array('ip', 'length', 'max' => 20),
            array('answer_date', 'length', 'max' => 100),
            array('email', 'email'),
            array('answer', 'filter', 'filter' => 'trim'),
            array('id, creation_date, change_date, name, email, theme, text, type, status, ip', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'id'            => Yii::t('FeedbackModule.feedback', 'Идентификатор'),
            'creation_date' => Yii::t('FeedbackModule.feedback', 'Добавлено'),
            'change_date'   => Yii::t('FeedbackModule.feedback', 'Изменено'),
            'name'          => Yii::t('FeedbackModule.feedback', 'Имя'),
            'email'         => Yii::t('FeedbackModule.feedback', 'Email'),
            'phone'         => Yii::t('FeedbackModule.feedback', 'Телефон'),
            'theme'         => Yii::t('FeedbackModule.feedback', 'Тема'),
            'text'          => Yii::t('FeedbackModule.feedback', 'Текст'),
            'type'          => Yii::t('FeedbackModule.feedback', 'Тип'),
            'answer'        => Yii::t('FeedbackModule.feedback', 'Ответ'),
            'answer_date'   => Yii::t('FeedbackModule.feedback', 'Время ответа'),
            'answer_user'   => Yii::t('FeedbackModule.feedback', 'Ответил'),
            'is_faq'        => Yii::t('FeedbackModule.feedback', 'В разделе FAQ'),
            'status'        => Yii::t('FeedbackModule.feedback', 'Статус'),
            'ip'            => Yii::t('FeedbackModule.feedback', 'Ip-адрес'),
            'category_id'   => Yii::t('FeedbackModule.feedback', 'Категория'),
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search()
    {
        $criteria = new CDbCriteria;

        $criteria->compare('id', $this->id);
        $criteria->compare('creation_date', $this->creation_date, true);
        $criteria->compare('change_date', $this->change_date, true);
        $criteria->compare('name', $this->name, true);
        $criteria->compare('email', $this->email, true);
        $criteria->compare('theme', $this->theme, true);
        $criteria->compare('text', $this->text, true);
        $criteria->compare('type', $this->type);
        $criteria->compare('status', $this->status);
        $criteria->compare('ip', $this->ip);
        $criteria->compare('is_faq', $this->is_faq);
        $criteria->compare('category_id', $this->category_id);

        return new CActiveDataProvider(get_class($this), array(
            'criteria' => $criteria,
            'sort'     => array('defaultOrder' => 'status ASC, change_date ASC'),
        ));
    }

    public function beforeValidate()
    {
        $this->change_date = YDbMigration::expression('NOW()');

        if ($this->isNewRecord)
        {
            $this->creation_date = $this->change_date;
            $this->ip            = Yii::app()->request->userHostAddress;

            if (!$this->type)
                $this->type = self::TYPE_DEFAULT;
        }

        return parent::beforeValidate();
    }

    public function scopes()
    {
        return array(
            'new'      => array(
                'condition' => 'status = :status',
                'params'    => array(':status' => self::STATUS_NEW),
             ),
            'answered' => array(
                'condition' => 'status = :status',
                'params'    => array(':status' => self::STATUS_ANSWER_SENDED),
            ),
            'faq'      => array(
                'condition' => 'is_faq = :is_faq',
                'params'    => array(':is_faq' => self::IS_FAQ),
            ),
        );
    }

    public function getAnsweredUser()
    {
        return $this->answer_user ? User::model()->findByPk($this->answer_user)->getFullName() : Yii::t('FeedbackModule.feedback', '—');
    }

    public function getStatusList()
    {
        return array(
            self::STATUS_NEW           => Yii::t('FeedbackModule.feedback', 'Новое сообщение'),
            self::STATUS_PROCESS       => Yii::t('FeedbackModule.feedback', 'Сообщение в обработке'),
            self::STATUS_FINISHED      => Yii::t('FeedbackModule.feedback', 'Сообщение обработано'),
            self::STATUS_ANSWER_SENDED => Yii::t('FeedbackModule.feedback', 'Ответ отправлен'),
        );
    }

    public function getStatus()
    {
        $data = $this->statusList;
        return isset($data[$this->status]) ? $data[$this->status] : Yii::t('FeedbackModule.feedback', 'Статус сообщения неизвестен');
    }

    public function getTypeList()
    {
        $types = Yii::app()->getModule('feedback')->types;

        if ($types)
            $types[self::TYPE_DEFAULT] = Yii::t('FeedbackModule.feedback', 'По умолчанию');
        else
            $types = array(self::TYPE_DEFAULT => Yii::t('FeedbackModule.feedback', 'По умолчанию'));

        return $types;
    }

    public function getType()
    {
        $data = $this->typeList;
        return isset($data[$this->type]) ? $data[$this->type] : Yii::t('FeedbackModule.feedback', 'Неизвестный тип сообщения!');
    }

    public function getIsFaqList()
    {
        return array(
            self::IS_FAQ_NO => Yii::t('FeedbackModule.feedback', 'Нет'),
            self::IS_FAQ    => Yii::t('FeedbackModule.feedback', 'Да'),
        );
    }

    public function getIsFaq()
    {
        $data = $this->isFaqList;
        return isset($data[$this->is_faq]) ? $data[$this->is_faq] : Yii::t('FeedbackModule.feedback', '*неизвестно*');
    }

    public function relations()
    {
        return array(
            'category' => array(self::BELONGS_TO,'Category','category_id')
        );
    }

    public function getCategory()
    {
        return empty($this->category) ? '---' : $this->category->name;
    }
}


text:
package com.sleekbyte.tailor.listeners.lengths;

import com.sleekbyte.tailor.antlr.SwiftParser;
import com.sleekbyte.tailor.antlr.SwiftParser.IdentifierContext;
import com.sleekbyte.tailor.common.ConstructLengths;
import com.sleekbyte.tailor.common.Messages;
import com.sleekbyte.tailor.common.Rules;
import com.sleekbyte.tailor.listeners.DeclarationListener;
import com.sleekbyte.tailor.output.Printer;
import com.sleekbyte.tailor.utils.SourceFileUtil;
import org.antlr.v4.runtime.ParserRuleContext;

import java.util.List;
import java.util.Set;

/**
 * Parse tree listener for verifying maximum lengths of Swift constructs.
 */
public final class MaxLengthListener extends LengthListener {

    /**
     * Listener that verifies max name and construct lengths.
     *
     * @param printer Printer object
     * @param constructLengths ConstructLengths object
     * @param enabledRules Set of enabled rules
     */
    public MaxLengthListener(Printer printer, ConstructLengths constructLengths, Set<Rules> enabledRules) {
        this.constructLengths = constructLengths;
        this.printer = printer;
        this.enabledRules = enabledRules;
    }

    @Override
    public void enterTopLevel(SwiftParser.TopLevelContext topLevelCtx) {
        List<IdentifierContext> constants = DeclarationListener.getConstantNames(topLevelCtx);
        constants.forEach(ctx ->
            verifyNameLength(Messages.CONSTANT + Messages.NAME, constructLengths.maxNameLength, ctx));

        List<IdentifierContext> variables = DeclarationListener.getVariableNames(topLevelCtx);
        variables.forEach(ctx ->
            verifyNameLength(Messages.VARIABLE + Messages.NAME, constructLengths.maxNameLength, ctx));
    }

    @Override
    public void enterClassName(SwiftParser.ClassNameContext ctx) {
        verifyNameLength(Messages.CLASS + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterEnumName(SwiftParser.EnumNameContext ctx) {
        verifyNameLength(Messages.ENUM + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterStructName(SwiftParser.StructNameContext ctx) {
        verifyNameLength(Messages.STRUCT + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterProtocolName(SwiftParser.ProtocolNameContext ctx) {
        verifyNameLength(Messages.PROTOCOL + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterClassBody(SwiftParser.ClassBodyContext ctx) {
        if (enabledRules.contains(Rules.MAX_CLASS_LENGTH)) {
            verifyConstructLength(Rules.MAX_CLASS_LENGTH, Messages.CLASS, constructLengths.maxClassLength, ctx);
        }
    }

    @Override
    public void enterClosureExpression(SwiftParser.ClosureExpressionContext ctx) {
        if (enabledRules.contains(Rules.MAX_CLOSURE_LENGTH)) {
            verifyConstructLength(Rules.MAX_CLOSURE_LENGTH, Messages.CLOSURE, constructLengths.maxClosureLength, ctx);
        }
    }

    @Override
    public void enterFunctionBody(SwiftParser.FunctionBodyContext ctx) {
        if (enabledRules.contains(Rules.MAX_FUNCTION_LENGTH)) {
            verifyConstructLength(Rules.MAX_FUNCTION_LENGTH, Messages.FUNCTION, constructLengths.maxFunctionLength,
                ctx);
        }
    }

    @Override
    public void enterStructBody(SwiftParser.StructBodyContext ctx) {
        if (enabledRules.contains(Rules.MAX_STRUCT_LENGTH)) {
            verifyConstructLength(Rules.MAX_STRUCT_LENGTH, Messages.STRUCT, constructLengths.maxStructLength, ctx);
        }
    }

    @Override
    public void enterElementName(SwiftParser.ElementNameContext ctx) {
        verifyNameLength(Messages.ELEMENT + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterFunctionName(SwiftParser.FunctionNameContext ctx) {
        verifyNameLength(Messages.FUNCTION + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterLabelName(SwiftParser.LabelNameContext ctx) {
        verifyNameLength(Messages.LABEL + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterSetterName(SwiftParser.SetterNameContext ctx) {
        verifyNameLength(Messages.SETTER + Messages.NAME, constructLengths.maxNameLength, ctx.identifier());
    }

    @Override
    public void enterTypeName(SwiftParser.TypeNameContext ctx) {
        verifyNameLength(Messages.TYPE + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterTypealiasName(SwiftParser.TypealiasNameContext ctx) {
        verifyNameLength(Messages.TYPEALIAS + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterVariableName(SwiftParser.VariableNameContext ctx) {
        verifyNameLength(Messages.VARIABLE + Messages.NAME, constructLengths.maxNameLength, ctx);
    }

    @Override
    public void enterRawValueStyleEnumCase(SwiftParser.RawValueStyleEnumCaseContext ctx) {
        verifyNameLength(Messages.ENUM_CASE + Messages.NAME, constructLengths.maxNameLength,
            ctx.enumCaseName());
    }

    @Override
    public void enterUnionStyleEnumCase(SwiftParser.UnionStyleEnumCaseContext ctx) {
        verifyNameLength(Messages.ENUM_CASE + Messages.NAME, constructLengths.maxNameLength,
            ctx.enumCaseName());
    }

    protected void verifyConstructLength(Rules rule, String constructType, int length, ParserRuleContext ctx) {
        if (SourceFileUtil.constructTooLong(ctx, length)) {
            int constructLength = ctx.getStop().getLine() - ctx.getStart().getLine();
            createErrorMessage(rule, constructLength, ctx, constructType, length, Messages.EXCEEDS_LINE_LIMIT);
        }
    }

    protected void verifyNameLength(String constructType, int length, ParserRuleContext ctx) {
        if (enabledRules.contains(Rules.MAX_NAME_LENGTH) && SourceFileUtil.nameTooLong(ctx, length)) {
            createErrorMessage(Rules.MAX_NAME_LENGTH, ctx.getText().length(), ctx, constructType, length,
                Messages.EXCEEDS_CHARACTER_LIMIT);
        }
    }

}


text:
id: sql-overview
title: Pulsar SQL Overview
sidebar_label: "Overview"
---

Apache Pulsar is used to store streams of event data, and the event data is structured with predefined fields. With the implementation of the [Schema Registry](schema-get-started), you can store structured data in Pulsar and query the data by using [Trino (formerly Presto SQL)](https://trino.io/).

As the core of Pulsar SQL, Presto Pulsar connector enables Presto workers within a Presto cluster to query data from Pulsar.

![The Pulsar consumer and reader interfaces](/assets/pulsar-sql-arch-2.png)

The query performance is efficient and highly scalable, because Pulsar adopts [two level segment based architecture](concepts-architecture-overview.md#apache-bookkeeper).

Topics in Pulsar are stored as segments in [Apache BookKeeper](https://bookkeeper.apache.org/). Each topic segment is replicated to some BookKeeper nodes, which enables concurrent reads and high read throughput. You can configure the number of BookKeeper nodes, and the default number is `3`. In Presto Pulsar connector, data is read directly from BookKeeper, so Presto workers can read concurrently from horizontally scalable number BookKeeper nodes.

![The Pulsar consumer and reader interfaces](/assets/pulsar-sql-arch-1.png)


text:
class WitEmulator(object):
    def __init__(self):
        self.name = "wit"

    def normalise_request_json(self, data):
        _data = {}
        _data["text"] = data["q"][0] if type(data["q"]) == list else data["q"]
        return _data

    def normalise_response_json(self, data):
        entities = {}
        for entity in data["entities"]:
            entities[entity["entity"]] = {
                "confidence": None,
                "type": "value",
                "value": entity["value"],
                "start": entity["start"],
                "end": entity["end"]
            }

        return [
            {
                "_text": data["text"],
                "confidence": None,
                "intent": data["intent"],
                "entities": entities
            }
        ]