text:
<?php

final class PhabricatorAuditTransaction
  extends PhabricatorModularTransaction {

  const TYPE_COMMIT = 'audit:commit';

  const MAILTAG_ACTION_CONCERN = 'audit-action-concern';
  const MAILTAG_ACTION_ACCEPT  = 'audit-action-accept';
  const MAILTAG_ACTION_RESIGN  = 'audit-action-resign';
  const MAILTAG_ACTION_CLOSE   = 'audit-action-close';
  const MAILTAG_ADD_AUDITORS   = 'audit-add-auditors';
  const MAILTAG_ADD_CCS        = 'audit-add-ccs';
  const MAILTAG_COMMENT        = 'audit-comment';
  const MAILTAG_COMMIT         = 'audit-commit';
  const MAILTAG_PROJECTS       = 'audit-projects';
  const MAILTAG_OTHER          = 'audit-other';

  public function getApplicationName() {
    return 'audit';
  }

  public function getBaseTransactionClass() {
    return 'DiffusionCommitTransactionType';
  }

  public function getApplicationTransactionType() {
    return PhabricatorRepositoryCommitPHIDType::TYPECONST;
  }

  public function getApplicationTransactionCommentObject() {
    return new PhabricatorAuditTransactionComment();
  }

  public function getApplicationTransactionViewObject() {
    return new PhabricatorAuditTransactionView();
  }

  public function getRemarkupBlocks() {
    $blocks = parent::getRemarkupBlocks();

    switch ($this->getTransactionType()) {
    case self::TYPE_COMMIT:
      $data = $this->getNewValue();
      $blocks[] = $data['description'];
      break;
    }

    return $blocks;
  }

  public function getActionStrength() {
    $type = $this->getTransactionType();

    switch ($type) {
      case self::TYPE_COMMIT:
        return 3.0;
    }

    return parent::getActionStrength();
  }

  public function getRequiredHandlePHIDs() {
    $phids = parent::getRequiredHandlePHIDs();

    $type = $this->getTransactionType();

    switch ($type) {
      case self::TYPE_COMMIT:
        $phids[] = $this->getObjectPHID();
        $data = $this->getNewValue();
        if ($data['authorPHID']) {
          $phids[] = $data['authorPHID'];
        }
        if ($data['committerPHID']) {
          $phids[] = $data['committerPHID'];
        }
        break;
      case PhabricatorAuditActionConstants::ADD_CCS:
      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        $old = $this->getOldValue();
        $new = $this->getNewValue();

        if (!is_array($old)) {
          $old = array();
        }
        if (!is_array($new)) {
          $new = array();
        }

        foreach (array_keys($old + $new) as $phid) {
          $phids[] = $phid;
        }
        break;
    }

    return $phids;
  }

  public function getActionName() {

    switch ($this->getTransactionType()) {
      case PhabricatorAuditActionConstants::ACTION:
        switch ($this->getNewValue()) {
          case PhabricatorAuditActionConstants::CONCERN:
            return pht('Raised Concern');
          case PhabricatorAuditActionConstants::ACCEPT:
            return pht('Accepted');
          case PhabricatorAuditActionConstants::RESIGN:
            return pht('Resigned');
          case PhabricatorAuditActionConstants::CLOSE:
            return pht('Closed');
        }
        break;
      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        return pht('Added Auditors');
      case self::TYPE_COMMIT:
        return pht('Committed');
    }

    return parent::getActionName();
  }

  public function getColor() {

    $type = $this->getTransactionType();

    switch ($type) {
      case PhabricatorAuditActionConstants::ACTION:
        switch ($this->getNewValue()) {
          case PhabricatorAuditActionConstants::CONCERN:
            return 'red';
          case PhabricatorAuditActionConstants::ACCEPT:
            return 'green';
          case PhabricatorAuditActionConstants::RESIGN:
            return 'black';
          case PhabricatorAuditActionConstants::CLOSE:
            return 'indigo';
        }
    }

    return parent::getColor();
  }

  public function getIcon() {

    $type = $this->getTransactionType();

    switch ($type) {
      case PhabricatorAuditActionConstants::ACTION:
        switch ($this->getNewValue()) {
          case PhabricatorAuditActionConstants::CONCERN:
            return 'fa-exclamation-circle';
          case PhabricatorAuditActionConstants::ACCEPT:
            return 'fa-check';
          case PhabricatorAuditActionConstants::RESIGN:
            return 'fa-plane';
          case PhabricatorAuditActionConstants::CLOSE:
            return 'fa-check';
        }
    }

    return parent::getIcon();
  }

  public function getTitle() {
    $old = $this->getOldValue();
    $new = $this->getNewValue();

    $author_handle = $this->renderHandleLink($this->getAuthorPHID());

    $type = $this->getTransactionType();

    switch ($type) {
      case PhabricatorAuditActionConstants::ADD_CCS:
      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        if (!is_array($old)) {
          $old = array();
        }
        if (!is_array($new)) {
          $new = array();
        }
        $add = array_keys(array_diff_key($new, $old));
        $rem = array_keys(array_diff_key($old, $new));
        break;
    }

    switch ($type) {
      case self::TYPE_COMMIT:
        $author = null;
        if ($new['authorPHID']) {
          $author = $this->renderHandleLink($new['authorPHID']);
        } else {
          $author = $new['authorName'];
        }

        $committer = null;
        if ($new['committerPHID']) {
          $committer = $this->renderHandleLink($new['committerPHID']);
        } else if ($new['committerName']) {
          $committer = $new['committerName'];
        }

        $commit = $this->renderHandleLink($this->getObjectPHID());

        if (!$committer) {
          $committer = $author;
          $author = null;
        }

        if ($author) {
          $title = pht(
            '%s committed %s (authored by %s).',
            $committer,
            $commit,
            $author);
        } else {
          $title = pht(
            '%s committed %s.',
            $committer,
            $commit);
        }
        return $title;

      case PhabricatorAuditActionConstants::INLINE:
        return pht(
          '%s added inline comments.',
          $author_handle);

      case PhabricatorAuditActionConstants::ADD_CCS:
        if ($add && $rem) {
          return pht(
            '%s edited subscribers; added: %s, removed: %s.',
            $author_handle,
            $this->renderHandleList($add),
            $this->renderHandleList($rem));
        } else if ($add) {
          return pht(
            '%s added subscribers: %s.',
            $author_handle,
            $this->renderHandleList($add));
        } else if ($rem) {
          return pht(
            '%s removed subscribers: %s.',
            $author_handle,
            $this->renderHandleList($rem));
        } else {
          return pht(
            '%s added subscribers...',
            $author_handle);
        }

      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        if ($add && $rem) {
          return pht(
            '%s edited auditors; added: %s, removed: %s.',
            $author_handle,
            $this->renderHandleList($add),
            $this->renderHandleList($rem));
        } else if ($add) {
          return pht(
            '%s added auditors: %s.',
            $author_handle,
            $this->renderHandleList($add));
        } else if ($rem) {
          return pht(
            '%s removed auditors: %s.',
            $author_handle,
            $this->renderHandleList($rem));
        } else {
          return pht(
            '%s added auditors...',
            $author_handle);
        }

      case PhabricatorAuditActionConstants::ACTION:
        switch ($new) {
          case PhabricatorAuditActionConstants::ACCEPT:
            return pht(
              '%s accepted this commit.',
              $author_handle);
          case PhabricatorAuditActionConstants::CONCERN:
            return pht(
              '%s raised a concern with this commit.',
              $author_handle);
          case PhabricatorAuditActionConstants::RESIGN:
            return pht(
              '%s resigned from this audit.',
              $author_handle);
          case PhabricatorAuditActionConstants::CLOSE:
            return pht(
              '%s closed this audit.',
              $author_handle);
        }

    }

    return parent::getTitle();
  }

  public function getTitleForFeed() {
    $old = $this->getOldValue();
    $new = $this->getNewValue();

    $author_handle = $this->renderHandleLink($this->getAuthorPHID());
    $object_handle = $this->renderHandleLink($this->getObjectPHID());

    $type = $this->getTransactionType();

    switch ($type) {
      case PhabricatorAuditActionConstants::ADD_CCS:
      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        if (!is_array($old)) {
          $old = array();
        }
        if (!is_array($new)) {
          $new = array();
        }
        $add = array_keys(array_diff_key($new, $old));
        $rem = array_keys(array_diff_key($old, $new));
        break;
    }

    switch ($type) {
      case self::TYPE_COMMIT:
        $author = null;
        if ($new['authorPHID']) {
          $author = $this->renderHandleLink($new['authorPHID']);
        } else {
          $author = $new['authorName'];
        }

        $committer = null;
        if ($new['committerPHID']) {
          $committer = $this->renderHandleLink($new['committerPHID']);
        } else if ($new['committerName']) {
          $committer = $new['committerName'];
        }

        if (!$committer) {
          $committer = $author;
          $author = null;
        }

        if ($author) {
          $title = pht(
            '%s committed %s (authored by %s).',
            $committer,
            $object_handle,
            $author);
        } else {
          $title = pht(
            '%s committed %s.',
            $committer,
            $object_handle);
        }
        return $title;

      case PhabricatorAuditActionConstants::INLINE:
        return pht(
          '%s added inline comments to %s.',
          $author_handle,
          $object_handle);

      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        if ($add && $rem) {
          return pht(
            '%s edited auditors for %s; added: %s, removed: %s.',
            $author_handle,
            $object_handle,
            $this->renderHandleList($add),
            $this->renderHandleList($rem));
        } else if ($add) {
          return pht(
            '%s added auditors to %s: %s.',
            $author_handle,
            $object_handle,
            $this->renderHandleList($add));
        } else if ($rem) {
          return pht(
            '%s removed auditors from %s: %s.',
            $author_handle,
            $object_handle,
            $this->renderHandleList($rem));
        } else {
          return pht(
            '%s added auditors to %s...',
            $author_handle,
            $object_handle);
        }

      case PhabricatorAuditActionConstants::ACTION:
        switch ($new) {
          case PhabricatorAuditActionConstants::ACCEPT:
            return pht(
              '%s accepted %s.',
              $author_handle,
              $object_handle);
          case PhabricatorAuditActionConstants::CONCERN:
            return pht(
              '%s raised a concern with %s.',
              $author_handle,
              $object_handle);
          case PhabricatorAuditActionConstants::RESIGN:
            return pht(
              '%s resigned from auditing %s.',
              $author_handle,
              $object_handle);
          case PhabricatorAuditActionConstants::CLOSE:
            return pht(
              '%s closed the audit of %s.',
              $author_handle,
              $object_handle);
        }

    }

    return parent::getTitleForFeed();
  }

  public function getBodyForFeed(PhabricatorFeedStory $story) {
    switch ($this->getTransactionType()) {
      case self::TYPE_COMMIT:
        $data = $this->getNewValue();
        return $story->renderSummary($data['summary']);
    }
    return parent::getBodyForFeed($story);
  }

  public function isInlineCommentTransaction() {
    switch ($this->getTransactionType()) {
      case PhabricatorAuditActionConstants::INLINE:
        return true;
    }

    return parent::isInlineCommentTransaction();
  }

  public function getBodyForMail() {
    switch ($this->getTransactionType()) {
      case self::TYPE_COMMIT:
        $data = $this->getNewValue();
        return $data['description'];
    }

    return parent::getBodyForMail();
  }

  public function getMailTags() {
    $tags = array();
    switch ($this->getTransactionType()) {
      case DiffusionCommitAcceptTransaction::TRANSACTIONTYPE:
        $tags[] = self::MAILTAG_ACTION_ACCEPT;
        break;
      case DiffusionCommitConcernTransaction::TRANSACTIONTYPE:
        $tags[] = self::MAILTAG_ACTION_CONCERN;
        break;
      case DiffusionCommitResignTransaction::TRANSACTIONTYPE:
        $tags[] = self::MAILTAG_ACTION_RESIGN;
        break;
      case DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE:
        $tags[] = self::MAILTAG_ADD_AUDITORS;
        break;
      case PhabricatorAuditActionConstants::ACTION:
        switch ($this->getNewValue()) {
          case PhabricatorAuditActionConstants::CONCERN:
            $tags[] = self::MAILTAG_ACTION_CONCERN;
            break;
          case PhabricatorAuditActionConstants::ACCEPT:
            $tags[] = self::MAILTAG_ACTION_ACCEPT;
            break;
          case PhabricatorAuditActionConstants::RESIGN:
            $tags[] = self::MAILTAG_ACTION_RESIGN;
            break;
          case PhabricatorAuditActionConstants::CLOSE:
            $tags[] = self::MAILTAG_ACTION_CLOSE;
            break;
        }
        break;
      case PhabricatorAuditActionConstants::ADD_AUDITORS:
        $tags[] = self::MAILTAG_ADD_AUDITORS;
        break;
      case PhabricatorAuditActionConstants::ADD_CCS:
        $tags[] = self::MAILTAG_ADD_CCS;
        break;
      case PhabricatorAuditActionConstants::INLINE:
      case PhabricatorTransactions::TYPE_COMMENT:
        $tags[] = self::MAILTAG_COMMENT;
        break;
      case self::TYPE_COMMIT:
        $tags[] = self::MAILTAG_COMMIT;
        break;
      case PhabricatorTransactions::TYPE_EDGE:
        switch ($this->getMetadataValue('edge:type')) {
          case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
            $tags[] = self::MAILTAG_PROJECTS;
            break;
          case PhabricatorObjectHasSubscriberEdgeType::EDGECONST:
            $tags[] = self::MAILTAG_ADD_CCS;
            break;
          default:
            $tags[] = self::MAILTAG_OTHER;
            break;
        }
        break;
      default:
        $tags[] = self::MAILTAG_OTHER;
        break;
    }
    return $tags;
  }

  public function shouldDisplayGroupWith(array $group) {
    // Make the "This commit now requires audit." state message stand alone.
    $type_state = DiffusionCommitStateTransaction::TRANSACTIONTYPE;

    if ($this->getTransactionType() == $type_state) {
      return false;
    }

    foreach ($group as $xaction) {
      if ($xaction->getTransactionType() == $type_state) {
        return false;
      }
    }

    return parent::shouldDisplayGroupWith($group);
  }

}


text:
<TITLE>Review for 15 Minutes (2001)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

15 Minutes (2001)

reviewed by
Dennis Schwartz

 15 MINUTES (director/writer: John Herzfeld; cinematographer: Jean Yves
 Escoffier; editor: Steven Cohen; cast: Robert De Niro (Eddie
 Flemming), Edward Burns (Jordy Warsaw), Kelsey Grammer (Robert
 Hawkins), Kim Cattrall (Cassandra), Avery Brooks (Leon Jackson),
 Melina Kanakaredes (Nicolette Karas), Karel Roden (Emil Slovak), Vera
 Farmiga (Daphne), Oleg Taktarov (Oleg Razgul), Roseanne (Herself),
 David Alan Grier (Mugger), Bruce Cutler (Himself); Runtime: 119; New
 Line Cinema; 2001)

Reviewed by Dennis Schwartz

A mindless action film that exploits the current news headlines while it
presents Andy Warhol's dictum that, in the future, everybody will be
famous for 15 minutes, and adds to that its ludicrous plot revolving
around how everyone is enchanted by fame, either wanting to be a
celebrity or to gawk at them. It also presents an annoyingly didactic
message about violence encouraged by the media for ratings and of
criminals getting away with murder because they know how to bend the
rules, as its maddening story only worsens with an incoherent finale.

There is nothing subtle about this heavy-handed thriller. The good part
of the film is its fast-paced street action scenes and the attention
grabbing psychopathic villain (Karel Roden) challenging the
self-absorbed celebrity ace homicide detective (De Niro), which makes
for vulgar entertainment. It's a film that has about 15 minutes of
fervor to it before it gets grounded into a mixture of sleaze, violence,
and heartless melodrama.

Two vile Eastern European émigrés come to America, believing it is the
land of opportunity for everyone, including criminals. The morose Emil
(Karel Roden) is a Czech, with the bulging eyes and simpering grin of a
lunatic. His partner is a creepy, dim-witted Russian, Oleg (Oleg
Taktarov), who is into taking pictures of everything he sees around him
with his mini camera.

Emil will at one point declare: "I love America! No one is responsible
for what they do," after watching a dumb American tabloid TV show (which
is the way most foreigners unfortunately learn about America).

Before they take care of their NYC business, Oleg impulsively steals an
expensive camcorder off a Times Square store and immediately starts
videotaping everything in his sight. The two then go to the apartment of
Emil's partner in an old country robbery, who stashed the money for them
to split while Emil spent time in prison for the crime. When he tells
Emil he spent the money and can only offer Emil a job as a plumber, Emil
picks up his partner's kitchen knife and savagely stabs him to death and
then chokes his wife to death. To conceal the crime, he puts their
bodies together and douses them with gasoline and burns down the
building. The only problem, is that there was a Czech woman in the other
room who witnessed the murders and escaped down the fire escape. Oleg,
who thinks of himself as Frank Capra, got it all on video.

First on the crime scene, is the 55-year-old homicide detective, Eddie
Flemming (Robert De Niro), who tells a popular tabloid TV program,"Top
Story," hosted by sleazy Robert Hawkins (Kelsey Grammer), a business
friend of Eddie's, about his arrests so he can get exclusive footage of
it which enables his show to have top ratings, in return Eddie gets
publicity which has made him into a celebrity, the toast of the grateful
town. Eddie's girlfriend is that program's TV reporter (Melina
Kanakaredes), and they mutually help their careers grow. The only good
thing about this arrangement, is that despite its seamly nature, Eddie
is a dedicated and good cop, and the show does help in catching
criminals. Second on the crime scene is a young fire marshal, Jordy
Warsaw (Edward Burns), who is upset that the publicity hound homicide
detective is stepping on what is supposed to be his crime scene. But
they both conclude there was a double homicide committed before the fire
started, and decide to exchange their takes on the case and work
together.

The eyewitness is an edgy hairdresser Daphne (Vera Farmiga), who is in
this country illegally and therefore afraid to come forward. But Eddie
and Jordy track her down to her workplace salon, where she works as a
hair washer. Meanwhile Emil is also trying to locate her and finds in
his victim's wallet a card to an escort service, whereby he calls for a
Czech prostitute to come over to his hotel. He beats the address out of
where the unfortunate prostitute works before killing her and beats the
detectives to the salon where he threatens the Czech witness not to
squeal or else. The detectives come by and they spot the two thugs in
the street, and the best action sequence in the film takes place, as the
detectives run through the crowded East Side streets chasing the
murderers who escape into Central Park.

The next part of the film is its big surprise, it involves these two
lunatics making a "snuff" film and selling it to Top Story for a million
dollars. Emil figures out that he and Oleg should be captured in Planet
Hollywood, with their sleazy attorney at their side (the real-life Mafia
mouthpiece, Bruce Cutler). The mouthpiece will plead insanity for them
and blame the crime on Emil's abusive childhood and he will move to get
Oleg sent to a mental institution, where he can then claim he's sane and
be released. Oleg's insane plan is to then cash in on his celebrity for
a movie deal knowing that he won't be tried for the crime again because
of double jeopardy.

John Herzfeld ("2 Days in the Valley"), in his second feature, has used
the media for his whipping boy to get out his overstated message about
how slimy they are. Other than the action scenes brilliantly filmed by
Jean Yves Escoffier, the movie is unappealing.

As for the actors: De Niro is playing a part he always does very well,
showing off his comical gift for quirkiness and endowing his character
with a larger than life presentation. Burns is his opposite, a bland
personality, who doesn't watch TV or seek publicity, and the performance
succeeds only in being a bland one, intentional or not. The juiciest
part is reserved for Roden, who makes the most out of being a scary
figure, a sociopath with an unintentionally droll wit. Grammer plays a
cardboard villain, who lives for the ratings which gives him fame and
wealth. He could be any one of a number of tabloid TV slimy hosts,
reminding me most of the ass kissing Geraldo Rivera.

There's not much to this flick, except for the beautiful way its mayhem
was filmed. Its cynical opinion of the media seemed hypocritical, since
this film is just as exploitive and violent as the tabloid TV show it
was railing against for the whole two hours of this film.

REVIEWED ON 3/17/2001     GRADE: C

Dennis Schwartz: "Ozus' World Movie Reviews"

http://www.sover.net/~ozus

ozus@sover.net

© ALL RIGHTS RESERVED   DENNIS SCHWARTZ

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace app\controllers;

use jerryhsia\JsonExporter;
use Yii;
use app\models\Module;
use yii\data\ActiveDataProvider;
use yii\data\Sort;
use yii\db\ActiveQuery;
use yii\helpers\ArrayHelper;
use yii\web\NotFoundHttpException;

/**
 * Class DataController
 *
 * @package app\controllers
 * @author Jerry Hsia<jerry9916@qq.com>
 */
class DataController extends RestController
{

    public function accessRules()
    {
        return [
            [
                'allow' => true
            ]
        ];
    }

    public function __construct($id, $module, $config = [])
    {
        parent::__construct($id, $module, $config);
    }

    /**
     * Load a module
     *
     * @param $moduleName
     * @return mixed
     * @throws NotFoundHttpException
     */
    private function loadModule($moduleName)
    {
        $module = Yii::$app->moduleService->getModule($moduleName);
        if (!$module) {
            throw new NotFoundHttpException(Yii::t('module', 'Module not found'));
        }
        return $module;
    }

    /**
     * Load a data
     *
     * @param $module
     * @param $id
     * @return mixed
     * @throws NotFoundHttpException
     */
    private function loadData($module, $id)
    {
        $data = Yii::$app->dataService->search($module)->andWhere(['id' => $id])->one();
        if (!$data) {
            throw new NotFoundHttpException(Yii::t('data', 'Data not found'));
        }
        return $data;
    }

    /**
     * GET /datas/<module_name>
     *
     * @return mixed
     */
    public function actionIndex()
    {
        $export = Yii::$app->request->getQueryParam('export', false);
        $moduleName = Yii::$app->request->getQueryParam('module_name');
        $module = $this->loadModule($moduleName);
        $params = Yii::$app->request->getQueryParams();
        $query = Yii::$app->dataService->search($module, $params);

        if ($export) {
            Yii::$app->dataService->export($module, $query);
        } else {
            return new ActiveDataProvider([
                'query' => $query,
                'pagination' => [
                    'pageSize' => Yii::$app->request->getQueryParam('per_page')
                ],
                'sort' => [
                    'enableMultiSort' => true
                ]
            ]);
        }
    }

    /**
     * POST /datas/<module_name>
     *
     * @return Module
     * @throws \yii\base\InvalidConfigException
     */
    public function actionCreate()
    {
        $moduleName = Yii::$app->request->getQueryParam('module_name');
        $module = $this->loadModule($moduleName);
        $array = Yii::$app->request->getBodyParams();

        $className = $module->getFullClassName();
        $model = new $className();
        Yii::$app->dataService->save($module, $model, $array);
        return $model;
    }

    /**
     * PUT /datas/<module_name>/<id>
     *
     * @return mixed
     * @throws NotFoundHttpException
     * @throws \yii\base\InvalidConfigException
     */
    public function actionUpdate()
    {
        $moduleName = Yii::$app->request->getQueryParam('module_name');
        $array = Yii::$app->request->getBodyParams();
        $id = Yii::$app->request->getQueryParam('id');

        $module = $this->loadModule($moduleName);
        $model = $this->loadData($module, $id);
        Yii::$app->dataService->save($module, $model, $array);
        return $model;
    }

    /**
     * Delete /datas/<module_name>/<id>
     *
     * @return mixed
     * @throws NotFoundHttpException
     */
    public function actionDelete()
    {
        $moduleName = Yii::$app->request->getQueryParam('module_name');
        $id = Yii::$app->request->getQueryParam('id');

        $module = $this->loadModule($moduleName);
        $model = $this->loadData($module, $id);
        return Yii::$app->dataService->delete($module, $model);
    }

    /**
     * GET /datas/<module_name>/<id>
     *
     * @return mixed
     * @throws NotFoundHttpException
     */
    public function actionView()
    {
        $moduleName = Yii::$app->request->getQueryParam('module_name');
        $id = Yii::$app->request->getQueryParam('id');

        $module = $this->loadModule($moduleName);
        return $this->loadData($module, $id);
    }

}


text:
#ifndef _THRIFT_CONCURRENCY_THREAD_H_
#define _THRIFT_CONCURRENCY_THREAD_H_ 1

#include <chrono>
#include <cstdint>
#include <memory>
#include <string>

namespace apache {
namespace thrift {
namespace concurrency {

class Thread;

/**
 * Minimal runnable class.  More or less analogous to java.lang.Runnable.
 *
 * @version $Id:$
 */
class Runnable {
 public:
  virtual ~Runnable() {}
  virtual void run() = 0;

  /**
   * Gets the thread object that is hosting this runnable object  - can return
   * an empty std::shared pointer if no references remain on the thread object
   */
  virtual std::shared_ptr<Thread> thread() const { return thread_.lock(); }

  /**
   * Sets the thread that is executing this object.  This is only meant for
   * use by concrete implementations of Thread.
   */
  virtual void thread(std::shared_ptr<Thread> value) { thread_ = value; }

 private:
  std::weak_ptr<Thread> thread_;
};

enum PRIORITY {
  HIGH_IMPORTANT,
  HIGH,
  IMPORTANT,
  NORMAL,
  BEST_EFFORT,
  N_PRIORITIES
};

/**
 * Minimal thread class. Returned by thread factory bound to a Runnable object
 * and ready to start execution.  More or less analogous to java.lang.Thread
 * (minus all the thread group, priority, mode and other baggage, since that
 * is difficult to abstract across platforms and is left for platform-specific
 * ThreadFactory implementations to deal with
 *
 * @see apache::thrift::concurrency::ThreadFactory)
 */
class Thread {
 public:
  typedef uint64_t id_t;

  virtual ~Thread() {}

  /**
   * Starts the thread. Does platform specific thread creation and
   * configuration then invokes the run method of the Runnable object bound
   * to this thread.
   */
  virtual void start() = 0;

  /**
   * Join this thread. Current thread blocks until this target thread
   * completes.
   */
  virtual void join() = 0;

  /**
   * Gets the thread's platform-specific ID
   */
  virtual id_t getId() = 0;

  /**
   * Gets the runnable object this thread is hosting
   */
  virtual std::shared_ptr<Runnable> runnable() const { return _runnable; }

  /**
   * Sets thread name for debugging purposes after the thread was created.
   * Returns true on success.
   */
  virtual bool setName(const std::string& /*name*/) { return false; }

  /**
   * Returns the CPU time consumed by the thread. Requires support for
   * thread-specific clocks. Returns 0 if not supported.
   */
  virtual std::chrono::nanoseconds usedCpuTime() const {
    return std::chrono::nanoseconds(0);
  }

 protected:
  virtual void runnable(std::shared_ptr<Runnable> value) { _runnable = value; }

 private:
  std::shared_ptr<Runnable> _runnable;
};

/**
 * Factory to create platform-specific thread object and bind them to Runnable
 * object for execution
 */
class ThreadFactory {
 public:
  enum DetachState {
    ATTACHED,
    DETACHED,
  };

  virtual ~ThreadFactory() {}
  virtual std::shared_ptr<Thread> newThread(
      const std::shared_ptr<Runnable>& runnable) const = 0;

  virtual std::shared_ptr<Thread> newThread(
      const std::shared_ptr<Runnable>& runnable,
      DetachState detachState) const = 0;

  /**
   * Gets the current thread id or unknown_thread_id if the current thread is
   * not a thrift thread
   */

  static const Thread::id_t unknown_thread_id;

  virtual Thread::id_t getCurrentThreadId() const = 0;
};

} // namespace concurrency
} // namespace thrift
} // namespace apache

#endif // #ifndef _THRIFT_CONCURRENCY_THREAD_H_


text:
class MemberTest : public ::testing::Test, public edisense_comms::MemberServer {
public:
  bool updateCalled;
  bool canReceiveCalled;
  bool commitReceiveCalled;
  bool commitAsStableCalled;
  edisense_comms::Member * member;
protected:

  virtual void SetUp() override;

  virtual void TearDown() override;

public:
  virtual GetResult handleGetRequest(transaction_t tid, device_t deviceId, time_t begin, time_t end);

  virtual PutResult handlePutRequest(node_t sender, transaction_t tid, device_t deviceId, time_t timestamp, time_t expiry, blob data);

  virtual std::list<std::string> *handleLocateRequest(device_t deviceId);

  virtual bool handleUpdatePartitionOwner(node_t sender, transaction_t tid, node_t newOwner, partition_t partition);

  virtual CanReceiveResult handleCanReceiveRequest(node_t sender, transaction_t tid, partition_t partition_id);

  virtual bool handleCommitReceiveRequest(node_t sender, transaction_t tid, partition_t partition_id);

  virtual bool handleCommitAsStableRequest(node_t sender, transaction_t tid, partition_t partition_id);

  virtual JoinResult handleJoinRequest(node_t sender, transaction_t tid, std::string &new_member);
};

TEST_F(MemberTest, TestUpdatePartitionRequest)
{
  std::list<std::string> recipients;
  recipients.push_back("localhost");
  std::future<std::list<std::string>> resultsSoon = member->updatePartitionOwner(1, 12345, recipients, 12, 123);
  std::future_status status = resultsSoon.wait_for(std::chrono::seconds(2));
  ASSERT_EQ(std::future_status::ready, status);
  std::list<std::string> results = resultsSoon.get();

  EXPECT_TRUE(updateCalled);
  EXPECT_EQ(0, results.size());
}

TEST_F(MemberTest, TestCanReceiveRequest)
{
  std::string recipient = "localhost";
  std::future<CanReceiveResult> resultsSoon = member->canReceiveRequest(1, 12345, recipient, 123);
  std::future_status status = resultsSoon.wait_for(std::chrono::seconds(2));
  ASSERT_EQ(std::future_status::ready, status);
  CanReceiveResult result = resultsSoon.get();

  EXPECT_TRUE(result.can_recv);
  EXPECT_TRUE(canReceiveCalled);
}

TEST_F(MemberTest, TestCommitReceiveRequest) {
  std::string recipient = "localhost";
  std::future<CallStatusBool> resultsSoon = member->commitReceiveRequest(1, 12345, recipient, 123);
  std::future_status status = resultsSoon.wait_for(std::chrono::seconds(2));
  ASSERT_EQ(std::future_status::ready, status);
  bool result = resultsSoon.get() == RET_TRUE;

  EXPECT_TRUE(result);
  EXPECT_TRUE(commitReceiveCalled);
}

TEST_F(MemberTest, TestCommitAsStableRequest)
{
  std::string recipient = "localhost";
  std::future<bool> resultsSoon = member->commitAsStableRequest(1, 12345, recipient, 123);
  std::future_status status = resultsSoon.wait_for(std::chrono::seconds(2));
  ASSERT_EQ(std::future_status::ready, status);
  bool result = resultsSoon.get();

  EXPECT_TRUE(commitAsStableCalled);
  EXPECT_TRUE(result);
}

GetResult MemberTest::handleGetRequest(transaction_t tid, device_t deviceId, time_t begin, time_t end) {
  return GetResult(); // Tested in test_client.h
}

PutResult MemberTest::handlePutRequest(node_t sender, transaction_t tid, device_t deviceId, time_t timestamp, time_t expiry, blob data) {
  return PutResult(); // Tested in test_client.h
}

std::list<std::string> *MemberTest::handleLocateRequest(device_t deviceId) {
  return NULL; // Tested in test_client.h
}

bool MemberTest::handleUpdatePartitionOwner(node_t sender, transaction_t tid, node_t newOwner, partition_t partition) {
  updateCalled = true;
  return true;
}

CanReceiveResult MemberTest::handleCanReceiveRequest(node_t sender, transaction_t tid, partition_t partition_id) {
  canReceiveCalled = true;
  CanReceiveResult result= {};
  result.can_recv = true;
  result.free = 2121212121;
  result.util = 0.5;
  return result;
}

bool MemberTest::handleCommitReceiveRequest(node_t sender, transaction_t tid, partition_t partition_id) {
  commitReceiveCalled = true;
  return true;
}

bool MemberTest::handleCommitAsStableRequest(node_t sender, transaction_t tid, partition_t partition_id) {
  commitAsStableCalled = true;
  return true;
}

JoinResult MemberTest::handleJoinRequest(node_t sender, transaction_t tid, std::string &new_member)
{
  JoinResult r;
  return r;
}

void MemberTest::SetUp() {
  Test::SetUp();
  member = new edisense_comms::Member;
  member->start(this);
  updateCalled = false;
  canReceiveCalled = false;
  commitReceiveCalled = false;
  commitAsStableCalled = false;
}

void MemberTest::TearDown() {
  Test::TearDown();
  member->stop();
  delete member;
}


text:
Sensor Tutorials Overview
-------------------------

This set of sensor tutorials allows you to explore the Mynewt Sensor
Framework features and learn how to develop sensor-enabled Mynewt
applications.

The Mynewt Sensor framework supports:

-  Onboard and off-board sensors.
-  Retrieving sensor data and controlling sensor devices via the Mynewt
   OS Shell.
-  Retrieving sensor data over the OIC protocol and BLE transport.

Available Tutorials
~~~~~~~~~~~~~~~~~~~

The tutorials are:

-  `Enabling an Off-Board Sensor in an Existing
   Application </os/tutorials/sensors/sensor_nrf52_bno055.html>`__ - This
   is an introductory tutorial that shows you to how to quickly bring up
   a sensor enabled application that retrieves data from a sensor
   device. We recommend that you work through this tutorial before
   trying one of the other tutorials.

-  `Changing the Default Configuration for a
   Sensor </os/tutorials/sensors/sensor_offboard_config.html>`__ - This
   tutorial shows you how to change the default configuration values for
   a sensor.

-  `Developing an Application for an Onboard
   Sensor </os/tutorials/sensors/sensor_thingy_lis2dh12_onb.html>`__ -
   This tutorial shows you how to develop a simple application for a
   device with an onboard sensor.

-  `Enabling OIC Sensor Data Monitoring in an Existing
   Application </os/tutorials/sensors/sensor_oic_overview.html>`__ - This
   tutorial shows you how to enable support for sensor data monitoring
   via OIC in an existing application.

Mynewt Smart Device Controller OIC App
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We use the ``Mynewt Sensor Monitor`` App on iOS or Android to retrieve
and display sensor data from the Mynewt OS OIC sensor applications
described in the OIC Sensor Data Monitoring tutorials. You can download
the app from either the Apple Store or Google Play Store.

**Note:** At the time of writing this tutorial, the iOS app was still in
the queue waiting to be placed in the App Store. You can build the iOS
app from source as indicated below.

If you would like to contribute or modify the Mynewt Smart Device
Controller App, see the `Android Sensor
source <https://github.com/runtimeco/android_sensor>`__ and `iOS Sensor
source <https://github.com/runtimeco/iOS_oic>`__ on github.

Prerequisites
~~~~~~~~~~~~~~~

Ensure that you meet the following prerequisites
before continuing with one of the tutorials.

-  Have Internet connectivity to fetch remote Mynewt components.
-  Have a computer to build a Mynewt application and connect to the
   board over USB.
-  Have a Micro-USB cable to connect the board and the computer.
-  Install the newt tool and toolchains (See `Basic
   Setup </os/get_started/get_started.html>`__).
-  Read the Mynewt OS `Concepts </os/get_started/vocabulary.html>`__
   section.
-  Create a project space (directory structure) and populate it with the
   core code repository (apache-mynewt-core) explained in `Creating Your
   First Project </os/get_started/project_create>`__.
-  Work through one of the `Blinky
   Tutorials </os/tutorials/blinky.html>`__.


text:
package org.jspare.core.helpers.annotation;

import org.jspare.core.Component;

/**
 * The Interface CmptWithAnnotation.
 *
 * @author pflimaw
 * @since 30/03/2016
 */
@Component
public interface CmptWithAnnotation {

}


text:
@interface LMJAddressPickerViewController : LMJStaticTableViewController

@end


text:
from biohub.utils.rest.serializers import ModelSerializer, bind_model

from .models import Notice

@bind_model(Notice)
class NoticeSerializer(ModelSerializer):

    class Meta:
        fields = ('id', 'has_read', 'message', 'category', 'created')
        model = Notice


text:
// Copyright NVIDIA Corporation 2002-2011
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of NVIDIA CORPORATION nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#pragma once
/** @file */

#include <dp/sg/core/Config.h>
#include <dp/math/Quatt.h>
#include <dp/math/Trafo.h>
#include <dp/math/Vecnt.h>
#include <dp/util/HashGenerator.h>
#include <dp/sg/core/Group.h>

namespace dp
{
  namespace sg
  {
    namespace core
    {

      /*! \brief Transform node.
       *  \par Namespace: dp::sg::core
       *  \remarks A Transform is a special Group node. In addition to the children held by a
       *  Transform like a Group, it contains a transformation that is appended to the current
       *  transformation. The children then are positioned relative to this transformation.
       *
       *  Beginning with SceniX 7.2 each property P will send out only notify PID_P and PID_Matrix.
       *  PID_Invert is implied with all property changes.
       *  \sa Group */
      class Transform : public Group
      {
        friend class Skin;

        public:
          DP_SG_CORE_API static TransformSharedPtr create();

          DP_SG_CORE_API virtual HandledObjectSharedPtr clone() const;

          DP_SG_CORE_API virtual ~Transform(void);

        public:
          /*! \brief Get the transformation represented by this Transform.
           *  \return A reference to the constant dp::math::Trafo, representing the transformation.
           *  \sa dp::math::Trafo, setTrafo */
          virtual const dp::math::Trafo& getTrafo( void ) const;

          /*! \brief Set the transformation for this Transform.
           *  \param trafo A reference to the constant dp::math::Trafo to use.
           *  \remarks The transformation \a trafo is copied to the internal one, and the bounding
           *  sphere of the Transform is invalidated.
           *  \sa dp::math::Trafo, getTrafo */
          DP_SG_CORE_API virtual void setTrafo( const dp::math::Trafo & trafo );

          /*! \brief Test if a Transform is a Joint.
           *  \return \c true, if this Transform is a Joint, otherwise \c false.
           *  \remarks When a Transform is added as a Joint to a Skin, its joint counter is incremented.
           *  If the joint counter of a Transform is positive, it is considered to be a Joint. */
          bool isJoint() const;

          /*! \brief Assignment operator
           *  \param rhs A reference to the constant Transform to copy from
           *  \return A reference to the assigned Transform
           *  \remarks The assignment operator calls the assignment operator of Group, and copies the
           *  transformation.
           *  \sa Group, dp::math::Trafo */
          DP_SG_CORE_API Transform & operator=(const Transform & rhs);

          /*! \brief Test for equivalence with an other Transform.
           *  \param p A reference to the constant Transform to test for equivalence with.
           *  \param ignoreNames Optional parameter to ignore the names of the objects; default is \c true.
           *  \param deepCompare Optional parameter to perform a deep comparsion; default is \c false.
           *  \return \c true if the Transform \a p is equivalent to \c this, otherwise \c false.
           *  \remarks If \a p and \c this are equivalent as a Group, they are equivalent if they have
           *  the same transformation.
           *  \sa Group, dp::math::Trafo */
          DP_SG_CORE_API virtual bool isEquivalent( ObjectSharedPtr const& object, bool ignoreNames, bool deepCompare ) const;

          REFLECTION_INFO_API( DP_SG_CORE_API, Transform );

        protected:
          /*! \brief Default-constructs a Transform.
           */
          DP_SG_CORE_API Transform(void);

          /*! \brief Constructs a Transform as a copy of another Transform.
          */
          DP_SG_CORE_API Transform( const Transform &rhs );

          /*! \brief Calculates the bounding box of this Transform.
           *  \return The axis-aligned bounding box of this Transform.
           *  \remarks This function is called by the framework when re-calculation
           *  of the bounding box is required for this Transform. */
          DP_SG_CORE_API virtual dp::math::Box3f calculateBoundingBox() const;

          /*! \brief Calculate the bounding sphere of this Transform.
           *  \return A dp::math::Sphere3f that contains the complete Transform.
           *  \remarks This function is called by the framework to determine a sphere that completely
           *  contains the Transform. First, the bounding sphere of the Group is determined, then
           *  this sphere is transformed according to the transformation. */
          DP_SG_CORE_API virtual dp::math::Sphere3f calculateBoundingSphere() const;

          /*! \brief Increments the number of references as a joint.
           *  \remarks A Transform can be used as a joint by a Skin. For each Skin, that uses this
           *  Transform, its joint count is incremented. Whenever a joint is removed from a Skin, the
           *  joint count of the corresponding Transform is decremented. That is, when the joint count
           *  is larger than zero, this Transform is a joint, otherwise it isn't. This function is
           *  exclusively used by the Skin class.
           *  \sa decrementJointCount */
          DP_SG_CORE_API void incrementJointCount();

          /*! \brief Decrements the number of references as a joint.
           *  \remarks A Transform can be used as a joint by a Skin. For each Skin, that uses this
           *  Transform, its joint count is incremented. Whenever a joint is removed from a Skin, the
           *  joint count of the corresponding Transform is decremented. That is, when the joint count
           *  is larger than zero, this Transform is a joint, otherwise it isn't. This function is
           *  exclusively used by the Skin class.
           *  \sa decrementJointCount */
          DP_SG_CORE_API void decrementJointCount();

          /*! \brief Feed the data of this object into the provied HashGenerator.
           *  \param hg The HashGenerator to update with the data of this object.
           *  \sa getHashKey */
          DP_SG_CORE_API virtual void feedHashGenerator( dp::util::HashGenerator & hg ) const;

        private:
          void evalChange();

        private:
          dp::math::Trafo m_trafo;
          unsigned int    m_jointCount;
          unsigned int    m_changeCount;
          unsigned int    m_changeThreshold;

        public:
          // Property framework
          BEGIN_DECLARE_STATIC_PROPERTIES
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Center );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Orientation );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( ScaleOrientation );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Scaling );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Translation );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Matrix );
              DP_SG_CORE_API DECLARE_STATIC_PROPERTY( Inverse );
          END_DECLARE_STATIC_PROPERTIES

          const dp::math::Vec3f&  getCenter( void ) const           { return getTrafo().getCenter(); }
          const dp::math::Quatf&  getOrientation( void ) const      { return getTrafo().getOrientation(); }
          const dp::math::Quatf&  getScaleOrientation( void ) const { return getTrafo().getScaleOrientation(); }
          const dp::math::Vec3f&  getScaling( void ) const          { return getTrafo().getScaling(); }
          const dp::math::Vec3f&  getTranslation( void ) const      { return getTrafo().getTranslation(); }
                dp::math::Mat44f  getMatrix( void ) const           { return getTrafo().getMatrix(); }
                dp::math::Mat44f  getInverse( void ) const          { return getTrafo().getInverse(); }

          DP_SG_CORE_API void setCenter( const dp::math::Vec3f& value );
          DP_SG_CORE_API void setOrientation( const dp::math::Quatf& value );
          DP_SG_CORE_API void setScaleOrientation( const dp::math::Quatf& value );
          DP_SG_CORE_API void setScaling( const dp::math::Vec3f& value );
          DP_SG_CORE_API void setTranslation( const dp::math::Vec3f& value );
          DP_SG_CORE_API void setMatrix( const dp::math::Mat44f& value);
      };

      inline const dp::math::Trafo& Transform::getTrafo( void ) const
      {
        return( m_trafo );
      }

      inline bool Transform::isJoint() const
      {
        return( 0 < m_jointCount );
      }

    } // namespace core
  } // namespace sg
} // namespace dp


text:
module FreshBooks
  class Address < FreshBooks::Base
    define_schema do |s|
      s.string :street1, :street2, :city, :state, :country, :code
    end
  end
end


text:
use messages::*;
use messages::message_type::MessageTypes;
use settings;
use utils::httpclient;
use error::prelude::*;
use utils::httpclient::AgencyMock;
use utils::constants::DELETE_CONNECTION_RESPONSE;

#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct UpdateConnection {
    #[serde(rename = "@type")]
    msg_type: MessageTypes,
    #[serde(rename = "statusCode")]
    status_code: ConnectionStatus,
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ConnectionStatus {
    AlreadyConnected,
    NotConnected,
    Deleted,
}

impl Serialize for ConnectionStatus {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
        let value = match self {
            ConnectionStatus::AlreadyConnected => "CS-101",
            ConnectionStatus::NotConnected => "CS-102",
            ConnectionStatus::Deleted => "CS-103",
        };
        serde_json::Value::String(value.to_string()).serialize(serializer)
    }
}

impl<'de> Deserialize<'de> for ConnectionStatus {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de> {
        let value = Value::deserialize(deserializer).map_err(de::Error::custom)?;
        match value.as_str() {
            Some("CS-101") => Ok(ConnectionStatus::AlreadyConnected),
            Some("CS-102") => Ok(ConnectionStatus::NotConnected),
            Some("CS-103") => Ok(ConnectionStatus::Deleted),
            _ => Err(de::Error::custom("Unexpected message type."))
        }
    }
}

#[derive(Debug, Deserialize, Serialize, PartialEq)]
pub struct UpdateConnectionResponse {
    #[serde(rename = "@type")]
    msg_type: MessageTypes,
    #[serde(rename = "statusCode")]
    status_code: ConnectionStatus,
}

#[derive(Debug)]
pub struct DeleteConnectionBuilder {
    to_did: String,
    to_vk: String,
    status_code: ConnectionStatus,
    agent_did: String,
    agent_vk: String,
    version: settings::ProtocolTypes,
}

impl DeleteConnectionBuilder {
    pub fn create() -> DeleteConnectionBuilder {
        trace!("DeleteConnection::create_message >>>");

        DeleteConnectionBuilder {
            to_did: String::new(),
            to_vk: String::new(),
            status_code: ConnectionStatus::Deleted,
            agent_did: String::new(),
            agent_vk: String::new(),
            version: settings::get_protocol_type(),
        }
    }

    pub fn version(&mut self, version: &Option<settings::ProtocolTypes>) -> VcxResult<&mut Self> {
        self.version = match version {
            Some(version) => version.clone(),
            None => settings::get_protocol_type()
        };
        Ok(self)
    }

    pub fn send_secure(&mut self) -> VcxResult<()> {
        trace!("DeleteConnection::send >>>");

        AgencyMock::set_next_response(DELETE_CONNECTION_RESPONSE.to_vec());

        let data = self.prepare_request()?;

        let response = httpclient::post_u8(&data)?;

        self.parse_response(&response)
    }

    fn parse_response(&self, response: &Vec<u8>) -> VcxResult<()> {
        trace!("parse_create_keys_response >>>");

        let mut response = parse_response_from_agency(response, &self.version)?;

        match response.remove(0) {
            A2AMessage::Version1(A2AMessageV1::UpdateConnectionResponse(_)) => Ok(()),
            A2AMessage::Version2(A2AMessageV2::UpdateConnectionResponse(_)) => Ok(()),
            _ => Err(VcxError::from_msg(VcxErrorKind::InvalidHttpResponse, "Message does not match any variant of UpdateConnectionResponse"))
        }
    }
}

pub fn send_delete_connection_message(pw_did: &str, pw_verkey: &str, agent_did: &str, agent_vk: &str) -> VcxResult<()> {
    delete_connection()
        .to(pw_did)?
        .to_vk(pw_verkey)?
        .agent_did(agent_did)?
        .agent_vk(agent_vk)?
        .send_secure()
        .map_err(|err| err.extend("Cannot delete connection"))
}

//TODO Every GeneralMessage extension, duplicates code
impl GeneralMessage for DeleteConnectionBuilder {
    type Msg = DeleteConnectionBuilder;

    fn set_agent_did(&mut self, did: String) {
        self.agent_did = did;
    }

    fn set_agent_vk(&mut self, vk: String) {
        self.agent_vk = vk;
    }

    fn set_to_did(&mut self, to_did: String) { self.to_did = to_did; }
    fn set_to_vk(&mut self, to_vk: String) { self.to_vk = to_vk; }

    fn prepare_request(&mut self) -> VcxResult<Vec<u8>> {
        let message = match self.version {
            settings::ProtocolTypes::V1 =>
                A2AMessage::Version1(
                    A2AMessageV1::UpdateConnection(
                        UpdateConnection {
                            msg_type: MessageTypes::build(A2AMessageKinds::UpdateConnectionStatus),
                            status_code: self.status_code.clone(),
                        }
                    )
                ),
            settings::ProtocolTypes::V2 |
            settings::ProtocolTypes::V3 |
            settings::ProtocolTypes::V4 =>
                A2AMessage::Version2(
                    A2AMessageV2::UpdateConnection(
                        UpdateConnection {
                            msg_type: MessageTypes::build(A2AMessageKinds::UpdateConnectionStatus),
                            status_code: self.status_code.clone(),
                        }
                    )
                )
        };

        prepare_message_for_agent(vec![message], &self.to_vk, &self.agent_did, &self.agent_vk, &self.version)
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use utils::devsetup::SetupDefaults;

    #[test]
    fn test_deserialize_delete_connection_payload() {
        let _setup = SetupDefaults::init();

        let payload = vec![130, 165, 64, 116, 121, 112, 101, 130, 164, 110, 97, 109, 101, 179, 67, 79, 78, 78, 95, 83, 84, 65, 84, 85, 83, 95, 85, 80, 68, 65, 84, 69, 68, 163, 118, 101, 114, 163, 49, 46, 48, 170, 115, 116, 97, 116, 117, 115, 67, 111, 100, 101, 166, 67, 83, 45, 49, 48, 51];
        let msg_str = r#"{ "@type": { "name": "CONN_STATUS_UPDATED", "ver": "1.0" }, "statusCode": "CS-103" }"#;
        let delete_connection_payload: UpdateConnectionResponse = serde_json::from_str(&msg_str).unwrap();
        assert_eq!(delete_connection_payload, rmp_serde::from_slice(&payload).unwrap());
    }
}


text:
<?php

namespace zqhong\route;

class RouteParser
{
    protected $leftSeparator = '{';
    protected $rightSeparator = '}';

    /**
     * 解析路由:
     * e.g.
     * parse('/user/{id:\d+}', 'getUser') -> new Route('/user/(\d+)', 'getUser', ['id' => 'id"])
     *
     * @param string $route
     * @param $handler
     * @return array
     */
    public function parse($route, $handler)
    {
        $params = [];

        $leftPos = strpos($route, $this->leftSeparator);
        $rightPos = strpos($route, $this->rightSeparator);
        while (($leftPos || $rightPos) !== false && $rightPos > $leftPos) {
            $rule = substr($route, $leftPos, $rightPos - $leftPos + 1);
            list($paramName, $regex) = explode(':', trim($rule, '{}'), 2);
            $route = str_replace($rule, sprintf('(%s)', $regex), $route);
            $params[$paramName] = $paramName;

            $leftPos = strpos($route, $this->leftSeparator);
            $rightPos = strpos($route, $this->rightSeparator);
        }

        return new Route($route, $handler, $params);
    }
}


text:
struct compile_local_t
{
  const char* name;
  LLVMValueRef alloca;
};

static uint64_t compile_local_hash(compile_local_t* p)
{
  return hash_ptr(p->name);
}

static bool compile_local_cmp(compile_local_t* a, compile_local_t* b)
{
  return a->name == b->name;
}

static void compile_local_free(compile_local_t* p)
{
  POOL_FREE(compile_local_t, p);
}

DEFINE_HASHMAP(compile_locals, compile_local_t, compile_local_hash,
  compile_local_cmp, pool_alloc_size, pool_free_size, compile_local_free);

static void fatal_error(const char* reason)
{
  printf("%s\n", reason);
  print_errors();
}

static compile_frame_t* push_frame(compile_t* c)
{
  compile_frame_t* frame = POOL_ALLOC(compile_frame_t);
  memset(frame, 0, sizeof(compile_frame_t));
  compile_locals_init(&frame->locals, 0);

  if(c->frame != NULL)
  {
    frame->has_source = c->frame->has_source;
    frame->prev = c->frame;
  }

  c->frame = frame;
  return frame;
}

static void pop_frame(compile_t* c)
{
  compile_frame_t* frame = c->frame;
  compile_locals_destroy(&frame->locals);

  c->frame = frame->prev;

  if(c->frame != NULL)
    c->dwarf.has_source = c->frame->has_source;
  else
    c->dwarf.has_source = true;

  POOL_FREE(compile_frame_t, frame);
}

static LLVMTargetMachineRef make_machine(pass_opt_t* opt)
{
  LLVMTargetRef target;
  char* err;

  if(LLVMGetTargetFromTriple(opt->triple, &target, &err) != 0)
  {
    errorf(NULL, "couldn't create target: %s", err);
    LLVMDisposeMessage(err);
    return NULL;
  }

  LLVMCodeGenOptLevel opt_level =
    opt->release ? LLVMCodeGenLevelAggressive : LLVMCodeGenLevelNone;

  LLVMRelocMode reloc = opt->library ? LLVMRelocPIC : LLVMRelocDefault;

  LLVMTargetMachineRef machine = LLVMCreateTargetMachine(target, opt->triple,
    opt->cpu, opt->features, opt_level, reloc, LLVMCodeModelDefault);

  if(machine == NULL)
  {
    errorf(NULL, "couldn't create target machine");
    return NULL;
  }

  return machine;
}

static void init_runtime(compile_t* c)
{
  c->str_1 = stringtab("$1");
  c->str_Bool = stringtab("Bool");
  c->str_I8 = stringtab("I8");
  c->str_I16 = stringtab("I16");
  c->str_I32 = stringtab("I32");
  c->str_I64 = stringtab("I64");
  c->str_I128 = stringtab("I128");
  c->str_U8 = stringtab("U8");
  c->str_U16 = stringtab("U16");
  c->str_U32 = stringtab("U32");
  c->str_U64 = stringtab("U64");
  c->str_U128 = stringtab("U128");
  c->str_F32 = stringtab("F32");
  c->str_F64 = stringtab("F64");
  c->str_Pointer = stringtab("Pointer");
  c->str_Array = stringtab("Array");
  c->str_Platform = stringtab("Platform");

  c->str_add = stringtab("add");
  c->str_sub = stringtab("sub");
  c->str_mul = stringtab("mul");
  c->str_div = stringtab("div");
  c->str_mod = stringtab("mod");
  c->str_neg = stringtab("neg");
  c->str_and = stringtab("op_and");
  c->str_or = stringtab("op_or");
  c->str_xor = stringtab("op_xor");
  c->str_not = stringtab("op_not");
  c->str_shl = stringtab("shl");
  c->str_shr = stringtab("shr");
  c->str_eq = stringtab("eq");
  c->str_ne = stringtab("ne");
  c->str_lt = stringtab("lt");
  c->str_le = stringtab("le");
  c->str_ge = stringtab("ge");
  c->str_gt = stringtab("gt");

  LLVMTypeRef type;
  LLVMTypeRef params[4];
  LLVMValueRef value;

  c->void_type = LLVMVoidTypeInContext(c->context);
  c->i1 = LLVMInt1TypeInContext(c->context);
  c->i8 = LLVMInt8TypeInContext(c->context);
  c->i16 = LLVMInt16TypeInContext(c->context);
  c->i32 = LLVMInt32TypeInContext(c->context);
  c->i64 = LLVMInt64TypeInContext(c->context);
  c->i128 = LLVMIntTypeInContext(c->context, 128);
  c->f32 = LLVMFloatTypeInContext(c->context);
  c->f64 = LLVMDoubleTypeInContext(c->context);
  c->intptr = LLVMIntPtrTypeInContext(c->context, c->target_data);

  // i8*
  c->void_ptr = LLVMPointerType(c->i8, 0);

  // forward declare object
  c->object_type = LLVMStructCreateNamed(c->context, "$object");
  c->object_ptr = LLVMPointerType(c->object_type, 0);

  // padding required in an actor between the descriptor and fields
  c->actor_pad = LLVMArrayType(c->i8, PONY_ACTOR_PAD_SIZE);

  // message
  params[0] = c->i32; // size
  params[1] = c->i32; // id
  c->msg_type = LLVMStructCreateNamed(c->context, "$message");
  c->msg_ptr = LLVMPointerType(c->msg_type, 0);
  LLVMStructSetBody(c->msg_type, params, 2, false);

  // trace
  // void (*)($object*)
  params[0] = c->object_ptr;
  c->trace_type = LLVMFunctionType(c->void_type, params, 1, false);
  c->trace_fn = LLVMPointerType(c->trace_type, 0);

  // dispatch
  // void (*)($object*, $message*)
  params[0] = c->object_ptr;
  params[1] = c->msg_ptr;
  c->dispatch_type = LLVMFunctionType(c->void_type, params, 2, false);
  c->dispatch_fn = LLVMPointerType(c->dispatch_type, 0);

  // void (*)($object*)
  params[0] = c->object_ptr;
  c->final_fn = LLVMPointerType(
    LLVMFunctionType(c->void_type, params, 1, false), 0);

  // descriptor, opaque version
  // We need this in order to build our own structure.
  const char* desc_name = genname_descriptor(NULL);
  c->descriptor_type = LLVMStructCreateNamed(c->context, desc_name);
  c->descriptor_ptr = LLVMPointerType(c->descriptor_type, 0);

  // field descriptor
  // Also needed to build a descriptor structure.
  params[0] = c->i32;
  params[1] = c->descriptor_ptr;
  c->field_descriptor = LLVMStructTypeInContext(c->context, params, 2, false);

  // descriptor, filled in
  c->descriptor_type = gendesc_type(c, NULL);

  // define object
  params[0] = c->descriptor_ptr;
  LLVMStructSetBody(c->object_type, params, 1, false);

  // $object* pony_create($desc*)
  params[0] = c->descriptor_ptr;
  type = LLVMFunctionType(c->object_ptr, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_create", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
  LLVMSetReturnNoAlias(value);

  // void pony_sendv($object*, $message*);
  params[0] = c->object_ptr;
  params[1] = c->msg_ptr;
  type = LLVMFunctionType(c->void_type, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_sendv", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // i8* pony_alloc(i64)
  params[0] = c->i64;
  type = LLVMFunctionType(c->void_ptr, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_alloc", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
  LLVMSetReturnNoAlias(value);

  // i8* pony_realloc(i8*, i64)
  params[0] = c->void_ptr;
  params[1] = c->i64;
  type = LLVMFunctionType(c->void_ptr, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_realloc", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
  LLVMSetReturnNoAlias(value);

  // i8* pony_alloc_final(i64, c->final_fn)
  params[0] = c->i64;
  params[1] = c->final_fn;
  type = LLVMFunctionType(c->void_ptr, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_alloc_final", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
  LLVMSetReturnNoAlias(value);

  // $message* pony_alloc_msg(i32, i32)
  params[0] = c->i32;
  params[1] = c->i32;
  type = LLVMFunctionType(c->msg_ptr, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_alloc_msg", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
  LLVMSetReturnNoAlias(value);

  // void pony_trace(i8*)
  params[0] = c->void_ptr;
  type = LLVMFunctionType(c->void_type, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_trace", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_traceactor($object*)
  params[0] = c->object_ptr;
  type = LLVMFunctionType(c->void_type, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_traceactor", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_traceobject($object*, trace_fn)
  params[0] = c->object_ptr;
  params[1] = c->trace_fn;
  type = LLVMFunctionType(c->void_type, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_traceobject", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_traceunknown($object*)
  params[0] = c->object_ptr;
  type = LLVMFunctionType(c->void_type, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_traceunknown", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_trace_tag_or_actor($object*)
  params[0] = c->object_ptr;
  type = LLVMFunctionType(c->void_type, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_trace_tag_or_actor", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_gc_send()
  type = LLVMFunctionType(c->void_type, NULL, 0, false);
  value = LLVMAddFunction(c->module, "pony_gc_send", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_gc_recv()
  type = LLVMFunctionType(c->void_type, NULL, 0, false);
  value = LLVMAddFunction(c->module, "pony_gc_recv", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_send_done()
  type = LLVMFunctionType(c->void_type, NULL, 0, false);
  value = LLVMAddFunction(c->module, "pony_send_done", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_recv_done()
  type = LLVMFunctionType(c->void_type, NULL, 0, false);
  value = LLVMAddFunction(c->module, "pony_recv_done", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // i32 pony_init(i32, i8**)
  params[0] = c->i32;
  params[1] = LLVMPointerType(c->void_ptr, 0);
  type = LLVMFunctionType(c->i32, params, 2, false);
  value = LLVMAddFunction(c->module, "pony_init", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_become($object*)
  params[0] = c->object_ptr;
  type = LLVMFunctionType(c->void_type, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_become", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // i32 pony_start(i32)
  params[0] = c->i32;
  type = LLVMFunctionType(c->i32, params, 1, false);
  value = LLVMAddFunction(c->module, "pony_start", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // void pony_throw()
  type = LLVMFunctionType(c->void_type, NULL, 0, false);
  LLVMAddFunction(c->module, "pony_throw", type);

  // i32 pony_personality_v0(...)
  type = LLVMFunctionType(c->i32, NULL, 0, true);
  c->personality = LLVMAddFunction(c->module, "pony_personality_v0", type);

  // i8* memcpy(...)
  type = LLVMFunctionType(c->void_ptr, NULL, 0, true);
  value = LLVMAddFunction(c->module, "memcpy", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);

  // i8* memmove(...)
  type = LLVMFunctionType(c->void_ptr, NULL, 0, true);
  value = LLVMAddFunction(c->module, "memmove", type);
  LLVMAddFunctionAttr(value, LLVMNoUnwindAttribute);
}

static void init_module(compile_t* c, ast_t* program, pass_opt_t* opt)
{
  c->opt = opt;

  // Get the first package and the builtin package.
  ast_t* package = ast_child(program);
  ast_t* builtin = ast_sibling(package);

  // If we have only one package, we are compiling builtin itself.
  if(builtin == NULL)
    builtin = package;

  c->reachable = reach_new();
  reach_primitives(c->reachable, opt, builtin);

  // The name of the first package is the name of the program.
  c->filename = package_filename(package);

  // LLVM context and machine settings.
  c->context = LLVMContextCreate();
  c->machine = make_machine(opt);
  c->target_data = LLVMGetTargetMachineData(c->machine);

  // Create a module.
  c->module = LLVMModuleCreateWithNameInContext(c->filename, c->context);

  // Set the target triple.
  LLVMSetTarget(c->module, opt->triple);

  // Set the data layout.
  char* layout = LLVMCopyStringRepOfTargetData(c->target_data);
  LLVMSetDataLayout(c->module, layout);
  LLVMDisposeMessage(layout);

  // IR builder.
  c->builder = LLVMCreateBuilderInContext(c->context);

  // Empty frame stack.
  c->frame = NULL;
}

static void codegen_cleanup(compile_t* c)
{
  while(c->frame != NULL)
    pop_frame(c);

  LLVMDisposeBuilder(c->builder);
  LLVMDisposeModule(c->module);
  LLVMContextDispose(c->context);
  LLVMDisposeTargetMachine(c->machine);
  reach_free(c->reachable);
}

bool codegen_init(pass_opt_t* opt)
{
  LLVMInitializeNativeTarget();
  LLVMInitializeAllTargets();
  LLVMInitializeAllTargetMCs();
  LLVMInitializeAllAsmPrinters();
  LLVMInitializeAllAsmParsers();
  LLVMEnablePrettyStackTrace();
  LLVMInstallFatalErrorHandler(fatal_error);

  LLVMPassRegistryRef passreg = LLVMGetGlobalPassRegistry();
  LLVMInitializeCore(passreg);
  LLVMInitializeTransformUtils(passreg);
  LLVMInitializeScalarOpts(passreg);
  LLVMInitializeObjCARCOpts(passreg);
  LLVMInitializeVectorization(passreg);
  LLVMInitializeInstCombine(passreg);
  LLVMInitializeIPO(passreg);
  LLVMInitializeInstrumentation(passreg);
  LLVMInitializeAnalysis(passreg);
  LLVMInitializeIPA(passreg);
  LLVMInitializeCodeGen(passreg);
  LLVMInitializeTarget(passreg);

  // Default triple, cpu and features.
  if(opt->triple != NULL)
    opt->triple = LLVMCreateMessage(opt->triple);
  else
    opt->triple = LLVMGetDefaultTargetTriple();

  if(opt->cpu != NULL)
    opt->cpu = LLVMCreateMessage(opt->cpu);
  else
    opt->cpu = LLVMGetHostCPUName();

  if(opt->features != NULL)
    opt->features = LLVMCreateMessage(opt->features);
  else
    opt->features = LLVMCreateMessage("");

  return true;
}

void codegen_shutdown(pass_opt_t* opt)
{
  LLVMDisposeMessage(opt->triple);
  LLVMDisposeMessage(opt->cpu);
  LLVMDisposeMessage(opt->features);

  LLVMShutdown();
}

bool codegen(ast_t* program, pass_opt_t* opt)
{
  printf("Generating\n");

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  init_module(&c, program, opt);
  init_runtime(&c);
  genprim_builtins(&c);

  // Emit debug info for this compile unit.
  dwarf_init(&c.dwarf, c.opt, c.builder, c.target_data, c.module);
  dwarf_compileunit(&c.dwarf, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}

LLVMValueRef codegen_addfun(compile_t* c, const char* name, LLVMTypeRef type)
{
  // Add the function and set the calling convention.
  LLVMValueRef fun = LLVMAddFunction(c->module, name, type);

  if(!c->opt->library)
    LLVMSetFunctionCallConv(fun, GEN_CALLCONV);

  if(c->opt->no_restrict)
    return fun;

  // Set the noalias attribute on all arguments. This is fortran-like semantics
  // for parameter aliasing, similar to C restrict.
  LLVMValueRef arg = LLVMGetFirstParam(fun);

  while(arg != NULL)
  {
    LLVMTypeRef type = LLVMTypeOf(arg);

    if(LLVMGetTypeKind(type) == LLVMPointerTypeKind)
      LLVMAddAttribute(arg, LLVMNoAliasAttribute);

    arg = LLVMGetNextParam(arg);
  }

  return fun;
}

void codegen_startfun(compile_t* c, LLVMValueRef fun, bool has_source)
{
  compile_frame_t* frame = push_frame(c);

  frame->fun = fun;
  frame->restore_builder = LLVMGetInsertBlock(c->builder);
  frame->has_source = has_source;
  c->dwarf.has_source = has_source;

  // Reset debug locations
  dwarf_location(&c->dwarf, NULL);

  if(LLVMCountBasicBlocks(fun) == 0)
  {
    LLVMBasicBlockRef block = codegen_block(c, "entry");
    LLVMPositionBuilderAtEnd(c->builder, block);
  }
}

void codegen_finishfun(compile_t* c)
{
  if(c->frame->restore_builder != NULL)
    LLVMPositionBuilderAtEnd(c->builder, c->frame->restore_builder);

  // Reset debug locations
  dwarf_location(&c->dwarf, NULL);

  pop_frame(c);
}

void codegen_pushloop(compile_t* c, LLVMBasicBlockRef continue_target,
  LLVMBasicBlockRef break_target)
{
  compile_frame_t* frame = push_frame(c);

  frame->fun = frame->prev->fun;
  frame->restore_builder = frame->prev->restore_builder;
  frame->break_target = break_target;
  frame->continue_target = continue_target;
  frame->invoke_target = frame->prev->invoke_target;
}

void codegen_poploop(compile_t* c)
{
  pop_frame(c);
}

void codegen_pushtry(compile_t* c, LLVMBasicBlockRef invoke_target)
{
  compile_frame_t* frame = push_frame(c);

  frame->fun = frame->prev->fun;
  frame->restore_builder = frame->prev->restore_builder;
  frame->break_target = frame->prev->break_target;
  frame->continue_target = frame->prev->continue_target;
  frame->invoke_target = invoke_target;
}

void codegen_poptry(compile_t* c)
{
  pop_frame(c);
}

LLVMValueRef codegen_getlocal(compile_t* c, const char* name)
{
  compile_frame_t* frame = c->frame;

  compile_local_t k;
  k.name = name;

  while(frame != NULL)
  {
    compile_local_t* p = compile_locals_get(&frame->locals, &k);

    if(p != NULL)
      return p->alloca;

    frame = frame->prev;
  }

  return NULL;
}

void codegen_setlocal(compile_t* c, const char* name, LLVMValueRef alloca)
{
  compile_local_t* p = POOL_ALLOC(compile_local_t);
  p->name = name;
  p->alloca = alloca;

  compile_locals_put(&c->frame->locals, p);
}

LLVMValueRef codegen_fun(compile_t* c)
{
  return c->frame->fun;
}

LLVMBasicBlockRef codegen_block(compile_t* c, const char* name)
{
  return LLVMAppendBasicBlockInContext(c->context, c->frame->fun, name);
}

LLVMValueRef codegen_call(compile_t* c, LLVMValueRef fun, LLVMValueRef* args,
  size_t count)
{
  LLVMValueRef result = LLVMBuildCall(c->builder, fun, args, (int)count, "");

  if(!c->opt->library)
    LLVMSetInstructionCallConv(result, GEN_CALLCONV);

  return result;
}

bool codegen_hassource(compile_t* c)
{
  return c->frame->has_source;
}

const char* suffix_filename(const char* dir, const char* file,
  const char* extension)
{
  // Copy to a string with space for a suffix.
  size_t len = strlen(dir) + strlen(file) + strlen(extension) + 3;
  VLA(char, filename, len + 1);

  // Start with no suffix.
  snprintf(filename, len, "%s/%s%s", dir, file, extension);
  int suffix = 0;

  while(suffix < 100)
  {
    // Overwrite files but not directories.
    struct stat s;
    int err = stat(filename, &s);

    if((err == -1) || !S_ISDIR(s.st_mode))
      break;

    snprintf(filename, len, "%s/%s%d%s", dir, file, ++suffix, extension);
  }

  if(suffix >= 100)
  {
    errorf(NULL, "couldn't pick an unused file name");
    return NULL;
  }

  return stringtab(filename);
}


text:
import {
    CombatLogEvent,
    DamagePayload,
    HealPayload,
} from "../engine/combat-log-event";
import { Guids } from "../engine/guid";
import aceEvent, { AceEvent } from "@wowts/ace_event-3.0";
import { LuaObj, pairs, wipe } from "@wowts/lua";
import {
    UnitHealth,
    UnitHealthMax,
    UnitGetTotalAbsorbs,
    UnitGetTotalHealAbsorbs,
} from "@wowts/wow-mock";
import { huge as infinity } from "@wowts/math";
import { OvaleClass } from "../Ovale";
import { AceModule } from "@wowts/tsaddon";
import { OvaleOptionsClass } from "../ui/Options";
import { Tracer, DebugTools } from "../engine/debug";
import { oneTimeMessage } from "../tools/tools";

const healthEvent: LuaObj<boolean> = {
    DAMAGE_SHIELD: true,
    DAMAGE_SPLIT: true,
    ENVIRONMENTAL_DAMAGE: true,
    RANGE_DAMAGE: true,
    SPELL_BUILDING_DAMAGE: true,
    SPELL_DAMAGE: true,
    SPELL_HEAL: true,
    SPELL_PERIODIC_DAMAGE: true,
    SPELL_PERIODIC_HEAL: true,
    SWING_DAMAGE: true,
};

export class OvaleHealthClass {
    health: LuaObj<number> = {};
    maxHealth: LuaObj<number> = {};
    absorb: LuaObj<number> = {};
    healAbsorb: LuaObj<number> = {};
    totalDamage: LuaObj<number> = {};
    totalHealing: LuaObj<number> = {};
    firstSeen: LuaObj<number> = {};
    lastUpdated: LuaObj<number> = {};
    private module: AceModule & AceEvent;
    private tracer: Tracer;

    constructor(
        private ovaleGuid: Guids,
        ovale: OvaleClass,
        private ovaleOptions: OvaleOptionsClass,
        ovaleDebug: DebugTools,
        private combatLogEvent: CombatLogEvent
    ) {
        this.module = ovale.createModule(
            "OvaleHealth",
            this.handleInitialize,
            this.handleDisable,
            aceEvent
        );
        this.tracer = ovaleDebug.create(this.module.GetName());
    }

    private handleInitialize = () => {
        this.module.RegisterEvent(
            "PLAYER_REGEN_DISABLED",
            this.handlePlayerRegenDisabled
        );
        this.module.RegisterEvent(
            "PLAYER_REGEN_ENABLED",
            this.handlePlayerRegenEnabled
        );
        if (this.ovaleOptions.db.profile.apparence.frequentHealthUpdates) {
            this.module.RegisterEvent("UNIT_HEALTH", this.handleUpdateHealth);
        } else {
            this.module.RegisterEvent("UNIT_HEALTH", this.handleUpdateHealth);
        }
        this.module.RegisterEvent("UNIT_MAXHEALTH", this.handleUpdateHealth);
        this.module.RegisterEvent(
            "UNIT_ABSORB_AMOUNT_CHANGED",
            this.handleUpdateAbsorb
        );
        this.module.RegisterEvent(
            "UNIT_HEAL_ABSORB_AMOUNT_CHANGED",
            this.handleUpdateAbsorb
        );
        this.module.RegisterMessage(
            "Ovale_UnitChanged",
            this.handleUnitChanged
        );
    };
    private handleDisable = () => {
        this.module.UnregisterEvent("PLAYER_REGEN_ENABLED");
        this.module.UnregisterEvent("PLAYER_TARGET_CHANGED");
        this.module.UnregisterEvent("UNIT_HEALTH");
        this.module.UnregisterEvent("UNIT_HEALTH");
        this.module.UnregisterEvent("UNIT_MAXHEALTH");
        this.module.UnregisterEvent("UNIT_ABSORB_AMOUNT_CHANGED");
        this.module.UnregisterEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED");
        this.module.UnregisterMessage("Ovale_UnitChanged");
    };
    private handleCombatLogEvent = (cleuEvent: string) => {
        if (!healthEvent[cleuEvent]) {
            return;
        }
        const cleu = this.combatLogEvent;
        const timestamp = cleu.timestamp;
        const destGUID = cleu.destGUID;
        const destName = cleu.destName;
        let healthUpdate = false;
        if (cleu.payload.type == "DAMAGE") {
            const payload = cleu.payload as DamagePayload;
            const amount = payload.amount;
            this.tracer.debug(cleuEvent, destGUID, destName, amount);
            const total = this.totalDamage[destGUID] || 0;
            this.totalDamage[destGUID] = total + amount;
            healthUpdate = true;
        } else if (cleu.payload.type == "HEAL") {
            const payload = cleu.payload as HealPayload;
            const amount = payload.amount;
            this.tracer.debug(cleuEvent, destGUID, destName, amount);
            const total = this.totalHealing[destGUID] || 0;
            this.totalHealing[destGUID] = total + amount;
            healthUpdate = true;
        }
        if (healthUpdate) {
            if (!this.firstSeen[destGUID]) {
                this.firstSeen[destGUID] = timestamp;
            }
            this.lastUpdated[destGUID] = timestamp;
        }
    };
    private handlePlayerRegenDisabled = (event: string) => {
        for (const [event] of pairs(healthEvent)) {
            this.combatLogEvent.registerEvent(
                event,
                this,
                this.handleCombatLogEvent
            );
        }
    };
    private handlePlayerRegenEnabled = (event: string) => {
        this.combatLogEvent.unregisterAllEvents(this);
        wipe(this.totalDamage);
        wipe(this.totalHealing);
        wipe(this.firstSeen);
        wipe(this.lastUpdated);
    };
    private handleUnitChanged = (
        event: string,
        unitId: string,
        guid: string
    ) => {
        if (unitId == "target" || unitId == "focus") {
            this.tracer.debug(event, unitId, guid);
            this.handleUpdateHealth("UNIT_HEALTH", unitId);
            this.handleUpdateHealth("UNIT_MAXHEALTH", unitId);
            this.handleUpdateAbsorb("UNIT_ABSORB_AMOUNT_CHANGED", unitId);
            this.handleUpdateAbsorb("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unitId);
        }
    };
    private handleUpdateAbsorb = (event: string, unitId: string) => {
        if (!unitId) {
            return;
        }

        let func;
        let db;

        if (event == "UNIT_ABSORB_AMOUNT_CHANGED") {
            func = UnitGetTotalAbsorbs;
            db = this.absorb;
        } else if (event == "UNIT_HEAL_ABSORB_AMOUNT_CHANGED") {
            func = UnitGetTotalHealAbsorbs;
            db = this.absorb;
        } else {
            oneTimeMessage(
                "Warning: Invalid event (%s) in UpdateAbsorb.",
                event
            );
            return;
        }

        const amount = func(unitId);
        if (amount >= 0) {
            const guid = this.ovaleGuid.getUnitGUID(unitId);
            this.tracer.debug(event, unitId, guid, amount);
            if (guid) {
                db[guid] = amount;
            }
        }
    };
    private handleUpdateHealth = (event: string, unitId: string) => {
        if (!unitId) {
            return;
        }

        let func;
        let db;

        if (event == "UNIT_HEALTH") {
            func = UnitHealth;
            db = this.health;
        } else if (event == "UNIT_MAXHEALTH") {
            func = UnitHealthMax;
            db = this.maxHealth;
        } else {
            oneTimeMessage(
                "Warning: Invalid event (%s) in UpdateHealth.",
                event
            );
            return;
        }

        const amount = func(unitId);
        if (amount) {
            const guid = this.ovaleGuid.getUnitGUID(unitId);
            this.tracer.debug(event, unitId, guid, amount);
            if (guid) {
                if (amount > 0) {
                    db[guid] = amount;
                } else {
                    delete db[guid];
                    delete this.firstSeen[guid];
                    delete this.lastUpdated[guid];
                }
            }
        }
    };
    getUnitHealth(unitId: string, guid?: string) {
        return this.getUnitAmount(UnitHealth, this.health, unitId, guid);
    }
    getUnitHealthMax(unitId: string, guid?: string) {
        return this.getUnitAmount(UnitHealthMax, this.maxHealth, unitId, guid);
    }
    getUnitAbsorb(unitId: string, guid?: string) {
        return this.getUnitAmount(
            UnitGetTotalAbsorbs,
            this.absorb,
            unitId,
            guid
        );
    }
    getUnitHealAbsorb(unitId: string, guid?: string) {
        return this.getUnitAmount(
            UnitGetTotalHealAbsorbs,
            this.healAbsorb,
            unitId,
            guid
        );
    }
    getUnitAmount(
        func: (_: string) => number | undefined,
        db: LuaObj<number>,
        unitId: string,
        guid?: string
    ): number {
        let amount;
        if (unitId) {
            guid = guid || this.ovaleGuid.getUnitGUID(unitId);
            if (guid) {
                if (
                    (unitId === "focus" || unitId === "target") &&
                    db[guid] !== undefined
                ) {
                    amount = db[guid];
                } else {
                    amount = func(unitId);
                    if (amount !== undefined) {
                        db[guid] = amount;
                    } else {
                        amount = 0;
                    }
                }
            } else {
                amount = 0;
            }
        } else {
            amount = 0;
        }
        return amount;
    }
    getUnitTimeToDie(unitId: string, effectiveHealth?: boolean, guid?: string) {
        let timeToDie = infinity;
        guid = guid || this.ovaleGuid.getUnitGUID(unitId);
        if (guid) {
            let health = this.getUnitHealth(unitId, guid) || 0;
            if (effectiveHealth) {
                health =
                    health +
                    this.getUnitAbsorb(unitId, guid) -
                    this.getUnitHealAbsorb(unitId, guid);
            }
            const maxHealth = this.getUnitHealthMax(unitId, guid);
            if (health && maxHealth > 0) {
                if (health == 0) {
                    timeToDie = 0;
                    delete this.firstSeen[guid];
                    delete this.lastUpdated[guid];
                } else if (maxHealth > 5) {
                    const [firstSeen, lastUpdated] = [
                        this.firstSeen[guid],
                        this.lastUpdated[guid],
                    ];
                    const damage = this.totalDamage[guid] || 0;
                    const healing = this.totalHealing[guid] || 0;
                    if (
                        firstSeen &&
                        lastUpdated &&
                        lastUpdated > firstSeen &&
                        damage > healing
                    ) {
                        timeToDie =
                            (health * (lastUpdated - firstSeen)) /
                            (damage - healing);
                    }
                }
            }
        }
        return timeToDie;
    }

    cleanState(): void {}
    initializeState(): void {}
    resetState(): void {}
}


text:
RELEASE=$1

svn copy -m "Branching for the $RELEASE release" http://svn.openlayers.org/trunk/openlayers http://svn.openlayers.org/branches/openlayers/$RELEASE


text:
package com.amazonaws.services.cloudfront.model.transform;

import java.util.ArrayList;

import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;

import com.amazonaws.services.cloudfront.model.*;
import com.amazonaws.transform.Unmarshaller;

import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * TagKeys StAX Unmarshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TagKeysStaxUnmarshaller implements Unmarshaller<TagKeys, StaxUnmarshallerContext> {

    public TagKeys unmarshall(StaxUnmarshallerContext context) throws Exception {
        TagKeys tagKeys = new TagKeys();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 1;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return tagKeys;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("Items", targetDepth)) {
                    tagKeys.withItems(new ArrayList<String>());
                    continue;
                }

                if (context.testExpression("Items/Key", targetDepth)) {
                    tagKeys.withItems(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return tagKeys;
                }
            }
        }
    }

    private static TagKeysStaxUnmarshaller instance;

    public static TagKeysStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new TagKeysStaxUnmarshaller();
        return instance;
    }
}


text:
from suds import *
from suds.client import Client
from sys import exit
from optparse import OptionParser
from aviary.util import *

# change these for other default locations and ports
wsdl = 'file:/var/lib/condor/aviary/services/job/aviary-job.wsdl'
types = ['BOOLEAN','EXPRESSION','FLOAT','INTEGER','STRING']

parser = build_basic_parser('Set job attributes remotely via SOAP.','http://localhost:39090/services/job/setJobAttribute')
parser.add_option('--name', action="store", dest='name', help='attribute name')
parser.add_option('--type', action="store", choices=(types), dest='type', help=str(types))
parser.add_option('--value', action="store", dest='value', help='attribute value')
parser.add_option('--cproc', action="store", dest='cproc', help="a cluster.proc id like '1.0' or '5.3'")
(opts,args) =  parser.parse_args()

# the joy that is optparse...
if opts.name is None:
	print 'You must provide an attribute name'
	parser.print_help()
	exit(1)

if opts.type is None:
	print 'You must provide an attribute type'
	parser.print_help()
	exit(1)

if opts.value is None:
	print 'You must provide an attribute value'
	parser.print_help()
	exit(1)

if opts.cproc is None:
	print 'You must provide a cluster.proc job id'
	parser.print_help()
	exit(1)

client = create_suds_client(opts,wsdl,None)
client.set_options(location=opts.url)

# set up our JobID
jobId = client.factory.create('ns0:JobID')
jobId.job = opts.cproc

# set up the Attribute
aviary_attr = client.factory.create('ns0:Attribute')
aviary_attr.name = opts.name
aviary_attr.type = opts.type
aviary_attr.value = opts.value

try:
	print 'invoking', opts.url, 'for job', opts.cproc
	result = client.service.setJobAttribute(jobId, aviary_attr)
except Exception, e:
	print "unable to access scheduler at: ", opts.url
	print e
	exit(1)

if result.code != "OK":
	print result.code,":", result.text


text:
/**
 * @file gui_utils.h
 * @brief some utils for GUI
 * @author Duboisset Philippe <duboisset.philippe@gmail.com>
 * @version 0.1b
 * @date (yyyy-mm-dd) 2013-07-13
 * Licence: MIT
 */

#ifndef _gui_utils_h
#define _gui_utils_h

#include "gui.h"

/**
 * @function gmemset
 * @brief fill a memory area with a given byte
 * @param void *ptr: memory address to fill
 * @param uint8_t fill: byte to fill with
 * @param uint16_t size: number of bytes to fill
 * @return none
 */
void gmemset(void /*@null@*/ *ptr, uint8_t fill, uint16_t size);

/**
 * @function ismemdiff
 * @brief compare memory areas
 * @param const void *_a: address of the first memory area
 * @param const void *_b: address of the second memory area
 * @param uint16_t size: size of the areas
 * @return true if areas are different, false otherwise
 */
bool ismemdiff(const void /*@null@*/ *_a, const void /*@null@*/ *_b, uint16_t size);

/**
 * @function gstrncpy
 * @brief copy a string into another one (shall be allocated first)
 * @param void *_dst: address of the destination buffer
 * @param const void *_src: address of the source buffer
 * @param uint16_t dstSize: string physical size
 * @return none
 */
void gstrncpy(void /*@null@*/ *_dst, const void /*@null@*/ *_src, uint16_t dstSize);

/**
 * @function gstrlen
 * @brief return the length of a string
 * @param const void *str: address of the string
 * @return uint16_t: string size
 */
uint16_t gstrlen(const void /*@null@*/ *str);

/**
 * @function AllocateAndCopyStr
 * @brief allocate and compy a string
 * @param const void *str: address of the source string; the source string will be copied into the new allocated string
 * @return void *: NULL if error, address to the allocated & copied string otherwise
 */
void /*@null@*/ * AllocateAndCopyStr(const void /*@null@*/ *str);

/**
 * @function GUI_Rect
 * @brief generate a rect_st
 * @param coord_t x, coord_t y, length_t w, length_t h: rect parameters
 * @return rect_st
 */
rect_st GUI_Rect(coord_t x, coord_t y, length_t w, length_t h);

/**
 * @function gmemcpy
 * @brief copy a memory area to another one
 * @param void *dst: where the source area will be copied
 * @param const void *src: the area to copy
 * @param uint16_t size: dst size (in byte)
 * @return none
 */
void gmemcpy(void /*@null@*/ *dst, const void /*@null@*/ *src, uint16_t size);

#endif


text:
/*Navigation Bootstrap Bar Changes*/

.navbar {
  background-color: #000 !important;
  background-image: linear-gradient(to bottom, #F9F9F9 0%, #F9F9F9 100%);
  border-color: #F9F9F9;
  border: 0 solid !important;

  -moz-box-shadow: 0 0 15px #888;
  -webkit-box-shadow: 0 0 15px#888;
  box-shadow: 0 0 15px #888;

  z-index: 20;
}
.navbar-inverse .navbar-toggle {
  border: 0 solid;
}
.navbar-inverse .navbar-toggle .icon-bar {
  background-color: #DB0000;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
  background-color: transparent;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
  border: 0 solid;
}

.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .active > a {
  background-image: -moz-linear-gradient(top, #F9F9F9 0%, #F9F9F9 100%);
  background-image: -webkit-linear-gradient(top, #F9F9F9 0%, #F9F9F9 100%);
  background-image: -o-linear-gradient(top, #F9F9F9 0%, #F9F9F9 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#F9F9F9), to(#F9F9F9));
  background-image: linear-gradient(to bottom, #F9F9F9 0%, #F9F9F9 100%);
  box-shadow: none;
  border-color: #DB0000 !important;
}

.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus {
  background-color: #F9F9F9;
}

.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
  color: #DB0000 !important;
  background-color: #F9F9F9;
  /*border-color: #DB0000 !important;*/
}
.navbar-inverse .navbar-brand, .navbar-inverse .navbar-nav > li > a {
  text-shadow: 0 0 0 rgba(0, 0, 0, 0);
}
.navbar-brand, .navbar-nav > li > a {
  transition: 0.5s all;
  font: 400 18px/1.3 'Oleo Script', Helvetica, sans-serif;
  color: #E85353 !important;
  border-bottom: 3px solid !important;
  border-color: #F9F9F9 !important;
  cursor: pointer !important;
}
.navbar-brand, .navbar-nav > li > a [class=navbar-brand] {
  color: #E85353 !important;
  border-bottom: 0 solid !important;
  font-size: 19px !important;
  font-weight: bold !important;
}

.navbar-brand, .navbar-nav > li > .active {
  color: #DB0000 !important;
  background-color: #F9F9F9;
  border-color: #DB0000 !important;
}

.navbar-brand {
  font: 400 10px/1.3 'Oleo Script', Helvetica, sans-serif;
  font-weight: bold;
  padding-top: 15px;
}

@media screen and (max-width: 1000px) {
  .navbar-nav > li > a {
    font: 400 12px/1.3 'Oleo Script', Helvetica, sans-serif;
  }
}

@media screen and (max-width: 775px) {
  .navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
    color: #E85353 !important;
    background-color: #F9F9F9;
    /*border-color: #DB0000 !important;*/
  }
  .navbar-brand, .navbar-nav > li > .active {
    color: #E85353 !important;
    background-color: #F9F9F9;
    border-color: transparent !important;
  }
}


text:
    <input
        class="admin__control-text"
        data-bind="
            value: $view().value,
            hasFocus: isEditing($view().index),
            autoselect,
            attr: {
                placeholder: $view().label
            },
            keyboard: {
                13: updateAndSave.bind($data, $view().index),
                27: endEdit.bind($data, $view().index)
            }"
        type="text">
    <button class="action-submit" type="button" attr="title: $t('Save all changes')" click="updateAndSave.bind($data, $view().index)">

    </button>

        <button class="action-delete" type="button" attr="title: $t('Delete bookmark')" click="removeView.bind($data, $view().index)">

        </button>

        <button class="action-edit" type="button" attr="title: $t('Edit bookmark')" click="editView.bind($data, $view().index)">

        </button>


text:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libperfctr.h"
#include "arch.h"

void setup_control(const struct perfctr_info *info,
		   struct perfctr_cpu_control *control)
{
    memset(control, 0, sizeof *control);
    switch (info->cpu_type) {
      case PERFCTR_ARM_XSC1:
      case PERFCTR_ARM_XSC2:
	control->nractrs = 1;
	control->pmc_map[0] = 0;
	control->evntsel[0] = 0x07; /* INSTRUCTIONS_EXECUTED */
	counting_mips = 1;
    }
}


text:
package com.joker.fourfun.ui.mode.contract;

import android.app.Activity;

/**
 * Created by joker on 2017/1/3.
 */

public interface ModeState {
    void setTheme(Activity activity);
}


text:
<?php

namespace Tienvx\Bundle\MbtBundle\Reducer\Random;

use Tienvx\Bundle\MbtBundle\Reducer\HandlerTemplate;

class RandomHandler extends HandlerTemplate
{
}


text:
package com.spring.springmvc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SpringTest st = new SpringTest();
		System.out.println(st.getClass().getResource("/"));
	}

}


text:
require 'google/apis/memcache_v1beta2/service.rb'
require 'google/apis/memcache_v1beta2/classes.rb'
require 'google/apis/memcache_v1beta2/representations.rb'

module Google
  module Apis
    # Cloud Memorystore for Memcached API
    #
    # Google Cloud Memorystore for Memcached API is used for creating and managing
    # Memcached instances in GCP.
    #
    # @see https://cloud.google.com/memorystore/
    module MemcacheV1beta2
      VERSION = 'V1beta2'
      REVISION = '20201109'

      # View and manage your data across Google Cloud Platform services
      AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
    end
  end
end


text:
<?php

namespace Kikala\FrontBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Kikala\FrontBundle\Entity\UserKikologue;
use Kikala\FrontBundle\Entity\Formation;
class DefaultController extends Controller
{
	 public function homeAction()
    {
        $em = $this->getDoctrine()->getEntityManager();

        $nbUser= $em->getRepository('KikalaFrontBundle:UserKikologue')->countUser();
        $nbFormation= $em->getRepository('KikalaFrontBundle:Formation')->countFormation();

        return $this->render('KikalaFrontBundle:Default:home.html.twig',array('nbUser' => $nbUser,
            'nbFormation' => $nbFormation));

    }

    public function legalAction()
    {
        return $this->render('KikalaFrontBundle:Default:legal.html.twig');
    }
     public function aboutAction()
    {
        return $this->render('KikalaFrontBundle:Default:about.html.twig');
    }
}


text:
cd /
if [ "`lsmod | grep wl1251`" ]
then
	notify-send -u normal "WLAN" "WLAN is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-no-connection.png
	ifconfig wlan0 down
	rmmod board_omap3pandora_wifi wl1251_sdio wl1251
else
	notify-send -u normal "WLAN" "WLAN is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-device-wired.png
	/etc/init.d/wl1251-init start
fi