text:
$:.unshift 'lib'

require "ruby-prof"
require 'mustache'
require "pathname"

template = """
{{#products}}

          {{external_index}}

{{/products}}
"""

data = {
  products: []
}

200.times do
  data[:products] << {
    :external_index=>"product",
    :url=>"/products/7",
    :image=>"products/product.jpg"
  }
end

# Uncomment to measure object allocations. Requires ruby 2.0.0
# RubyProf.measure_mode = RubyProf::ALLOCATIONS

view = Mustache.new
view.template = template
view.render # Call render once so the template will be compiled

RubyProf.start

500.times do
  view.render(data)
end

result = RubyProf.stop

printer = RubyProf::GraphHtmlPrinter.new(result)

Pathname.new(FileUtils.pwd).join("benchmarks/render_collection_profile.html").open("w+") do |file|
  printer.print(file, {})
end

redpajama_set_name: RedPajamaGithub


text:
<?php
class ControllerCommonColumnLeft extends Controller {
	public function index() {
		if (isset($this->request->get['user_token']) && isset($this->session->data['user_token']) && ($this->request->get['user_token'] == $this->session->data['user_token'])) {
			$this->load->language('common/column_left');
      $this->load->language('rosava/main');

			// Create a 3 level menu array
			// Level 2 can not have children

			// Menu
			$data['menus'][] = array(
				'id'       => 'menu-dashboard',
				'icon'	   => 'fa-dashboard',
				'name'	   => $this->language->get('text_dashboard'),
				'href'     => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
				'children' => array()
			);

			$rosava = array();

			if ($this->user->hasPermission('access', 'rosava/main')) {
				$rosava[] = array(
					'name'     => $this->language->get('text_menu_main'),
					'href'     => $this->url->link('rosava/main', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

      // Wherebuy
      $wherebuy = array();
      if ($this->user->hasPermission('access', 'rosava/wherebuy/wholesales')) {
        $wherebuy[] = array(
          'name'     => $this->language->get('text_menu_wholesales'),
          'href'     => $this->url->link('rosava/wherebuy/wholesales', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()
        );
      }

      if ($this->user->hasPermission('access', 'localisation/location')) {
        $wherebuy[] = array(
          'name'     => $this->language->get('text_menu_point'),
          'href'     => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()
        );
      }

      if ($wherebuy) {
        $rosava[] = array(
          'name'     => $this->language->get('text_menu_wherebuy'),
          'href'     => '',
          'children' => $wherebuy
        );
      }

      // News
      $news = array();
      if ($this->user->hasPermission('access', 'rosava/news/newscomp')) {
        $news[] = array(
          'name'     => $this->language->get('text_menu_newscomp'),
          'href'     => $this->url->link('rosava/news/newscomp', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()
        );
      }

      if ($this->user->hasPermission('access', 'rosava/news/review')) {
        $news[] = array(
          'name'     => $this->language->get('text_review'),
          'href'     => $this->url->link('rosava/news/review', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()
        );
      }

      if ($news) {
        $rosava[] = array(
          'name'     => $this->language->get('text_menu_news'),
          'href'     => '',
          'children' => $news
        );
      }

      // Help
      $help = array();
			if ($this->user->hasPermission('access', 'rosava/glossary')) {
				$help[] = array(
					'name'     => $this->language->get('text_menu_glossary'),
					'href'     => $this->url->link('rosava/glossary', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

      if ($help) {
        $rosava[] = array(
          'name'     => $this->language->get('text_menu_help'),
          'href'     => '',
          'children' => $help
        );
      }

      if ($this->user->hasPermission('access', 'rosava/info')) {
        $rosava[] = array(
          'name'     => $this->language->get('text_menu_info'),
          'href'     => $this->url->link('rosava/info', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()
        );
      }

			if ($rosava) {
				$data['menus'][] = array(
					'id'       => 'menu-rosava',
					'icon'     => 'fa-car',
					'name'     => $this->language->get('text_menu_rosava'),
					'href'     => '',
					'children' => $rosava
				);
			}

			// Catalog
			$catalog = array();

			if ($this->user->hasPermission('access', 'catalog/category')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_category'),
					'href'     => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/product')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_product'),
					'href'     => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/recurring')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_recurring'),
					'href'     => $this->url->link('catalog/recurring', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/filter')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_filter'),
					'href'     => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			// Attributes
			$attribute = array();

			if ($this->user->hasPermission('access', 'catalog/attribute')) {
				$attribute[] = array(
					'name'     => $this->language->get('text_attribute'),
					'href'     => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/attribute_group')) {
				$attribute[] = array(
					'name'	   => $this->language->get('text_attribute_group'),
					'href'     => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($attribute) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_attribute'),
					'href'     => '',
					'children' => $attribute
				);
			}

			if ($this->user->hasPermission('access', 'catalog/option')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_option'),
					'href'     => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/manufacturer')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_manufacturer'),
					'href'     => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/download')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_download'),
					'href'     => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/review')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_review'),
					'href'     => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'catalog/information')) {
				$catalog[] = array(
					'name'	   => $this->language->get('text_information'),
					'href'     => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($catalog) {
				$data['menus'][] = array(
					'id'       => 'menu-catalog',
					'icon'	   => 'fa-tags',
					'name'	   => $this->language->get('text_catalog'),
					'href'     => '',
					'children' => $catalog
				);
			}

			// Extension
			$marketplace = array();

			if ($this->user->hasPermission('access', 'marketplace/marketplace')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_marketplace'),
					'href'     => $this->url->link('marketplace/marketplace', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketplace/installer')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_installer'),
					'href'     => $this->url->link('marketplace/installer', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketplace/extension')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_extension'),
					'href'     => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketplace/modification')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_modification'),
					'href'     => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketplace/event')) {
				$marketplace[] = array(
					'name'	   => $this->language->get('text_event'),
					'href'     => $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($marketplace) {
				$data['menus'][] = array(
					'id'       => 'menu-extension',
					'icon'	   => 'fa-puzzle-piece',
					'name'	   => $this->language->get('text_extension'),
					'href'     => '',
					'children' => $marketplace
				);
			}

			// Design
			$design = array();

			if ($this->user->hasPermission('access', 'design/layout')) {
				$design[] = array(
					'name'	   => $this->language->get('text_layout'),
					'href'     => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'design/theme')) {
				$design[] = array(
					'name'	   => $this->language->get('text_theme'),
					'href'     => $this->url->link('design/theme', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'design/translation')) {
				$design[] = array(
					'name'	   => $this->language->get('text_language_editor'),
					'href'     => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'design/banner')) {
				$design[] = array(
					'name'	   => $this->language->get('text_banner'),
					'href'     => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'design/seo_url')) {
				$design[] = array(
					'name'	   => $this->language->get('text_seo_url'),
					'href'     => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($design) {
				$data['menus'][] = array(
					'id'       => 'menu-design',
					'icon'	   => 'fa-television',
					'name'	   => $this->language->get('text_design'),
					'href'     => '',
					'children' => $design
				);
			}

			// Sales
			$sale = array();

			if ($this->user->hasPermission('access', 'sale/order')) {
				$sale[] = array(
					'name'	   => $this->language->get('text_order'),
					'href'     => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'sale/recurring')) {
				$sale[] = array(
					'name'	   => $this->language->get('text_recurring'),
					'href'     => $this->url->link('sale/recurring', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'sale/return')) {
				$sale[] = array(
					'name'	   => $this->language->get('text_return'),
					'href'     => $this->url->link('sale/return', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			// Voucher
			$voucher = array();

			if ($this->user->hasPermission('access', 'sale/voucher')) {
				$voucher[] = array(
					'name'	   => $this->language->get('text_voucher'),
					'href'     => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'sale/voucher_theme')) {
				$voucher[] = array(
					'name'	   => $this->language->get('text_voucher_theme'),
					'href'     => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($voucher) {
				$sale[] = array(
					'name'	   => $this->language->get('text_voucher'),
					'href'     => '',
					'children' => $voucher
				);
			}

			if ($sale) {
				$data['menus'][] = array(
					'id'       => 'menu-sale',
					'icon'	   => 'fa-shopping-cart',
					'name'	   => $this->language->get('text_sale'),
					'href'     => '',
					'children' => $sale
				);
			}

			// Customer
			$customer = array();

			if ($this->user->hasPermission('access', 'customer/customer')) {
				$customer[] = array(
					'name'	   => $this->language->get('text_customer'),
					'href'     => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'customer/customer_group')) {
				$customer[] = array(
					'name'	   => $this->language->get('text_customer_group'),
					'href'     => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'customer/customer_approval')) {
				$customer[] = array(
					'name'	   => $this->language->get('text_customer_approval'),
					'href'     => $this->url->link('customer/customer_approval', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'customer/custom_field')) {
				$customer[] = array(
					'name'	   => $this->language->get('text_custom_field'),
					'href'     => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($customer) {
				$data['menus'][] = array(
					'id'       => 'menu-customer',
					'icon'	   => 'fa-user',
					'name'	   => $this->language->get('text_customer'),
					'href'     => '',
					'children' => $customer
				);
			}

			// Marketing
			$marketing = array();

			if ($this->user->hasPermission('access', 'marketing/marketing')) {
				$marketing[] = array(
					'name'	   => $this->language->get('text_marketing'),
					'href'     => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketing/coupon')) {
				$marketing[] = array(
					'name'	   => $this->language->get('text_coupon'),
					'href'     => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'marketing/contact')) {
				$marketing[] = array(
					'name'	   => $this->language->get('text_contact'),
					'href'     => $this->url->link('marketing/contact', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($marketing) {
				$data['menus'][] = array(
					'id'       => 'menu-marketing',
					'icon'	   => 'fa-share-alt',
					'name'	   => $this->language->get('text_marketing'),
					'href'     => '',
					'children' => $marketing
				);
			}

			// System
			$system = array();

			if ($this->user->hasPermission('access', 'setting/setting')) {
				$system[] = array(
					'name'	   => $this->language->get('text_setting'),
					'href'     => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			// Users
			$user = array();

			if ($this->user->hasPermission('access', 'user/user')) {
				$user[] = array(
					'name'	   => $this->language->get('text_users'),
					'href'     => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'user/user_permission')) {
				$user[] = array(
					'name'	   => $this->language->get('text_user_group'),
					'href'     => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'user/api')) {
				$user[] = array(
					'name'	   => $this->language->get('text_api'),
					'href'     => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($user) {
				$system[] = array(
					'name'	   => $this->language->get('text_users'),
					'href'     => '',
					'children' => $user
				);
			}

			// Localisation
			$localisation = array();

			if ($this->user->hasPermission('access', 'localisation/language')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_language'),
					'href'     => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/currency')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_currency'),
					'href'     => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/stock_status')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_stock_status'),
					'href'     => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/order_status')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_order_status'),
					'href'     => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			// Returns
			$return = array();

			if ($this->user->hasPermission('access', 'localisation/return_status')) {
				$return[] = array(
					'name'	   => $this->language->get('text_return_status'),
					'href'     => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/return_action')) {
				$return[] = array(
					'name'	   => $this->language->get('text_return_action'),
					'href'     => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/return_reason')) {
				$return[] = array(
					'name'	   => $this->language->get('text_return_reason'),
					'href'     => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($return) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_return'),
					'href'     => '',
					'children' => $return
				);
			}

			if ($this->user->hasPermission('access', 'localisation/country')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_country'),
					'href'     => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/zone')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_zone'),
					'href'     => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/geo_zone')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_geo_zone'),
					'href'     => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			// Tax
			$tax = array();

			if ($this->user->hasPermission('access', 'localisation/tax_class')) {
				$tax[] = array(
					'name'	   => $this->language->get('text_tax_class'),
					'href'     => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/tax_rate')) {
				$tax[] = array(
					'name'	   => $this->language->get('text_tax_rate'),
					'href'     => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($tax) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_tax'),
					'href'     => '',
					'children' => $tax
				);
			}

			if ($this->user->hasPermission('access', 'localisation/length_class')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_length_class'),
					'href'     => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'localisation/weight_class')) {
				$localisation[] = array(
					'name'	   => $this->language->get('text_weight_class'),
					'href'     => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($localisation) {
				$system[] = array(
					'name'	   => $this->language->get('text_localisation'),
					'href'     => '',
					'children' => $localisation
				);
			}

			// Tools
			$maintenance = array();

			if ($this->user->hasPermission('access', 'tool/backup')) {
				$maintenance[] = array(
					'name'	   => $this->language->get('text_backup'),
					'href'     => $this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'tool/upload')) {
				$maintenance[] = array(
					'name'	   => $this->language->get('text_upload'),
					'href'     => $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'tool/log')) {
				$maintenance[] = array(
					'name'	   => $this->language->get('text_log'),
					'href'     => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($maintenance) {
				$system[] = array(
					'id'       => 'menu-maintenance',
					'icon'	   => 'fa-cog',
					'name'	   => $this->language->get('text_maintenance'),
					'href'     => '',
					'children' => $maintenance
				);
			}

			if ($system) {
				$data['menus'][] = array(
					'id'       => 'menu-system',
					'icon'	   => 'fa-cog',
					'name'	   => $this->language->get('text_system'),
					'href'     => '',
					'children' => $system
				);
			}

			$report = array();

			if ($this->user->hasPermission('access', 'report/report')) {
				$report[] = array(
					'name'	   => $this->language->get('text_reports'),
					'href'     => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'report/online')) {
				$report[] = array(
					'name'	   => $this->language->get('text_online'),
					'href'     => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			if ($this->user->hasPermission('access', 'report/statistics')) {
				$report[] = array(
					'name'	   => $this->language->get('text_statistics'),
					'href'     => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true),
					'children' => array()
				);
			}

			$data['menus'][] = array(
				'id'       => 'menu-report',
				'icon'	   => 'fa-bar-chart-o',
				'name'	   => $this->language->get('text_reports'),
				'href'     => '',
				'children' => $report
			);

			// Stats
			$this->load->model('sale/order');

			$order_total = $this->model_sale_order->getTotalOrders();

			$this->load->model('report/statistics');

			$complete_total = $this->model_report_statistics->getValue('order_complete');

			if ((float)$complete_total && $order_total) {
				$data['complete_status'] = round(($complete_total / $order_total) * 100);
			} else {
				$data['complete_status'] = 0;
			}

			$processing_total = $this->model_report_statistics->getValue('order_processing');

			if ((float)$processing_total && $order_total) {
				$data['processing_status'] = round(($processing_total / $order_total) * 100);
			} else {
				$data['processing_status'] = 0;
			}

			$other_total = $this->model_report_statistics->getValue('order_other');

			if ((float)$other_total && $order_total) {
				$data['other_status'] = round(($other_total / $order_total) * 100);
			} else {
				$data['other_status'] = 0;
			}

			return $this->load->view('common/column_left', $data);
		}
	}
}


text:
ActiveRecord::Schema.define(:version => 20130907083847) do

  create_table "artists", :force => true do |t|
    t.string   "name"
    t.text     "description"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "image"
    t.string   "location"
    t.datetime "start_date"
    t.datetime "end_date"
    t.string   "slug"
  end

  create_table "artists_releases", :id => false, :force => true do |t|
    t.integer "artist_id"
    t.integer "release_id"
  end

  create_table "assets", :force => true do |t|
    t.integer  "piece_id",    :null => false
    t.integer  "medium",      :null => false
    t.string   "title",       :null => false
    t.string   "description"
    t.string   "location"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "blog_comments", :force => true do |t|
    t.integer  "blog_post_id"
    t.integer  "user_id"
    t.string   "user_ip"
    t.string   "user_agent"
    t.string   "referrer"
    t.string   "name"
    t.string   "site_url"
    t.string   "email"
    t.text     "body"
    t.datetime "created_at"
  end

  add_index "blog_comments", ["blog_post_id"], :name => "index_blog_comments_on_blog_post_id"

  create_table "blog_images", :force => true do |t|
    t.string   "image_file_name"
    t.string   "image_content_type"
    t.integer  "image_file_size"
    t.datetime "image_updated_at"
    t.integer  "blog_post_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "blog_images", ["blog_post_id"], :name => "index_blog_images_on_blog_post_id"

  create_table "blog_posts", :force => true do |t|
    t.string   "title",                           :null => false
    t.text     "body"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "published",    :default => false, :null => false
    t.integer  "user_id"
    t.datetime "published_at"
  end

  create_table "blog_tags", :force => true do |t|
    t.integer "blog_post_id"
    t.string  "tag",          :null => false
  end

  add_index "blog_tags", ["blog_post_id"], :name => "index_blog_tags_on_blog_post_id"
  add_index "blog_tags", ["tag"], :name => "index_blog_tags_on_tag"

  create_table "links", :force => true do |t|
    t.integer  "artist_id"
    t.string   "location",   :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "pieces", :force => true do |t|
    t.integer "release_id",  :null => false
    t.integer "artist_id",   :null => false
    t.string  "title",       :null => false
    t.string  "description"
  end

  create_table "podcasts", :force => true do |t|
    t.string   "title",                         :null => false
    t.integer  "artist_id",                     :null => false
    t.string   "file_name",                     :null => false
    t.boolean  "available",  :default => false
    t.string   "genre",                         :null => false
    t.string   "cat_no",                        :null => false
    t.integer  "duration",                      :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "release_links", :force => true do |t|
    t.string   "location",   :null => false
    t.integer  "release_id", :null => false
    t.string   "vendor",     :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "link_type"
  end

  create_table "releases", :force => true do |t|
    t.string   "title"
    t.text     "long_desc"
    t.datetime "release_date"
    t.string   "short_desc"
    t.string   "cat"
    t.integer  "artist_id"
    t.boolean  "available"
  end

  create_table "track_lists", :force => true do |t|
    t.integer  "podcast_id", :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "tracks", :force => true do |t|
    t.integer  "track_list_id", :null => false
    t.string   "artist_title",  :null => false
    t.string   "label"
    t.integer  "position"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", :force => true do |t|
    t.string   "username"
    t.string   "email"
    t.string   "crypted_password"
    t.string   "password_salt"
    t.string   "persistence_token"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
#include "config.h"

#include <assert.h>
#include <string.h>

#ifdef WITH_BROKER
#  include "mosquitto_broker_internal.h"
#endif

#include "mosquitto.h"
#include "logging_mosq.h"
#include "memory_mosq.h"
#include "mqtt_protocol.h"
#include "packet_mosq.h"
#include "property_mosq.h"
#include "send_mosq.h"
#include "util_mosq.h"

int send__unsubscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, const mosquitto_property *properties)
{
	struct mosquitto__packet *packet = NULL;
	uint32_t packetlen;
	uint16_t local_mid;
	int rc;
	int i;
	size_t tlen;

	assert(mosq);
	assert(topic);

	packetlen = 2;
	for(i=0; i<topic_count; i++){
		tlen = strlen(topic[i]);
		if(tlen > UINT16_MAX){
			return MOSQ_ERR_INVAL;
		}
		packetlen += 2U+(uint16_t)tlen;
	}

	packet = mosquitto__calloc(1, sizeof(struct mosquitto__packet));
	if(!packet) return MOSQ_ERR_NOMEM;

	if(mosq->protocol == mosq_p_mqtt5){
		packetlen += property__get_remaining_length(properties);
	}

	packet->command = CMD_UNSUBSCRIBE | (1<<1);
	packet->remaining_length = packetlen;
	rc = packet__alloc(packet);
	if(rc){
		mosquitto__free(packet);
		return rc;
	}

	/* Variable header */
	local_mid = mosquitto__mid_generate(mosq);
	if(mid) *mid = (int)local_mid;
	packet__write_uint16(packet, local_mid);

	if(mosq->protocol == mosq_p_mqtt5){
		/* We don't use User Property yet. */
		property__write_all(packet, properties, true);
	}

	/* Payload */
	for(i=0; i<topic_count; i++){
		packet__write_string(packet, topic[i], (uint16_t)strlen(topic[i]));
	}

#ifdef WITH_BROKER
# ifdef WITH_BRIDGE
	for(i=0; i<topic_count; i++){
		log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
	}
# endif
#else
	for(i=0; i<topic_count; i++){
		log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
	}
#endif
	return packet__queue(mosq, packet);
}


text:
char kActiveTabSwitch[] = "active-tab";
char kChromeSwitch[] = "chrome";
char kChromiumSwitch[] = "chromium";
char kFirefoxSwitch[] = "firefox";
char kEdgeSwitch[] = "edge";
char kPatternSwitch[] = "pattern";
char kSafariSwitch[] = "safari";

char kFiltersSwitch[] = "filters";

#if defined(USE_OZONE) || defined(OS_MAC)
char kIdSwitch[] = "pid";
#else
char kIdSwitch[] = "window";
#endif  // defined(WINDOWS)

using ui::AXTreeSelector;

gfx::AcceleratedWidget CastToAcceleratedWidget(unsigned int window_id) {
#if defined(USE_OZONE) || defined(OS_MAC)
  return static_cast<gfx::AcceleratedWidget>(window_id);
#else
  return reinterpret_cast<gfx::AcceleratedWidget>(window_id);
#endif
}

// Convert from string to int, whether in 0x hex format or decimal format.
bool StringToInt(std::string str, unsigned* result) {
  if (str.empty())
    return false;
  bool is_hex =
      str.size() > 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X');
  return is_hex ? base::HexStringToUInt(str, result)
                : base::StringToUint(str, result);
}

namespace tools {

void PrintHelpShared() {
  printf("options:\n");
  PrintHelpTreeSelectors();
  PrintHelpFilters();

  PrintHelpFooter();
}

void PrintHelpTreeSelectors() {
  printf("  --pattern\ttitle of an application\n");
#if defined(WINDOWS)
  printf("  --window\tHWND of a window\n");
#else
  printf("  --pid\t\tprocess id of an application\n");
#endif
  printf("  pre-defined application selectors:\n");
  printf("    --chrome\tChrome browser\n");
  printf("    --chromium\tChromium browser\n");
#if defined(WINDOWS)
  printf("    --edge\tEdge browser\n");
#endif
  printf("    --firefox\tFirefox browser\n");
#if defined(OS_MAC)
  printf("    --safari\tSafari browser\n");
#endif
  printf(
      "  --active-tab\tactive tab of browser, if application is a browser\n");
}

void PrintHelpFilters() {
  printf(
      "  --filters\tfile containing property filters used to filter out\n"
      "  \t\taccessible tree, for example:\n"
      "  \t\t--filters=/absolute/path/to/filters/file\n");
}

void PrintHelpFooter() {
  printf(
      "\nmore info at "
      "https://www.chromium.org/developers/accessibility/testing/"
      "automated-testing/ax-inspect\n");
}

absl::optional<AXTreeSelector> TreeSelectorFromCommandLine(
    const base::CommandLine& command_line) {
  int selectors = AXTreeSelector::None;
  if (command_line.HasSwitch(kChromeSwitch)) {
    selectors = AXTreeSelector::Chrome;
  } else if (command_line.HasSwitch(kChromiumSwitch)) {
    selectors = AXTreeSelector::Chromium;
  } else if (command_line.HasSwitch(kEdgeSwitch)) {
    selectors = AXTreeSelector::Edge;
  } else if (command_line.HasSwitch(kFirefoxSwitch)) {
    selectors = AXTreeSelector::Firefox;
  } else if (command_line.HasSwitch(kSafariSwitch)) {
    selectors = AXTreeSelector::Safari;
  }
  if (command_line.HasSwitch(kActiveTabSwitch)) {
    selectors |= AXTreeSelector::ActiveTab;
  }
  std::string pattern_str = command_line.GetSwitchValueASCII(kPatternSwitch);
  std::string id_str = command_line.GetSwitchValueASCII(kIdSwitch);

  if (!id_str.empty()) {
    unsigned hwnd_or_pid = 0;
    if (!StringToInt(id_str, &hwnd_or_pid)) {
      LOG(ERROR) << "Error: can't convert window id string to integer.";
      return absl::nullopt;
    }
    return AXTreeSelector(selectors, pattern_str,
                          CastToAcceleratedWidget(hwnd_or_pid));
  }
  return AXTreeSelector(selectors, pattern_str);
}

absl::optional<ui::AXInspectScenario> ScenarioFromCommandLine(
    const base::CommandLine& command_line) {
  base::FilePath filters_path = command_line.GetSwitchValuePath(kFiltersSwitch);
  if (filters_path.empty() && command_line.HasSwitch(kFiltersSwitch)) {
    LOG(ERROR) << "Error: empty filter path given. Run with --help for help.";
    return absl::nullopt;
  }

  // Return with the default filter scenario if no file is provided.
  if (filters_path.empty()) {
    return ui::AXInspectScenario::From("@", std::vector<std::string>());
  }

  absl::optional<ui::AXInspectScenario> scenario =
      ui::AXInspectScenario::From("@", filters_path);
  if (!scenario) {
    LOG(ERROR) << "Error: failed to open filters file " << filters_path
               << ". Note: path traversal components ('..') are not allowed "
                  "for security reasons";
    return absl::nullopt;
  }
  return scenario;
}

}  // namespace tools


text:
namespace PolyTics.UnityUtils
{

    using System.Collections;
    using UnityEngine;
#if UNITY_5_5_OR_NEWER
    using UnityEngine.Networking;

#else
using UnityEngine.Experimental.Networking;
#endif

    [DisallowMultipleComponent]
    public class InternetWatchdog : Singleton<InternetWatchdog>
    {
        [SerializeField]
        private float CheckTimer = 1f;
        private float timer;
        private static bool? isConnectedToInternet;
        private static Coroutine coroutine;

        public delegate void OnInternetStatusChanged(bool internet);

        public static event OnInternetStatusChanged InternetStatusChanged;

        public static bool IsConnectedToInternet
        {
            get { return isConnectedToInternet != null && isConnectedToInternet.Value; }
            private set
            {
                if (isConnectedToInternet == value)
                {
                    return;
                }
                if ((!value || isConnectedToInternet != null) && InternetStatusChanged != null)
                {
                    InternetStatusChanged(value);
                }
                isConnectedToInternet = value;
            }
        }

        protected override void AwakeSingleton()
        {
            PingService();
        }

#if UNITY_EDITOR
        private void OnApplicationFocus(bool focusStatus)
        {
            OnApplicationPause(!focusStatus);
        }
#endif

        private void OnApplicationPause(bool pause)
        {
            if (!pause)
            {
                timer = 0;
            }
        }

        private void OnApplicationQuit()
        {
            if (coroutine != null)
            {
                StopCoroutine(coroutine);
            }
        }

        private void PingService()
        {
            if (coroutine == null)
            {
                coroutine = StartCoroutine(Google204());
            }
        }

        //https://google.com/generate_204
        //https://connectivitycheck.gstatic.com/generate_204
        //https://www.gstatic.com/generate_204
        private IEnumerator Google204()
        {
            while (true)
            {
                using (UnityWebRequest www = UnityWebRequest.Get("https://clients3.google.com/generate_204"))
                {
                    yield return www.Send();
                    IsConnectedToInternet = !www.isError && www.responseCode == 204;
                }
                timer = CheckTimer;
                while (timer > 0f)
                {
                    timer -= Time.deltaTime;
                    yield return null;
                }
            }
        }
    }
}


text:
/******************************************************************************
 *
 * Module Name: psxface - Parser external interfaces
 *
 *****************************************************************************/

/*
 * Copyright (C) 2000 - 2011, Intel Corp.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
 */

#define __PSXFACE_C__

#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/acdispat.h>
#include <contrib/dev/acpica/include/acinterp.h>
#include <contrib/dev/acpica/include/actables.h>

#define _COMPONENT          ACPI_PARSER
        ACPI_MODULE_NAME    ("psxface")

/* Local Prototypes */

static void
AcpiPsStartTrace (
    ACPI_EVALUATE_INFO      *Info);

static void
AcpiPsStopTrace (
    ACPI_EVALUATE_INFO      *Info);

static void
AcpiPsUpdateParameterList (
    ACPI_EVALUATE_INFO      *Info,
    UINT16                  Action);

/*******************************************************************************
 *
 * FUNCTION:    AcpiDebugTrace
 *
 * PARAMETERS:  MethodName      - Valid ACPI name string
 *              DebugLevel      - Optional level mask. 0 to use default
 *              DebugLayer      - Optional layer mask. 0 to use default
 *              Flags           - bit 1: one shot(1) or persistent(0)
 *
 * RETURN:      Status
 *
 * DESCRIPTION: External interface to enable debug tracing during control
 *              method execution
 *
 ******************************************************************************/

ACPI_STATUS
AcpiDebugTrace (
    char                    *Name,
    UINT32                  DebugLevel,
    UINT32                  DebugLayer,
    UINT32                  Flags)
{
    ACPI_STATUS             Status;

    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }

    /* TBDs: Validate name, allow full path or just nameseg */

    AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name);
    AcpiGbl_TraceFlags = Flags;

    if (DebugLevel)
    {
        AcpiGbl_TraceDbgLevel = DebugLevel;
    }
    if (DebugLayer)
    {
        AcpiGbl_TraceDbgLayer = DebugLayer;
    }

    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
    return (AE_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiPsStartTrace
 *
 * PARAMETERS:  Info        - Method info struct
 *
 * RETURN:      None
 *
 * DESCRIPTION: Start control method execution trace
 *
 ******************************************************************************/

static void
AcpiPsStartTrace (
    ACPI_EVALUATE_INFO      *Info)
{
    ACPI_STATUS             Status;

    ACPI_FUNCTION_ENTRY ();

    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    if ((!AcpiGbl_TraceMethodName) ||
        (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
    {
        goto Exit;
    }

    AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
    AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;

    AcpiDbgLevel = 0x00FFFFFF;
    AcpiDbgLayer = ACPI_UINT32_MAX;

    if (AcpiGbl_TraceDbgLevel)
    {
        AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
    }
    if (AcpiGbl_TraceDbgLayer)
    {
        AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
    }

Exit:
    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiPsStopTrace
 *
 * PARAMETERS:  Info        - Method info struct
 *
 * RETURN:      None
 *
 * DESCRIPTION: Stop control method execution trace
 *
 ******************************************************************************/

static void
AcpiPsStopTrace (
    ACPI_EVALUATE_INFO      *Info)
{
    ACPI_STATUS             Status;

    ACPI_FUNCTION_ENTRY ();

    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    if ((!AcpiGbl_TraceMethodName) ||
        (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
    {
        goto Exit;
    }

    /* Disable further tracing if type is one-shot */

    if (AcpiGbl_TraceFlags & 1)
    {
        AcpiGbl_TraceMethodName = 0;
        AcpiGbl_TraceDbgLevel = 0;
        AcpiGbl_TraceDbgLayer = 0;
    }

    AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
    AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;

Exit:
    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiPsExecuteMethod
 *
 * PARAMETERS:  Info            - Method info block, contains:
 *                  Node            - Method Node to execute
 *                  ObjDesc         - Method object
 *                  Parameters      - List of parameters to pass to the method,
 *                                    terminated by NULL. Params itself may be
 *                                    NULL if no parameters are being passed.
 *                  ReturnObject    - Where to put method's return value (if
 *                                    any). If NULL, no value is returned.
 *                  ParameterType   - Type of Parameter list
 *                  ReturnObject    - Where to put method's return value (if
 *                                    any). If NULL, no value is returned.
 *                  PassNumber      - Parse or execute pass
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Execute a control method
 *
 ******************************************************************************/

ACPI_STATUS
AcpiPsExecuteMethod (
    ACPI_EVALUATE_INFO      *Info)
{
    ACPI_STATUS             Status;
    ACPI_PARSE_OBJECT       *Op;
    ACPI_WALK_STATE         *WalkState;

    ACPI_FUNCTION_TRACE (PsExecuteMethod);

    /* Quick validation of DSDT header */

    AcpiTbCheckDsdtHeader ();

    /* Validate the Info and method Node */

    if (!Info || !Info->ResolvedNode)
    {
        return_ACPI_STATUS (AE_NULL_ENTRY);
    }

    /* Init for new method, wait on concurrency semaphore */

    Status = AcpiDsBeginMethodExecution (Info->ResolvedNode, Info->ObjDesc, NULL);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }

    /*
     * The caller "owns" the parameters, so give each one an extra reference
     */
    AcpiPsUpdateParameterList (Info, REF_INCREMENT);

    /* Begin tracing if requested */

    AcpiPsStartTrace (Info);

    /*
     * Execute the method. Performs parse simultaneously
     */
    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
        "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
        Info->ResolvedNode->Name.Ascii, Info->ResolvedNode, Info->ObjDesc));

    /* Create and init a Root Node */

    Op = AcpiPsCreateScopeOp ();
    if (!Op)
    {
        Status = AE_NO_MEMORY;
        goto Cleanup;
    }

    /* Create and initialize a new walk state */

    Info->PassNumber = ACPI_IMODE_EXECUTE;
    WalkState = AcpiDsCreateWalkState (
                    Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
    if (!WalkState)
    {
        Status = AE_NO_MEMORY;
        goto Cleanup;
    }

    Status = AcpiDsInitAmlWalk (WalkState, Op, Info->ResolvedNode,
                Info->ObjDesc->Method.AmlStart,
                Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
    if (ACPI_FAILURE (Status))
    {
        AcpiDsDeleteWalkState (WalkState);
        goto Cleanup;
    }

    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
    {
        WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
    }

    /* Invoke an internal method if necessary */

    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY)
    {
        Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState);
        Info->ReturnObject = WalkState->ReturnDesc;

        /* Cleanup states */

        AcpiDsScopeStackClear (WalkState);
        AcpiPsCleanupScope (&WalkState->ParserState);
        AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
        AcpiDsDeleteWalkState (WalkState);
        goto Cleanup;
    }

    /*
     * Start method evaluation with an implicit return of zero. This is done
     * for Windows compatibility.
     */
    if (AcpiGbl_EnableInterpreterSlack)
    {
        WalkState->ImplicitReturnObj =
            AcpiUtCreateIntegerObject ((UINT64) 0);
        if (!WalkState->ImplicitReturnObj)
        {
            Status = AE_NO_MEMORY;
            AcpiDsDeleteWalkState (WalkState);
            goto Cleanup;
        }
    }

    /* Parse the AML */

    Status = AcpiPsParseAml (WalkState);

    /* WalkState was deleted by ParseAml */

Cleanup:
    AcpiPsDeleteParseTree (Op);

    /* End optional tracing */

    AcpiPsStopTrace (Info);

    /* Take away the extra reference that we gave the parameters above */

    AcpiPsUpdateParameterList (Info, REF_DECREMENT);

    /* Exit now if error above */

    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }

    /*
     * If the method has returned an object, signal this to the caller with
     * a control exception code
     */
    if (Info->ReturnObject)
    {
        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
            Info->ReturnObject));
        ACPI_DUMP_STACK_ENTRY (Info->ReturnObject);

        Status = AE_CTRL_RETURN_VALUE;
    }

    return_ACPI_STATUS (Status);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiPsUpdateParameterList
 *
 * PARAMETERS:  Info            - See ACPI_EVALUATE_INFO
 *                                (Used: ParameterType and Parameters)
 *              Action          - Add or Remove reference
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Update reference count on all method parameter objects
 *
 ******************************************************************************/

static void
AcpiPsUpdateParameterList (
    ACPI_EVALUATE_INFO      *Info,
    UINT16                  Action)
{
    UINT32                  i;

    if (Info->Parameters)
    {
        /* Update reference count for each parameter */

        for (i = 0; Info->Parameters[i]; i++)
        {
            /* Ignore errors, just do them all */

            (void) AcpiUtUpdateObjectReference (Info->Parameters[i], Action);
        }
    }
}


text:
package com.hazelcast.core;

public enum ItemEventType {
    ADDED(1),
    REMOVED(2);

    private int type;

    private ItemEventType(final int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public static ItemEventType getByType(final int eventType) {
        for (ItemEventType entryEventType : values()) {
            if (entryEventType.type == eventType) {
                return entryEventType;
            }
        }
        return null;
    }
}


text:
#define C_LUCY_FSFILEHANDLE
#include "Lucy/Util/ToolSet.h"

#include "charmony.h"

#include <errno.h>
#include <stdio.h>
#include <fcntl.h> // open, POSIX flags

#ifdef CHY_HAS_UNISTD_H
  #include <unistd.h> // close
#endif

#ifdef CHY_HAS_SYS_MMAN_H
  #include <sys/mman.h>
#elif defined(CHY_HAS_WINDOWS_H)
  #include <windows.h>
  #include <io.h>
#else
  #error "No support for memory mapped files"
#endif

#include "Lucy/Store/FSFileHandle.h"
#include "Lucy/Store/FileWindow.h"

// Convert FileHandle flags to POSIX flags.
static CFISH_INLINE int
SI_posix_flags(uint32_t fh_flags) {
    int posix_flags = 0;
    if (fh_flags & FH_WRITE_ONLY) { posix_flags |= O_WRONLY; }
    if (fh_flags & FH_READ_ONLY)  { posix_flags |= O_RDONLY; }
    if (fh_flags & FH_CREATE)     { posix_flags |= O_CREAT; }
    if (fh_flags & FH_EXCLUSIVE)  { posix_flags |= O_EXCL; }
#ifdef O_LARGEFILE
    posix_flags |= O_LARGEFILE;
#endif
#ifdef _O_BINARY
    posix_flags |= _O_BINARY;
#endif
    return posix_flags;
}

#define IS_64_BIT (CHY_SIZEOF_PTR == 8 ? 1 : 0)

// Memory map a region of the file with shared (read-only) permissions.  If
// the requested length is 0, return NULL.  If an error occurs, return NULL
// and set the global error object.
static CFISH_INLINE void*
SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
       int64_t len);

// Release a memory mapped region assigned by SI_map.
static CFISH_INLINE bool
SI_unmap(FSFileHandle *self, char *ptr, int64_t len);

// 32-bit or 64-bit inlined helpers for FSFH_window.
static CFISH_INLINE bool
SI_window(FSFileHandle *self, FSFileHandleIVARS *ivars, FileWindow *window,
          int64_t offset, int64_t len);

// Architecture- and OS- specific initialization for a read-only FSFileHandle.
static CFISH_INLINE bool
SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars);

// Windows-specific routine needed for closing read-only handles.
#ifdef CHY_HAS_WINDOWS_H
static CFISH_INLINE bool
SI_close_win_handles(FSFileHandle *self);
#endif

FSFileHandle*
FSFH_open(String *path, uint32_t flags) {
    FSFileHandle *self = (FSFileHandle*)Class_Make_Obj(FSFILEHANDLE);
    return FSFH_do_open(self, path, flags);
}

FSFileHandle*
FSFH_do_open(FSFileHandle *self, String *path, uint32_t flags) {
    FH_do_open((FileHandle*)self, path, flags);
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
    if (!path || !Str_Get_Size(path)) {
        Err_set_error(Err_new(Str_newf("Missing required param 'path'")));
        CFISH_DECREF(self);
        return NULL;
    }

    // Attempt to open file.
    if (flags & FH_WRITE_ONLY) {
        char *path_ptr = Str_To_Utf8(path);
        ivars->fd = open(path_ptr, SI_posix_flags(flags), 0666);
        FREEMEM(path_ptr);
        if (ivars->fd == -1) {
            ivars->fd = 0;
            Err_set_error(Err_new(Str_newf("Attempt to open '%o' failed: %s",
                                           path, strerror(errno))));
            CFISH_DECREF(self);
            return NULL;
        }
        if (flags & FH_EXCLUSIVE) {
            ivars->len = 0;
        }
        else {
            // Derive length.
            ivars->len = chy_lseek64(ivars->fd, INT64_C(0), SEEK_END);
            if (ivars->len == -1) {
                Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                               ivars->path, strerror(errno))));
                CFISH_DECREF(self);
                return NULL;
            }
            else {
                int64_t check_val
                    = chy_lseek64(ivars->fd, INT64_C(0), SEEK_SET);
                if (check_val == -1) {
                    Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                                   ivars->path, strerror(errno))));
                    CFISH_DECREF(self);
                    return NULL;
                }
            }
        }
    }
    else if (flags & FH_READ_ONLY) {
        if (SI_init_read_only(self, ivars)) {
            // On 64-bit systems, map the whole file up-front.
            if (IS_64_BIT && ivars->len) {
                ivars->buf = (char*)SI_map(self, ivars, 0, ivars->len);
                if (!ivars->buf) {
                    // An error occurred during SI_map, which has set
                    // the global error object for us already.
                    CFISH_DECREF(self);
                    return NULL;
                }
            }
        }
        else {
            CFISH_DECREF(self);
            return NULL;
        }
    }
    else {
        Err_set_error(Err_new(Str_newf("Must specify FH_READ_ONLY or FH_WRITE_ONLY to open '%o'",
                                       path)));
        CFISH_DECREF(self);
        return NULL;
    }

    return self;
}

bool
FSFH_Close_IMP(FSFileHandle *self) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);

    // On 64-bit systems, cancel the whole-file mapping.
    if (IS_64_BIT && (ivars->flags & FH_READ_ONLY) && ivars->buf != NULL) {
        if (!SI_unmap(self, ivars->buf, ivars->len)) { return false; }
        ivars->buf = NULL;
    }

    // Close system-specific handles.
    if (ivars->fd) {
        if (close(ivars->fd)) {
            Err_set_error(Err_new(Str_newf("Failed to close file: %s",
                                           strerror(errno))));
            return false;
        }
        ivars->fd  = 0;
    }
    #if (defined(CHY_HAS_WINDOWS_H) && !defined(CHY_HAS_SYS_MMAN_H))
    if (ivars->win_fhandle) {
        if (!SI_close_win_handles(self)) { return false; }
    }
    #endif

    return true;
}

bool
FSFH_Write_IMP(FSFileHandle *self, const void *data, size_t len) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);

    if (len) {
        // Write data, track file length, check for errors.
        int64_t check_val = write(ivars->fd, data, len);
        ivars->len += check_val;
        if ((size_t)check_val != len) {
            if (check_val == -1) {
                Err_set_error(Err_new(Str_newf("Error when writing %u64 bytes: %s",
                                               (uint64_t)len, strerror(errno))));
            }
            else {
                Err_set_error(Err_new(Str_newf("Attempted to write %u64 bytes, but wrote %i64",
                                               (uint64_t)len, check_val)));
            }
            return false;
        }
    }

    return true;
}

int64_t
FSFH_Length_IMP(FSFileHandle *self) {
    return FSFH_IVARS(self)->len;
}

bool
FSFH_Window_IMP(FSFileHandle *self, FileWindow *window, int64_t offset,
                int64_t len) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
    const int64_t end = offset + len;
    if (!(ivars->flags & FH_READ_ONLY)) {
        Err_set_error(Err_new(Str_newf("Can't read from write-only handle")));
        return false;
    }
    else if (offset < 0) {
        Err_set_error(Err_new(Str_newf("Can't read from negative offset %i64",
                                       offset)));
        return false;
    }
    else if (end > ivars->len) {
        Err_set_error(Err_new(Str_newf("Tried to read past EOF: offset %i64 + request %i64 > len %i64",
                                       offset, len, ivars->len)));
        return false;
    }
    else {
        return SI_window(self, ivars, window, offset, len);
    }
}

/********************************* 64-bit *********************************/

#if IS_64_BIT

static CFISH_INLINE bool
SI_window(FSFileHandle *self, FSFileHandleIVARS *ivars, FileWindow *window,
          int64_t offset, int64_t len) {
    UNUSED_VAR(self);
    FileWindow_Set_Window(window, ivars->buf + offset, offset, len);
    return true;
}

bool
FSFH_Release_Window_IMP(FSFileHandle *self, FileWindow *window) {
    UNUSED_VAR(self);
    FileWindow_Set_Window(window, NULL, 0, 0);
    return true;
}

bool
FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
    const int64_t end = offset + (int64_t)len;

    if (ivars->flags & FH_WRITE_ONLY) {
        Err_set_error(Err_new(Str_newf("Can't read from write-only filehandle")));
        return false;
    }
    if (offset < 0 || end < offset) {
        Err_set_error(Err_new(Str_newf("Invalid offset and len (%i64, %u64)",
                                       offset, (uint64_t)len)));
        return false;
    }
    else if (end > ivars->len) {
        Err_set_error(Err_new(Str_newf("Tried to read past EOF: offset %i64 + request %u64 > len %i64",
                                       offset, (uint64_t)len, ivars->len)));
        return false;
    }
    memcpy(dest, ivars->buf + offset, len);
    return true;
}

/********************************* 32-bit *********************************/

#else

static CFISH_INLINE bool
SI_window(FSFileHandle *self, FSFileHandleIVARS *ivars, FileWindow *window,
          int64_t offset, int64_t len) {
    // Release the previously mmap'd region, if any.
    FSFH_Release_Window_IMP(self, window);

    // Start map on a page boundary.  Ensure that the window is at
    // least wide enough to view all the data spec'd in the original
    // request.
    const int64_t remainder       = offset % ivars->page_size;
    const int64_t adjusted_offset = offset - remainder;
    const int64_t adjusted_len    = len + remainder;
    char *const buf
        = (char*)SI_map(self, ivars, adjusted_offset, adjusted_len);
    if (len && buf == NULL) {
        return false;
    }
    else {
        FileWindow_Set_Window(window, buf, adjusted_offset, adjusted_len);
    }

    return true;
}

bool
FSFH_Release_Window_IMP(FSFileHandle *self, FileWindow *window) {
    char *buf = FileWindow_Get_Buf(window);
    int64_t len = FileWindow_Get_Len(window);
    if (!SI_unmap(self, buf, len)) { return false; }
    FileWindow_Set_Window(window, NULL, 0, 0);
    return true;
}

#endif // IS_64_BIT vs. 32-bit

/********************************* UNIXEN *********************************/

#ifdef CHY_HAS_SYS_MMAN_H

static CFISH_INLINE bool
SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
    UNUSED_VAR(self);

    // Open.
    char *path_ptr = Str_To_Utf8(ivars->path);
    ivars->fd = open(path_ptr, SI_posix_flags(ivars->flags), 0666);
    FREEMEM(path_ptr);
    if (ivars->fd == -1) {
        ivars->fd = 0;
        Err_set_error(Err_new(Str_newf("Can't open '%o': %s", ivars->path,
                                       strerror(errno))));
        return false;
    }

    // Derive len.
    ivars->len = chy_lseek64(ivars->fd, INT64_C(0), SEEK_END);
    if (ivars->len == -1) {
        Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s", ivars->path,
                                       strerror(errno))));
        return false;
    }
    else {
        int64_t check_val = chy_lseek64(ivars->fd, INT64_C(0), SEEK_SET);
        if (check_val == -1) {
            Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                           ivars->path, strerror(errno))));
            return false;
        }
    }

    // Get system page size.
#if defined(_SC_PAGESIZE)
    ivars->page_size = sysconf(_SC_PAGESIZE);
#elif defined(_SC_PAGE_SIZE)
    ivars->page_size = sysconf(_SC_PAGE_SIZE);
#else
    #error "Can't determine system memory page size"
#endif

    return true;
}

static CFISH_INLINE void*
SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
       int64_t len) {
    UNUSED_VAR(self);
    void *buf = NULL;

    if (len) {
        // Read-only memory mapping.
        buf = mmap(NULL, (size_t)len, PROT_READ, MAP_SHARED, ivars->fd, offset);
        if (buf == (void*)(-1)) {
            Err_set_error(Err_new(Str_newf("mmap of offset %i64 and length %i64 (page size %i64) "
                                           "against '%o' failed: %s",
                                           offset, len, ivars->page_size,
                                           ivars->path, strerror(errno))));
            return NULL;
        }
    }

    return buf;
}

static CFISH_INLINE bool
SI_unmap(FSFileHandle *self, char *buf, int64_t len) {
    if (buf != NULL) {
        if (munmap(buf, (size_t)len)) {
            Err_set_error(Err_new(Str_newf("Failed to munmap '%o': %s",
                                           FSFH_IVARS(self)->path,
                                           strerror(errno))));
            return false;
        }
    }
    return true;
}

#if !IS_64_BIT
bool
FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
    int64_t check_val;

    // Sanity check.
    if (offset < 0) {
        Err_set_error(Err_new(Str_newf("Can't read from an offset less than 0 (%i64)",
                                       offset)));
        return false;
    }

    // Read.
    check_val = chy_pread64(ivars->fd, dest, len, offset);
    if (check_val != (int64_t)len) {
        if (check_val == -1) {
            Err_set_error(Err_new(Str_newf("Tried to read %u64 bytes, got %i64: %s",
                                           (uint64_t)len, check_val, strerror(errno))));
        }
        else {
            Err_set_error(Err_new(Str_newf("Tried to read %u64 bytes, got %i64",
                                           (uint64_t)len, check_val)));
        }
        return false;
    }

    return true;
}
#endif // !IS_64_BIT

/********************************* WINDOWS **********************************/

#elif defined(CHY_HAS_WINDOWS_H)

static CFISH_INLINE bool
SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
    char *filepath = Str_To_Utf8(ivars->path);
    SYSTEM_INFO sys_info;

    // Get system page size.
    GetSystemInfo(&sys_info);
    ivars->page_size = sys_info.dwAllocationGranularity;

    // Open.
    ivars->win_fhandle = CreateFile(
                            filepath,
                            GENERIC_READ,
                            FILE_SHARE_READ,
                            NULL,
                            OPEN_EXISTING,
                            FILE_ATTRIBUTE_READONLY | FILE_FLAG_OVERLAPPED,
                            NULL
                        );
    FREEMEM(filepath);
    if (ivars->win_fhandle == INVALID_HANDLE_VALUE) {
        char *win_error = Err_win_error();
        Err_set_error(Err_new(Str_newf("CreateFile for %o failed: %s",
                                       ivars->path, win_error)));
        FREEMEM(win_error);
        return false;
    }

    // Derive len.
    DWORD file_size_hi;
    DWORD file_size_lo = GetFileSize(ivars->win_fhandle, &file_size_hi);
    if (file_size_lo == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) {
        Err_set_error(Err_new(Str_newf("GetFileSize for %o failed",
                                       ivars->path)));
        return false;
    }
    ivars->len = ((uint64_t)file_size_hi << 32) | file_size_lo;

    // Init mapping handle.
    ivars->buf = NULL;
    if (ivars->len) {
        ivars->win_maphandle = CreateFileMapping(ivars->win_fhandle, NULL,
                                                 PAGE_READONLY, 0, 0, NULL);
        if (ivars->win_maphandle == NULL) {
            char *win_error = Err_win_error();
            Err_set_error(Err_new(Str_newf("CreateFileMapping for %o failed: %s",
                                           ivars->path, win_error)));
            FREEMEM(win_error);
            return false;
        }
    }

    return true;
}

static CFISH_INLINE void*
SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
       int64_t len) {
    void *buf = NULL;

    if (len) {
        // Read-only memory map.
        uint64_t offs = (uint64_t)offset;
        DWORD file_offset_hi = offs >> 32;
        DWORD file_offset_lo = offs & 0xFFFFFFFF;
        size_t amount = (size_t)len;
        buf = MapViewOfFile(ivars->win_maphandle, FILE_MAP_READ,
                            file_offset_hi, file_offset_lo, amount);
        if (buf == NULL) {
            char *win_error = Err_win_error();
            Err_set_error(Err_new(Str_newf("MapViewOfFile for %o failed: %s",
                                           ivars->path, win_error)));
            FREEMEM(win_error);
        }
    }

    return buf;
}

static CFISH_INLINE bool
SI_unmap(FSFileHandle *self, char *buf, int64_t len) {
    if (buf != NULL) {
        if (!UnmapViewOfFile(buf)) {
            char *win_error = Err_win_error();
            Err_set_error(Err_new(Str_newf("Failed to unmap '%o': %s",
                                           FSFH_IVARS(self)->path,
                                           win_error)));
            FREEMEM(win_error);
            return false;
        }
    }
    return true;
}

static CFISH_INLINE bool
SI_close_win_handles(FSFileHandle *self) {
    FSFileHandleIVARS *ivars = FSFH_IVARS(self);
    // Close both standard handle and mapping handle.
    if (ivars->win_maphandle) {
        if (!CloseHandle(ivars->win_maphandle)) {
            char *win_error = Err_win_error();
            Err_set_error(Err_new(Str_newf("Failed to close file mapping handle: %s",
                                           win_error)));
            FREEMEM(win_error);
            return false;
        }
        ivars->win_maphandle = NULL;
    }
    if (ivars->win_fhandle) {
        if (!CloseHandle(ivars->win_fhandle)) {
            char *win_error = Err_win_error();
            Err_set_error(Err_new(Str_newf("Failed to close file handle: %s",
                                           win_error)));
            FREEMEM(win_error);
            return false;
        }
        ivars->win_fhandle = NULL;
    }

    return true;
}

#if !IS_64_BIT
bool
FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
    FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
    BOOL check_val;
    DWORD got;
    OVERLAPPED read_op_state;
    uint64_t offs = (uint64_t)offset;

    read_op_state.hEvent     = NULL;
    read_op_state.OffsetHigh = offs >> 32;
    read_op_state.Offset     = offs & 0xFFFFFFFF;

    // Sanity check.
    if (offset < 0) {
        Err_set_error(Err_new(Str_newf("Can't read from an offset less than 0 (%i64)",
                                       offset)));
        return false;
    }

    // ReadFile() takes a DWORD (unsigned 32-bit integer) as a length
    // argument, so throw a sensible error rather than wrap around.
    if (len > UINT32_MAX) {
        Err_set_error(Err_new(Str_newf("Can't read more than 4 GB (%u64)",
                                       (uint64_t)len)));
        return false;
    }

    // Read.
    check_val = ReadFile(ivars->win_fhandle, dest, len, &got, &read_op_state);
    if (!check_val && GetLastError() == ERROR_IO_PENDING) {
        // Read has been queued by the OS and will soon complete.  Wait for
        // it, since this is a blocking IO call from the point of the rest of
        // the library.
        check_val = GetOverlappedResult(ivars->win_fhandle, &read_op_state,
                                        &got, TRUE);
    }

    // Verify that the read has succeeded by now.
    if (!check_val) {
        char *win_error = Err_win_error();
        Err_set_error(Err_new(Str_newf("Failed to read %u64 bytes: %s",
                                       (uint64_t)len, win_error)));
        FREEMEM(win_error);
        return false;
    }

    return true;
}
#endif // !IS_64_BIT

#endif // CHY_HAS_SYS_MMAN_H vs. CHY_HAS_WINDOWS_H


text:
package fm.audiobox.core.models.collections;

import fm.audiobox.core.models.Model;

/**
 * This is the wrapper object sent to the observers.
 * <p>
 * It contains information about what happened, the item that triggered the event
 * and the item the event impacted (i.e. the list).
 * </p>
 */
public class ModelEvent<E> {

  /**
   * An item is added to the collection.
   */
  public static final int ADD = 1;

  /**
   * An item is removed from the collection.
   */
  public static final int REMOVE = -1;

  /**
   * The collection is cleared.
   */
  public static final int CLEAR = 0;

  /**
   * The type of the event (see {@link ModelEvent#ADD}, {@link ModelEvent#REMOVE} and {@link ModelEvent#CLEAR}).
   */
  public int what;

  /**
   * The item that triggered the event.
   */
  public E source;

  /**
   * The object where the event is originated.
   */
  public EventedModelList target;

  private Model parent;

  /**
   * Instantiates a new Event.
   *
   * @param what      the type of the event (see {@link ModelEvent#ADD}, {@link ModelEvent#REMOVE} and {@link ModelEvent#CLEAR}).
   * @param source    the item that triggered the event.
   * @param target    the object where the event is originated (can be null).
   * @param notifiers the model to notify the event to.
   */
  public ModelEvent(int what, E source, EventedModelList target, Model notifiers) {
    this.what = what;
    this.source = source;
    this.target = target;
    this.parent = notifiers;
  }

  /**
   * Notifies parents observers
   */
  public void trigger() {
    parent.notifyObservers( this );
  }
}


text:
#include "soomla/NativeImpl/CCNativeStoreInfo.h"

#include <soomla/CCNdkBridge.h>
#include <soomla/CCSoomlaUtils.h>

namespace soomla {
    #define TAG "SOOMLA NativeStoreInfo"

    USING_NS_CC;

    CCNativeStoreInfo::~CCNativeStoreInfo() {

    }

    void CCNativeStoreInfo::setStoreAssets(CCStoreAssets *storeAssets) {
        CCSoomlaUtils::logDebug(TAG, "pushing CCStoreAssets to StoreInfo on native side");
        ValueMap&& storeAssetsMap = storeAssetsToValueMap(storeAssets);

        ValueMap params;
        params["method"] = "CCStoreAssets::init";
        params["version"] = storeAssets->getVersion();
        params["storeAssets"] = storeAssetsMap;
        CCNdkBridge::callNative(params, nullptr);

        CCSoomlaUtils::logDebug(TAG, "done! (pushing data to StoreAssets on native side)");
    }

    void CCNativeStoreInfo::save() {
        CCStoreInfo::save();

        ValueMap params;
        params["method"] = "CCStoreInfo::loadFromDB";
        CCNdkBridge::callNative(params, nullptr);
    }
}


text:
require_relative 'slack_post'

require 'dotenv'
Dotenv.load File.absolute_path(File.join(File.expand_path(__FILE__), '..', '.env'))

message = ARGV[0]
level = ARGV[1]

slack = SlackPost.new(ENV['SLACK_WEBHOOK_URL'])
slack.username = ENV['USERNAME']

if !level.nil?
    if level[0] == ':' # it's an emoji
        slack.with_icon level
    else
        slack.level level
    end
end

slack.send_message message


text:
import flask

app = flask.Flask(__name__)

# this is supposed to be overridden by the client code
def store_auth_token(code):
    pass

def start():
    app.run(port=9010)

def kill():
    func = flask.request.environ.get('werkzeug.server.shutdown')
    if func is None:
        raise RuntimeError("not running werkzeug server")
    func()

@app.route("/", methods=["GET"])
def token():
    code = flask.request.args["code"]
    store_auth_token(code)
    kill()
    return "code stored!"

if __name__ == "__main__":
    start()


text:
import expect from 'expect'

import { getParameterByName } from '../../app/common/utils';

describe('getParameterByName', () => {
    describe('#lang', () => {
        it ('should return undefined if url is undefined', function() {
            let res = getParameterByName('lang', undefined);
            expect(res).toNotExist();
        });
        it ('should return undefined if query does not exist', () => {
            let res = getParameterByName('lang', 'http://test.com');
            expect(res).toNotExist();
        });
        it ('should return undefined if query param does not exist', () => {
            let res = getParameterByName('lang', 'http://test.com?test=eins');
            expect(res).toNotExist();
        });
        it ('should return the value if query param exists', () => {
            let res = getParameterByName('lang', 'http://test.com?lang=eins');
            expect(res).toBe('eins');
        });
        it ('should return the value if query param exists (anyhow where is query)', () => {
            let res = getParameterByName('lang', 'http://test.com?lang=eins&test=zwei');
            expect(res).toBe('eins');
        });
        it ('should return the value if query param exists (anyhow where is query)', () => {
            let res = getParameterByName('lang', 'http://test.com?test=zwei&lang=eins');
            expect(res).toBe('eins');
        });
        it ('should return the value if query param exists (anyhow where is query)', () => {
            let res = getParameterByName('lang', 'http://test.com?test=zwei&lang=eins&ende=drei');
            expect(res).toBe('eins');
        });
    });
});


text:
<!--
Description: feed subtitle contains embed
Expect:      not bozo and feed['tagline'] == 'safe description'
-->
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<subtitle type="text/html" mode="escaped">safe<embed src="http://example.com/"> description</subtitle>
</feed>


text:
<?php

class usuarios extends CI_Controller{

public function __construct(){

	parent::__construct();
	$this->load->model('usuario');
	$this->load->helper('url');
	$this->load->library('session');

	//Si no hay session redirige a Login
	if(! $this->session->userdata('logged_in')){
		redirect('dashboard');
	}

}

public function index(){

	//Pagination
	$per_page = 15;
	$page = $this->uri->segment(3);
	if(!$page){ $start =0; $page =1; }else{ $start = ($page -1 ) * $per_page; }
		$data['pagination_links'] = "";
		$total_pages = ceil($this->usuario->count_rows() / $per_page);

		if ($total_pages > 1){
			for ($i=1;$i<=$total_pages;$i++){
			if ($page == $i)
				//si muestro el índice de la página actual, no coloco enlace
				$data['pagination_links'] .=  '
'.$i.'
';
			else
				//si el índice no corresponde con la página mostrada actualmente, coloco el enlace para ir a esa pagina
				$data['pagination_links']  .= '
 '. $i .'
';
		}
	}
	//End Pagination

	$data['title'] = 'usuarios';
	$data['menu'] = 'control/usuarios/menu_usuario';
	$data['content'] = 'control/usuarios/all';
	$data['query'] = $this->usuario->get_records($per_page,$start);
	$this->load->view('control/control_layout', $data);

}

//detail
public function detail(){

	$data['title'] = 'usuario';
	$data['content'] = 'control/usuarios/detail';
	$data['menu'] = 'control/usuarios/menu_usuario';
	$data['query'] = $this->usuario->get_record($this->uri->segment(4));
	$this->load->view('control/control_layout', $data);
}

//new
public function form_new(){

	$this->load->helper('form');
	$data['title'] = 'Nuevo usuario';
	$data['content'] = 'control/usuarios/new_usuario';
	$data['menu'] = 'control/usuarios/menu_usuario';
	$this->load->view('control/control_layout', $data);
}

/*
public function comprobacion(){
	$email = $this->input->post('email');
	$password = $this->input->post('password');

	$access_granted = $this->usuario->check_credentials($email, $password);
	if($access_granted===FALSE){echo "Nop R"; }else{echo $access_granted;}
}
*/
public function logout(){
	$this->usuario->logout();
}
//create
public function create(){

	$this->load->helper('form');
	$this->load->library('form_validation');
	$this->form_validation->set_rules('nombre', 'Nombre', 'required');
	$this->form_validation->set_rules('apellido', 'Apellido', 'required');
	$this->form_validation->set_rules('email', 'Email', 'required|is_unique[usuarios.email]');
	$this->form_validation->set_rules('password', 'Password', 'required');

	$this->form_validation->set_message('required','El campo %s es requerido.');
	$this->form_validation->set_message('is_unique', 'Ya existe otro usuario registrado con ese E-mail');

if ($this->form_validation->run() === FALSE){

		$this->load->helper('form');
		$data['title'] = 'Nuevo usuarios';
		$data['content'] = 'control/usuarios/new_usuario';
		$data['menu'] = 'control/usuarios/menu_usuario';
		$this->load->view('control/control_layout', $data);

	}else{
		/*
		$this->load->helper('url');
		$slug = url_title($this->input->post('titulo'), 'dash', TRUE);
		*/
		$file  = $this->upload_file();
		if($_FILES['filename']['size'] > 0){
			if ( $file['status'] == 0 ){
				$this->session->set_flashdata('error', $file['msg']);
			}
		}else{
			$file['filename'] = '';
		}

		// set default time zone if not set at php.ini
		if (!date_default_timezone_get('date.timezone'))
		{
		date_default_timezone_set('America/Buenos_Aires');
		}
		$ahora = date("Y-m-d H:i:s");

		//encrypto

		$salt = md5(uniqid(rand(), true));
		$hash = hash('sha512', $salt.$this->input->post('password'));

		$newusuario = array(
			'nombre' => $this->input->post('nombre'),
			'apellido' => $this->input->post('apellido'),
			'email' => $this->input->post('email'),
			'password' => $hash,
			'salt' => $salt,
			'role_id' => 12,
			'created_at' => $ahora,
			'updated_at' => $ahora,
			'filename' => "",
		);
		#save
		$this->usuario->add_record($newusuario);
		$this->session->set_flashdata('success', 'usuario creado. db->insert_id().'">Ver');
		redirect('control/usuarios', 'refresh');

	}

}

//edit
public function editar(){

	$this->load->helper('form');
	$data['title']= 'Editar usuario';
	$data['content'] = 'control/usuarios/edit_usuario';
	$data['menu'] = 'control/usuarios/menu_usuario';
	$data['query'] = $this->usuario->get_record($this->uri->segment(4));
	$this->load->view('control/control_layout', $data);
}

//update
public function update(){

	$this->load->helper('form');
	$this->load->library('form_validation');
	$this->form_validation->set_rules('nombre', 'Nombre', 'required');
	$this->form_validation->set_rules('apellido', 'Apellido', 'required');
	$this->form_validation->set_rules('email', 'Email', 'required');
	$this->form_validation->set_rules('password', 'Password', 'required');

	$this->form_validation->set_message('required','El campo %s es requerido.');

	if ($this->form_validation->run() === FALSE){
		$this->load->helper('form');

		$data['title'] = 'Nuevo usuario';
		$data['content'] = 'control/usuarios/edit_usuario';
		$data['menu'] = 'control/usuarios/menu_usuario';
		$data['query'] = $this->usuario->get_record($this->input->post('id'));
		$this->load->view('control/control_layout', $data);
	}else{
		if($_FILES['filename']['size'] > 0){

			$file  = $this->upload_file();

			if ( $file['status'] != 0 )
				{
				//guardo
				$usuario = $this->usuario->get_record($this->input->post('id'));
					 $path = 'images-usuarios/'.$usuario->filename;
					 if(is_link($path)){
						unlink($path);
					 }

				$data = array('filename' => $file['filename']);
				$this->usuario->update_record($this->input->post('id'), $data);
				}

}
		$id=  $this->input->post('id');

		// set default time zone if not set at php.ini
		if (!date_default_timezone_get('date.timezone'))
		{
		date_default_timezone_set('America/Buenos_Aires');
		}
		$ahora = date("Y-m-d H:i:s");

		//encrypto

		$salt = md5(uniqid(rand(), true));
		$hash = hash('sha512', $salt.$this->input->post('password'));

		$editedusuario = array(
			'nombre' => $this->input->post('nombre'),
			'apellido' => $this->input->post('apellido'),
			'email' => $this->input->post('email'),
			'password' => $hash,
			'salt' => $salt,
			'role_id' => 12,
			'updated_at' => $ahora,
		);

		#save
		$this->session->set_flashdata('success', 'usuario Actualizado!');
		$this->usuario->update_record($id, $editedusuario);
		if($this->input->post('id')!=""){
			redirect('control/usuarios', 'refresh');
		}else{
			redirect('control/usuarios', 'refresh');
		}

	}

}

public function soft_delete(){

	if(!$permiso){
		$retorno = array('status' => 3);
		echo json_encode($retorno);
		exit;
	}
	// 0 Active
	// 1 Deleted
	// 2 Draft
	$id_usuario = $this->input->post('iditem');
	if($id_usuario > 0 && $id_usuario != ""){
		$editedusuario = array(
		'status' => 1,
		);
		$this->usuario->update_record($id_usuario, $editedusuario);
		$retorno = array('status' => 1);
		echo json_encode($retorno);
	}else{
		$retorno = array('status' => 0);
		echo json_encode($retorno);
	}
}

public function upload_file(){

	//1 = OK - 0 = Failure
	$file = array('status' => '', 'filename' => '', 'msg' => '' );

	//check ext.
	$file_extensions_allowed = array('image/gif', 'image/png', 'image/jpeg', 'image/jpg');
	$exts_humano = array('gif', 'png', 'jpeg', 'jpg');
	$exts_humano = implode(', ',$exts_humano);
	$ext = $_FILES['filename']['type'];
	#$ext = strtolower($ext);
	if(!in_array($ext, $file_extensions_allowed)){
		$exts = implode(', ',$file_extensions_allowed);

		$file['msg'] .="
".$_FILES['filename']['name']."
Puede subir archivos que tengan alguna de estas extenciones: ".$exts_humano."
";

	}else{
		include(APPPATH.'libraries/class.upload.php');
		$yukle = new upload;
		$yukle->set_max_size(1900000);
		$yukle->set_directory('./images-usuarios');
		$yukle->set_tmp_name($_FILES['filename']['tmp_name']);
		$yukle->set_file_size($_FILES['filename']['size']);
		$yukle->set_file_type($_FILES['filename']['type']);
		$random = substr(md5(rand()),0,6);
		$name_whitout_whitespaces = str_replace(" ","-",$_FILES['filename']['name']);
		$imagname=''.$random.'_'.$name_whitout_whitespaces;
		#$thumbname='tn_'.$imagname;
		$yukle->set_file_name($imagname);

		$yukle->start_copy();

		if($yukle->is_ok()){
			#$yukle->resize(600,0);
			#$yukle->set_thumbnail_name('tn_'.$random.'_'.$name_whitout_whitespaces);
			#$yukle->create_thumbnail();
			#$yukle->set_thumbnail_size(180, 0);

			//UPLOAD ok
			$file['filename'] = $imagname;
			$file['status'] = 1;
		}
		else{
			$file['status'] = 0 ;
			$file['msg'] = 'Error al subir archivo';
		}

		//clean
		$yukle->set_tmp_name('');
		$yukle->set_file_size('');
		$yukle->set_file_type('');
		$imagname='';
	}//fin if(extencion)

	return $file;
}

} //end class

?>


text:
<?php

namespace common\models;

use Yii;
use \common\models\base\Device as BaseDevice;

/**
 * This is the model class for table "device".
 */
class Device extends BaseDevice
{
		public static function getDeviceTypes() {
			$dt = [];
			foreach(Device::find()->select('device_type')->distinct()->each() as $d) {
				$dt[$d->device_type] = $d->device_type;
			}
			return $dt;
		}
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.resources.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and
 * on resource's non-compliant compliance results.
 */
@Fluent
public final class NonComplianceMessage {
    /*
     * A message that describes why a resource is non-compliant with the
     * policy. This is shown in 'deny' error messages and on resource's
     * non-compliant compliance results.
     */
    @JsonProperty(value = "message", required = true)
    private String message;

    /*
     * The policy definition reference ID within a policy set definition the
     * message is intended for. This is only applicable if the policy
     * assignment assigns a policy set definition. If this is not provided the
     * message applies to all policies assigned by this policy assignment.
     */
    @JsonProperty(value = "policyDefinitionReferenceId")
    private String policyDefinitionReferenceId;

    /**
     * Get the message property: A message that describes why a resource is non-compliant with the policy. This is shown
     * in 'deny' error messages and on resource's non-compliant compliance results.
     *
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Set the message property: A message that describes why a resource is non-compliant with the policy. This is shown
     * in 'deny' error messages and on resource's non-compliant compliance results.
     *
     * @param message the message value to set.
     * @return the NonComplianceMessage object itself.
     */
    public NonComplianceMessage withMessage(String message) {
        this.message = message;
        return this;
    }

    /**
     * Get the policyDefinitionReferenceId property: The policy definition reference ID within a policy set definition
     * the message is intended for. This is only applicable if the policy assignment assigns a policy set definition. If
     * this is not provided the message applies to all policies assigned by this policy assignment.
     *
     * @return the policyDefinitionReferenceId value.
     */
    public String policyDefinitionReferenceId() {
        return this.policyDefinitionReferenceId;
    }

    /**
     * Set the policyDefinitionReferenceId property: The policy definition reference ID within a policy set definition
     * the message is intended for. This is only applicable if the policy assignment assigns a policy set definition. If
     * this is not provided the message applies to all policies assigned by this policy assignment.
     *
     * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set.
     * @return the NonComplianceMessage object itself.
     */
    public NonComplianceMessage withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) {
        this.policyDefinitionReferenceId = policyDefinitionReferenceId;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (message() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property message in model NonComplianceMessage"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(NonComplianceMessage.class);
}


text:
package imageproc.processing.manipulation;

import org.trianacode.gui.windows.ErrorDialog;
import org.trianacode.taskgraph.Unit;
import triana.types.TrianaPixelMap;
import triana.types.image.PixelMap;

/**
 * A ImageXor unit to ..
 *
 * @author Melanie Rhianna Lewis
 * @version 1.0 alpha 10 Sep 1997
 */
public class ImageXor extends Unit {

    /**
     * ********************************************* ** USER CODE of ImageXor goes here    ***
     * *********************************************
     */
    public void process() {
        int i, p1, p2, r, g, b;

        TrianaPixelMap trianaPixelMap1 = (TrianaPixelMap) getInputAtNode(0);
        TrianaPixelMap trianaPixelMap2 = (TrianaPixelMap) getInputAtNode(1);
        PixelMap pixelMap1 = trianaPixelMap1.getPixelMap();
        PixelMap pixelMap2 = trianaPixelMap2.getPixelMap();

        if ((pixelMap1.width != pixelMap2.width) ||
                (pixelMap1.height != pixelMap2.height)) {
            new ErrorDialog(
                    getTask().getToolName() + ": Error, incompatible image dimensions." + "\n" +
                            "Dimensions for the source images must be similar!");
            //stop();  // stops the scheduler and hence this process!
        } else {
            PixelMap newPixelMap = new PixelMap(pixelMap1);
            int[] pixels1 = pixelMap1.pixels;
            int[] pixels2 = pixelMap2.pixels;
            int[] newPixels = newPixelMap.pixels;

            for (i = 0; i < pixels1.length; i++) {
                p1 = pixels1[i];
                p2 = pixels2[i];

                r = ((p1 >> 16) & 0xff) | ((p2 >> 16) & 0xff);
                g = ((p1 >> 8) & 0xff) | ((p2 >> 8) & 0xff);
                b = (p1 & 0xff) & (p2 | 0xff);

                newPixels[i] = 0xff000000 | (r << 16) | (g << 8) | b;
            }

            output(new TrianaPixelMap(newPixelMap));
        }
    }

    /**
     * Initialses information specific to ImageXor.
     */
    public void init() {
        super.init();

        setDefaultInputNodes(2);
        setMinimumInputNodes(2);
        setMaximumInputNodes(2);

        setDefaultOutputNodes(1);
        setMinimumOutputNodes(1);
        setMaximumOutputNodes(Integer.MAX_VALUE);
    }

    /**
     * Reset's ImageXor
     */
    public void reset() {
        super.reset();
    }

    /**
     * Saves ImageXor's parameters to the parameter file.
     */
    public void saveParameters() {
    }

    /**
     * Loads ImageXor's parameters of from the parameter file.
     */
    public void setParameter(String name, String value) {
    }

    /**
     * @return a string containing the names of the types allowed to be input to ImageXor, each separated by a white
     *         space.
     */
    public String[] getInputTypes() {
        return new String[]{"triana.types.TrianaPixelMap"};
    }

    public String[] getOutputTypes() {
        return new String[]{"triana.types.TrianaPixelMap"};
    }

    /**
     * This returns a <b>brief!</b> description of what the unit does. The text here is shown in a pop up window when
     * the user puts the mouse over the unit icon for more than a second.
     */
    public String getPopUpDescription() {
        return "Logically exclusive ors the values of the pixels in two PixelMaps.";
    }

    /**
     * @returns the location of the help file for this unit.
     */
    public String getHelpFile() {
        return "ImageXor.html";
    }
}


text:
918. Maximum Sum Circular Subarray (Medium)
Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C.

Here, a circular array means the end of the array connects to the beginning of the array.  (Formally, C[i] = A[i] when 0 <= i < A.length, and C[i+A.length] = C[i] when i >= 0.)

Also, a subarray may only include each element of the fixed buffer A at most once.  (Formally, for a subarray C[i], C[i+1], ..., C[j], there does not exist i <= k1, k2 <= j with k1 % A.length = k2 % A.length.)

### Example 1:
```
Input: [1,-2,3,-2]
Output: 3
Explanation: Subarray [3] has maximum sum 3
```

### Example 2:
```
Input: [5,-3,5]
Output: 10
Explanation: Subarray [5,5] has maximum sum 5 + 5 = 10
```

### Example 3:
```
Input: [3,-1,2,-1]
Output: 4
Explanation: Subarray [2,-1,3] has maximum sum 2 + (-1) + 3 = 4
```

### Example 4:
```
Input: [3,-2,2,-3]
Output: 3
Explanation: Subarray [3] and [3,-2,2] both have maximum sum 3
```

### Example 5:
```
Input: [-2,-3,-1]
Output: -1
Explanation: Subarray [-1] has maximum sum -1
```

### Note:
- -30000 <= A[i] <= 30000
- 1 <= A.length <= 30000

## Solution
This is twisted version of [#53](../p053e/README.md). There are two cases.

- The first is that the subarray take only a middle part, and we know how to find the max subarray sum.
- The second is that the subarray take a part of head array and a part of tail array. We can transfer this case to the first one. The maximum result equals to the total sum minus the minimum subarray sum.

### Corner case
If all numbers are negative, maxSum = max(A) and minSum = sum(A). In this case, max(maxSum, total - minSum) = 0, which means the sum of an empty subarray, but we need to return the max(A), instead of sum of am empty subarray.

#Similar Questions [#53](../p053e/README.md) [#152](../p152m/README.md) [#918](../p918m/README.md)


text:
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.

for fgbg in 38 48 ; do #Foreground/Background
    for color in {0..255} ; do #Colors
    	#Display the color
    	#echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m"
    	echo -en "\e[${fgbg};5;${color}m"
        printf "%4d " ${color}
        echo -en "\e[0m"
    	#Display 16 colors per lines
    	if [ $((($color + 1) % 16)) == 0 ] ; then
    	    echo #New line
    	fi
    done
    echo #New line
done

exit 0


text:
#ifndef CONTENT_BROWSER_RENDERER_HOST_WEB_EVENT_FACTORY_H_
#define CONTENT_BROWSER_RENDERER_HOST_WEB_EVENT_FACTORY_H_

#include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"

class QHoverEvent;
class QKeyEvent;
class QMouseEvent;
class QWheelEvent;

namespace content {

class WebEventFactory {
 public:
  static blink::WebMouseEvent toWebMouseEvent(QMouseEvent*,
      float device_scale_factor);
  static blink::WebMouseEvent toWebMouseEvent(QHoverEvent*,
      float device_scale_factor);
  static blink::WebMouseWheelEvent toWebWheelEvent(QWheelEvent*,
      float device_scale_factor);
  static content::NativeWebKeyboardEvent toWebKeyboardEvent(QKeyEvent*);
};

} // namespace content

#endif // CONTENT_BROWSER_RENDERER_HOST_WEB_EVENT_FACTORY_H_


text:
package com.cooltee.dao.entity;

import com.cooltee.dao.orm.BaseEntity;
import org.hibernate.annotations.Cache;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * TODO add distributions about this class
 * Created by alittleseven on 2017/2/19.
 */

@Entity
@Table(name ="veh_drive_record")
public class DriveRecord extends BaseEntity{

    @Id
    @GeneratedValue
    @Column(name = "id")
    private Long id;

    @Column(name = "driver_id")
    private Long driver_id;

    @Column(name = "vehicle_id")
    private Long vehicle_id;

    @Column(name = "distance")
    private int distance;

    @Column(name = "create_time")
    private Timestamp create_time;

    @Column(name = "update_time")
    private Timestamp update_time;

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

    @Override
    public Long getId() {
        return id;
    }

    public void setDriver_id(Long driver_id) {
        this.driver_id = driver_id;
    }

    public Long getDriver_id() {
        return driver_id;
    }

    public void setVehicle_id(Long vehicle_id) {
        this.vehicle_id = vehicle_id;
    }

    public Long getVehicle_id() {
        return vehicle_id;
    }

    public void setDistance(int distance) {
        this.distance = distance;
    }

    public int getDistance() {
        return distance;
    }

    public void setCreate_time(Timestamp create_time) {
        this.create_time = create_time;
    }

    public Timestamp getCreate_time() {
        return create_time;
    }

    public void setUpdate_time(Timestamp update_time) {
        this.update_time = update_time;
    }

    public Timestamp getUpdate_time() {
        return update_time;
    }
}