text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~  Copyright(c) 2017 lizhaotailang
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/activity_vertical_margin"
    android:paddingRight="@dimen/activity_vertical_margin"
    android:paddingTop="@dimen/activity_horizontal_margin"
    android:paddingBottom="@dimen/activity_horizontal_margin"
    android:id="@+id/layoutPackageItemMain"
    android:background="@color/layout_background">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:id="@+id/imageViewAvatar" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textViewAvatar"
            android:layout_gravity="center"
            android:textColor="@android:color/white"
            android:textSize="32sp"/>

    </FrameLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginStart="16dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textViewPackageName"
            android:maxLines="1"
            android:textAppearance="@style/TextAppearance.AppCompat.Body2" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textViewStatus"
            android:textAppearance="@style/TextAppearance.AppCompat.Small" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textViewTime"
            android:maxLines="1"
            android:textAppearance="@style/TextAppearance.AppCompat.Small" />

    </LinearLayout>

</LinearLayout>


text:
import { connect } from 'react-redux'
import { compose } from 'redux'
import { reduxForm } from 'redux-form'
import validator from '@helpers/validator'
import schema from '@schemas/addModule'
import ModuleSettingsForm from '@routes/DeviceSettingsPage/components/ModuleSettingsForm'
import { nameConfirmationAwaiting, nameConfirmationClear } from '@modules/confirmation/actions'
import * as moduleActions from '@modules/modules/actions'

const validate = values => validator(values, schema)

const mapDispatchToProps = dispatch => ({
  updateModule(module) {
    return dispatch(moduleActions.updateModule(module))
      .catch(() => false)
  },
  confirmationAwait(module, waiting) {
    return dispatch(nameConfirmationAwaiting(module, waiting))
  },
  confirmationClear(module) {
    return dispatch(nameConfirmationClear(module))
  },
})

const mapStateToProps = (state, ownProps) => ({
  initialValues: {
    name: ownProps.serial ? state.modules.get('modules').get(ownProps.serial).name : null,
    relay1: ownProps.serial && state.modules.get('modules').get(ownProps.serial).components ?
      state.modules.get('modules').get(ownProps.serial).components.relay1.name : null,
    relay2: ownProps.serial && state.modules.get('modules').get(ownProps.serial).components ?
      state.modules.get('modules').get(ownProps.serial).components.relay2.name : null,
    location: ownProps.serial ? state.modules.get('modules').get(ownProps.serial).location : null,
    morpheusId: ownProps.serial ?
      state.modules.get('modules').get(ownProps.serial).morpheus._id : null,
  },
  confirmationArrived: ownProps.serial ? state.confirmation.get(ownProps.serial).get('name').get('payload') !== null : false,
  confirmationAwaited: ownProps.serial ? state.confirmation.get(ownProps.serial).get('name').get('waiting') : false,
  module: ownProps.serial ? state.modules.get('modules').get(ownProps.serial) : null,
  morpheus: state.morpheus.get('morpheus').toJS(),
  moduleUpdating: state.modules.get('isUpdating'),
})

export default compose(
  connect(mapStateToProps, mapDispatchToProps),
  reduxForm({
    form: 'ModuleSettingsForm',
    enableReinitialize: true,
    validate,
  }),
)(ModuleSettingsForm)

redpajama_set_name: RedPajamaGithub


text:
package sk.tuke.xhl.examples.statemachine;

/**
 * Event
 *
 * Example by Martin Fowler: http://martinfowler.com/dslwip/Intro.html
 */
public class Event extends AbstractEvent {

    public Event(String name, String code) {
        super(name, code);
    }

}


text:
<?php

namespace albaraam\push;

use albaraam\gcmapns\Message;

interface IPushService
{
    /**
     * @param string $id service id.
     */
    public function setId($id);

    /**
     * @return string service id
     */
    public function getId();

    /**
     * @return string service name.
     */
    public function getName();

    /**
     * @param string $name service name.
     */
    public function setName($name);

    /**
     * @param $token
     * @param $device_type
     * @return string service_device_id
     */
    public function register($token, $device_type);

    /**
     * @param $service_device_id
     * @return bool
     */
    public function unRegister($service_device_id);

    /**
     * @param $name
     * @return string service_channel_id
     */
    public function createChannel($name);

    /**
     * @param $service_channel_id
     * @return bool
     */
    public function deleteChannel($service_channel_id);

    /**
     * @param $service_device_id
     * @param $service_channel_id
     * @return string service_subscription_id
     */
    public function subscribe($service_device_id, $service_channel_id);

    /**
     * @param $service_subscription_id
     * @return bool
     */
    public function unSubscribe($service_subscription_id);

    /**
     * @param $service_channel_id
     * @param $pushMessage Message
     * @return bool
     */
    public function sendToChannel($service_channel_id, $pushMessage);

}


text:
package org.apache.sysml.runtime.controlprogram.parfor;

import java.util.Collection;

import org.apache.sysml.conf.CompilerConfig;
import org.apache.sysml.conf.ConfigurationManager;
import org.apache.sysml.hops.OptimizerUtils;
import org.apache.sysml.runtime.controlprogram.context.SparkExecutionContext;
import org.apache.sysml.runtime.controlprogram.parfor.stat.Stat;
import org.apache.sysml.runtime.controlprogram.parfor.stat.StatisticMonitor;
import org.apache.sysml.runtime.controlprogram.parfor.stat.Timing;

/**
 * Instances of this class can be used to execute tasks in parallel. Within each ParWorker
 * multiple iterations of a single task and subsequent tasks are executed sequentially.
 *
 * Resiliency approach: retry on computation error, abort on task queue error
 *
 *
 */
public class LocalParWorker extends ParWorker implements Runnable
{
	protected LocalTaskQueue<Task> _taskQueue   = null;

	protected Collection<String> _fnNames = null;

	protected CompilerConfig _cconf  = null;
	protected boolean   _stopped     = false;
	protected int 		_max_retry   = -1;

	public LocalParWorker( long ID, LocalTaskQueue<Task> q, ParForBody body, CompilerConfig cconf, int max_retry, boolean monitor )
	{
		super(ID, body, monitor);

		_taskQueue = q;

		_cconf = cconf;
		_stopped   = false;
		_max_retry = max_retry;
	}

	public void setFunctionNames(Collection<String> fnNames) {
		_fnNames = fnNames;
	}

	public Collection<String> getFunctionNames() {
		return _fnNames;
	}

	@Override
	public void run()
	{
		// monitoring start
		Timing time1 = ( _monitor ? new Timing(true) : null );

		//setup fair scheduler pool for worker thread, but avoid unnecessary
		//spark context creation (if data cached already created)
		if( OptimizerUtils.isSparkExecutionMode()
			&& SparkExecutionContext.isSparkContextCreated() ) {
			SparkExecutionContext sec = (SparkExecutionContext)_ec;
			sec.setThreadLocalSchedulerPool("parforPool"+_workerID);
		}

		//setup compiler config for worker thread
		ConfigurationManager.setLocalConfig(_cconf);

		// continuous execution (execute tasks until (1) stopped or (2) no more tasks)
		Task lTask = null;

		while( !_stopped )
		{
			//dequeue the next task (abort on NO_MORE_TASKS or error)
			try
			{
				lTask = _taskQueue.dequeueTask();

				if( lTask == LocalTaskQueue.NO_MORE_TASKS ) // task queue closed (no more tasks)
					break; //normal end of parallel worker
			}
			catch(Exception ex)
			{
				// abort on taskqueue error
				LOG.warn("Error reading from task queue: "+ex.getMessage());
				LOG.warn("Stopping LocalParWorker.");
				break; //no exception thrown to prevent blocking on join
			}

			//execute the task sequentially (re-try on error)
			boolean success = false;
			int retrys = _max_retry;

			while( !success )
			{
				try
				{
					///////
					//core execution (see ParWorker)
					executeTask( lTask );
					success = true;
				}
				catch (Exception ex)
				{
					LOG.error("Failed to execute "+lTask.toString()+", retry:"+retrys, ex);

					if( retrys > 0 )
						retrys--; //retry on task error
					else
					{
						// abort on no remaining retrys
						LOG.error("Error executing task: ",ex);
						LOG.error("Stopping LocalParWorker.");
						break; //no exception thrown to prevent blocking on join
					}
				}
			}
		}

		//setup fair scheduler pool for worker thread
		if( OptimizerUtils.isSparkExecutionMode()
			&& SparkExecutionContext.isSparkContextCreated() ) {
			SparkExecutionContext sec = (SparkExecutionContext)_ec;
			sec.cleanupThreadLocalSchedulerPool();
		}

		if( _monitor ) {
			StatisticMonitor.putPWStat(_workerID, Stat.PARWRK_NUMTASKS, _numTasks);
			StatisticMonitor.putPWStat(_workerID, Stat.PARWRK_NUMITERS, _numIters);
			StatisticMonitor.putPWStat(_workerID, Stat.PARWRK_EXEC_T, time1.stop());
		}
	}
}


text:
#import "ElasticLoadBalancingSetLoadBalancerPoliciesForBackendServerRequestMarshaller.h"

@implementation ElasticLoadBalancingSetLoadBalancerPoliciesForBackendServerRequestMarshaller

+(AmazonServiceRequest *)createRequest:(ElasticLoadBalancingSetLoadBalancerPoliciesForBackendServerRequest *)setLoadBalancerPoliciesForBackendServerRequest
{
    AmazonServiceRequest *request = [[ElasticLoadBalancingRequest alloc] init];

    [request setParameterValue:@"SetLoadBalancerPoliciesForBackendServer"           forKey:@"Action"];
    [request setParameterValue:@"2011-11-15"   forKey:@"Version"];

    [request setDelegate:[setLoadBalancerPoliciesForBackendServerRequest delegate]];
    [request setCredentials:[setLoadBalancerPoliciesForBackendServerRequest credentials]];
    [request setEndpoint:[setLoadBalancerPoliciesForBackendServerRequest requestEndpoint]];
    [request setRequestTag:[setLoadBalancerPoliciesForBackendServerRequest requestTag]];

    if (setLoadBalancerPoliciesForBackendServerRequest != nil) {
        if (setLoadBalancerPoliciesForBackendServerRequest.loadBalancerName != nil) {
            [request setParameterValue:[NSString stringWithFormat:@"%@", setLoadBalancerPoliciesForBackendServerRequest.loadBalancerName] forKey:[NSString stringWithFormat:@"%@", @"LoadBalancerName"]];
        }
    }
    if (setLoadBalancerPoliciesForBackendServerRequest != nil) {
        if (setLoadBalancerPoliciesForBackendServerRequest.instancePort != nil) {
            [request setParameterValue:[NSString stringWithFormat:@"%@", setLoadBalancerPoliciesForBackendServerRequest.instancePort] forKey:[NSString stringWithFormat:@"%@", @"InstancePort"]];
        }
    }

    if (setLoadBalancerPoliciesForBackendServerRequest != nil) {
        int policyNamesListIndex = 1;

        if ([setLoadBalancerPoliciesForBackendServerRequest.policyNames count] == 0) {
            [request setParameterValue:@"" forKey:@"PolicyNames"];
        }
        for (NSString *policyNamesListValue in setLoadBalancerPoliciesForBackendServerRequest.policyNames) {
            if (policyNamesListValue != nil) {
                [request setParameterValue:[NSString stringWithFormat:@"%@", policyNamesListValue] forKey:[NSString stringWithFormat:@"%@.member.%d", @"PolicyNames", policyNamesListIndex]];
            }

            policyNamesListIndex++;
        }
    }

    return [request autorelease];
}

@end


text:
//*******************************************************************************************//
//                                                                                //
// Download Free Evaluation Version From: https://bytescout.com/download/web-installer       //
//                                                                                //
// Also available as Web API! Get Your Free API Key: https://app.pdf.co/signup               //
//                                                                                //
// Copyright © 2017-2020 ByteScout, Inc. All rights reserved.                                //
// https://www.bytescout.com                                                                 //
// https://pdf.co                                                                            //
//                                                                                //
//*******************************************************************************************//

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using System.IO;
using System.Diagnostics;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();

            // Add new worksheet
            Worksheet worksheet = document.Workbook.Worksheets.Add("HelloWorld");

            // Set cell value
            worksheet.Cell(0, 0).Value = "Hello, World!";

            // delete output file if exists already
            if (File.Exists("Output.xls")){
                File.Delete("Output.xls");
            }

            // Save document
            document.SaveAs("Output.xls");

            // Close Spreadsheet
            document.Close();

            // open generated XLS document in default program
            Process.Start("Output.xls");
        }
    }
}


text:
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var clientSessions = require("client-sessions");

var routes = require('./routes/index');
var users = require('./routes/users');
var login = require('./routes/login');
var register = require('./routes/register');
var logout = require('./routes/logout');
var dashboard = require('./routes/dashboard');
var api = require('./routes/api');

var app = express();

app.use(clientSessions({
  cookieName: 'session',
  secret: 'kFjaa4mRU9m8B3wuv3hFCQudJuHfAc',
  duration: 1800000,
  cookie:{
      ephemeral: true
  }
}));
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', routes);
app.use('/users', users);
app.use('/login', login);
app.use('/register', register);
app.use('/logout', logout);
app.use('/dashboard', dashboard);
app.use('/api', api);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handlers

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: err
    });
  });
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});

module.exports = app;


text:
import time
import torch
import argparse
import torchvision
import numpy as np
from torch.autograd import Variable
import torchvision.models as models
import torch.backends.cudnn as cudnn
import psutil
cudnn.benchmark = True

# Training settings
parser = argparse.ArgumentParser(description='PyTorch Quick Stress Test')
parser.add_argument('--batch-size', type=int, default=100, metavar='N',
                    help='input batch size for training (default: 100)')
parser.add_argument('--iteration', type=int, default=100, metavar='N',
                    help='number of iteration to test (default: 100)')
parser.add_argument('--warm-up-steps', type=int, default=5, metavar='N',
                    help='number of steps to train (default: 5)')
parser.add_argument('--lr', type=float, default=0.01, metavar='LR',
                    help='learning rate (default: 0.01)')
parser.add_argument('--seed', type=int, default=1, metavar='S',
                    help='random seed (default: 1)')
parser.add_argument('--no-cuda', action='store_true', default=False,
                    help='disables CUDA training')
parser.add_argument('--fp16', action='store_true', default=False,
                    help='Enable FP16 (Mixed Precision Training)')
parser.add_argument('--log-interval', type=int, default=10, metavar='N',
                    help='how many steps to wait before logging training status')

args = parser.parse_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()

torch.manual_seed(args.seed)
if args.cuda:
    torch.cuda.manual_seed(args.seed)

# Model ResNet if GPU detected, otherwise AlexNet
if args.cuda:
    net = models.resnet50()
else:
    net = models.alexnet()

# Log Info
print("-" * 64)
print("TEST INFO - PYTORCH STRESS TEST")
print("-" * 64)
print("PyTorch version:\t {}".format(torch.__version__))
print("Dataset:\t ImageNet Synthetic")
print("Data Format:\t NCHW (Channel First)")
print("Batch Size:\t {}".format(args.batch_size))
print("CUDA support:\t {}".format(torch.cuda.is_available()))

if torch.cuda.is_available():
    print("Model: \t ResNet50")
    print("Number of GPUs:\t {}".format(torch.cuda.device_count()))
else:
    print("Model: \t AlexNet")
    print("CPU cores:\t {}".format(psutil.cpu_count()))
print("=" * 64)

# Synthetic ImageNet Input (Data Format: Channel First)
inp = torch.randn(args.batch_size, 3, 224, 224)

# CUDA?
if args.cuda:
    net.cuda()
    inp = inp.cuda()

# MXP? (require CUDA enabled)
if args.cuda and args.fp16:
    net.half()
    inp = inp.half()

print("Warm Up")
# Warm Up
for i in range(args.warm_up_steps):
    net.zero_grad()
    out = net.forward(Variable(inp, requires_grad=True))
    loss = out.sum()
    loss.backward()

# if multipgpus
#torch.cuda.synchronize()

rate_list_accumulator = 0

print("Iteration \t Rate (Iter/s) \t Loss")
start=time.time()
for i in range(args.iteration):
    batch_start=time.time()
    net.zero_grad()
    out = net.forward(Variable(inp, requires_grad=True))
    loss = out.sum()
    loss.backward()
    batch_end=time.time()

    rate_list_accumulator += batch_end-batch_start
    # Logging
    if i != 0 and i % args.log_interval == 0:
        rate = args.log_interval/rate_list_accumulator
        print("{} \t {:.3f} ({:.3f} Imgs/s) \t {:.3f}".format(i, rate, rate*args.batch_size, -np.asscalar(loss.type(torch.FloatTensor).data.cpu().numpy())))
        rate_list_accumulator = 0
end=time.time()

# if multipgpus
#torch.cuda.synchronize()

final_rate = args.iteration/(end-start)
print("[Result on {} steps] Iterations per second: {:.3f} ( {:.3f} Imgs/s)".format(args.iteration, final_rate, final_rate*args.batch_size))


text:
@interface UpcomingMoviesNavigationController()
@property (retain) UpcomingMoviesViewController* upcomingMoviesViewController;
@end

@implementation UpcomingMoviesNavigationController

@synthesize upcomingMoviesViewController;

- (void) dealloc {
  self.upcomingMoviesViewController = nil;

  [super dealloc];
}

- (id) init {
  if ((self = [super init])) {
    self.title = LocalizedString(@"Upcoming", nil);
    self.tabBarItem.image = BoxOfficeStockImage(@"Upcoming.png");
  }

  return self;
}

- (void) loadView {
  [super loadView];

  if (upcomingMoviesViewController == nil) {
    self.upcomingMoviesViewController = [[[UpcomingMoviesViewController alloc] init] autorelease];
    [self pushViewController:upcomingMoviesViewController animated:NO];
  }
}

- (Movie*) movieForTitle:(NSString*) canonicalTitle {
  for (Movie* movie in [[UpcomingCache cache] movies]) {
    if ([movie.canonicalTitle isEqual:canonicalTitle]) {
      return movie;
    }
  }

  return [super movieForTitle:canonicalTitle];
}

@end


text:
"""Add Admin role.

Revision ID: 3be0d9d2c9f8
Revises: 3148b80be376
Create Date: 2013-10-05 14:07:22.359908

"""

# revision identifiers, used by Alembic.
revision = '3be0d9d2c9f8'
down_revision = '3148b80be376'

import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
from sqlalchemy.sql import table, column, and_

roles_table = table('roles',
    column('id', sa.Integer),
    column('name', sa.String),
    column('permissions_json', sa.Text),
    column('description', sa.Text),
    column('modified_by_id', sa.Integer),
    column('created_at', sa.DateTime),
    column('updated_at', sa.DateTime),
    column('context_id', sa.Integer),
    column('scope', sa.String),
    )

contexts_table = table('contexts',
    column('id', sa.Integer),
    column('name', sa.String),
    column('description', sa.Text),
    )

def upgrade():
  current_datetime = datetime.now()

  # Add an explicit Admin context with id 0
  op.execute(
      contexts_table.insert().values(
        name='System Administration',
        description='Context for super-user permissions.',
        ))
  # Insert with id set seems to fail on mysql due to auto-incremented id.
  # force it after the fact.
  op.execute(
      contexts_table.update().values(id=0).where(
        contexts_table.c.name=='System Administration'))

  # Add the System Administrator role
  op.execute(
      roles_table.insert().values(
        name='System Administrator',
        description='gGRC System Administrator with super-user privileges',
        permissions_json=json.dumps({
           '__GGRC_ADMIN__': ['__GGRC_ALL__'],
           }),
        created_at=current_datetime,
        updated_at=current_datetime,
        scope='Admin'
        ))

def downgrade():
  op.execute(
      roles_table.delete().where(
        and_(
          roles_table.c.name=='System Administrator',
          roles_table.c.scope=='Admin')
        ))
  op.execute(contexts_table.delete().where(contexts_table.c.id==0))


text:
**Elixir API Wrapper for [Cognitive Services](https://www.microsoft.com/cognitive-services/en-us/apis) from Microsoft**

## Installation

The package can be installed as:

  1. Add `Cognixir` to your list of dependencies in `mix.exs`:

    ```elixir
    def deps do
      [{:cognixir, "~> 0.4.0"}]
    end
    ```

  2. Ensure `Cognixir` is started before your application:

    ```elixir
    def application do
      [applications: [:cognixir]]
    end
    ```

## Configuration

You need a subscription key to access the different cognitive service api. Head over to https://www.microsoft.com/cognitive-services, create an account and fetch your api key. You can get started with a free subscription.

Add to your config.exs:

```elixir
# api key for text analytics
config :cognixir, ta_api_key: "<your key>"
# api key for computer vision
config :cognixir, cv_api_key: "<your key>"
# api key for face api
config :cognixir, fa_api_key: "<your key>"
```

## Implemented Features

### Text Analytics
 * detect language [x]
 * initiate topic analysis [x]
 * detect key phrases [x]
 * detect sentiment [x]

### Computer Vision
 * analyze image [x]
 * describe image [x]
 * get thumbnail []
 * list domain specific models []
 * OCR [x]
 * recognize domain specific content []
 * tag image [x]

### Face Api
 * face detection [x]
 * find similar []
 * group []
 * identify []
 * verify [x]

## Api Documentation

You can find the api documentation for published packages on [Hex Doc](https://hexdocs.pm/cognixir/api-reference.html)

## Demo Application & Usage

If you want to see this api in action, check out [CognixirDemo](https://github.com/BrummbQ/cognixir-demo). That application tries to illustrate the main features and usage of this library. For api examples you might also have a look in the tests directory.


text:
import { compute } from 'cerebral'
import { state } from 'cerebral/tags'

export default compute(state`todos`, state`filter`, (todos, filter) => {
  return Object.keys(todos).filter(uid => {
    return (
      filter === 'all' ||
      (filter === 'completed' && todos[uid].completed) ||
      (filter === 'active' && !todos[uid].completed)
    )
  })
})


text:
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#include "pch.h"
#include "ContextualSearchGameClipStat_WinRT.h"

using namespace Microsoft::Xbox::Services;
using namespace Microsoft::Xbox::Services::System;
using namespace Platform;
using namespace Platform::Collections;
using namespace Windows::Foundation::Collections;
using namespace Windows::Foundation;
using namespace xbox::services::contextual_search;

NAMESPACE_MICROSOFT_XBOX_SERVICES_CONTEXTUAL_SEARCH_BEGIN

ContextualSearchGameClipStat::ContextualSearchGameClipStat(
    _In_ xbox::services::contextual_search::contextual_search_game_clip_stat cppObj
    ) :
    m_cppObj(std::move(cppObj))
{
}

NAMESPACE_MICROSOFT_XBOX_SERVICES_CONTEXTUAL_SEARCH_END


text:
<?php

/**
 * Upload handler for the filemanager/util/browser dialog.
 */

$page->layout = false;

if (! User::require_acl ('admin') || ! User::require_acl ('filemanager')) {
	echo json_encode (array ('success' => false, 'error' => __ ('Must be logged in to upload')));
	return;
}

$f = new Form ('post', $this);
$_POST['_token_'] = $_POST['token'];
if (! $f->verify_csrf ('/filemanager')) {
	echo json_encode (array ('success' => false, 'error' => __ ('Validation error')));
	return;
}

$root = getcwd () . '/' . conf('Paths','filemanager_path') . '/';

if (! FileManager::verify_folder ($_POST['path'], $root)) {
	echo json_encode (array ('success' => false, 'error' => __ ('Invalid path')));
	return;
}

if (! isset ($_FILES['file'])) {
	echo json_encode (array ('success' => false, 'error' => __ ('No file uploaded or file too large.')));
	return;
}

if (isset ($_FILES['file']['error']) && $_FILES['file']['error'] > 0) {
	$errors = array (
		1 => __ ('File size is too large.'),
		2 => __ ('File size is too large.'),
		3 => __ ('The file was only partially uploaded.'),
		4 => __ ('No file was uploaded.'),
		6 => __ ('Missing a temporary folder, check your PHP setup.'),
		7 => __ ('Failed to write the file to disk.'),
		8 => __ ('A PHP extension stopped the file upload.')
	);
	echo json_encode (array ('success' => false, 'error' => $errors[$_FILES['file']['error']]));
	return;
}

// some browsers may urlencode the file name
$_FILES['file']['name'] = trim (urldecode ($_FILES['file']['name']));

if (preg_match ('/\.(php|phtml|pht|php3|php4|php5|phar|js|rb|py|pl|sh|bash|exe|htaccess|htpasswd)$/i', $_FILES['file']['name'])) {
	echo json_encode (array ('success' => false, 'error' => __ ('Cannot upload executable files due to security.')));
	return;
}

if (strpos ($_FILES['file']['name'], '..') !== false) {
	echo json_encode (array ('success' => false, 'error' => __ ('The file name contains invalid characters.')));
	return;
}

if (@move_uploaded_file ($_FILES['file']['tmp_name'], $root . $_POST['path'] . '/' . $_FILES['file']['name'])) {
	@chmod ($root . $_POST['path'] . '/' . $_FILES['file']['name'], 0666);
	$this->hook ('filemanager/add', array (
		'file' => $_POST['path'] . '/' . $_FILES['file']['name']
	));
} else {
	echo json_encode (array ('success' => false, 'error' => __ ('Unable to save the file') . ': ' . $_FILES['file']['name']));
	return;
}

echo json_encode (array ('success' => true, 'data' => __ ('File saved.')));


text:
/*
 * User: anna
 * Date: 14-May-2007
 */
package com.intellij.execution.configuration;

import com.intellij.execution.ExecutionBundle;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.UserActivityProviderComponent;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

import javax.swing.event.ChangeListener;
import java.util.Map;

public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWithBrowseButton> implements UserActivityProviderComponent {
  @NonNls private static final String ENVS = "envs";
  @NonNls public static final String ENV = "env";
  @NonNls public static final String NAME = "name";
  @NonNls public static final String VALUE = "value";
  @NonNls private static final String OPTION = "option";
  @NonNls private static final String ENV_VARIABLES = "ENV_VARIABLES";

  private final EnvironmentVariablesTextFieldWithBrowseButton myEnvVars;

  public EnvironmentVariablesComponent() {
    super();
    myEnvVars = new EnvironmentVariablesTextFieldWithBrowseButton();
    setComponent(myEnvVars);
    setText(ExecutionBundle.message("environment.variables.component.title"));
  }

  public void setEnvs(@NotNull Map<String, String> envs) {
    myEnvVars.setEnvs(envs);
  }

  @NotNull
  public Map<String, String> getEnvs() {
    return myEnvVars.getEnvs();
  }

  public boolean isPassParentEnvs() {
    return myEnvVars.isPassParentEnvs();
  }

  public void setPassParentEnvs(final boolean passParentEnvs) {
    myEnvVars.setPassParentEnvs(passParentEnvs);
  }

  @NotNull
  public EnvironmentVariablesData getEnvData() {
    return myEnvVars.getData();
  }

  public void setEnvData(@NotNull EnvironmentVariablesData envData) {
    myEnvVars.setData(envData);
  }

  public static void readExternal(Element element, Map<String, String> envs) {
    final Element envsElement = element.getChild(ENVS);
    if (envsElement != null) {
      for (Object o : envsElement.getChildren(ENV)) {
        Element envElement = (Element)o;
        final String envName = envElement.getAttributeValue(NAME);
        final String envValue = envElement.getAttributeValue(VALUE);
        if (envName != null && envValue != null) {
          envs.put(envName, envValue);
        }
      }
    } else { //compatibility with prev version
      for (Object o : element.getChildren(OPTION)) {
        if (Comparing.strEqual(((Element)o).getAttributeValue(NAME), ENV_VARIABLES)) {
          splitVars(envs, ((Element)o).getAttributeValue(VALUE));
          break;
        }
      }
    }
  }

  private static void splitVars(final Map<String, String> envs, final String val) {
    if (val != null) {
      final String[] envVars = val.split(";");
      for (String envVar : envVars) {
        final int idx = envVar.indexOf('=');
        if (idx > -1) {
          envs.put(envVar.substring(0, idx), idx < envVar.length() - 1 ? envVar.substring(idx + 1) : "");
        }
      }
    }
  }

  public static void writeExternal(@NotNull Element element, @NotNull Map<String, String> envs) {
    final Element envsElement = new Element(ENVS);
    for (String envName : envs.keySet()) {
      final Element envElement = new Element(ENV);
      envElement.setAttribute(NAME, envName);
      envElement.setAttribute(VALUE, envs.get(envName));
      envsElement.addContent(envElement);
    }
    element.addContent(envsElement);
  }

  @Override
  public void addChangeListener(final ChangeListener changeListener) {
    myEnvVars.addChangeListener(changeListener);
  }

  @Override
  public void removeChangeListener(final ChangeListener changeListener) {
    myEnvVars.removeChangeListener(changeListener);
  }
}


text:
function(detect_cuDNN)
  set(CUDNN_ROOT "" CACHE PATH "CUDNN root folder")

  find_path(CUDNN_INCLUDE cudnn.h
            PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDA_TOOLKIT_INCLUDE}
            DOC "Path to cuDNN include directory." )

  get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)
  find_library(CUDNN_LIBRARY NAMES libcudnn.so # libcudnn_static.a
                             PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDNN_INCLUDE} ${__libpath_hist}
                             DOC "Path to cuDNN library.")

  if(CUDNN_INCLUDE AND CUDNN_LIBRARY)
    set(HAVE_CUDNN  TRUE PARENT_SCOPE)
    set(CUDNN_FOUND TRUE PARENT_SCOPE)

    mark_as_advanced(CUDNN_INCLUDE CUDNN_LIBRARY CUDNN_ROOT)
    message(STATUS "Found cuDNN (include: ${CUDNN_INCLUDE}, library: ${CUDNN_LIBRARY})")
  endif()
endfunction()


text:
package org.ethereum.manager;

import static org.ethereum.config.SystemProperties.CONFIG;

import java.math.BigInteger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import org.ethereum.core.AccountState;
import org.ethereum.core.Blockchain;
import org.ethereum.core.Wallet;
import org.ethereum.crypto.ECKey;
import org.ethereum.crypto.HashUtil;
import org.ethereum.db.Repository;
import org.ethereum.listener.EthereumListener;
import org.ethereum.net.client.ClientPeer;
import org.ethereum.net.client.PeerData;
import org.ethereum.net.peerdiscovery.PeerDiscovery;

/**
 * WorldManager is the main class to handle the processing of transactions and
 * managing the world state.
 *
 * www.ethereumJ.com
 * @author: Roman Mandeleil
 * Created on: 01/06/2014 10:44
 */
public class WorldManager {

	private Blockchain blockchain;
	private final Repository repository;
	private Wallet wallet;

    private PeerDiscovery peerDiscovery;

    private final BlockingQueue<PeerData> peers = new LinkedBlockingQueue<>();

    private ClientPeer activePeer;

    private EthereumListener listener;

    private static final class WorldManagerHolder {
    	private static final WorldManager instance = new WorldManager();
    }

	private WorldManager() {
		this.repository = new Repository();
		this.blockchain = new Blockchain(repository);

        // Initialize PeerData
        List<PeerData> peerDataList = parsePeerDiscoveryIpList(CONFIG.peerDiscoveryIPList());
        peers.addAll(peerDataList);

        peerDiscovery = new PeerDiscovery(peers);

		this.wallet = new Wallet();

		byte[] cowAddr = HashUtil.sha3("cow".getBytes());
		ECKey key = ECKey.fromPrivate(cowAddr);
		wallet.importKey(cowAddr);

		AccountState state = wallet.getAccountState(key.getAddress());
		state.addToBalance(BigInteger.valueOf(2).pow(200));

		String secret = CONFIG.coinbaseSecret();
		byte[] cbAddr = HashUtil.sha3(secret.getBytes());
		wallet.importKey(cbAddr);
	}

	public static WorldManager getInstance() {
		return WorldManagerHolder.instance;
	}

    public void addListener(EthereumListener listener){
        this.listener = listener;
    }

    public void addPeers(final Set<PeerData> newPeers) {
        for (final PeerData peer : newPeers) {
        	peers.add(peer);
        	if (peerDiscovery.isStarted()) {
        		peerDiscovery.addNewPeerData(peer);
        	}
        }
    }

    public void startPeerDiscovery() {
        if (!peerDiscovery.isStarted())
            peerDiscovery.start();
    };

    public void stopPeerDiscover(){

        if (listener != null)
            listener.trace("Stopping peer discovery");

        if (peerDiscovery.isStarted())
            peerDiscovery.stop();
    }

    public void close() {
		repository.close();
	}

    public EthereumListener getListener() {
        return listener;
    }

    public List<PeerData> parsePeerDiscoveryIpList(final String peerDiscoveryIpList){

        final List<String> ipList = Arrays.asList( peerDiscoveryIpList.split(",") );
        final List<PeerData> peers = new ArrayList<>();

        for (String ip : ipList){
            String[] addr = ip.trim().split(":");
            String ip_trim = addr[0];
            String port_trim = addr[1];

            try {
                InetAddress iAddr = InetAddress.getByName(ip_trim);
                int port = Integer.parseInt(port_trim);

                PeerData peerData = new PeerData(iAddr.getAddress(), port, new byte[]{00});
                peers.add(peerData);
            } catch (UnknownHostException e) {
                e.printStackTrace();
            }
        }

        return peers;
    }

    public void setWallet(Wallet wallet)  {
    	this.wallet = wallet;
    }

	public Repository getRepository() {
		return repository;
	}

	public Blockchain getBlockchain() {
		return blockchain;
	}

	public void loadBlockchain() {
		this.blockchain = repository.loadBlockchain();
	}

	public Wallet getWallet() {
		return wallet;
	}

    public void setActivePeer(ClientPeer peer) {
        this.activePeer = peer;
    }

    public ClientPeer getActivePeer() {
        return activePeer;
    }

    public BlockingQueue<PeerData> getPeers() {
		return peers;
	}

}


text:
var jsDiff2 = require('diff'); //TODO: VER POR QUE NO PUEDO USARLO SI LO DEFINO ACA Y NO EN LA FUNCION QUE LO LLAMA

module.exports = {
    mergeBlock: function(lastBlock, ACObj){
        var LBDifference = this.getDifference(lastBlock.originalCode, lastBlock.code),
            ACDifference = this.getDifference(ACObj.originalCode, ACObj.code),
            newCode = this.mergeItems(LBDifference, ACDifference, 0, 0, ""),
            originalCode = lastBlock.originalCode;
        lastBlock.code = newCode;
        console.log(newCode);
        return lastBlock;
    },
    mergeItems: function(LBDifference, ACDifference, indexLB, indexAC, codeResult){
        if(!LBDifference[0] && !ACDifference[0]){ //Termino de procesar
            return codeResult;
        }

        if(LBDifference.length <= 1 || ACDifference.length <= 1){ //Uno termino de procesar, puedo asignar con un bucle lo que falte
            var arrayDiff = LBDifference.length <= 1? ACDifference : LBDifference;
            var index = LBDifference.length <= 1 ? indexLB : indexAC;
            var diff = arrayDiff.shift();
            var auxText = diff.value.substring(index, diff.value.length);
            codeResult+=auxText;
            arrayDiff.forEach(function(diff){
                if(!diff.removed){
                    codeResult+=diff.value;
                }
            });
            return codeResult;
        }

        var LBText = LBDifference[0].value.substring(indexAC, LBDifference[0].value.length);
        var ACText = ACDifference[0].value.substring(indexLB, ACDifference[0].value.length);

        var aux = {};
        if(ACText.length > LBText.length){
            aux = this.processDiff(LBDifference, LBText, codeResult, indexLB);
            LBDifference = aux.arrayDiff;
            indexLB = aux.index;
            indexAC = 0;
        }
        else{
            aux = this.processDiff(ACDifference, ACText, codeResult, indexAC);
            ACDifference = aux.arrayDiff;
            indexAC = aux.index;
            indexLB = 0;
        }
        return this.mergeItems(LBDifference, ACDifference, indexLB, indexAC, aux.codeResult);
    },
    processDiff: function (arrayDiff, text, codeResult, index){
        if(!arrayDiff[0].removed && !arrayDiff[0].added){
            codeResult+= text;
            index+= text.length;
            arrayDiff.shift();
        }

        if(!arrayDiff[0]){ //No hay mas removed o added
            return {arrayDiff: arrayDiff, index:index, codeResult:codeResult};
        }

        if(arrayDiff[0].removed){ //Caso de que elimino algo y agrego algo nuevo
            index+= arrayDiff[0].value.length; //Suma al indice lo que habia en el original
            codeResult+= arrayDiff[1].value; //Agrega el nuevo texto
            arrayDiff.shift();
            arrayDiff.shift();
        }
        else { //Caso de que agrego un texto
            codeResult+= arrayDiff[0].value; //Agrega el nuevo texto
            arrayDiff.shift();
        }

        return {arrayDiff: arrayDiff, index:index, codeResult:codeResult};
    },
    getDifference: function(fromCode, newCode){
        var jsDiff = require('diff'); //Ver por que no lo puedo requerir arriba
        return jsDiff.diffWords(fromCode, newCode);
    },
    sameBlock: function(blockObj, ACObj){
        return blockObj.start == ACObj.startLine && blockObj.stop == ACObj.stopLine;
    },
    setBlockItem: function(obj){
        return {
            originalCode: obj.originalCode,
            code: obj.code,
            start: obj.startLine,
            stop: obj.stopLine,
            children: []
        }
    },
    generateBlocks: function(ACArray) {
        var that = this;
        var blockArray = [];
        var blockObj = {}; //TODO Trabajar con shift
        ACArray.forEach(function (ACObj) {
            var lastBlock = blockArray[blockArray.length - 1];
            if (lastBlock && that.sameBlock(lastBlock, ACObj)) { //TODO Hacer un metodo find por si la persona no envia el array ordenado como lo envia AC
                blockArray[blockArray.length - 1] = that.mergeBlock(lastBlock, ACObj);
            }
            else {
                blockArray.push(that.setBlockItem(ACObj));

            }
        });
        return blockArray
    }
};


text:
import {Component} from "@angular/core";
import{ NgForm} from '@angular/forms';

import{ CrudInterface} from '../../interface/crud.interface';
import{ CrudService} from '../../services/crud.service';

@Component({
    selector: 'createform',
    template: require('../../templates/crud/createform.component.html'),
     styles: [`
    input.ng-dirty.ng-invalid { border: solid red 2px; }
    input.ng-dirty.ng-valid { border: solid green 2px; }
  `]

})
export class CreateformComponent {

    entry:CrudInterface = new CrudInterface();

    constructor( private repository:CrudService) {
    }

  onSubmit(form: NgForm) {

        this.entry.id = Date.now().toString();
        this.entry.created = this.entry.updated = new Date();

        this.repository.saveEntry(this.entry);
        form.resetForm();
    }

}


text:
using Infrastructure.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Webplayer.Modules.Structure.DesignTime
{
    class DtSong : BaseSong
    {
    }
}


text:
// This file is automatically generated.

package adila.db;

/*
 * Allview Viva C701
 *
 * DEVICE: Viva_C701
 * MODEL: Viva_C701
 */
final class viva5fc701_viva5fc701 {
    public static final String DATA = "Allview|Viva C701|";
}


text:
package protocol

// StatusRequest is sent by the client instantly after
// switching to the Status protocol state and is used
// to signal the server to send a StatusResponse to the
// client
//
// This is a Minecraft packet
type StatusRequest struct {
}

// StatusPing is sent by the client after recieving a
// StatusResponse. The client uses the time from sending
// the ping until the time of recieving a pong to measure
// the latency between the client and the server.
//
// This is a Minecraft packet
type StatusPing struct {
	// The time when the ping was sent
	Time int64
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Y!LDA: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>

Main Page

Related Pages

Namespaces

Classes

Files

Class List

Class Hierarchy

Class Members

Filter_Updater Member List
This is the complete list of members for Filter_Updater, including all inherited members.

Filter_Updater(Model_Refiner &)	Filter_Updater

operator()(void *)	Filter_Updater

~Filter_Updater()	Filter_Updater	 [virtual]

<address style="text-align: right;">Generated on Tue Jul 19 11:45:26 2011 for Y!LDA by

 1.6.3 </address>


text:
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class LockComponent implements org.apache.thrift.TBase<LockComponent, LockComponent._Fields>, java.io.Serializable, Cloneable, Comparable<LockComponent> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LockComponent");

  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField LEVEL_FIELD_DESC = new org.apache.thrift.protocol.TField("level", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField PARTITIONNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionname", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField OPERATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationType", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField IS_TRANSACTIONAL_FIELD_DESC = new org.apache.thrift.protocol.TField("isTransactional", org.apache.thrift.protocol.TType.BOOL, (short)7);
  private static final org.apache.thrift.protocol.TField IS_DYNAMIC_PARTITION_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("isDynamicPartitionWrite", org.apache.thrift.protocol.TType.BOOL, (short)8);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new LockComponentStandardSchemeFactory());
    schemes.put(TupleScheme.class, new LockComponentTupleSchemeFactory());
  }

  private LockType type; // required
  private LockLevel level; // required
  private String dbname; // required
  private String tablename; // optional
  private String partitionname; // optional
  private DataOperationType operationType; // optional
  private boolean isTransactional; // optional
  private boolean isDynamicPartitionWrite; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     *
     * @see LockType
     */
    TYPE((short)1, "type"),
    /**
     *
     * @see LockLevel
     */
    LEVEL((short)2, "level"),
    DBNAME((short)3, "dbname"),
    TABLENAME((short)4, "tablename"),
    PARTITIONNAME((short)5, "partitionname"),
    /**
     *
     * @see DataOperationType
     */
    OPERATION_TYPE((short)6, "operationType"),
    IS_TRANSACTIONAL((short)7, "isTransactional"),
    IS_DYNAMIC_PARTITION_WRITE((short)8, "isDynamicPartitionWrite");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // TYPE
          return TYPE;
        case 2: // LEVEL
          return LEVEL;
        case 3: // DBNAME
          return DBNAME;
        case 4: // TABLENAME
          return TABLENAME;
        case 5: // PARTITIONNAME
          return PARTITIONNAME;
        case 6: // OPERATION_TYPE
          return OPERATION_TYPE;
        case 7: // IS_TRANSACTIONAL
          return IS_TRANSACTIONAL;
        case 8: // IS_DYNAMIC_PARTITION_WRITE
          return IS_DYNAMIC_PARTITION_WRITE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __ISTRANSACTIONAL_ISSET_ID = 0;
  private static final int __ISDYNAMICPARTITIONWRITE_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTITIONNAME,_Fields.OPERATION_TYPE,_Fields.IS_TRANSACTIONAL,_Fields.IS_DYNAMIC_PARTITION_WRITE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, LockType.class)));
    tmpMap.put(_Fields.LEVEL, new org.apache.thrift.meta_data.FieldMetaData("level", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, LockLevel.class)));
    tmpMap.put(_Fields.DBNAME, new org.apache.thrift.meta_data.FieldMetaData("dbname", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TABLENAME, new org.apache.thrift.meta_data.FieldMetaData("tablename", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PARTITIONNAME, new org.apache.thrift.meta_data.FieldMetaData("partitionname", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.OPERATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("operationType", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DataOperationType.class)));
    tmpMap.put(_Fields.IS_TRANSACTIONAL, new org.apache.thrift.meta_data.FieldMetaData("isTransactional", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_DYNAMIC_PARTITION_WRITE, new org.apache.thrift.meta_data.FieldMetaData("isDynamicPartitionWrite", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LockComponent.class, metaDataMap);
  }

  public LockComponent() {
    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;

    this.isTransactional = false;

    this.isDynamicPartitionWrite = false;

  }

  public LockComponent(
    LockType type,
    LockLevel level,
    String dbname)
  {
    this();
    this.type = type;
    this.level = level;
    this.dbname = dbname;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public LockComponent(LockComponent other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetType()) {
      this.type = other.type;
    }
    if (other.isSetLevel()) {
      this.level = other.level;
    }
    if (other.isSetDbname()) {
      this.dbname = other.dbname;
    }
    if (other.isSetTablename()) {
      this.tablename = other.tablename;
    }
    if (other.isSetPartitionname()) {
      this.partitionname = other.partitionname;
    }
    if (other.isSetOperationType()) {
      this.operationType = other.operationType;
    }
    this.isTransactional = other.isTransactional;
    this.isDynamicPartitionWrite = other.isDynamicPartitionWrite;
  }

  public LockComponent deepCopy() {
    return new LockComponent(this);
  }

  @Override
  public void clear() {
    this.type = null;
    this.level = null;
    this.dbname = null;
    this.tablename = null;
    this.partitionname = null;
    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;

    this.isTransactional = false;

    this.isDynamicPartitionWrite = false;

  }

  /**
   *
   * @see LockType
   */
  public LockType getType() {
    return this.type;
  }

  /**
   *
   * @see LockType
   */
  public void setType(LockType type) {
    this.type = type;
  }

  public void unsetType() {
    this.type = null;
  }

  /** Returns true if field type is set (has been assigned a value) and false otherwise */
  public boolean isSetType() {
    return this.type != null;
  }

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  /**
   *
   * @see LockLevel
   */
  public LockLevel getLevel() {
    return this.level;
  }

  /**
   *
   * @see LockLevel
   */
  public void setLevel(LockLevel level) {
    this.level = level;
  }

  public void unsetLevel() {
    this.level = null;
  }

  /** Returns true if field level is set (has been assigned a value) and false otherwise */
  public boolean isSetLevel() {
    return this.level != null;
  }

  public void setLevelIsSet(boolean value) {
    if (!value) {
      this.level = null;
    }
  }

  public String getDbname() {
    return this.dbname;
  }

  public void setDbname(String dbname) {
    this.dbname = dbname;
  }

  public void unsetDbname() {
    this.dbname = null;
  }

  /** Returns true if field dbname is set (has been assigned a value) and false otherwise */
  public boolean isSetDbname() {
    return this.dbname != null;
  }

  public void setDbnameIsSet(boolean value) {
    if (!value) {
      this.dbname = null;
    }
  }

  public String getTablename() {
    return this.tablename;
  }

  public void setTablename(String tablename) {
    this.tablename = tablename;
  }

  public void unsetTablename() {
    this.tablename = null;
  }

  /** Returns true if field tablename is set (has been assigned a value) and false otherwise */
  public boolean isSetTablename() {
    return this.tablename != null;
  }

  public void setTablenameIsSet(boolean value) {
    if (!value) {
      this.tablename = null;
    }
  }

  public String getPartitionname() {
    return this.partitionname;
  }

  public void setPartitionname(String partitionname) {
    this.partitionname = partitionname;
  }

  public void unsetPartitionname() {
    this.partitionname = null;
  }

  /** Returns true if field partitionname is set (has been assigned a value) and false otherwise */
  public boolean isSetPartitionname() {
    return this.partitionname != null;
  }

  public void setPartitionnameIsSet(boolean value) {
    if (!value) {
      this.partitionname = null;
    }
  }

  /**
   *
   * @see DataOperationType
   */
  public DataOperationType getOperationType() {
    return this.operationType;
  }

  /**
   *
   * @see DataOperationType
   */
  public void setOperationType(DataOperationType operationType) {
    this.operationType = operationType;
  }

  public void unsetOperationType() {
    this.operationType = null;
  }

  /** Returns true if field operationType is set (has been assigned a value) and false otherwise */
  public boolean isSetOperationType() {
    return this.operationType != null;
  }

  public void setOperationTypeIsSet(boolean value) {
    if (!value) {
      this.operationType = null;
    }
  }

  public boolean isIsTransactional() {
    return this.isTransactional;
  }

  public void setIsTransactional(boolean isTransactional) {
    this.isTransactional = isTransactional;
    setIsTransactionalIsSet(true);
  }

  public void unsetIsTransactional() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISTRANSACTIONAL_ISSET_ID);
  }

  /** Returns true if field isTransactional is set (has been assigned a value) and false otherwise */
  public boolean isSetIsTransactional() {
    return EncodingUtils.testBit(__isset_bitfield, __ISTRANSACTIONAL_ISSET_ID);
  }

  public void setIsTransactionalIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTRANSACTIONAL_ISSET_ID, value);
  }

  public boolean isIsDynamicPartitionWrite() {
    return this.isDynamicPartitionWrite;
  }

  public void setIsDynamicPartitionWrite(boolean isDynamicPartitionWrite) {
    this.isDynamicPartitionWrite = isDynamicPartitionWrite;
    setIsDynamicPartitionWriteIsSet(true);
  }

  public void unsetIsDynamicPartitionWrite() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISDYNAMICPARTITIONWRITE_ISSET_ID);
  }

  /** Returns true if field isDynamicPartitionWrite is set (has been assigned a value) and false otherwise */
  public boolean isSetIsDynamicPartitionWrite() {
    return EncodingUtils.testBit(__isset_bitfield, __ISDYNAMICPARTITIONWRITE_ISSET_ID);
  }

  public void setIsDynamicPartitionWriteIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISDYNAMICPARTITIONWRITE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((LockType)value);
      }
      break;

    case LEVEL:
      if (value == null) {
        unsetLevel();
      } else {
        setLevel((LockLevel)value);
      }
      break;

    case DBNAME:
      if (value == null) {
        unsetDbname();
      } else {
        setDbname((String)value);
      }
      break;

    case TABLENAME:
      if (value == null) {
        unsetTablename();
      } else {
        setTablename((String)value);
      }
      break;

    case PARTITIONNAME:
      if (value == null) {
        unsetPartitionname();
      } else {
        setPartitionname((String)value);
      }
      break;

    case OPERATION_TYPE:
      if (value == null) {
        unsetOperationType();
      } else {
        setOperationType((DataOperationType)value);
      }
      break;

    case IS_TRANSACTIONAL:
      if (value == null) {
        unsetIsTransactional();
      } else {
        setIsTransactional((Boolean)value);
      }
      break;

    case IS_DYNAMIC_PARTITION_WRITE:
      if (value == null) {
        unsetIsDynamicPartitionWrite();
      } else {
        setIsDynamicPartitionWrite((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case LEVEL:
      return getLevel();

    case DBNAME:
      return getDbname();

    case TABLENAME:
      return getTablename();

    case PARTITIONNAME:
      return getPartitionname();

    case OPERATION_TYPE:
      return getOperationType();

    case IS_TRANSACTIONAL:
      return isIsTransactional();

    case IS_DYNAMIC_PARTITION_WRITE:
      return isIsDynamicPartitionWrite();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case TYPE:
      return isSetType();
    case LEVEL:
      return isSetLevel();
    case DBNAME:
      return isSetDbname();
    case TABLENAME:
      return isSetTablename();
    case PARTITIONNAME:
      return isSetPartitionname();
    case OPERATION_TYPE:
      return isSetOperationType();
    case IS_TRANSACTIONAL:
      return isSetIsTransactional();
    case IS_DYNAMIC_PARTITION_WRITE:
      return isSetIsDynamicPartitionWrite();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof LockComponent)
      return this.equals((LockComponent)that);
    return false;
  }

  public boolean equals(LockComponent that) {
    if (that == null)
      return false;

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_level = true && this.isSetLevel();
    boolean that_present_level = true && that.isSetLevel();
    if (this_present_level || that_present_level) {
      if (!(this_present_level && that_present_level))
        return false;
      if (!this.level.equals(that.level))
        return false;
    }

    boolean this_present_dbname = true && this.isSetDbname();
    boolean that_present_dbname = true && that.isSetDbname();
    if (this_present_dbname || that_present_dbname) {
      if (!(this_present_dbname && that_present_dbname))
        return false;
      if (!this.dbname.equals(that.dbname))
        return false;
    }

    boolean this_present_tablename = true && this.isSetTablename();
    boolean that_present_tablename = true && that.isSetTablename();
    if (this_present_tablename || that_present_tablename) {
      if (!(this_present_tablename && that_present_tablename))
        return false;
      if (!this.tablename.equals(that.tablename))
        return false;
    }

    boolean this_present_partitionname = true && this.isSetPartitionname();
    boolean that_present_partitionname = true && that.isSetPartitionname();
    if (this_present_partitionname || that_present_partitionname) {
      if (!(this_present_partitionname && that_present_partitionname))
        return false;
      if (!this.partitionname.equals(that.partitionname))
        return false;
    }

    boolean this_present_operationType = true && this.isSetOperationType();
    boolean that_present_operationType = true && that.isSetOperationType();
    if (this_present_operationType || that_present_operationType) {
      if (!(this_present_operationType && that_present_operationType))
        return false;
      if (!this.operationType.equals(that.operationType))
        return false;
    }

    boolean this_present_isTransactional = true && this.isSetIsTransactional();
    boolean that_present_isTransactional = true && that.isSetIsTransactional();
    if (this_present_isTransactional || that_present_isTransactional) {
      if (!(this_present_isTransactional && that_present_isTransactional))
        return false;
      if (this.isTransactional != that.isTransactional)
        return false;
    }

    boolean this_present_isDynamicPartitionWrite = true && this.isSetIsDynamicPartitionWrite();
    boolean that_present_isDynamicPartitionWrite = true && that.isSetIsDynamicPartitionWrite();
    if (this_present_isDynamicPartitionWrite || that_present_isDynamicPartitionWrite) {
      if (!(this_present_isDynamicPartitionWrite && that_present_isDynamicPartitionWrite))
        return false;
      if (this.isDynamicPartitionWrite != that.isDynamicPartitionWrite)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_type = true && (isSetType());
    list.add(present_type);
    if (present_type)
      list.add(type.getValue());

    boolean present_level = true && (isSetLevel());
    list.add(present_level);
    if (present_level)
      list.add(level.getValue());

    boolean present_dbname = true && (isSetDbname());
    list.add(present_dbname);
    if (present_dbname)
      list.add(dbname);

    boolean present_tablename = true && (isSetTablename());
    list.add(present_tablename);
    if (present_tablename)
      list.add(tablename);

    boolean present_partitionname = true && (isSetPartitionname());
    list.add(present_partitionname);
    if (present_partitionname)
      list.add(partitionname);

    boolean present_operationType = true && (isSetOperationType());
    list.add(present_operationType);
    if (present_operationType)
      list.add(operationType.getValue());

    boolean present_isTransactional = true && (isSetIsTransactional());
    list.add(present_isTransactional);
    if (present_isTransactional)
      list.add(isTransactional);

    boolean present_isDynamicPartitionWrite = true && (isSetIsDynamicPartitionWrite());
    list.add(present_isDynamicPartitionWrite);
    if (present_isDynamicPartitionWrite)
      list.add(isDynamicPartitionWrite);

    return list.hashCode();
  }

  @Override
  public int compareTo(LockComponent other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLevel()).compareTo(other.isSetLevel());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLevel()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.level, other.level);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDbname()).compareTo(other.isSetDbname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbname, other.dbname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTablename()).compareTo(other.isSetTablename());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTablename()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablename, other.tablename);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPartitionname()).compareTo(other.isSetPartitionname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartitionname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partitionname, other.partitionname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOperationType()).compareTo(other.isSetOperationType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOperationType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationType, other.operationType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsTransactional()).compareTo(other.isSetIsTransactional());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsTransactional()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isTransactional, other.isTransactional);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsDynamicPartitionWrite()).compareTo(other.isSetIsDynamicPartitionWrite());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsDynamicPartitionWrite()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDynamicPartitionWrite, other.isDynamicPartitionWrite);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("LockComponent(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("level:");
    if (this.level == null) {
      sb.append("null");
    } else {
      sb.append(this.level);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("dbname:");
    if (this.dbname == null) {
      sb.append("null");
    } else {
      sb.append(this.dbname);
    }
    first = false;
    if (isSetTablename()) {
      if (!first) sb.append(", ");
      sb.append("tablename:");
      if (this.tablename == null) {
        sb.append("null");
      } else {
        sb.append(this.tablename);
      }
      first = false;
    }
    if (isSetPartitionname()) {
      if (!first) sb.append(", ");
      sb.append("partitionname:");
      if (this.partitionname == null) {
        sb.append("null");
      } else {
        sb.append(this.partitionname);
      }
      first = false;
    }
    if (isSetOperationType()) {
      if (!first) sb.append(", ");
      sb.append("operationType:");
      if (this.operationType == null) {
        sb.append("null");
      } else {
        sb.append(this.operationType);
      }
      first = false;
    }
    if (isSetIsTransactional()) {
      if (!first) sb.append(", ");
      sb.append("isTransactional:");
      sb.append(this.isTransactional);
      first = false;
    }
    if (isSetIsDynamicPartitionWrite()) {
      if (!first) sb.append(", ");
      sb.append("isDynamicPartitionWrite:");
      sb.append(this.isDynamicPartitionWrite);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetType()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
    }

    if (!isSetLevel()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'level' is unset! Struct:" + toString());
    }

    if (!isSetDbname()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'dbname' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class LockComponentStandardSchemeFactory implements SchemeFactory {
    public LockComponentStandardScheme getScheme() {
      return new LockComponentStandardScheme();
    }
  }

  private static class LockComponentStandardScheme extends StandardScheme<LockComponent> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, LockComponent struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.hadoop.hive.metastore.api.LockType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LEVEL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.level = org.apache.hadoop.hive.metastore.api.LockLevel.findByValue(iprot.readI32());
              struct.setLevelIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DBNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.dbname = iprot.readString();
              struct.setDbnameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TABLENAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tablename = iprot.readString();
              struct.setTablenameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // PARTITIONNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.partitionname = iprot.readString();
              struct.setPartitionnameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // OPERATION_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
              struct.setOperationTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // IS_TRANSACTIONAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isTransactional = iprot.readBool();
              struct.setIsTransactionalIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // IS_DYNAMIC_PARTITION_WRITE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isDynamicPartitionWrite = iprot.readBool();
              struct.setIsDynamicPartitionWriteIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, LockComponent struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.level != null) {
        oprot.writeFieldBegin(LEVEL_FIELD_DESC);
        oprot.writeI32(struct.level.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.dbname != null) {
        oprot.writeFieldBegin(DBNAME_FIELD_DESC);
        oprot.writeString(struct.dbname);
        oprot.writeFieldEnd();
      }
      if (struct.tablename != null) {
        if (struct.isSetTablename()) {
          oprot.writeFieldBegin(TABLENAME_FIELD_DESC);
          oprot.writeString(struct.tablename);
          oprot.writeFieldEnd();
        }
      }
      if (struct.partitionname != null) {
        if (struct.isSetPartitionname()) {
          oprot.writeFieldBegin(PARTITIONNAME_FIELD_DESC);
          oprot.writeString(struct.partitionname);
          oprot.writeFieldEnd();
        }
      }
      if (struct.operationType != null) {
        if (struct.isSetOperationType()) {
          oprot.writeFieldBegin(OPERATION_TYPE_FIELD_DESC);
          oprot.writeI32(struct.operationType.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIsTransactional()) {
        oprot.writeFieldBegin(IS_TRANSACTIONAL_FIELD_DESC);
        oprot.writeBool(struct.isTransactional);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsDynamicPartitionWrite()) {
        oprot.writeFieldBegin(IS_DYNAMIC_PARTITION_WRITE_FIELD_DESC);
        oprot.writeBool(struct.isDynamicPartitionWrite);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class LockComponentTupleSchemeFactory implements SchemeFactory {
    public LockComponentTupleScheme getScheme() {
      return new LockComponentTupleScheme();
    }
  }

  private static class LockComponentTupleScheme extends TupleScheme<LockComponent> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, LockComponent struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI32(struct.type.getValue());
      oprot.writeI32(struct.level.getValue());
      oprot.writeString(struct.dbname);
      BitSet optionals = new BitSet();
      if (struct.isSetTablename()) {
        optionals.set(0);
      }
      if (struct.isSetPartitionname()) {
        optionals.set(1);
      }
      if (struct.isSetOperationType()) {
        optionals.set(2);
      }
      if (struct.isSetIsTransactional()) {
        optionals.set(3);
      }
      if (struct.isSetIsDynamicPartitionWrite()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetTablename()) {
        oprot.writeString(struct.tablename);
      }
      if (struct.isSetPartitionname()) {
        oprot.writeString(struct.partitionname);
      }
      if (struct.isSetOperationType()) {
        oprot.writeI32(struct.operationType.getValue());
      }
      if (struct.isSetIsTransactional()) {
        oprot.writeBool(struct.isTransactional);
      }
      if (struct.isSetIsDynamicPartitionWrite()) {
        oprot.writeBool(struct.isDynamicPartitionWrite);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, LockComponent struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.type = org.apache.hadoop.hive.metastore.api.LockType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      struct.level = org.apache.hadoop.hive.metastore.api.LockLevel.findByValue(iprot.readI32());
      struct.setLevelIsSet(true);
      struct.dbname = iprot.readString();
      struct.setDbnameIsSet(true);
      BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.tablename = iprot.readString();
        struct.setTablenameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.partitionname = iprot.readString();
        struct.setPartitionnameIsSet(true);
      }
      if (incoming.get(2)) {
        struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
        struct.setOperationTypeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.isTransactional = iprot.readBool();
        struct.setIsTransactionalIsSet(true);
      }
      if (incoming.get(4)) {
        struct.isDynamicPartitionWrite = iprot.readBool();
        struct.setIsDynamicPartitionWriteIsSet(true);
      }
    }
  }

}


text:
<?php

final class BurndownTestDataGenerator
  extends PhabricatorTestDataGenerator {

  private $xactions = array();

  public function generate() {
    $title = $this->generateTitle();
    // Prepend or append 'Sprint'
    $title = (mt_rand(0,1)) ? $title.' Sprint':'Sprint '.$title;
    $author = $this->loadPhabrictorUser();
    $authorPHID = $author->getPHID();
    $project = PhabricatorProject::initializeNewProject($author);

    $this->addTransaction(
      PhabricatorProjectTransaction::TYPE_NAME,
      $title);
     $this->addTransaction(
      PhabricatorProjectTransaction::TYPE_ICON,
      'fa-briefcase');
     $this->addTransaction(
      PhabricatorProjectTransaction::TYPE_COLOR,
      'blue');
    // $this->addTransaction(
    //   PhabricatorProjectTransaction::TYPE_MEMBERS,
    //   $this->loadMembersWithAuthor($authorPHID));
    $this->addTransaction(
      PhabricatorTransactions::TYPE_VIEW_POLICY,
      PhabricatorPolicies::POLICY_PUBLIC);
    $this->addTransaction(
      PhabricatorTransactions::TYPE_EDIT_POLICY,
      PhabricatorPolicies::POLICY_PUBLIC);
    $this->addTransaction(
      PhabricatorTransactions::TYPE_JOIN_POLICY,
      PhabricatorPolicies::POLICY_PUBLIC);

    // Pick a date to be the start date for the sprint
    // Random between 4 weeks ago and one week from now
    $start = mt_rand(time() - 28 * 24 * 60 * 60, time() + 7 * 24 * 60 * 60);
    $this->xactions[] = id(new ManiphestTransaction())
      ->setTransactionType(PhabricatorTransactions::TYPE_CUSTOMFIELD)
      ->setMetadataValue('customfield:key', 'isdc:sprint:startdate')
      ->setOldValue(null)
      ->setNewValue($start);

    // Pick a date to be the end date for the sprint
    // Sprint is between 3 days and 3 weeks long
    $end = $start + mt_rand(3 * 24 * 60 * 60, 21 * 24 * 60 * 60);
    $this->xactions[] = id(new ManiphestTransaction())
      ->setTransactionType(PhabricatorTransactions::TYPE_CUSTOMFIELD)
      ->setMetadataValue('customfield:key', 'isdc:sprint:enddate')
      ->setOldValue(null)
      ->setNewValue($end);

    $editor = id(new PhabricatorProjectTransactionEditor())
      ->setActor($author)
      ->setContentSource(PhabricatorContentSource::newConsoleSource())
      ->setContinueOnNoEffect(true)
      ->setContinueOnMissingFields(true)
      ->applyTransactions($project, $this->xactions);

    $project->save();

    // Generate a bunch of tasks created the before the sprint starts
    for($i = 0, $num = mt_rand(5,40); $i <= $num; $i++) {
      echo ".";
      $this->generateTask($project, $start, $end);
    }

    return $project;
  }

  private function addTransaction($type, $value) {
    $this->xactions[] = id(new PhabricatorProjectTransaction())
      ->setTransactionType($type)
      ->setNewValue($value);
  }

  public function loadMembersWithAuthor($author) {
    $members = array($author);
    for ($i = 0; $i < rand(10, 20);$i++) {
      $members[] = $this->loadPhabrictorUserPHID();
    }
    return $members;
  }

  public function generateTitle() {
    return id(new PhutilLipsumContextFreeGrammar())
      ->generate();
  }

  public function generateDescription() {
    return id(new PhutilLipsumContextFreeGrammar())
      ->generateSeveral(rand(30, 40));
  }

  public function generateTask($project, $start, $end) {
    // Decide when the task was created
    switch (mt_rand(0,10)) {
      case 0:
        // A few are created during sprint
        $date_created = mt_rand($start, $end);
        break;
      default:
        // Most are created sometime in the 3 days before the sprint
        $date_created = mt_rand($start - 3 * 24 * 60 * 60, $start);
        break;
    }

    $author = $this->loadPhabrictorUser();
    $task = ManiphestTask::initializeNewTask($author);
    $task->setDateCreated($date_created);

    $content_source = PhabricatorContentSource::newForSource(
      PhabricatorContentSource::SOURCE_UNKNOWN,
      array());

    $template = new ManiphestTransaction();
    // Accumulate Transactions
    $changes = array();
    $changes[ManiphestTransaction::TYPE_TITLE] =
      $this->generateTitle();
    $changes[ManiphestTransaction::TYPE_DESCRIPTION] =
      $this->generateDescription();
    $changes[ManiphestTransaction::TYPE_OWNER] =
      $this->loadOwnerPHID();
    $changes[ManiphestTransaction::TYPE_STATUS] =
      ManiphestTaskStatus::STATUS_OPEN;
    $changes[ManiphestTransaction::TYPE_PRIORITY] =
      $this->generateTaskPriority();
    $changes[ManiphestTransaction::TYPE_CCS] =
      $this->getCCPHIDs();
    $transactions = array();
    foreach ($changes as $type => $value) {
      $transaction = clone $template;
      $transaction->setTransactionType($type);
      $transaction->setDateCreated($date_created);
      $transaction->setNewValue($value);
      $transactions[] = $transaction;
    }

    // For most tasks, project will be added when created
    // But for a few, let's add it later
    $project_added = (mt_rand(0,10) == 0) ?
      mt_rand($date_created, $end) : $date_created;
    $transactions[] = id(new ManiphestTransaction())
      ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
      ->setDateCreated($project_added)
      ->setMetadataValue(
        'edge:type',
        PhabricatorProjectObjectHasProjectEdgeType::EDGECONST)
      ->setNewValue(
        array(
          '=' => array($project->getPHID() => $project->getPHID()),
        ));

    // Set points when created
    $points = mt_rand(0,10);
    $transactions[] = id(new ManiphestTransaction())
      ->setTransactionType(PhabricatorTransactions::TYPE_CUSTOMFIELD)
      ->setMetadataValue('customfield:key', 'isdc:sprint:storypoints')
      ->setDateCreated($date_created)
      ->setOldValue(null)
      ->setNewValue($points);

    $editor = id(new ManiphestTransactionEditor())
      ->setActor($author)
      ->setContentSource($content_source)
      ->setContinueOnNoEffect(true)
      ->setContinueOnMissingFields(true);

    // Apply and clear transactions
    $editor->applyTransactions($task, $transactions);
    $transactions = array();

    // For some tasks, change points part way through sprint
    if (mt_rand(0,10) == 0) {
      $transactions[] = id(new ManiphestTransaction())
        ->setTransactionType(PhabricatorTransactions::TYPE_CUSTOMFIELD)
        ->setMetadataValue('customfield:key', 'isdc:sprint:storypoints')
        ->setDateCreated(mt_rand($date_created, $end))
        ->setOldValue($points)
        ->setNewValue(mt_rand(0,10));
    }

    // Close some amount of the tasks in the sprint
    $total_days = floor(($end - $start)/24*60*60);
    $elapsed_days = floor((time() - $start)/24*60*60);
    if (mt_rand(0,$total_days) <= $elapsed_days) {
      $transactions[] = id(new ManiphestTransaction())
        ->setTransactionType(ManiphestTransaction::TYPE_STATUS)
        ->setDateCreated(mt_rand(max($date_created, $start), $end))
        ->setNewValue(ManiphestTaskStatus::STATUS_CLOSED_RESOLVED);
    }

    // Apply any "during sprint" transactions
    if ($transactions) {
      $editor->applyTransactions($task, $transactions);
    }

    return $task;
  }

  public function loadOwnerPHID() {
    if (rand(0, 3) == 0) {
      return null;
    } else {
      return $this->loadPhabrictorUserPHID();
    }
  }

  public function getCCPHIDs() {
    $ccs = array();
    for ($i = 0; $i < rand(1, 4);$i++) {
      $ccs[] = $this->loadPhabrictorUserPHID();
    }
    return $ccs;
  }

  public function generateTaskPriority() {
    return array_rand(ManiphestTaskPriority::getTaskPriorityMap());
  }

  public function generateTaskSubPriority() {
    return rand(2 << 16, 2 << 32);
  }

}


text:
sidebar_label: SerializedAXNode.focused
---

# SerializedAXNode.focused property

#### Signature:

```typescript
interface SerializedAXNode {
  focused?: boolean;
}
```


text:
import { SerializedAutomatonWithGUI, defaultDataWithGUI } from '../types/SerializedAutomatonWithGUI';
import { jsonCopy } from '../utils/jsonCopy';
import { v1Compat } from './v1Compat';
import { v2Compat } from './v2Compat';
import { v3Compat } from './v3Compat';

export function compat( data?: any ): SerializedAutomatonWithGUI {
  if ( !data ) {
    return jsonCopy( defaultDataWithGUI );
  }

  let newData;
  if ( typeof data === 'object' ) {
    newData = jsonCopy( data );
  } else {
    console.error( 'Loaded data is invalid' );
    return jsonCopy( defaultDataWithGUI );
  }

  let version = parseFloat( newData.version ) || parseFloat( newData.v );

  if ( !version && !newData.rev ) {
    // assuming it's latest
    return newData;
  }

  if ( newData.rev ) { // fuck
    version = 1.0;
    delete newData.rev;
  }

  if ( version < 2.0 ) { // v1, modes and modifiers, CURSED
    newData = v1Compat( newData );
  }

  if ( version < 3.0 ) { // v2
    newData = v2Compat( newData );
  }

  if ( version < 4.0 ) { // v3
    newData = v3Compat( newData );
  }

  return newData;
}


text:
<?php

namespace KuiKui\MemcacheServiceProvider;

use Pimple\ServiceProviderInterface;
use Pimple\Container;
use Silex\Application;
use Silex\Api\BootableProviderInterface;

/**
 * Memcache service provider.
 *
 * @author Denis Roussel <denis.roussel@gmail.com>
 */
class ServiceProvider implements ServiceProviderInterface, BootableProviderInterface
{
    public function register(Container $app)
    {
        // Storing the provider to be able to inject it into the closure, allowing the closure to access the provider.
        $provider = $this;
        $app['memcache'] = ( function() use ($app, $provider) {
            $memcacheClass = $provider->getMemcacheClass($app);
            $memcacheInstance = new $memcacheClass();

            foreach ($provider->getConnections($app) as $connection) {
                call_user_func_array(array($memcacheInstance, 'addServer'), array_values($connection));
            }

            $wrapperClass = $provider->getWrapperClass($app);
            if ($wrapperClass === false) {
                return $memcacheInstance;
            }

            return new $wrapperClass($memcacheInstance, $app);
        });
    }

    public function boot(Application $app)
    {
        $app['memcache.default_duration'] = $this->getDefaultExpirationTime($app);
        $app['memcache.default_compress'] = $this->getDefaultCompress($app);
    }

    public function getMemcacheClass(Application $app)
    {
        if (!isset($app['memcache.class'])) {
            return '\Memcache';
        }

        $memcacheClass = $app['memcache.class'];

        if (!in_array($memcacheClass, array('\Memcache', '\Memcached'))) {
            throw new \Exception(sprintf("Unknown class %s. Please set '\Memcache' or '\Memcached'", $memcacheClass));
        }

        return $memcacheClass;
    }

    public function getWrapperClass(Application $app)
    {
        if (!isset($app['memcache.wrapper'])) {
            return __NAMESPACE__.'\SimpleWrapper';
        }

        return $app['memcache.wrapper'];
    }

    public function getConnections(Application $app)
    {
        if (!isset($app['memcache.connections'])) {
            return array(array('127.0.0.1', 11211));
        }

        return $app['memcache.connections'];
    }

    public function getDefaultExpirationTime(Application $app)
    {
        if (isset($app['memcache.default_duration']) && is_int($app['memcache.default_duration'])) {
            return $app['memcache.default_duration'];
        }

        return 0;
    }

    public function getDefaultCompress(Application $app)
    {
        if (isset($app['memcache.default_compress']) && is_bool($app['memcache.default_compress'])) {
            return $app['memcache.default_compress'];
        }

        return false;
    }
}


text:
using MetroTalks.Win81.PetesEats.Common;
using MetroTalks.Win81.PetesEats.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Windows.Input;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Item Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234232
using MetroTalks.Win81.PetesEats.ViewModels;

namespace MetroTalks.Win81.PetesEats
{
    /// <summary>
    /// A page that displays details for a single item within a group.
    /// </summary>
    public sealed partial class ItemPage : Page
    {
        private NavigationHelper navigationHelper;
        private EatItemViewModel defaultViewModel = new EatItemViewModel();

        /// <summary>
        /// NavigationHelper is used on each page to aid in navigation and
        /// process lifetime management
        /// </summary>
        public NavigationHelper NavigationHelper
        {
            get { return this.navigationHelper; }
        }

        /// <summary>
        /// This can be changed to a strongly typed view model.
        /// </summary>
        public EatItemViewModel DefaultViewModel
        {
            get { return this.defaultViewModel; }
        }

        public ItemPage()
        {
            this.InitializeComponent();
            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
        }

        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            await DefaultViewModel.BindItem((int)e.NavigationParameter);
        }

        #region NavigationHelper registration

        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        ///
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            navigationHelper.OnNavigatedTo(e);
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            navigationHelper.OnNavigatedFrom(e);
        }

        #endregion

        private void OnBack(object sender, RoutedEventArgs e)
        {
            Frame.GoBack();
        }
    }
}