text:
package sql

import (
	"github.com/cockroachdb/cockroach/client"
	"github.com/cockroachdb/cockroach/config"
	"github.com/cockroachdb/cockroach/keys"
	"github.com/cockroachdb/cockroach/roachpb"
	"github.com/cockroachdb/cockroach/sql/parser"
	"github.com/cockroachdb/cockroach/sql/privilege"
)

// DropDatabase drops a database.
// Privileges: DROP on database.
//   Notes: postgres allows only the database owner to DROP a database.
//          mysql requires the DROP privileges on the database.
// TODO(XisiHuang): our DROP DATABASE is like the postgres DROP SCHEMA
// (cockroach database == postgres schema). the postgres default of not
// dropping the schema if there are dependent objects is more sensible
// (see the RESTRICT and CASCADE options).
func (p *planner) DropDatabase(n *parser.DropDatabase) (planNode, *roachpb.Error) {
	if n.Name == "" {
		return nil, roachpb.NewError(errEmptyDatabaseName)
	}

	nameKey := MakeNameMetadataKey(keys.RootNamespaceID, string(n.Name))
	gr, pErr := p.txn.Get(nameKey)
	if pErr != nil {
		return nil, pErr
	}
	if !gr.Exists() {
		if n.IfExists {
			// Noop.
			return &emptyNode{}, nil
		}
		return nil, roachpb.NewUErrorf("database %q does not exist", n.Name)
	}

	descKey := MakeDescMetadataKey(ID(gr.ValueInt()))
	desc := &Descriptor{}
	if pErr := p.txn.GetProto(descKey, desc); pErr != nil {
		return nil, pErr
	}
	dbDesc := desc.GetDatabase()
	if dbDesc == nil {
		return nil, roachpb.NewErrorf("%q is not a database", n.Name)
	}
	if err := dbDesc.Validate(); err != nil {
		return nil, roachpb.NewError(err)
	}

	if err := p.checkPrivilege(dbDesc, privilege.DROP); err != nil {
		return nil, roachpb.NewError(err)
	}

	tbNames, pErr := p.getTableNames(dbDesc)
	if pErr != nil {
		return nil, pErr
	}

	tbNameStrings := make([]string, len(tbNames))
	for i := range tbNames {
		tbDesc, err := p.dropTableImpl(tbNames, i)
		if err != nil {
			return nil, err
		}
		if tbDesc == nil {
			// Database claims to have this table, but it does not exist.
			return nil, roachpb.NewErrorf("table %q was described by database %q, but does not exist",
				tbNames[i].String())
		}
		tbNameStrings[i] = tbDesc.Name
	}

	zoneKey := MakeZoneKey(dbDesc.ID)

	b := &client.Batch{}
	b.Del(descKey)
	b.Del(nameKey)
	// Delete the zone config entry for this database.
	b.Del(zoneKey)

	p.setTestingVerifyMetadata(func(systemConfig config.SystemConfig) error {
		for _, key := range [...]roachpb.Key{descKey, nameKey, zoneKey} {
			if err := expectDeleted(systemConfig, key); err != nil {
				return err
			}
		}
		return nil
	})

	if pErr := p.txn.Run(b); pErr != nil {
		return nil, pErr
	}

	// Log Drop Database event.
	if pErr := MakeEventLogger(p.leaseMgr).insertEventRecord(p.txn,
		EventLogDropDatabase,
		int32(dbDesc.ID),
		int32(p.evalCtx.NodeID),
		struct {
			DatabaseName  string
			Statement     string
			User          string
			DroppedTables []string
		}{n.Name.String(), n.String(), p.session.User, tbNameStrings},
	); pErr != nil {
		return nil, pErr
	}
	return &emptyNode{}, nil
}

// DropIndex drops an index.
// Privileges: CREATE on table.
//   Notes: postgres allows only the index owner to DROP an index.
//          mysql requires the INDEX privilege on the table.
func (p *planner) DropIndex(n *parser.DropIndex) (planNode, *roachpb.Error) {
	for _, indexQualifiedName := range n.Names {
		if err := indexQualifiedName.NormalizeTableName(p.session.Database); err != nil {
			return nil, roachpb.NewError(err)
		}

		tableDesc, pErr := p.getTableDesc(indexQualifiedName)
		if pErr != nil {
			return nil, pErr
		}

		if err := p.checkPrivilege(&tableDesc, privilege.CREATE); err != nil {
			return nil, roachpb.NewError(err)
		}
		idxName := indexQualifiedName.Index()
		status, i, err := tableDesc.FindIndexByName(idxName)
		if err != nil {
			if n.IfExists {
				// Noop.
				return &emptyNode{}, nil
			}
			// Index does not exist, but we want it to: error out.
			return nil, roachpb.NewError(err)
		}
		switch status {
		case DescriptorActive:
			tableDesc.addIndexMutation(tableDesc.Indexes[i], DescriptorMutation_DROP)
			tableDesc.Indexes = append(tableDesc.Indexes[:i], tableDesc.Indexes[i+1:]...)

		case DescriptorIncomplete:
			switch tableDesc.Mutations[i].Direction {
			case DescriptorMutation_ADD:
				return nil, roachpb.NewUErrorf("index %q in the middle of being added, try again later", idxName)

			case DescriptorMutation_DROP:
				return &emptyNode{}, nil
			}
		}
		tableDesc.UpVersion = true
		mutationID := tableDesc.NextMutationID
		tableDesc.NextMutationID++
		if err := tableDesc.Validate(); err != nil {
			return nil, roachpb.NewError(err)
		}

		if pErr := p.txn.Put(MakeDescMetadataKey(tableDesc.GetID()), wrapDescriptor(&tableDesc)); pErr != nil {
			return nil, pErr
		}
		p.notifySchemaChange(tableDesc.ID, mutationID)
	}
	return &emptyNode{}, nil
}

// DropTable drops a table.
// Privileges: DROP on table.
//   Notes: postgres allows only the table owner to DROP a table.
//          mysql requires the DROP privilege on the table.
func (p *planner) DropTable(n *parser.DropTable) (planNode, *roachpb.Error) {
	// TODO(XisiHuang): should do truncate and delete descriptor in
	// the same txn
	for i := range n.Names {
		droppedDesc, err := p.dropTableImpl(n.Names, i)
		if err != nil {
			return nil, err
		}
		if droppedDesc == nil {
			if n.IfExists {
				continue
			}
			// Table does not exist, but we want it to: error out.
			return nil, roachpb.NewUErrorf("table %q does not exist", n.Names[i].Table())
		}
		// Log a Drop Table event for this table.
		if pErr := MakeEventLogger(p.leaseMgr).insertEventRecord(p.txn,
			EventLogDropTable,
			int32(droppedDesc.ID),
			int32(p.evalCtx.NodeID),
			struct {
				TableName string
				Statement string
				User      string
			}{droppedDesc.Name, n.String(), p.session.User},
		); pErr != nil {
			return nil, pErr
		}
	}
	return &emptyNode{}, nil
}

// dropTableImpl is used to drop a single table by name, which can result from
// either a DROP TABLE or DROP DATABASE statement. This method returns the
// dropped table descriptor, to be used for the purpose of logging the event.
func (p *planner) dropTableImpl(names parser.QualifiedNames, index int) (*TableDescriptor, *roachpb.Error) {
	// TODO(XisiHuang): should do truncate and delete descriptor in
	// the same txn
	tableQualifiedName := names[index]
	if err := tableQualifiedName.NormalizeTableName(p.session.Database); err != nil {
		return nil, roachpb.NewError(err)
	}

	dbDesc, pErr := p.getDatabaseDesc(tableQualifiedName.Database())
	if pErr != nil {
		return nil, pErr
	}

	tbKey := tableKey{dbDesc.ID, tableQualifiedName.Table()}
	nameKey := tbKey.Key()
	gr, pErr := p.txn.Get(nameKey)
	if pErr != nil {
		return nil, pErr
	}

	if !gr.Exists() {
		// Return nil descriptor. This might result in an error at a higher
		// level.
		return nil, nil
	}

	desc := &Descriptor{}
	descKey := MakeDescMetadataKey(ID(gr.ValueInt()))
	if pErr := p.txn.GetProto(descKey, desc); pErr != nil {
		return nil, pErr
	}
	tableDesc := desc.GetTable()
	if tableDesc == nil {
		return nil, roachpb.NewErrorf("%q is not a table", tbKey.Name())
	}
	if err := tableDesc.Validate(); err != nil {
		return nil, roachpb.NewError(err)
	}

	if err := p.checkPrivilege(tableDesc, privilege.DROP); err != nil {
		return nil, roachpb.NewError(err)
	}

	if _, pErr := p.Truncate(&parser.Truncate{Tables: names[index : index+1]}); pErr != nil {
		return nil, pErr
	}

	zoneKey := MakeZoneKey(tableDesc.ID)

	// Delete table descriptor
	b := &client.Batch{}
	b.Del(descKey)
	b.Del(nameKey)
	// Delete the zone config entry for this table.
	b.Del(zoneKey)

	p.setTestingVerifyMetadata(func(systemConfig config.SystemConfig) error {
		for _, key := range [...]roachpb.Key{descKey, nameKey, zoneKey} {
			if err := expectDeleted(systemConfig, key); err != nil {
				return err
			}
		}
		return nil
	})

	if pErr := p.txn.Run(b); pErr != nil {
		return nil, pErr
	}

	return tableDesc, nil
}


text:
using Newtonsoft.Json;

namespace ProcessingJSON.Models
{
    public class Link
    {
        [JsonProperty("@rel")]
        public string Rel { get; set; }

        [JsonProperty("@href")]
        public string Href { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
body{
	background-color: #4C5566;
}
.navbar-default, .navbar {
	background-color: #4C5566;
    border:none !important;
    background-image: none;
    filter: none;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a {
color: #EEE !important;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #FFF !important;
background-color: #c3c3c3;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a {
background-color: #c3c3c3;
color: #333 !important;
}
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus {
background-color: #c3c3c3;
}
.navbar-brand{
  font-family: "Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  color:#EEE !important;
}
#main{
    background-color: #EBEEF5;
    color: #717171;
    margin-top:50px;
}
#main section{
        padding-bottom:25px;
}
footer{
	background-color: #4C5566;
	color: #C4C9D3;
}
footer a {
color: #D3D7DE;
}
 a.backtotop:focus {
color: #FFF !important;
text-decoration:none;
}
.font-thin {
font-weight: 300;
}
form .font-thin {
	margin-top: 25px !important;
}
.m-xl {
margin-bottom: 50px;
margin-top: 50px;
}
.m-l {
margin-bottom: 15px;
margin-top: 25px;
}
hr{
	border-top: 1px solid #333;
}
label.list-group-item{
    font-weight:normal;
}
.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {

}
label.list-group-item:hover{
	background-color:#EBDAC2;
}
.list-group-item input{
    width:70px;
}
form h3 .badge{
border-radius: 30px;
font-size: 28px;
padding: 8px 15px;
}
.btn:active, .btn.active {
    background-color: #47A447;
    background-image: none;
    border-bottom-color: #398439;
    border-left-color: #398439;
    border-right-color: #398439;
    border-top-color: #398439;
    color: #FFFFFF;
    filter: none;
}
.active > .text-active {
display: inline-block !important;
}
.text-active, .active > .text {
display: none !important;
}
label {
font-weight: normal;
}
.red.badge {
    background-color: #af1e1e;
}
.sponsors{
    border-top:1px solid #AAA;
    border-bottom: 1px solid #000;
    padding:20px;
    text-align:center;
}
.sponsors img{
    height:50px;
}
.intro p{
    font-size:16px;
    text-align:justify;
}
.intro p.lettrine:first-letter {
    font-family: 'Great Vibes', cursive;
    font-size: 28px;
    line-height:28px;
    margin-right:  5px;
    float: left;
    color: #333;
    padding: 8px;
    text-shadow:1px 1px 0px #ffffff;
}
.ref{
    font-size:10px;
    text-align:justify;
}
.bannertop{
    background-color:#333;
    height:150px;
    overflow:hidden;
    text-align:center;
    margin:0;
    padding:0;
}


text:
<?php
namespace Masdevs\Passenger\Bridge;

use DateTime;
use Illuminate\Database\Connection;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;

class AccessTokenRepository implements AccessTokenRepositoryInterface
{
    use FormatsScopesForStorage;
    /**
     * The database connection.
     *
     * @var \Illuminate\Database\Connection
     */
    protected $database;
    /**
     * Create a new repository instance.
     *
     * @param  \Illuminate\Database\Connection  $database
     * @return void
     */
    public function __construct(Connection $database)
    {
        $this->database = $database;
    }
    /**
     * {@inheritdoc}
     */
    public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
    {
        return new AccessToken($userIdentifier, $scopes);
    }
    /**
     * {@inheritdoc}
     */
    public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
    {
        $this->database->table('oauth_access_tokens')->insert([
            'id' => $accessTokenEntity->getIdentifier(),
            'user_id' => $accessTokenEntity->getUserIdentifier(),
            'client_id' => $accessTokenEntity->getClient()->getIdentifier(),
            'scopes' => $this->formatScopesForStorage($accessTokenEntity->getScopes()),
            'revoked' => false,
            'created_at' => new DateTime,
            'updated_at' => new DateTime,
            'expires_at' => $accessTokenEntity->getExpiryDateTime(),
        ]);
    }
    /**
     * {@inheritdoc}
     */
    public function revokeAccessToken($tokenId)
    {
        $this->database->table('oauth_access_tokens')
                    ->where('id', $tokenId)->update(['revoked' => true]);
    }
    /**
     * {@inheritdoc}
     */
    public function isAccessTokenRevoked($tokenId)
    {
        return ! $this->database->table('oauth_access_tokens')
                    ->where('id', $tokenId)->where('revoked', 0)->exists();
    }
}


text:
package hei2017.controller;

import hei2017.service.ProjectService;
import hei2017.service.SprintService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by pic on 09/02/2017.
 */
@Controller
public class StoryController {

}


text:
using base::PlatformFile;
using base::PlatformFileError;
using base::PlatformFileInfo;

namespace fileapi {

NativeMediaFileUtil::NativeMediaFileUtil() {
}

PlatformFileError NativeMediaFileUtil::CreateOrOpen(
    FileSystemOperationContext* context,
    const FileSystemURL& url,
    int file_flags,
    PlatformFile* file_handle,
    bool* created) {
  // Only called by NaCl, which should not have access to media file systems.
  return base::PLATFORM_FILE_ERROR_SECURITY;
}

PlatformFileError NativeMediaFileUtil::EnsureFileExists(
    FileSystemOperationContext* context,
    const FileSystemURL& url, bool* created) {
  base::FilePath file_path;
  PlatformFileError error = GetFilteredLocalFilePath(context, url, &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  return NativeFileUtil::EnsureFileExists(file_path, created);
}

scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
NativeMediaFileUtil::CreateFileEnumerator(
    FileSystemOperationContext* context,
    const FileSystemURL& root_url) {
  DCHECK(context);
  return make_scoped_ptr(new FilteringFileEnumerator(
      IsolatedFileUtil::CreateFileEnumerator(context, root_url),
      context->media_path_filter()))
      .PassAs<FileSystemFileUtil::AbstractFileEnumerator>();
}

PlatformFileError NativeMediaFileUtil::Touch(
    FileSystemOperationContext* context,
    const FileSystemURL& url,
    const base::Time& last_access_time,
    const base::Time& last_modified_time) {
  base::FilePath file_path;
  PlatformFileError error = GetFilteredLocalFilePathForExistingFileOrDirectory(
      context,
      url,
      // Touch fails for non-existent paths and filtered paths.
      base::PLATFORM_FILE_ERROR_FAILED,
      &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  return NativeFileUtil::Touch(file_path, last_access_time, last_modified_time);
}

PlatformFileError NativeMediaFileUtil::Truncate(
    FileSystemOperationContext* context,
    const FileSystemURL& url,
    int64 length) {
  base::FilePath file_path;
  PlatformFileError error = GetFilteredLocalFilePathForExistingFileOrDirectory(
      context,
      url,
      // Cannot truncate paths that do not exist, or are filtered.
      base::PLATFORM_FILE_ERROR_NOT_FOUND,
      &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  return NativeFileUtil::Truncate(file_path, length);
}

PlatformFileError NativeMediaFileUtil::CopyOrMoveFile(
    FileSystemOperationContext* context,
    const FileSystemURL& src_url,
    const FileSystemURL& dest_url,
    bool copy) {
  base::FilePath src_file_path;
  PlatformFileError error =
      GetFilteredLocalFilePathForExistingFileOrDirectory(
          context, src_url,
          base::PLATFORM_FILE_ERROR_NOT_FOUND,
          &src_file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  if (NativeFileUtil::DirectoryExists(src_file_path))
    return base::PLATFORM_FILE_ERROR_NOT_A_FILE;

  base::FilePath dest_file_path;
  error = GetLocalFilePath(context, dest_url, &dest_file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  PlatformFileInfo file_info;
  error = NativeFileUtil::GetFileInfo(dest_file_path, &file_info);
  if (error != base::PLATFORM_FILE_OK &&
      error != base::PLATFORM_FILE_ERROR_NOT_FOUND)
    return error;
  if (error == base::PLATFORM_FILE_OK && file_info.is_directory)
    return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
  if (!context->media_path_filter()->Match(dest_file_path))
    return base::PLATFORM_FILE_ERROR_SECURITY;

  return NativeFileUtil::CopyOrMoveFile(src_file_path, dest_file_path, copy);
}

PlatformFileError NativeMediaFileUtil::CopyInForeignFile(
    FileSystemOperationContext* context,
    const base::FilePath& src_file_path,
    const FileSystemURL& dest_url) {
  if (src_file_path.empty())
    return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;

  base::FilePath dest_file_path;
  PlatformFileError error =
      GetFilteredLocalFilePath(context, dest_url, &dest_file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  return NativeFileUtil::CopyOrMoveFile(src_file_path, dest_file_path, true);
}

PlatformFileError NativeMediaFileUtil::DeleteFile(
    FileSystemOperationContext* context,
    const FileSystemURL& url) {
  base::FilePath file_path;
  PlatformFileError error = GetLocalFilePath(context, url, &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  PlatformFileInfo file_info;
  error = NativeFileUtil::GetFileInfo(file_path, &file_info);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  if (file_info.is_directory)
    return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
  if (!context->media_path_filter()->Match(file_path))
    return base::PLATFORM_FILE_ERROR_NOT_FOUND;
  return NativeFileUtil::DeleteFile(file_path);
}

PlatformFileError NativeMediaFileUtil::GetFileInfo(
    FileSystemOperationContext* context,
    const FileSystemURL& url,
    PlatformFileInfo* file_info,
    base::FilePath* platform_path) {
  DCHECK(context);
  DCHECK(context->media_path_filter());
  DCHECK(file_info);
  DCHECK(platform_path);

  base::PlatformFileError error =
      IsolatedFileUtil::GetFileInfo(context, url, file_info, platform_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;

  if (file_info->is_directory ||
      context->media_path_filter()->Match(*platform_path)) {
    return base::PLATFORM_FILE_OK;
  }
  return base::PLATFORM_FILE_ERROR_NOT_FOUND;
}

PlatformFileError NativeMediaFileUtil::GetFilteredLocalFilePath(
    FileSystemOperationContext* context,
    const FileSystemURL& file_system_url,
    base::FilePath* local_file_path) {
  base::FilePath file_path;
  PlatformFileError error =
      IsolatedFileUtil::GetLocalFilePath(context, file_system_url, &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;
  if (!context->media_path_filter()->Match(file_path))
    return base::PLATFORM_FILE_ERROR_SECURITY;

  *local_file_path = file_path;
  return base::PLATFORM_FILE_OK;
}

PlatformFileError
NativeMediaFileUtil::GetFilteredLocalFilePathForExistingFileOrDirectory(
    FileSystemOperationContext* context,
    const FileSystemURL& file_system_url,
    PlatformFileError failure_error,
    base::FilePath* local_file_path) {
  base::FilePath file_path;
  PlatformFileError error =
      GetLocalFilePath(context, file_system_url, &file_path);
  if (error != base::PLATFORM_FILE_OK)
    return error;

  if (!file_util::PathExists(file_path))
    return failure_error;
  PlatformFileInfo file_info;
  if (!file_util::GetFileInfo(file_path, &file_info))
    return base::PLATFORM_FILE_ERROR_FAILED;

  if (!file_info.is_directory &&
      !context->media_path_filter()->Match(file_path)) {
    return failure_error;
  }

  *local_file_path = file_path;
  return base::PLATFORM_FILE_OK;
}

}  // namespace fileapi


text:
import * as React from 'react';
import { DialogProps } from '../dialog/Dialog.d.ts';

interface ConfirmDialogProps extends DialogProps {
    visible?: boolean;
    message?: any;
    rejectLabel?: string;
    acceptLabel?: string;
    icon?: string;
    rejectIcon?: string;
    acceptIcon?: string;
    rejectClassName?: string;
    acceptClassName?: string;
    appendTo?: any;
    className?: string;
    footer?: any;
    breakpoints?: {[key: string]: string};
    onHide?(result: string): void;
    accept?(): void;
    reject?(): void;
}

export class ConfirmDialog extends React.Component<ConfirmDialogProps,any> {}

export function confirmDialog(props: ConfirmDialogProps):any;


text:
package BuffsBoolean;

/**
 * Created by Michael on 5/22/2016.
 */
public class StunnedDebuff extends BooleanBuffList
{
    public StunnedDebuff(String name)
    {
        super(name);
    }

    public boolean isInEffect()
    {
        return size() > 0;
    }

    public String toString()
    {
        return " has been Stunned";
    }

    public String description()
    {
        return "stun";
    }
}


text:
> Babel preset for stage 3 plugins.

## Install

```sh
npm install --save-dev babel-preset-stage-3
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "presets": ["stage-3"]
}
```

### Via CLI

```sh
babel script.js --presets stage-3
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  presets: ["stage-3"]
});
```


text:
module Challenges.Challenge6 where

--import Lib (breakCipherRepeatingXOR, fromBase64, alreadyEncoded)
import System.Environment
import Data.Maybe
import System.Exit
import System.IO (IOMode(ReadMode), openFile, Handle, hIsEOF)
import qualified Data.ByteString as BS
import Control.Monad
import Data.Char
import Data.Word

secondArg :: [String] -> Maybe String
secondArg (_:fp:_) = Just fp
secondArg _        = Nothing

removeLines :: BS.ByteString -> BS.ByteString
removeLines = BS.filter nonWSDelim
  where newLineByte = fromIntegral $ ord '\n'
        cReturn    = fromIntegral $ ord '\r'
        nonWSDelim x = x /= newLineByte && x /= cReturn

output :: [BS.ByteString] -> IO ()
output = mapM_ (\x -> putStrLn $ "Decoded:\n-------\n" ++ show x)

challenge6 :: IO ()
challenge6 = return ()--do
  -- mbArg <- secondArg <$> getArgs
  -- when (isNothing mbArg) $ do
  --   putStrLn "No second argument supplied. Need filepath"
  --   exitSuccess
  -- openFile (fromJust mbArg) ReadMode >>=
  --   BS.hGetContents                  >>=
  --     \x ->
  --       (output . breakCipherRepeatingXOR)
  --         (fromBase64 . alreadyEncoded $ removeLines x)


text:
.. change::
    :tags: usecase, postgresql
    :tickets: 4914

    The maximum buffer size for the :class:`.BufferedRowResultProxy`, which
    is used by dialects such as PostgreSQL when ``stream_results=True``, can
    now be set to a number greater than 1000 and the buffer will grow to
    that size.  Previously, the buffer would not go beyond 1000 even if the
    value were set larger.   The growth of the buffer is also now based
    on a simple multiplying factor currently set to 5.  Pull request courtesy
    Soumaya Mauthoor.


text:
module Azure::ServiceFabric::V6_5_0_36
  module Models
    #
    # Describes a Chaos event that gets generated when Chaos has decided on the
    # faults for an iteration. This Chaos event contains the details of the
    # faults as a list of strings.
    #
    class ExecutingFaultsChaosEvent < ChaosEvent

      include MsRestAzure

      def initialize
        @Kind = "ExecutingFaults"
      end

      attr_accessor :Kind

      # @return [Array<String>] List of string description of the faults that
      # Chaos decided to execute in an iteration.
      attr_accessor :faults

      #
      # Mapper for ExecutingFaultsChaosEvent class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ExecutingFaults',
          type: {
            name: 'Composite',
            class_name: 'ExecutingFaultsChaosEvent',
            model_properties: {
              time_stamp_utc: {
                client_side_validation: true,
                required: true,
                serialized_name: 'TimeStampUtc',
                type: {
                  name: 'DateTime'
                }
              },
              Kind: {
                client_side_validation: true,
                required: true,
                serialized_name: 'Kind',
                type: {
                  name: 'String'
                }
              },
              faults: {
                client_side_validation: true,
                required: false,
                serialized_name: 'Faults',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
module JekyllAdmin
  class Server < Sinatra::Base
    namespace "/collections" do
      get do
        json(site.collections.map { |c| c[1].to_api })
      end

      get "/:collection_id" do
        ensure_collection
        json collection.to_api
      end

      get "/:collection_id/*?/?:path.:ext" do
        ensure_requested_file
        json requested_file.to_api(:include_content => true)
      end

      get "/:collection_id/entries/?*" do
        ensure_directory
        json entries.map(&:to_api)
      end

      put "/:collection_id/*?/?:path.:ext" do
        ensure_collection

        if new?
          ensure_not_overwriting_existing_file
        elsif renamed?
          ensure_requested_file
          ensure_not_overwriting_existing_file
          delete_file_without_process path
        end

        write_file write_path, document_body
        json written_file.to_api(:include_content => true)
      end

      delete "/:collection_id/*?/?:path.:ext" do
        ensure_requested_file
        delete_file path
        content_type :json
        status 200
        halt
      end

      private

      def collection
        collection = site.collections.find { |l, _c| l == params["collection_id"] }
        collection[1] if collection
      end

      def document_id
        path = "#{params["splat"].first}/#{filename}"
        path.gsub(%r!(\d{4})/(\d{2})/(\d{2})/(.*)!, '\1-\2-\3-\4')
      end

      def directory_docs
        collection.docs.find_all { |d| File.dirname(d.path) == directory_path }
      end

      def ensure_collection
        render_404 if collection.nil?
      end

      def ensure_directory
        ensure_collection
        render_404 unless Dir.exist?(directory_path)
      end

      def entries
        collections_dir = site.config["collections_dir"]
        collection_id, splats = params.values_at("collection_id", "splat")
        args = {
          :base         => site.in_source_dir(collections_dir, "_#{collection_id}"),
          :content_type => collection_id,
          :splat        => splats&.first,
        }
        # get the directories inside the requested directory
        directory = JekyllAdmin::Directory.new(directory_path, **args)
        directories = directory.directories
        # merge directories with the documents at the same level
        directories.concat(directory_docs.sort_by(&:date).reverse)
      end
    end
  end
end


text:
package software.amazon.awssdk.codegen.jmespath.component;

/**
 * A comparator expression is two expressions separated by a {@link Comparator}.
 *
 * Examples:
 *

 *
Foo == Bar

 *
Bar <= `101

 *

 */
public class ComparatorExpression {
    private final Expression leftExpression;
    private final Comparator comparator;
    private final Expression rightExpression;

    public ComparatorExpression(Expression leftExpression, Comparator comparator, Expression rightExpression) {
        this.leftExpression = leftExpression;
        this.comparator = comparator;
        this.rightExpression = rightExpression;
    }

    public Expression leftExpression() {
        return leftExpression;
    }

    public Comparator comparator() {
        return comparator;
    }

    public Expression rightExpression() {
        return rightExpression;
    }
}


text:
title: Node Release Notes
category: node
authors: fabiand, mburns, nkesick
wiki_category: Node
wiki_title: Node Release Notes
wiki_revision_count: 17
wiki_last_updated: 2013-11-19
---

# Node Release Notes

## 3.0.2 Release Notes

*   Bug fixes
    -   Fixes to let gluster work oob
    -   Fix link detection with some NICs
    -   Add some module dependencies
    -   Better debugging informations

## 3.0.1 Release Notes

*   Several bug fixes

## **3.0.0 Release Notes**

*   For an detailed overview take a look at the [Node 3.0 release-management](Node 3.0 release-management) page
*   Universal Image - Remove VDSM specific bits to make the image more general (an VDSM image is still provided)
*   Improved upgrade tool
*   Software iSCSI root
*   Puppet configuration management
*   Bridegeless Networking
*   NIC Bonds
*   New installer TUI
*   IPv6 support in the setup TUI
*   Diagnostics page in the setup TUI
*   Images for Fedora 19 and EL6

## 2.6.1 Release Notes

*   Fix for [CVE-2013-0293](https://bugzilla.redhat.com/show_bug.cgi?id=911699)
*   Updated vdsm and latest Fedora 18 packages

## 2.6.0 Release Notes

*   Move to Fedora 18 base
*   Add new Setup UI (based on python-urwid)
*   glusterfs client support added
*   Full Plugin enablement
*   various other enhancements and bug fixes

## 2.5.5 Release Notes

*   include dns_resolver kmod to fix nfs mounting issues

## 2.5.4 Release Notes

*   Fix selinux booleans related to sanlock

## 2.5.3 Release Notes

*   Include /bin/hostname command

## 2.5.2 Release Notes

*   This build includes the fixed vdsm to allow nfs

based domains to be attached.

## 2.5.1 Release Notes

*   Refactoring for pep8 compliance
*   Various bug fixes for oVirt 3.1 support
*   TECH PREVIEW: Plugin Support

### Known issues for 2.4.0

*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.4.0 Release Notes

*   Move to F17 Base
*   Various spec file cleanups
*   fix some issues around networking
*   Various bugs related to F17 transition

### Known issues for 2.4.0

*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.3.0 Release Notes

*   Migrate to systemd for fedora based images
*   Add support for detecting and cleaning fakeraid devices
*   Add libvirt-cim/sblim-sfcb support to ovirt-node
*   Various stateless fixes
*   Various Small TUI fixes
*   Add keyboard selection support
*   Add ovirt-node-iso rpm

### Known Issues for 2.3.0

*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.2.3 Release Notes

*   Add kickstarts for F18
*   Configuring networking even if autoinstall fails
*   Small build enhancements
*   Added archipel configuration
*   Limited stateless support introduced

### Known Issues for 2.2.3

*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.2.2 Release Notes

*   UEFI installation should be fixed [Bug 761540](https://bugzilla.redhat.com/show_bug.cgi?id=761540)
*   Spec file cleanup
*   Build process enhancements
*   Automatically log out sessions that are idle for 15 minutes
*   Validate iscsi iqn name
*   Persist Manually added dns entries when using DHCP
*   Fix display of bootproto when using vlans

### Known Issues for 2.2.2

*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.2.1 Release Notes

*   UEFI installation does not work with internal drives, only usb drives [Bug 761540](https://bugzilla.redhat.com/show_bug.cgi?id=761540)
*   Registration directly from ovirt-node will fail [Bug 782663](https://bugzilla.redhat.com/show_bug.cgi?id=782663)
*   Adding oVirt Node through the engine interface will fail [Bug 782660](https://bugzilla.redhat.com/show_bug.cgi?id=782660)
    -   There is a workaround available in this [patch](http://gerrit.ovirt.org/#change,1117)
    -   Needs to be applied on the ovirt-engine server to vds_installer.py in /usr/share/ovirt-engine/scripts/
*   Some hardware seems to fail to boot the Node correctly
    -   Fails to load the TUI when booting the first time
    -   Seen on IBM x3650 Servers
    -   Cannot reproduce on desktop hardware or virtual machines
*   See Current Backlog for other issues [Node_Backlog](Node_Backlog)

## 2.2.0 Release Notes

*   Registration with oVirt Engine is non-functional due to vdsm bugs
    -   [Bug 752464](https://bugzilla.redhat.com/show_bug.cgi?id=752464)
*   This release is intended to be used for testing installation


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycologia 100: 410 (2008)

#### Original name
Lecania leprosa Reese Naesb. & Vondrák

### Remarks
null


text:
package git4idea.roots;

import javax.annotation.Nonnull;
import consulo.logging.Logger;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.roots.VcsIntegrationEnabler;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;

public class GitIntegrationEnabler extends VcsIntegrationEnabler<GitVcs>
{

	private final
	@Nonnull
	Git myGit;

	private static final Logger LOG = Logger.getInstance(GitIntegrationEnabler.class);

	public GitIntegrationEnabler(@Nonnull GitVcs vcs, @Nonnull Git git)
	{
		super(vcs);
		myGit = git;
	}

	@Override
	protected boolean initOrNotifyError(@Nonnull final VirtualFile projectDir)
	{
		VcsNotifier vcsNotifier = VcsNotifier.getInstance(myProject);
		GitCommandResult result = myGit.init(myProject, projectDir);
		if(result.success())
		{
			refreshVcsDir(projectDir, GitUtil.DOT_GIT);
			vcsNotifier.notifySuccess("Created Git repository in " + projectDir.getPresentableUrl());
			return true;
		}
		else
		{
			if(myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded())
			{
				vcsNotifier.notifyError("Couldn't git init " + projectDir.getPresentableUrl(), result.getErrorOutputAsHtmlString());
				LOG.info(result.getErrorOutputAsHtmlString());
			}
			return false;
		}
	}

}


text:
/**
 * Functions for parsing an XML object converted to JSON.
 */

/*
  Style and locale JSON should be formatted as follows. Note that
  an empty literal should be set as an explicit empty strings within
  children:[]

  {
    name:"term",
    children:[
      ""
    ],
    attrs:{
      name:"author"
    }
  }

  The following script will generate correctly formatted JSON
  from a CSL style or locale file:

#!/usr/bin/python
''' Make me a module
'''

from xml.dom import minidom
import json,re

class jsonwalker:

    def __init__(self):
        pass

    def makedoc(self,xmlstring):
        #xmlstring = re.sub("(?ms)^<\?[^>]*\?>","",xmlstring);
        dom = minidom.parseString(xmlstring)
        return dom.documentElement

    def walktojson(self, elem):
        obj = {}
        obj["name"] = elem.nodeName
        obj["attrs"] = {}
        if elem.attributes:
            for key in elem.attributes.keys():
                obj["attrs"][key] = elem.attributes[key].value
        obj["children"] = []
        if len(elem.childNodes) == 0 and elem.nodeName == "term":
            obj["children"] = [""]
        for child in elem.childNodes:
            if child.nodeName == "#comment":
                pass
            elif child.nodeName == "#text":
                if len(elem.childNodes) == 1 and elem.nodeName in ["term","single","multiple"]:
                    obj["children"].append(child.wholeText)
            else:
                obj["children"].append(self.walktojson(child))
        return obj

if __name__ == "__main__":

    import sys
    w = jsonwalker()
    doc = w.makedoc(open(sys.argv[1]).read())
    obj = w.walktojson(doc)
    print json.dumps(obj,indent=2)

*/

// Don't clobber an existing value if this has already been declared.
if ("undefined" === typeof CSL_IS_IE) {
    var CSL_IS_IE;
};

var CSL_JSON = function () {
    this.institution = {
        name:"institution",
        attrs:{
            "institution-parts":"long",
            "delimiter":", ",
            "substitute-use-first":"1",
            "use-last":"1"
        },
        children:[
            {
                name:"institution-part",
                attrs:{
                    name:"long"
                },
                children:[]
            }
        ]
    };
};

/**
 * No need for cleaning with native JSON.
 */
CSL_JSON.prototype.clean = function (json) {
    return json;
};

/**
 * Methods to call on a node.
 */
CSL_JSON.prototype.getStyleId = function (myjson, styleName) {
    var tagName = 'id';
    if (styleName) {
        tagName = 'title';
    }
    return myjson.attrs[tagName];
};

CSL_JSON.prototype.children = function (myjson) {
    //print("children()");
    if (myjson && myjson.children.length) {
        return myjson.children.slice();
    } else {
        return false;
    }
};

CSL_JSON.prototype.nodename = function (myjson) {
    //print("nodename()");
    return myjson.name;
};

CSL_JSON.prototype.attributes = function (myjson) {
    //print("attributes()");
    var ret = {};
    for (var attrname in myjson.attrs) {
        ret["@"+attrname] = myjson.attrs[attrname];
    }
    return ret;
};

CSL_JSON.prototype.content = function (myjson) {
    //print("content()");
    // xmldom.js and xmle4x.js have "undefined" as default
    var ret = "";
    // This only catches content at first level, but that is good enough
    // for us.
    if (!myjson || !myjson.children) {
        return ret;
    }
    for (var i=0, ilen=myjson.children.length; i < ilen; i += 1) {
        if ("string" === typeof myjson.children[i]) {
            ret += myjson.children[i];
        }
    }
    return ret;
};

CSL_JSON.prototype.namespace = {}

CSL_JSON.prototype.numberofnodes = function (myjson) {
    //print("numberofnodes()");
    if (myjson && "number" == typeof myjson.length) {
        return myjson.length;
    } else {
        return 0;
    }
};

// getAttributeName() removed. Looks like it was not being used.

CSL_JSON.prototype.getAttributeValue = function (myjson,name,namespace) {
    //print("getAttributeValue()");
    var ret = "";
    if (namespace) {
        name = namespace+":"+name;
    }
    if (myjson) {
        if (myjson.attrs) {
            if (myjson.attrs[name]) {
                ret = myjson.attrs[name];
            } else {
                ret = "";
            }
        }
    }
    return ret;
}

CSL_JSON.prototype.getNodeValue = function (myjson,name) {
    //print("getNodeValue()");
    var ret = "";
    if (name){
        for (var i=0, ilen=myjson.children.length; i < ilen; i += 1) {
            if (myjson.children[i].name === name) {
                // This will always be Object() unless empty
                if (myjson.children[i].children.length) {
                    ret = myjson.children[i];
                } else {
                    ret = "";
                }
            }
        }
    } else if (myjson) {
        ret = myjson;
    }
    // Just being careful here, following the former DOM code. The JSON object we receive
    // for this should be fully normalized.
    if (ret && ret.children && ret.children.length == 1 && "string" === typeof ret.children[0]) {
        ret = ret.children[0];
    }
    return ret;
}

CSL_JSON.prototype.setAttributeOnNodeIdentifiedByNameAttribute = function (myjson,nodename,partname,attrname,val) {
    //print("setAttributeOnNodeIdentifiedByNameAttribute()");
    var pos, len, xml, nodes, node;
    if (attrname.slice(0,1) === '@'){
        attrname = attrname.slice(1);
    }
    // In the one place this is used in citeproc-js code, it doesn't need to recurse.
    for (var i=0,ilen=myjson.children.length; i<ilen; i += 1) {
        if (myjson.children[i].name === nodename && myjson.children[i].attrs.name === partname) {
            myjson.children[i].attrs[attrname] = val;
        }
    }
}

CSL_JSON.prototype.deleteNodeByNameAttribute = function (myjson,val) {
    //print("deleteNodeByNameAttribute()");
    var i, ilen;
    for (i = 0, ilen = myjson.children.length; i < ilen; i += 1) {
        if (!myjson.children[i] || "string" === typeof myjson.children[i]) {
            continue;
        }
        if (myjson.children[i].attrs.name == val) {
            myjson.children = myjson.children.slice(0,i).concat(myjson.children.slice(i+1));
        }
    }
}

CSL_JSON.prototype.deleteAttribute = function (myjson,attrname) {
    //print("deleteAttribute()");
    var i, ilen;
    if ("undefined" !== typeof myjson.attrs[attrname]) {
        myjson.attrs.pop(attrname);
    }
}

CSL_JSON.prototype.setAttribute = function (myjson,attr,val) {
    //print("setAttribute()");
    myjson.attrs[attr] = val;
    return false;
}

CSL_JSON.prototype.nodeCopy = function (myjson,clone) {
    //print("nodeCopy()");
    if (!clone) {
        var clone = {};
    }
    if ("object" === typeof clone && "undefined" === typeof clone.length) {
        // myjson is an object
        for (var key in myjson) {
            if ("string" === typeof myjson[key]) {
                clone[key] = myjson[key];
            } else if ("object" === typeof myjson[key]) {
                if ("undefined" === typeof myjson[key].length) {
                    clone[key] = this.nodeCopy(myjson[key],{});
                } else {
                    clone[key] = this.nodeCopy(myjson[key],[]);
                }
            }
        }
    } else {
        // myjson is an array
        for (var i=0,ilen=myjson.length;i<ilen; i += 1) {
            if ("string" === typeof myjson[i]) {
                clone[i] = myjson[i];
            } else {
                // If it's at the first level of an array, it's an object.
                clone[i] = this.nodeCopy(myjson[i],{});
            }
        }
    }
    return clone;
}

CSL_JSON.prototype.getNodesByName = function (myjson,name,nameattrval,ret) {
    //print("getNodesByName()");
    var nodes, node, pos, len;
    if (!ret) {
        var ret = [];
    }
    if (!myjson || !myjson.children) {
        return ret;
    }
    if (name === myjson.name) {
        if (nameattrval) {
            if (nameattrval === myjson.attrs.name) {
                ret.push(myjson);
            }
        } else {
            ret.push(myjson);
        }
    }
    for (var i=0,ilen=myjson.children.length;i<ilen;i+=1){
        if ("object" !== typeof myjson.children[i]) {
            continue;
        }
        this.getNodesByName(myjson.children[i],name,nameattrval,ret);
    }
    return ret;
}

CSL_JSON.prototype.nodeNameIs = function (myjson,name) {
    //print("nodeNameIs()");
    if (name == myjson.name) {
        return true;
    }
    return false;
}

CSL_JSON.prototype.makeXml = function (myjson) {
    //print("makeXml()");
    return myjson;
};

CSL_JSON.prototype.insertChildNodeAfter = function (parent,node,pos,datejson) {
    //print("insertChildNodeAfter()");
    // Function is misnamed: this replaces the node
    for (var i=0,ilen=parent.children.length;i<ilen;i+=1) {
        if (node === parent.children[i]) {
            parent.children = parent.children.slice(0,i).concat([datejson]).concat(parent.children.slice(i+1));
            break;
        }
    }
    return parent;
};

CSL_JSON.prototype.insertPublisherAndPlace = function(myjson) {
    if (myjson.name === "group") {
        var useme = true;
        var mustHaves = ["publisher","publisher-place"];
        for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
            var haveVarname = mustHaves.indexOf(myjson.children[i].attrs.variable);
            var isText = myjson.children[i].name === "text";
            if (isText && haveVarname > -1 && !myjson.children[i].attrs.prefix && !myjson.children[i].attrs.suffix) {
                mustHaves = mustHaves.slice(0,haveVarname).concat(mustHaves.slice(haveVarname+1));
            } else {
                useme = false;
                break;
            }
        }
        if (useme && !mustHaves.length) {
            myjson.attrs["has-publisher-and-publisher-place"] = true;
       }
    }
    for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
        if ("object" === typeof myjson.children[i]) {
            this.insertPublisherAndPlace(myjson.children[i]);
        }
    }
}
/*
CSL_JSON.prototype.insertPublisherAndPlace = function(myxml) {
    var group = myxml.getElementsByTagName("group");
    for (var i = 0, ilen = group.length; i < ilen; i += 1) {
        var node = group.item(i);
        var skippers = [];
        for (var j = 0, jlen = node.childNodes.length; j < jlen; j += 1) {
            if (node.childNodes.item(j).nodeType !== 1) {
                skippers.push(j);
            }
        }
        if (node.childNodes.length - skippers.length === 2) {
            var twovars = [];
            for (var j = 0, jlen = 2; j < jlen; j += 1) {
                if (skippers.indexOf(j) > -1) {
                    continue;
                }
                var child = node.childNodes.item(j);
                var subskippers = [];
                for (var k = 0, klen = child.childNodes.length; k < klen; k += 1) {
                    if (child.childNodes.item(k).nodeType !== 1) {
                        subskippers.push(k);
                    }
                }
                if (child.childNodes.length - subskippers.length === 0) {
                    twovars.push(child.getAttribute('variable'));
                    if (child.getAttribute('suffix')
                        || child.getAttribute('prefix')) {
                        twovars = [];
                        break;
                    }
                }
            }
            if (twovars.indexOf("publisher") > -1 && twovars.indexOf("publisher-place") > -1) {
                node.setAttribute('has-publisher-and-publisher-place', true);
            }
        }
    }
};
*/

CSL_JSON.prototype.addMissingNameNodes = function(myjson,parentname) {
    //print("addMissingNameNodes()");
    if (myjson.name === "names") {
        if (myjson.children.length === 0 && "substitute" !== parentname) {
             myjson.children.push({name:"name",attrs:{},children:[]})
        }
    }
    for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
        if ("object" === typeof myjson.children[i]) {
            this.addMissingNameNodes(myjson.children[i],myjson.name);
        }
    }
}

CSL_JSON.prototype.addInstitutionNodes = function(myjson) {
    //print("addInstitutionNodes()");
    var names, thenames, institution, theinstitution, name, thename, xml, pos, len;
    // The idea here is to map relevant attributes from name and nampart=family
    // to the "long" institution-part node, when and only when forcing insert
    // of the default node.
    if (myjson.name === "names") {
        // do stuff
        var attributes = {};
        var insertPos = -1;
        for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
            if (myjson.children[i].name == "name") {
                for (var key in myjson.children[i].attrs) {
                    attributes[key] = myjson.children[i].attrs[key];
                }
                attributes.delimiter = myjson.children[i].attrs.delimiter;
                attributes.and = myjson.children[i].attrs.and;
                insertPos = i;
                for (var k=0,klen=myjson.children[i].children.length;k<klen;k+=1) {
                    if (myjson.children[i].children[k].attrs.name !== 'family') {
                        continue;
                    }
                    for (var key in myjson.children[i].children[k].attrs) {
                        attributes[key] = myjson.children[i].children[k].attrs[key];
                    }
                }
            }
            if (myjson.children[i].name == "institution") {
                insertPos = -1;
                break;
            }
        }
        if (insertPos > -1) {
            var institution = this.nodeCopy(this.institution);
            for (var i=0,ilen = CSL.INSTITUTION_KEYS.length;i<ilen;i+=1) {
                var attrname = CSL.INSTITUTION_KEYS[i];
                if ("undefined" !== typeof attributes[attrname]) {
                    institution.children[0].attrs[attrname] = attributes[attrname];
                }
                if (attributes.delimiter) {
                    institution.attrs.delimiter = attributes.delimiter;
                }
                if (attributes.and) {
                    institution.attrs.and = "text";
                }
            }
            myjson.children = myjson.children.slice(0,insertPos+1).concat([institution]).concat(myjson.children.slice(insertPos+1));
        }
    }
    for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
        if ("string" === typeof myjson.children[i]) {
            continue;
        }
        // Recurse
        this.addInstitutionNodes(myjson.children[i]);
    }
}
CSL_JSON.prototype.flagDateMacros = function(myjson) {
    //print("flagDateMacros()");
    for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
        if (myjson.children[i].name === "macro") {
            if (this.inspectDateMacros(myjson.children[i])) {
                myjson.children[i].attrs["macro-has-date"] = "true";
            }
        }
    }
}
CSL_JSON.prototype.inspectDateMacros = function(myjson) {
    //print("inspectDateMacros()");
    if (!myjson || !myjson.children) {
        return false;
    }
    if (myjson.name === "date") {
        return true;
    } else {
        for (var i=0,ilen=myjson.children.length;i<ilen;i+=1) {
            if (this.inspectDateMacros(myjson.children[i])) {
                return true;
            }
        }
    }
    return false;
}


text:
package be.fgov.caamihziv.services.quickmon.domain.samplers.x509;

import be.fgov.caamihziv.services.quickmon.domain.samplers.Sampler;
import be.fgov.caamihziv.services.quickmon.domain.samplers.SamplerBuilder;
import be.fgov.caamihziv.services.quickmon.domain.samplers.http.HttpSamplerBuilder;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.net.ssl.*;
import java.io.IOException;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

/**
 * Created by gs on 07.07.17.
 */
public class X509Sampler implements Sampler<X509CertificateDTO> {

    private String url;
    private int timeout;

    public X509Sampler(X509SamplerBuilder builder) {
        url = builder.getUrl();
        this.timeout = builder.getTimeout();
    }

    @Override
    public X509CertificateDTO sample() {
        HttpsURLConnection conn = null;
        try {
            SSLContext sslc = SSLContext.getInstance("TLS");

            TrustManager[] trustManagerArray = { new X509TrustManager() {
                @Override
                public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
                }

                @Override
                public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
                }

                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }
            } };

            sslc.init(null, trustManagerArray, null);

            HttpsURLConnection.setDefaultSSLSocketFactory(sslc.getSocketFactory());

            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                public boolean verify(String hostname, SSLSession session) {
                    return true;
                }
            });

            URL url = new URL(this.url);
            conn = (HttpsURLConnection) url.openConnection();

            conn.connect();

            X509Certificate cert = (X509Certificate) conn.getServerCertificates()[0];

            return new X509CertificateDTO(cert);
        } catch (Exception e) {
            throw new IllegalStateException("Unable to retrieve certificate", e);
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
    }

    @Override
    public SamplerBuilder toBuilder() {
        return new X509SamplerBuilder()
                .url(url)
                .timeout(timeout);
    }

    @Override
    public String getType() {
        return "x509";
    }

}


text:
package me.lennartVH01.itemfinder.nms;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;

import me.lennartVH01.itemfinder.Config;
import me.lennartVH01.itemfinder.ItemFinder;
import net.minecraft.server.v1_12_R1.EntityMagmaCube;
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_12_R1.PacketPlayOutMount;
import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving;

import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;

public class BlockMarker {
	private final ItemFinder plugin;
	private final HashMap<UUID, MarkedTask> playerMap = new HashMap<UUID, MarkedTask>();

	public BlockMarker(ItemFinder plugin){
		this.plugin = plugin;
	}
	public void markObjects(final org.bukkit.entity.Player p, final List<Location> blocks, final List<org.bukkit.entity.Entity> entities){
		final int[] cubeIds = new int[blocks.size()+entities.size()];

		//Mark Blocks
		for(int i = 0; i < blocks.size(); i++){
			EntityMagmaCube cube = createMarkerAt((CraftPlayer) p, blocks.get(i).getX() + 0.5, blocks.get(i).getY() + 0.25, blocks.get(i).getZ() + 0.5);
			cubeIds[i] = cube.getId();
			sendSpawnEntityPacket(p, cube);
		}

		//Mark Entities
		if(entities.size() > 0){
			try{
				Field vehicleField = PacketPlayOutMount.class.getDeclaredField("a");
				vehicleField.setAccessible(true);

				Field passengerField = PacketPlayOutMount.class.getDeclaredField("b");
				passengerField.setAccessible(true);

				for(int i = 0; i < entities.size(); i++){
					org.bukkit.entity.Entity e = entities.get(i);

					EntityMagmaCube cube = createMarkerAt((CraftPlayer) p, e.getLocation().getX(), e.getLocation().getY(), e.getLocation().getZ());

					sendSpawnEntityPacket(p, cube);

					cubeIds[i+blocks.size()] = cube.getId();
					PacketPlayOutMount mountPacket = new PacketPlayOutMount();

					// Keep current passengers
					int[] passengers = new int[e.getPassengers().size() + 1];
					for(int j = 0; j < e.getPassengers().size(); j++)
						passengers[j] = e.getPassengers().get(j).getEntityId();

					// Add cube to passenger list
					passengers[e.getPassengers().size()] = cube.getId();

					// bottom entity, in this case, whatever minecart/armorstand is wanted for marking
					vehicleField.setInt(mountPacket, e.getEntityId());

					// Add passenger list
					passengerField.set(mountPacket, passengers);

					((CraftPlayer) p).getHandle().playerConnection.sendPacket(mountPacket);
				}

				vehicleField.setAccessible(false);
				passengerField.setAccessible(false);

			} catch (Exception e1) {
				plugin.getLogger().log(Level.WARNING, "ERROR: Cannot edit field in PacketPlayOutMount. Please contact the developer and send them this log");
				e1.printStackTrace();
			}
		}

		//Regiser Kill everything task
		int taskId = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
			@Override public void run() {
				playerMap.remove(p.getUniqueId());
				if(p != null && p.isOnline()){
					removeEntitys(p, cubeIds);
				}
			}
		}, Config.MARKER_TIMEOUT);
		playerMap.put(p.getUniqueId(), new MarkedTask(taskId, cubeIds));
	}

	public void removeMarkersFromPlayer(Player p){
		if(playerMap.containsKey(p.getUniqueId())){
			MarkedTask t = playerMap.get(p.getUniqueId());
			t.cancelTask();

			removeEntitys(p, t.ids);
		}
	}

	public void onPlayerLeave(UUID player){
		playerMap.remove(player).cancelTask();
	}

	public void onDisable(){
		for(Map.Entry<UUID, MarkedTask> playerEntry:playerMap.entrySet()){
			playerEntry.getValue().cancelTask();

			removeEntitys(plugin.getServer().getPlayer(playerEntry.getKey()), playerEntry.getValue().ids);
		}
	}

	private static void removeEntitys(Player p, int[] ids){
		//remove cubes
		((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(ids));
	}

	private static EntityMagmaCube createMarkerAt(CraftPlayer player, double x, double y, double z){
		EntityMagmaCube cube = new EntityMagmaCube(((CraftWorld) player.getWorld()).getHandle());

		cube.setLocation(x, y, z, 0, 0);

		cube.setFlag(5, true);//invisible
		cube.setFlag(6, true);//glowing

		return cube;
	}

	private static void sendSpawnEntityPacket(org.bukkit.entity.Player player, EntityMagmaCube cube){
		((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(cube));
	}

	private class MarkedTask{
		public int taskId;
		public int[] ids;
		public MarkedTask(int taskId, int[] ids){
			this.taskId = taskId;
			this.ids = ids;
		}
		public void cancelTask(){
			plugin.getServer().getScheduler().cancelTask(taskId);
		}
	}
}


text:
package com.matt.forgehax.mods;

import static com.matt.forgehax.Helper.getRidingOrPlayer;

import com.matt.forgehax.events.LocalPlayerUpdateEvent;
import com.matt.forgehax.util.mod.Category;
import com.matt.forgehax.util.mod.ToggleMod;
import com.matt.forgehax.util.mod.loader.RegisterMod;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@RegisterMod
public class NoclipMod extends ToggleMod {

  public NoclipMod() {
    super(Category.PLAYER, "Noclip", false, "Enables player noclip");
  }

  @Override
  public void onDisabled() {
    Entity local = getRidingOrPlayer();
    if (local != null) {
      local.noClip = false;
    }
  }

  @SubscribeEvent
  public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) {
    Entity local = getRidingOrPlayer();
    local.noClip = true;
    local.onGround = false;
    local.fallDistance = 0;
  }
}


text:
from django.db import models
from django.utils.translation import ugettext_lazy as _

from projects.models import Project

LEVEL_CHOICES = (
    ('v1-org-5', '$5/mo'),
    ('v1-org-10', '$10/mo'),
    ('v1-org-15', '$15/mo'),
    ('v1-org-20', '$20/mo'),
    ('v1-org-50', '$50/mo'),
    ('v1-org-100', '$100/mo'),
)

class GoldUser(models.Model):
    pub_date = models.DateTimeField(_('Publication date'), auto_now_add=True)
    modified_date = models.DateTimeField(_('Modified date'), auto_now=True)

    user = models.ForeignKey('auth.User', verbose_name=_('User'), unique=True, related_name='gold')
    level = models.CharField(_('Level'), max_length=20, choices=LEVEL_CHOICES, default='supporter')
    projects = models.ManyToManyField(Project, verbose_name=_('Projects'),
                                   related_name='gold_owners')

    last_4_digits = models.CharField(max_length=4)
    stripe_id = models.CharField(max_length=255)
    subscribed = models.BooleanField(default=False)

    def __unicode__(self):
        return 'Gold Level %s for %s' % (self.level, self.user)


text:
@implementation RXMLDocHolder

- (id)initWithDocPtr:(xmlDocPtr)doc {
    if ((self = [super init])) {
        doc_ = doc;
    }

    return self;
}

- (void)dealloc {
    [super dealloc];
    if (doc_ != nil) {
        xmlFreeDoc(doc_);
    }
}

- (xmlDocPtr)doc {
    return doc_;
}

@end

@implementation RXMLElement

- (id)initFromXMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding {
    return [self initFromXMLData:[xmlString dataUsingEncoding:encoding]];
}

- (id)initFromXMLFilePath:(NSString *)fullPath {
    return [self initFromXMLData:[NSData dataWithContentsOfFile:fullPath]];
}

- (id)initFromXMLFile:(NSString *)filename {
    NSString *fullPath = [[[NSBundle bundleForClass:self.class] bundlePath] stringByAppendingPathComponent:filename];
    return [self initFromXMLFilePath:fullPath];
}

- (id)initFromXMLFile:(NSString *)filename fileExtension:(NSString *)extension {
    NSString *fullPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename ofType:extension];
    return [self initFromXMLData:[NSData dataWithContentsOfFile:fullPath]];
}

- (id)initFromURL:(NSURL *)url {
    return [self initFromXMLData:[NSData dataWithContentsOfURL:url]];
}

- (id)initFromXMLData:(NSData *)data {
    if ((self = [super init])) {
        xmlDocPtr doc = xmlReadMemory([data bytes], (int)[data length], "", nil, XML_PARSE_RECOVER);
        self.xmlDoc = [[RXMLDocHolder alloc] initWithDocPtr:doc];

        if ([self isValid]) {
            node_ = xmlDocGetRootElement(doc);

            if (!node_) {
                self.xmlDoc = nil;
            }
        }
    }

    return self;
}

- (id)initFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node {
    if ((self = [super init])) {
        self.xmlDoc = doc;
        node_ = node;
    }

    return self;
}

- (id)initFromHTMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding {
    return [self initFromHTMLData:[xmlString dataUsingEncoding:encoding]];
}

- (id)initFromHTMLFile:(NSString *)filename {
    NSString *fullPath = [[[NSBundle bundleForClass:self.class] bundlePath] stringByAppendingPathComponent:filename];
    return [self initFromHTMLData:[NSData dataWithContentsOfFile:fullPath]];
}

- (id)initFromHTMLFile:(NSString *)filename fileExtension:(NSString*)extension {
    NSString *fullPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename ofType:extension];
    return [self initFromHTMLData:[NSData dataWithContentsOfFile:fullPath]];
}

- (id)initFromHTMLFilePath:(NSString *)fullPath {
    return [self initFromHTMLData:[NSData dataWithContentsOfFile:fullPath]];

}

- (id)initFromHTMLData:(NSData *)data {
    if ((self = [super init])) {
        xmlDocPtr doc = htmlReadMemory([data bytes], (int)[data length], "", nil, HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR);
        self.xmlDoc = [[RXMLDocHolder alloc] initWithDocPtr:doc];

        if ([self isValid]) {
            node_ = xmlDocGetRootElement(doc);

            if (!node_) {
                self.xmlDoc = nil;
            }
        }
    }
    return self;
}

// Copy the RaptureXML element
// (calling copy will call this method automatically with the default zone)
-(id)copyWithZone:(NSZone *)zone{
    RXMLElement* new_element = [[RXMLElement alloc] init];
    new_element->node_ = node_;
    new_element.xmlDoc = self.xmlDoc;
    return new_element;
}

+ (id)elementFromXMLString:(NSString *)attributeXML_ encoding:(NSStringEncoding)encoding {
    return [[RXMLElement alloc] initFromXMLString:attributeXML_ encoding:encoding];
}

+ (id)elementFromXMLFilePath:(NSString *)fullPath {
    return [[RXMLElement alloc] initFromXMLFilePath:fullPath];
}

+ (id)elementFromXMLFile:(NSString *)filename {
    return [[RXMLElement alloc] initFromXMLFile:filename];
}

+ (id)elementFromXMLFilename:(NSString *)filename fileExtension:(NSString *)extension {
    return [[RXMLElement alloc] initFromXMLFile:filename fileExtension:extension];
}

+ (id)elementFromURL:(NSURL *)url {
    return [[RXMLElement alloc] initFromURL:url];
}

+ (id)elementFromXMLData:(NSData *)data {
    return [[RXMLElement alloc] initFromXMLData:data];
}

+ (id)elementFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node {
    return [[RXMLElement alloc] initFromXMLDoc:doc node:node];
}

- (NSString *)description {
    return [self text];
}

+ (id)elementFromHTMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding {
    return [[RXMLElement alloc] initFromHTMLString:xmlString encoding:encoding];
}

+ (id)elementFromHTMLFile:(NSString *)filename {
    return [[RXMLElement alloc] initFromHTMLFile:filename];
}

+ (id)elementFromHTMLFile:(NSString *)filename fileExtension:(NSString*)extension {
    return [[RXMLElement alloc] initFromHTMLFile:filename fileExtension:extension];
}

+ (id)elementFromHTMLFilePath:(NSString *)fullPath {
    return [[RXMLElement alloc] initFromHTMLFilePath:fullPath];
}

+ (id)elementFromHTMLData:(NSData *)data {
    return [[RXMLElement alloc] initFromHTMLData:data];
}

#pragma mark -

- (NSString *)tag {
    return [NSString stringWithUTF8String:(const char *)node_->name];
}

- (NSString *)text {
    xmlChar *key = xmlNodeGetContent(node_);
    NSString *text = (key ? [NSString stringWithUTF8String:(const char *)key] : @"");
    xmlFree(key);

    return text;
}

- (NSString *)xml {
    xmlBufferPtr buffer = xmlBufferCreate();
    xmlNodeDump(buffer, node_->doc, node_, 0, false);
    NSString *text = [NSString stringWithUTF8String:(const char *)xmlBufferContent(buffer)];
    xmlBufferFree(buffer);
    return text;
}

- (NSString *)innerXml {
    NSMutableString* innerXml = [NSMutableString string];
    xmlNodePtr cur = node_->children;

    while (cur != nil) {
        if (cur->type == XML_TEXT_NODE) {
            xmlChar *key = xmlNodeGetContent(cur);
            NSString *text = (key ? [NSString stringWithUTF8String:(const char *)key] : @"");
            xmlFree(key);
            [innerXml appendString:text];
        } else {
            xmlBufferPtr buffer = xmlBufferCreate();
            xmlNodeDump(buffer, node_->doc, cur, 0, false);
            NSString *text = [NSString stringWithUTF8String:(const char *)xmlBufferContent(buffer)];
            xmlBufferFree(buffer);
            [innerXml appendString:text];
        }
        cur = cur->next;
    }

    return innerXml;
}

- (NSInteger)textAsInt {
    return [self.text intValue];
}

- (double)textAsDouble {
    return [self.text doubleValue];
}

- (NSString *)attribute:(NSString *)attName {
    NSString *ret = nil;
    const unsigned char *attCStr = xmlGetProp(node_, (const xmlChar *)[attName cStringUsingEncoding:NSUTF8StringEncoding]);

    if (attCStr) {
        ret = [NSString stringWithUTF8String:(const char *)attCStr];
        xmlFree((void *)attCStr);
    }

    return ret;
}

- (NSString *)attribute:(NSString *)attName inNamespace:(NSString *)ns {
    const unsigned char *attCStr = xmlGetNsProp(node_, (const xmlChar *)[attName cStringUsingEncoding:NSUTF8StringEncoding], (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding]);

    if (attCStr) {
        return [NSString stringWithUTF8String:(const char *)attCStr];
    }

    return nil;
}

- (NSArray *)attributeNames {
    NSMutableArray *names = [[NSMutableArray alloc] init];

    for(xmlAttrPtr attr = node_->properties; attr != nil; attr = attr->next) {
        [names addObject:[[NSString alloc] initWithCString:(const char *)attr->name encoding:NSUTF8StringEncoding]];
    }

    return names;
}

- (NSInteger)attributeAsInt:(NSString *)attName {
    return [[self attribute:attName] intValue];
}

- (NSInteger)attributeAsInt:(NSString *)attName inNamespace:(NSString *)ns {
    return [[self attribute:attName inNamespace:ns] intValue];
}

- (double)attributeAsDouble:(NSString *)attName {
    return [[self attribute:attName] doubleValue];
}

- (double)attributeAsDouble:(NSString *)attName inNamespace:(NSString *)ns {
    return [[self attribute:attName inNamespace:ns] doubleValue];
}

- (BOOL)isValid {
    return (self.xmlDoc != nil);
}

#pragma mark -

- (RXMLElement *)child:(NSString *)tag {
    NSArray *components = [tag componentsSeparatedByString:@"."];
    xmlNodePtr cur = node_;

    // navigate down
    for (NSString *itag in components) {
        const xmlChar *tagC = (const xmlChar *)[itag cStringUsingEncoding:NSUTF8StringEncoding];

        if ([itag isEqualToString:@"*"]) {
            cur = cur->children;

            while (cur != nil && cur->type != XML_ELEMENT_NODE) {
                cur = cur->next;
            }
        } else {
            cur = cur->children;
            while (cur != nil) {
                if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC)) {
                    break;
                }

                cur = cur->next;
            }
        }

        if (!cur) {
            break;
        }
    }

    if (cur) {
        return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur];
    }

    return nil;
}

- (RXMLElement *)child:(NSString *)tag inNamespace:(NSString *)ns {
    NSArray *components = [tag componentsSeparatedByString:@"."];
    xmlNodePtr cur = node_;
    const xmlChar *namespaceC = (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding];

    // navigate down
    for (NSString *itag in components) {
        const xmlChar *tagC = (const xmlChar *)[itag cStringUsingEncoding:NSUTF8StringEncoding];

        if ([itag isEqualToString:@"*"]) {
            cur = cur->children;

            while (cur != nil && cur->type != XML_ELEMENT_NODE && !xmlStrcmp(cur->ns->href, namespaceC)) {
                cur = cur->next;
            }
        } else {
            cur = cur->children;
            while (cur != nil) {
                if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC) && !xmlStrcmp(cur->ns->href, namespaceC)) {
                    break;
                }

                cur = cur->next;
            }
        }

        if (!cur) {
            break;
        }
    }

    if (cur) {
        return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur];
    }

    return nil;
}

- (NSArray *)children:(NSString *)tag {
    const xmlChar *tagC = (const xmlChar *)[tag cStringUsingEncoding:NSUTF8StringEncoding];
    NSMutableArray *children = [NSMutableArray array];
    xmlNodePtr cur = node_->children;

    while (cur != nil) {
        if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC)) {
            [children addObject:[RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]];
        }

        cur = cur->next;
    }

    return [children copy];
}

- (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns {
    const xmlChar *tagC = (const xmlChar *)[tag cStringUsingEncoding:NSUTF8StringEncoding];
    const xmlChar *namespaceC = (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding];
    NSMutableArray *children = [NSMutableArray array];
    xmlNodePtr cur = node_->children;

    while (cur != nil) {
        if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC) && !xmlStrcmp(cur->ns->href, namespaceC)) {
            [children addObject:[RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]];
        }

        cur = cur->next;
    }

    return [children copy];
}

- (NSArray *)childrenWithRootXPath:(NSString *)xpath {
    // check for a query
    if (!xpath) {
        return [NSArray array];
    }

    xmlXPathContextPtr context = xmlXPathNewContext([self.xmlDoc doc]);

    if (context == NULL) {
		return nil;
    }

    xmlXPathObjectPtr object = xmlXPathEvalExpression((xmlChar *)[xpath cStringUsingEncoding:NSUTF8StringEncoding], context);
    if(object == NULL) {
		return nil;
    }

	xmlNodeSetPtr nodes = object->nodesetval;
	if (nodes == NULL) {
		return nil;
	}

	NSMutableArray *resultNodes = [NSMutableArray array];

    for (NSInteger i = 0; i < nodes->nodeNr; i++) {
		RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:nodes->nodeTab[i]];

		if (element != NULL) {
			[resultNodes addObject:element];
		}
	}

    xmlXPathFreeObject(object);
    xmlXPathFreeContext(context);

    return resultNodes;
}

#pragma mark -

- (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk {
    // check for a query
    if (!query) {
        return;
    }

    NSArray *components = [query componentsSeparatedByString:@"."];
    xmlNodePtr cur = node_;

    // navigate down
    for (NSInteger i=0; i < components.count; ++i) {
        NSString *iTagName = [components objectAtIndex:i];

        if ([iTagName isEqualToString:@"*"]) {
            cur = cur->children;

            // different behavior depending on if this is the end of the query or midstream
            if (i < (components.count - 1) && cur != nil) {
                // midstream
                do {
                    if (cur->type == XML_ELEMENT_NODE) {
                        RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur];
                        NSString *restOfQuery = [[components subarrayWithRange:NSMakeRange(i + 1, components.count - i - 1)] componentsJoinedByString:@"."];
                        [element iterate:restOfQuery usingBlock:blk];
                    }

                    cur = cur->next;
                } while (cur != nil);

            }
        } else {
            const xmlChar *tagNameC = (const xmlChar *)[iTagName cStringUsingEncoding:NSUTF8StringEncoding];

            cur = cur->children;
            while (cur != nil) {
                if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagNameC)) {
                    break;
                }

                cur = cur->next;
            }
        }

        if (!cur) {
            break;
        }
    }

    if (cur) {
        // enumerate
        NSString *childTagName = [components lastObject];

        do {
            if (cur->type == XML_ELEMENT_NODE) {
                RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur];
                blk(element);
            }

            if ([childTagName isEqualToString:@"*"]) {
                cur = cur->next;
            } else {
                const xmlChar *tagNameC = (const xmlChar *)[childTagName cStringUsingEncoding:NSUTF8StringEncoding];

                while ((cur = cur->next)) {
                    if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagNameC)) {
                        break;
                    }
                }
            }
        } while (cur);
    }
}

- (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(RXMLElement *))blk {
    NSArray *children = [self childrenWithRootXPath:xpath];
    [self iterateElements:children usingBlock:blk];
}

- (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(RXMLElement *))blk {
    for (RXMLElement *iElement in elements) {
        blk(iElement);
    }
}

@end


text:
require 'simplecov'

SimpleCov.start do
  add_filter '/spec'
end

require 'action_controller'
require 'class-action'

RSpec.configure do |config|

  config.mock_with :rspec do |config|
    config.syntax = :expect
  end

end

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

    <TextView
        android:id="@+id/main_activity_tv_adid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <TextView
        android:id="@+id/main_activity_tv_limitedflag"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>


text:
namespace google {
namespace cloud {
namespace kms_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

class KeyManagementServiceLogging : public KeyManagementServiceStub {
 public:
  ~KeyManagementServiceLogging() override = default;
  KeyManagementServiceLogging(std::shared_ptr<KeyManagementServiceStub> child,
                              TracingOptions tracing_options,
                              std::set<std::string> components);

  StatusOr<google::cloud::kms::v1::ListKeyRingsResponse> ListKeyRings(
      grpc::ClientContext& context,
      google::cloud::kms::v1::ListKeyRingsRequest const& request) override;

  StatusOr<google::cloud::kms::v1::ListCryptoKeysResponse> ListCryptoKeys(
      grpc::ClientContext& context,
      google::cloud::kms::v1::ListCryptoKeysRequest const& request) override;

  StatusOr<google::cloud::kms::v1::ListCryptoKeyVersionsResponse>
  ListCryptoKeyVersions(
      grpc::ClientContext& context,
      google::cloud::kms::v1::ListCryptoKeyVersionsRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::ListImportJobsResponse> ListImportJobs(
      grpc::ClientContext& context,
      google::cloud::kms::v1::ListImportJobsRequest const& request) override;

  StatusOr<google::cloud::kms::v1::KeyRing> GetKeyRing(
      grpc::ClientContext& context,
      google::cloud::kms::v1::GetKeyRingRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKey> GetCryptoKey(
      grpc::ClientContext& context,
      google::cloud::kms::v1::GetCryptoKeyRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> GetCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::GetCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::PublicKey> GetPublicKey(
      grpc::ClientContext& context,
      google::cloud::kms::v1::GetPublicKeyRequest const& request) override;

  StatusOr<google::cloud::kms::v1::ImportJob> GetImportJob(
      grpc::ClientContext& context,
      google::cloud::kms::v1::GetImportJobRequest const& request) override;

  StatusOr<google::cloud::kms::v1::KeyRing> CreateKeyRing(
      grpc::ClientContext& context,
      google::cloud::kms::v1::CreateKeyRingRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKey> CreateCryptoKey(
      grpc::ClientContext& context,
      google::cloud::kms::v1::CreateCryptoKeyRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> CreateCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::CreateCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> ImportCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::ImportCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::ImportJob> CreateImportJob(
      grpc::ClientContext& context,
      google::cloud::kms::v1::CreateImportJobRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKey> UpdateCryptoKey(
      grpc::ClientContext& context,
      google::cloud::kms::v1::UpdateCryptoKeyRequest const& request) override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> UpdateCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::UpdateCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::CryptoKey> UpdateCryptoKeyPrimaryVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::UpdateCryptoKeyPrimaryVersionRequest const&
          request) override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> DestroyCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::DestroyCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::CryptoKeyVersion> RestoreCryptoKeyVersion(
      grpc::ClientContext& context,
      google::cloud::kms::v1::RestoreCryptoKeyVersionRequest const& request)
      override;

  StatusOr<google::cloud::kms::v1::EncryptResponse> Encrypt(
      grpc::ClientContext& context,
      google::cloud::kms::v1::EncryptRequest const& request) override;

  StatusOr<google::cloud::kms::v1::DecryptResponse> Decrypt(
      grpc::ClientContext& context,
      google::cloud::kms::v1::DecryptRequest const& request) override;

  StatusOr<google::cloud::kms::v1::AsymmetricSignResponse> AsymmetricSign(
      grpc::ClientContext& context,
      google::cloud::kms::v1::AsymmetricSignRequest const& request) override;

  StatusOr<google::cloud::kms::v1::AsymmetricDecryptResponse> AsymmetricDecrypt(
      grpc::ClientContext& context,
      google::cloud::kms::v1::AsymmetricDecryptRequest const& request) override;

  StatusOr<google::cloud::kms::v1::MacSignResponse> MacSign(
      grpc::ClientContext& context,
      google::cloud::kms::v1::MacSignRequest const& request) override;

  StatusOr<google::cloud::kms::v1::MacVerifyResponse> MacVerify(
      grpc::ClientContext& context,
      google::cloud::kms::v1::MacVerifyRequest const& request) override;

  StatusOr<google::cloud::kms::v1::GenerateRandomBytesResponse>
  GenerateRandomBytes(grpc::ClientContext& context,
                      google::cloud::kms::v1::GenerateRandomBytesRequest const&
                          request) override;

 private:
  std::shared_ptr<KeyManagementServiceStub> child_;
  TracingOptions tracing_options_;
  std::set<std::string> components_;
};  // KeyManagementServiceLogging

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace kms_internal
}  // namespace cloud
}  // namespace google

#endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_KMS_INTERNAL_KEY_MANAGEMENT_LOGGING_DECORATOR_H


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.init;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Process;

import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.chrome.browser.ApplicationLifetime;
import org.chromium.chrome.browser.BrowserRestartActivity;

import java.lang.ref.WeakReference;

/**
 * Answers requests to kill and (potentially) restart Chrome's main browser process.
 *
 * This class fires an Intent to start the {@link BrowserRestartActivity}, which will utltimately
 * kill the main browser process from its own process.
 *
 * https://crbug.com/515919 details why another Activity is used instead of using the AlarmManager.
 * https://crbug.com/545453 details why the BrowserRestartActivity handles the process killing.
 */
class ChromeLifetimeController implements ApplicationLifetime.Observer,
        ApplicationStatus.ActivityStateListener {
    private static final String TAG = "LifetimeController";

    private static ChromeLifetimeController sInstance;

    private boolean mRestartChromeOnDestroy;
    private int mRemainingActivitiesCount;

    /**
     * Initialize the ChromeLifetimeController;
     */
    @SuppressFBWarnings("LI_LAZY_INIT_UPDATE_STATIC")
    public static void initialize() {
        ThreadUtils.assertOnUiThread();
        if (sInstance != null) return;
        sInstance = new ChromeLifetimeController();
        ApplicationLifetime.addObserver(sInstance);
    }

    private ChromeLifetimeController() {}

    @Override
    public void onTerminate(boolean restart) {
        mRestartChromeOnDestroy = restart;

        for (WeakReference<Activity> weakActivity : ApplicationStatus.getRunningActivities()) {
            Activity activity = weakActivity.get();
            if (activity != null) {
                ApplicationStatus.registerStateListenerForActivity(this, activity);
                mRemainingActivitiesCount++;
                activity.finish();
            }
        }

        // Start the Activity that will ultimately kill this process.
        fireBrowserRestartActivityIntent(BrowserRestartActivity.ACTION_START_WATCHDOG);
    }

    @Override
    public void onActivityStateChange(Activity activity, int newState) {
        assert mRemainingActivitiesCount > 0;
        if (newState == ActivityState.DESTROYED) {
            mRemainingActivitiesCount--;
            if (mRemainingActivitiesCount == 0) {
                fireBrowserRestartActivityIntent(BrowserRestartActivity.ACTION_KILL_PROCESS);
            }
        }
    }

    private void fireBrowserRestartActivityIntent(String action) {
        Context context = ContextUtils.getApplicationContext();
        Intent intent = new Intent();
        intent.setAction(action);
        intent.setClassName(
                context.getPackageName(), BrowserRestartActivity.class.getName());
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra(BrowserRestartActivity.EXTRA_MAIN_PID, Process.myPid());
        intent.putExtra(BrowserRestartActivity.EXTRA_RESTART, mRestartChromeOnDestroy);
        context.startActivity(intent);
    }
}


text:
ResidentTilestack::ResidentTilestack(const TilestackInfo &ti)
{
  *((TilestackInfo*)this) = ti;
  set_nframes(nframes);
  size_t size = bytes_per_frame() * nframes;
  try {
    if (size / 1e9 > 0.5) fprintf(stderr, "Allocating %f GB in ResidentTilestack\n", size / 1e9);
    all_pixels.resize(size);
  } catch (std::bad_alloc) {
    fprintf(stderr, "Ran out of memory trying to allocate ResidentTilestack of dimensions width:%d x height:%d x nframes:%d (%lld bytes)\n",
            tile_width, tile_height, nframes, (long long) size);
    throw;
  }
  for (unsigned i = 0; i < nframes; i++) {
    pixels[i] = &all_pixels[bytes_per_frame() * i];
  }
}

void Tilestack::write(Writer *w) const {
  unsigned long long filepos = 0;

  // Write compressed with zlib

  std::vector<unsigned char> header(8);
  write_u64(&header[0], 0x326b7473656c6974LL); // ASCII 'tilestk2'
  w->write(header);
  filepos += header.size();

  std::vector<unsigned char> buf;
  unsigned flush_threshold = 24 * 1024 * 1024; // Buffer ~24 MB before flushing

  std::vector<unsigned char> compressed_frame;

  std::vector<TOCEntry> write_toc(nframes);

  for (unsigned i = 0; i < nframes; i++) {
    frame_pixels(i);
    Zlib::compress(compressed_frame, pixels[i], bytes_per_frame());
    buf.insert(buf.end(), compressed_frame.begin(), compressed_frame.end());
    write_toc[i].timestamp = toc[i].timestamp;
    write_toc[i].address = filepos;
    write_toc[i].length = compressed_frame.size();
    filepos += compressed_frame.size();
    if (buf.size() >= flush_threshold) {
      w->write(buf);
      buf.resize(0);
    }
  }
  w->write(buf);
  buf.resize(0);

  size_t tocentry_size = 24;
  std::vector<unsigned char> tocdata(tocentry_size * nframes);
  for (unsigned i = 0; i < nframes; i++) {
    write_double64(&tocdata[i*tocentry_size +  0], write_toc[i].timestamp);
    write_u64(&tocdata[i*tocentry_size +  8], write_toc[i].address);
    write_u64(&tocdata[i*tocentry_size + 16], write_toc[i].length);
  }
  w->write(tocdata);
  size_t footer_size = 48;
  std::vector<unsigned char> footer(footer_size);

  write_u64(&footer[ 0], nframes);
  write_u64(&footer[ 8], tile_width);
  write_u64(&footer[16], tile_height);
  write_u32(&footer[24], bands_per_pixel);
  write_u32(&footer[28], bits_per_band);
  write_u32(&footer[32], pixel_format);
  write_u32(&footer[36], ZLIB_COMPRESSION);
  write_u64(&footer[40], 0x646e65326b747374LL); // ASCII: 'tstk2end'
  w->write(footer);
}

void ResidentTilestack::instantiate_pixels(unsigned frame) const {
  assert(0); // we instantiate all the pixels in our constructor
}


text:
package com.spectral.ttlfc.exception;

public class NotYourTurnException extends RuntimeException{

}