text:
**Namespace:** [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605.md)
**Assembly:** OfficeDevPnP.Core.dll
## Syntax
```C#
public TermTerms Terms { get; set; }
```

### Property Value
Type: [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605.TermTerms](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605.TermTerms.md)

## See also
- [Term](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605.Term.md)
- [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201605.md)

redpajama_set_name: RedPajamaGithub


text:
package tag

import (
	"github.com/watermint/toolbox/domain/dropbox/api/dbx_auth"
	"github.com/watermint/toolbox/domain/dropbox/api/dbx_conn"
	"github.com/watermint/toolbox/domain/dropbox/model/mo_path"
	"github.com/watermint/toolbox/domain/dropbox/service/sv_file_tag"
	"github.com/watermint/toolbox/infra/control/app_control"
	"github.com/watermint/toolbox/infra/recipe/rc_exec"
	"github.com/watermint/toolbox/infra/recipe/rc_recipe"
	"github.com/watermint/toolbox/quality/recipe/qtr_endtoend"
)

type Delete struct {
	Peer dbx_conn.ConnScopedIndividual
	Path mo_path.DropboxPath
	Tag  string
}

func (z *Delete) Preset() {
	z.Peer.SetScopes(
		dbx_auth.ScopeFilesMetadataRead,
		dbx_auth.ScopeFilesMetadataWrite,
	)
}

func (z *Delete) Exec(c app_control.Control) error {
	return sv_file_tag.New(z.Peer.Client()).Delete(z.Path, z.Tag)
}

func (z *Delete) Test(c app_control.Control) error {
	return rc_exec.ExecMock(c, &Delete{}, func(r rc_recipe.Recipe) {
		m := r.(*Delete)
		m.Tag = "delete"
		m.Path = qtr_endtoend.NewTestDropboxFolderPath("delete")
	})
}


text:
<!doctype html>

    <meta charset='utf-8'>
    <title>DevRelOMeter: Are you practicing Developer Evangelism or Advocacy?</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>

    <link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css' />

DevRelOMeter

Are you practicing - or considering practicing - Developer Evangelism or Advocacy?

Built by Phil @leggetter | Created whilst writing up an article on Defining Developer Relations | Get the DevRelOMeter code on GitHub.


text:
class Bucket < ApplicationRecord
  has_many :descriptions, dependent: :nullify
  validates :name, presence: true, uniqueness: true

  scope :where_has_line_items, ->() {
          where("descriptions_count > ?", 0).select do |b|
            b.total_line_items > 0
          end
        }

  # TODO: Technically, there is no relation between Bucket and LineItem
  # This should be refactored into a different module or directly where it's used
  def line_items
    LineItem.where(description: self.descriptions.select(:value))
  end

  def total_line_items
    self.line_items.sum :amount
  end
end


text:
Gitbook plugin that provide [The Unofficial GitHub Watch & Fork Buttons](https://ghbtns.com/ "The Unofficial GitHub Watch & Fork Buttons").

![screenshot](https://monosnap.com/file/pzLUbsaOvgah0aWPt6E0TqG0l73faX.png)

## Installation

    npm install gitbook-plugin-github-buttons

## Usage

Plugin Config

```json
{
  "plugins": [
    "github-buttons"
  ],
  "pluginsConfig": {
    "github-buttons": {
      "buttons": [{
        "user": "azu",
        "repo": "JavaScript-Plugin-Architecture",
        "type": "star",
        "size": "large"
      }, {
        "user": "azu",
        "type": "follow",
        "width": "230",
        "count": false
      }]
    }
  }
}
```

The default size of `large` is `150 x 30`, and `small` is `100 x 20`, however, you can specify the size you want by using `width` and `height`. Such as:

- "size": "small" || "large"
- "width": `number`
- "height": `number`

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

MIT


text:
import React from "react";
import { shallow } from "enzyme";
import { fromJS } from "immutable";
import MultipleChoiceAnswer, { Choice } from "../../../js/components/dashboard/multiple-choice-answer";

describe("<MultipleChoiceAnswer />", () => {
  describe("when showFullAnswer prop is false and selected answer is correct", () => {
    it("should render checkmark icon only", () => {
      const answer = fromJS({ answer: [ { id: 1, choice: "choice_1" } ], correct: true });
      const question = fromJS({ scored: true, choices: [ { id: 1, content: "choice_1", correct: true }, { id: 2, content: "choice_2", correct: false } ] });
      const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer={false} question={question} answer={answer} />);
      expect(wrapper.find(Choice)).toHaveLength(0);
      expect(wrapper.find(".icomoon-checkmark")).toHaveLength(1);
    });
  });

  describe("when showFullAnswer prop is false and selected answer is incorrect", () => {
    it("should render cross icon only", () => {
      const answer = fromJS({ answer: [ { id: 2, choice: "choice_2" } ], correct: false });
      const question = fromJS({ scored: true, choices: [ { id: 1, content: "choice_1", correct: true }, { id: 2, content: "choice_2", correct: false } ] });
      const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer={false} question={question} answer={answer} />);
      expect(wrapper.find(Choice)).toHaveLength(0);
      expect(wrapper.find(".icomoon-cross")).toHaveLength(1);
    });
  });

  describe("when showFullAnswer prop is false and there is no correct or incorrect answer", () => {
    describe("and correct properties are equal to `null`", () => {
      it("should render empty checkmark icon only", () => {
        const answer = fromJS({ answer: [ { id: 2, choice: "choice_2" } ], correct: null });
        const question = fromJS({ choices: [ { id: 1, content: "choice_1", correct: null }, { id: 2, content: "choice_2", correct: null } ] });
        const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer={false} question={question} answer={answer} />);
        expect(wrapper.find(Choice)).toHaveLength(0);
        expect(wrapper.find(".icomoon-checkmark2")).toHaveLength(1);
      });
    });
    describe("and correct properties are equal to `false`", () => {
      it("should render empty checkmark icon only", () => {
        const answer = fromJS({ answer: [ { id: 2, choice: "choice_2" } ], correct: false });
        const question = fromJS({ choices: [ { id: 1, content: "choice_1", correct: false }, { id: 2, content: "choice_2", correct: false } ] });
        const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer={false} question={question} answer={answer} />);
        expect(wrapper.find(Choice)).toHaveLength(0);
        expect(wrapper.find(".icomoon-checkmark2")).toHaveLength(1);
      });
    });
  });

  describe("when showFullAnswer prop is true", () => {
    it("should render all the choices and select one selected by student", () => {
      const answer = fromJS({ selectedChoices: [ {id: 1} ] });
      const question = fromJS({ choices: [ { id: 1, content: "choice_1" }, { id: 2, content: "choice_2" } ] });
      const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer question={question} answer={answer} />);
      expect(wrapper.find(Choice)).toHaveLength(2);
      expect(wrapper.find(Choice).at(0).prop("choice")).toBe(question.get("choices").get(0));
      expect(wrapper.find(Choice).at(0).prop("selected")).toBe(true);
      expect(wrapper.find(Choice).at(1).prop("choice")).toBe(question.get("choices").get(1));
      expect(wrapper.find(Choice).at(1).prop("selected")).toBe(false);
    });
  });

  describe("when there is no choice with correct property equal to `true`", () => {
    it("should pass `correctAnswerDefined=false` prop to choices", () => {
      const answer = fromJS({ selectedChoices: [ {id: 1} ] });
      const question = fromJS({ scored: false, choices: [ { id: 1, content: "choice_1", correct: false }, { id: 2, content: "choice_2", correct: false } ] });
      const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer question={question} answer={answer} />);
      expect(wrapper.find(Choice)).toHaveLength(2);
      expect(wrapper.find(Choice).at(0).prop("correctAnswerDefined")).toBe(false);
      expect(wrapper.find(Choice).at(1).prop("correctAnswerDefined")).toBe(false);
    });
  });

  describe("when there is at least one choice with correct property equal to `true`", () => {
    it("should pass `correctAnswerDefined=true` prop to choices", () => {
      const answer = fromJS({ selectedChoices: [ {id: 1} ] });
      const question = fromJS({ scored: true, choices: [ { id: 1, content: "choice_1", correct: true }, { id: 2, content: "choice_2", correct: false } ] });
      const wrapper = shallow(<MultipleChoiceAnswer showFullAnswer question={question} answer={answer} />);
      expect(wrapper.find(Choice)).toHaveLength(2);
      expect(wrapper.find(Choice).at(0).prop("correctAnswerDefined")).toBe(true);
      expect(wrapper.find(Choice).at(1).prop("correctAnswerDefined")).toBe(true);
    });
  });
});

describe("<Choice />", () => {
  it("should render choice text", () => {
    const choice = fromJS({ id: 1, content: "choice_12345" });
    const wrapper = shallow(<Choice choice={choice} />);
    expect(wrapper.contains("choice_12345")).toBe(true);
  });

  describe("when it is not selected", () => {
    it("should render unchecked icon", () => {
      const choice = fromJS({ id: 1, content: "choice_12345" });
      const wrapper = shallow(<Choice selected={false} choice={choice} />);
      expect(wrapper.find(".icomoon-radio-unchecked")).toHaveLength(1);
    });
  });

  describe("when student answer is correct", () => {
    it("should render filled checkmark icon", () => {
      const choice = fromJS({ id: 1, content: "choice_12345", correct: true });
      const wrapper = shallow(<Choice selected correctAnswerDefined choice={choice} />);
      expect(wrapper.find(".icomoon-checkmark")).toHaveLength(1);
    });
  });

  describe("when student answer is incorrect", () => {
    it("should render cross icon", () => {
      const choice = fromJS({ id: 1, content: "choice_12345", correct: false });
      const wrapper = shallow(<Choice selected correctAnswerDefined choice={choice} />);
      expect(wrapper.find(".icomoon-cross")).toHaveLength(1);
    });
  });

  describe("when there is no correct answer defined", () => {
    describe("and correct prop is equal to `false`", () => {
      it("should render empty checkmark icon", () => {
        const choice = fromJS({ id: 1, content: "choice_12345", correct: false });
        const wrapper = shallow(<Choice selected correctAnswerDefined={false} choice={choice} />);
        expect(wrapper.find(".icomoon-checkmark2")).toHaveLength(1);
      });
    });
    describe("and correct prop is equal to `null`", () => {
      it("should render empty checkmark icon", () => {
        const choice = fromJS({ id: 1, content: "choice_12345", correct: null });
        const wrapper = shallow(<Choice selected correctAnswerDefined={false} choice={choice} />);
        expect(wrapper.find(".icomoon-checkmark2")).toHaveLength(1);
      });
    });
  });
});


text:
require 'gooddata/models/segment'
require 'securerandom'

describe GoodData::Client do
  TOKEN = 'mustangs'

  before(:all) do
    @client = GoodData.connect('mustang@gooddata.com', 'jindrisska', server: 'https://mustangs.intgdc.com', verify_ssl: false )
    @domain = @client.domain('mustangs')
    @master_project = @client.create_project(title: 'Test project', auth_token: TOKEN)
    @segment_name = "segment-#{SecureRandom.uuid}"
    @segment = @domain.create_segment(segment_id: @segment_name, master_project: @master_project)
  end

  after(:all) do
    @segment && @segment.delete
    @master_project && @master_project.delete
    @client.disconnect
  end

  describe '#[]' do
    before(:all) do
      client_id = SecureRandom.uuid
      @client_project = @client.create_project(title: "client_#{client_id} project", auth_token: TOKEN)
      @segment_client = @segment.create_client(id: "tenant_#{client_id}", project: @client_project)
    end

    it 'Returns all clients of a segment' do
      clients = @segment.clients
      expect(clients.to_a).to be_an_instance_of(Array)
      expect(clients.to_a.count).to eq 1
    end

    it 'Returns specific tenant when schedule ID passed' do
      client = @segment.clients(@segment_client.uri)
      expect(client).to be_an_instance_of(GoodData::Client)
      expect(client.uri).to eq @segment_client.uri
    end

    after(:all) do
      @segment_client && @segment_client.delete
      @client_project && @client_project.delete
    end

  end

  describe '#delete' do
    before(:all) do
      client_id = SecureRandom.uuid
      @segment_client = @segment.create_client(id: "tenant_#{client_id}")
    end

    it 'Deletes particular client' do
      expect(@segment.clients.count).to eq 1
      s = @segment.clients(@segment_client.uri)
      s.delete
      expect(@segment.clients.count).to eq 0
      @segment_client = nil
    end

    after(:all) do
      @segment_client && @segment_client.delete
    end
  end

  describe '#delete' do
    before(:all) do
      client_id = SecureRandom.uuid
      @client_project = @client.create_project(title: 'client_1 project', auth_token: TOKEN)
      @segment_client = @segment.create_client(id: "tenant_#{client_id}", project: @client_project)
    end

    it 'Deletes particular client. Project is cleaned up as well' do
      expect(@segment.clients.count).to eq 1
      s = @segment.clients(@segment_client.uri)
      s.delete
      expect(@segment.clients.count).to eq 0
      expect(@client_project.reload!.state).to eq :deleted
      @segment_client = nil
    end

    after(:all) do
      @segment_client && segment_client.delete
    end
  end

  describe '#save' do
    before(:all) do
      @client_id = SecureRandom.uuid
      @client_project = @client.create_project(title: 'client_1 project', auth_token: TOKEN)
      @segment_client = @segment.create_client(id: "tenant_#{@client_id}", project: @client_project)
    end

    it 'can update project id' do
      begin
        other_client_project = @client.create_project(title: "client_#{@client_id} other project", auth_token: TOKEN)
        @segment_client.project = other_client_project
        @segment_client.save
        expect(@segment.clients('tenant_1').project_uri).to eq other_client_project.uri
      ensure
        other_client_project && other_client_project.delete
      end
    end

    it 'can update tenants segment id' do
      pending 'Fix the test '

      second_segment_name = "segment-#{SecureRandom.uuid}"
      second_master_project = @client.create_project(title: 'Test project', auth_token: TOKEN)
      second_segment = @domain.create_segment(segment_id: second_segment_name, master_project: second_master_project)
      @segment_client.segment = second_segment
      @segment_client.save
      expect(second_segment.clients.find { |s| s.uri == @segment_client.uri }).not_to be_nil
      expect(@segment.clients.find { |s| s.uri == @segment_client.uri }).to be_nil
    end

    it 'cannot update a client id' do
      @segment_client.client_id = 'different_id'
      expect {
        @segment_client.save
      }.to raise_error RestClient::BadRequest
    end

    after(:all) do
      @segment_client && @segment_client.delete
      @client_project && @client_project.delete
    end
  end
end


text:
function New-DbaDbRole {
    <#
    .SYNOPSIS
        Create new database roles for each database(s)/ instance(s) of SQL Server.

    .DESCRIPTION
        The New-DbaDbRole create new roles on database(s)/ instance(s) of SQL Server.

    .PARAMETER SqlInstance
        The target SQL Server instance or instances.

    .PARAMETER SqlCredential
        Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).

        Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.

        For MFA support, please use Connect-DbaInstance.

    .PARAMETER Database
        The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.

    .PARAMETER ExcludeDatabase
        The database(s) to exclude - this list is auto-populated from the server

    .PARAMETER Role
        The role(s) to create.

    .PARAMETER Owner
        The owner of the role. If not specified will assume the default dbo.

    .PARAMETER InputObject
        Enables piped input from Get-DbaDatabase

    .PARAMETER WhatIf
        Shows what would happen if the command were to run. No actions are actually performed.

    .PARAMETER Confirm
        Prompts you for confirmation before executing any changing operations within the command.

    .PARAMETER EnableException
        By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
        This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
        Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

    .NOTES
        Tags: Role, User
        Author: Claudio Silva (@ClaudioESSilva), claudioessilva.eu
        Website: https://dbatools.io
        Copyright: (c) 2018 by dbatools, licensed under MIT
        License: MIT https://opensource.org/licenses/MIT

    .LINK
        https://dbatools.io/New-DbaDbRole

    .EXAMPLE
        PS C:\> New-DbaDbRole -SqlInstance sql2017a -Database db1 -Role 'dbExecuter'

        Will create a new role named dbExecuter within db1 on sql2017a instance.

    #>
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    param (
        [DbaInstanceParameter[]]$SqlInstance,
        [PSCredential]$SqlCredential,
        [string[]]$Database,
        [string[]]$ExcludeDatabase,
        [String[]]$Role,
        [String]$Owner,
        [parameter(ValueFromPipeline)]
        [Microsoft.SqlServer.Management.Smo.Database[]]$InputObject,
        [switch]$EnableException
    )
    process {
        if (-not $InputObject -and -not $SqlInstance) {
            Stop-Function -Message "You must pipe in a database or specify a SqlInstance."
            return
        }

        if (-not $Role) {
            Stop-Function -Message "You must specify a new role name."
            return
        }

        if ($SqlInstance) {
            foreach ($instance in $SqlInstance) {
                $InputObject += Get-DbaDatabase -SqlInstance $instance -SqlCredential $SqlCredential -Database $Database -ExcludeDatabase $ExcludeDatabase
            }
        }

        $InputObject = $InputObject | Where-Object { $_.IsAccessible -eq $true }

        foreach ($db in $InputObject) {
            $server = $db.Parent
            Write-Message -Level 'Verbose' -Message "Getting Database Roles for $db on $server"

            $dbRoles = $db.Roles

            foreach ($r in $Role) {
                if ($dbRoles | Where-Object Name -eq $r) {
                    Stop-Function -Message "The $r role already exist within database $db on instance $server." -Target $db -Continue
                }

                Write-Message -Level Verbose -Message "Add roles to Database $db on target $server"

                if ($Pscmdlet.ShouldProcess("Creating new DatabaseRole $role on database $db", $server)) {
                    try {
                        $newRole = New-Object -TypeName Microsoft.SqlServer.Management.Smo.DatabaseRole
                        $newRole.Name = $r
                        $newRole.Parent = $db

                        if ($Owner) {
                            $newRole.Owner = $Owner
                        } else {
                            $newRole.Owner = "dbo"
                        }

                        $newRole.Create()

                        Add-Member -Force -InputObject $newRole -MemberType NoteProperty -Name ComputerName -value $server.ComputerName
                        Add-Member -Force -InputObject $newRole -MemberType NoteProperty -Name InstanceName -value $server.ServiceName
                        Add-Member -Force -InputObject $newRole -MemberType NoteProperty -Name SqlInstance -value $server.DomainInstanceName
                        Add-Member -Force -InputObject $newRole -MemberType NoteProperty -Name ParentName -value $db.Name

                        Select-DefaultView -InputObject $newRole -Property ComputerName, InstanceName, SqlInstance, Name, 'ParentName as Parent', Owner
                    } catch {
                        Stop-Function -Message "Failure" -ErrorRecord $_ -Continue
                    }
                }
            }

        }
    }
}


text:
package net.revenj.patterns

import java.time.OffsetDateTime

import scala.concurrent.Future

trait Event

trait Command extends Event with ValidationErrors

/** Domain event represents an meaningful business event that occurred in the system.
  * It is a message that back-end system knows how to process and that will
  * change the state of the system.
  *
  * They are preferred way of manipulating data instead of simple CUD
  * operations (create, update, delete).
  * Unlike {@link AggregateDomainEvent aggregate domain event} which is tied to a change in a single
  * {@link AggregateRoot aggregate root}, domain event should be used when an action will result
  * in modifications to multiple aggregates, external call (like sending an email)
  * or some other action.
  *
  * By default event will be applied immediately.
  * If {@code async} is used, event will be stored immediately but applied later.
  *
  * DomainEvent is defined in DSL with keyword {@code event}.
  *
  * {{{
  * module Todo {
  *   aggregate Task;
  *   event MarkDone {
  *     Task task;
  *   }
  * }
  * }}}
  */
trait DomainEvent extends Event with Identifiable {

  def queuedAt: OffsetDateTime
}

trait AsyncEvent extends DomainEvent {

  def processedAt: Option[OffsetDateTime]
}

trait CommandLog[T <: Command] extends Identifiable with NestedValue[T] {
  def at: OffsetDateTime
}

trait AggregateDomainEvent[TAgg <: AggregateRoot] extends DomainEvent {
  def apply(aggregate: TAgg): Unit
}

trait DomainEventHandler[T] {
  def handle(domainEvent: T): Unit
}

trait AggregateDomainEventHandler[TAgg <: AggregateRoot, TDE <: AggregateDomainEvent[TAgg]] {
  def handle(domainEvent: TDE, aggregate: TAgg): Unit
}

trait EventStore[T <: Event] {

  def submit(events: scala.collection.Seq[T]): Future[scala.collection.IndexedSeq[String]]

  def submit(event: T): Future[String] = {
    implicit val global = scala.concurrent.ExecutionContext.Implicits.global
    require(event ne null, "null value provided for event")
    submit(Seq(event)).map(_.head)
  }
}

trait DomainEventStore[T <: DomainEvent] extends EventStore[T] with Repository[T] with SearchableRepository[T] {
}

trait AsyncDomainEventStore[T <: DomainEvent] extends DomainEventStore[T] {

  def mark(events: scala.collection.Seq[T]): Future[Unit]

  def mark(event: T): Future[Unit] = {
    require(event ne null, "null value provided for event")
    mark(Seq(event))
  }
}

trait EventStoreAspect[T <: Event] {
  def before(events: scala.collection.Seq[T]): scala.collection.Seq[T] = events
  def after(events: scala.collection.Seq[T]): Unit = {}
}


text:
package org.apache.cassandra.cql3.functions;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.cassandra.cql3.Json;

import org.apache.cassandra.cql3.QueryOptions;
import org.apache.cassandra.db.marshal.*;
import org.apache.cassandra.exceptions.FunctionExecutionException;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.serializers.MarshalException;
import org.apache.cassandra.transport.ProtocolVersion;

public class FromJsonFct extends NativeScalarFunction
{
    public static final FunctionName NAME = FunctionName.nativeFunction("fromjson");

    private static final Map<AbstractType<?>, FromJsonFct> instances = new ConcurrentHashMap<>();

    public static FromJsonFct getInstance(AbstractType<?> returnType)
    {
        FromJsonFct func = instances.get(returnType);
        if (func == null)
        {
            func = new FromJsonFct(returnType);
            instances.put(returnType, func);
        }
        return func;
    }

    private FromJsonFct(AbstractType<?> returnType)
    {
        super("fromjson", returnType, UTF8Type.instance);
    }

    public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters)
    {
        assert parameters.size() == 1 : "Unexpectedly got " + parameters.size() + " arguments for fromJson()";
        ByteBuffer argument = parameters.get(0);
        if (argument == null)
            return null;

        String jsonArg = UTF8Type.instance.getSerializer().deserialize(argument);
        try
        {
            Object object = Json.JSON_OBJECT_MAPPER.readValue(jsonArg, Object.class);
            if (object == null)
                return null;
            return returnType.fromJSONObject(object).bindAndGet(QueryOptions.forProtocolVersion(protocolVersion));
        }
        catch (IOException exc)
        {
            throw FunctionExecutionException.create(NAME, Collections.singletonList("text"),
                                                    String.format("Could not decode JSON string '%s': %s", jsonArg, exc));
        }
        catch (MarshalException exc)
        {
            throw FunctionExecutionException.create(this, exc);
        }
    }

    public static void addFunctionsTo(NativeFunctions functions)
    {
        functions.add(new FunctionFactory(NAME.name, FunctionParameter.fixed(UTF8Type.instance))
        {
            @Override
            protected NativeFunction doGetOrCreateFunction(List<AbstractType<?>> argTypes, AbstractType<?> receiverType)
            {
                if (receiverType == null)
                    throw new InvalidRequestException("fromJson() cannot be used in the selection clause of a SELECT statement");

                return FromJsonFct.getInstance(receiverType);
            }
        });
    }
}


text:
/**
 * Created by amos on 14-4-24.
 */
LBF.define('qidian.comp.LightTip', function(require, exports, module){
    var LightTip = require('ui.widget.LightTip.LightTip'),
        $ = require('lib.jQuery'),
        extend = require('lang.extend');

    var MAX_ZINDEX = 2147483647; //传说中的z-index最大值
    var defaults = {
        hide: {
            delay: 2000
        },
        modal: false,
        events: {
            load: function() {
                var self = this;
                setTimeout(function() {
                    self.$el.css('z-index', MAX_ZINDEX); //和流氓扩展做斗争,夺回最大值
                }, 20);
            }
        }
    };

    exports = module.exports = LightTip.inherit({});

    exports.success = function(content, options){
        if(content)//防止传入空参数时报错
        return new LightTip(extend({}, defaults, options, {content: '' + content}));
    };

    exports.error = function(content, options){
        if(content)
        return new LightTip(extend({}, defaults, options, {content: '' + content.toString().replace(/^Error:/,''), className: 'lbf-light-tip-error'}));
    };

    exports.tip = function(content, options){
        if(content)
        return new LightTip(extend({}, defaults, options, {content: content, className: 'lbf-light-tip-normal'}));
    };
});


text:
using System.ComponentModel.Composition;
using WEditor.ComponentLibBase;

namespace WEditor.DefaultComponents
{
    [Export(typeof(IGameComponent))]
    [ExportMetadata("Type", typeof(CameraComponent))]
    class CameraComponent : IGameComponent
    {
        public float Zoom { get; set; }
        public CameraComponent()
        {
            Zoom = 1f;
        }
    }
}


text:
#import "NSObject.h"

@class NSMutableDictionary, NSObject<OS_dispatch_queue>;

// Not exported
@interface TSPDocumentResourceDownloadObserverManager : NSObject
{
    NSObject<OS_dispatch_queue> *_accessQueue;
    NSMutableDictionary *_downloadObserversMap;
}

+ (id)sharedManager;
- (void).cxx_destruct;
- (void)postNotification:(long long)arg1 forDigestString:(id)arg2 wait:(_Bool)arg3;
- (void)addDownloadObserver:(id)arg1 forData:(id)arg2 digestString:(id)arg3 isInternalObserver:(_Bool)arg4 completionHandler:(id)arg5;
- (id)init;

@end


text:
<?php

namespace Fanta\ManagerBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Fanta\ManagerBundle\Entity\FantaTeam
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Fanta\ManagerBundle\Entity\FantaTeamRepository")
 */
class FantaTeam
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * @ORM\OneToOne(targetEntity="User")
     */
    private $user;

    /**
     * @ORM\ManyToMany(targetEntity="Player")
     * @ORM\JoinTable(name="FantaTeamsPlayers",
     *      joinColumns={@ORM\JoinColumn(name="fanta_team_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="player_id", referencedColumnName="id")}
     *      )
     * @ORM\OrderBy({"role" = "DESC"})
     */
    private $players;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set user
     *
     * @param Fanta\ManagerBundle\Entity\User $user
     */
    public function setUser(\Fanta\ManagerBundle\Entity\User $user)
    {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return Fanta\ManagerBundle\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }
    public function __construct()
    {
        $this->fanta_team_player = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add players
     *
     * @param Fanta\ManagerBundle\Entity\Player $players
     */
    public function addPlayer(\Fanta\ManagerBundle\Entity\Player $players)
    {
        $this->players[] = $players;
    }

    /**
     * Get players
     *
     * @return Doctrine\Common\Collections\Collection
     */
    public function getPlayers()
    {
        return $this->players;
    }

    public function __toString()
    {
        return $this->name;
    }
}


text:
import toDate from '../toDate/index.js'

/**
 * @name getSeconds
 * @category Second Helpers
 * @summary Get the seconds of the given date.
 *
 * @description
 * Get the seconds of the given date.
 *
 * ### v2.0.0 breaking changes:
 *
 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
 *
 * @param {Date|Number} date - the given date
 * @returns {Number} the seconds
 * @throws {TypeError} 1 argument required
 *
 * @example
 * // Get the seconds of 29 February 2012 11:45:05.123:
 * var result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))
 * //=> 5
 */
export default function getSeconds(dirtyDate) {
  if (arguments.length < 1) {
    throw new TypeError(
      '1 argument required, but only ' + arguments.length + ' present'
    )
  }

  var date = toDate(dirtyDate)
  var seconds = date.getSeconds()
  return seconds
}


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

/*=====================================================================
**
** Source:  test5.c (DuplicateHandle)
**
** Purpose: Tests the PAL implementation of the DuplicateHandle function,
**          with CreatePipe. This test will create a pipe and write to it,
**          the duplicate the read handle and read what was written.
**
** Depends: WriteFile
**          ReadFile
**          memcmp
**          CloseHandle
**
**
**===================================================================*/

#include <palsuite.h>

const char* cTestString = "one fish, two fish, red fish, blue fish.";

int __cdecl main(int argc, char **argv)
{
    HANDLE  hReadPipe   = NULL;
    HANDLE  hWritePipe  = NULL;
    HANDLE  hDupPipe    = NULL;
    BOOL    bRetVal     = FALSE;
    DWORD   dwBytesWritten;
    DWORD   dwBytesRead;
    char    buffer[256];

    SECURITY_ATTRIBUTES lpPipeAttributes;

    /*Initialize the PAL*/
    if ((PAL_Initialize(argc, argv)) != 0)
    {
        return (FAIL);
    }

    /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
    lpPipeAttributes.nLength              = sizeof(lpPipeAttributes);
    lpPipeAttributes.lpSecurityDescriptor = NULL;
    lpPipeAttributes.bInheritHandle       = TRUE;

    /*Create a Pipe*/
    bRetVal = CreatePipe(&hReadPipe,       /* read handle*/
                         &hWritePipe,      /* write handle */
                         &lpPipeAttributes,/* security attributes*/
                         0);               /* pipe size*/
    if (bRetVal == FALSE)
    {
        Fail("ERROR:%u:Unable to create pipe\n", GetLastError());
    }

    /*Write to the write pipe handle*/
    bRetVal = WriteFile(hWritePipe,         /* handle to write pipe*/
                        cTestString,        /* buffer to write*/
                        strlen(cTestString),/* number of bytes to write*/
                        &dwBytesWritten,    /* number of bytes written*/
                        NULL);              /* overlapped buffer*/
    if (bRetVal == FALSE)
    {
        Trace("ERROR:%u:unable to write to write pipe handle "
            "hWritePipe=0x%lx\n", GetLastError(), hWritePipe);
        CloseHandle(hReadPipe);
        CloseHandle(hWritePipe);
        Fail("");
    }

    /*Duplicate the pipe handle*/
    if (!(DuplicateHandle(GetCurrentProcess(),       /* source handle process*/
                          hReadPipe,                 /* handle to duplicate*/
                          GetCurrentProcess(),       /* target process handle*/
                          &hDupPipe,                 /* duplicate handle*/
                          GENERIC_READ|GENERIC_WRITE,/* requested access*/
                          FALSE,                     /* handle inheritance*/
                          DUPLICATE_SAME_ACCESS)))   /* optional actions*/
    {
        Trace("ERROR:%u:Fail to create the duplicate handle"
             " to hReadPipe=0x%lx",
             GetLastError(),
             hReadPipe);
        CloseHandle(hReadPipe);
        CloseHandle(hWritePipe);
        Fail("");
    }

    /*Read from the duplicated handle, 256 bytes, more bytes
     than actually written. This will allow us to use the
     value that ReadFile returns for comparision.*/
    bRetVal = ReadFile(hDupPipe,           /* handle to read pipe*/
                       buffer,             /* buffer to write to*/
                       256,                /* number of bytes to read*/
                       &dwBytesRead,       /* number of bytes read*/
                       NULL);              /* overlapped buffer*/
    if (bRetVal == FALSE)
    {
        Trace("ERROR:%u:unable read from the duplicated pipe "
             "hDupPipe=0x%lx\n",
             GetLastError(),
             hDupPipe);
        CloseHandle(hReadPipe);
        CloseHandle(hWritePipe);
        CloseHandle(hDupPipe);
        Fail("");
    }

    /*Compare what was read with what was written.*/
    if ((memcmp(cTestString, buffer, dwBytesRead)) != 0)
    {
        Trace("ERROR:%u: read \"%s\" expected \"%s\" \n",
               GetLastError(),
               buffer,
               cTestString);
        CloseHandle(hReadPipe);
        CloseHandle(hWritePipe);
        CloseHandle(hDupPipe);
        Fail("");
    }

    /*Compare values returned from WriteFile and ReadFile.*/
    if (dwBytesWritten != dwBytesRead)
    {
        Trace("ERROR:%u: WriteFile wrote \"%s\", but ReadFile read \"%s\","
             " these should be the same\n",
             GetLastError(),
             buffer,
             cTestString);
        CloseHandle(hReadPipe);
        CloseHandle(hWritePipe);
        CloseHandle(hDupPipe);
        Fail("");
    }

    /*Cleanup.*/
    CloseHandle(hWritePipe);
    CloseHandle(hReadPipe);
    CloseHandle(hDupPipe);

    PAL_Terminate();
    return (PASS);
}


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Resources.ProviderFeatures
{
    using System;
    using System.Collections.Generic;
    using System.Management.Automation;
    using Microsoft.Azure.Commands.Resources.Models.ProviderFeatures;

    /// <summary>
    /// Gets the preview features of a certain azure resource provider.
    /// </summary>
    [Cmdlet(VerbsCommon.Get, "AzureRMProviderFeature", DefaultParameterSetName = GetAzureProviderFeatureCmdlet.ListAvailableParameterSet)]
    [OutputType(typeof(List<PSProviderFeature>))]
    public class GetAzureProviderFeatureCmdlet : AzureProviderFeatureCmdletBase
    {
        /// <summary>
        /// The filter unregistered parameter set
        /// </summary>
        public const string ListAvailableParameterSet = "ListAvailableParameterSet";

        /// <summary>
        /// The get feature parameter set
        /// </summary>
        public const string GetFeatureParameterSet = "GetFeature";

        /// <summary>
        /// Gets or sets the provider namespace
        /// </summary>
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource provider namespace.", ParameterSetName = GetAzureProviderFeatureCmdlet.GetFeatureParameterSet)]
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource provider namespace.", ParameterSetName = GetAzureProviderFeatureCmdlet.ListAvailableParameterSet)]
        [ValidateNotNullOrEmpty]
        public string ProviderNamespace { get; set; }

        /// <summary>
        /// Gets or sets the feature name
        /// </summary>
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The feature name.", ParameterSetName = GetAzureProviderFeatureCmdlet.GetFeatureParameterSet)]
        [ValidateNotNullOrEmpty]
        public string FeatureName { get; set; }

        /// <summary>
        /// Gets or sets a switch indicating whether to list all available features or just the ones registered with the current subscription
        /// </summary>
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "When set, lists all available features including those not registered with the current subscription.", ParameterSetName = GetAzureProviderFeatureCmdlet.ListAvailableParameterSet)]
        public SwitchParameter ListAvailable { get; set; }

        protected override void ProcessRecord()
        {
            var parameterSetName = this.DetermineParameterSetName();

            switch (parameterSetName)
            {
                case GetAzureProviderFeatureCmdlet.ListAvailableParameterSet:
                    this.WriteObject(this.ProviderFeatureClient.ListPSProviderFeatures(this.ListAvailable, this.ProviderNamespace), enumerateCollection: true);
                    break;

                case GetAzureProviderFeatureCmdlet.GetFeatureParameterSet:
                    this.WriteObject(this.ProviderFeatureClient.ListPSProviderFeatures(this.ProviderNamespace, this.FeatureName), enumerateCollection: true);
                    break;

                default:
                    throw new ApplicationException(string.Format("Unknown parameter set encountered: '{0}'", this.ParameterSetName));
            }
        }
    }
}


text:
var http = require('http'),
   express = require('express'),
   config = require('./config'),
   monk = require('monk');

var handlebars = require('express-handlebars').create();
var routes = require('./routes');

var db = monk(config.mongodbendpoint, {
   username: config.mongodbusername,
   password: config.mongodbpassword
});

var app = express();

app.set('port', process.env.PORT || 2997);
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');
app.use(express.static(__dirname + '/public'));
app.use(express.favicon("./public/images/favicon.ico"));
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);
app.post('/api/messages', routes.sendMessage(config.cetoken, config.ceusersecret, config.ceorgsecret, config.email, config.isemailon));

http.createServer(app).listen(app.get('port'), function () {
  console.log('Express server listening on port ' + app.get('port'));
});


text:
#pragma once

#include "StackVec.h"
#include "TargetPhrase.h"
#include "TargetPhraseCollection.h"
#include "Range.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include "ChartTranslationOption.h"

namespace Moses
{
class ChartTranslationOption;
class InputPath;
class InputType;

/** Similar to a DottedRule, but contains a direct reference to a list
 * of translations and provdes an estimate of the best score. For a specific range in the input sentence
 */
class ChartTranslationOptions
{
  friend std::ostream& operator<<(std::ostream&, const ChartTranslationOptions&);

public:
  typedef std::vector<boost::shared_ptr<ChartTranslationOption> > CollType;

  /** Constructor
      \param targetPhraseColl @todo dunno
      \param stackVec @todo dunno
      \param range the range in the source sentence this translation option covers
      \param score @todo dunno
   */
  ChartTranslationOptions(const TargetPhraseCollection &targetPhraseColl,
                          const StackVec &stackVec,
                          const Range &range,
                          float score);
  ~ChartTranslationOptions();

  static float CalcEstimateOfBestScore(const TargetPhraseCollection &,
                                       const StackVec &);

  size_t GetSize() const {
    return m_collection.size();
  }

  //! @todo dunno
  const StackVec &GetStackVec() const {
    return m_stackVec;
  }

  //! @todo isn't the translation suppose to just contain 1 target phrase, not a whole collection of them?
  const CollType &GetTargetPhrases() const {
    return m_collection;
  }

  //! the range in the source sentence this translation option covers
  const Range &GetSourceWordsRange() const {
    return *m_wordsRange;
  }

  /** return an estimate of the best score possible with this translation option.
    * the estimate is the sum of the top target phrase's estimated score plus the
    * scores of the best child hypotheses.
    */
  inline float GetEstimateOfBestScore() const {
    return m_estimateOfBestScore;
  }

  void EvaluateWithSourceContext(const InputType &input, const InputPath &inputPath);

  void SetInputPath(const InputPath *inputPath);

  void CreateSourceRuleFromInputPath();

private:

  StackVec m_stackVec; //! vector of hypothesis list!
  CollType m_collection;

  const Range *m_wordsRange;
  float m_estimateOfBestScore;
};

}


text:
package main

import (
	"flag"
	"goim/libs/perf"
	"runtime"

	log "github.com/thinkboy/log4go"
)

var (
	DefaultServer    *Server
	DefaultWhitelist *Whitelist
	Debug            bool
)

func main() {
	flag.Parse()
	if err := InitConfig(); err != nil {
		panic(err)
	}
	Debug = Conf.Debug
	runtime.GOMAXPROCS(Conf.MaxProc)
	log.LoadConfiguration(Conf.Log)
	defer log.Close()
	log.Info("comet[%s] start", Ver)
	// white list log
	if wl, err := NewWhitelist(Conf.WhiteLog, Conf.Whitelist); err != nil {
		panic(err)
	} else {
		DefaultWhitelist = wl
	}
	perf.Init(Conf.PprofBind)
	// logic rpc
	if err := InitLogicRpc(Conf.LogicAddrs); err != nil {
		log.Warn("logic rpc current can't connect, retry")
	}
	// new server
	buckets := make([]*Bucket, Conf.Bucket)
	for i := 0; i < Conf.Bucket; i++ {
		buckets[i] = NewBucket(BucketOptions{
			ChannelSize:   Conf.BucketChannel,
			RoomSize:      Conf.BucketRoom,
			RoutineAmount: Conf.RoutineAmount,
			RoutineSize:   Conf.RoutineSize,
		})
	}
	round := NewRound(RoundOptions{
		Reader:       Conf.TCPReader,
		ReadBuf:      Conf.TCPReadBuf,
		ReadBufSize:  Conf.TCPReadBufSize,
		Writer:       Conf.TCPWriter,
		WriteBuf:     Conf.TCPWriteBuf,
		WriteBufSize: Conf.TCPWriteBufSize,
		Timer:        Conf.Timer,
		TimerSize:    Conf.TimerSize,
	})
	operator := new(DefaultOperator)
	DefaultServer = NewServer(buckets, round, operator, ServerOptions{
		CliProto:         Conf.CliProto,
		SvrProto:         Conf.SvrProto,
		HandshakeTimeout: Conf.HandshakeTimeout,
		TCPKeepalive:     Conf.TCPKeepalive,
		TCPRcvbuf:        Conf.TCPRcvbuf,
		TCPSndbuf:        Conf.TCPSndbuf,
	})
	// white list
	// tcp comet
	if err := InitTCP(Conf.TCPBind, Conf.MaxProc); err != nil {
		panic(err)
	}
	// websocket comet
	if err := InitWebsocket(Conf.WebsocketBind); err != nil {
		panic(err)
	}
	// flash safe policy
	if Conf.FlashPolicyOpen {
		if err := InitFlashPolicy(); err != nil {
			panic(err)
		}
	}
	// wss comet
	if Conf.WebsocketTLSOpen {
		if err := InitWebsocketWithTLS(Conf.WebsocketTLSBind, Conf.WebsocketCertFile, Conf.WebsocketPrivateFile); err != nil {
			panic(err)
		}
	}
	// start rpc
	if err := InitRPCPush(Conf.RPCPushAddrs); err != nil {
		panic(err)
	}
	// block until a signal is received.
	InitSignal()
}


text:
// This file was automatically generated by the code gen tool - do not modify.

using System ;
using scg = System.Collections.Generic ;
using sd = System.Data ;
using sds = System.Data.SqlClient ;
using sr = System.Reflection ;
using mst = Microsoft.SqlServer.Types ;
using mss = Microsoft.SqlServer.Server ;
using acr = alby.codegen.runtime ;
using ns = alby.northwind.codegen;

namespace alby.northwind.codegen.query
{
	public partial class TestQuery01Factory : acr.FactoryBase< TestQuery01, ns.database.NorthwindDatabaseSingletonHelper, ns.database.NorthwindDatabase >
	{
		static TestQuery01Factory()
		{
			_assemblyˡ = sr.Assembly.GetExecutingAssembly() ;
			_selectˡ = "alby.northwind.codegen.query.sql.TestQuery01.Select.sql" ;
		}

		public scg.List<TestQuery01> LoadByTheKey
		(
			sds.SqlConnection connˡ,
			int theKey,
			int? topNˡ = null,
			scg.List<acr.CodeGenOrderBy> orderByˡ = null,
			sds.SqlTransaction tranˡ = null
		)
		{
			scg.List<sds.SqlParameter> parametersˡ = new scg.List<sds.SqlParameter>();
			base.AddParameterˡ( parametersˡ, "@theKey", theKey );
			string whereˡ = "alby.northwind.codegen.query.sql.TestQuery01.LoadByTheKey.sql";
			string sqlˡ = "" ;
			return base.ExecuteQueryˡ( connˡ, tranˡ, parametersˡ, _assemblyˡ, _selectˡ, true, whereˡ, true, topNˡ, orderByˡ, out sqlˡ ) ;
		}

	}

}


text:
package org.apache.ibatis.metadata;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DatabaseFactory {
  private DatabaseFactory() {
  }

  public static Database newDatabase(Connection conn, String catalogFilter, String schemaFilter) throws SQLException {
    Database database = new Database(catalogFilter, schemaFilter);
    ResultSet rs = null;
    try {
      DatabaseMetaData dbmd = conn.getMetaData();

      try {
        rs = dbmd.getColumns(catalogFilter, schemaFilter, null, null);
        while (rs.next()) {
          String catalogName = rs.getString("TABLE_CAT");
          String schemaName = rs.getString("TABLE_SCHEM");
          String tableName = rs.getString("TABLE_NAME");
          String columnName = rs.getString("COLUMN_NAME");
          int dataType = Integer.parseInt(rs.getString("DATA_TYPE"));
          Table table = database.getTable(tableName);
          if (table == null) {
            table = new Table(tableName);
            table.setCatalog(catalogName);
            table.setSchema(schemaName);
            database.addTable(table);
          }
          table.addColumn(new Column(columnName, dataType));
        }
      } finally {
        if (rs != null) rs.close();
      }

      try {
        String[] tableNames = database.getTableNames();
        for (int i = 0; i < tableNames.length; i++) {
          Table table = database.getTable(tableNames[i]);
          rs = dbmd.getPrimaryKeys(catalogFilter, schemaFilter, table.getName());
          if (rs.next()) {
            String columnName = rs.getString("COLUMN_NAME");
            table.setPrimaryKey(table.getColumn(columnName));
          }
        }
      } finally {
        if (rs != null) rs.close();
      }

    } finally {
      try {
        conn.rollback();
      } catch (Exception e) { /*ignore*/ }
    }
    return database;
  }

}