text:
function [trainData, testData, minX, maxX, minY, maxY, numOfClasses] = prepareInputData(path)
%UNTITLED Summary of this function goes here
%   Cell array with each index contains a class's data (attribute table)

    command = ['ls',' ',path,' -l| grep Class | wc -l'];
    [~,output] = system(command);
    numOfClasses = str2double(output);
    trainData = cell(1,numOfClasses);
    testData = cell(1,numOfClasses);

    maxX = 0;
    maxY = 0;
    minX = 0;
    minY = 0;
    dirpath = (strcat(path,'*.txt'));
    Files=dir(dirpath);
   % system('mkdir Training');
   % system('mkdir Testing');;

    for i=1:length(Files)
        fileName=Files(i).name;
        inputData = load([path, fileName]);
        rows = size(inputData,1);
        trainData{i} =  inputData(1:floor((3/4)* rows),:);
        testData{i} = inputData(floor((3/4)*rows)+1:end,:);
       % dlmwrite([path, 'Training/', fileName], trainData{i}, '\t');
       % dlmwrite([path, 'Testing/', fileName], testData{i}, '\t');
        minX = min(min(trainData{i}(:,1)), minX);
        minY = min(min(trainData{i}(:,2)), minY);
        maxX = max(max(trainData{i}(:,1)), maxX);
        maxY = max(max(trainData{i}(:,2)), maxY);
    end
end


text:
  <param name="movie" value="<%= baseUrl %>/assets/HLSPlayer.swf?inline=1">
  <param name="quality" value="autohigh">
  <param name="swliveconnect" value="true">
  <param name="allowScriptAccess" value="always">
  <param name="bgcolor" value="#001122">
  <param name="allowFullScreen" value="false">
  <param name="wmode" value="transparent">
  <param name="tabindex" value="1">
  <param name=FlashVars value="playbackId=<%= playbackId %>" />
  <embed
    type="application/x-shockwave-flash"
    tabindex="1"
    enablecontextmenu="false"
    allowScriptAccess="always"
    quality="autohigh"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    wmode="transparent"
    swliveconnect="true"
    type="application/x-shockwave-flash"
    allowfullscreen="false"
    bgcolor="#000000"
    FlashVars="playbackId=<%= playbackId %>"
    src="<%= baseUrl %>/assets/HLSPlayer.swf"
    width="100%"
    height="100%">
  </embed>

redpajama_set_name: RedPajamaGithub


text:
/*******************************************************************************
 * refn - All content 2016 Trent Reed, all rights reserved.
 *------------------------------------------------------------------------------
 * Abstract class for defining Generator types (what output will generate).
 ******************************************************************************/
#ifndef   REFN_GENERATOR_HPP
#define   REFN_GENERATOR_HPP

// std
#include <iosfwd>

// RefN
#include <RefN/Common/Types.hpp>

namespace RefN {
class TranslationUnit;

/*******************************************************************************
 * Public Types
 ******************************************************************************/
class Generator {
public:
  virtual void processTranslationUnit(std::ostream &os, TranslationUnit const &tu) = 0;
  virtual void linkTranslationUnits(std::ostream &os, String const &moduleName, PathList const &inputs) = 0;
};

}

#endif // REFN_GENERATOR_HPP


text:
namespace jcon {

JsonRpcWebSocketServer::JsonRpcWebSocketServer(
    QObject* parent,
    std::shared_ptr<JsonRpcLogger> logger)
    : JsonRpcServer(parent, logger)
    , m_server(new QWebSocketServer("JSON RPC WebSocket server",
                                    QWebSocketServer::NonSecureMode,
                                    this))
{
    m_server->connect(m_server, &QWebSocketServer::newConnection,
                      this, &JsonRpcWebSocketServer::newConnection);
}

JsonRpcWebSocketServer::~JsonRpcWebSocketServer()
{
    m_server->disconnect(this);
    close();
    delete m_server;
    m_server = nullptr;
}

void JsonRpcWebSocketServer::listen(int port)
{
    logInfo(QString("listening on port %2").arg(port));
    m_server->listen(QHostAddress::AnyIPv4, port);
}

void JsonRpcWebSocketServer::listen(const QHostAddress& addr, int port)
{
    logInfo(QString("listening on port %2").arg(port));
    m_server->listen(addr, port);
}

void JsonRpcWebSocketServer::close()
{
    m_server->close();
}

JsonRpcEndpoint* JsonRpcWebSocketServer::findClient(QObject* socket)
{
    QWebSocket* web_socket = qobject_cast<QWebSocket*>(socket);
    auto it = m_client_endpoints.find(web_socket);
    return (it != m_client_endpoints.end()) ? it->second.get() : nullptr;
}

void JsonRpcWebSocketServer::newConnection()
{
    JCON_ASSERT(m_server->hasPendingConnections());
    if (m_server->hasPendingConnections()) {
        QWebSocket* web_socket = m_server->nextPendingConnection();

        JCON_ASSERT(web_socket);
        if (!web_socket) {
            logError("pending socket was null");
            return;
        }

        logInfo("client connected: " + web_socket->peerAddress().toString());

        // TODO: maybe move this to base class?
        // {
        auto rpc_socket = std::make_shared<JsonRpcWebSocket>(web_socket);

        auto endpoint =
            std::make_shared<JsonRpcEndpoint>(rpc_socket, log(), this);

        connect(endpoint.get(), &JsonRpcEndpoint::socketDisconnected,
                this, &JsonRpcWebSocketServer::disconnectClient);

        connect(endpoint.get(), &JsonRpcEndpoint::jsonObjectReceived,
                this, &JsonRpcServer::jsonRequestReceived);

        m_client_endpoints[web_socket] = endpoint;
        emit(clientConnected(web_socket));
        // }
    }
}

void JsonRpcWebSocketServer::disconnectClient(QObject* client_socket)
{
    QWebSocket* socket = qobject_cast<QWebSocket*>(client_socket);
    JCON_ASSERT(socket);
    if (!socket) {
        logError("client disconnected, but socket is null");
        return;
    }

    logInfo("client disconnected: " + socket->peerAddress().toString());
    auto it = m_client_endpoints.find(socket);
    JCON_ASSERT(it != m_client_endpoints.end());
    if (it == m_client_endpoints.end()) {
        logError("unknown client disconnected");
        return;
    }
    m_client_endpoints.erase(it);
    emit(clientDisconnected(client_socket));
}

}


text:
package build

import (
	"context"
	"fmt"

	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/timestamppb"

	bbpb "go.chromium.org/luci/buildbucket/proto"
	"go.chromium.org/luci/common/clock"
	"go.chromium.org/luci/common/data/stringset"
	"go.chromium.org/luci/common/errors"
)

// Start is the 'inner' entrypoint to this library.
//
// If you're writing a standalone luciexe binary, see `Main` and
// `MainWithOutput`.
//
// This function clones `initial` as the basis of all state updates (see
// OptSend) and MakePropertyReader declarations. This also initializes the build
// State in `ctx` and returns the manipulable State object.
//
// You must End the returned State. To automatically map errors and panics to
// their correct visual representation, End the State like:
//
//    var err error
//    state, ctx := build.Start(ctx, initialBuild, ...)
//    defer func() { state.End(err) }()
//
//    err = opThatErrsOrPanics(ctx)
//
// NOTE: A panic will still crash the program as usual. This does NOT
// `recover()` the panic. Please use conventional Go error handling and control
// flow mechanisms.
func Start(ctx context.Context, initial *bbpb.Build, opts ...StartOption) (*State, context.Context, error) {
	if initial == nil {
		initial = &bbpb.Build{}
	}
	initial = proto.Clone(initial).(*bbpb.Build)
	// initialize proto sections which other code in this module assumes exist.
	proto.Merge(initial, &bbpb.Build{
		Output: &bbpb.Build_Output{},
		Input:  &bbpb.Build_Input{},
	})

	outputReservationKeys := propModifierReservations.locs.snap()

	ret := &State{
		buildPb:          initial,
		logClosers:       map[string]func() error{},
		outputProperties: make(map[string]*outputPropertyState, len(outputReservationKeys)),
	}
	for ns := range outputReservationKeys {
		ret.outputProperties[ns] = &outputPropertyState{}
	}
	ret.ctx, ret.ctxCloser = context.WithCancel(ctx)

	for _, opt := range opts {
		opt(ret)
	}

	// in case our buildPb is unstarted, start it now.
	if ret.buildPb.StartTime == nil {
		ret.buildPb.StartTime = timestamppb.New(clock.Now(ctx))
		ret.buildPb.Status = bbpb.Status_STARTED
	}

	// initialize all log names already in ret.buildPb; likely this includes
	// stdout/stderr which may already be populated by our parent process, such as
	// `bbagent`.
	for _, l := range ret.buildPb.Output.Logs {
		ret.logNames.resolveName(l.Name)
	}

	err := func() (err error) {
		ret.reservedInputProperties, err = parseReservedInputProperties(initial.Input.Properties, ret.strictParse)
		if err != nil {
			return
		}
		if ret.topLevelInputProperties != nil {
			if err := parseTopLevelProperties(ret.buildPb.Input.Properties, ret.strictParse, ret.topLevelInputProperties); err != nil {
				return errors.Annotate(err, "parsing top-level properties").Err()
			}
		}
		if tlo := ret.topLevelOutput; tlo != nil {
			fields := tlo.msg.ProtoReflect().Descriptor().Fields()
			topLevelOutputKeys := stringset.New(fields.Len())
			for i := 0; i < fields.Len(); i++ {
				f := fields.Get(i)
				topLevelOutputKeys.Add(f.TextName())
				topLevelOutputKeys.Add(f.JSONName())
			}
			for reserved := range ret.outputProperties {
				if topLevelOutputKeys.Has(reserved) {
					return errors.Reason(
						"output property %q conflicts with field in top-level output properties: reserved at %s",
						reserved, propModifierReservations.locs.get(reserved)).Err()
				}
			}
		}
		return
	}()
	if err != nil {
		err = AttachStatus(err, bbpb.Status_INFRA_FAILURE, nil)
		ret.SetSummaryMarkdown(fmt.Sprintf("fatal error starting build: %s", err))
		ret.End(err)
		return nil, ctx, err
	}

	return ret, setState(ctx, ctxState{ret, nil}), nil
}


text:
package org.owasp.dependencycheck.analyzer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Dependency;

import java.io.File;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import org.owasp.dependencycheck.dependency.EvidenceType;

/**
 * Unit tests for {@link RubyGemspecAnalyzer}.
 *
 * @author Dale Visser
 */
public class RubyGemspecAnalyzerTest extends BaseTest {

    /**
     * The analyzer to test.
     */
    private RubyGemspecAnalyzer analyzer;

    /**
     * Correctly setup the analyzer for testing.
     *
     * @throws Exception thrown if there is a problem
     */
    @Before
    @Override
    public void setUp() throws Exception {
        super.setUp();
        analyzer = new RubyGemspecAnalyzer();
        analyzer.initialize(getSettings());
        analyzer.setFilesMatched(true);
        analyzer.prepare(null);
    }

    /**
     * Cleanup the analyzer's temp files, etc.
     *
     * @throws Exception thrown if there is a problem
     */
    @After
    @Override
    public void tearDown() throws Exception {
        analyzer.close();
        super.tearDown();
    }

    /**
     * Test Ruby Gemspec name.
     */
    @Test
    public void testGetName() {
        assertThat(analyzer.getName(), is("Ruby Gemspec Analyzer"));
    }

    /**
     * Test Ruby Gemspec file support.
     */
    @Test
    public void testSupportsFiles() {
        assertThat(analyzer.accept(new File("test.gemspec")), is(true));
        assertThat(analyzer.accept(new File("gemspec.lock")), is(false));
//        assertThat(analyzer.accept(new File("Rakefile")), is(true));
    }

    /**
     * Test Ruby Gemspec analysis.
     *
     * @throws AnalysisException is thrown when an exception occurs.
     */
    @Test
    public void testAnalyzePackageJson() throws AnalysisException {
        final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
                "ruby/vulnerable/gems/specifications/rest-client-1.7.2.gemspec"));
        analyzer.analyze(result, null);
        final String vendorString = result.getEvidence(EvidenceType.VENDOR).toString();
        assertEquals(RubyGemspecAnalyzer.DEPENDENCY_ECOSYSTEM, result.getEcosystem());
        assertThat(vendorString, containsString("REST Client Team"));
        assertThat(vendorString, containsString("rest-client_project"));
        assertThat(vendorString, containsString("rest.client@librelist.com"));
        assertThat(vendorString, containsString("https://github.com/rest-client/rest-client"));
        assertThat(result.getEvidence(EvidenceType.PRODUCT).toString(), containsString("rest-client"));
        assertThat(result.getEvidence(EvidenceType.VERSION).toString(), containsString("1.7.2"));
        assertEquals("rest-client", result.getName());
        assertEquals("1.7.2", result.getVersion());
        assertEquals("rest-client:1.7.2", result.getDisplayFileName());
    }

//    /**
//     * Test Rakefile analysis.
//     *
//     * @throws AnalysisException is thrown when an exception occurs.
//     */
//    @Test
//    @Ignore
//    //TODO: place holder to test Rakefile support
//    public void testAnalyzeRakefile() throws AnalysisException {
//        final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
//                "ruby/vulnerable/gems/rails-4.1.15/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/Rakefile"));
//        analyzer.analyze(result, null);
//        assertTrue(result.size() > 0);
//        assertEquals(RubyGemspecAnalyzer.DEPENDENCY_ECOSYSTEM, result.getEcosystem());
//        assertEquals("pg", result.getName());
//        assertEquals("0.18.4", result.getVersion());
//        assertEquals("pg:0.18.4", result.getDisplayFileName());
//    }
}


text:
export { fill   } from './fill';
export { stroke } from './stroke';


text:
package com.oodesign.factorypattern.ships;

import com.oodesign.factorypattern.EnemyShipFactory;

public class BigUFOEnemyShip extends UFOEnemyShip {

	static
	{
		EnemyShipFactory.getInstance().registerEnemyShipType("B", new BigUFOEnemyShip());
	}

	public BigUFOEnemyShip(){

		setName("Big UFO Enemy Ship");

		setDamage(40.0);

	}

	@Override
	public EnemyShip createEnemyShip() {
		// TODO Auto-generated method stub
		return new BigUFOEnemyShip();
	}

}


text:
from setuptools import setup

setup(name='overloadimpact',
      version='0.0.5',
      description='CLI tool and framework for writing and running tests suites for loadimpact.com, with support for custom lua libraries.',
      url='https://github.com/schibsted/overloadimpact',
      author='Schibsted Products and Technology',
      author_email='someemail@example.com',
      license='MIT',
      packages=['overloadimpact'],
      zip_safe=False,
      keywords='loadtest loadimpact testing',
      # To provide executable scripts, use entry points in preference to the
    # "scripts" keyword. Entry points provide cross-platform support and allow
    # pip to create the appropriate form of executable for the target platform.
    entry_points={
        'console_scripts': [
            'oimp=overloadimpact:main',
        ],
    },
)


text:
////////////////////////////////////////////////////////////////////////////////
//
//  TYPHOON FRAMEWORK
//  Copyright 2014, Typhoon Framework Contributors
//  All Rights Reserved.
//
//  NOTICE: The authors permit you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>

/**
* @ingroup Assembly
*
 Allows for custom modification of a instance after its instantiation.

 Component factories can auto-detect TyphoonComponentPostProcessor components in their definitions and will apply them to components created
 by the factory.
 */
@protocol TyphoonInstancePostProcessor <NSObject>

/**
 Post process a component after its initialization and return the processed component.
*/
- (id)postProcessInstance:(id)instance;

@end


text:
"""App Engine local test runner."""

import argparse
import os
import sys
import unittest
import unittest.mock

import google.cloud.logging

def main(test_path, test_pattern):
  suite = unittest.loader.TestLoader().discover(test_path, test_pattern)
  return unittest.TextTestRunner(verbosity=2).run(suite)

if __name__ == '__main__':
  parser = argparse.ArgumentParser(
      description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
  parser.add_argument(
      '--test-path',
      help='The path to look for tests, defaults to the current directory.',
      default=os.getcwd())
  parser.add_argument(
      '--test-pattern',
      help='The file pattern for test modules, defaults to *_test.py.',
      default='*_test.py')
  args = parser.parse_args()
  google.cloud.logging = unittest.mock.MagicMock()
  result = main(args.test_path, args.test_pattern)
  if not result.wasSuccessful():
    sys.exit(1)


text:
[![Docker Pulls](https://img.shields.io/docker/pulls/carbonsrv/carbon.svg)](https://hub.docker.com/r/carbonsrv/carbon/) [![Docker Stars](https://img.shields.io/docker/stars/carbonsrv/carbon.svg)](https://hub.docker.com/r/carbonsrv/carbon/) [![](https://badge.imagelayers.io/carbonsrv/carbon:latest.svg)](https://imagelayers.io/?images=carbonsrv/carbon:latest 'Get your own badge on imagelayers.io')

Carbon is a Lua Application Toolkit with focus on Web Servers, written in [Go](https://golang.org).

# Installing
`go get -u github.com/carbonsrv/carbon`

## Dependencies
- [LuaJIT 2.X](http://luajit.org)
- [PhysFS](https://icculus.org/physfs/)
- [go-bindata](https://github.com/jteeuwen/go-bindata)

The development headers of LuaJIT and PhysFS are also required.

# Usage
## Flags
To get this list, just type `carbon -h`.

    Usage of carbon:
      -cert="": Certificate File for HTTPS
      -config="": Parse Config File
      -debug=false: Show debug information
      -eval="": Eval Lua Code
      -gzip=false: Use GZIP
      -host="": IP of Host to bind the Webserver on
      -http=true: Listen HTTP
      -http2=false: Enable HTTP/2
      -https=false: Listen HTTPS
      -key="": Key File for HTTPS
      -logger=true: Log Request information
      -port=8080: Port to run Webserver on (HTTP)
      -ports=8443: Port to run Webserver on (HTTPS)
      -recovery=false: Recover from Panics
      -repl=false: Run REPL
      -root=".": Path to Web Root
      -script="": Parse Lua Script as initialization
      -states=8: Number of Preinitialized Lua States
      -workers=8: Number of Worker threads.

# HTML Generation system

Let's start with an example:
```lua
doctype( -- Always start with the doctype
  tag"head"( -- Put your tags here.
    tag"title"("Hello World!")
  ),
  tag"body"( -- To put more than one tag in an existing tag, just put a comma after the inside tag and write your other tag after that.
    tag"h1"("Hello!"),
    tag"a"[{href="http://vifino.de/"}]("Link to my page!"), -- Supply arguments like that.
    link("http://vifino.de/")("Another link to my page!") -- Same thing as above, with a small helper function.
  )
)
```
This template language can be used both in static and dynamic configuration.

# More info

Check the wiki!

# License
MIT
Copyright (c) 2015 Adrian Pistol

Third party software included with this may have different licenses. Check /builtin/NOTICE.txt.


text:
class QLineEdit;
class QToolButton;

class ModernPropertyExpressionEditor : public ModernPropertyDefaultEditor
{
    Q_OBJECT

public:
    ModernPropertyExpressionEditor(const std::shared_ptr<ModernPropertyContext>& context, ValueProperty* property);
    ~ModernPropertyExpressionEditor() override;

    void AddToGrid(QGridLayout* layout, int row, int col, int colSpan) override;

protected:
    void OnPropertyChanged() override;

private:
    void OnEditingFinished();
    void OnCurrentIndexChanged(int index);
    void OnButtonClicked();

    void ApplyChanges();

    QLineEdit* line = nullptr;
    QToolButton* bindButton = nullptr;

    QHBoxLayout* layout = nullptr;
};


text:
'use strict';

const {getRequest} = require('../../../query/GraphQLTag');
const {createReaderSelector} = require('../../../store/RelayModernSelector');
const {RelayFeatureFlags} = require('relay-runtime');
const {graphql} = require('relay-runtime/query/GraphQLTag');
const {
  createOperationDescriptor,
} = require('relay-runtime/store/RelayModernOperationDescriptor');
const {
  createMockEnvironment,
  disallowConsoleErrors,
  disallowWarnings,
} = require('relay-test-utils-internal');

disallowWarnings();
disallowConsoleErrors();

beforeEach(() => {
  RelayFeatureFlags.ENABLE_RELAY_RESOLVERS = true;
});

afterEach(() => {
  RelayFeatureFlags.ENABLE_RELAY_RESOLVERS = false;
});

describe('Relay Resolver', () => {
  it('works with refetchable fragments', () => {
    const environment = createMockEnvironment();

    const FooFragment = graphql`
      fragment ResolverTest2Fragment on User
      @refetchable(queryName: "ResolverTest1FragmentRefetchableQuery") {
        greeting
      }
    `;

    const FooQuery = graphql`
      query ResolverTest2Query {
        me {
          ...ResolverTest2Fragment
        }
      }
    `;

    const request = getRequest(FooQuery);
    const operation = createOperationDescriptor(request, {});
    environment.commitPayload(operation, {
      me: {
        id: '1',
        name: 'Alice',
      },
    });

    const fragmentSelector = createReaderSelector(
      FooFragment,
      '1',
      {},
      operation.request,
    );

    // $FlowFixMe[unclear-type]
    const {data} = (environment.lookup(fragmentSelector): any);

    expect(data.greeting).toEqual('Hello, Alice!'); // Resolver result
    expect(data.name).toEqual(undefined); // Fields needed by resolver's fragment don't end up in the result
  });

  it('returns the result of the resolver function', () => {
    const environment = createMockEnvironment();

    const FooQuery = graphql`
      query ResolverTest1Query {
        me {
          greeting
        }
      }
    `;

    const request = getRequest(FooQuery);
    const operation = createOperationDescriptor(request, {});

    environment.commitPayload(operation, {
      me: {
        id: '1',
        name: 'Alice',
      },
    });

    // $FlowFixMe[unclear-type]
    const {data} = (environment.lookup(operation.fragment): any);

    expect(data.me.greeting).toEqual('Hello, Alice!'); // Resolver result
    expect(data.me.name).toEqual(undefined); // Fields needed by resolver's fragment don't end up in the result
  });

  it('can create a client edge query in our test enviornment that has valid import', () => {
    // This is not really a runtime test, but more a test to confirm that this query generates
    // an artifact with valid imports in our non-Haste test environment.
    const clientEdgeRuntimeArtifact = graphql`
      query ResolverTest3Query {
        me {
          client_edge @waterfall {
            __typename
          }
        }
      }
    `;
    expect(clientEdgeRuntimeArtifact.operation.name).toBe('ResolverTest3Query');
  });
});


text:
@interface RSDiscoverViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) NSMutableArray *allDatas;

@end

@implementation RSDiscoverViewController

#pragma mark - lifeCycle

- (void)viewDidLoad {
    [super viewDidLoad];

    [RSDiscoverCell registerNibToTableView:self.tableView];
    [self.view addSubview:self.tableView];

#ifdef __IPHONE_11_0
    self.tableView.estimatedRowHeight = 0;
    self.tableView.estimatedSectionFooterHeight = 0;
    self.tableView.estimatedSectionHeaderHeight = 0;
#endif
}

#pragma mark - tableView dataSource delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0) {
        return 1;
    }
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellID = [RSDiscoverCell cellID];
    RSDiscoverCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    RSDiscoverModel *model = [RSDiscoverModel new];
    switch (indexPath.section) {
        case 0:
            model = self.allDatas[0];
            break;
        case 1:
            if (indexPath.row == 0) {
                model = self.allDatas[1];
            } else {
                model = self.allDatas[2];
            }
            break;
        case 2:
            if (indexPath.row == 0) {
                model = self.allDatas[3];
            } else {
                model = self.allDatas[4];
            }
            break;
        default:
            if (indexPath.row == 0) {
                model = self.allDatas[5];
            } else {
                model = self.allDatas[6];
            }
            break;
    }
    [cell setCellWithModel:model];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [RSDiscoverCell rowHeight];
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return CGFLOAT_MIN;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 10;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:NO];

    RSViewController *destVC = nil;

    if (indexPath.section == 0) {
        destVC = [[RSFriendsCircleViewController alloc] init];
    } else if (indexPath.section == 1 && indexPath.row == 0) {
        destVC = [[RSScanViewController alloc] init];
    } else if (indexPath.section == 1 && indexPath.row == 1) {
        destVC = [[RSShakeViewController alloc] initWithNibName:@"RSShakeViewController" bundle:[NSBundle mainBundle]];
    } else if (indexPath.section == 2 && indexPath.row == 0) {
        destVC = [[RSLocalViewController alloc] initWithNibName:@"RSLocalViewController" bundle:[NSBundle mainBundle]];
    } else if (indexPath.section == 2 && indexPath.row == 1) {
        destVC = [[RSBottleViewController alloc] initWithNibName:@"RSBottleViewController" bundle:[NSBundle mainBundle]];
    } else if (indexPath.section == 3 && indexPath.row == 0) {
        destVC = [[RSBuyViewController alloc] init];
    } else if (indexPath.section == 3 && indexPath.row == 1) {
        destVC = [[RSGameViewController alloc] init];
    }

    [self.navigationController pushViewController:destVC animated:YES];
}

#pragma mark - setter & getter

- (NSMutableArray *)allDatas {
    if (!_allDatas) {
        _allDatas = [[RSDiscoverModel demoData] mutableCopy];
    }
    return _allDatas;
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2016 OPEN TONE Inc.
  ~
  ~ 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.
  -->

<!--
    This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
    Checkstyle-Configuration: linkbinder
    Description: none
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
    <property name="severity" value="warning"/>
    <property name="charset" value="UTF-8"/>
      <module name="JavadocPackage">
          <property name="severity" value="ignore"/>
      </module>

        <module name="RegexpSingleline">
        <!--
        <module name="GenericIllegalRegexp">
        -->
            <property name="format" value="\s+$"/>
            <property name="message" value="Line has trailing spaces."/>
        </module>
       <module name="FileLength">
           <property name="severity" value="info"/>
           <property name="max" value="1000"/>
       </module>
        <module name="FileTabCharacter"/>
    <module name="TreeWalker">
        <property name="tabWidth" value="4"/>
        <module name="FileContentsHolder"/>
        <module name="JavadocMethod">
            <property name="scope" value="protected"/>
            <property name="allowMissingJavadoc" value="true"/>
            <property name="logLoadErrors" value="true"/>
            <property name="suppressLoadErrors" value="true"/>
        </module>
        <module name="JavadocType">
            <property name="scope" value="public"/>
        </module>
        <module name="JavadocVariable"/>
        <module name="JavadocStyle"/>
        <module name="ConstantName">
            <property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|log)$"/>
        </module>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName"/>
        <module name="MethodName"/>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <module name="StaticVariableName"/>
        <module name="TypeName"/>
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports"/>
        <module name="LineLength">
            <property name="severity" value="ignore"/>
            <property name="tabWidth" value="4"/>
        </module>
        <module name="MethodLength">
            <property name="severity" value="info"/>
            <property name="max" value="30"/>
        </module>
        <module name="ParameterNumber"/>
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter"/>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround">
            <property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT"/>
        </module>
        <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>
        <module name="AvoidNestedBlocks"/>
        <module name="EmptyBlock"/>
        <module name="LeftCurly">
            <property name="maxLineLength" value="100"/>
        </module>
        <module name="NeedBraces"/>
        <module name="RightCurly"/>
        <module name="AvoidInlineConditionals">
            <property name="severity" value="ignore"/>
        </module>
        <module name="DoubleCheckedLocking"/>
        <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="HiddenField">
            <property name="ignoreConstructorParameter" value="true"/>
            <property name="ignoreSetter" value="true"/>
            <property name="ignoreAbstractMethods" value="true"/>
        </module>
        <module name="IllegalInstantiation"/>
        <module name="InnerAssignment"/>
        <module name="MagicNumber"/>
        <module name="MissingSwitchDefault"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="DesignForExtension">
            <property name="severity" value="ignore"/>
        </module>
        <module name="FinalClass">
            <property name="severity" value="ignore"/>
        </module>
        <module name="HideUtilityClassConstructor"/>
        <module name="InterfaceIsType"/>
        <module name="VisibilityModifier"/>
        <module name="ArrayTypeStyle"/>
        <module name="FinalParameters">
            <property name="severity" value="ignore"/>
        </module>
        <module name="TodoComment"/>
        <module name="UpperEll"/>
        <module name="JavaNCSS">
            <property name="methodMaximum" value="30"/>
            <property name="classMaximum" value="1000"/>
        </module>
        <module name="LineLength">
            <property name="ignorePattern" value="^(import .*|\s+public static final .+=.+)$"/>
            <property name="max" value="100"/>
        </module>
    </module>
    <!--
    <module name="PackageHtml">
        <property name="severity" value="ignore"/>
    </module>
    -->
    <module name="NewlineAtEndOfFile"/>
    <module name="Translation"/>
    <!--
    <module name="SuppressWithNearbyCommentFilter"/>
    -->
    <module name="SuppressionCommentFilter">
      <property name="checkFormat" value=".*"/>
      <!--
      <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE"/>
      <property name="influenceFormat" value="0"/>
      -->
    </module>
</module>


text:
import urllib2 as ub
import time as ts
import traceback as tb
import sys
from bs4 import BeautifulSoup

def getRawData():
	req=ub.Request('http://www.shfe.com.cn/statements/delaymarket_all.html?isAjax=true')
	req.add_header('user-agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36')
	res=[]
	try:
		url=ub.urlopen(req,timeout=5)
		data=url.read()
		soup=BeautifulSoup(data)
		rows=soup.find('table').find_all('tr')
		for i,r in enumerate(rows):
			if i>1:
				res.append([col.text.replace(',','') for col in r.find_all('td') ])
	except AttributeError,e:
		print tb.format_exc()
	except ub.HTTPError,e:
		print tb.format_exc()
	except Exception,e:
		print tb.format_exc()
	return res

if __name__=='__main__':
	with file(sys.argv[1],'a') as input:
		res=getRawData()
		for l in res:
			input.write('\001'.join(l).encode('utf8')+'\001'+ts.strftime('%Y-%m-%d %H:%M:%S')+'\n')


text:
from theano import Op, Apply
from theano.tensor import as_tensor_variable
from theano.scalar import as_scalar

class ScalMulV1(Op):
    __props__ = ('scal',)

    def __init__(self, scal):
        if not isinstance(scal, int):
            raise TypeError('expected an int')
        self.scal = scal

    def make_node(self, x):
        x = as_tensor_variable(x)
        return Apply(self, [x], [x.type()])

    def perform(self, node, inputs, output_storage):
        x = inputs[0]
        z = output_storage[0]
        z[0] = x * self.scal

class ScalMulV2(Op):
    __props__ = ()

    def make_node(self, x, scal):
        x = as_tensor_variable(x)
        scal = as_scalar(scal)
        return Apply(self, [x, scal], [x.type()])

    def perform(self, node, inputs, output_storage):
        x = inputs[0]
        scal = inputs[1]
        z = output_storage[0]
        z[0] = x * scal


text:
class AddClonedOrderIdToOrders < ActiveRecord::Migration[5.2]
  def change
    add_column :orders, :cloned_order_id, :integer
  end
end


text:
namespace base {
class SharedMemory;
}

namespace content {

class PPB_Graphics3D_Impl;
class RendererPpapiHost;
class RenderViewImpl;
class VideoDecoderShim;

class CONTENT_EXPORT PepperVideoDecoderHost
    : public ppapi::host::ResourceHost,
      public media::VideoDecodeAccelerator::Client {
 public:
  PepperVideoDecoderHost(RendererPpapiHost* host,
                         PP_Instance instance,
                         PP_Resource resource);
  ~PepperVideoDecoderHost() override;

 private:
  struct PendingDecode {
    PendingDecode(uint32_t shm_id,
                  const ppapi::host::ReplyMessageContext& reply_context);
    ~PendingDecode();

    const uint32_t shm_id;
    const ppapi::host::ReplyMessageContext reply_context;
  };

  friend class VideoDecoderShim;

  // ResourceHost implementation.
  int32_t OnResourceMessageReceived(
      const IPC::Message& msg,
      ppapi::host::HostMessageContext* context) override;

  // media::VideoDecodeAccelerator::Client implementation.
  void ProvidePictureBuffers(uint32 requested_num_of_buffers,
                             const gfx::Size& dimensions,
                             uint32 texture_target) override;
  void DismissPictureBuffer(int32 picture_buffer_id) override;
  void PictureReady(const media::Picture& picture) override;
  void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override;
  void NotifyFlushDone() override;
  void NotifyResetDone() override;
  void NotifyError(media::VideoDecodeAccelerator::Error error) override;

  int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context,
                              const ppapi::HostResource& graphics_context,
                              PP_VideoProfile profile,
                              PP_HardwareAcceleration acceleration);
  int32_t OnHostMsgGetShm(ppapi::host::HostMessageContext* context,
                          uint32_t shm_id,
                          uint32_t shm_size);
  int32_t OnHostMsgDecode(ppapi::host::HostMessageContext* context,
                          uint32_t shm_id,
                          uint32_t size,
                          int32_t decode_id);
  int32_t OnHostMsgAssignTextures(ppapi::host::HostMessageContext* context,
                                  const PP_Size& size,
                                  const std::vector<uint32_t>& texture_ids);
  int32_t OnHostMsgRecyclePicture(ppapi::host::HostMessageContext* context,
                                  uint32_t picture_id);
  int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context);
  int32_t OnHostMsgReset(ppapi::host::HostMessageContext* context);

  // These methods are needed by VideoDecodeShim, to look like a
  // VideoDecodeAccelerator.
  void OnInitializeComplete(int32_t result);
  const uint8_t* DecodeIdToAddress(uint32_t decode_id);
  void RequestTextures(uint32 requested_num_of_buffers,
                       const gfx::Size& dimensions,
                       uint32 texture_target,
                       const std::vector<gpu::Mailbox>& mailboxes);

  // Non-owning pointer.
  RendererPpapiHost* renderer_ppapi_host_;

  scoped_ptr<media::VideoDecodeAccelerator> decoder_;

  // A vector holding our shm buffers, in sync with a similar vector in the
  // resource. We use a buffer's index in these vectors as its id on both sides
  // of the proxy. Only add buffers or update them in place so as not to
  // invalidate these ids.
  ScopedVector<base::SharedMemory> shm_buffers_;
  // A vector of true/false indicating if a shm buffer is in use by the decoder.
  // This is parallel to |shm_buffers_|.
  std::vector<uint8_t> shm_buffer_busy_;

  typedef std::set<uint32_t> TextureSet;
  TextureSet pictures_in_use_;
  TextureSet dismissed_pictures_in_use_;

  // Maps decode uid to PendingDecode info.
  typedef base::hash_map<int32_t, PendingDecode> PendingDecodeMap;
  PendingDecodeMap pending_decodes_;

  ppapi::host::ReplyMessageContext flush_reply_context_;
  ppapi::host::ReplyMessageContext reset_reply_context_;
  // Only used when in software fallback mode.
  ppapi::host::ReplyMessageContext initialize_reply_context_;

  bool initialized_;

  DISALLOW_COPY_AND_ASSIGN(PepperVideoDecoderHost);
};

}  // namespace content

#endif  // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_


text:
<?php

declare(strict_types=1);

namespace JsonApiPhp\JsonApi\Link;

use JsonApiPhp\JsonApi\Internal\LinkTrait;
use JsonApiPhp\JsonApi\Internal\PaginationLink;

use function JsonApiPhp\JsonApi\child;

final class PrevLink implements PaginationLink {
    use LinkTrait;

    /**
     * @param object $o
     * @internal
     */
    public function attachTo(object $o): void {
        child($o, 'links')->prev = $this->link;
    }
}


text:
package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"runtime"
	"strings"
	"time"

	"github.com/boot2docker/boot2docker-cli/driver"
	_ "github.com/boot2docker/boot2docker-cli/dummy"
	_ "github.com/boot2docker/boot2docker-cli/virtualbox"
)

func vmNotRunningError(vmName string) error {
	return fmt.Errorf("VM %q is not running. (Did you run `boot2docker up`?)", vmName)
}

// Initialize the boot2docker VM from scratch.
func cmdInit() error {
	B2D.Init = false
	_, err := driver.GetMachine(&B2D)
	if err == nil {
		fmt.Printf("Virtual machine %s already exists\n", B2D.VM)
		return nil
	}

	if _, err := os.Stat(B2D.ISO); err != nil {
		if !os.IsNotExist(err) {
			return fmt.Errorf("Failed to open ISO image %q: %s", B2D.ISO, err)
		}

		if err := cmdDownload(); err != nil {
			return err
		}
	}

	if _, err := os.Stat(B2D.SSHKey); err != nil {
		if !os.IsNotExist(err) {
			return fmt.Errorf("Something wrong with SSH Key file %q: %s", B2D.SSHKey, err)
		}

		cmd := exec.Command(B2D.SSHGen, "-t", "rsa", "-N", "", "-f", B2D.SSHKey)
		cmd.Stdin = os.Stdin
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		if B2D.Verbose {
			cmd.Stderr = os.Stderr
			fmt.Printf("executing: %v %v\n", cmd.Path, strings.Join(cmd.Args, " "))
		}

		if err := cmd.Run(); err != nil {
			return fmt.Errorf("Error generating new SSH Key into %s: %s", B2D.SSHKey, err)
		}
	}
	//TODO: print a ~/.ssh/config entry for our b2d connection that the user can c&p

	B2D.Init = true
	_, err = driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to initialize machine %q: %s", B2D.VM, err)
	}
	fmt.Printf("Initialization of virtual machine %q complete.\n", B2D.VM)
	fmt.Printf("Use `boot2docker up` to start it.\n")
	return nil
}

// Bring up the VM from all possible states.
func cmdUp() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Start(); err != nil {
		return fmt.Errorf("Failed to start machine %q: %s", B2D.VM, err)
	}

	if err := m.Refresh(); err != nil {
		return fmt.Errorf("Failed to start machine %q: %s", B2D.VM, err)
	}
	if m.GetState() != driver.Running {
		return fmt.Errorf("Failed to start machine %q (run again with -v for details)", B2D.VM)
	}

	fmt.Println("Waiting for VM and Docker daemon to start...")
	//give the VM a little time to start, so we don't kill the Serial Pipe/Socket
	time.Sleep(time.Duration(B2D.Waittime) * time.Millisecond)
	natSSH := fmt.Sprintf("localhost:%d", m.GetSSHPort())
	IP := ""
	for i := 1; i < B2D.Retries; i++ {
		print(".")
		if B2D.Serial && runtime.GOOS != "windows" {
			if IP, err = RequestIPFromSerialPort(m.GetSerialFile()); err == nil {
				break
			}
		}
		if err := read(natSSH, 1, time.Duration(B2D.Waittime)*time.Millisecond); err == nil {
			if IP, err = RequestIPFromSSH(m); err == nil {
				break
			}
		}
	}
	if B2D.Verbose {
		fmt.Printf("VM Host-only IP address: %s", IP)
		fmt.Printf("\nWaiting for Docker daemon to start...\n")
	}

	time.Sleep(time.Duration(B2D.Waittime) * time.Millisecond)
	socket := ""
	for i := 1; i < B2D.Retries; i++ {
		print("o")
		if socket, err = RequestSocketFromSSH(m); err == nil {
			break
		}
		if B2D.Verbose {
			fmt.Printf("Error requesting socket: %s\n", err)
		}
		time.Sleep(600 * time.Millisecond)
	}
	fmt.Printf("\nStarted.\n")

	if socket == "" {
		// lets try one more time
		time.Sleep(time.Duration(B2D.Waittime) * time.Millisecond)
		fmt.Printf("  Trying to get Docker socket one more time\n")

		if socket, err = RequestSocketFromSSH(m); err != nil {
			fmt.Printf("Error requesting socket: %s\n", err)
		}
	}
	// Copying the certs here - someone might have have written a Windows API client.
	certPath, err := RequestCertsUsingSSH(m)
	if err != nil {
		// These errors are not fatal
		fmt.Fprintf(os.Stderr, "Warning: error copying certificates: %s\n", err)
	}

	if socket == "" {
		fmt.Fprintf(os.Stderr, "Auto detection of the VM's Docker socket failed.\n")
		fmt.Fprintf(os.Stderr, "Please run `boot2docker -v up` to diagnose.\n")
	} else {
		// Check if $DOCKER_* ENV vars are properly configured.
		if !checkEnvironment(socket, certPath) {
			fmt.Printf("\nTo connect the Docker client to the Docker daemon, please set:\n")
			printExport(socket, certPath)
			fmt.Printf("\nOr run: `eval \"$(boot2docker shellinit)\"`\n")
		} else {
			fmt.Printf("Your environment variables are already set correctly.\n")
		}
	}
	fmt.Printf("\n")
	return nil
}

// Give the user the exact command to run to set the env.
func cmdShellInit() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}

	if m.GetState() != driver.Running {
		return vmNotRunningError(B2D.VM)
	}

	socket, err := RequestSocketFromSSH(m)
	if err != nil {
		return fmt.Errorf("Error requesting socket: %s\n", err)
	}

	certPath, err := RequestCertsUsingSSH(m)
	if err != nil {
		// These errors are not fatal
		fmt.Fprintf(os.Stderr, "Warning: error copying certificates: %s\n", err)
	}

	// Check if $DOCKER_* ENV vars are properly configured.
	if !checkEnvironment(socket, certPath) {
		printExport(socket, certPath)
	} else {
		fmt.Fprintf(os.Stderr, "Your environment variables are already set correctly.\n")
	}

	return nil
}

func checkEnvironment(socket, certPath string) bool {
	for name, value := range exports(socket, certPath) {
		value = strings.Trim(value, `"'`) // remove surrounding quotes
		if os.Getenv(name) != value {
			return false
		}
	}

	return true
}

func printExport(socket, certPath string) {
	values := exports(socket, certPath)
	if runtime.GOOS == "windows" && !isUnixShellOnWindows() {
		printExportWindows(values)
	} else {
		printExportUnix(values)
	}
}

func isUnixShellOnWindows() bool {
	return os.Getenv("TERM") != ""
}

func printExportUnix(values map[string]string) {
	for name, value := range values {
		switch filepath.Base(os.Getenv("SHELL")) {
		case "fish":
			if value == "" {
				fmt.Printf("    set -e %s\n", name)
			} else {
				fmt.Printf("    set -x %s %s\n", name, value)
			}
		default: // default command to export variables POSIX shells, like bash, zsh, etc.
			if value == "" {
				fmt.Printf("    unset %s\n", name)
			} else {
				fmt.Printf("    export %s=%s\n", name, value)
			}
		}
	}
}

func printExportWindows(values map[string]string) {
	// Print cmd.exe instructions to stderr
	fmt.Fprintln(os.Stderr, "If you are running inside Windows Command Prompt (cmd.exe), copy and paste the")
	fmt.Fprintln(os.Stderr, "following commands to your terminal to set the environment variables:")
	for name, value := range values {
		if value == "" {
			fmt.Fprintf(os.Stderr, "    set %s=\n", name)
		} else {
			fmt.Fprintf(os.Stderr, "    set %s=%s\n", name, value)
		}
	}
	fmt.Fprintln(os.Stderr, "")
	// Print powershell instructions to stderr
	fmt.Fprintln(os.Stderr, "If you are running inside PowerShell, copy or paste the following commands")
	fmt.Fprintln(os.Stderr, `to your shell or run "boot2docker shellinit | Invoke-Expression" to set the`)
	fmt.Fprintln(os.Stderr, "environment variables:")

	// Print powershell exports to stdout
	for name, value := range values {
		if value == "" {
			fmt.Printf("    Remove-Item Env:\\%s\n", name)
		} else {
			fmt.Printf("    $Env:%s = \"%s\"\n", name, value)
		}
	}
}

func exports(socket, certPath string) map[string]string {
	out := make(map[string]string)

	out["DOCKER_HOST"] = socket
	out["DOCKER_CERT_PATH"] = certPath

	if runtime.GOOS == "windows" && isUnixShellOnWindows() {
		// Surround Windows-style paths with single quotes in exported path otherwise
		// bash swallows the backslashes in export statements like:
		//   export DOCKER_CERT_PATH=C:\Users\ahmet\.boot2docker\certs\boot2docker-vm
		out["DOCKER_CERT_PATH"] = fmt.Sprintf("'%s'", out["DOCKER_CERT_PATH"])
	}

	if certPath == "" {
		out["DOCKER_TLS_VERIFY"] = ""
	} else {
		out["DOCKER_TLS_VERIFY"] = "1"
	}

	//if a http_proxy is set, we need to make sure the boot2docker ip
	//is added to the NO_PROXY environment variable
	if os.Getenv("http_proxy") != "" || os.Getenv("HTTP_PROXY") != "" {
		//get the ip from socket/DOCKER_HOST
		re := regexp.MustCompile("tcp://([^:]+):")
		if matches := re.FindStringSubmatch(socket); len(matches) == 2 {
			ip := matches[1]
			name := "no_proxy"
			val := os.Getenv("no_proxy")
			if val == "" {
				name = "NO_PROXY"
				val = os.Getenv("NO_PROXY")
			}

			switch {
			case val == "":
				out[name] = ip
			case strings.Contains(val, ip):
				out[name] = val
			default:
				out[name] = fmt.Sprintf("%s,%s", val, ip)
			}
		}
	}
	return out
}

// Tell the user the config (and later let them set it?)
func cmdConfig() error {
	dir, err := cfgDir(".boot2docker")
	if err != nil {
		return fmt.Errorf("Error working out Profile file location: %s\n", err)
	}
	filename := cfgFilename(dir)
	fmt.Printf("# boot2docker profile filename: %s\n", filename)
	fmt.Println(printConfig())
	return nil
}

// Suspend and save the current state of VM on disk.
func cmdSave() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s\n", B2D.VM, err)
	}
	if err := m.Save(); err != nil {
		return fmt.Errorf("Failed to save machine %q: %s\n", B2D.VM, err)
	}
	return nil
}

// Gracefully stop the VM by sending ACPI shutdown signal.
func cmdStop() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Stop(); err != nil {
		return fmt.Errorf("Failed to stop machine %q: %s", B2D.VM, err)
	}
	return nil
}

// Forcefully power off the VM (equivalent to unplug power). Might corrupt disk
// image.
func cmdPoweroff() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Poweroff(); err != nil {
		return fmt.Errorf("Failed to poweroff machine %q: %s", B2D.VM, err)
	}
	return nil
}

// Upgrade the boot2docker ISO - preserving server state
func cmdUpgrade() error {
	if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
		if B2D.Clobber {
			err := upgradeDockerClientBinary()
			if err != nil {
				return err
			}
		} else {
			fmt.Println("Skipping client binary download, use --clobber=true to enable...")
		}
	}
	if err := upgradeBoot2DockerBinary(); err != nil {
		return fmt.Errorf("Error upgrading boot2docker binary: %s", err)
	}
	m, err := driver.GetMachine(&B2D)
	if err == nil {
		if m.GetState() == driver.Running || m.GetState() == driver.Saved || m.GetState() == driver.Paused {
			// Windows won't let us move the ISO aside while it's in use
			if err = cmdStop(); err == nil {
				if err = cmdDownload(); err == nil {
					err = cmdUp()
				}
			}
			return err
		}
	}
	return cmdDownload()
}

func upgradeBoot2DockerBinary() error {
	var (
		goos, arch, ext string
	)
	latestVersion, err := getLatestReleaseName("https://api.github.com/repos/boot2docker/boot2docker-cli/releases")
	if err != nil {
		return fmt.Errorf("Error attempting to get the latest boot2docker-cli release: %s", err)
	}
	baseUrl := "https://github.com/boot2docker/boot2docker-cli/releases/download"

	ext = ""

	switch runtime.GOARCH {
	case "amd64":
		arch = "amd64"
	default:
		return fmt.Errorf("Architecture not supported")
	}

	switch runtime.GOOS {
	case "darwin", "linux":
		goos = runtime.GOOS
	case "windows":
		goos = "windows"
		arch = "amd64"
		ext = ".exe"
	default:
		return fmt.Errorf("Operating system not supported")
	}
	binaryUrl := fmt.Sprintf("%s/%s/boot2docker-%s-%s-%s%s", baseUrl, latestVersion, latestVersion, goos, arch, ext)
	currentBoot2DockerVersion := Version
	if err := attemptUpgrade(binaryUrl, "boot2docker", latestVersion, currentBoot2DockerVersion); err != nil {
		return fmt.Errorf("Error attempting upgrade: %s", err)
	}
	return nil
}

func upgradeDockerClientBinary() error {
	var (
		clientOs, clientArch string
	)
	resp, err := http.Get("https://get.docker.com/latest")
	if err != nil {
		return fmt.Errorf("Error checking the latest version of Docker: %s", err)
	}
	defer resp.Body.Close()
	latestVersionBytes, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return fmt.Errorf("Error reading response body on latest version of Docker call: %s", err)
	}
	latestVersion := strings.TrimSpace(string(latestVersionBytes))
	localClientVersion, err := getLocalClientVersion()
	if err != nil {
		return fmt.Errorf("Error getting local Docker client version: %s", err)
	}
	switch runtime.GOARCH {
	case "amd64":
		clientArch = "x86_64"
	default:
		return fmt.Errorf("Architecture not supported")
	}

	switch runtime.GOOS {
	case "darwin":
		clientOs = "Darwin"
	case "linux":
		clientOs = "Linux"
	default:
		return fmt.Errorf("Operating system not supported")
	}
	binaryUrl := fmt.Sprintf("https://get.docker.com/builds/%s/%s/docker-latest", clientOs, clientArch)
	if err := attemptUpgrade(binaryUrl, "docker", latestVersion, localClientVersion); err != nil {
		return fmt.Errorf("Error attempting upgrade: %s", err)
	}
	return nil
}

func attemptUpgrade(binaryUrl, binaryName, latestVersion, localVersion string) error {
	if (latestVersion != localVersion && !strings.Contains(latestVersion, "rc")) || B2D.ForceUpgradeDownload {
		if err := backupAndDownload(binaryUrl, binaryName, localVersion); err != nil {
			return fmt.Errorf("Error attempting backup and download of Docker client binary: %s", err)
		}
	} else {
		fmt.Printf("%s is up to date (%s), skipping upgrade...\n", binaryName, localVersion)
	}
	return nil
}

func backupAndDownload(binaryUrl, binaryName, localVersion string) error {
	binaryPath, err := exec.LookPath(binaryName)
	if err != nil {
		return fmt.Errorf("Error attempting to locate local binary: %s", err)
	}
	path := strings.TrimSpace(string(binaryPath))

	fmt.Println("Backing up existing", binaryName, "binary...")
	if err := backupBinary(binaryName, localVersion, path); err != nil {
		return fmt.Errorf("Error backing up docker client: %s", err)
	}

	fmt.Println("Downloading new", binaryName, "client binary...")
	if err := download(path, binaryUrl); err != nil {
		return fmt.Errorf("Error attempting to download new client binary: %s", err)
	}
	if err := os.Chmod(path, 0755); err != nil {
		return err
	}
	fmt.Printf("Success: downloaded %s\n\tto %s\n\tThe old version is backed up to ~/.boot2docker.\n", binaryUrl, path)
	return nil
}

func backupBinary(binaryName, localVersion, path string) error {
	dir, err := cfgDir(".boot2docker")
	if err != nil {
		return fmt.Errorf("Error getting boot2docker config dir: %s", err)
	}
	buf, err := ioutil.ReadFile(path)
	if err != nil {
		return fmt.Errorf("Error opening binary for reading at %s: %s", path, err)
	}
	backupName := fmt.Sprintf("%s-%s", binaryName, localVersion)
	if err := ioutil.WriteFile(filepath.Join(dir, backupName), buf, 0755); err != nil {
		return fmt.Errorf("Error creating backup file: %s", err)
	}
	return nil
}

// Gracefully stop and then start the VM.
func cmdRestart() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Restart(); err != nil {
		return fmt.Errorf("Failed to restart machine %q: %s", B2D.VM, err)
	}
	return nil
}

// Forcefully reset (equivalent to cold boot) the VM. Might corrupt disk image.
func cmdReset() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Reset(); err != nil {
		return fmt.Errorf("Failed to reset machine %q: %s", B2D.VM, err)
	}
	return nil
}

// Delete the VM and associated disk image.
func cmdDelete() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		if err == driver.ErrMachineNotExist {
			return fmt.Errorf("Machine %q does not exist.", B2D.VM)
		}
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	if err := m.Delete(); err != nil {
		return fmt.Errorf("Failed to delete machine %q: %s", B2D.VM, err)
	}
	return nil
}

// Show detailed info of the VM.
func cmdInfo() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	b, err := json.MarshalIndent(m, "", "\t")
	if err != nil {
		return fmt.Errorf("Failed to encode machine %q info: %s", B2D.VM, err)
	}

	os.Stdout.Write(b)

	return nil
}

// Show the current state of the VM.
func cmdStatus() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}
	fmt.Println(m.GetState())
	return nil
}

// Call the external SSH command to login into boot2docker VM.
func cmdSSH() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}

	if m.GetState() != driver.Running {
		return vmNotRunningError(B2D.VM)
	}

	// find the ssh cmd string and then pass any remaining strings to ssh
	// TODO: it's a shame to repeat the same code as in config.go, but I
	//       didn't find a way to share the unsharable without more rework
	i := 1
	for i < len(os.Args) && os.Args[i-1] != "ssh" {
		i++
	}

	if err := cmdInteractive(m, os.Args[i:]...); err != nil {
		return fmt.Errorf("%s", err)
	}
	return nil
}

func cmdIP() error {
	m, err := driver.GetMachine(&B2D)
	if err != nil {
		return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err)
	}

	if m.GetState() != driver.Running {
		return vmNotRunningError(B2D.VM)
	}

	IP := ""
	if B2D.Serial {
		if runtime.GOOS != "windows" {
			if IP, err = RequestIPFromSerialPort(m.GetSerialFile()); err != nil {
				if B2D.Verbose {
					fmt.Printf("Error getting IP via Serial: %s\n", err)
				}
			}
		}
	}

	if IP == "" {
		if IP, err = RequestIPFromSSH(m); err != nil {
			if B2D.Verbose {
				fmt.Printf("Error getting IP via SSH: %s\n", err)
			}
		}
	}
	if IP != "" {
		fmt.Println(IP)
	} else {
		fmt.Fprintf(os.Stderr, "\nFailed to get VM Host only IP address.\n")
		fmt.Fprintf(os.Stderr, "\tWas the VM initialized using boot2docker?\n")
	}
	return nil
}

// Download the boot2docker ISO image.
func cmdDownload() error {
	url := B2D.ISOURL

	// match github (enterprise) release urls:
	// https://api.github.com/repos/../../relases or
	// https://some.github.enterprise/api/v3/repos/../../relases
	re := regexp.MustCompile("https://([^/]+)(/api/v3)?/repos/([^/]+)/([^/]+)/releases")
	if matches := re.FindStringSubmatch(url); len(matches) == 5 {
		tag, err := getLatestReleaseName(url)
		if err != nil {
			return fmt.Errorf("Failed to get latest release: %s", err)
		}
		host := matches[1]
		org := matches[3]
		repo := matches[4]
		if host == "api.github.com" {
			host = "github.com"
		}
		fmt.Printf("Latest release for %s/%s/%s is %s\n", host, org, repo, tag)
		url = fmt.Sprintf("https://%s/%s/%s/releases/download/%s/boot2docker.iso", host, org, repo, tag)
	}

	fmt.Println("Downloading boot2docker ISO image...")
	if err := download(B2D.ISO, url); err != nil {
		return fmt.Errorf("Failed to download ISO image: %s", err)
	}
	fmt.Printf("Success: downloaded %s\n\tto %s\n", url, B2D.ISO)
	return nil
}


text:
package io.apiman.gateway.engine.jdbc;

import io.apiman.gateway.engine.async.AsyncResultImpl;
import io.apiman.gateway.engine.async.IAsyncResultHandler;
import io.apiman.gateway.engine.beans.Api;
import io.apiman.gateway.engine.beans.ApiContract;
import io.apiman.gateway.engine.beans.Client;
import io.apiman.gateway.engine.beans.Contract;
import io.apiman.gateway.engine.beans.exceptions.InvalidContractException;
import io.apiman.gateway.engine.jdbc.i18n.Messages;

import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Extends the {@link JdbcRegistry} to provide single-node caching.  This caching solution
 * will not work in a cluster.  If looking for cluster support, either go with the core
 * {@link JdbcRegistry} or use {@link CachingJdbcRegistry}.
 *
 * @author eric.wittmann@redhat.com
 */
public abstract class CachingJdbcRegistry extends JdbcRegistry {

    private Map<String, Api> apiCache = new ConcurrentHashMap<>();
    private Map<String, Client> clientCache = new ConcurrentHashMap<>();
    private Object mutex = new Object();

    /**
     * Constructor.
     */
    public CachingJdbcRegistry(Map<String, String> config) {
        super(config);
    }

    /**
     * Called to invalidate the cache - clearing it so that subsequent calls to getApi()
     * or getContract() will trigger a new fetch from the ES store.
     */
    protected void invalidateCache() {
        synchronized (mutex) {
            clientCache.clear();
            apiCache.clear();
        }
    }

    /**
     * @see io.apiman.gateway.engine.jdbc.JdbcRegistry#getContract(java.lang.String, java.lang.String, java.lang.String, java.lang.String, io.apiman.gateway.engine.async.IAsyncResultHandler)
     */
    @Override
    public void getContract(String apiOrganizationId, String apiId, String apiVersion, String apiKey,
            IAsyncResultHandler<ApiContract> handler) {
        Client client = null;
        Api api = null;

        try {
            synchronized (mutex) {
                client = getClient(apiKey);
                api = getApi(apiOrganizationId, apiId, apiVersion);
            }
            if (client == null) {
                Exception error = new InvalidContractException(Messages.i18n.format("JdbcRegistry.NoClientForAPIKey", apiKey)); //$NON-NLS-1$
                handler.handle(AsyncResultImpl.create(error, ApiContract.class));
                return;
            }
            if (api == null) {
                throw new InvalidContractException(Messages.i18n.format("JdbcRegistry.ApiWasRetired", //$NON-NLS-1$
                        apiId, apiOrganizationId));
            }

            Contract matchedContract = null;
            for (Contract contract : client.getContracts()) {
                if (contract.matches(apiOrganizationId, apiId, apiVersion)) {
                    matchedContract = contract;
                    break;
                }
            }

            if (matchedContract == null) {
                throw new InvalidContractException(Messages.i18n.format("JdbcRegistry.NoContractFound", //$NON-NLS-1$
                        client.getClientId(), api.getApiId()));
            }

            ApiContract contract = new ApiContract(api, client, matchedContract.getPlan(), matchedContract.getPolicies());
            handler.handle(AsyncResultImpl.create(contract));
        } catch (Exception e) {
            handler.handle(AsyncResultImpl.create(e, ApiContract.class));
        }
    }

    /**
     * @see io.apiman.gateway.engine.jdbc.JdbcRegistry#getApi(java.lang.String, java.lang.String, java.lang.String, io.apiman.gateway.engine.async.IAsyncResultHandler)
     */
    @Override
    public void getApi(final String organizationId, final String apiId, final String apiVersion,
            final IAsyncResultHandler<Api> handler) {
        try {
            Api api = getApi(organizationId, apiId, apiVersion);
            handler.handle(AsyncResultImpl.create(api));
        } catch (SQLException e) {
            handler.handle(AsyncResultImpl.create(e, Api.class));
        }
    }

    /**
     * Gets the api either from the cache or from ES.
     * @param orgId
     * @param apiId
     * @param version
     */
    protected Api getApi(String orgId, String apiId, String version) throws SQLException {
        String apiIdx = getApiId(orgId, apiId, version);
        Api api;
        synchronized (mutex) {
            api = apiCache.get(apiIdx);
        }

        if (api == null) {
            api = super.getApiInternal(orgId, apiId, version);
            synchronized (mutex) {
                if (api != null) {
                    apiCache.put(apiIdx, api);
                }
            }
        }

        return api;
    }

    /**
     * @see io.apiman.gateway.engine.jdbc.JdbcRegistry#getClient(java.lang.String, io.apiman.gateway.engine.async.IAsyncResultHandler)
     */
    @Override
    public void getClient(String apiKey, IAsyncResultHandler<Client> handler) {
        try {
            Client client = getClient(apiKey);
            handler.handle(AsyncResultImpl.create(client));
        } catch (SQLException e) {
            handler.handle(AsyncResultImpl.create(e, Client.class));
        }
    }

    /**
     * Gets the client either from the cache or from ES.
     * @param orgId
     * @param clientId
     * @param version
     */
    protected Client getClient(String apiKey) throws SQLException {
        Client client;
        synchronized (mutex) {
            client = clientCache.get(apiKey);
        }

        if (client == null) {
            client = super.getClientInternal(apiKey);
            synchronized (mutex) {
                if (client != null) {
                    clientCache.put(apiKey, client);
                }
            }
        }

        return client;
    }

}


text:
using Game;
using ExitGames.Client.Photon;
using Mod.Exceptions;
using Photon;

namespace Mod.Commands
{
    public class CommandResetkd : Command
    {
        public override string CommandName => "resetkd";
        public override string[] Aliases => new[] {"resetkda"};

        public override void Execute(string[] args)
        {
            Hashtable hashtable = new Hashtable
            {
                {PlayerProperty.Kills, 0},
                {PlayerProperty.Deaths, 0},
                {PlayerProperty.MaxDamage, 0},
                {PlayerProperty.TotalDamage, 0}
            };

            if (args.Length < 1)
            {
                Player.Self.SetCustomProperties(hashtable);
                Shelter.Chat.System("You resetted your kd.");
                return;
            }

            if (args[0].EqualsIgnoreCase("all"))
            {
#if !ABUSIVE
                if (!Player.Self.IsMasterClient)
                {
                    Chat.System("You need to be MC to reset everyone's KDs");
                    return;
                }
#endif
                foreach (Player p in PhotonNetwork.PlayerList)
                    p.SetCustomProperties(hashtable);
                Shelter.Chat.System("You resetted the kds of everyone.");
                return;
            }

            if (!Player.TryParse(args[0], out Player player))
                throw new PlayerNotFoundException(args[0]);

            player.SetCustomProperties(hashtable);
            Shelter.Chat.System("You reset {0}'s kda", player);
        }
    }
}


text:
/**
 * Created by Nhuan on 12/12/2015.
 */
// Enable pusher logging - don't include this in production
    // Enable pusher logging - don't include this in production
//Pusher.log = function(message) {
//    if (window.console && window.console.log) {
//        //window.console.log(message);
//    }
//};
var pusher = new Pusher('0698be6919e98a075011', {
    encrypted: true
});
var user_channel = getUserId().toString();
list_channel = [];
var channel = pusher.subscribe(user_channel);
list_channel.push(channel);
console.log("Notification channel initializing");
channel.bind('notification', function(data) {

    $("#box_noti").append("

"+data.text+"

");
    $(".noti_alert").show();
});
console.log("Like channel initializing");
channel.bind('like', function(data) {
    //console.log(data);
    $("#box_noti").append("

"+data.name+" vừa like ảnh của bạn

");
    $(".noti_alert").show();
});
channel.bind('onShowChatBox',function(data){
    console.log(data);
    //var modal = $('.box-mess');
    var friendid = data.user.user_id;
    var user_id = $("#user-id-info").data('id');
    //modal.data("chatid",friendid);
    //modal.find("#friend_profile").attr("href","http://foodieweb.com/"+data.user.username);
    //modal.find("#friend_profile").text(data.user.name);
    //modal.show();
    //console.log(friendid);
    //console.log(user_id);
    var channel_name = Math.min(user_id,friendid)+"-"+Math.max(user_id,friendid);
    var channel = createChannelChat(channel_name);
});
function createChannelChat(channel_name){

    for(var i = 0;i<list_channel.length;i++){
        if(list_channel[i].name==channel_name)
        {
            console.log("Duplicate channel");
            return;
        }
    }
    try {
        var channel = pusher.subscribe(channel_name);
        channel.bind("messages:onsend", appendToBox);
        channel.bind("messages:ontype", showTyping);
        channel.bind("messages:onseen", showSeenLabel);
        list_channel.push(channel);
        return channel;
    } catch(err){
        console.log(err);
    }

}
function appendToBox(data){
    console.log("Ping...");
    if(getUserId()!=data.sender_id) {
        if($('.box-mess').is(":hidden")==true){
            showBox(data.sender_id);
        }
        console.log(data.message);
        var chat = data.message;
        $(".bm-container").append("
" + chat + "
");
    }
}
function showTyping(data){
    console.log("Typing...");
}
function showSeenLabel(data){
    console.log(data);
}


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

import javax.annotation.Generated;

/**
 *

 * The specified resource can't be modified at this time.
 *

 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResourceInUseException extends com.amazonaws.services.qldb.model.AmazonQLDBException {
    private static final long serialVersionUID = 1L;

    /**
     *

     * The type of resource.
     *

     */
    private String resourceType;
    /**
     *

     * The name of the resource.
     *

     */
    private String resourceName;

    /**
     * Constructs a new ResourceInUseException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public ResourceInUseException(String message) {
        super(message);
    }

    /**
     *

     * The type of resource.
     *

     *
     * @param resourceType
     *        The type of resource.
     */

    @com.fasterxml.jackson.annotation.JsonProperty("ResourceType")
    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    /**
     *

     * The type of resource.
     *

     *
     * @return The type of resource.
     */

    @com.fasterxml.jackson.annotation.JsonProperty("ResourceType")
    public String getResourceType() {
        return this.resourceType;
    }

    /**
     *

     * The type of resource.
     *

     *
     * @param resourceType
     *        The type of resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ResourceInUseException withResourceType(String resourceType) {
        setResourceType(resourceType);
        return this;
    }

    /**
     *

     * The name of the resource.
     *

     *
     * @param resourceName
     *        The name of the resource.
     */

    @com.fasterxml.jackson.annotation.JsonProperty("ResourceName")
    public void setResourceName(String resourceName) {
        this.resourceName = resourceName;
    }

    /**
     *

     * The name of the resource.
     *

     *
     * @return The name of the resource.
     */

    @com.fasterxml.jackson.annotation.JsonProperty("ResourceName")
    public String getResourceName() {
        return this.resourceName;
    }

    /**
     *

     * The name of the resource.
     *

     *
     * @param resourceName
     *        The name of the resource.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ResourceInUseException withResourceName(String resourceName) {
        setResourceName(resourceName);
        return this;
    }

}


text:
#include "webrtc/modules/audio_coding/neteq/rtcp.h"

#include <string.h>

#include <algorithm>

#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/interface/module_common_types.h"

namespace webrtc {

void Rtcp::Init(uint16_t start_sequence_number) {
  cycles_ = 0;
  max_seq_no_ = start_sequence_number;
  base_seq_no_ = start_sequence_number;
  received_packets_ = 0;
  received_packets_prior_ = 0;
  expected_prior_ = 0;
  jitter_ = 0;
  transit_ = 0;
}

void Rtcp::Update(const RTPHeader& rtp_header, uint32_t receive_timestamp) {
  // Update number of received packets, and largest packet number received.
  received_packets_++;
  int16_t sn_diff = rtp_header.sequenceNumber - max_seq_no_;
  if (sn_diff >= 0) {
    if (rtp_header.sequenceNumber < max_seq_no_) {
      // Wrap-around detected.
      cycles_++;
    }
    max_seq_no_ = rtp_header.sequenceNumber;
  }

  // Calculate jitter according to RFC 3550, and update previous timestamps.
  // Note that the value in |jitter_| is in Q4.
  if (received_packets_ > 1) {
    int32_t ts_diff = receive_timestamp - (rtp_header.timestamp - transit_);
    ts_diff = WEBRTC_SPL_ABS_W32(ts_diff);
    int32_t jitter_diff = (ts_diff << 4) - jitter_;
    // Calculate 15 * jitter_ / 16 + jitter_diff / 16 (with proper rounding).
    jitter_ = jitter_ + ((jitter_diff + 8) >> 4);
  }
  transit_ = rtp_header.timestamp - receive_timestamp;
}

void Rtcp::GetStatistics(bool no_reset, RtcpStatistics* stats) {
  // Extended highest sequence number received.
  stats->extended_max_sequence_number =
      (static_cast<int>(cycles_) << 16) + max_seq_no_;

  // Calculate expected number of packets and compare it with the number of
  // packets that were actually received. The cumulative number of lost packets
  // can be extracted.
  uint32_t expected_packets =
      stats->extended_max_sequence_number - base_seq_no_ + 1;
  if (received_packets_ == 0) {
    // No packets received, assume none lost.
    stats->cumulative_lost = 0;
  } else if (expected_packets > received_packets_) {
    stats->cumulative_lost = expected_packets - received_packets_;
    if (stats->cumulative_lost > 0xFFFFFF) {
      stats->cumulative_lost = 0xFFFFFF;
    }
  } else {
    stats->cumulative_lost = 0;
  }

  // Fraction lost since last report.
  uint32_t expected_since_last = expected_packets - expected_prior_;
  uint32_t received_since_last = received_packets_ - received_packets_prior_;
  if (!no_reset) {
    expected_prior_ = expected_packets;
    received_packets_prior_ = received_packets_;
  }
  int32_t lost = expected_since_last - received_since_last;
  if (expected_since_last == 0 || lost <= 0 || received_packets_ == 0) {
    stats->fraction_lost = 0;
  } else {
    stats->fraction_lost = std::min(0xFFU, (lost << 8) / expected_since_last);
  }

  stats->jitter = jitter_ >> 4;  // Scaling from Q4.
}

}  // namespace webrtc


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Package com.communote.server.model.tag (Communote 3.5 API)</title>
<meta name="date" content="2019-02-02">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
com.communote.server.model.tag

Packages that use com.communote.server.model.tag

Package
Description

com.communote.plugins.api.rest.resource.tag

com.communote.plugins.mq.message.core.handler

com.communote.plugins.mq.message.core.util

com.communote.server.api.core.tag

com.communote.server.core.converter.user

com.communote.server.core.filter.listitems

com.communote.server.core.tag

com.communote.server.core.tag.category

com.communote.server.core.vo.query.converters

com.communote.server.model.blog

com.communote.server.model.note

com.communote.server.model.tag

com.communote.server.model.user

com.communote.server.model.user.group

com.communote.server.persistence.global

com.communote.server.persistence.tag

Classes in com.communote.server.model.tag used by com.communote.plugins.api.rest.resource.tag

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.plugins.mq.message.core.handler

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.plugins.mq.message.core.util

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.server.api.core.tag

Class and Description

Tag

A tag for some entity.

TagImpl

TagName

 Interface for tags with a name

Classes in com.communote.server.model.tag used by com.communote.server.core.converter.user

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.server.core.filter.listitems

Class and Description

TagName

 Interface for tags with a name

Classes in com.communote.server.model.tag used by com.communote.server.core.tag

Class and Description

Tag

A tag for some entity.

TagName

 Interface for tags with a name

Classes in com.communote.server.model.tag used by com.communote.server.core.tag.category

Class and Description

CategorizedTag

GlobalTagCategory

Classes in com.communote.server.model.tag used by com.communote.server.core.vo.query.converters

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.server.model.blog

Class and Description

Tag

A tag for some entity.

Taggable

Classes in com.communote.server.model.tag used by com.communote.server.model.note

Class and Description

Tag

A tag for some entity.

Taggable

Classes in com.communote.server.model.tag used by com.communote.server.model.tag

Class and Description

AbstractTagCategory

AbstractTagCategoryImpl

CategorizedTag

GlobalTagCategory

Tag

A tag for some entity.

TagImpl

TagName

 Interface for tags with a name

Classes in com.communote.server.model.tag used by com.communote.server.model.user

Class and Description

Tag

A tag for some entity.

Taggable

Classes in com.communote.server.model.tag used by com.communote.server.model.user.group

Class and Description

Tag

A tag for some entity.

Taggable

Classes in com.communote.server.model.tag used by com.communote.server.persistence.global

Class and Description

Tag

A tag for some entity.

Classes in com.communote.server.model.tag used by com.communote.server.persistence.tag

Class and Description

AbstractTagCategory

CategorizedTag

GlobalTagCategory

Tag

A tag for some entity.

TagImpl

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2019 Communote team. All rights reserved.


text:
package com.ynswet.common.rest;

import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import com.ynswet.common.util.databinding.CustomDateEditor;

@Controller
public class BaseRest {

	/**
	 * Register custom, context-specific property editors
	 *
	 */

	public final static String DEFAULT_PASSWORD="888888";

	public final static String ALREADY_EXISTS="账号已经存在,请重新填写";

	public final static String SAVE_SUCCESS="添加成功";

	public final static String UPDATE_SUCCESS="更新成功";

	public final static String DELTE_SUCCESS="删除成功";

	public final static String FIND_SUCCESS="查询成功";

	public final static String SAVE_FAILURE="添加失败";

	public final static String UPDATE_FAILURE="更新失败";

	public final static String DELETE_FAILURE="删除失败";

	public final static String FIND_FAILURE="查询失败";

	@InitBinder
	public void initBinder(WebDataBinder binder) {

		binder.registerCustomEditor(java.util.Calendar.class,
				new com.ynswet.common.util.databinding.CustomCalendarEditor());
		binder.registerCustomEditor(
				byte[].class,
				new org.springframework.web.multipart.support.ByteArrayMultipartFileEditor());
		binder.registerCustomEditor(boolean.class,
				new com.ynswet.common.util.databinding.EnhancedBooleanEditor(
						false));
		binder.registerCustomEditor(Boolean.class,
				new com.ynswet.common.util.databinding.EnhancedBooleanEditor(
						true));
		binder.registerCustomEditor(java.math.BigDecimal.class,
				new com.ynswet.common.util.databinding.NaNHandlingNumberEditor(
						java.math.BigDecimal.class, true));
		binder.registerCustomEditor(Integer.class,
				new com.ynswet.common.util.databinding.NaNHandlingNumberEditor(
						Integer.class, true));
		binder.registerCustomEditor(String.class,
				new com.ynswet.common.util.databinding.StringEditor());
		binder.registerCustomEditor(Long.class,
				new com.ynswet.common.util.databinding.NaNHandlingNumberEditor(
						Long.class, true));
		binder.registerCustomEditor(Double.class,
				new com.ynswet.common.util.databinding.NaNHandlingNumberEditor(
						Double.class, true));
		binder.registerCustomEditor(Date.class,
				new com.ynswet.common.util.databinding.CustomDateEditor(
						"yyyy-MM-dd HH:mm:ss"));

	}

	public static void main(String[] args) {

		CustomDateEditor ct=	new com.ynswet.common.util.databinding.CustomDateEditor(
				"yyyy-MM-dd HH:mm:ss");
		ct.setAsText("2015-11-11 12:22:33");
		System.out.println(ct.getAsText());

	}

}


text:
<?php

namespace Imagine\Test\Image\Fill\Gradient;

use Imagine\Image\Fill\Gradient\Horizontal;
use Imagine\Image\Color;
use Imagine\Image\Point;

class HorizontalTest extends LinearTest
{
    /**
     * (non-PHPdoc)
     * @see Imagine\Image\Fill\Gradient\LinearTest::getEnd()
     */
    protected function getEnd()
    {
        return new Color('fff');
    }

    /**
     * (non-PHPdoc)
     * @see Imagine\Image\Fill\Gradient\LinearTest::getStart()
     */
    protected function getStart()
    {
        return new Color('000');
    }

    /**
     * (non-PHPdoc)
     * @see Imagine\Image\Fill\Gradient\LinearTest::getMask()
     */
    protected function getFill(Color $start, Color $end)
    {
        return new Horizontal(100, $start, $end);
    }

    /**
     * (non-PHPdoc)
     * @see Imagine\Image\Fill\Gradient\LinearTest::getPointsAndShades()
     */
    public function getPointsAndColors()
    {
        return array(array(new Color('fff'), new Point(100, 5)),
        array(new Color('000'), new Point(0, 15)),
        array(new Color(array(128, 128, 128)), new Point(50, 25)));
    }
}


text:
/* 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.
 */

package org.camunda.bpm.engine.impl.migration.validation;

import org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance;
import org.camunda.bpm.engine.migration.MigrationInstruction;

public class MigrationPlanValidationFailure {

  protected MigrationInstruction migrationInstruction;
  protected String errorMessage;

  public MigrationPlanValidationFailure(MigrationInstruction migrationInstruction, String errorMessage) {
    this.migrationInstruction = migrationInstruction;
    this.errorMessage = errorMessage;
  }

  public MigrationInstruction getMigrationInstruction() {
    return migrationInstruction;
  }

  public String getErrorMessage() {
    return errorMessage;
  }

  public void writeTo(StringBuilder sb) {
    sb.append(migrationInstruction);
    sb.append(": ");
    sb.append(errorMessage);
  }

}


text:
package task.application.com.colette.ui.navdrawer;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;

import task.application.com.colette.R;
import task.application.com.colette.ui.favorites.FavoritesMediaActivity;

import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

public class NavigationDrawerActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener, NavigationDrawerItemListeners {

    private static final int NAVDRAWER_LAUNCH_DELAY = 250;
    private static final int MAIN_CONTENT_FADEOUT_DURATION = 250;
    private DrawerLayout drawer;
    private NavigationDrawerItemListeners listener;
    private FrameLayout mainContent;
    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
            WindowManager.LayoutParams attributes = this.getWindow().getAttributes();
            attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
            this.getWindow().setAttributes(attributes);
        }
        setContentView(R.layout.activity_navigation_drawer);
        mainContent = (FrameLayout) findViewById(R.id.activity_content);
        mainContent.setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        listener = this;
    }

    @Override
    public void setContentView(@LayoutRes int layoutResID) {
        super.setContentView(layoutResID);
        createNvDrawer();
    }

    @Override
    public void setContentView(View view) {
        mainContent.addView(view);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    protected void createNvDrawer() {

        handler = new Handler();
        drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
       // toggle.isDrawerIndicatorEnabled();

        toggle.syncState();
        //toggle.setDrawerIndicatorEnabled(true);
        drawer.addDrawerListener(toggle);
        drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
            @Override
            public void onDrawerSlide(View drawerView, float slideOffset) {

            }

            @Override
            public void onDrawerOpened(View drawerView) {

            }

            @Override
            public void onDrawerClosed(View drawerView) {

            }

            @Override
            public void onDrawerStateChanged(int newState) {

            }
        });
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    public void openDrawer(){
        drawer.openDrawer(Gravity.LEFT);
    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.navigation_drawer, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        switch (id) {
            case R.id.nav_favorite:
                handler.postDelayed(() ->
                        listener.itemSelected(new Intent(NavigationDrawerActivity.this,
                                FavoritesMediaActivity.class)), NAVDRAWER_LAUNCH_DELAY);
                break;
        }

        if (mainContent != null) {
            mainContent.animate().alpha(0).setDuration(MAIN_CONTENT_FADEOUT_DURATION);
        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }

    @Override
    public void itemSelected(Intent intent) {
        startActivity(intent);
        finish();
    }

    public interface NavigationDrawerStateChangeListener {

        void onDrawerSlide(View drawerView, float slideOffset);

        void onDrawerOpened(View drawerView);

        void onDrawerClosed(View drawerView);

        void onDrawerStateChanged(int newState);
    }
}

interface NavigationDrawerItemListeners {
    void itemSelected(Intent intent);
}