text:
package com.amazonaws.services.ec2.model;

import java.io.Serializable;

/**
 *

 * Describes a block device mapping.
 *

 */
public class BlockDeviceMapping implements Serializable, Cloneable {

    /**
     *

     * The virtual device name (ephemeralN). Instance store volumes
     * are numbered starting from 0. An instance type with 2 available instance
     * store volumes can specify mappings for ephemeral0 and
     * ephemeral1.The number of available instance store volumes
     * depends on the instance type. After you connect to the instance, you must
     * mount the volume.
     *

     *

     * Constraints: For M3 instances, you must specify instance store volumes in
     * the block device mapping for the instance. When you launch an M3
     * instance, we ignore any instance store volumes specified in the block
     * device mapping for the AMI.
     *

     */
    private String virtualName;
    /**
     *

     * The device name exposed to the instance (for example,
     * /dev/sdh or xvdh).
     *

     */
    private String deviceName;
    /**
     *

     * Parameters used to automatically set up EBS volumes when the instance is
     * launched.
     *

     */
    private EbsBlockDevice ebs;
    /**
     *

     * Suppresses the specified device included in the block device mapping of
     * the AMI.
     *

     */
    private String noDevice;

    /**
     *

     * The virtual device name (ephemeralN). Instance store volumes
     * are numbered starting from 0. An instance type with 2 available instance
     * store volumes can specify mappings for ephemeral0 and
     * ephemeral1.The number of available instance store volumes
     * depends on the instance type. After you connect to the instance, you must
     * mount the volume.
     *

     *

     * Constraints: For M3 instances, you must specify instance store volumes in
     * the block device mapping for the instance. When you launch an M3
     * instance, we ignore any instance store volumes specified in the block
     * device mapping for the AMI.
     *

     *
     * @param virtualName
     *        The virtual device name (ephemeralN). Instance store
     *        volumes are numbered starting from 0. An instance type with 2
     *        available instance store volumes can specify mappings for
     *        ephemeral0 and ephemeral1.The number of
     *        available instance store volumes depends on the instance type.
     *        After you connect to the instance, you must mount the volume.

     *

     *        Constraints: For M3 instances, you must specify instance store
     *        volumes in the block device mapping for the instance. When you
     *        launch an M3 instance, we ignore any instance store volumes
     *        specified in the block device mapping for the AMI.
     */

    public void setVirtualName(String virtualName) {
        this.virtualName = virtualName;
    }

    /**
     *

     * The virtual device name (ephemeralN). Instance store volumes
     * are numbered starting from 0. An instance type with 2 available instance
     * store volumes can specify mappings for ephemeral0 and
     * ephemeral1.The number of available instance store volumes
     * depends on the instance type. After you connect to the instance, you must
     * mount the volume.
     *

     *

     * Constraints: For M3 instances, you must specify instance store volumes in
     * the block device mapping for the instance. When you launch an M3
     * instance, we ignore any instance store volumes specified in the block
     * device mapping for the AMI.
     *

     *
     * @return The virtual device name (ephemeralN). Instance store
     *         volumes are numbered starting from 0. An instance type with 2
     *         available instance store volumes can specify mappings for
     *         ephemeral0 and ephemeral1.The number of
     *         available instance store volumes depends on the instance type.
     *         After you connect to the instance, you must mount the volume.

     *

     *         Constraints: For M3 instances, you must specify instance store
     *         volumes in the block device mapping for the instance. When you
     *         launch an M3 instance, we ignore any instance store volumes
     *         specified in the block device mapping for the AMI.
     */

    public String getVirtualName() {
        return this.virtualName;
    }

    /**
     *

     * The virtual device name (ephemeralN). Instance store volumes
     * are numbered starting from 0. An instance type with 2 available instance
     * store volumes can specify mappings for ephemeral0 and
     * ephemeral1.The number of available instance store volumes
     * depends on the instance type. After you connect to the instance, you must
     * mount the volume.
     *

     *

     * Constraints: For M3 instances, you must specify instance store volumes in
     * the block device mapping for the instance. When you launch an M3
     * instance, we ignore any instance store volumes specified in the block
     * device mapping for the AMI.
     *

     *
     * @param virtualName
     *        The virtual device name (ephemeralN). Instance store
     *        volumes are numbered starting from 0. An instance type with 2
     *        available instance store volumes can specify mappings for
     *        ephemeral0 and ephemeral1.The number of
     *        available instance store volumes depends on the instance type.
     *        After you connect to the instance, you must mount the volume.

     *

     *        Constraints: For M3 instances, you must specify instance store
     *        volumes in the block device mapping for the instance. When you
     *        launch an M3 instance, we ignore any instance store volumes
     *        specified in the block device mapping for the AMI.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public BlockDeviceMapping withVirtualName(String virtualName) {
        setVirtualName(virtualName);
        return this;
    }

    /**
     *

     * The device name exposed to the instance (for example,
     * /dev/sdh or xvdh).
     *

     *
     * @param deviceName
     *        The device name exposed to the instance (for example,
     *        /dev/sdh or xvdh).
     */

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    /**
     *

     * The device name exposed to the instance (for example,
     * /dev/sdh or xvdh).
     *

     *
     * @return The device name exposed to the instance (for example,
     *         /dev/sdh or xvdh).
     */

    public String getDeviceName() {
        return this.deviceName;
    }

    /**
     *

     * The device name exposed to the instance (for example,
     * /dev/sdh or xvdh).
     *

     *
     * @param deviceName
     *        The device name exposed to the instance (for example,
     *        /dev/sdh or xvdh).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public BlockDeviceMapping withDeviceName(String deviceName) {
        setDeviceName(deviceName);
        return this;
    }

    /**
     *

     * Parameters used to automatically set up EBS volumes when the instance is
     * launched.
     *

     *
     * @param ebs
     *        Parameters used to automatically set up EBS volumes when the
     *        instance is launched.
     */

    public void setEbs(EbsBlockDevice ebs) {
        this.ebs = ebs;
    }

    /**
     *

     * Parameters used to automatically set up EBS volumes when the instance is
     * launched.
     *

     *
     * @return Parameters used to automatically set up EBS volumes when the
     *         instance is launched.
     */

    public EbsBlockDevice getEbs() {
        return this.ebs;
    }

    /**
     *

     * Parameters used to automatically set up EBS volumes when the instance is
     * launched.
     *

     *
     * @param ebs
     *        Parameters used to automatically set up EBS volumes when the
     *        instance is launched.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public BlockDeviceMapping withEbs(EbsBlockDevice ebs) {
        setEbs(ebs);
        return this;
    }

    /**
     *

     * Suppresses the specified device included in the block device mapping of
     * the AMI.
     *

     *
     * @param noDevice
     *        Suppresses the specified device included in the block device
     *        mapping of the AMI.
     */

    public void setNoDevice(String noDevice) {
        this.noDevice = noDevice;
    }

    /**
     *

     * Suppresses the specified device included in the block device mapping of
     * the AMI.
     *

     *
     * @return Suppresses the specified device included in the block device
     *         mapping of the AMI.
     */

    public String getNoDevice() {
        return this.noDevice;
    }

    /**
     *

     * Suppresses the specified device included in the block device mapping of
     * the AMI.
     *

     *
     * @param noDevice
     *        Suppresses the specified device included in the block device
     *        mapping of the AMI.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public BlockDeviceMapping withNoDevice(String noDevice) {
        setNoDevice(noDevice);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getVirtualName() != null)
            sb.append("VirtualName: " + getVirtualName() + ",");
        if (getDeviceName() != null)
            sb.append("DeviceName: " + getDeviceName() + ",");
        if (getEbs() != null)
            sb.append("Ebs: " + getEbs() + ",");
        if (getNoDevice() != null)
            sb.append("NoDevice: " + getNoDevice());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof BlockDeviceMapping == false)
            return false;
        BlockDeviceMapping other = (BlockDeviceMapping) obj;
        if (other.getVirtualName() == null ^ this.getVirtualName() == null)
            return false;
        if (other.getVirtualName() != null
                && other.getVirtualName().equals(this.getVirtualName()) == false)
            return false;
        if (other.getDeviceName() == null ^ this.getDeviceName() == null)
            return false;
        if (other.getDeviceName() != null
                && other.getDeviceName().equals(this.getDeviceName()) == false)
            return false;
        if (other.getEbs() == null ^ this.getEbs() == null)
            return false;
        if (other.getEbs() != null
                && other.getEbs().equals(this.getEbs()) == false)
            return false;
        if (other.getNoDevice() == null ^ this.getNoDevice() == null)
            return false;
        if (other.getNoDevice() != null
                && other.getNoDevice().equals(this.getNoDevice()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime
                * hashCode
                + ((getVirtualName() == null) ? 0 : getVirtualName().hashCode());
        hashCode = prime * hashCode
                + ((getDeviceName() == null) ? 0 : getDeviceName().hashCode());
        hashCode = prime * hashCode
                + ((getEbs() == null) ? 0 : getEbs().hashCode());
        hashCode = prime * hashCode
                + ((getNoDevice() == null) ? 0 : getNoDevice().hashCode());
        return hashCode;
    }

    @Override
    public BlockDeviceMapping clone() {
        try {
            return (BlockDeviceMapping) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}


text:
<?php

$SudoWebScript = '/var/sudowebscript.sh';

if (isset($_GET['cmd'])) {
	$command = $_GET['cmd'];
	if ($command == "current") {
		exec("mpc current", $output, $return_var);
	} elseif ($command == "volume") {
		exec("mpc volume", $output, $return_var);
	} elseif ($command == "leiser") {
		exec("mpc volume -5", $output, $return_var);
	} elseif ($command == "lauter") {
		exec("mpc volume +5", $output, $return_var);
	} elseif ($command == "stop") {
		exec("mpc stop", $output, $return_var);
	}
}
if (isset($_GET['sender'])) {
	$number = $_GET['sender'];
	exec("mpc play ".$number, $output, $return_var);
}

if (isset($return_var) AND $return_var >= 1) {
	echo "ERROR:
";
	echo exitcode($return_var)."\n";
}
if (isset($output) AND !empty($output)) {
	foreach($output AS $line) { echo $line."
\n"; }
}

function exitcode($code) {
	switch($code) {
		case 0: $Reason = "Successful"; break;
		case 1: $Reason = "General Error (Miscellaneous errors, such as 'divide by zero' and other impermissible operations)"; break;
		case 2: $Reason = "Incorrect Usage"; break;
		case 126: $Reason = "Command found but not executable (Permission problem)"; break;
		case 127: $Reason = "Command not found (Possible problem with \$PATH or a typo)"; break;
		case 128: $Reason = "Invalid argument to exit (exit takes only integer args in the range 0 - 255)"; break;
		#case 130: $ReturnCode = "Script terminated by Control-C"; break;
		default:
			# http://de.wikipedia.org/wiki/Signal_(Unix)
			$Signal = $code - 128;
			switch($Signal) {
				#case 0: $Reason = ""; break;
				case 1: $Reason = "Hangup detected on controlling terminal or death of controlling process"; break;
				case 2: $Reason = "Interrupt from keyboard; interactive attention signal. Script terminated by Control-C"; break;
				case 3: $Reason = "Quit from keyboard."; break;
				case 4: $Reason = "Illegal instruction."; break;
				case 5: $Reason = "Trace/breakpoint trap."; break;
				case 6: $Reason = "Abnormal termination; abort signal from abort(3)."; break;
				case 7: $Reason = "BUS error (bad memory access)."; break;
				case 8: $Reason = "'Floating-point exception': erroneous arithmetic operation."; break;
				case 9: $Reason = "Kill, unblockable."; break;
				case 10: $Reason = "User-defined signal 1."; break;
				case 11: $Reason = "'Segmentation violation': invalid memory reference."; break;
				default: $Reason = $code;
			}
	}
	return $Reason;
}

?>

redpajama_set_name: RedPajamaGithub


text:
Dev2Ops – Development To Operations is a cost effective, DevOps based platform which is integrated with open source tools (open source tools provides cost efficiency, flexibility and security) providing continuous software delivery process.

### Download the latest version from the Releases. After extracting the zip, follow the steps from Installation Steps
[Installation Steps.md](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Installation%20steps.md)

You can check the Help Documentation from [UserGuide](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Dev2Ops_User_Guide.doc).
## Development / Contribution

Please read [CONTRIBUTING.md](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Contributing.md) before submitting your pull requests. It also has details on how to setup your development environment.
## Code of Conduct

To provide clarity on what is expected of our members, Tech Mahindra Dev2Ops has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities and we think it articulates our values well. For more, see the [Code of Conduct](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Code%20of%20conduct.md).
## Contact

If you have any queries on Tech Mahindra Dev2Ops , please write to [Dev2Ops Feedback](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Feedback.md).

To ask specific questions on project development, to discuss future improvements or for any other technical detail, please write to [Dev2Ops Feedback](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/Feedback.md).

## License

Tech Mahindra Dev2Ops is licensed under [MIT License](https://github.com/Dev2Ops-TechMahindra/Dev2Ops/blob/master/LICENSE).


text:
package com.vagabond.dealhunting.ui;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.util.Log;

import com.vagabond.dealhunting.data.DealContract;
import com.vagabond.dealhunting.data.DealDBHelper;

public class DealProvider extends ContentProvider {

  private static final String LOG_TAG = DealProvider.class.getSimpleName();

  private static final int CATEGORY = 200;
  private static final int PROMOTION = 201;
  private static final int PROMOTION_CATEGORY = 202;
  private static final int STORE = 203;
  private static final int STORE_WITH_ID = 204;
  private static final int PROMOTION_WITH_ID = 205;
  private static final int STORE_PROMOTION = 206;
  private static final UriMatcher sUriMatcher = buildUriMatcher();
  private static final SQLiteQueryBuilder sCategoryQueryBuild;
  private static final SQLiteQueryBuilder sPromotionQueryBuild;
  private static final SQLiteQueryBuilder sStoreQueryBuild;
  private static final String promotionCategorySelection = DealContract.PromotionEntry.TABLE_NAME +
      "." + DealContract.PromotionEntry.COLUMN_CATEGORY_KEY + " = ? ";
  private static final String promotionStoreSelection = DealContract.PromotionEntry.TABLE_NAME +
      "." + DealContract.PromotionEntry.COLUMN_STORE_KEY + " = ? ";
  private static final String sPromotionIDSelection = DealContract.PromotionEntry.TABLE_NAME +
      "." + DealContract.PromotionEntry._ID + " = ? ";
  private static final String sStoreIDSelection = DealContract.PromotionEntry._ID + " = ? ";

  static {
    sCategoryQueryBuild = new SQLiteQueryBuilder();
    sPromotionQueryBuild = new SQLiteQueryBuilder();
    sStoreQueryBuild = new SQLiteQueryBuilder();

    sCategoryQueryBuild.setTables(DealContract.CategoryEntry.TABLE_NAME);
    sPromotionQueryBuild.setTables(DealContract.PromotionEntry.TABLE_NAME + " INNER JOIN " +
        DealContract.StoreEntry.TABLE_NAME + " ON " + DealContract.PromotionEntry.COLUMN_STORE_KEY +
        " = " + DealContract.StoreEntry.TABLE_NAME + "." + DealContract.StoreEntry._ID);
    sStoreQueryBuild.setTables(DealContract.StoreEntry.TABLE_NAME);
  }

  private DealDBHelper mOpenHelper;

  private static UriMatcher buildUriMatcher() {
    UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.StoreEntry.PATH_STORE, STORE);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.StoreEntry.PATH_STORE + "/#", STORE_WITH_ID);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.StoreEntry.PATH_STORE + "/*", STORE_PROMOTION);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.CategoryEntry.PATH_CATEGORY, CATEGORY);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.PromotionEntry.PATH_PROMOTION, PROMOTION);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.PromotionEntry.PATH_PROMOTION + "/#", PROMOTION_WITH_ID);
    uriMatcher.addURI(DealContract.CONTENT_AUTHORITY, DealContract.PromotionEntry.PATH_PROMOTION + "/*", PROMOTION_CATEGORY);
    return uriMatcher;
  }

  @Override
  public boolean onCreate() {
    mOpenHelper = new DealDBHelper(getContext());
    return true;
  }

  @Nullable
  @Override
  public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    Cursor retCursor;
    switch (sUriMatcher.match(uri)) {
      case STORE:
        retCursor = sStoreQueryBuild.query(mOpenHelper.getReadableDatabase(), projection, selection, selectionArgs, null, null, sortOrder);
        break;
      case STORE_WITH_ID:
        retCursor = getStoreById(uri, projection);
        break;
      case STORE_PROMOTION:
        retCursor = getPromotionByStore(uri, projection);
        break;
      case CATEGORY:
        retCursor = sCategoryQueryBuild.query(mOpenHelper.getReadableDatabase(), projection, selection, selectionArgs, null, null, sortOrder);
        break;
      case PROMOTION:
        if (selectionArgs != null && !selectionArgs[0].equals("")) {
          selectionArgs[0] = "%" + selectionArgs[0] + "%";
          retCursor = sPromotionQueryBuild.query(mOpenHelper.getReadableDatabase(), projection, "promotion.title LIKE ?", selectionArgs, null, null, sortOrder);
        } else if (selectionArgs != null && selectionArgs[0].equals("")) {
          retCursor = sPromotionQueryBuild.query(mOpenHelper.getReadableDatabase(), projection, selection, null, null, null, sortOrder, "10");
        } else {
          retCursor = sPromotionQueryBuild.query(mOpenHelper.getReadableDatabase(), projection, selection, null, null, null, sortOrder);
        }
        break;
      case PROMOTION_WITH_ID:
        retCursor = getPromotionByPromotionID(uri, projection, sortOrder);
        break;
      case PROMOTION_CATEGORY:
        retCursor = getPromotionByCategory(uri, projection, sortOrder);
        break;
      default:
        throw new UnsupportedOperationException("Unknow uri: " + uri);
    }

    retCursor.setNotificationUri(getContext().getContentResolver(), uri);
    return retCursor;
  }

  private Cursor getPromotionByStore(Uri uri, String[] projection) {
    String selection = promotionStoreSelection;
    String[] selectionArgs = new String[]{DealContract.PromotionEntry.getStoreId(uri)};
    return sPromotionQueryBuild.query(mOpenHelper.getReadableDatabase(),
        projection,
        selection,
        selectionArgs,
        null,
        null,
        null
    );
  }

  private Cursor getPromotionByCategory(Uri uri, String[] projection, String sortOrder) {
    String selection = promotionCategorySelection;
    String[] selectionArgs = new String[]{DealContract.PromotionEntry.getCategoryId(uri) };
    Log.d(LOG_TAG, "getPromotionByCategory:" + selectionArgs[0]);
    return sPromotionQueryBuild.query(mOpenHelper.getReadableDatabase(),
        projection,
        selection,
        selectionArgs,
        null,
        null,
        sortOrder
    );
  }

  @Nullable
  @Override
  public String getType(Uri uri) {
    switch (sUriMatcher.match(uri)) {
      case CATEGORY:
        return DealContract.CategoryEntry.CONTENT_TYPE;
      case PROMOTION_CATEGORY:
        return DealContract.PromotionEntry.CONTENT_TYPE;
      case PROMOTION_WITH_ID:
        return DealContract.PromotionEntry.CONTENT_ITEM_TYPE;
      case PROMOTION:
        return DealContract.PromotionEntry.CONTENT_TYPE;
      default:
        throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
  }

  @Nullable
  @Override
  public Uri insert(Uri uri, ContentValues values) {
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);
    Uri retUri;
    long rowId;

    switch (match) {
      case CATEGORY:
        rowId = db.insert(DealContract.CategoryEntry.TABLE_NAME, null, values);
        if (rowId != -1) {
          retUri = DealContract.CategoryEntry.buildCategoryUri(rowId);
        } else {
          throw new SQLException("Fail to insert row into " + uri);
        }
        break;
      case PROMOTION:
        rowId = db.insert(DealContract.PromotionEntry.TABLE_NAME, null, values);
        if (rowId != -1) {
          retUri = DealContract.PromotionEntry.buildPromotionUri(rowId);
        } else {
          throw new SQLException("Fail to insert row into " + uri);
        }
        break;
      case STORE:
        rowId = db.insert(DealContract.StoreEntry.TABLE_NAME, null, values);
        if (rowId != -1) {
          retUri = DealContract.StoreEntry.buildStoreUri(rowId);
        } else {
          throw new SQLException("Fail to insert row into " + uri);
        }
        break;
      default:
        throw new UnsupportedOperationException("Unknown uri: " + uri);
    }

    getContext().getContentResolver().notifyChange(uri, null);
    return retUri;
  }

  @Override
  public int delete(Uri uri, String selection, String[] selectionArgs) {
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);

    int rowDeleteds;
    switch (match) {
      case CATEGORY:
        rowDeleteds = db.delete(DealContract.CategoryEntry.TABLE_NAME, selection, selectionArgs);
        break;
      case PROMOTION:
        rowDeleteds = db.delete(DealContract.PromotionEntry.TABLE_NAME, selection, selectionArgs);
        break;
      case STORE:
        rowDeleteds = db.delete(DealContract.StoreEntry.TABLE_NAME, selection, selectionArgs);
        break;
      default:
        throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
    getContext().getContentResolver().notifyChange(uri, null);
    return rowDeleteds;
  }

  @Override
  public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);

    int rowUpdated;
    switch (match) {
      case CATEGORY:
        rowUpdated = db.update(DealContract.CategoryEntry.TABLE_NAME, values, selection, selectionArgs);
        break;
      case PROMOTION:
        rowUpdated = db.update(DealContract.PromotionEntry.TABLE_NAME, values, selection, selectionArgs);
        break;
      case STORE:
        rowUpdated = db.update(DealContract.StoreEntry.TABLE_NAME, values, selection, selectionArgs);
        break;
      default:
        throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
    getContext().getContentResolver().notifyChange(uri, null);
    return rowUpdated;
  }

  @Override
  public int bulkInsert(Uri uri, ContentValues[] values) {
    final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    final int match = sUriMatcher.match(uri);
    int returnCount = 0;

    switch (match) {
      case CATEGORY:
        db.beginTransaction();
        try {
          for (ContentValues value : values) {
            long _id = db.insertWithOnConflict(DealContract.CategoryEntry.TABLE_NAME, null, value, SQLiteDatabase.CONFLICT_IGNORE);
            if (_id != -1) {
              returnCount++;
            }
          }
          db.setTransactionSuccessful();
        } finally {
          db.endTransaction();
        }
        getContext().getContentResolver().notifyChange(uri, null);
        return returnCount;
      case PROMOTION:
        db.beginTransaction();
        try {
          for (ContentValues value : values) {
            long _id = db.insertWithOnConflict(DealContract.PromotionEntry.TABLE_NAME, null, value, SQLiteDatabase.CONFLICT_REPLACE);
            if (_id != -1) {
              returnCount++;
            }
          }
          db.setTransactionSuccessful();
        } finally {
          db.endTransaction();
        }
        getContext().getContentResolver().notifyChange(uri, null);
        return returnCount;
      case STORE:
        db.beginTransaction();
        try {
          for (ContentValues value : values) {
            long _id = db.insertWithOnConflict(DealContract.StoreEntry.TABLE_NAME, null, value, SQLiteDatabase.CONFLICT_REPLACE);
            if (_id != -1) {
              returnCount++;
            }
          }
          db.setTransactionSuccessful();
        } finally {
          db.endTransaction();
        }
        getContext().getContentResolver().notifyChange(uri, null);
        return returnCount;
      default:
        return super.bulkInsert(uri, values);
    }
  }

  public Cursor getPromotionByPromotionID(Uri uri, String[] projection, String sortOrder) {
    return sPromotionQueryBuild.query(
        mOpenHelper.getReadableDatabase(),
        projection, sPromotionIDSelection,
        new String[]{ DealContract.PromotionEntry.getPromotionIdFromUri(uri) },
        null,
        null,
        sortOrder);
  }

  private Cursor getStoreById(Uri uri, String[] projection) {
    return sStoreQueryBuild.query(
        mOpenHelper.getReadableDatabase(),
        projection, sStoreIDSelection,
        new String[]{DealContract.StoreEntry.getStoreIdFromUri(uri)},
        null,
        null,
        null);
  }
}


text:
<?php

namespace Kraken\_Unit\Runtime\Container\Manager;

use Dazzle\Channel\Extra\Request;
use Dazzle\Channel\Protocol\Protocol;
use Dazzle\Channel\ChannelInterface;
use Dazzle\Promise\PromiseFulfilled;
use Dazzle\Promise\PromiseRejected;
use Kraken\Runtime\Container\Manager\ThreadManagerBase;
use Kraken\Runtime\Container\ThreadManagerInterface;
use Kraken\Runtime\Runtime;
use Kraken\Runtime\RuntimeCommand;
use Kraken\Runtime\RuntimeContainerInterface;
use Kraken\Test\TUnit;
use Dazzle\Throwable\Exception\Logic\InvalidArgumentException;
use Dazzle\Throwable\Exception\Logic\ResourceOccupiedException;
use Dazzle\Throwable\Exception\Runtime\RejectionException;
use StdClass;

class ThreadManagerBaseTest extends TUnit
{
    /**
     * @var RuntimeCommand
     */
    private $command;

    /**
     *
     */
    public function testApiConstructor_CreatesInstance()
    {
        $manager = $this->createThreadManager();

        $this->assertInstanceOf(ThreadManagerBase::class, $manager);
        $this->assertInstanceOf(ThreadManagerInterface::class, $manager);
    }

    /**
     *
     */
    public function testApiDestructor_DoesNotThrowException()
    {
        $manager = $this->createThreadManager();
        unset($manager);
    }

    /**
     *
     */
    public function testApiExistsThread_ReturnsFalse_WhenThreadDoesNotExist()
    {
        $manager = $this->createThreadManager();

        $this->assertFalse($manager->existsThread('alias'));
    }

    /**
     *
     */
    public function testApiExistsThread_ReturnsTrue_WhenThreadDoesExist()
    {
        $manager = $this->createThreadManager();
        $this->setProtectedProperty($manager, 'threads', [ 'alias' => new StdClass ]);

        $this->assertTrue($manager->existsThread('alias'));
    }

    /**
     *
     */
    public function testApiCreateThread_RejectsPromise_WhenThreadDoesNotExistAndNameIsNull()
    {
        $manager = $this->createThreadManager();
        $alias = 'alias';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(InvalidArgumentException::class));

        $manager
            ->createThread($alias, null)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiCreateThread_RecreatesThreadWithForceSoft_WhenThreadDoesExistAndForceIsForceSoft()
    {
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $name = 'name';
        $flags = Runtime::CREATE_FORCE_SOFT;

        $manager
            ->expects($this->once())
            ->method('destroyThread')
            ->with($alias, Runtime::DESTROY_FORCE_SOFT)
            ->will($this->returnCallback(function() {
                $mock = $this->getMock(PromiseFulfilled::class, [ 'then' ], [], '', false);
                $mock
                    ->expects($this->any())
                    ->method('then')
                    ->will($this->returnCallback(function($func) {
                        return new PromiseFulfilled();
                    }));

                return $mock;
            }));

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke');

        $manager
            ->createThread($alias, $name, $flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiCreateThread_RecreatesThreadWithForceHard_WhenThreadDoesExistAndForceIsForceHard()
    {
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $name = 'name';
        $flags = Runtime::CREATE_FORCE_HARD;

        $manager
            ->expects($this->once())
            ->method('destroyThread')
            ->with($alias, Runtime::DESTROY_FORCE_HARD)
            ->will($this->returnCallback(function() {
                $mock = $this->getMock(PromiseFulfilled::class, [ 'then' ], [], '', false);
                $mock
                    ->expects($this->any())
                    ->method('then')
                    ->will($this->returnCallback(function($func) {
                        return new PromiseFulfilled();
                    }));

                return $mock;
            }));

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke');

        $manager
            ->createThread($alias, $name, $flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiCreateThread_RecreatesThreadWithForce_WhenThreadDoesExistAndForceIsForce()
    {
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $name = 'name';
        $flags = Runtime::CREATE_FORCE;

        $manager
            ->expects($this->once())
            ->method('destroyThread')
            ->with($alias, Runtime::DESTROY_FORCE)
            ->will($this->returnCallback(function() {
                $mock = $this->getMock(PromiseFulfilled::class, [ 'then' ], [], '', false);
                $mock
                    ->expects($this->any())
                    ->method('then')
                    ->will($this->returnCallback(function($func) {
                        return new PromiseFulfilled();
                    }));

                return $mock;
            }));

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke');

        $manager
            ->createThread($alias, $name, $flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiCreateThread_RejectsPromise_WhenThreadDoesExistAndForceIsDefault()
    {
        $manager = $this->createThreadManager();
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $name = 'name';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(ResourceOccupiedException::class));

        $manager
            ->createThread($alias, $name)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiDestroyThread_ResolvesPromise_WhenThreadDoesNotExist()
    {
        $manager = $this->createThreadManager();
        $alias = 'alias';
        $name = 'name';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->destroyThread($alias, $name)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiDestroyThread_RejectsPromise_WhenThreadDoesExistAndForceFlagIsDestroyKeep()
    {
        $manager = $this->createThreadManager();
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $flags = Runtime::DESTROY_KEEP;

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(ResourceOccupiedException::class));

        $manager
            ->destroyThread($alias, $flags)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiStartThread_InvokesValidCommand()
    {
        $manager = $this->createThreadManager();
        $manager->startThread($alias = 'alias');
        $command = $this->getCommand();

        $this->assertInstanceOf(RuntimeCommand::class, $command);
        $this->assertSame('container:start', $command->getCommand());
        $this->assertSame([], $command->getParams());
    }

    /**
     *
     */
    public function testApiStopThread_InvokesValidCommand()
    {
        $manager = $this->createThreadManager();
        $manager->stopThread($alias = 'alias');
        $command = $this->getCommand();

        $this->assertInstanceOf(RuntimeCommand::class, $command);
        $this->assertSame('container:stop', $command->getCommand());
        $this->assertSame([], $command->getParams());
    }

    /**
     *
     */
    public function testApiCreateThreads_ResolvesPromise_WhenAllThreadsAreCreated()
    {
        $manager = $this->createThreadManager([ 'createThread' ]);
        $manager
            ->expects($this->twice())
            ->method('createThread')
            ->will($this->returnValue(new PromiseFulfilled()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];
        $flags = 'flags';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->createThreads($aliases, $flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiCreateThreads_RejectsPromise_WhenAtLeastOneThreadCouldNotBeCreated()
    {
        $manager = $this->createThreadManager([ 'createThread' ]);
        $manager
            ->expects($this->twice())
            ->method('createThread')
            ->will($this->returnValue(new PromiseRejected()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];
        $flags = 'flags';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(RejectionException::class));

        $manager
            ->createThreads($aliases, $flags)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiDestroyThreads_ResolvesPromise_WhenAllThreadsAreDestroyed()
    {
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager
            ->expects($this->twice())
            ->method('destroyThread')
            ->will($this->returnValue(new PromiseFulfilled()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];
        $flags = 'flags';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->destroyThreads($aliases, $flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiDestroyThreads_RejectsPromise_WhenAtLeastOneThreadCouldNotBeDestroyed()
    {
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager
            ->expects($this->twice())
            ->method('destroyThread')
            ->will($this->returnValue(new PromiseRejected()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];
        $flags = 'flags';

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(RejectionException::class));

        $manager
            ->destroyThreads($aliases, $flags)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiStartThreads_ResolvesPromise_WhenAllThreadsAreStarted()
    {
        $manager = $this->createThreadManager([ 'startThread' ]);
        $manager
            ->expects($this->twice())
            ->method('startThread')
            ->will($this->returnValue(new PromiseFulfilled()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->startThreads($aliases)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiStartThreads_RejectsPromise_WhenAtLeastOneThreadCouldNotBeStarted()
    {
        $manager = $this->createThreadManager([ 'startThread' ]);
        $manager
            ->expects($this->twice())
            ->method('startThread')
            ->will($this->returnValue(new PromiseRejected()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(RejectionException::class));

        $manager
            ->startThreads($aliases)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiStopThreads_ResolvesPromise_WhenAllThreadsAreStopped()
    {
        $manager = $this->createThreadManager([ 'stopThread' ]);
        $manager
            ->expects($this->twice())
            ->method('stopThread')
            ->will($this->returnValue(new PromiseFulfilled()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->stopThreads($aliases)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiStopThreads_RejectsPromise_WhenAtLeastOneThreadCouldNotBeStopped()
    {
        $manager = $this->createThreadManager([ 'stopThread' ]);
        $manager
            ->expects($this->twice())
            ->method('stopThread')
            ->will($this->returnValue(new PromiseRejected()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);
        $aliases = [ $alias1, $alias2 ];

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(RejectionException::class));

        $manager
            ->stopThreads($aliases)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiGetThreads_ReturnsFulfilledPromiseThatContainsListOfThreads()
    {
        $manager = $this->createThreadManager();
        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with([ $alias1, $alias2 ]);

        $manager
            ->getThreads()
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testApiFlushThreads_RejectsPromise_WhenFlagIsDestroyKeep()
    {
        $flags = Runtime::DESTROY_KEEP;
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager
            ->expects($this->never())
            ->method('destroyThread');

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isInstanceOf(RejectionException::class));

        $manager
            ->flushThreads($flags)
            ->then(
                null,
                $callable
            );
    }

    /**
     *
     */
    public function testApiFlushThreads_FlushesThreads_WhenFlagIsOtherThanDestroyKeep()
    {
        $flags = Runtime::DESTROY_FORCE;
        $manager = $this->createThreadManager([ 'destroyThread' ]);
        $manager
            ->expects($this->twice())
            ->method('destroyThread')
            ->with($this->isType('string'), $flags)
            ->will($this->returnValue(new PromiseFulfilled()));

        $manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass);
        $manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass);

        $callable = $this->createCallableMock();
        $callable
            ->expects($this->once())
            ->method('__invoke')
            ->with($this->isType('string'));

        $manager
            ->flushThreads($flags)
            ->then(
                $callable
            );
    }

    /**
     *
     */
    public function testProtectedApiAllocateThread_AllocatesThreadAndReturnsTrue()
    {
        $manager = $this->createThreadManager();
        $result  = $manager->allocateThread($alias = 'alias', $object = new StdClass);

        $this->assertTrue($result);
        $this->assertSame([ $alias=>$object ], $this->getProtectedProperty($manager, 'threads'));
    }

    /**
     *
     */
    public function testProtectedApiFreeThread_FreesThreadAndReturnsTrue()
    {
        $manager = $this->createThreadManager();
        $manager->allocateThread($alias = 'alias', $object = new StdClass);
        $result  = $manager->freeThread($alias = 'alias');

        $this->assertTrue($result);
        $this->assertSame([], $this->getProtectedProperty($manager, 'threads'));
    }

    /**
     *
     */
    public function testProtectedApiCreateRequest_CreatesRequest()
    {
        $runtime  = $this->getMock(RuntimeContainerInterface::class, [], [], '', false);
        $channel  = $this->getMock(ChannelInterface::class, [], [], '', false);
        $channel
            ->expects($this->any())
            ->method('createProtocol')
            ->will($this->returnCallback(function($message) {
                return new Protocol('', '', '', '', $message);
            }));
        $receiver = 'receiver';
        $command  = 'command';

        $manager = new ThreadManagerBase($runtime, $channel, $receiver);

        $req = $this->callProtectedMethod($manager, 'createRequest', [ $channel, $receiver, $command ]);

        $this->assertInstanceOf(Request::class, $req);
        $this->assertSame($channel,  $this->getProtectedProperty($req, 'channel'));
        $this->assertSame($receiver, $this->getProtectedProperty($req, 'name'));
        $this->assertSame($command,  $this->getProtectedProperty($req, 'message')->getMessage());
    }

    /**
     * @return RuntimeCommand
     */
    public function getCommand()
    {
        return $this->command;
    }

    /**
     * @param string[] $methods
     * @return ThreadManagerBase|\PHPUnit_Framework_MockObject_MockObject
     */
    public function createThreadManager($methods = [])
    {
        $runtime = $this->getMock(RuntimeContainerInterface::class, [], [], '', false);
        $channel = $this->getMock(ChannelInterface::class, [], [], '', false);

        $methods = array_merge($methods, [ 'createRequest' ]);
        $manager = $this->getMock(ThreadManagerBase::class, $methods, [ $runtime, $channel, [] ]);
        $manager
            ->expects($this->any())
            ->method('createRequest')
            ->will($this->returnCallback(function($channel, $receiver, $command) {
                $this->command = $command;

                $mock = $this->getMock(RuntimeCommand::class, [ 'call' ], [ $channel, $receiver, $command ]);
                $mock
                    ->expects($this->once())
                    ->method('call')
                    ->will($this->returnValue(new PromiseFulfilled()));

                return $mock;
            }));

        return $manager;
    }
}


text:
class Beer:
	def __init__(self, abv=None, ibu=None, name=None, desc=None):
		self.abv=self.sanitize(abv)
		self.ibu=self.sanitize(ibu)
		self.name=self.sanitize(name)
		self.desc=self.sanitize(desc)

	def sanitize(self, value):
		return value.encode('ascii','ignore').strip()


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using MusicApp.DAL;
using MusicApp.Models;

namespace MusicApp.Controllers
{
    public class ArtistsController : Controller
    {
        private MusicContext db = new MusicContext();

        // GET: Artists
        public ActionResult Index()
        {
            return View(db.Artists.ToList());
        }

        // GET: Artists/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Artist artist = db.Artists.Find(id);
            if (artist == null)
            {
                return HttpNotFound();
            }
            return View(artist);
        }

        // GET: Artists/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: Artists/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "ID,Href,Name,Popularity")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                db.Artists.Add(artist);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(artist);
        }

        // GET: Artists/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Artist artist = db.Artists.Find(id);
            if (artist == null)
            {
                return HttpNotFound();
            }
            return View(artist);
        }

        // POST: Artists/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "ID,Href,Name,Popularity")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                db.Entry(artist).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(artist);
        }

        // GET: Artists/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Artist artist = db.Artists.Find(id);
            if (artist == null)
            {
                return HttpNotFound();
            }
            return View(artist);
        }

        // POST: Artists/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            Artist artist = db.Artists.Find(id);
            db.Artists.Remove(artist);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


text:
#include "../../idlib/precompiled.h"
#pragma hdrstop

#include "../Game_local.h"

const idEventDef EV_Thread_Execute( "<execute>", NULL );
const idEventDef EV_Thread_SetCallback( "<script_setcallback>", NULL );

// script callable events
const idEventDef EV_Thread_TerminateThread( "terminate", "d" );
const idEventDef EV_Thread_Pause( "pause", NULL );
const idEventDef EV_Thread_Wait( "wait", "f" );
const idEventDef EV_Thread_WaitFrame( "waitFrame" );
const idEventDef EV_Thread_WaitFor( "waitFor", "e" );
const idEventDef EV_Thread_WaitForThread( "waitForThread", "d" );
const idEventDef EV_Thread_Print( "print", "s" );
const idEventDef EV_Thread_PrintLn( "println", "s" );
const idEventDef EV_Thread_Say( "say", "s" );
const idEventDef EV_Thread_Assert( "assert", "f" );
const idEventDef EV_Thread_Trigger( "trigger", "e" );
const idEventDef EV_Thread_SetCvar( "setcvar", "ss" );
const idEventDef EV_Thread_GetCvar( "getcvar", "s", 's' );
const idEventDef EV_Thread_Random( "random", "f", 'f' );
const idEventDef EV_Thread_GetTime( "getTime", NULL, 'f' );
const idEventDef EV_Thread_KillThread( "killthread", "s" );
const idEventDef EV_Thread_SetThreadName( "threadname", "s" );
const idEventDef EV_Thread_GetEntity( "getEntity", "s", 'e' );
const idEventDef EV_Thread_Spawn( "spawn", "s", 'e' );
const idEventDef EV_Thread_CopySpawnArgs( "copySpawnArgs", "e" );
const idEventDef EV_Thread_SetSpawnArg( "setSpawnArg", "ss" );
const idEventDef EV_Thread_SpawnString( "SpawnString", "ss", 's' );
const idEventDef EV_Thread_SpawnFloat( "SpawnFloat", "sf", 'f' );
const idEventDef EV_Thread_SpawnVector( "SpawnVector", "sv", 'v' );
const idEventDef EV_Thread_ClearPersistantArgs( "clearPersistantArgs" );
const idEventDef EV_Thread_SetPersistantArg( "setPersistantArg", "ss" );
const idEventDef EV_Thread_GetPersistantString( "getPersistantString", "s", 's' );
const idEventDef EV_Thread_GetPersistantFloat( "getPersistantFloat", "s", 'f' );
const idEventDef EV_Thread_GetPersistantVector( "getPersistantVector", "s", 'v' );
const idEventDef EV_Thread_AngToForward( "angToForward", "v", 'v' );
const idEventDef EV_Thread_AngToRight( "angToRight", "v", 'v' );
const idEventDef EV_Thread_AngToUp( "angToUp", "v", 'v' );
const idEventDef EV_Thread_Sine( "sin", "f", 'f' );
const idEventDef EV_Thread_Cosine( "cos", "f", 'f' );
const idEventDef EV_Thread_SquareRoot( "sqrt", "f", 'f' );
const idEventDef EV_Thread_Normalize( "vecNormalize", "v", 'v' );
const idEventDef EV_Thread_VecLength( "vecLength", "v", 'f' );
const idEventDef EV_Thread_VecDotProduct( "DotProduct", "vv", 'f' );
const idEventDef EV_Thread_VecCrossProduct( "CrossProduct", "vv", 'v' );
const idEventDef EV_Thread_VecToAngles( "VecToAngles", "v", 'v' );
const idEventDef EV_Thread_OnSignal( "onSignal", "des" );
const idEventDef EV_Thread_ClearSignal( "clearSignalThread", "de" );
const idEventDef EV_Thread_SetCamera( "setCamera", "e" );
const idEventDef EV_Thread_FirstPerson( "firstPerson", NULL );
const idEventDef EV_Thread_Trace( "trace", "vvvvde", 'f' );
const idEventDef EV_Thread_TracePoint( "tracePoint", "vvde", 'f' );
const idEventDef EV_Thread_GetTraceFraction( "getTraceFraction", NULL, 'f' );
const idEventDef EV_Thread_GetTraceEndPos( "getTraceEndPos", NULL, 'v' );
const idEventDef EV_Thread_GetTraceNormal( "getTraceNormal", NULL, 'v' );
const idEventDef EV_Thread_GetTraceEntity( "getTraceEntity", NULL, 'e' );
const idEventDef EV_Thread_GetTraceJoint( "getTraceJoint", NULL, 's' );
const idEventDef EV_Thread_GetTraceBody( "getTraceBody", NULL, 's' );
const idEventDef EV_Thread_FadeIn( "fadeIn", "vf" );
const idEventDef EV_Thread_FadeOut( "fadeOut", "vf" );
const idEventDef EV_Thread_FadeTo( "fadeTo", "vff" );
const idEventDef EV_Thread_StartMusic( "music", "s" );
const idEventDef EV_Thread_Error( "error", "s" );
const idEventDef EV_Thread_Warning( "warning", "s" );
const idEventDef EV_Thread_StrLen( "strLength", "s", 'd' );
const idEventDef EV_Thread_StrLeft( "strLeft", "sd", 's' );
const idEventDef EV_Thread_StrRight( "strRight", "sd", 's' );
const idEventDef EV_Thread_StrSkip( "strSkip", "sd", 's' );
const idEventDef EV_Thread_StrMid( "strMid", "sdd", 's' );
const idEventDef EV_Thread_StrToFloat( "strToFloat", "s", 'f' );
const idEventDef EV_Thread_RadiusDamage( "radiusDamage", "vEEEsf" );
const idEventDef EV_Thread_IsClient( "isClient", NULL, 'f' );
const idEventDef EV_Thread_IsMultiplayer( "isMultiplayer", NULL, 'f' );
const idEventDef EV_Thread_GetFrameTime( "getFrameTime", NULL, 'f' );
const idEventDef EV_Thread_GetTicsPerSecond( "getTicsPerSecond", NULL, 'f' );
const idEventDef EV_Thread_DebugLine( "debugLine", "vvvf" );
const idEventDef EV_Thread_DebugArrow( "debugArrow", "vvvdf" );
const idEventDef EV_Thread_DebugCircle( "debugCircle", "vvvfdf" );
const idEventDef EV_Thread_DebugBounds( "debugBounds", "vvvf" );
const idEventDef EV_Thread_DrawText( "drawText", "svfvdf" );
const idEventDef EV_Thread_InfluenceActive( "influenceActive", NULL, 'd' );

CLASS_DECLARATION( idClass, idThread )
	EVENT( EV_Thread_Execute,				idThread::Event_Execute )
	EVENT( EV_Thread_TerminateThread,		idThread::Event_TerminateThread )
	EVENT( EV_Thread_Pause,					idThread::Event_Pause )
	EVENT( EV_Thread_Wait,					idThread::Event_Wait )
	EVENT( EV_Thread_WaitFrame,				idThread::Event_WaitFrame )
	EVENT( EV_Thread_WaitFor,				idThread::Event_WaitFor )
	EVENT( EV_Thread_WaitForThread,			idThread::Event_WaitForThread )
	EVENT( EV_Thread_Print,					idThread::Event_Print )
	EVENT( EV_Thread_PrintLn,				idThread::Event_PrintLn )
	EVENT( EV_Thread_Say,					idThread::Event_Say )
	EVENT( EV_Thread_Assert,				idThread::Event_Assert )
	EVENT( EV_Thread_Trigger,				idThread::Event_Trigger )
	EVENT( EV_Thread_SetCvar,				idThread::Event_SetCvar )
	EVENT( EV_Thread_GetCvar,				idThread::Event_GetCvar )
	EVENT( EV_Thread_Random,				idThread::Event_Random )
	EVENT( EV_Thread_GetTime,				idThread::Event_GetTime )
	EVENT( EV_Thread_KillThread,			idThread::Event_KillThread )
	EVENT( EV_Thread_SetThreadName,			idThread::Event_SetThreadName )
	EVENT( EV_Thread_GetEntity,				idThread::Event_GetEntity )
	EVENT( EV_Thread_Spawn,					idThread::Event_Spawn )
	EVENT( EV_Thread_CopySpawnArgs,			idThread::Event_CopySpawnArgs )
	EVENT( EV_Thread_SetSpawnArg,			idThread::Event_SetSpawnArg )
	EVENT( EV_Thread_SpawnString,			idThread::Event_SpawnString )
	EVENT( EV_Thread_SpawnFloat,			idThread::Event_SpawnFloat )
	EVENT( EV_Thread_SpawnVector,			idThread::Event_SpawnVector )
	EVENT( EV_Thread_ClearPersistantArgs,	idThread::Event_ClearPersistantArgs )
	EVENT( EV_Thread_SetPersistantArg,		idThread::Event_SetPersistantArg )
	EVENT( EV_Thread_GetPersistantString,	idThread::Event_GetPersistantString )
	EVENT( EV_Thread_GetPersistantFloat,	idThread::Event_GetPersistantFloat )
	EVENT( EV_Thread_GetPersistantVector,	idThread::Event_GetPersistantVector )
	EVENT( EV_Thread_AngToForward,			idThread::Event_AngToForward )
	EVENT( EV_Thread_AngToRight,			idThread::Event_AngToRight )
	EVENT( EV_Thread_AngToUp,				idThread::Event_AngToUp )
	EVENT( EV_Thread_Sine,					idThread::Event_GetSine )
	EVENT( EV_Thread_Cosine,				idThread::Event_GetCosine )
	EVENT( EV_Thread_SquareRoot,			idThread::Event_GetSquareRoot )
	EVENT( EV_Thread_Normalize,				idThread::Event_VecNormalize )
	EVENT( EV_Thread_VecLength,				idThread::Event_VecLength )
	EVENT( EV_Thread_VecDotProduct,			idThread::Event_VecDotProduct )
	EVENT( EV_Thread_VecCrossProduct,		idThread::Event_VecCrossProduct )
	EVENT( EV_Thread_VecToAngles,			idThread::Event_VecToAngles )
	EVENT( EV_Thread_OnSignal,				idThread::Event_OnSignal )
	EVENT( EV_Thread_ClearSignal,			idThread::Event_ClearSignalThread )
	EVENT( EV_Thread_SetCamera,				idThread::Event_SetCamera )
	EVENT( EV_Thread_FirstPerson,			idThread::Event_FirstPerson )
	EVENT( EV_Thread_Trace,					idThread::Event_Trace )
	EVENT( EV_Thread_TracePoint,			idThread::Event_TracePoint )
	EVENT( EV_Thread_GetTraceFraction,		idThread::Event_GetTraceFraction )
	EVENT( EV_Thread_GetTraceEndPos,		idThread::Event_GetTraceEndPos )
	EVENT( EV_Thread_GetTraceNormal,		idThread::Event_GetTraceNormal )
	EVENT( EV_Thread_GetTraceEntity,		idThread::Event_GetTraceEntity )
	EVENT( EV_Thread_GetTraceJoint,			idThread::Event_GetTraceJoint )
	EVENT( EV_Thread_GetTraceBody,			idThread::Event_GetTraceBody )
	EVENT( EV_Thread_FadeIn,				idThread::Event_FadeIn )
	EVENT( EV_Thread_FadeOut,				idThread::Event_FadeOut )
	EVENT( EV_Thread_FadeTo,				idThread::Event_FadeTo )
	EVENT( EV_SetShaderParm,				idThread::Event_SetShaderParm )
	EVENT( EV_Thread_StartMusic,			idThread::Event_StartMusic )
	EVENT( EV_Thread_Warning,				idThread::Event_Warning )
	EVENT( EV_Thread_Error,					idThread::Event_Error )
	EVENT( EV_Thread_StrLen,				idThread::Event_StrLen )
	EVENT( EV_Thread_StrLeft,				idThread::Event_StrLeft )
	EVENT( EV_Thread_StrRight,				idThread::Event_StrRight )
	EVENT( EV_Thread_StrSkip,				idThread::Event_StrSkip )
	EVENT( EV_Thread_StrMid,				idThread::Event_StrMid )
	EVENT( EV_Thread_StrToFloat,			idThread::Event_StrToFloat )
	EVENT( EV_Thread_RadiusDamage,			idThread::Event_RadiusDamage )
	EVENT( EV_Thread_IsClient,				idThread::Event_IsClient )
	EVENT( EV_Thread_IsMultiplayer,			idThread::Event_IsMultiplayer )
	EVENT( EV_Thread_GetFrameTime,			idThread::Event_GetFrameTime )
	EVENT( EV_Thread_GetTicsPerSecond,		idThread::Event_GetTicsPerSecond )
	EVENT( EV_CacheSoundShader,				idThread::Event_CacheSoundShader )
	EVENT( EV_Thread_DebugLine,				idThread::Event_DebugLine )
	EVENT( EV_Thread_DebugArrow,			idThread::Event_DebugArrow )
	EVENT( EV_Thread_DebugCircle,			idThread::Event_DebugCircle )
	EVENT( EV_Thread_DebugBounds,			idThread::Event_DebugBounds )
	EVENT( EV_Thread_DrawText,				idThread::Event_DrawText )
	EVENT( EV_Thread_InfluenceActive,		idThread::Event_InfluenceActive )
END_CLASS

idThread			*idThread::currentThread = NULL;
int					idThread::threadIndex = 0;
idList<idThread *>	idThread::threadList;
trace_t				idThread::trace;

/*
================
idThread::CurrentThread
================
*/
idThread *idThread::CurrentThread( void ) {
	return currentThread;
}

/*
================
idThread::CurrentThreadNum
================
*/
int idThread::CurrentThreadNum( void ) {
	if ( currentThread ) {
		return currentThread->GetThreadNum();
	} else {
		return 0;
	}
}

/*
================
idThread::BeginMultiFrameEvent
================
*/
bool idThread::BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ) {
	if ( !currentThread ) {
		gameLocal.Error( "idThread::BeginMultiFrameEvent called without a current thread" );
	}
	return currentThread->interpreter.BeginMultiFrameEvent( ent, event );
}

/*
================
idThread::EndMultiFrameEvent
================
*/
void idThread::EndMultiFrameEvent( idEntity *ent, const idEventDef *event ) {
	if ( !currentThread ) {
		gameLocal.Error( "idThread::EndMultiFrameEvent called without a current thread" );
	}
	currentThread->interpreter.EndMultiFrameEvent( ent, event );
}

/*
================
idThread::idThread
================
*/
idThread::idThread() {
	Init();
	SetThreadName( va( "thread_%d", threadIndex ) );
	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: create thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
}

/*
================
idThread::idThread
================
*/
idThread::idThread( idEntity *self, const function_t *func ) {
	assert( self );

	Init();
	SetThreadName( self->name );
	interpreter.EnterObjectFunction( self, func, false );
	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: create thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
}

/*
================
idThread::idThread
================
*/
idThread::idThread( const function_t *func ) {
	assert( func );

	Init();
	SetThreadName( func->Name() );
	interpreter.EnterFunction( func, false );
	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: create thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
}

/*
================
idThread::idThread
================
*/
idThread::idThread( idInterpreter *source, const function_t *func, int args ) {
	Init();
	interpreter.ThreadCall( source, func, args );
	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: create thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
}

/*
================
idThread::idThread
================
*/
idThread::idThread( idInterpreter *source, idEntity *self, const function_t *func, int args ) {
	assert( self );

	Init();
	SetThreadName( self->name );
	interpreter.ThreadCall( source, func, args );
	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: create thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
}

/*
================
idThread::~idThread
================
*/
idThread::~idThread() {
	idThread	*thread;
	int			i;
	int			n;

	if ( g_debugScript.GetBool() ) {
		gameLocal.Printf( "%d: end thread (%d) '%s'\n", gameLocal.time, threadNum, threadName.c_str() );
	}
	threadList.Remove( this );
	n = threadList.Num();
	for( i = 0; i < n; i++ ) {
		thread = threadList[ i ];
		if ( thread->WaitingOnThread() == this ) {
			thread->ThreadCallback( this );
		}
	}

	if ( currentThread == this ) {
		currentThread = NULL;
	}
}

/*
================
idThread::ManualDelete
================
*/
void idThread::ManualDelete( void ) {
	interpreter.terminateOnExit = false;
}

/*
================
idThread::Save
================
*/
void idThread::Save( idSaveGame *savefile ) const {

	// We will check on restore that threadNum is still the same,
	//  threads should have been restored in the same order.
	savefile->WriteInt( threadNum );

	savefile->WriteObject( waitingForThread );
	savefile->WriteInt( waitingFor );
	savefile->WriteInt( waitingUntil );

	interpreter.Save( savefile );

	savefile->WriteDict( &spawnArgs );
	savefile->WriteString( threadName );

	savefile->WriteInt( lastExecuteTime );
	savefile->WriteInt( creationTime );

	savefile->WriteBool( manualControl );
}

/*
================
idThread::Restore
================
*/
void idThread::Restore( idRestoreGame *savefile ) {
	savefile->ReadInt( threadNum );

	savefile->ReadObject( reinterpret_cast<idClass *&>( waitingForThread ) );
	savefile->ReadInt( waitingFor );
	savefile->ReadInt( waitingUntil );

	interpreter.Restore( savefile );

	savefile->ReadDict( &spawnArgs );
	savefile->ReadString( threadName );

	savefile->ReadInt( lastExecuteTime );
	savefile->ReadInt( creationTime );

	savefile->ReadBool( manualControl );
}

/*
================
idThread::Init
================
*/
void idThread::Init( void ) {
	// create a unique threadNum
	do {
		threadIndex++;
		if ( threadIndex == 0 ) {
			threadIndex = 1;
		}
	} while( GetThread( threadIndex ) );

	threadNum = threadIndex;
	threadList.Append( this );

	creationTime = gameLocal.time;
	lastExecuteTime = 0;
	manualControl = false;

	ClearWaitFor();

	interpreter.SetThread( this );
}

/*
================
idThread::GetThread
================
*/
idThread *idThread::GetThread( int num ) {
	int			i;
	int			n;
	idThread	*thread;

	n = threadList.Num();
	for( i = 0; i < n; i++ ) {
		thread = threadList[ i ];
		if ( thread->GetThreadNum() == num ) {
			return thread;
		}
	}

	return NULL;
}

/*
================
idThread::DisplayInfo
================
*/
void idThread::DisplayInfo( void ) {
	gameLocal.Printf(
		"%12i: '%s'\n"
		"        File: %s(%d)\n"
		"     Created: %d (%d ms ago)\n"
		"      Status: ",
		threadNum, threadName.c_str(),
		interpreter.CurrentFile(), interpreter.CurrentLine(),
		creationTime, gameLocal.time - creationTime );

	if ( interpreter.threadDying ) {
		gameLocal.Printf( "Dying\n" );
	} else if ( interpreter.doneProcessing ) {
		gameLocal.Printf(
			"Paused since %d (%d ms)\n"
			"      Reason: ",  lastExecuteTime, gameLocal.time - lastExecuteTime );
		if ( waitingForThread ) {
			gameLocal.Printf( "Waiting for thread #%3i '%s'\n", waitingForThread->GetThreadNum(), waitingForThread->GetThreadName() );
		} else if ( ( waitingFor != ENTITYNUM_NONE ) && ( gameLocal.entities[ waitingFor ] ) ) {
			gameLocal.Printf( "Waiting for entity #%3i '%s'\n", waitingFor, gameLocal.entities[ waitingFor ]->name.c_str() );
		} else if ( waitingUntil ) {
			gameLocal.Printf( "Waiting until %d (%d ms total wait time)\n", waitingUntil, waitingUntil - lastExecuteTime );
		} else {
			gameLocal.Printf( "None\n" );
		}
	} else {
		gameLocal.Printf( "Processing\n" );
	}

	interpreter.DisplayInfo();

	gameLocal.Printf( "\n" );
}

/*
================
idThread::ListThreads_f
================
*/
void idThread::ListThreads_f( const idCmdArgs &args ) {
	int	i;
	int	n;

	n = threadList.Num();
	for( i = 0; i < n; i++ ) {
		//threadList[ i ]->DisplayInfo();
		gameLocal.Printf( "%3i: %-20s : %s(%d)\n", threadList[ i ]->threadNum, threadList[ i ]->threadName.c_str(), threadList[ i ]->interpreter.CurrentFile(), threadList[ i ]->interpreter.CurrentLine() );
	}
	gameLocal.Printf( "%d active threads\n\n", n );
}

/*
================
idThread::Restart
================
*/
void idThread::Restart( void ) {
	int	i;
	int	n;

	// reset the threadIndex
	threadIndex = 0;

	currentThread = NULL;
	n = threadList.Num();
	for( i = n - 1; i >= 0; i-- ) {
		delete threadList[ i ];
	}
	threadList.Clear();

	memset( &trace, 0, sizeof( trace ) );
	trace.c.entityNum = ENTITYNUM_NONE;
}

/*
================
idThread::DelayedStart
================
*/
void idThread::DelayedStart( int delay ) {
	CancelEvents( &EV_Thread_Execute );
	if ( gameLocal.time <= 0 ) {
		delay++;
	}
	PostEventMS( &EV_Thread_Execute, delay );
}

/*
================
idThread::Start
================
*/
bool idThread::Start( void ) {
	bool result;

	CancelEvents( &EV_Thread_Execute );
	result = Execute();

	return result;
}

/*
================
idThread::SetThreadName
================
*/
void idThread::SetThreadName( const char *name ) {
	threadName = name;
}

/*
================
idThread::ObjectMoveDone
================
*/
void idThread::ObjectMoveDone( int threadnum, idEntity *obj ) {
	idThread *thread;

	if ( !threadnum ) {
		return;
	}

	thread = GetThread( threadnum );
	if ( thread ) {
		thread->ObjectMoveDone( obj );
	}
}

/*
================
idThread::End
================
*/
void idThread::End( void ) {
	// Tell thread to die.  It will exit on its own.
	Pause();
	interpreter.threadDying	= true;
}

/*
================
idThread::KillThread
================
*/
void idThread::KillThread( const char *name ) {
	int			i;
	int			num;
	int			len;
	const char	*ptr;
	idThread	*thread;

	// see if the name uses a wild card
	ptr = strchr( name, '*' );
	if ( ptr ) {
		len = ptr - name;
	} else {
		len = strlen( name );
	}

	// kill only those threads whose name matches name
	num = threadList.Num();
	for( i = 0; i < num; i++ ) {
		thread = threadList[ i ];
		if ( !idStr::Cmpn( thread->GetThreadName(), name, len ) ) {
			thread->End();
		}
	}
}

/*
================
idThread::KillThread
================
*/
void idThread::KillThread( int num ) {
	idThread *thread;

	thread = GetThread( num );
	if ( thread ) {
		// Tell thread to die.  It will delete itself on it's own.
		thread->End();
	}
}

/*
================
idThread::Execute
================
*/
bool idThread::Execute( void ) {
	idThread	*oldThread;
	bool		done;

	if ( manualControl && ( waitingUntil > gameLocal.time ) ) {
		return false;
	}

	oldThread = currentThread;
	currentThread = this;

	lastExecuteTime = gameLocal.time;
	ClearWaitFor();
	done = interpreter.Execute();
	if ( done ) {
		End();
		if ( interpreter.terminateOnExit ) {
			PostEventMS( &EV_Remove, 0 );
		}
	} else if ( !manualControl ) {
		if ( waitingUntil > lastExecuteTime ) {
			PostEventMS( &EV_Thread_Execute, waitingUntil - lastExecuteTime );
		} else if ( interpreter.MultiFrameEventInProgress() ) {
			PostEventMS( &EV_Thread_Execute, gameLocal.msec );
		}
	}

	currentThread = oldThread;

	return done;
}

/*
================
idThread::IsWaiting

Checks if thread is still waiting for some event to occur.
================
*/
bool idThread::IsWaiting( void ) {
	if ( waitingForThread || ( waitingFor != ENTITYNUM_NONE ) ) {
		return true;
	}

	if ( waitingUntil && ( waitingUntil > gameLocal.time ) ) {
		return true;
	}

	return false;
}

/*
================
idThread::CallFunction

NOTE: If this is called from within a event called by this thread, the function arguments will be invalid after calling this function.
================
*/
void idThread::CallFunction( const function_t *func, bool clearStack ) {
	ClearWaitFor();
	interpreter.EnterFunction( func, clearStack );
}

/*
================
idThread::CallFunction

NOTE: If this is called from within a event called by this thread, the function arguments will be invalid after calling this function.
================
*/
void idThread::CallFunction( idEntity *self, const function_t *func, bool clearStack ) {
	assert( self );
	ClearWaitFor();
	interpreter.EnterObjectFunction( self, func, clearStack );
}

/*
================
idThread::ClearWaitFor
================
*/
void idThread::ClearWaitFor( void ) {
	waitingFor			= ENTITYNUM_NONE;
	waitingForThread	= NULL;
	waitingUntil		= 0;
}

/*
================
idThread::IsWaitingFor
================
*/
bool idThread::IsWaitingFor( idEntity *obj ) {
	assert( obj );
	return waitingFor == obj->entityNumber;
}

/*
================
idThread::ObjectMoveDone
================
*/
void idThread::ObjectMoveDone( idEntity *obj ) {
	assert( obj );

	if ( IsWaitingFor( obj ) ) {
		ClearWaitFor();
		DelayedStart( 0 );
	}
}

/*
================
idThread::ThreadCallback
================
*/
void idThread::ThreadCallback( idThread *thread ) {
	if ( interpreter.threadDying ) {
		return;
	}

	if ( thread == waitingForThread ) {
		ClearWaitFor();
		DelayedStart( 0 );
	}
}

/*
================
idThread::Event_SetThreadName
================
*/
void idThread::Event_SetThreadName( const char *name ) {
	SetThreadName( name );
}

/*
================
idThread::Error
================
*/
void idThread::Error( const char *fmt, ... ) const {
	va_list	argptr;
	char	text[ 1024 ];

	va_start( argptr, fmt );
	vsprintf( text, fmt, argptr );
	va_end( argptr );

	interpreter.Error( text );
}

/*
================
idThread::Warning
================
*/
void idThread::Warning( const char *fmt, ... ) const {
	va_list	argptr;
	char	text[ 1024 ];

	va_start( argptr, fmt );
	vsprintf( text, fmt, argptr );
	va_end( argptr );

	interpreter.Warning( text );
}

/*
================
idThread::ReturnString
================
*/
void idThread::ReturnString( const char *text ) {
	gameLocal.program.ReturnString( text );
}

/*
================
idThread::ReturnFloat
================
*/
void idThread::ReturnFloat( float value ) {
	gameLocal.program.ReturnFloat( value );
}

/*
================
idThread::ReturnInt
================
*/
void idThread::ReturnInt( int value ) {
	// true integers aren't supported in the compiler,
	// so int values are stored as floats
	gameLocal.program.ReturnFloat( value );
}

/*
================
idThread::ReturnVector
================
*/
void idThread::ReturnVector( idVec3 const &vec ) {
	gameLocal.program.ReturnVector( vec );
}

/*
================
idThread::ReturnEntity
================
*/
void idThread::ReturnEntity( idEntity *ent ) {
	gameLocal.program.ReturnEntity( ent );
}

/*
================
idThread::Event_Execute
================
*/
void idThread::Event_Execute( void ) {
	Execute();
}

/*
================
idThread::Pause
================
*/
void idThread::Pause( void ) {
	ClearWaitFor();
	interpreter.doneProcessing = true;
}

/*
================
idThread::WaitMS
================
*/
void idThread::WaitMS( int time ) {
	Pause();
	waitingUntil = gameLocal.time + time;
}

/*
================
idThread::WaitSec
================
*/
void idThread::WaitSec( float time ) {
	WaitMS( SEC2MS( time ) );
}

/*
================
idThread::WaitFrame
================
*/
void idThread::WaitFrame( void ) {
	Pause();

	// manual control threads don't set waitingUntil so that they can be run again
	// that frame if necessary.
	if ( !manualControl ) {
		waitingUntil = gameLocal.time + gameLocal.msec;
	}
}

/***********************************************************************

  Script callable events

***********************************************************************/

/*
================
idThread::Event_TerminateThread
================
*/
void idThread::Event_TerminateThread( int num ) {
	idThread *thread;

	thread = GetThread( num );
	KillThread( num );
}

/*
================
idThread::Event_Pause
================
*/
void idThread::Event_Pause( void ) {
	Pause();
}

/*
================
idThread::Event_Wait
================
*/
void idThread::Event_Wait( float time ) {
	WaitSec( time );
}

/*
================
idThread::Event_WaitFrame
================
*/
void idThread::Event_WaitFrame( void ) {
	WaitFrame();
}

/*
================
idThread::Event_WaitFor
================
*/
void idThread::Event_WaitFor( idEntity *ent ) {
	if ( ent && ent->RespondsTo( EV_Thread_SetCallback ) ) {
		ent->ProcessEvent( &EV_Thread_SetCallback );
		if ( gameLocal.program.GetReturnedInteger() ) {
			Pause();
			waitingFor = ent->entityNumber;
		}
	}
}

/*
================
idThread::Event_WaitForThread
================
*/
void idThread::Event_WaitForThread( int num ) {
	idThread *thread;

	thread = GetThread( num );
	if ( !thread ) {
		if ( g_debugScript.GetBool() ) {
			// just print a warning and continue executing
			Warning( "Thread %d not running", num );
		}
	} else {
		Pause();
		waitingForThread = thread;
	}
}

/*
================
idThread::Event_Print
================
*/
void idThread::Event_Print( const char *text ) {
	gameLocal.Printf( "%s", text );
}

/*
================
idThread::Event_PrintLn
================
*/
void idThread::Event_PrintLn( const char *text ) {
	gameLocal.Printf( "%s\n", text );
}

/*
================
idThread::Event_Say
================
*/
void idThread::Event_Say( const char *text ) {
	cmdSystem->BufferCommandText( CMD_EXEC_NOW, va( "say \"%s\"", text ) );
}

/*
================
idThread::Event_Assert
================
*/
void idThread::Event_Assert( float value ) {
	assert( value );
}

/*
================
idThread::Event_Trigger
================
*/
void idThread::Event_Trigger( idEntity *ent ) {
	if ( ent ) {
		ent->Signal( SIG_TRIGGER );
		ent->ProcessEvent( &EV_Activate, gameLocal.GetLocalPlayer() );
		ent->TriggerGuis();
	}
}

/*
================
idThread::Event_SetCvar
================
*/
void idThread::Event_SetCvar( const char *name, const char *value ) const {
	cvarSystem->SetCVarString( name, value );
}

/*
================
idThread::Event_GetCvar
================
*/
void idThread::Event_GetCvar( const char *name ) const {
	ReturnString( cvarSystem->GetCVarString( name ) );
}

/*
================
idThread::Event_Random
================
*/
void idThread::Event_Random( float range ) const {
	float result;

	result = gameLocal.random.RandomFloat();
	ReturnFloat( range * result );
}

/*
================
idThread::Event_GetTime
================
*/
void idThread::Event_GetTime( void ) {
	ReturnFloat( MS2SEC( gameLocal.realClientTime ) );
}

/*
================
idThread::Event_KillThread
================
*/
void idThread::Event_KillThread( const char *name ) {
	KillThread( name );
}

/*
================
idThread::Event_GetEntity
================
*/
void idThread::Event_GetEntity( const char *name ) {
	int			entnum;
	idEntity	*ent;

	assert( name );

	if ( name[ 0 ] == '*' ) {
		entnum = atoi( &name[ 1 ] );
		if ( ( entnum < 0 ) || ( entnum >= MAX_GENTITIES ) ) {
			Error( "Entity number in string out of range." );
		}
		ReturnEntity( gameLocal.entities[ entnum ] );
	} else {
		ent = gameLocal.FindEntity( name );
		ReturnEntity( ent );
	}
}

/*
================
idThread::Event_Spawn
================
*/
void idThread::Event_Spawn( const char *classname ) {
	idEntity *ent;

	spawnArgs.Set( "classname", classname );
	gameLocal.SpawnEntityDef( spawnArgs, &ent );
	ReturnEntity( ent );
	spawnArgs.Clear();
}

/*
================
idThread::Event_CopySpawnArgs
================
*/
void idThread::Event_CopySpawnArgs( idEntity *ent ) {
	spawnArgs.Copy( ent->spawnArgs );
}

/*
================
idThread::Event_SetSpawnArg
================
*/
void idThread::Event_SetSpawnArg( const char *key, const char *value ) {
	spawnArgs.Set( key, value );
}

/*
================
idThread::Event_SpawnString
================
*/
void idThread::Event_SpawnString( const char *key, const char *defaultvalue ) {
	const char *result;

	spawnArgs.GetString( key, defaultvalue, &result );
	ReturnString( result );
}

/*
================
idThread::Event_SpawnFloat
================
*/
void idThread::Event_SpawnFloat( const char *key, float defaultvalue ) {
	float result;

	spawnArgs.GetFloat( key, va( "%f", defaultvalue ), result );
	ReturnFloat( result );
}

/*
================
idThread::Event_SpawnVector
================
*/
void idThread::Event_SpawnVector( const char *key, idVec3 &defaultvalue ) {
	idVec3 result;

	spawnArgs.GetVector( key, va( "%f %f %f", defaultvalue.x, defaultvalue.y, defaultvalue.z ), result );
	ReturnVector( result );
}

/*
================
idThread::Event_ClearPersistantArgs
================
*/
void idThread::Event_ClearPersistantArgs( void ) {
	gameLocal.persistentLevelInfo.Clear();
}

/*
================
idThread::Event_SetPersistantArg
================
*/
void idThread::Event_SetPersistantArg( const char *key, const char *value ) {
	gameLocal.persistentLevelInfo.Set( key, value );
}

/*
================
idThread::Event_GetPersistantString
================
*/
void idThread::Event_GetPersistantString( const char *key ) {
	const char *result;

	gameLocal.persistentLevelInfo.GetString( key, "", &result );
	ReturnString( result );
}

/*
================
idThread::Event_GetPersistantFloat
================
*/
void idThread::Event_GetPersistantFloat( const char *key ) {
	float result;

	gameLocal.persistentLevelInfo.GetFloat( key, "0", result );
	ReturnFloat( result );
}

/*
================
idThread::Event_GetPersistantVector
================
*/
void idThread::Event_GetPersistantVector( const char *key ) {
	idVec3 result;

	gameLocal.persistentLevelInfo.GetVector( key, "0 0 0", result );
	ReturnVector( result );
}

/*
================
idThread::Event_AngToForward
================
*/
void idThread::Event_AngToForward( idAngles &ang ) {
	ReturnVector( ang.ToForward() );
}

/*
================
idThread::Event_AngToRight
================
*/
void idThread::Event_AngToRight( idAngles &ang ) {
	idVec3 vec;

	ang.ToVectors( NULL, &vec );
	ReturnVector( vec );
}

/*
================
idThread::Event_AngToUp
================
*/
void idThread::Event_AngToUp( idAngles &ang ) {
	idVec3 vec;

	ang.ToVectors( NULL, NULL, &vec );
	ReturnVector( vec );
}

/*
================
idThread::Event_GetSine
================
*/
void idThread::Event_GetSine( float angle ) {
	ReturnFloat( idMath::Sin( DEG2RAD( angle ) ) );
}

/*
================
idThread::Event_GetCosine
================
*/
void idThread::Event_GetCosine( float angle ) {
	ReturnFloat( idMath::Cos( DEG2RAD( angle ) ) );
}

/*
================
idThread::Event_GetSquareRoot
================
*/
void idThread::Event_GetSquareRoot( float theSquare ) {
	ReturnFloat( idMath::Sqrt( theSquare ) );
}

/*
================
idThread::Event_VecNormalize
================
*/
void idThread::Event_VecNormalize( idVec3 &vec ) {
	idVec3 n;

	n = vec;
	n.Normalize();
	ReturnVector( n );
}

/*
================
idThread::Event_VecLength
================
*/
void idThread::Event_VecLength( idVec3 &vec ) {
	ReturnFloat( vec.Length() );
}

/*
================
idThread::Event_VecDotProduct
================
*/
void idThread::Event_VecDotProduct( idVec3 &vec1, idVec3 &vec2 ) {
	ReturnFloat( vec1 * vec2 );
}

/*
================
idThread::Event_VecCrossProduct
================
*/
void idThread::Event_VecCrossProduct( idVec3 &vec1, idVec3 &vec2 ) {
	ReturnVector( vec1.Cross( vec2 ) );
}

/*
================
idThread::Event_VecToAngles
================
*/
void idThread::Event_VecToAngles( idVec3 &vec ) {
	idAngles ang = vec.ToAngles();
	ReturnVector( idVec3( ang[0], ang[1], ang[2] ) );
}

/*
================
idThread::Event_OnSignal
================
*/
void idThread::Event_OnSignal( int signal, idEntity *ent, const char *func ) {
	const function_t *function;

	assert( func );

	if ( !ent ) {
		Error( "Entity not found" );
	}

	if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) {
		Error( "Signal out of range" );
	}

	function = gameLocal.program.FindFunction( func );
	if ( !function ) {
		Error( "Function '%s' not found", func );
	}

	ent->SetSignal( ( signalNum_t )signal, this, function );
}

/*
================
idThread::Event_ClearSignalThread
================
*/
void idThread::Event_ClearSignalThread( int signal, idEntity *ent ) {
	if ( !ent ) {
		Error( "Entity not found" );
	}

	if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) {
		Error( "Signal out of range" );
	}

	ent->ClearSignalThread( ( signalNum_t )signal, this );
}

/*
================
idThread::Event_SetCamera
================
*/
void idThread::Event_SetCamera( idEntity *ent ) {
	if ( !ent ) {
		Error( "Entity not found" );
		return;
	}

	if ( !ent->IsType( idCamera::Type ) ) {
		Error( "Entity is not a camera" );
		return;
	}

	gameLocal.SetCamera( ( idCamera * )ent );
}

/*
================
idThread::Event_FirstPerson
================
*/
void idThread::Event_FirstPerson( void ) {
	gameLocal.SetCamera( NULL );
}

/*
================
idThread::Event_Trace
================
*/
void idThread::Event_Trace( const idVec3 &start, const idVec3 &end, const idVec3 &mins, const idVec3 &maxs, int contents_mask, idEntity *passEntity ) {
	if ( mins == vec3_origin && maxs == vec3_origin ) {
		gameLocal.clip.TracePoint( trace, start, end, contents_mask, passEntity );
	} else {
		gameLocal.clip.TraceBounds( trace, start, end, idBounds( mins, maxs ), contents_mask, passEntity );
	}
	ReturnFloat( trace.fraction );
}

/*
================
idThread::Event_TracePoint
================
*/
void idThread::Event_TracePoint( const idVec3 &start, const idVec3 &end, int contents_mask, idEntity *passEntity ) {
	gameLocal.clip.TracePoint( trace, start, end, contents_mask, passEntity );
	ReturnFloat( trace.fraction );
}

/*
================
idThread::Event_GetTraceFraction
================
*/
void idThread::Event_GetTraceFraction( void ) {
	ReturnFloat( trace.fraction );
}

/*
================
idThread::Event_GetTraceEndPos
================
*/
void idThread::Event_GetTraceEndPos( void ) {
	ReturnVector( trace.endpos );
}

/*
================
idThread::Event_GetTraceNormal
================
*/
void idThread::Event_GetTraceNormal( void ) {
	if ( trace.fraction < 1.0f ) {
		ReturnVector( trace.c.normal );
	} else {
		ReturnVector( vec3_origin );
	}
}

/*
================
idThread::Event_GetTraceEntity
================
*/
void idThread::Event_GetTraceEntity( void ) {
	if ( trace.fraction < 1.0f ) {
		ReturnEntity( gameLocal.entities[ trace.c.entityNum ] );
	} else {
		ReturnEntity( ( idEntity * )NULL );
	}
}

/*
================
idThread::Event_GetTraceJoint
================
*/
void idThread::Event_GetTraceJoint( void ) {
	if ( trace.fraction < 1.0f && trace.c.id < 0 ) {
		idAFEntity_Base *af = static_cast<idAFEntity_Base *>( gameLocal.entities[ trace.c.entityNum ] );
		if ( af && af->IsType( idAFEntity_Base::Type ) && af->IsActiveAF() ) {
			ReturnString( af->GetAnimator()->GetJointName( CLIPMODEL_ID_TO_JOINT_HANDLE( trace.c.id ) ) );
			return;
		}
	}
	ReturnString( "" );
}

/*
================
idThread::Event_GetTraceBody
================
*/
void idThread::Event_GetTraceBody( void ) {
	if ( trace.fraction < 1.0f && trace.c.id < 0 ) {
		idAFEntity_Base *af = static_cast<idAFEntity_Base *>( gameLocal.entities[ trace.c.entityNum ] );
		if ( af && af->IsType( idAFEntity_Base::Type ) && af->IsActiveAF() ) {
			int bodyId = af->BodyForClipModelId( trace.c.id );
			idAFBody *body = af->GetAFPhysics()->GetBody( bodyId );
			if ( body ) {
				ReturnString( body->GetName() );
				return;
			}
		}
	}
	ReturnString( "" );
}

/*
================
idThread::Event_FadeIn
================
*/
void idThread::Event_FadeIn( idVec3 &color, float time ) {
	idVec4		fadeColor;
	idPlayer	*player;

	player = gameLocal.GetLocalPlayer();
	if ( player ) {
		fadeColor.Set( color[ 0 ], color[ 1 ], color[ 2 ], 0.0f );
		player->playerView.Fade(fadeColor, SEC2MS( time ) );
	}
}

/*
================
idThread::Event_FadeOut
================
*/
void idThread::Event_FadeOut( idVec3 &color, float time ) {
	idVec4		fadeColor;
	idPlayer	*player;

	player = gameLocal.GetLocalPlayer();
	if ( player ) {
		fadeColor.Set( color[ 0 ], color[ 1 ], color[ 2 ], 1.0f );
		player->playerView.Fade(fadeColor, SEC2MS( time ) );
	}
}

/*
================
idThread::Event_FadeTo
================
*/
void idThread::Event_FadeTo( idVec3 &color, float alpha, float time ) {
	idVec4		fadeColor;
	idPlayer	*player;

	player = gameLocal.GetLocalPlayer();
	if ( player ) {
		fadeColor.Set( color[ 0 ], color[ 1 ], color[ 2 ], alpha );
		player->playerView.Fade(fadeColor, SEC2MS( time ) );
	}
}

/*
================
idThread::Event_SetShaderParm
================
*/
void idThread::Event_SetShaderParm( int parmnum, float value ) {
	if ( ( parmnum < 0 ) || ( parmnum >= MAX_GLOBAL_SHADER_PARMS ) ) {
		Error( "shader parm index (%d) out of range", parmnum );
	}

	gameLocal.globalShaderParms[ parmnum ] = value;
}

/*
================
idThread::Event_StartMusic
================
*/
void idThread::Event_StartMusic( const char *text ) {
	gameSoundWorld->PlayShaderDirectly( text );
}

/*
================
idThread::Event_Warning
================
*/
void idThread::Event_Warning( const char *text ) {
	Warning( "%s", text );
}

/*
================
idThread::Event_Error
================
*/
void idThread::Event_Error( const char *text ) {
	Error( "%s", text );
}

/*
================
idThread::Event_StrLen
================
*/
void idThread::Event_StrLen( const char *string ) {
	int len;

	len = strlen( string );
	idThread::ReturnInt( len );
}

/*
================
idThread::Event_StrLeft
================
*/
void idThread::Event_StrLeft( const char *string, int num ) {
	int len;

	if ( num < 0 ) {
		idThread::ReturnString( "" );
		return;
	}

	len = strlen( string );
	if ( len < num ) {
		idThread::ReturnString( string );
		return;
	}

	idStr result( string, 0, num );
	idThread::ReturnString( result );
}

/*
================
idThread::Event_StrRight
================
*/
void idThread::Event_StrRight( const char *string, int num ) {
	int len;

	if ( num < 0 ) {
		idThread::ReturnString( "" );
		return;
	}

	len = strlen( string );
	if ( len < num ) {
		idThread::ReturnString( string );
		return;
	}

	idThread::ReturnString( string + len - num );
}

/*
================
idThread::Event_StrSkip
================
*/
void idThread::Event_StrSkip( const char *string, int num ) {
	int len;

	if ( num < 0 ) {
		idThread::ReturnString( string );
		return;
	}

	len = strlen( string );
	if ( len < num ) {
		idThread::ReturnString( "" );
		return;
	}

	idThread::ReturnString( string + num );
}

/*
================
idThread::Event_StrMid
================
*/
void idThread::Event_StrMid( const char *string, int start, int num ) {
	int len;

	if ( num < 0 ) {
		idThread::ReturnString( "" );
		return;
	}

	if ( start < 0 ) {
		start = 0;
	}
	len = strlen( string );
	if ( start > len ) {
		start = len;
	}

	if ( start + num > len ) {
		num = len - start;
	}

	idStr result( string, start, start + num );
	idThread::ReturnString( result );
}

/*
================
idThread::Event_StrToFloat( const char *string )
================
*/
void idThread::Event_StrToFloat( const char *string ) {
	float result;

	result = atof( string );
	idThread::ReturnFloat( result );
}

/*
================
idThread::Event_RadiusDamage
================
*/
void idThread::Event_RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignore, const char *damageDefName, float dmgPower ) {
	gameLocal.RadiusDamage( origin, inflictor, attacker, ignore, ignore, damageDefName, dmgPower );
}

/*
================
idThread::Event_IsClient
================
*/
void idThread::Event_IsClient( void ) {
	idThread::ReturnFloat( gameLocal.isClient );
}

/*
================
idThread::Event_IsMultiplayer
================
*/
void idThread::Event_IsMultiplayer( void ) {
	idThread::ReturnFloat( gameLocal.isMultiplayer );
}

/*
================
idThread::Event_GetFrameTime
================
*/
void idThread::Event_GetFrameTime( void ) {
	idThread::ReturnFloat( MS2SEC( gameLocal.msec ) );
}

/*
================
idThread::Event_GetTicsPerSecond
================
*/
void idThread::Event_GetTicsPerSecond( void ) {
	idThread::ReturnFloat( USERCMD_HZ );
}

/*
================
idThread::Event_CacheSoundShader
================
*/
void idThread::Event_CacheSoundShader( const char *soundName ) {
	declManager->FindSound( soundName );
}

/*
================
idThread::Event_DebugLine
================
*/
void idThread::Event_DebugLine( const idVec3 &color, const idVec3 &start, const idVec3 &end, const float lifetime ) {
	gameRenderWorld->DebugLine( idVec4( color.x, color.y, color.z, 0.0f ), start, end, SEC2MS( lifetime ) );
}

/*
================
idThread::Event_DebugArrow
================
*/
void idThread::Event_DebugArrow( const idVec3 &color, const idVec3 &start, const idVec3 &end, const int size, const float lifetime ) {
	gameRenderWorld->DebugArrow( idVec4( color.x, color.y, color.z, 0.0f ), start, end, size, SEC2MS( lifetime ) );
}

/*
================
idThread::Event_DebugCircle
================
*/
void idThread::Event_DebugCircle( const idVec3 &color, const idVec3 &origin, const idVec3 &dir, const float radius, const int numSteps, const float lifetime ) {
	gameRenderWorld->DebugCircle( idVec4( color.x, color.y, color.z, 0.0f ), origin, dir, radius, numSteps, SEC2MS( lifetime ) );
}

/*
================
idThread::Event_DebugBounds
================
*/
void idThread::Event_DebugBounds( const idVec3 &color, const idVec3 &mins, const idVec3 &maxs, const float lifetime ) {
	gameRenderWorld->DebugBounds( idVec4( color.x, color.y, color.z, 0.0f ), idBounds( mins, maxs ), vec3_origin, SEC2MS( lifetime ) );
}

/*
================
idThread::Event_DrawText
================
*/
void idThread::Event_DrawText( const char *text, const idVec3 &origin, float scale, const idVec3 &color, const int align, const float lifetime ) {
	gameRenderWorld->DrawText( text, origin, scale, idVec4( color.x, color.y, color.z, 0.0f ), gameLocal.GetLocalPlayer()->viewAngles.ToMat3(), align, SEC2MS( lifetime ) );
}

/*
================
idThread::Event_InfluenceActive
================
*/
void idThread::Event_InfluenceActive( void ) {
	idPlayer *player;

	player = gameLocal.GetLocalPlayer();
	if ( player && player->GetInfluenceLevel() ) {
		idThread::ReturnInt( true );
	} else {
		idThread::ReturnInt( false );
	}
}


text:
import dotProp from 'dot-prop-immutable';

import albumInstanceSchema from '~shared/data/schemas/album/albumInstanceSchema';

const localFileSchema = { type: 'string', minLength: 1 };

const tempShareCandidateSchema = dotProp.set(
  albumInstanceSchema,
  'properties.cover.properties.image',
  localFileSchema,
);

const shareCandidateSchema = dotProp.set(
  tempShareCandidateSchema,
  'properties.tracks.items.properties.audio',
  localFileSchema,
);

export default shareCandidateSchema;


text:
class MixedSettings;
class QSettings;

class Settings : public QObject
{
	Q_OBJECT

	public:
		explicit Settings(QSettings *settings, QObject *parent = nullptr);
		explicit Settings(MixedSettings *settings, QObject *parent = nullptr);

		Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = {}) const;
		Q_INVOKABLE void setValue(const QString &key, const QJSValue &value, const QVariant &defaultValue = {});
		Q_INVOKABLE void remove(const QString &key);
		Q_INVOKABLE QStringList childKeys(const QString &parent = {});

	private:
		MixedSettings *m_settings;
};

#endif // SETTINGS_H