text:
var gulp = require("gulp");
var gutil = require("gulp-util");
var webpack = require("webpack");
var webpackConfig = require("./webpack.config.js");

gulp.task("default", ["build-dev"]);

gulp.task("build-dev", function() {
  gulp.start('webpack:dev-server');
  gulp.watch(["app/public/scss/**/*"], ["webpack:build-css"]);
});

// Production build
gulp.task("build", ["webpack:build"]);

gulp.task("webpack:build", function(callback) {
  // modify some webpack config options
  var myConfig = Object.create(webpackConfig);
  myConfig.plugins = (myConfig.plugins || []).concat(
    new webpack.DefinePlugin({
      "process.env": {
        // This has effect on the react lib size
        "NODE_ENV": JSON.stringify("production")
      }
    }),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin()
  );

  // run webpack
  webpack(myConfig, function(err, stats) {
    if(err) throw new gutil.PluginError("webpack:build", err);
    gutil.log("[webpack:build]", stats.toString({
      colors: true
    }));
    callback();
  });
});

gulp.task("webpack:dev-server", function(callback) {
  var WebpackDevServer = require("webpack-dev-server");

	// modify some webpack config options
	var myDevConfig = Object.create(webpackConfig);
  myDevConfig.devtool = "sourcemap";
	myDevConfig.debug = true;
  myDevConfig.output.path = "/" + myDevConfig.output.path;
  myDevConfig.output.publicPath = 'http://localhost:8090' + myDevConfig.output.publicPath;

	// Start a webpack-dev-server
	new WebpackDevServer(webpack(myDevConfig), {
		publicPath: myDevConfig.output.publicPath,
		stats: {
      colors: true
    }
	}).listen(8090, "localhost", function(err) {
		if(err) throw new gutil.PluginError("webpack-dev-server", err);
	});
});

gulp.task("build:photos", function(callback) {
  var glob = require('glob');
  var gm = require('gm');

  glob('photos/full/**/*.jpg', function(err, files) {
    var numProcessed = 0;
    files.forEach(function(file) {
      gm(file)
        .quality(80)
        .resize(500)
        .write('photos/thumb/' + file.substr('photos/full/'.length), function(err) {
          if (err) {
            console.log(err);
          }
          numProcessed++;
          if (numProcessed === files.length) {
            callback();
          }
        });
    });
  });
});

gulp.task("webpack:build-css", function() {
  var sass = require('gulp-sass');

  gulp.src('app/public/scss/*.scss')
    .pipe(sass())
    .pipe(gulp.dest('app/public/css'));
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Openbizx Cubi Application Platform
  LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  Copyright (c) 2005-2011, Openbiz Technology LLC
  Version $Id: GroupDetailForm.xml 3372 2012-05-31 06:19:06Z rockyswen@gmail.com $
-->
<EasyForm Name="GroupDetailForm" Class="EasyForm" FormType=""  Icon="icon_group_list.gif" jsClass="jbForm" Title="Group Detail" Description="User Group controls users data level visibility in the system." BizDataObj="system.do.GroupDO" TemplateEngine="Smarty" TemplateFile="system_right_detailform.tpl.html" EventName="" MessageFile="">
    <DataPanel>
		<Element Name="fld_Id" ElementSet="General" Hidden="Y" Class="LabelText" FieldName="Id" Label="Id" AllowURLParam="Y"/>
       	<Element Name="fld_name" ElementSet="General" Class="LabelText" FieldName="name" Label="Name" AllowURLParam="N"/>
       	<Element Name="fld_description" ElementSet="General" Class="LabelText" FieldName="description" Label="Description" AllowURLParam="N"/>
		<Element Name="fld_status" Class="LabelBool" ElementSet="General" FieldName="status" Label="Status" Link="javascript:;">
			<EventHandler Name="fld_status_onclick" Event="onclick" Function="UpdateFieldValueXor({@:Elem[fld_Id].Value},fld_status,{@:Elem[fld_status].Value})"/>
		</Element>
		<Element Name="fld_default" Class="LabelBool" ElementSet="General" FieldName="default" Label="Default" Link="javascript:;">
			<EventHandler Name="fld_default_onclick" Event="onclick" Function="UpdateFieldValueXor({@:Elem[fld_Id].Value},fld_default,{@:Elem[fld_default].Value})"/>
		</Element>
		<!--

		     <Element Name="fld_create_by" Class="LabelText" ElementSet="Miscellaneous" FieldName="create_by" Label="Create By" Text="{\Openbizx\Openbizx::$app->getProfile()->getProfileName(@:Elem[fld_create_by].Value)}" AllowURLParam="N"/>
		        <Element Name="fld_create_time" Class="LabelText" ElementSet="Miscellaneous" FieldName="create_time" Label="Create Time" AllowURLParam="N"/>
		        <Element Name="fld_update_by" Class="LabelText" ElementSet="Miscellaneous" FieldName="update_by" Label="Update By"  Text="{\Openbizx\Openbizx::$app->getProfile()->getProfileName(@:Elem[fld_update_by].Value)}" AllowURLParam="N"/>
		        <Element Name="fld_update_time" Class="LabelText" ElementSet="Miscellaneous" FieldName="update_time" Label="Update Time" AllowURLParam="N"/>
				-->
    </DataPanel>
    <ActionPanel>
        <Element Name="btn_new" Class="Button" Text="Add" CssClass="button_gray_add" Description="new record (Insert)">
			<EventHandler Name="btn_new_onclick" Event="onclick" Function="SwitchForm(system.form.GroupNewForm)"  ShortcutKey="Insert" ContextMenu="New" />
        </Element>
        <Element Name="btn_edit" Class="Button" Text="Edit" CssClass="button_gray_m" Description="edit record (Ctrl+E)">
			<EventHandler Name="btn_new_onclick" Event="onclick" Function="SwitchForm(system.form.GroupEditForm,{@:Elem[fld_Id].Value})"  ShortcutKey="Ctrl+E" ContextMenu="Edit" />
        </Element>
        <Element Name="btn_delete" Class="Button" Text="Delete" CssClass="button_gray_m" Description="delete record (Delete)">
            <EventHandler Name="del_onclick" Event="onclick" EventLogMsg="" Function="DeleteRecord({@:Elem[fld_Id].Value})"  RedirectPage="{OPENBIZ_APP_INDEX_URL}/system/group_list" ShortcutKey="Ctrl+Delete" ContextMenu="Delete" />
        </Element>
        <Element Name="btn_cancel" Class="Button" Text="Back" CssClass="button_gray_m">
            <EventHandler Name="btn_cancel_onclick" Event="onclick" Function="SwitchForm(system.form.GroupListForm)"  ShortcutKey="Escape" ContextMenu="Cancel" />
        </Element>
    </ActionPanel>
    <NavPanel>
    </NavPanel>
    <SearchPanel>
    </SearchPanel>
</EasyForm>

redpajama_set_name: RedPajamaGithub


text:
class Student < ActiveRecord::Base

  # Relationships
  has_many :commitments
  has_many :interests
  belongs_to :user

  #array for Enumerated Values
  GENDER_LIST = [['Male', 'Male'], ['Female', 'Female'], ['Not Specified', 'Not Specified']]
  DORM_LIST = [['Boss', 'Boss'], ['Donner', 'Donner'], ['Greek Housing', 'Greek Housing'], ['Hamerschlag', 'Hamerschlag'], ['McGill', 'McGill'], ['Morewood E-Tower', 'Morewood E-Tower'], ['Morewood Gardens', 'Morewood Gardens'], ['Mudge', 'Mudge'], ['Resnik', 'Resnik'], ['Scobell', 'Scobell'], ['Stever', 'Stever'], ['Welch', 'Welch'], ['West Wing', 'West Wing'], ['Off-campus', 'Off-campus']]
  CLASS_LIST = [['2016', 2016], ['2017', 2017], ['2018', 2018], ['2019', 2019], ['2020', 2020], ['2021', 2021]]

  # Allow user to be nested within student
  accepts_nested_attributes_for :user, reject_if: ->(user) { user[:username].blank? }, allow_destroy: true

  #Allow interests to be nested within student
  accepts_nested_attributes_for :interests, reject_if: lambda { |interest| interest[:name].blank? }, allow_destroy: true

  # Scopes
  scope :alphabetical,  -> { order(:last_name).order(:first_name) }
  scope :active,        -> { where(active: true) }
  scope :inactive,      -> { where(active: false) }
  scope :for_dorm, ->(dorm) { where(dorm: dorm) }

  # Validations
  validates_presence_of :last_name, :first_name
  validates_inclusion_of :gender, in: GENDER_LIST.map{|key, value| value}, message: "is not a valid option"
  validates_inclusion_of :dorm, in: DORM_LIST.map{|key, value| value}, message: "is not a valid option"
  validates_inclusion_of :class_year, in: CLASS_LIST.map{|key, value| value}, message: "is not a valid option"

  # Callbacks
  #before_update :deactive_user_if_customer_inactive
  #before_destroy :is_never_destroyable

  # Other methods
  def name
    "#{last_name}, #{first_name}"
  end

  def proper_name
    "#{first_name} #{last_name}"
  end

end


text:
package org.yu55.yagga.impl.mercurial;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.yu55.yagga.common.command.CommandExecutor;
import org.yu55.yagga.common.command.CommandOutput;
import org.yu55.yagga.common.command.CommandOutputLine;
import org.yu55.yagga.common.model.annotate.AnnotateResponse;
import org.yu55.yagga.common.model.annotate.AnnotateResponseLineAssert;
import org.yu55.yagga.common.model.grep.GrepResponseLine;
import org.yu55.yagga.common.model.grep.GrepResponseLineAssert;
import org.yu55.yagga.common.repository.annotate.AnnotateParameters;
import org.yu55.yagga.common.repository.grep.GrepParameters;
import org.yu55.yagga.impl.mercurial.command.common.MercurialCommandExecutorFactory;

public class MercurialRepositoryTest {

    @Test
    public void testRefresh() throws Exception {
        // given
        CommandExecutor executor = mock(CommandExecutor.class);
        MercurialCommandExecutorFactory commandExecutorFactory = mock(MercurialCommandExecutorFactory.class);
        Path repositoryDirectory = mock(Path.class);
        MercurialRepository repository = new MercurialRepository(repositoryDirectory, commandExecutorFactory);

        when(commandExecutorFactory.factorizeRefresh(repository)).thenReturn(executor);

        // when
        repository.refresh();

        // then
        verify(executor).execute();
    }

    @Test
    public void testAnnotate() throws Exception {
        // given
        CommandExecutor executor = mock(CommandExecutor.class);
        MercurialCommandExecutorFactory commandExecutorFactory = mock(MercurialCommandExecutorFactory.class);
        Path repositoryDirectory = mock(Path.class);
        MercurialRepository repository = new MercurialRepository(repositoryDirectory, commandExecutorFactory);

        CommandOutput commandOutput = new CommandOutput(repositoryDirectory.toString())
                .addOutputLine(new CommandOutputLine(
                        "sawickil 699243681ab8 Wed Jan 20 21:58:42 2016 +0100:1: Hello world!"));

        AnnotateParameters annotateParameters = new AnnotateParameters("readme.txt");

        when(commandExecutorFactory.factorizeAnnotate(repository, annotateParameters)).thenReturn(executor);
        when(executor.execute()).thenReturn(commandOutput);

        // when
        AnnotateResponse annotateResponse = repository.annotate(annotateParameters);

        // then
        verify(executor).execute();
        AnnotateResponseLineAssert.assertThat(annotateResponse.getAnnotationResponseLines().get(0))
                .hasCommitId("699243681ab8")
                .hasAuthor("sawickil")
                .hasCommitDate("Wed Jan 20 21:58:42 2016 +0100")
                .hasLineNumber(1)
                .hasLine("Hello world!");
    }

    @Test
    public void testGrep() throws Exception {
        // given
        CommandExecutor executor = mock(CommandExecutor.class);
        MercurialCommandExecutorFactory commandExecutorFactory = mock(MercurialCommandExecutorFactory.class);
        Path repositoryDirectory = Paths.get("repo");
        MercurialRepository repository = new MercurialRepository(repositoryDirectory, commandExecutorFactory);

        CommandOutput commandOutput = new CommandOutput(repositoryDirectory.toString())
                .addOutputLine(
                        new CommandOutputLine(
                                "src/main/java/org/yu55/yagga/Application.java:1:6:@SpringBootApplication"));

        GrepParameters grepParameters = new GrepParameters.Builder("buildscript").build();

        when(commandExecutorFactory.factorizeGrep(repository, grepParameters)).thenReturn(executor);
        when(executor.execute()).thenReturn(commandOutput);

        // when
        List<GrepResponseLine> grep = repository.grep(grepParameters);

        // then
        verify(executor).execute();
        Assertions.assertThat(grep.size()).isEqualTo(1);

        GrepResponseLineAssert.assertThat(grep.get(0))
                .hasFile("src/main/java/org/yu55/yagga/Application.java")
                .hasLineNumber(6)
                .hasMatchedTextLine("@SpringBootApplication")
                .hasRepository("repo");
    }

}


text:
#ifndef qscriptvalueiterator_p_h
#define qscriptvalueiterator_p_h

#include "qscriptvalue_p.h"
#include <JavaScriptCore/JavaScript.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvector.h>

class QScriptValueIteratorPrivate: public QSharedData {
public:
    inline QScriptValueIteratorPrivate(const QScriptValuePrivate* value);
    inline ~QScriptValueIteratorPrivate();

    inline bool hasNext();
    inline void next();

    inline bool hasPrevious();
    inline void previous();

    inline QString name() const;
    inline QScriptStringPrivate* scriptName() const;

    inline QScriptValuePrivate* value() const;
    inline void setValue(const QScriptValuePrivate* value);

    inline void remove();

    inline void toFront();
    inline void toBack();

    QScriptValue::PropertyFlags flags() const;

    inline bool isValid() const;
private:
    inline QScriptEnginePrivate* engine() const;

    QExplicitlySharedDataPointer<QScriptValuePrivate> m_object;
    QVector<JSStringRef> m_names;
    QMutableVectorIterator<JSStringRef> m_idx;
};

inline QScriptValueIteratorPrivate::QScriptValueIteratorPrivate(const QScriptValuePrivate* value)
    : m_object(const_cast<QScriptValuePrivate*>(value))
    , m_idx(m_names)
{
    if (m_object->isObject()) {
        m_names = engine()->objectGetOwnPropertyNames(*m_object);
        m_idx = m_names;
    } else
        m_object = 0;
}

inline QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate()
{
    QVector<JSStringRef>::const_iterator i = m_names.constBegin();
    for (; i != m_names.constEnd(); ++i)
        JSStringRelease(*i);
}

inline bool QScriptValueIteratorPrivate::hasNext()
{
    return m_idx.hasNext();
}

inline void QScriptValueIteratorPrivate::next()
{
    // FIXME (Qt5) This method should return a value (QTBUG-11226).
    m_idx.next();
}

inline bool QScriptValueIteratorPrivate::hasPrevious()
{
    return m_idx.hasPrevious();
}

inline void QScriptValueIteratorPrivate::previous()
{
    m_idx.previous();
}

inline QString QScriptValueIteratorPrivate::name() const
{
    if (!isValid())
        return QString();
    return QScriptConverter::toString(m_idx.value());
}

inline QScriptStringPrivate* QScriptValueIteratorPrivate::scriptName() const
{
    if (!isValid())
        return new QScriptStringPrivate();
    return new QScriptStringPrivate(QScriptConverter::toString(m_idx.value()));
}

inline QScriptValuePrivate* QScriptValueIteratorPrivate::value() const
{
    if (!isValid())
        return new QScriptValuePrivate();
    JSValueRef exception = 0;
    JSValueRef value = m_object->property(m_idx.value(), &exception);
    engine()->setException(exception);
    return new QScriptValuePrivate(engine(), value);
}

inline void QScriptValueIteratorPrivate::setValue(const QScriptValuePrivate* value)
{
    if (!isValid())
        return;
    JSValueRef exception = 0;
    m_object->setProperty(m_idx.value(), *value, /* flags */ 0, &exception);
    engine()->setException(exception);
}

inline void QScriptValueIteratorPrivate::remove()
{
    if (!isValid())
        return;
    JSValueRef exception = 0;
    m_object->deleteProperty(m_idx.value(), &exception);
    engine()->setException(exception);
    m_idx.remove();
}

inline void QScriptValueIteratorPrivate::toFront()
{
    m_idx.toFront();
}

inline void QScriptValueIteratorPrivate::toBack()
{
    m_idx.toBack();
}

QScriptValue::PropertyFlags QScriptValueIteratorPrivate::flags() const
{
    if (!isValid())
        return QScriptValue::PropertyFlags(0);
    return m_object->propertyFlags(m_idx.value(), QScriptValue::ResolveLocal);
}

inline bool QScriptValueIteratorPrivate::isValid() const
{
    return m_object;
}

inline QScriptEnginePrivate* QScriptValueIteratorPrivate::engine() const
{
    Q_ASSERT(isValid());
    return m_object->engine();
}

#endif // qscriptvalueiterator_p_h


text:
import React from 'react'
import Form from 'react-jsonschema-form'

import { Msg } from './messages'

const schema = {
  type: 'object',
  required: ['name'],
  properties: {
    name: { type: 'string', title: 'Your name', default: '' },
    feedback: { type: 'string', title: 'Feedback', default: '' }
  }
}
const uiSchema = {
  feedback: { 'ui:widget': 'textarea' }
}

export default class About extends React.Component {

  onSubmit = (ev) => {
    alert(`Hi ${ev.formData.name}, this is just an example.\nData will not be submitted.\nIf you want to contact me, please file a Github issue.`)
  }

  render () {
    return (

<Msg s="title"/>

<Msg s="intro"/>

          <Form schema={schema} uiSchema={uiSchema}
                autoFocus={true} showErrorList={false}
                onSubmit={this.onSubmit}>
          </Form>

    )
  }
}


text:
package org.zstack.header.volume;

/**
 * Created by frank on 4/20/2015.
 */
public class VolumeDeletionStruct extends VolumeInventory {
    private boolean detachBeforeDeleting;
    private String deletionPolicy;

    public VolumeDeletionStruct() {
    }

    public String getDeletionPolicy() {
        return deletionPolicy;
    }

    public void setDeletionPolicy(String deletionPolicy) {
        this.deletionPolicy = deletionPolicy;
    }

    public VolumeDeletionStruct(VolumeInventory other) {
        super(other);
    }

    public boolean isDetachBeforeDeleting() {
        return detachBeforeDeleting;
    }

    public void setDetachBeforeDeleting(boolean detachBeforeDeleting) {
        this.detachBeforeDeleting = detachBeforeDeleting;
    }
}


text:
package cn.net.normcore.iorder.vo.business;

import cn.net.normcore.iorder.entity.business.Shop;
import cn.net.normcore.iorder.entity.business.Shopman;
import cn.net.normcore.iorder.vo.BaseVo;

/**
 * Created by 81062 on 2017/3/21.
 */
public class ShopmanVo extends BaseVo {
    private String account;  //登陆账号,可以是餐厅名字或店主手机号码
    private String password;  //登陆时的密码
    private String loginName;  //登录名
    private String realName;  //真实姓名
    private String mobile;  //手机号码
    private String shopName;  //店主的商店

    public static ShopmanVo fromShopman(Shopman shopman) {
        ShopmanVo shopmanVo = new ShopmanVo();
        shopmanVo.setId(shopman.getId());
        shopmanVo.setLoginName(shopman.getLoginName());
        shopmanVo.setRealName(shopman.getRealName());
        shopmanVo.setMobile(shopman.getMobile());
        shopmanVo.setShopName(shopman.getShop().getName());
        return shopmanVo;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }
}


text:
import vtk

def setup():
    # create a rendering window and renderer
    ren = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)

    # create a renderwindowinteractor
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    return ren,renWin,iren

def create_sphere(ren=None,r=5.0,center=(0,0,0)):
    if ren is None:
        ren,renWin,iren=setup()

    # create source
    source = vtk.vtkSphereSource()
    source.SetCenter(0,0,0)
    source.SetRadius(5.0)

    # mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInput(source.GetOutput())

    # actor
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)

    # assign actor to the renderer
    ren.AddActor(actor)
    return source


text:
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package google.registry.tools;

import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;

import google.registry.model.domain.Domain;
import google.registry.model.domain.Period;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.FakeClock;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/** Unit tests for {@link GetClaimsListCommand}. */
class GetHistoryEntriesCommandTest extends CommandTestCase<GetHistoryEntriesCommand> {

  private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z"));

  private Domain domain;

  @BeforeEach
  void beforeEach() {
    createTld("tld");
    domain = persistActiveDomain("example.tld");
  }

  @Test
  void testSuccess_works() throws Exception {
    persistResource(
        makeHistoryEntry(
            domain,
            HistoryEntry.Type.DOMAIN_CREATE,
            Period.create(1, Period.Unit.YEARS),
            "created",
            clock.nowUtc()));
    runCommand("--id=example.tld", "--type=DOMAIN");
    assertStdoutIs(
        "Client: TheRegistrar\n"
            + "Time: 2000-01-01T00:00:00.000Z\n"
            + "Client TRID: ABC-123\n"
            + "Server TRID: server-trid\n"
            + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
            + "<xml/>\n"
            + "\n");
  }

  @Test
  void testSuccess_nothingBefore() throws Exception {
    persistResource(
        makeHistoryEntry(
            domain,
            HistoryEntry.Type.DOMAIN_CREATE,
            Period.create(1, Period.Unit.YEARS),
            "created",
            clock.nowUtc()));
    runCommand("--before", clock.nowUtc().minusMinutes(1).toString());
    assertStdoutIs("");
  }

  @Test
  void testSuccess_nothingAfter() throws Exception {
    persistResource(
        makeHistoryEntry(
            domain,
            HistoryEntry.Type.DOMAIN_CREATE,
            Period.create(1, Period.Unit.YEARS),
            "created",
            clock.nowUtc()));
    runCommand("--after", clock.nowUtc().plusMinutes(1).toString());
    assertStdoutIs("");
  }

  @Test
  void testSuccess_withinRange() throws Exception {
    persistResource(
        makeHistoryEntry(
            domain,
            HistoryEntry.Type.DOMAIN_CREATE,
            Period.create(1, Period.Unit.YEARS),
            "created",
            clock.nowUtc()));
    runCommand(
        "--after",
        clock.nowUtc().minusMinutes(1).toString(),
        "--before",
        clock.nowUtc().plusMinutes(1).toString());
    assertStdoutIs(
        "Client: TheRegistrar\n"
            + "Time: 2000-01-01T00:00:00.000Z\n"
            + "Client TRID: ABC-123\n"
            + "Server TRID: server-trid\n"
            + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
            + "<xml/>\n"
            + "\n");
  }

  @Test
  void testSuccess_noTrid() throws Exception {
    persistResource(
        makeHistoryEntry(
                domain,
                HistoryEntry.Type.DOMAIN_CREATE,
                Period.create(1, Period.Unit.YEARS),
                "created",
                clock.nowUtc())
            .asBuilder()
            .setTrid(null)
            .build());
    runCommand("--id=example.tld", "--type=DOMAIN");
    assertStdoutIs(
        "Client: TheRegistrar\n"
            + "Time: 2000-01-01T00:00:00.000Z\n"
            + "Client TRID: null\n"
            + "Server TRID: null\n"
            + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
            + "<xml/>\n"
            + "\n");
  }
}


text:
package com.sagui.forms.crud;

import java.beans.PropertyChangeListener;
import java.util.Collection;

import com.sagui.dataset.commons.dataset.IBookmark;
import com.sagui.dataset.commons.i18n.I18n;
import com.sagui.forms.FatuActionEventHandler;
import com.sagui.forms.FatuReflectActionListener;
import com.sagui.forms.FatuReflectPropertyChangedListener;
import com.sagui.model.FatuComponent;
import com.sagui.model.action.IFatuActionEvent;
import com.sagui.model.action.IFatuActionListener;
import com.sagui.model.button.FatuButton;
import com.sagui.model.container.panel.FatuPanel;
import com.sagui.model.container.toolbar.FatuToolbar;
import com.sagui.model.datamodel.IFatuTableModel;
import com.sagui.model.editable.editbox.FatuTextBox;
import com.sagui.model.feature.FatuSize;
import com.sagui.model.grid.FatuGrid;
import com.sagui.model.layout.border.FatuBorderLayout;
import com.sagui.model.layout.border.FatuBorderLayoutRule;
import com.sagui.model.layout.box.FatuVBoxLayout;
import com.sagui.model.layout.fit.FatuFitLayout;
import com.sagui.model.layout.fit.FatuFitLayoutRule;
import com.sagui.model.selection.IFatuSelectionListener;
import com.sagui.model.selection.IFatuSelectionModel;

public abstract class FatuAbstractCrudPanel<M> extends FatuPanel<FatuBorderLayout> {

    private final I18n btnNew_I18N;
    private final I18n btnSearch_I18N;
    private final I18n btnSave_I18N;
    private final I18n btnDelete_I18N;

    private final IFatuActionListener defaultActionListener;
    private final PropertyChangeListener defaultPropertyChangeListener;

    private FatuToolbar<FatuComponent> toolbar;
    private FatuPanel<FatuVBoxLayout> contentPanel;
    private FatuGrid grid;

    private FatuTextBox tBoxSearchValue;

    private FatuButton btnNew;
    private FatuButton btnSave;
    private FatuButton btnDelete;
    private FatuButton btnSearch;

    private IFatuTableModel<M> tableModel;
    private IFatuSelectionModel<IBookmark<M>> selectionModel;

    public FatuAbstractCrudPanel() {
        super(new FatuBorderLayout());
        this.setTitle(this.getClass().getName());

        this.defaultActionListener = new FatuReflectActionListener(this);
        this.defaultPropertyChangeListener = new FatuReflectPropertyChangedListener(this);

        this.btnNew_I18N = new I18n("btnNew_I18N");
        this.btnNew_I18N.setDefault("Novo");

        this.btnSave_I18N = new I18n("btnSave_I18N");
        this.btnSave_I18N.setDefault("Salvar");

        this.btnDelete_I18N = new I18n("btnDelete_I18N");
        this.btnDelete_I18N.setDefault("Excluir");

        this.btnSearch_I18N = new I18n("btnSearch_I18N");
        this.btnSearch_I18N.setDefault("Buscar");
    }

    protected void initGui() {
        // The Grid
        this.tableModel = this.getTableModel();
        this.selectionModel = this.getSelectionModel();

        this.grid = new FatuGrid(tableModel, selectionModel);
        FatuPanel<FatuFitLayout> gridContainer = new FatuPanel<FatuFitLayout>(FatuFitLayout.FIT_LAYOUT);
        gridContainer.setSize(new FatuSize(100, 200));
        gridContainer.addChild(this.grid, FatuFitLayoutRule.FIT_LAYOUT_RULE);

        this.addChild(gridContainer, FatuBorderLayoutRule.NORTH);

        // The Toolbar Buttons
        this.toolbar = new FatuToolbar<FatuComponent>();
        this.setToolbar(this.toolbar);

        this.btnNew = new FatuButton();
        this.btnNew.addActionListener(getDefaultActionListener());
        this.btnNew.setName("btnCreate");
        this.btnNew.setLabel(btnNew_I18N);
        this.btnNew.setEnabled(true);
        this.getToolbar().addChild(btnNew);

        this.btnSave = new FatuButton();
        this.btnSave.addActionListener(getDefaultActionListener());
        this.btnSave.setName("btnSave");
        this.btnSave.setLabel(btnSave_I18N);
        this.btnSave.setEnabled(false);
        this.getToolbar().addChild(btnSave);

        this.btnDelete = new FatuButton();
        this.btnDelete.addActionListener(getDefaultActionListener());
        this.btnDelete.setName("btnDelete");
        this.btnDelete.setLabel(btnDelete_I18N);
        this.btnDelete.setEnabled(false);
        this.getToolbar().addChild(btnDelete);

        this.tBoxSearchValue = new FatuTextBox();
        this.tBoxSearchValue.setName("tBoxSearchValue");
        tBoxSearchValue.addPropertyChangeListener(defaultPropertyChangeListener);
        this.getToolbar().addChild(tBoxSearchValue);

        this.btnSearch = new FatuButton();
        this.btnSearch.addActionListener(getDefaultActionListener());
        this.btnSearch.setName("btnSearch");
        this.btnSearch.setLabel(btnSearch_I18N);
        this.btnSearch.setEnabled(true);
        this.getToolbar().addChild(btnSearch);

        // Content Panel
        this.contentPanel = new FatuPanel<FatuVBoxLayout>(FatuVBoxLayout.VBOX_DEFAULT);
        //this.contentPanel.setTitle("Fields Area....");
        this.addChild(contentPanel, FatuBorderLayoutRule.CENTER);

        IFatuSelectionListener<IBookmark<M>> l = new IFatuSelectionListener<IBookmark<M>>() {

            @Override
            public void selectionChanged(Collection<IBookmark<M>> newSelection, Collection<IBookmark<M>> oldSelection) {
                FatuAbstractCrudPanel.this.refreshToolbar();
            }
        };
        this.selectionModel.addSelectionListener(l);
    }

    public final FatuPanel<FatuVBoxLayout> getContentPanel() {
        return contentPanel;
    }

    public FatuToolbar<FatuComponent> getToolbar() {
        return toolbar;
    }

    public IFatuActionListener getDefaultActionListener() {
        return defaultActionListener;
    }

    public PropertyChangeListener getDefaultPropertyChangeListener() {
        return defaultPropertyChangeListener;
    }

    @FatuActionEventHandler(components = "btnSave")
    public final void btnSaveOnClick(IFatuActionEvent evt) {
        doSave();
    }

    @FatuActionEventHandler(components = "btnSearch")
    public final void btnSearchOnClick(IFatuActionEvent evt) {
        doSearch(tBoxSearchValue.getValue());
    }

    @FatuActionEventHandler(components = "btnDelete")
    public final void btnDeleteOnClick(IFatuActionEvent evt) {
        doDelete();
    }

    @FatuActionEventHandler(components = "btnCreate")
    public final void btnCreateOnClick(IFatuActionEvent evt) {
        doCreate();
        refreshToolbar();
    }

    protected abstract void doCreate();

    protected abstract void doSave();

    protected abstract boolean isCanSave();

    protected abstract void doSearch(String value);

    protected abstract void doDelete();

    protected abstract IFatuTableModel<M> getTableModel();

    protected abstract IFatuSelectionModel<IBookmark<M>> getSelectionModel();

    protected void refreshToolbar() {
        this.btnNew.setEnabled(true);
        this.btnSave.setEnabled(isCanSave());
        this.btnDelete.setEnabled(this.getSelectionModel().getSelectedCount() != 0);
    }

}


text:
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;

namespace NMF.Interop.Ecore
{

    /// <summary>
    /// The public interface for EPackage
    /// </summary>
    [DefaultImplementationTypeAttribute(typeof(EPackage))]
    [XmlDefaultImplementationTypeAttribute(typeof(EPackage))]
    public interface IEPackage : IModelElement, IENamedElement
    {

        /// <summary>
        /// The nsURI property
        /// </summary>
        string NsURI
        {
            get;
            set;
        }

        /// <summary>
        /// The nsPrefix property
        /// </summary>
        string NsPrefix
        {
            get;
            set;
        }

        /// <summary>
        /// The eFactoryInstance property
        /// </summary>
        IEFactory EFactoryInstance
        {
            get;
            set;
        }

        /// <summary>
        /// The eClassifiers property
        /// </summary>
        IOrderedSetExpression<IEClassifier> EClassifiers
        {
            get;
        }

        /// <summary>
        /// The eSubpackages property
        /// </summary>
        IOrderedSetExpression<IEPackage> ESubpackages
        {
            get;
        }

        /// <summary>
        /// The eSuperPackage property
        /// </summary>
        IEPackage ESuperPackage
        {
            get;
            set;
        }

        /// <summary>
        /// Gets fired before the NsURI property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> NsURIChanging;

        /// <summary>
        /// Gets fired when the NsURI property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> NsURIChanged;

        /// <summary>
        /// Gets fired before the NsPrefix property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> NsPrefixChanging;

        /// <summary>
        /// Gets fired when the NsPrefix property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> NsPrefixChanged;

        /// <summary>
        /// Gets fired before the EFactoryInstance property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> EFactoryInstanceChanging;

        /// <summary>
        /// Gets fired when the EFactoryInstance property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> EFactoryInstanceChanged;

        /// <summary>
        /// Gets fired before the ESuperPackage property changes its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> ESuperPackageChanging;

        /// <summary>
        /// Gets fired when the ESuperPackage property changed its value
        /// </summary>
        event System.EventHandler<ValueChangedEventArgs> ESuperPackageChanged;
    }
}


text:
'use strict'

const t = require('tap')
const test = t.test
const sget = require('simple-get').concat
const Fastify = require('fastify')
const path = require('path')

test('reply.view with art-template engine and custom templates folder', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    templates: 'templates'
  })

  fastify.get('/', (req, reply) => {
    reply.view('./index.art', data)
  })

  fastify.listen({ port: 10086 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://127.0.0.1:10086/'
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template without data-parameter and defaultContext', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    templates: 'templates'
  })

  fastify.get('/', (req, reply) => {
    reply.view('./index.art')
  })

  fastify.listen({ port: 10086 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://127.0.0.1:10086/'
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, {}), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template without data-parameter but with defaultContext', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    defaultContext: data,
    templates: 'templates'
  })

  fastify.get('/', (req, reply) => {
    reply.view('./index.art')
  })

  fastify.listen({ port: 10086 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://127.0.0.1:10086/'
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view with art-template engine and defaultContext', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    templates: 'templates',
    defaultContext: data
  })

  fastify.get('/', (req, reply) => {
    reply.view('./index.art', {})
  })

  fastify.listen({ port: 10086 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://127.0.0.1:10086/'
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template engine without data-parameter and defaultContext but with reply.locals', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const localsData = { text: 'text from locals' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    }
  })

  fastify.addHook('preHandler', function (request, reply, done) {
    reply.locals = localsData
    done()
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index.art')
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, localsData), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template engine without defaultContext but with reply.locals and data-parameter', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const localsData = { text: 'text from locals' }
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    }
  })

  fastify.addHook('preHandler', function (request, reply, done) {
    reply.locals = localsData
    done()
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index.art', data)
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template engine without data-parameter but with reply.locals and defaultContext', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const localsData = { text: 'text from locals' }
  const contextData = { text: 'text from context' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    defaultContext: contextData
  })

  fastify.addHook('preHandler', function (request, reply, done) {
    reply.locals = localsData
    done()
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index.art')
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, localsData), body.toString())
      fastify.close()
    })
  })
})

test('reply.view for art-template engine with data-parameter and reply.locals and defaultContext', t => {
  t.plan(6)
  const fastify = Fastify()
  const art = require('art-template')
  const localsData = { text: 'text from locals' }
  const contextData = { text: 'text from context' }
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    defaultContext: contextData
  })

  fastify.addHook('preHandler', function (request, reply, done) {
    reply.locals = localsData
    done()
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index.art', data)
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view with art-template engine and full path templates folder', t => {
  t.plan(6)

  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    templates: path.join(__dirname, '..', 'templates')
  })

  fastify.get('/', (req, reply) => {
    reply.view('./index.art', data)
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('reply.view with art-template engine and includeViewExtension is true', t => {
  t.plan(6)

  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    includeViewExtension: true
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index', data)
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-length'], '' + body.length)
      t.equal(response.headers['content-type'], 'text/html; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('fastify.view with art-template engine and full path templates folder', t => {
  t.plan(6)

  const fastify = Fastify()
  const art = require('art-template')
  const data = { text: 'text' }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    },
    templates: path.join(__dirname, '..', 'templates')
  })

  fastify.get('/', (req, reply) => {
    fastify.view('./index', data, (err, html) => {
      t.error(err)
      reply.send(html)
    })
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(response.headers['content-type'], 'text/plain; charset=utf-8')

      const templatePath = path.join(__dirname, '..', 'templates', 'index.art')

      t.equal(art(templatePath, data), body.toString())
      fastify.close()
    })
  })
})

test('fastify.view with art-template should throw page missing', t => {
  t.plan(3)
  const fastify = Fastify()
  const art = require('art-template')

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    }
  })

  fastify.ready(err => {
    t.error(err)

    fastify.view(null, {}, err => {
      t.ok(err instanceof Error)
      t.equal(err.message, 'Missing page')
      fastify.close()
    })
  })
})

test('reply.view with art-template should return 500 if render fails', t => {
  t.plan(4)
  const fastify = Fastify()
  const art = {
    compile: () => { throw Error('Compile Error') }
  }

  fastify.register(require('../index'), {
    engine: {
      'art-template': art
    }
  })

  fastify.get('/', (req, reply) => {
    reply.view('./templates/index')
  })

  fastify.listen({ port: 0 }, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      const { message } = JSON.parse(body.toString())
      t.error(err)
      t.equal(response.statusCode, 500)
      t.equal('Compile Error', message)

      fastify.close()
    })
  })
})


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

    <title>HBase -

      HBase ACID Properties
    </title>

    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta name="Date-Revision-yyyymmdd" content="20110718" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

                                 Last Published: 2011-07-18
               | Version: 0.90.3-cdh3u1

HBase Project

                  Overview

                  License

                  Downloads

                  Release Notes

                  Issue Tracking

                  Mailing Lists

                  Source Repository

                  Team

Documentation

                  Getting Started: Quick

                  Getting Started: Detailed

                  API

                  X-Ref

                  Book

                  FAQ

                  Wiki

            ACID Semantics

                  Bulk Loads

                  Metrics

                  HBase on Windows

                  Cluster replication

                  Pseudo-Dist. Extras

About this Document

HBase is not an ACID compliant database. However, it does guarantee certain specific
      properties.

This specification enumerates the ACID properties of HBase.

Definitions

For the sake of common vocabulary, we define the following terms:

Atomicity

an operation is atomic if it either completes entirely or not at all

Consistency

          all actions cause the table to transition from one valid state directly to another
          (eg a row will not disappear during an update, etc)

Isolation

          an operation is isolated if it appears to complete independently of any other concurrent transaction

Durability

any update that reports "successful" to the client will not be lost

Visibility

an update is considered visible if any subsequent read will see the update as having been committed

        The terms must and may are used as specified by RFC 2119.
        In short, the word "must" implies that, if some case exists where the statement
        is not true, it is a bug. The word "may" implies that, even if the guarantee
        is provided in a current release, users should not rely on it.

APIs to consider

Read APIs

get

scan

Write APIs

put

batch put

delete

Combination (read-modify-write) APIs

incrementColumnValue

checkAndPut

Guarantees Provided

Atomicity

All mutations are atomic within a row. Any put will either wholely succeed or wholely fail.

An operation that returns a "success" code has completely succeeded.

An operation that returns a "failure" code has completely failed.

An operation that times out may have succeeded and may have failed. However,
            it will not have partially succeeded or failed.

 This is true even if the mutation crosses multiple column families within a row.

 APIs that mutate several rows will _not_ be atomic across the multiple rows.
          For example, a multiput that operates on rows 'a','b', and 'c' may return having
          mutated some but not all of the rows. In such cases, these APIs will return a list
          of success codes, each of which may be succeeded, failed, or timed out as described above.

 The checkAndPut API happens atomically like the typical compareAndSet (CAS) operation
          found in many hardware architectures.

 The order of mutations is seen to happen in a well-defined order for each row, with no
          interleaving. For example, if one writer issues the mutation "a=1,b=1,c=1" and
          another writer issues the mutation "a=2,b=2,c=2", the row must either
          be "a=1,b=1,c=1" or "a=2,b=2,c=2" and must not be something
          like "a=1,b=2,c=1".

Please note that this is not true _across rows_ for multirow batch mutations.

Consistency and Isolation

All rows returned via any access API will consist of a complete row that existed at
          some point in the table's history.

This is true across column families - i.e a get of a full row that occurs concurrent
          with some mutations 1,2,3,4,5 will return a complete row that existed at some point in time
          between mutation i and i+1 for some i between 1 and 5.

The state of a row will only move forward through the history of edits to it.

Consistency of Scans

          A scan is not a consistent view of a table. Scans do
          not exhibit snapshot isolation.

          Rather, scans have the following properties:

            Any row returned by the scan will be a consistent view (i.e. that version
            of the complete row existed at some point in time)

            A scan will always reflect a view of the data at least as new as
            the beginning of the scan. This satisfies the visibility guarantees
          enumerated below.

For example, if client A writes data X and then communicates via a side
            channel to client B, any scans started by client B will contain data at least
            as new as X.

A scan _must_ reflect all mutations committed prior to the construction
            of the scanner, and _may_ reflect some mutations committed subsequent to the
            construction of the scanner.

Scans must include all data written prior to the scan (except in
            the case where data is subsequently mutated, in which case it _may_ reflect
            the mutation)

          Those familiar with relational databases will recognize this isolation level as "read committed".

          Please note that the guarantees listed above regarding scanner consistency
          are referring to "transaction commit time", not the "timestamp"
          field of each cell. That is to say, a scanner started at time t may see edits
          with a timestamp value greater than t, if those edits were committed with a
          "forward dated" timestamp before the scanner was constructed.

Visibility

 When a client receives a "success" response for any mutation, that
          mutation is immediately visible to both that client and any client with whom it
          later communicates through side channels.

 A row must never exhibit so-called "time-travel" properties. That
          is to say, if a series of mutations moves a row sequentially through a series of
          states, any sequence of concurrent reads will return a subsequence of those states.

For example, if a row's cells are mutated using the "incrementColumnValue"
            API, a client must never see the value of any cell decrease.

This is true regardless of which read API is used to read back the mutation.

 Any version of a cell that has been returned to a read operation is guaranteed to
          be durably stored.

Durability

 All visible data is also durable data. That is to say, a read will never return
          data that has not been made durable on disk[1]

 Any operation that returns a "success" code (eg does not throw an exception)
          will be made durable.

 Any operation that returns a "failure" code will not be made durable
          (subject to the Atomicity guarantees above)

 All reasonable failure scenarios will not affect any of the guarantees of this document.

Tunability

All of the above guarantees must be possible within HBase. For users who would like to trade
        off some guarantees for performance, HBase may offer several tuning options. For example:

Visibility may be tuned on a per-read basis to allow stale reads or time travel.

Durability may be tuned to only flush data to disk on a periodic basis

Footnotes

[1] In the context of HBase, "durably on disk" implies an hflush() call on the transaction
      log. This does not actually imply an fsync() to magnetic media, but rather just that the data has been
      written to the OS cache on all replicas of the log. In the case of a full datacenter power loss, it is
      possible that the edits are not truly durable.

        ©            2011
              Cloudera

                       - Privacy Policy.
        Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.


text:
<bill session="115" type="hr" number="407" updated="2017-09-28T19:30:12Z">
  <state datetime="2017-06-26">REFERRED</state>
  <status>
    <introduced datetime="2017-06-26"/>
  </status>
  <introduced datetime="2017-06-26"/>
  <titles>
    <title type="official" as="introduced">Condemning the persecution of Christians around the world.</title>
    <title type="display">Condemning the persecution of Christians around the world.</title>
  </titles>
  <sponsor bioguide_id="G000576"/>
  <cosponsors>
    <cosponsor bioguide_id="A000372" joined="2017-06-26"/>
    <cosponsor bioguide_id="B001291" joined="2017-06-26"/>
    <cosponsor bioguide_id="B001302" joined="2017-06-26"/>
    <cosponsor bioguide_id="B001257" joined="2017-06-27"/>
    <cosponsor bioguide_id="C001105" joined="2017-07-14"/>
    <cosponsor bioguide_id="D000621" joined="2017-06-26"/>
    <cosponsor bioguide_id="D000628" joined="2017-06-26"/>
    <cosponsor bioguide_id="E000296" joined="2017-07-12"/>
    <cosponsor bioguide_id="F000464" joined="2017-06-26"/>
    <cosponsor bioguide_id="F000448" joined="2017-07-18"/>
    <cosponsor bioguide_id="G000578" joined="2017-06-26"/>
    <cosponsor bioguide_id="G000580" joined="2017-06-26"/>
    <cosponsor bioguide_id="G000565" joined="2017-06-26"/>
    <cosponsor bioguide_id="G000377" joined="2017-06-26"/>
    <cosponsor bioguide_id="G000560" joined="2017-06-26"/>
    <cosponsor bioguide_id="H001052" joined="2017-06-26"/>
    <cosponsor bioguide_id="H001053" joined="2017-06-29"/>
    <cosponsor bioguide_id="H001071" joined="2017-06-26"/>
    <cosponsor bioguide_id="J000290" joined="2017-06-26"/>
    <cosponsor bioguide_id="J000299" joined="2017-06-26"/>
    <cosponsor bioguide_id="J000289" joined="2017-06-26"/>
    <cosponsor bioguide_id="K000362" joined="2017-06-26"/>
    <cosponsor bioguide_id="P000605" joined="2017-06-26"/>
    <cosponsor bioguide_id="P000592" joined="2017-07-13"/>
    <cosponsor bioguide_id="R000597" joined="2017-06-26"/>
    <cosponsor bioguide_id="R000607" joined="2017-07-11"/>
    <cosponsor bioguide_id="R000593" joined="2017-06-26"/>
    <cosponsor bioguide_id="S001148" joined="2017-06-26"/>
    <cosponsor bioguide_id="T000470" joined="2017-06-26"/>
    <cosponsor bioguide_id="V000130" joined="2017-06-26"/>
    <cosponsor bioguide_id="Y000065" joined="2017-06-26"/>
  </cosponsors>
  <actions>
    <action datetime="2017-06-26">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-06-26" state="REFERRED">
      <text>Referred to the House Committee on Foreign Affairs.</text>
    </action>
    <action datetime="2017-07-06">
      <text>Referred to the Subcommittee on Africa, Global Health, Global Human Rights and International Organizations.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="HSFA" name="House Foreign Affairs" activity="Referral"/>
    <committee subcommittee="Africa, Global Health, Global Human Rights and International Organizations" code="HSFA16" name="House Foreign Affairs" activity="Referral"/>
  </committees>
  <relatedbills/>
  <subjects>
    <term name="International affairs"/>
    <term name="Human rights"/>
    <term name="Racial and ethnic relations"/>
    <term name="Religion"/>
  </subjects>
  <amendments/>
  <summary date="2017-06-26T04:00:00Z" status="Introduced in House">Condemns the persecution of Christians around the world.

Calls on: (1) discriminatory regimes to cease their persecution of Christians and religious minorities, and (2) the President and the heads of the governments of all democratic countries to uphold the right to religious freedom and condemn the persecution of Christians.</summary>
  <committee-reports/>
</bill>


text:
<?php

namespace App\Http\Requests\Inventory;

use App\Http\Requests\Request as BaseRequest;

class InventoryStockRequest extends BaseRequest
{
    /**
     * The inventory stock validation rules.
     *
     * @return array
     */
    public function rules()
    {
        $item = $this->route('inventory');
        $stock = ($this->route('stocks') ?: 'NULL');

        return [
            'location'    => "required|exists:locations,id|unique:inventory_stocks,location_id,$stock,id,inventory_id,$item",
            'quantity'    => 'required|numeric|min:0',
            'reason'      => 'max:250',
            'cost'        => 'numeric|min:0',
        ];
    }

    /**
     * Allows all users to create a stock on an inventory item.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
}


text:
OPENTELEMETRY_BEGIN_NAMESPACE
namespace nostd
{
template <typename... Ts>
class variant;
}  // namespace nostd
OPENTELEMETRY_END_NAMESPACE


text:
title: Solving Exponential Equations from the Definition
localeTitle: حل المعادلات الأسية من التعريف
---
## حل المعادلات الأسية من التعريف

هذا هو كعب. [ساعد مجتمعنا على توسيعه](https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/solving-exponential-equations-from-the-definition/index.md) .

[سيساعدك دليل النمط السريع هذا على ضمان قبول طلب السحب](https://github.com/freecodecamp/guides/blob/master/README.md) .

#### معلومات اكثر:


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<TITLE>CLHS: Issue DOTIMES-IGNORE Writeup</TITLE>
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="The Harlequin Group Limited">
<LINK REL=TOP HREF="../FrontMatter/index.html">
<LINK REL=COPYRIGHT HREF="../FrontMatter/About-HyperSpec.html#Legal">
<LINK REL=DISCLAIMER HREF="../FrontMatter/About-HyperSpec.html#Disclaimer">
<LINK REL=PREV HREF="../Issues/iss136-writeup.html">
<LINK REL=UP HREF="../Issues/iss137.html">
<LINK REL=NEXT HREF="../Issues/iss138-writeup.html">

Issue DOTIMES-IGNORE Writeup

Issue:        DOTIMES-IGNORE

Forum:	      Cleanup

References:   DOLIST (p126), DOTIMES (p126-128), IGNORE (p160),

	      LOOP (X3J13/89-004), DO-SYMBOLS (p187), DO-ALL-SYMBOLS (p188),

	      DO-EXTERNAL-SYMBOLS (p187), DO (pp122-126), DO* (pp122-126)

Category:     CLARIFICATION

Edit history: 20-Jul-90, Version 1 by Pitman

	      06-Mar-91, Version 2 by Pitman

	      15-Mar-91, Version 3 by Pitman

Status:	      For Internal Discussion

Problem Description:

  The IGNORE declaration is described in terms of whether a variable is

  `used'.  But what constitutes a use?  Several iteration primitives are

  described as macros, and the nature of the expansion is not well

  enough specified for the answer to this question to be easily

  determined.

  Consider:

    (DOTIMES (A 3) (PRINT 'FOO))

  Is A used?  Would it be appropriate to write:

    (DOTIMES (A 3) (DECLARE (IGNORE A)) (PRINT 'FOO))

  In some implementations, this would seem to be desirable, while in

  other implementations it would seem undesirable.

  In some implementations, such as an older Genera release, when the

  compiler sees an IGNORE declaration, it `commits' the fact that the

  variable will not be used and sometimes cannot later back out and

  produce a successful compilation when this assumption is later realized

  to be wrong in the process of code-walking.  Because such a program

  is technically in error, this is a conforming situation.  But it

  means that the choice of whether to use IGNORE or not has potential

  semantic impact.

  This issue started out as being just about DOTIMES (hence the name)

  but has been generalized to include all CL iteration forms.

Terminology:

  For the purposes of this issue, the following terminology applies:

  An "explicit use of a variable in a form" is a use that would be

  apparent in the normal semantics of the form.  That is, if all

  subforms of that form were macroexpanded, but the form itself were

  not.  [This isn't how an implementation has to detect an explicit

  form; it's just a definition of what explicit use means.  The intent

  is that an explicit use be one which does not expose any undocumented

  details of the form's macro expansion (if the form is in fact a macro).]

  An "iteration form" means a DOLIST, DOTIMES, LOOP, DO-SYMBOLS,

  DO-ALL-SYMBOLS, DO-EXTERNAL-SYMBOLS, DO, or DO* form.

  An "iteration variable" is a variable which is "explicitly used"

  as a variable to be bound by by an "iteration form".

Voting Instructions:

  Proposals which have a "+" in their name are compatible with any

  other proposals, and may be voted in addition to the other proposals.

Proposal (DOTIMES-IGNORE:NEVER):

  Clarify that iteration variables are, by definition, always `used'.

  That is, clarify that using

   (DECLARE (IGNORE ...))

  for such an iteration variable has undefined consequences.

  Rationale:

  This is analagous to the situation in DEFMETHOD where a specialized

  required argument is considered a use of the argument.

  Example:

   ;; The following would be correct and should not be warned about.

   (DOTIMES (I 5)

     (PRINT 'FOO))

   ;; The following would not be correct and might be warned about.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

Proposal (DOTIMES-IGNORE:UNLESS-EXPLICIT):

  Clarify that unless an variable in an iteration form is explicitly

  used in the form which binds it, it might be considered "unused" by

  the implementation, and that it is always permissible to use

   (DECLARE (IGNORE ...))

  for such a unused variable.

  Rationale:

  This doesn't force users to think about the macro expansion and tends

  to treat iteration variables more like variables bound by LET, LET*,

  and LAMBDA.

  Example:

   ;; The following would be correct and should not be warned about.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

   ;; The following would not be correct and might be warned about.

   (DOTIMES (I 5)

     (PRINT 'FOO))

Proposal (DOTIMES-IGNORE:INVISIBLE-REFERENCES):

  Introduce a macro

    WITH-INVISIBLE-REFERENCES ({vars}*) {forms}*		[Macro]

    Within the context of this macro, any uses of the <vars> are not

    regarded as `uses' of the <vars> for the purposes of compiler warnings.

  Clarify that macros like DOTIMES which expand into code which do

  invisible computations on user-supplied variables must do the equivalent

  of wrapping WITH-INVISIBLE-REFERNCES around those invisible uses, so that

  those uses will not be counted as uses.

  Rationale:

  This makes the mechanism for invisible uses available to users so that they

  can write forms like DOTIMES which manipulate user-supplied variables

  and yet warn about lack of explicit use of those variables.

  Example:

   ;; The following would be correct and should not be warned about.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

   ;; The following would not be correct and might be warned about.

   (DOTIMES (I 5)

     (PRINT 'FOO))

   ;; The following would be correct.  User might be warned that X

   ;; is not used. (This is a pathological case which wouldn't be a

   ;; normal use.  For a `real' use see the expansion of DOTIMES in

   ;; the Symbolics Genera current practice.)

   (LET ((X 3))

     (WITH-INVISIBLE-REFERENCES (X) (INCF X) (PRINT X))

     0)

   4

   => 0

Proposal (DOTIMES-IGNORE:+IGNORE-FUNCTION):

  Introduce a function

    IGNORE &REST IGNORE 			[Function]

     Accepts any number of arguments and returns NIL.

  Function calls to IGNORE can effectively be optimized away by a compiler,

  except where side-effects might occur.  That is, (IGNORE X #'Y (Z)) is

  equivalent to (PROGN X #'Y (Z) NIL), but is more perspicuous about the

  user's intent to identify ignored items.

  Rationale:

  This leaves the original problem in place but provides a compromise

  that people can learn to use.   It also has the side benefit of providing

  an obvious syntax for `ignorable' variables introduced by some macros.

  It also provides an obvious syntax for ignoring FLET'd items.

  Example:

   ;; The following might or might not be correct and might be warned about.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

   (DOTIMES (I 5)

     (PRINT 'FOO))

   ;; The following would not be warned about.

   (DOTIMES (I 5)

     (IGNORE I)

     (PRINT 'FOO))

Proposal (DOTIMES-IGNORE:+STYLE-WARNING):

  Clarify that any `unused variable' warning must be a STYLE-WARNING, and

  may not affect program semantics.

  Rationale:

  This is similar to STATUS-QUO, but at least insures that the issue has

  no semantic impact on code.

  Example:

   ;; The following might or might not be correct and might be warned about

   ;; but could be suppressed in a context where style warnings were

   ;; suppressable.  In either case, correct code would be generated.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

   (DOTIMES (I 5)

     (PRINT 'FOO))

Proposal (DOTIMES-IGNORE:+NEW-DECLARATION):

  Introduce a new declaration, IGNORABLE, similar to IGNORE, except that

  it means that the variable might or might not be used, but that in

  neither case should a warning be issued.

  Rationale:

  A lot of people have asked for this.  e.g., it would be useful for

  places where variables pop out of nowhere due to the presence of some

  macro. e.g., in New Flavors (think of it as a user program from the

  point of view of this proposal) the variable SELF magically appears in a

  DEFMETHOD.  The definition of FLAVOR:DEFMETHOD might, therefore, want

  to declare SELF to be IGNORABLE since not all Flavors' DEFMETHOD forms

  actually use this.

  Example:

   Given...

   (DEFMACRO WITH-FOO (X &BODY STUFF)

     `(LET ((FOO (FROB ,X)))

	(DECLARE (IGNORABLE FOO))

	,@STUFF))

   Neither of the following two uses would be warned about:

       (WITH-FOO (F) (G))

   or  (WITH-FOO (F) (H FOO))

Proposal (DOTIMES-IGNORE:+FUNCTION-DECLARATIONS):

  Permit the IGNORE (and IGNORABLE, if it passes--see proposal

  +NEW-DECLARATION) declarations to contain references to #'name

  in order to refer to a function name instead of a variable name.

  Rationale:

  This would be useful, for example, in the expansion of DEFMETHOD

  in order to declare that CALL-NEXT-METHOD and NEXT-METHOD-P might

  or might not be used, but that no warning should be produced in

  either case.  Some user programs presumably have similar needs.

  Example:

   (DEFMACRO DEFMETHOD ...

     `(... (FLET ((CALL-NEXT-METHOD ...)

		  (NEXT-METHOD-P ...))

	     (DECLARE (IGNORABLE #'CALL-NEXT-METHOD

			         #'NEXT-METHOD-P))

	     ...)))

Proposal (DOTIMES-IGNORE:STATUS-QUO):

  Accept the fact that the use of (DECLARE (IGNORE ...)) for an iteration

  variable will always cause a warning in some implementations and that

  the failure to use it will always cause a warning in some other

  implementations.  The net effect of this will be that no code which uses

  any iteration primitive, DO, LOOP, or otherwise without using all iteration

  variables explicitly will be free from gratuitous whining of at least

  some compilers.  Since the presence of

   (DECLARE (IGNORE ...))

  is sometimes fatal to some compilers, people will learn to live without it,

  or will introduce creative other ways to `use' the variable to muffle the

  warnings, sometimes at a performance penalty.

  Rationale:

  Implements the status quo.

  Example:

   ;; The following might or might not be correct and might be warned about.

   (DOTIMES (I 5)

     (DECLARE (IGNORE I))

     (PRINT 'FOO))

   (DOTIMES (I 5)

     (PRINT 'FOO))

Test Case:

  (DEFUN COMPILER-WARNINGS-P (BODIES &OPTIONAL (FLAG NIL))

    (MAPCAR #'(LAMBDA (BODY)

		(FLET ((TRY (BODY)

			 (LET ((WARNING

				 (WITH-OUTPUT-TO-STRING (*ERROR-OUTPUT*)

				   (COMPILE NIL `(LAMBDA ,@BODY)))))

			   (IF FLAG WARNING (> (LENGTH WARNING) 0)))))

		  (LIST (TRY BODY)

			(TRY (LIST (CAR BODY)

				   (REMOVE-IF

				     #'(LAMBDA (X)

					 (AND (NOT (ATOM X))

					      (EQ (CAR X) 'DECLARE)))

				     (CADR BODY)))))))

	    BODIES))

  (DEFUN TEST-CASE ()

    (COMPILER-WARNINGS-P

      '(((X) (DOTIMES (A X) (DECLARE (IGNORE A)) (PRINT 'FOO)))

	((X) (DOLIST (A X) (DECLARE (IGNORE A)) (PRINT 'FOO)))

	((X) (DO-SYMBOLS (S X) (DECLARE (IGNORE S)) (PRINT 'FOO)))

	((X) (DO-EXTERNAL-SYMBOLS (S X) (DECLARE (IGNORE S)) (PRINT 'FOO)))

	(()  (DO-ALL-SYMBOLS (S) (DECLARE (IGNORE S)) (PRINT 'FOO)))

	((X) (LOOP FOR I IN X DO (DECLARE (IGNORE I)) (PRINT 'FOO)))

	((X) (LOOP FOR L ON X DO (DECLARE (IGNORE L)) (PRINT 'FOO)))

	((X) (DO ((L X X)) (NIL) (DECLARE (IGNORE L)) (PRINT 'FOO)))

	((X) (DO* ((L X X)) (NIL) (DECLARE (IGNORE L)) (PRINT 'FOO))))))

Current Practice:

  Symbolics Genera implements INVISIBLE-REFERENCES (except that the

   macro is called COMPILER:INVISIBLE-REFERENCES) and by implication

   it implements UNLESS-EXPLICIT and STATUS-QUO.  It also implements

   +IGNORE-FUNCTION, and probably implements +STYLE-WARNING.

  Test case results...

   Symbolics Genera 8.0.1: ((NIL T) (T T  ) (T   NIL) (T NIL) (T NIL)

		            (T   T) (T T  ) (T   T  ) (T T  ))

   Symbolics Genera 8.1:   ((NIL T) (NIL T) (T   NIL) (T NIL) (T NIL)

			    (T   T) (T   T) (T   T  ) (T T  ))

   Symbolics Cloe:         ((NIL T) (T T  ) (NIL NIL) (T NIL) (T T  )

		            (T   T) (T NIL) (T   T  ) (T T  ))

  In Symbolics Genera, the macroexpansion of (DOTIMES (A 3) (PRINT 'FOO)) is:

    (PROG    ((A 0))

     #:G1689 (PRINT 'FOO)

	     (COMPILER:INVISIBLE-REFERENCES (A)

	       (IF (PROGN (SETQ A (1+ A))

		          (< A 3))

		   (PROGN (GO #:G1689))))

	     (RETURN NIL))

Cost to Implementors:

  NEVER: Relatively small.  It's straightforward for macros to add a few

   spurious additional references in order to assure that no unused warnings

   occur.

  UNLESS-EXPLICIT: Medium.  This is similar to INVISIBLE-REFERENCES, but

   it allows for alternate implementations with equivalent effect because

   it doesn't publish the interface.

  +IGNORE-FUNCTION: Relatively small.

  +NEW-DECLARATION: None to medium.  This involves some compiler work,

   the amount of which may vary, for implementations that do enough

   bookkeeping for it to matter.  Implementations which don't ever warn

   can just ignore this, of course.

  +FUNCTION-DECLARATIONS: Probably relatively small.

  INVISIBLE-REFERENCES:  None to Medium.  This probably involves some

    compiler hacking for implementations who care to do this kind of

    warning.  Strictly, an implementation could simply never warn, and then

    this would be free, but some implementations have already established

    a precedent of warning, so their customers would probably insist that

    they did the work to make warnings continue to work in places where

    they were called for.

  STATUS-QUO: None.

Cost to Users:

  NEVER: Relatively small.

  UNLESS-EXPLICIT: Relatively small.

  +IGNORE-FUNCTION: Relatively small.

  +NEW-DECLARATION: None.

  +FUNCTION-DECLARATIONS: None.

  INVISIBLE-REFERENCES: Relatively small.

  STATUS-QUO: Potentially large nuisance value and medium amount of work

    for some users.

    When porting to a new platform, you get a lot of warnings.  Sometimes

    the warnings are useful, sometimes they are not.  The worst part is

    if they are not useful and you just want to ignore them but you can't

    because there are other warnings you want to see and you don't have the

    ability to turn off just these warnings.  So over and over you have to

    wade through these warnings just to get to the others.

Cost of Non-Adoption:

  See cost of option STATUS-QUO.

Benefits:

  Users don't have to guess about important aspects of language semantics.

Aesthetics:

  Proposals NEVER, UNLESS-EXPLICIT, +IGNORE-FUNCTION, +NEW-DECLARATION,

  +FUNCTION-DECLARATIONS, and INVISIBLE-REFERENCES definitely improve the

  aesthetics in the sense that they give the user the power to make the

  code mean a particular thing, rather than leaving it to the discretion

  of the implementation what the user meant.

  Proposal STATUS-QUO is not aesthetic.

Discussion:

  Pitman thinks that anything but STATUS-QUO is livable, but has a

  preference for either INVISIBLE-REFERENCES or NEVER.  He thinks

  any of +IGNORE-FUNCTION, +NEW-DECLARATION, and +FUNCTION-DECLARATIONS

  would be nice additions, too.

  Dalton is on record as opposing a WITH-INVISIBLE-REFERENCES macro

  and an IGNORABLE declaration (see below), but he hasn't seen this

  specific proposal (which admittedly isn't likely to change his mind).

  Several Symbolics customers have complained about portability

  problems due to this lack of specificity.

  Gregor Kiczales says: ``in writing PCL, this IGNORE issue was a

  major pain in the ass.  I never really was able to get it right,

  and it ended up showing through to the users.''

  JonL White said of mail from Dalton in a much longer discussion:

    ``he claims that DECLARE-IGNORE is *not* just friendly,

      optional advice to the compiler, but assertions about

      the program.  I may disagree with him, but I can certainly

      sympathesize with his viewpoint.  This issue in general

      -- what *must* declarations do -- is a serious one.''

  Margolin said ``We're past the deadline for making significant changes

  in the language. We're trying to get the standard edited now.  At this

  time we shouldn't be making changes unless they fix real language

  bugs.  I personally don't feel that a style warning is sufficient

  justification for a change to the semantics of DOTIMES.''  RWK

  responded ``I feel that the style warnings *ARE* an important enough

  issue, because these style warnings are by default dictating the

  variable semantics, but in a manner inconsistent from implementation

  to implementation.''

  Some people reviewing version 1 made suggestions which are not

  pursued in this version, but which are worthy of note:

   - GLS suggested we might need a REPEAT macro, such that

     (REPEAT n . body) meant the same as (DOTIMES (I n) . body).

     This would paper over the DOTIMES problem, but would still

     leave other similar problems unattended to.  This angle was

     therefore not pursued.

   - Barrett and others raised the issue of what counts as a use.

     Both reading and writing it, or just reading?  Technically,

     that's an orthogonal issue, although it has obvious interplay

     with anything decided here.

   - There was discussion by Dalton, Margolin, and others of changing

     the semantics of IGNORE to mean `ignorable'.  Some felt this

     would be visually confusing. Some felt we should rename IGNORE

     to IGNORABLE.  Some felt we should introduce IGNORABLE in

     addition to IGNORE.   [An IGNORABLE declaration was added as an

     option in v3 of this proposal. -kmp]

   - Jeff Barnett (at Northrop) suggested that we should reconsider

     the idea of dignifying a certain variable, IGNORE, as implicitly

     ignored and then permit (DOTIMES (IGNORE 5) ...).  He observed

     that this also works for (MULTIPLE-VALUE-BIND (X IGNORE Z) ...).

     This was already brought up as issue IGNORE-VARIABLE (tabled by

     Masinter at Mar-89 meeting due to deadline constraints).

     Fred White (at BBN) suggested that it should be possible to do

     (PROCLAIM '(IGNORE IGNORE)). Pitman pointed out that

     (PROCLAIM '(SPECIAL IGNORE)) almost works.

     Neil Goldman (at ISI) raised the issue of

      (mapcar #'(lambda (V) t) l)

     which again calls for the IGNORE variable.

   - Eliot@CS.UMASS.EDU pointed out that he just tries to avoid

     (DECLARE (IGNORE X)) in favor of just X at toplevel of a body.

     Don Cohen (at ISI) disagreed that this was adequate, saying that

     he felt that an implementor would be justified in finding such

     a `use' to be gratuitous and still warning.  (Pitman disagrees

     with this disagreement, because sometimes macros expand into

     such things and getting a use that is `more significant' might be

     a data abstraction violation.)  In any case, the use Eliot was

     talking about really implements IGNORABLE, not IGNORE.

   - There was some exploration into the area of whether DOTIMES should

     create a new binding every time.  RPG cited that the current

     definition of DOTIMES is unintuitive to users of parallel lisps.

     Dalton pointed out that if a new binding were made every time, then

     the internal variable which DOTIMES stepped could be a different

     one, and hence the user's variable would be unused as a matter of

     course (i.e., without WITH-INVISIBLE-REFERENCES) since no hidden

     operations on it would be needed.  Bob Kerns (RWK at ILA) said that

     if people were intending to close over an iteration variable, their

     intent would still be clearer if they wrote

      (DOTIMES (I N) (LET ((I I)) (SPAWN #'(LAMBDA () ...I...))))

     rather than just

      (DOTIMES (I N) (SPAWN #'(LAMBDA () ...I...)))

   - Dalton raised the question of whether all this trouble was really

     worth it and whether we shouldn't just specify the expansion of

     DOTIMES precisely so users could just know what it would have going

     on inside it.  RPG said ``Using possible macro expansions to reason

     about language design is poor methodology. DOTIMES should be

     specified and its implementation choices outlined.''  Barmar

     defended (as an example) the Symbolics implementation which

     expands differently depending on the situation and worried that

     optimizations would be harder if the expansion was dictated.  The

     idea of showing a space of possible expansions was also discussed

     by RWK and others.    Barmar said ``By specifying each

     operator as independently as possible we have less trouble with

     strange interactions.''  Dalton responded ``Except where we don't,

     as with DOTIMES and IGNORE. Moreover, it is at least arguable that

     when too much is separate the language is more complex and harder

     to learn.''

   - Neil Goldman cited three examples of problem situations--

      - 1) in lambda lists, because a function is used in a role

            where it may be passed arguments it does not need.

        2) multiple-value-setq, where the values that need to be

           consumed are not just an initial sequence of those returned.

        3) macros (like DOTIMES), that require the provision of a

           variable name that will be lexically bound in the expansion

           and permit IGNORE declarations about it.

     He suggested that the form of destructuring used by LOOP would

     solve these problems. e.g.,

      (defun arg1-is-integer (arg1 nil) ...) ;;second arg is not consumed

      (defun CAR-is-integer ((car . nil)) ...)

        ;; first arg must be a CONS.  Its CDR is not consumed

      (multiple-value-setq ((onea oneb) nil three) ...)

      (dotimes (nil n) (push 0 l))

     Peter Norvig (at Berkeley) worried about ambiguities in this notation.

      (defun optional-CAR-is-integer (&optional (car nil)) ...)

      (defmethod CAR-is-integer ((car cons)) ...)

  RWK wrote one particular message which Moon identified in mail as the

  most important message in the long conversation and which Moon said he

  hoped wouldn't get lost.  GLS sent mail saying he agreed. The

  message was long, but it was a good message, so KMP has picked some choice

  paragraphs from it and reproduced them here. These are from the

  message of 26 Jul 90 21:26 EDT from RWK@FUJI.ILA.Dialnet.Symbolics.COM:

   ``Variable semantics is a very fundamental aspect of the language,

     and we have failed to specify an important part of it.  Traditionally,

     we have dismissed "style warnings" as being an "environment" issue.

     However, in this case, I do not think it should be so dismissed.

     Currently, we have implementations of CL which vocally complain about

     opposite usages.  Having bogus style warnings go off in this way is

     a serious problem for people porting code, because it obscures

     legitimate problems.  Bogus warnings are a serious waste of time for

     porters of code, and they also make venders of portable code look as

     if they are careless programmers.

   ``I strongly feel that a well-written portable Common Lisp program

     should compile with no warnings in any well-done Common Lisp

     implementation.  Otherwise, how is the user of a portable program

     supposed to know if the warnings warn of actual problems, or are

     just noise.

   ``I strongly feel that X3J13 should firmly nail down under what

     circumstances "unused variable" and "unused local function"

     warnings may be issued.  It is our failure to do so which is

     at the heart of the current issue, and as a porter of code, it

     has been a recurrent problem.''

   ``There are also two capabilities which are missing, which have

     been refered to as an IGNORABLE declaration and a

     COMPILER:INVISIBLE-REFERENCES form, in BARMAR's message.  I

     actually think that both are needed.  IGNORABLE states that it

     doesn't matter if the user doesn't reference a variable.

     COMPILER:INVISIBLE-REFERENCES (WITHOUT-REFERENCES ?) states that

     the user is *expected* to reference a particular variable, and

     that style warnings are appropriate if he does not.

    ``I think both situations are common in macros, and that because

      these issues are so close to the core of the language semantics,

      this should be regarded as something more than mere "style

      warnings".  I wouldn't require compilers and interpreters to

      issue the warnings in any particular situation, but I do think

      we can and should define the semantics of our variables sufficiently

      to state when these warnings are and are not appropriate.

    ``I'd also like to see all of these extended to local functions

      in the same manner as the DYNAMIC-EXTENT declaration.''

  Pitman notes the following bug report, received by Symbolics.  One very

  important effect of solving this issue is that vendors will know what

  to implement and users will know what to expect.  Right now, vendors

  are forced to implement their conscience, and they have no defense if

  a user thinks they did the wrong thing.

     Date: Fri, 14 Sep 90 17:45 EDT

     From: J.P. Massar <massar@Think.COM>

     Subject: Stupid warnings

     To: bug-lispm@Think.COM

     Look at all this crap.  I don't care what anyone says about

     how iteration variables REALLY aren't been used...

     I JUST DON'T WANT TO SEE THESE STUPID MESSAGES AND I DON'T

     PARTICULARLY FEEL LIKE GOING AND PUTTING STUPID #+ WHATEVER's

     OVER THIS CODE.

     SYMBOLICS SHOULD BE SHOT FOR ISSUING THIS WARNING.

     ...

  The only little problem is--all Symbolics did was implement what it

  felt CLtL said to implement.  What the user is really complaining

  about is that the implementation didn't do the same thing as he

  expected, and the only way it ever will is if we resolve this issue

  once and for all.

Copyright 1996, The Harlequin Group Limited.  All Rights Reserved.


text:
/*
 * @author: Jean Lazarou
 * @date: 15 fevr. 04
 */
package com.ap.jdbcunit;

import java.sql.*;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class PreparedStatementWrapper extends StatementWrapper implements PreparedStatement {

	public PreparedStatementWrapper(Connection con, String sql, PreparedStatement actualStatement) {
		super(con, actualStatement);

		actualPrepared = actualStatement;

		this.sql = sql;
	}

	public ResultSet executeQuery() throws SQLException {

		if (JDBCUnit.isRecording()) {

			String sql = prepareStatement();

			if (JDBCUnit.getRecorder().existsTrack(con.getMetaData().getURL(), sql)) {
				return JDBCUnit.getRecorder().get(this, con.getMetaData().getURL(), sql);
			}

			ResultSet rs = this.actualPrepared.executeQuery();

			JDBCUnit.getRecorder().add(con.getMetaData().getURL(), sql, rs);

		} else if (JDBCUnit.isReplaying()) {
			return JDBCUnit.getRecorder().get(this, con.getMetaData().getURL(), prepareStatement());
		}

		return actualPrepared.executeQuery();
	}

	public int executeUpdate() throws SQLException {

		if (JDBCUnit.isRecording()) {

			String sql = prepareStatement();

			if (JDBCUnit.getRecorder().existsTrack(con.getMetaData().getURL(), sql)) {
				return getRecordedUpdate(sql);
			}

			int count = this.actualPrepared.executeUpdate();

			JDBCUnit.getRecorder().add(con.getMetaData().getURL(), sql, createResultSet(count));

			return count;

		} else if (JDBCUnit.isReplaying()) {
			return getRecordedUpdate(prepareStatement());
		}

		return actualPrepared.executeUpdate();

	}

	public void setNull(int parameterIndex, int sqlType) throws SQLException {
		register(parameterIndex, null);
		actualPrepared.setNull(parameterIndex, sqlType);
	}

	public void setBoolean(int parameterIndex, boolean x) throws SQLException {
		register(parameterIndex, x ? Boolean.TRUE : Boolean.FALSE);
		actualPrepared.setBoolean(parameterIndex, x);
	}

	public void setByte(int parameterIndex, byte x) throws SQLException {
		register(parameterIndex, new Integer(x));
		actualPrepared.setByte(parameterIndex, x);
	}

	public void setShort(int parameterIndex, short x) throws SQLException {
		register(parameterIndex, new Integer(x));
		actualPrepared.setShort(parameterIndex, x);
	}

	public void setInt(int parameterIndex, int x) throws SQLException {
		register(parameterIndex, new Integer(x));
		actualPrepared.setInt(parameterIndex, x);
	}

	public void setLong(int parameterIndex, long x) throws SQLException {
		register(parameterIndex, new Long(x));
		actualPrepared.setLong(parameterIndex, x);
	}

	public void setFloat(int parameterIndex, float x) throws SQLException {
		register(parameterIndex, new Float(x));
		actualPrepared.setFloat(parameterIndex, x);
	}

	public void setDouble(int parameterIndex, double x) throws SQLException {
		register(parameterIndex, new Double(x));
		actualPrepared.setDouble(parameterIndex, x);
	}

	public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setBigDecimal(parameterIndex, x);
	}

	public void setString(int parameterIndex, String x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setString(parameterIndex, x);
	}

	public void setBytes(int parameterIndex, byte[] x) throws SQLException {
		register(parameterIndex, new String(x));
		actualPrepared.setBytes(parameterIndex, x);
	}

	public void setDate(int parameterIndex, Date x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setDate(parameterIndex, x);
	}

	public void setTime(int parameterIndex, Time x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setTime(parameterIndex, x);
	}

	public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setTimestamp(parameterIndex, x);
	}

	public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
		actualPrepared.setAsciiStream(parameterIndex, x, length);
	}

	public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
		actualPrepared.setUnicodeStream(parameterIndex, x, length);
	}

	public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
		actualPrepared.setBinaryStream(parameterIndex, x, length);
	}

	public void clearParameters() throws SQLException {
		values.clear();
		actualPrepared.clearParameters();
	}

	public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setObject(parameterIndex, x, targetSqlType, scale);
	}

	public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setObject(parameterIndex, x, targetSqlType);
	}

	public void setObject(int parameterIndex, Object x) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setObject(parameterIndex, x);
	}

	public boolean execute() throws SQLException {
		return actualPrepared.execute();
	}

	public void addBatch() throws SQLException {
		actualPrepared.addBatch();
	}

	public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
		actualPrepared.setCharacterStream(parameterIndex, reader, length);
	}

	public void setRef(int parameterIndex, Ref x) throws SQLException {
		actualPrepared.setRef(parameterIndex, x);
	}

	public void setBlob(int parameterIndex, Blob x) throws SQLException {
		actualPrepared.setBlob(parameterIndex, x);
	}

	public void setClob(int parameterIndex, Clob x) throws SQLException {
		actualPrepared.setClob(parameterIndex, x);
	}

	public void setArray(int parameterIndex, Array x) throws SQLException {
		actualPrepared.setArray(parameterIndex, x);
	}

	public ResultSetMetaData getMetaData() throws SQLException {
		return actualPrepared.getMetaData();
	}

	public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setDate(parameterIndex, x, cal);
	}

	public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setTime(parameterIndex, x, cal);
	}

	public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
		register(parameterIndex, x);
		actualPrepared.setTimestamp(parameterIndex, x, cal);
	}

	public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
		register(parameterIndex, null);
		actualPrepared.setNull(parameterIndex, sqlType, typeName);
	}

	protected void clear() {
		values.clear();
	}

	protected void register(int parameterIndex, Object value) {

		parameterIndex--;

		for (int i = values.size(); i <= parameterIndex; i++) {
			values.add(null);
		}

		values.set(parameterIndex, value);

	}

	private String prepareStatement() throws SQLException {

		StringBuffer buffer = new StringBuffer();

		int index = 0;

		int prev = 0;
		int param = sql.indexOf('?');

		while (param != -1) {

			buffer.append(sql.substring(prev, param));

			if (index >= values.size()) {
				break;
			}

			Object value = values.get(index++);

			if (value instanceof String || value instanceof Date) {
				buffer.append('\'');
				buffer.append(value);
				buffer.append('\'');
			} else {
				buffer.append(value);
			}

			prev = param + 1;
			param = sql.indexOf('?', prev);
		}

		if (prev < sql.length()) {
			buffer.append(sql.substring(prev));
		}

		return buffer.toString();
	}

	String sql;
	PreparedStatement actualPrepared;

	List values = new ArrayList();

	public void setURL(int parameterIndex, URL x) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public ParameterMetaData getParameterMetaData() throws SQLException {
		throw new UnsupportedOperationException();
	}

	public int getResultSetHoldability() throws SQLException {
		throw new UnsupportedOperationException();
	}

	public boolean getMoreResults(int current) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public boolean execute(String sql, int[] columnIndexes) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public ResultSet getGeneratedKeys() throws SQLException {
		throw new UnsupportedOperationException();
	}

	public int executeUpdate(String sql, String[] columnNames) throws SQLException {
		throw new UnsupportedOperationException();
	}

	public boolean execute(String sql, String[] columnNames) throws SQLException {
		throw new UnsupportedOperationException();
	}

    //------------------------- JDBC 4.0 -----------------------------------

	public void setRowId(int parameterIndex, RowId x) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNString(int parameterIndex, String value) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNClob(int parameterIndex, NClob value) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setClob(int parameterIndex, Reader reader) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
		throw new UnsupportedOperationException();

	}

	public void setNClob(int parameterIndex, Reader reader) throws SQLException {
		throw new UnsupportedOperationException();

	}

}