text:
'use strict'
require('promise-polyfill')

const Code = require('code')
const Lab = require('lab')

const lab = module.exports.lab = Lab.script()
const describe = lab.describe
const expect = Code.expect
const it = lab.it

const coworkersTest = require('../index.js')
const createApp = require('./fixtures/create-coworkers-app.js')

describe('coworkers-test functional test', function () {
  describe('assertions', function () {
    describe('expectAck', function () {
      it('should assert ack - nack err', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('nack-queue', {})
          .expectAck()
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.equal('expected "ack" but got "nack"')
            done()
          })
      })
      it('should assert ack - no ack err', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('noop-queue', {})
          .expectAck()
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.equal('expected "ack" but got nothing')
            done()
          })
      })
      it('should assert ack - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('ack-queue', {})
          .expectAck()
          .expect(done)
      })
      it('should assert ack - Promise no ack err', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('noop-queue', {})
          .expectAck()
          .expect()
          .then(function () {
            done(new Error('expected an error'))
          })
          .catch(function (err) {
            expect(err).to.exist()
            expect(err.message).to.equal('expected "ack" but got nothing')
            done()
          })
      })
      it('should assert ack - Promise success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('ack-queue', {})
          .expectAck()
          .expect()
          .then(function () {
            done()
          })
          .catch(done)
      })
      it('should assert ack - success w/ props and fields', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('ack-queue', {}, {}, {})
          .expectAck()
          .expect(done)
      })
    })

    describe('expectNack', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('nack-queue', {})
          .expectNack()
          .expect(done)
      })
    })

    describe('expectAckAll', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('ack-all-queue', {})
          .expectAckAll()
          .expect(done)
      })
    })

    describe('expectNackAll', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('nack-all-queue', {})
          .expectNackAll()
          .expect(done)
      })
    })

    describe('expectReject', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('reject-queue', {})
          .expectReject()
          .expect(done)
      })
    })

    describe('expectRequest', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('request-queue', {})
          .expectRequest('queue-name', 'content', {})
          .expect(done)
      })

      it('should assert - error', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('request-queue', {})
          .expectRequest('queue-name', 'ERRORCONTENT', {})
          .expectRequest('queue-name', 'ERRORCONTENT', {})
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/ERRORCONTENT/)
            done()
          })
      })

      it('should assert - error order', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('request-queue', {})
          .expectRequest('queue-name', 'ERRORCONTENT', {})
          .expectNack()
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/ERRORCONTENT/)
            done()
          })
      })

      it('should assert - error order2', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('request-queue', {})
          .expectNack()
          .expectRequest('queue-name', 'ERRORCONTENT', {})
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/expected "nack" but got "ack"/)
            done()
          })
      })
    })

    describe('expectReply', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('reply-queue', {})
          .expectReply('content', {})
          .expect(done)
      })

      it('should assert - error', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('reply-queue', {})
          .expectReply('ERRORCONTENT', {})
          .expectReply('ERRORCONTENT', {})
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/ERRORCONTENT/)
            done()
          })
      })
    })

    describe('stubContext', function () {
      it('should allow stubbing context', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('reply-queue', {})
          .stubContext(function (ctx) {
            ctx.request.resolves({ foo: 1 })
            done()
          })
          .expectReply('content', {})
          .expect(function () {
            // noop
          })
      })
    })

    describe('expectCheckQueue', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('check-queue', {})
          .expectCheckQueue('queue-name')
          .expect(done)
      })

      it('should assert - error', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('check-queue', {})
          .expectCheckQueue('ERRORQUEUE')
          .expectCheckQueue('ERRORQUEUE')
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/ERRORQUEUE/)
            done()
          })
      })
    })

    describe('expectCheckReplyQueue', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('check-reply-queue', {})
          .expectCheckReplyQueue()
          .expect(done)
      })

      it('should assert - error', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('check-reply-queue', {})
          .expectCheckReplyQueue('ERRORQUEUE')
          .expectCheckReplyQueue('ERRORQUEUE')
          .expect(function (err) {
            expect(err).to.exist()
            expect(err.message).to.match(/ERRORQUEUE/)
            done()
          })
      })
    })

    describe('expect', function () {
      it('should assert - success', function (done) {
        const app = createApp()
        coworkersTest(app)
          .send('reject-queue', {})
          .expect(done)
      })
    })

    describe('double assertions', function () {
      describe('expectAck', function () {
        it('should error due to double call', function (done) {
          const app = createApp()
          expect(function () {
            coworkersTest(app)
              .send('ack-queue', {})
              .expectAck()
              .expectAck()
          }).to.throw(/already expecting/)
          done()
        })
      })

      describe('expectNack', function () {
        it('should error due to double call', function (done) {
          const app = createApp()
          expect(function () {
            coworkersTest(app)
              .send('nack-queue', {})
              .expectNack()
              .expectNack()
          }).to.throw(/already expecting/)
          done()
        })
      })

      describe('expectAckAll', function () {
        it('should error due to double call', function (done) {
          const app = createApp()
          expect(function () {
            coworkersTest(app)
              .send('ack-all-queue', {})
              .expectAckAll()
              .expectAckAll()
          }).to.throw(/already expecting/)
          done()
        })
      })

      describe('expectNackAll', function () {
        it('should error due to double call', function (done) {
          const app = createApp()
          expect(function () {
            coworkersTest(app)
              .send('nack-all-queue', {})
              .expectNackAll()
              .expectNackAll()
          }).to.throw(/already expecting/)
          done()
        })
      })

      describe('expectReject', function () {
        it('should error due to double call', function (done) {
          const app = createApp()
          expect(function () {
            coworkersTest(app)
              .send('reject-queue', {})
              .expectReject()
              .expectReject()
          }).to.throw(/already expecting/)
          done()
        })
      })
    })
  })
})


text:
(function ($) {

  $.extend({
    advantagePageInit: function () {
      imgLazyLoad();
    }
  });

})(jQuery);

jQuery(function () {
  $.advantagePageInit();
});

redpajama_set_name: RedPajamaGithub


text:
Help us to make this project better by contributing. Whether it's new features, bug fixes, or simply improving documentation, your contributions are welcome. Please start with logging a [github issue][1] or submit a pull request.

Before you contribute, please review these guidelines to help ensure a smooth process for everyone.

Thanks.

## Issue reporting

* Please browse our [existing issues][1] before logging new issues.
* Check that the issue has not already been fixed in the `main` branch.
* Open an issue with a descriptive title and a summary.
* Please be as clear and explicit as you can in your description of the problem.
* Please state the version of Clojure and Clara you are using in the description.
* Include any relevant code in the issue summary.

## Pull requests

* Read [how to properly contribute to open source projects on Github][2].
* Fork the project.
* Use a feature branch.
* Write [good commit messages][3].
* Use the same coding conventions as the rest of the project.
* Commit locally and push to your fork until you are happy with your contribution.
* Make sure to add tests and verify all the tests are passing when merging upstream.
* Add an entry to the [Changelog][4] accordingly.
* Please add your name to the CONTRIBUTORS.md file. Adding your name to the CONTRIBUTORS.md file signifies agreement to all rights and reservations provided by the [License][5].
* [Squash related commits together][6].
* Open a [pull request][7].
* The pull request will be reviewed by the community and merged by the project committers.

[1]: https://github.com/cerner/clara-rules/issues
[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[4]: ./CHANGELOG.md
[5]: ./LICENSE
[6]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
[7]: https://help.github.com/articles/using-pull-requests


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="@color/colorPrimary" />
    <corners android:radius="50dp" />
</shape>


text:
<?php
namespace Telegraph\Middleware;

use Telegraph\Middleware\FormContentHandler;
use Zend\Diactoros\Response;

class FormContentHandlerTest extends AbstractContentHandlerTest
{
    public function requestData()
    {
        return [
            ['POST'],
            ['PUT'],
            ['DELETE'],
            ['other'],
        ];
    }

    /**
     * @dataProvider requestData
     */
    public function testInvokeWithApplicableMimeType($method)
    {
        $request = $this->getRequest(
            $method,
            $mime = 'application/x-www-form-urlencoded',
            http_build_query($body = ['test' => 'form'], '', '&')
        );

        $next = function ($request) use ($mime, $body) {
            $this->assertSame($mime, $request->getHeaderLine('Content-Type'));
            $this->assertSame($body, $request->getParsedBody());
            return new Response();
        };

        $handler = new FormContentHandler();
        $resolved = $handler($request, $next);
    }

    public function testInvokeWithInvalidMethod()
    {
        $request = $this->getRequest(
            $method = 'GET',
            $mime = 'application/x-www-form-urlencoded'
        );

        $next = function ($request) use ($mime) {
            $this->assertSame($mime, $request->getHeaderLine('Content-Type'));
            $this->assertEmpty($request->getParsedBody());
            return new Response();
        };

        $handler = new FormContentHandler();
        $resolved = $handler($request, $next);
    }

    public function testInvokeWithNonApplicableMimeType()
    {
        $request = $this->getRequest(
            $method = 'POST',
            $mime = 'application/json',
            $body = json_encode((object) ['test' => 'json'])
        );

        $next = function ($request) use ($mime) {
            $this->assertSame($mime, $request->getHeaderLine('Content-Type'));
            $this->assertNull($request->getParsedBody());
            return new Response();
        };

        $handler = new FormContentHandler();
        $resolved = $handler($request, $next);
    }
}


text:
/**
 * @file Switcher
 */

export default from './Switcher';


text:
class Nifi < Formula
  desc "Easy to use, powerful, and reliable system to process and distribute data"
  homepage "https://nifi.apache.org"
  url "https://www.apache.org/dyn/closer.cgi?path=/nifi/1.4.0/nifi-1.4.0-bin.tar.gz"
  sha256 "d67c90deb50ed5fee44e7ebf61fbf870f2e97cf1c82ad0f598ff5c4ef905ce99"

  bottle :unneeded

  depends_on :java => "1.8+"

  def install
    libexec.install Dir["*"]

    ENV["NIFI_HOME"] = libexec

    bin.install libexec/"bin/nifi.sh" => "nifi"
    bin.env_script_all_files libexec/"bin/", :NIFI_HOME => libexec
  end

  test do
    system bin/"nifi", "status"
  end
end


text:
<?php

namespace Nelmio\ApiDocBundle\Tests;

use Nelmio\ApiDocBundle\ApiDocGenerator;
use Nelmio\ApiDocBundle\Describer\DefaultDescriber;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

class ApiDocGeneratorTest extends TestCase
{
    public function testCache()
    {
        $adapter = new ArrayAdapter();
        $generator = new ApiDocGenerator([new DefaultDescriber()], [], $adapter);

        $this->assertEquals(json_encode($generator->generate()), json_encode($adapter->getItem('openapi_doc')->get()));
    }

    public function testCacheWithCustomId()
    {
        $adapter = new ArrayAdapter();
        $generator = new ApiDocGenerator([new DefaultDescriber()], [], $adapter, 'custom_id');

        $this->assertEquals(json_encode($generator->generate()), json_encode($adapter->getItem('custom_id')->get()));
    }
}


text:
This project is an example implementations of Prim's algorithm for finding
a **minimum spanning tree** of a completely connected, undirected graph.  The
graph is a set of points where there is an edge from every vertex to every
other vertex.  The goal is to find a set of edges that connect all points
with minimum length of the resulting edges.  The weight of each edge is the
distance between vertices.

The 'data' directory contains files with sets of points.  Each line describes
a single point in the form of an x-value, a tab character, and a y-value.

```
make
./mst ../data/graph-100.dat
./mst --csv ../data/graph-100.dat > ../data/graph-100.csv
```

## PLOT

This sub-project generates a tool to graph the minimum spanning tree output
from "mst --csv".  See plot/README for more information.

```
make
./mstplot ../data/graph-100.csv
```

## PLOT-JAVA

This sub-project is a rewrite of PLOT in Java.
See plot/README.md for more information.

```
ant
./mstplot       # a script to run the JAR on all of the data
```


text:
<!DOCTYPE html>

    <title>Hello World! </title>

You are now authenticated under

Username :

Password:


text:
package org.streetartgangs.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Marko Karjalainen <markotfk@gmail.com>
 */
@Entity
@XmlRootElement
public class Gang implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long dbId;

    @Column(unique=true)
    private Long id;

    public Long getId() {
        return id;
    }

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

    private String name;

    private String color;

    @OneToMany
    private List<StreetArtUser> users;

    public List<StreetArtUser> getUsers() {
        return users;
    }

    public void setUsers(List<StreetArtUser> users) {
        this.users = users;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getName() {
        return name;
    }

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

    public Long getDbId() {
        return dbId;
    }

    public void setDbId(Long dbId) {
        this.dbId = dbId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dbId != null ? dbId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gang)) {
            return false;
        }
        Gang other = (Gang) object;
        if ((this.dbId == null && other.dbId != null) || (this.dbId != null && !this.dbId.equals(other.dbId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.streetartgangs.entities.Gang[ id=" + dbId + " ]";
    }

}


text:
#ifndef VP9_COMMON_VP9_SEG_COMMON_H_
#define VP9_COMMON_VP9_SEG_COMMON_H_

#include "vp9/common/vp9_prob.h"

#define SEGMENT_DELTADATA   0
#define SEGMENT_ABSDATA     1

#define MAX_SEGMENTS     8
#define SEG_TREE_PROBS   (MAX_SEGMENTS-1)

#define PREDICTION_PROBS 3

// Segment level features.
typedef enum {
  SEG_LVL_ALT_Q = 0,               // Use alternate Quantizer ....
  SEG_LVL_ALT_LF = 1,              // Use alternate loop filter value...
  SEG_LVL_REF_FRAME = 2,           // Optional Segment reference frame
  SEG_LVL_SKIP = 3,                // Optional Segment (0,0) + skip mode
  SEG_LVL_MAX = 4                  // Number of features supported
} SEG_LVL_FEATURES;

struct segmentation {
  uint8_t enabled;
  uint8_t update_map;
  uint8_t update_data;
  uint8_t abs_delta;
  uint8_t temporal_update;

  vp9_prob tree_probs[SEG_TREE_PROBS];
  vp9_prob pred_probs[PREDICTION_PROBS];

  int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
  unsigned int feature_mask[MAX_SEGMENTS];
};

int vp9_segfeature_active(const struct segmentation *seg,
                          int segment_id,
                          SEG_LVL_FEATURES feature_id);

void vp9_clearall_segfeatures(struct segmentation *seg);

void vp9_enable_segfeature(struct segmentation *seg,
                           int segment_id,
                           SEG_LVL_FEATURES feature_id);

int vp9_seg_feature_data_max(SEG_LVL_FEATURES feature_id);

int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id);

void vp9_set_segdata(struct segmentation *seg,
                     int segment_id,
                     SEG_LVL_FEATURES feature_id,
                     int seg_data);

int vp9_get_segdata(const struct segmentation *seg,
                    int segment_id,
                    SEG_LVL_FEATURES feature_id);

extern const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)];

#endif  // VP9_COMMON_VP9_SEG_COMMON_H_


text:
#ifndef ARM_COMPUTE_GPUTARGET_H
#define ARM_COMPUTE_GPUTARGET_H

#include "support/Traits.h"

#include <string>

namespace arm_compute
{
/** Available GPU Targets */
enum class GPUTarget
{
    UNKNOWN             = 0x101,
    GPU_ARCH_MASK       = 0xF00,
    GPU_GENERATION_MASK = 0x0F0,
    MIDGARD             = 0x100,
    BIFROST             = 0x200,
    VALHALL             = 0x300,
    T600                = 0x110,
    T700                = 0x120,
    T800                = 0x130,
    G71                 = 0x210,
    G72                 = 0x220,
    G51                 = 0x221,
    G51BIG              = 0x222,
    G51LIT              = 0x223,
    G31                 = 0x224,
    G76                 = 0x230,
    G52                 = 0x231,
    G52LIT              = 0x232,
    G77                 = 0x310,
    G57                 = 0x311,
    G78                 = 0x320,
    G68                 = 0x321,
    G78AE               = 0x330,
    G710                = 0x340,
    G610                = 0x341,
    G510                = 0x342,
    G310                = 0x343,
    G715                = 0x350,
    G615                = 0x351,
};

/** Enable bitwise operations on GPUTarget enumerations */
template <>
struct enable_bitwise_ops<arm_compute::GPUTarget>
{
    static constexpr bool value = true; /**< Enabled. */
};

/** Translates a given gpu device target to string.
 *
 * @param[in] target Given gpu target.
 *
 * @return The string describing the target.
 */
const std::string &string_from_target(GPUTarget target);

/** Helper function to get the GPU target from a device name
 *
 * @param[in] device_name A device name
 *
 * @return the GPU target
 */
GPUTarget get_target_from_name(const std::string &device_name);

/** Helper function to get the GPU arch
 *
 * @param[in] target GPU target
 *
 * @return the GPU target which shows the arch
 */
GPUTarget get_arch_from_target(GPUTarget target);
/** Helper function to check whether a gpu target is equal to the provided targets
 *
 * @param[in] target_to_check gpu target to check
 * @param[in] target          First target to compare against
 * @param[in] targets         (Optional) Additional targets to compare with
 *
 * @return True if the target is equal with at least one of the targets.
 */
template <typename... Args>
bool gpu_target_is_in(GPUTarget target_to_check, GPUTarget target, Args... targets)
{
    return (target_to_check == target) | gpu_target_is_in(target_to_check, targets...);
}

/** Variant of gpu_target_is_in for comparing two targets */
inline bool gpu_target_is_in(GPUTarget target_to_check, GPUTarget target)
{
    return target_to_check == target;
}
} // namespace arm_compute
#endif /* ARM_COMPUTE_GPUTARGET_H */


text:
<?php

if (!defined('_PS_VERSION_'))
	exit;

class BlockMyAccount extends Module
{
	public function __construct()
	{
		$this->name = 'blockmyaccount';
		$this->tab = 'front_office_features';
		$this->version = '1.2';
		$this->author = 'PrestaShop';
		$this->need_instance = 0;

		parent::__construct();

		$this->displayName = $this->l('My Account block');
		$this->description = $this->l('Displays a block with links relative to a user\'s account.');
	}

	public function install()
	{
		if (!$this->addMyAccountBlockHook()
			|| !parent::install()
			|| !$this->registerHook('displayLeftColumn')
			|| !$this->registerHook('displayHeader'))
			return false;
		return true;
	}

	public function uninstall()
	{
		return (parent::uninstall() && $this->removeMyAccountBlockHook());
	}

	public function hookDisplayLeftColumn($params)
	{
		if (!$this->context->customer->isLogged())
			return false;

		$this->smarty->assign(array(
			'voucherAllowed' => CartRule::isFeatureActive(),
			'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN'),
			'HOOK_BLOCK_MY_ACCOUNT' => Hook::exec('displayMyAccountBlock'),
		));
		return $this->display(__FILE__, $this->name.'.tpl');
	}

	public function hookDisplayRightColumn($params)
	{
		return $this->hookDisplayLeftColumn($params);
	}

	public function hookDisplayFooter($params)
	{
		return $this->hookDisplayLeftColumn($params);
	}

	private function addMyAccountBlockHook()
	{
		return Db::getInstance()->execute('INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`, `description`, `position`) VALUES (\'displayMyAccountBlock\', \'My account block\', \'Display extra informations inside the "my account" block\', 1)');
	}

	private function removeMyAccountBlockHook()
	{
		return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'hook` WHERE `name` = \'displayMyAccountBlock\'');
	}

	public function hookDisplayHeader($params)
	{
		$this->context->controller->addCSS(($this->_path).'blockmyaccount.css', 'all');
	}
}


text:
class Tr8n::Api::V1::LanguageController < Tr8n::Api::V1::BaseController

  # for ssl access to the translator - using ssl_requirement plugin
  ssl_allowed :translate  if respond_to?(:ssl_allowed)

  def index
    if params[:locale].blank?
      return render_error("Locale must be provided")
    end

    lang = Tr8n::Language.for(params[:locale])
    unless lang
      return render_error("Unknown language locale")
    end

    render_response(lang.to_api_hash(:definition => true))
  end

  def all
    render_response(Tr8n::Language.order('english_name asc').all)
  end

  def enabled
    render_response(Tr8n::Language.enabled_languages)
  end

  def featured
    render_response(Tr8n::Language.featured_languages)
  end

  # deprecated - has been moved to proxy API
  def translate
    domain = Tr8n::TranslationDomain.find_or_create(request.env['HTTP_REFERER'])
    language = Tr8n::Language.for(params[:language] || params[:locale]) || tr8n_current_language
    Tr8n::Config.set_application(domain.application)
    Tr8n::Config.set_language(language)

    return render_response(translate_phrase(language, params, {:source => source, :api => :translate, :application => domain.application})) if params[:label]

    # API signature
    # {:source => "", :language => "", :phrases => [{:label => ""}]}

    # get all phrases for the specified source
    # this can be used by a parallel application or a JavaScript Client SDK that needs to build a page cache
    if params[:batch] == "true" or params[:cache] == "true"
      if params[:sources].blank? and params[:source].blank?
        return render_response({"error" => "No source/sources have been provided for the batch request."})
      end

      source_names = params[:sources] || [params[:source]]
      sources = Tr8n::TranslationSource.find(:all, :conditions => ["source in (?)", source_names])
      source_ids = sources.collect{|source| source.id}

      if source_ids.empty?
        conditions = ["1=2"]
      else
        conditions = ["(id in (select distinct(translation_key_id) from tr8n_translation_key_sources where translation_source_id in (?)))"]
        conditions << source_ids.uniq
      end

      translations = []
      Tr8n::TranslationKey.find(:all, :conditions => conditions).each_with_index do |tkey, index|
        trn = tkey.translate(language, {}, {:source => source, :url => source, :api => :cache})
        translations << trn
      end

      return render_response({:phrases => translations})
    elsif params[:phrases]

      if params[:phrases].is_a?(String)
        phrases = []
        begin
          phrases = HashWithIndifferentAccess.new({:data => JSON.parse(params[:phrases])})[:data]
        rescue Exception => ex
          return render_error("Invalid request. JSON parsing failed: #{ex.message}")
        end
      else
        phrases = params[:phrases]
      end

      translations = []
      phrases.each do |phrase|
        phrase = {:label => phrase} if phrase.is_a?(String)
        language = phrase[:locale].blank? ? Tr8n::Config.default_language.locale : (Tr8n::Language.for(phrase[:locale]) || Tr8n::Language.find_by_google_key(phrase[:locale]))

        translations << translate_phrase(language, phrase, {:source => source, :url => request.env['HTTP_REFERER'], :api => :translate, :locale => language.locale, :application => domain.application})
      end

      return render_response({:phrases => translations})
    end

    render_response(:phrases => [])
  rescue Tr8n::KeyRegistrationException => ex
    render_response({"error" => ex.message})
  end

private

  def translate_phrase(language, phrase, opts = {})
    return "" if phrase[:label].strip.blank?
    translation_key = Tr8n::TranslationKey.find_or_create(phrase[:label], phrase[:description], opts)
    translation_key.translate(language, {}, opts)
  end

end


text:
#ifndef ARM_COMPUTE_TEST_ALEXNET_CONVOLUTION_LAYER_DATASET
#define ARM_COMPUTE_TEST_ALEXNET_CONVOLUTION_LAYER_DATASET

#include "tests/datasets/ConvolutionLayerDataset.h"

#include "utils/TypePrinter.h"

#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"

namespace arm_compute
{
namespace test
{
namespace datasets
{
class AlexNetWinogradLayerDataset final : public ConvolutionLayerDataset
{
public:
    AlexNetWinogradLayerDataset()
    {
        add_config(TensorShape(13U, 13U, 256U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 192U), TensorShape(192U), TensorShape(13U, 13U, 192U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 128U), TensorShape(128U), TensorShape(13U, 13U, 128U), PadStrideInfo(1, 1, 1, 1));
    }
};

class AlexNetConvolutionLayerDataset final : public ConvolutionLayerDataset
{
public:
    AlexNetConvolutionLayerDataset()
    {
        add_config(TensorShape(227U, 227U, 3U), TensorShape(11U, 11U, 3U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U), PadStrideInfo(4, 4, 0, 0));
        add_config(TensorShape(27U, 27U, 48U), TensorShape(5U, 5U, 48U, 128U), TensorShape(128U), TensorShape(27U, 27U, 128U), PadStrideInfo(1, 1, 2, 2));
        add_config(TensorShape(13U, 13U, 256U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 192U), TensorShape(192U), TensorShape(13U, 13U, 192U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 128U), TensorShape(128U), TensorShape(13U, 13U, 128U), PadStrideInfo(1, 1, 1, 1));
    }
};

class AlexNetDirectConvolutionLayerDataset final : public ConvolutionLayerDataset
{
public:
    AlexNetDirectConvolutionLayerDataset()
    {
        add_config(TensorShape(27U, 27U, 48U), TensorShape(5U, 5U, 48U, 128U), TensorShape(128U), TensorShape(27U, 27U, 128U), PadStrideInfo(1, 1, 2, 2));
        add_config(TensorShape(13U, 13U, 256U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 192U), TensorShape(192U), TensorShape(13U, 13U, 192U), PadStrideInfo(1, 1, 1, 1));
        add_config(TensorShape(13U, 13U, 192U), TensorShape(3U, 3U, 192U, 128U), TensorShape(128U), TensorShape(13U, 13U, 128U), PadStrideInfo(1, 1, 1, 1));
    }
};
} // namespace datasets
} // namespace test
} // namespace arm_compute
#endif /* ARM_COMPUTE_TEST_ALEXNET_CONVOLUTION_LAYER_DATASET */


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Frames;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author hectorlv
 */
public final class Inventario extends javax.swing.JFrame {

    Conexion con = new Conexion();  //Creación de un objeto de tipo Conexion llamado con
    Connection cn = con.conexion(); //Creacion de objeto de tipo con llamado cn
    String sql ="";                 //Inicialización de la variable sql como cadena vacía
    String idOriginal;
    /**
     * Creates new form PantallaPrincipal
     */
    public Inventario() {
        initComponents();
        tablaVacia();
        nuevaTabla();
    }

    void tablaVacia(){
        DefaultTableModel modeloVacio = new DefaultTableModel();
        modeloVacio.addColumn("Id");
        modeloVacio.addColumn("Nombre");
        modeloVacio.addColumn("Cantidad");
        modeloVacio.addColumn("Precio Unitario");
        modeloVacio.addColumn("Descripción");
        tablaBusqueda.setModel(modeloVacio);
    }

    void nuevaTabla(){
        DefaultTableModel modelo = new DefaultTableModel();
        modelo.addColumn("Id");
        modelo.addColumn("Nombre");
        modelo.addColumn("Cantidad");
        modelo.addColumn("Precio Unitario");
        modelo.addColumn("Descripción");
        tablaInventario.setModel(modelo);
        tablaBusqueda.setModel(modelo);
        sql = "SELECT * FROM producto";
        String datos[] = new String [5];
        Statement st;
        try {
            st = cn.createStatement();
            ResultSet rs = st.executeQuery(sql);
            while(rs.next()){
                datos[0] = rs.getString(1);
                datos[1] = rs.getString(2);
                datos[2] = rs.getString(3);
                datos[3] = rs.getString(4);
                datos[4] = rs.getString(5);
                modelo.addRow(datos);
            }
            tablaInventario.setModel(modelo);
        } catch (SQLException ex) {
            Logger.getLogger(Inventario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    void limpiarCampos(){
        jTextField1.setText("");
        jTextField2.setText("");
        jTextField3.setText("");
        jTextField4.setText("");
        jTextField5.setText("");
    }

    void limpiarBusqueda(){
        textoModId.setText("");
        textoModNombre.setText("");
        textoModCantidad.setText("");
        textoModPrecio.setText("");
        textoModDescripcion.setText("");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jTextField4 = new javax.swing.JTextField();
        jTextField5 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablaInventario = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        textoModCantidad = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablaBusqueda = new javax.swing.JTable();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        textoModId = new javax.swing.JTextField();
        textoModNombre = new javax.swing.JTextField();
        textoModPrecio = new javax.swing.JTextField();
        botonModificar = new javax.swing.JButton();
        botonGuardarCambios = new javax.swing.JButton();
        textoModDescripcion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jTabbedPane1.setBackground(new java.awt.Color(204, 204, 204));

        jPanel2.setBackground(new java.awt.Color(204, 204, 204));

        jLabel1.setText("id del Producto");

        jLabel2.setText("Nombre del producto");

        jLabel3.setText("Cantidad");

        jLabel4.setText("Precio Unitario");

        jLabel5.setText("Descripción");

        jLabel6.setText("Ingrese la información del nuevo producto");

        jTextField2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField2ActionPerformed(evt);
            }
        });

        jTextField5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField5ActionPerformed(evt);
            }
        });

        jButton1.setForeground(new java.awt.Color(28, 45, 50));
        jButton1.setText("Guardar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Frames/nuevo-producto-01.png"))); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(110, 110, 110)
                        .addComponent(jLabel6))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(99, 99, 99)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButton1)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5))
                                .addGap(58, 58, 58)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addComponent(jLabel6)
                        .addGap(42, 42, 42)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton1))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(43, 43, 43))
        );

        jTabbedPane1.addTab("Agregar productos", jPanel2);

        tablaInventario.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane1.setViewportView(tablaInventario);

        jTabbedPane2.addTab("Total de productos", jScrollPane1);

        jTabbedPane1.addTab("Inventario general", jTabbedPane2);

        tablaBusqueda.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane2.setViewportView(tablaBusqueda);

        jLabel10.setText("Id del Producto");

        jLabel11.setText("Nombre del producto");

        jLabel12.setText("Cantidad");

        jLabel13.setText("Precio unitario");

        jLabel14.setText("Descripción");

        botonModificar.setText("Modificar");
        botonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonModificarActionPerformed(evt);
            }
        });

        botonGuardarCambios.setText("Guardar");
        botonGuardarCambios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGuardarCambiosActionPerformed(evt);
            }
        });

        jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Frames/inventario.png"))); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 840, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(33, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel11)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(textoModNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel12)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(textoModCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(textoModPrecio, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textoModDescripcion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel10)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(textoModId, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(68, 68, 68)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(botonModificar)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(botonGuardarCambios)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 91, Short.MAX_VALUE)
                                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(67, Short.MAX_VALUE))))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.LEADING))
                            .addContainerGap()))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textoModId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(botonModificar))
                        .addGap(13, 13, 13)
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(51, 51, 51)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel11)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(textoModNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(botonGuardarCambios)))
                        .addGap(50, 50, 50)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(textoModCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(43, 43, 43)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(textoModPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(37, 37, 37)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(textoModDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(81, 81, 81))
        );

        jTabbedPane1.addTab("Modificar producto", jPanel3);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 908, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1)
                .addContainerGap())
        );

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("Control de inventario");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(294, 294, 294)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(17, 17, 17))
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2ActionPerformed

    private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField5ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            PreparedStatement pps;
            pps = cn.prepareStatement("INSERT INTO producto (idProducto, nombreProducto, cantidad, precioProducto, descripcionProducto) VALUES (?,?,?,?,?)");
            pps.setString(1, jTextField1.getText());
            pps.setString(2, jTextField2.getText());
            pps.setString(3, jTextField3.getText());
            pps.setString(4, jTextField4.getText());
            pps.setString(5, jTextField5.getText());
            pps.executeUpdate();
            JOptionPane.showMessageDialog(null, "Datos Guardados");
            limpiarCampos();
            nuevaTabla();

        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Error");
            Logger.getLogger(Inventario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void botonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonModificarActionPerformed

        int fila;
        fila = tablaBusqueda.getSelectedRow();
        if(fila>=0){
            textoModId.setText(tablaBusqueda.getValueAt(fila, 0).toString());
            idOriginal=textoModId.getText();
            textoModNombre.setText(tablaBusqueda.getValueAt(fila, 1).toString());
            textoModCantidad.setText(tablaBusqueda.getValueAt(fila, 2).toString());
            textoModPrecio.setText(tablaBusqueda.getValueAt(fila, 3).toString());
            textoModDescripcion.setText(tablaBusqueda.getValueAt(fila, 4).toString());
        }
        else{
            JOptionPane.showMessageDialog(null, "Por favor seleccione un producto para modificar");
        }
    }//GEN-LAST:event_botonModificarActionPerformed

    private void botonGuardarCambiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarCambiosActionPerformed

        try {
            PreparedStatement pps = cn.prepareStatement("UPDATE producto SET idProducto='"+textoModId.getText()+"', nombreProducto='"+textoModNombre.getText()+"', cantidad='"+textoModCantidad.getText()+"', precioProducto='"+textoModPrecio.getText()+"', descripcionProducto='"+textoModDescripcion.getText()+"' WHERE idProducto='"+idOriginal+"'");
            pps.executeUpdate();
            JOptionPane.showMessageDialog(null, "Producto modificado con éxito");
            tablaVacia();
            limpiarBusqueda();
            nuevaTabla();
        } catch (SQLException ex) {
            Logger.getLogger(Inventario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_botonGuardarCambiosActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Inventario().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonGuardarCambios;
    private javax.swing.JButton botonModificar;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTable tablaBusqueda;
    private javax.swing.JTable tablaInventario;
    private javax.swing.JTextField textoModCantidad;
    private javax.swing.JTextField textoModDescripcion;
    private javax.swing.JTextField textoModId;
    private javax.swing.JTextField textoModNombre;
    private javax.swing.JTextField textoModPrecio;
    // End of variables declaration//GEN-END:variables
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Noco
{
	public class NocoMediasRequest:NocoRequest
	{
		public NocoMediasRequest(NocoAPI api, int showId) : base(api){
			this.queryStr = String.Format("/shows/{0}/medias", showId);
		}

		override protected void Parse(){
		}
	}

	///shows/%i/video/%@/%@", show.id_show,qualityKey,audioLang
	public class NocoVideoRequest:NocoRequest
	{
		public NocoVideo video = null;

		public NocoVideoRequest(NocoAPI api, int showId, string qualityKey = "HQ"/*LQ*/, string audioLang = "fr") : base(api){
			this.queryStr = String.Format("/shows/{0}/video/{1}/{2}", showId, qualityKey, audioLang);
		}

		override protected void Parse(){
			this.video = JsonUtility.FromJson <NocoVideo> (this.result);
		}
	}

	[Serializable]
	public class NocoVideo
	{
		// Video url
		public string file;
		public int code_reponse;
		public int cross_access;
		public int guest_free;
		public int is_abo;
		public string quality_key;
		public int quotafr_free;
		public int user_free;
	}
}


text:
import os, sys, re
from collections import defaultdict
from optparse import OptionParser

class FilterTrace:
    def __init__(self):
        # 2 pass parsing
        self.compiled_regexp = [] # regexp for 1st pass
        self.compiled_regexp2 = [] # regexp for 2nd pass
        self.final_text = [] # contains all lines before they are written to file
        self.previous_line = {} # index in self.final_text of previous status change per
				# tid + timestamp. So we can compute easily duration of
				# state for 1 tid

        # thread information
        self.tid_names = {} # process name per tid
        self.tid_states = defaultdict(int) # state per tid 0:RUNNING 1:QUEUED 2:SLEEPING
					   # 4:QUEUED or SLEEPING

        # error checking per tid
        self.t1_errors = defaultdict(int)
        self.t2_errors = defaultdict(int)
        self.t3_errors = defaultdict(int)

        # context switch info
        self.prev_tids = defaultdict(int) # previous tid per cpu when tracing new switch

        # Time (relative and absolute)
        self.last_timestamp_found = 0
        self.last_timestamp = 0
        self.reference_timestamp = 0 # time offset used in target script
        self.convert = 1 / 1000.0 #1.0 / 1 * 1000 # 32kHz -> ms conversion

        REGEXP_GLOSSARY = [

            ## irqs
            # <idle>-0     [001]   294.876831: irq_handler_entry: irq=30 name=arch_timer
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<foo>[\w+\.]+)\s+(?P<timestamp>\d+\.\d+):\s+' \
	     'irq_handler_entry:\s+irq=(?P<irq_id>\d+)\s+name=(?P<irq_name>[\w \.-_]+).*$',
		self.callback_irq_start_ftrace
	    ],
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<timestamp>\d+\.\d+):\s+irq_handler_entry:' \
	     '\s+irq=(?P<irq_id>\d+)\s+name=(?P<irq_name>[\w \.-_]+).*$',
		self.callback_irq_start_ftrace
	    ],
            # kworker/u:0-5     [000]   294.876862: irq_handler_exit: irq=30 ret=handled
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<foo>[\w+\.]+)\s+(?P<timestamp>\d+\.\d+):' \
	     '\s+irq_handler_exit:\s+irq=(?P<irq_id>\d+)\s+ret=.*$',
	     self.callback_irq_stop_ftrace
	    ],
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<timestamp>\d+\.\d+):\s+irq_handler_exit:\s+' \
	     'irq=(?P<irq_id>\d+)\s+ret=.*$',
	     self.callback_irq_stop_ftrace
	    ],

            ## scheduler
            #sh-2505  [000]   271.147491: sched_switch: prev_comm=sh prev_pid=2505 prev_prio=120
	    # prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<foo>[\w+\.]+)\s+(?P<timestamp>\d+\.\d+):\s+' \
	     'sched_switch:\s+.*==>\s+next_comm=(?P<next_task_name>[\w \.#-_/]+)\s+' \
	     'next_pid=(?P<next_tid>\d+)\s+next_prio.*$',
	     self.callback_context_switch_ftrace
	    ],
            ['^.*\[(?P<cpu_id>\d+)\]\s+(?P<timestamp>\d+\.\d+):\s+sched_switch:\s+.*==>\s+' \
	     'next_comm=(?P<next_task_name>[\w \.#-_/]+)\s+next_pid=(?P<next_tid>\d+)\s+' \
	     'next_prio.*$',
	     self.callback_context_switch_ftrace
	    ],
            ['^TIMESTAMP.*$', None],
            ['^.*$', self.callback_no_rule]
        ]

        REGEXP_GLOSSARY2 = [
            ['^Ref timestamp:\s*(?P<ref_time>\d+)$', self.callback_reference_timestamp],
            ['^.*psel.*$', None],
            ['^(?P<timestamp>\d+)\s+(?P<cpu_id>\d+)\s+(?P<task_name>[\w \.#-_/]+):(?P<tid>-?\d+)' \
	     '\s+(?P<state>\w+).*$',
	     self.callback_context_switch2
	    ],
            ['^Last timestamp:\s*(?P<last_timestamp>\d+).*$', self.callback_end2],
            ['^.*$', self.callback_no_rule2]
        ]

        # Compile all regexp
        for regexp_string, regexp_rules in REGEXP_GLOSSARY:
            self.compiled_regexp.append([re.compile(regexp_string), regexp_rules])

        for regexp_string, regexp_rules in REGEXP_GLOSSARY2:
            self.compiled_regexp2.append([re.compile(regexp_string), regexp_rules])

    def filter_line(self, line):
        # Parse all regexps
        for regexp, regexp_rules in self.compiled_regexp:
            # Test if regexp matches
            res = regexp.search(line)
            # if regexp match
            if res:
                # Execute regexp_rules
                if regexp_rules:
                    regexp_rules(res, line)
                # Only one regexp per line
                break

    def filter_line2(self):
        # Parse self.final_text to add duration of state per tid
        # Memorize index and timestamp of previous state change per tid and compute duration of
	# previous state when new state change is seen
        # For last state change, duration will be from state change until "Last timestamp"
        for line_index in range(0, len(self.final_text)):
            line = self.final_text[line_index]

            for regexp, regexp_rules in self.compiled_regexp2:
                # Test if regexp matches
                res = regexp.search(line)
                # if regexp match
                if res:
                    # Execute regexp_rules
                    if regexp_rules:
                        regexp_rules(res, line_index)
                    # Only one regexp per line
                    break

    def callback_context_switch_post(self, timestamp, cpu_id, next_tid, name, prev_tid,
				     prev_task_name, prev_state):
        self.last_timestamp = timestamp

        if (prev_task_name != ""):
            self.tid_names[prev_tid] = prev_task_name
            self.prev_tids[cpu_id] = prev_tid

	# short format requires storage of previous running thread per core
        if (cpu_id in self.prev_tids):
            prev_tid = self.prev_tids[cpu_id]

            if (prev_tid in self.tid_states):
                if (self.tid_states[prev_tid] > 0): # goes to queue/sleep but was not running
                    # choice is to do as if running and we keep simply trace of that
                    self.t1_errors[prev_tid] += 1

            if (prev_task_name != "") and (prev_state != ""):
                if (res.group('prev_state') == 'R'):
                    self.tid_states[prev_tid] = 1 # queued
                    new_state = "Q"
                else:
                    self.tid_states[prev_tid] = 2 # sleep
                    new_state = "S"

            else:
                self.tid_states[prev_tid] = 4 # Queued or sleep
                new_state = "X"

            # new state of previous thread if previous thread not seen for first time
            self.final_text.append("%-10d %s %-16s:%-5s %s" % (self.last_timestamp,
							       cpu_id,
							       self.tid_names[prev_tid],
							       prev_tid,
							       new_state))

        # handle "next task"
        if (next_tid == 0):
            next_tid = -cpu_id
        if (name == "swapper"):
            name += str(cpu_id)
        self.tid_names[next_tid] = name
        if (next_tid not in self.tid_states):
	    # consider was queued first time we see it to trigger no transition error
            self.tid_states[next_tid] = 1
        if (self.tid_states[next_tid] != 1): # process lifecycle: process must be queued to run
            # goes running but was not queued (missing wakeup ?)
            self.t2_errors[next_tid] += 1

        self.tid_states[next_tid] = 0 # running
        self.final_text.append("%-10s %s %-16s:%-5s R" % (self.last_timestamp,
							  cpu_id,
							  self.tid_names[next_tid],
							  next_tid))
        self.prev_tids[cpu_id] = next_tid

    def callback_context_switch_ftrace(self, res, line):
        timestamp = int(float(res.group('timestamp')) * 1000.0)
	if self.reference_timestamp == 0:
		self.reference_timestamp = timestamp
	timestamp = timestamp - self.reference_timestamp
        cpu_id = int(res.group('cpu_id'))
        name = res.group('next_task_name').rstrip(' ')
        tid = int(res.group('next_tid'))

        self.callback_context_switch_post(timestamp, cpu_id, tid, name, 0, "", "" )

    def callback_irq_start_ftrace(self, res, line):
        timestamp = int(float(res.group('timestamp')) * 1000.0)
	if self.reference_timestamp == 0:
		self.reference_timestamp = timestamp
	timestamp = timestamp - self.reference_timestamp
        cpu_id = int(res.group('cpu_id'))
        irq_id = int(res.group('irq_id'))
        irq_name = res.group('irq_name')
        self.final_text.append("%d %d irqin %d unknown_func %s 0x0" % (timestamp,
								       cpu_id,
								       irq_id,
								       irq_name))

    def callback_irq_stop_ftrace(self, res, line):
        timestamp = int(float(res.group('timestamp')) * 1000.0)
	if self.reference_timestamp == 0:
		self.reference_timestamp = timestamp
	timestamp = timestamp - self.reference_timestamp
        cpu_id = int(res.group('cpu_id'))
        irq_id = int(res.group('irq_id'))
        self.final_text.append("%d %d irqout %d" % (timestamp, cpu_id, irq_id))

    def callback_no_rule(self, res, line):
        self.final_text.append(line.rstrip('\n'))
        return

    def callback_end(self, res, line):
        if res != None:
            self.final_text.append(line.rstrip('\n'))
        else:
            self.final_text.append("Last timestamp: %d" % self.last_timestamp)

        self.last_timestamp_found = 1

        print("\nT1: goes to queued/sleep but was not running")
        keys = self.t1_errors.keys()
        keys.sort()
        for key in keys:
            print("%s: %s %d") % (self.tid_names[key], key, self.t1_errors[key])

        print("\nT2: goes running but was not queued (missing wakeup ?)")
        keys = self.t2_errors.keys()
        keys.sort()
        for key in keys:
            print("%s: %s %d") % (self.tid_names[key], key, self.t2_errors[key])

        print("\nT3: wakes up but was not sleeping")
        keys = self.t3_errors.keys()
        keys.sort()
        for key in keys:
            print("%s: %s %d") % (self.tid_names[key], key, self.t3_errors[key])

    def callback_context_switch2(self, res, line_index):
        tid = int(res.group('tid'))
        self.last_timestamp = int(res.group('timestamp'))

        # per tid, go back to previous line, compute stamp current - previous stamp and add
	# to previous line
        if (tid in self.previous_line):
            duration = self.last_timestamp - self.previous_line[tid][1]
            self.final_text[self.previous_line[tid][0]] = \
		self.final_text[self.previous_line[tid][0]] + \
		" %-10d (%-10d %.3f ms)" % (duration,
					    self.previous_line[tid][1] + self.reference_timestamp,
					    self.previous_line[tid][1] * self.convert)

        self.previous_line[tid] = [line_index, self.last_timestamp]

    def callback_reference_timestamp(self, res, line_index):
        self.reference_timestamp = int(res.group('ref_time'))

    def callback_end2(self, res, line_index):
        # add diff from last timestamp to current time to all tids
        if res != None:
            self.last_timestamp = int(res.group('last_timestamp'))

        # add timing to end of file for last switch of all threads
        for tid in self.previous_line:
            last_duration = self.last_timestamp - self.previous_line[tid][1]
            self.final_text[self.previous_line[tid][0]] = \
		self.final_text[self.previous_line[tid][0]] + \
		" %-10d (%-10d %.3f ms)" % (last_duration,
					    self.previous_line[tid][1] + self.reference_timestamp,
					    self.previous_line[tid][1] * self.convert)

        # dump everything
        print "\n%-9s %s %-15s:%-4s STA %-9s (%-10s)" % ("TIMESTAMP", "CPU", "NAME", "PID",
							 "DURATION", "ABS_TIME tick/REL_TIME ms")
        for i in range(0, len(self.final_text)):
            print self.final_text[i]

    def callback_no_rule2(self, res, line_index):
        return

global filterMaster
filterMaster = FilterTrace()

def Main(argv):
    usage = "Usage: %prog FILENAME [options]"
    parser = OptionParser(usage = usage)
    (options, args) = parser.parse_args()

    if len(args) != 1:
        print "Usage: type python <program>.py -h"
        return

    # First pass, fill each array index with 1 thread + its new status + timestamp
    # (basically 1 context switch will give 2 indexes, 1 wakeup 1 index)
    # only missing info is duration of state
    file = open(args[0], 'r')
    string = file.readline()

    while string:
        filterMaster.filter_line(string)
        string = file.readline()

    if filterMaster.last_timestamp_found == 0:
        filterMaster.callback_end(None, 0)

    # 2nd pass, add duration of state of tid
    filterMaster.filter_line2()

if __name__=="__main__":
    Main(sys.argv[1:])