text:
package vtgate

import (
	"context"
	"flag"
	"io"
	"regexp"
	"sync"
	"time"

	"google.golang.org/protobuf/proto"

	"vitess.io/vitess/go/mysql"
	"vitess.io/vitess/go/sqltypes"
	"vitess.io/vitess/go/stats"
	"vitess.io/vitess/go/vt/concurrency"
	"vitess.io/vitess/go/vt/discovery"
	"vitess.io/vitess/go/vt/log"
	"vitess.io/vitess/go/vt/srvtopo"
	"vitess.io/vitess/go/vt/topo/topoproto"
	"vitess.io/vitess/go/vt/vterrors"
	"vitess.io/vitess/go/vt/vtgate/buffer"
	"vitess.io/vitess/go/vt/vttablet/queryservice"

	querypb "vitess.io/vitess/go/vt/proto/query"
	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
	vtgatepb "vitess.io/vitess/go/vt/proto/vtgate"
	vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
)

var (
	messageStreamGracePeriod = flag.Duration("message_stream_grace_period", 30*time.Second, "the amount of time to give for a vttablet to resume if it ends a message stream, usually because of a reparent.")
)

// ScatterConn is used for executing queries across
// multiple shard level connections.
type ScatterConn struct {
	timings              *stats.MultiTimings
	tabletCallErrorCount *stats.CountersWithMultiLabels
	txConn               *TxConn
	gateway              Gateway
	legacyHealthCheck    discovery.LegacyHealthCheck
}

// shardActionFunc defines the contract for a shard action
// outside of a transaction. Every such function executes the
// necessary action on a shard, sends the results to sResults, and
// return an error if any.  multiGo is capable of executing
// multiple shardActionFunc actions in parallel and
// consolidating the results and errors for the caller.
type shardActionFunc func(rs *srvtopo.ResolvedShard, i int) error

// shardActionTransactionFunc defines the contract for a shard action
// that may be in a transaction. Every such function executes the
// necessary action on a shard (with an optional Begin call), aggregates
// the results, and return an error if any.
// multiGoTransaction is capable of executing multiple
// shardActionTransactionFunc actions in parallel and consolidating
// the results and errors for the caller.
type shardActionTransactionFunc func(rs *srvtopo.ResolvedShard, i int, shardActionInfo *shardActionInfo) (*shardActionInfo, error)

// NewLegacyScatterConn creates a new ScatterConn.
func NewLegacyScatterConn(statsName string, txConn *TxConn, gw Gateway, hc discovery.LegacyHealthCheck) *ScatterConn {
	tabletCallErrorCountStatsName := ""
	if statsName != "" {
		tabletCallErrorCountStatsName = statsName + "ErrorCount"
	}
	return &ScatterConn{
		timings: stats.NewMultiTimings(
			statsName,
			"Scatter connection timings",
			[]string{"Operation", "Keyspace", "ShardName", "DbType"}),
		tabletCallErrorCount: stats.NewCountersWithMultiLabels(
			tabletCallErrorCountStatsName,
			"Error count from tablet calls in scatter conns",
			[]string{"Operation", "Keyspace", "ShardName", "DbType"}),
		txConn:            txConn,
		gateway:           gw,
		legacyHealthCheck: hc,
	}
}

// NewScatterConn creates a new ScatterConn.
func NewScatterConn(statsName string, txConn *TxConn, gw *TabletGateway) *ScatterConn {
	// this only works with TabletGateway
	tabletCallErrorCountStatsName := ""
	if statsName != "" {
		tabletCallErrorCountStatsName = statsName + "ErrorCount"
	}
	return &ScatterConn{
		timings: stats.NewMultiTimings(
			statsName,
			"Scatter connection timings",
			[]string{"Operation", "Keyspace", "ShardName", "DbType"}),
		tabletCallErrorCount: stats.NewCountersWithMultiLabels(
			tabletCallErrorCountStatsName,
			"Error count from tablet calls in scatter conns",
			[]string{"Operation", "Keyspace", "ShardName", "DbType"}),
		txConn:  txConn,
		gateway: gw,
		// gateway has a reference to healthCheck so we don't need this any more
		legacyHealthCheck: nil,
	}
}

func (stc *ScatterConn) startAction(name string, target *querypb.Target) (time.Time, []string) {
	statsKey := []string{name, target.Keyspace, target.Shard, topoproto.TabletTypeLString(target.TabletType)}
	startTime := time.Now()
	return startTime, statsKey
}

func (stc *ScatterConn) endAction(startTime time.Time, allErrors *concurrency.AllErrorRecorder, statsKey []string, err *error, session *SafeSession) {
	if *err != nil {
		allErrors.RecordError(*err)
		// Don't increment the error counter for duplicate
		// keys or bad queries, as those errors are caused by
		// client queries and are not VTGate's fault.
		ec := vterrors.Code(*err)
		if ec != vtrpcpb.Code_ALREADY_EXISTS && ec != vtrpcpb.Code_INVALID_ARGUMENT {
			stc.tabletCallErrorCount.Add(statsKey, 1)
		}
		if ec == vtrpcpb.Code_RESOURCE_EXHAUSTED || ec == vtrpcpb.Code_ABORTED {
			session.SetRollback()
		}
	}
	stc.timings.Record(statsKey, startTime)
}

type reset int

const (
	none reset = iota
	shard
	newQS
)

// ExecuteMultiShard is like Execute,
// but each shard gets its own Sql Queries and BindVariables.
//
// It always returns a non-nil query result and an array of
// shard errors which may be nil so that callers can optionally
// process a partially-successful operation.
func (stc *ScatterConn) ExecuteMultiShard(
	ctx context.Context,
	rss []*srvtopo.ResolvedShard,
	queries []*querypb.BoundQuery,
	session *SafeSession,
	autocommit bool,
	ignoreMaxMemoryRows bool,
) (qr *sqltypes.Result, errs []error) {

	if len(rss) != len(queries) {
		return nil, []error{vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] got mismatched number of queries and shards")}
	}

	// mu protects qr
	var mu sync.Mutex
	qr = new(sqltypes.Result)

	if session.InLockSession() && session.TriggerLockHeartBeat() {
		go func() {
			_, lockErr := stc.ExecuteLock(ctx, &srvtopo.ResolvedShard{
				Target:  session.LockSession.Target,
				Gateway: stc.gateway,
			}, &querypb.BoundQuery{
				Sql:           "select 1",
				BindVariables: nil,
			}, session)
			if lockErr != nil {
				log.Warningf("Locking heartbeat failed, held locks might be released: %s", lockErr.Error())
			}
		}()
	}

	allErrors := stc.multiGoTransaction(
		ctx,
		"Execute",
		rss,
		session,
		autocommit,
		func(rs *srvtopo.ResolvedShard, i int, info *shardActionInfo) (*shardActionInfo, error) {
			var (
				innerqr *sqltypes.Result
				err     error
				opts    *querypb.ExecuteOptions
				alias   *topodatapb.TabletAlias
				qs      queryservice.QueryService
			)
			transactionID := info.transactionID
			reservedID := info.reservedID

			if session != nil && session.Session != nil {
				opts = session.Session.Options
			}

			if autocommit {
				// As this is auto-commit, the transactionID is supposed to be zero.
				if transactionID != int64(0) {
					return nil, vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "in autocommit mode, transactionID should be zero but was: %d", transactionID)
				}
			}

			qs, err = getQueryService(rs, info)
			if err != nil {
				return nil, err
			}

			retryRequest := func(exec func()) {
				retry := checkAndResetShardSession(info, err, session, rs.Target)
				switch retry {
				case newQS:
					// Current tablet is not available, try querying new tablet using gateway.
					qs = rs.Gateway
					fallthrough
				case shard:
					// if we need to reset a reserved connection, here is our chance to try executing again,
					// against a new connection
					exec()
				}
			}

			switch info.actionNeeded {
			case nothing:
				innerqr, err = qs.Execute(ctx, rs.Target, queries[i].Sql, queries[i].BindVariables, info.transactionID, info.reservedID, opts)
				if err != nil {
					retryRequest(func() {
						// we seem to have lost our connection. it was a reserved connection, let's try to recreate it
						info.actionNeeded = reserve
						innerqr, reservedID, alias, err = qs.ReserveExecute(ctx, rs.Target, session.SetPreQueries(), queries[i].Sql, queries[i].BindVariables, 0 /*transactionId*/, opts)
					})
				}
			case begin:
				innerqr, transactionID, alias, err = qs.BeginExecute(ctx, rs.Target, session.Savepoints, queries[i].Sql, queries[i].BindVariables, reservedID, opts)
				if err != nil {
					retryRequest(func() {
						// we seem to have lost our connection. it was a reserved connection, let's try to recreate it
						info.actionNeeded = reserveBegin
						innerqr, transactionID, reservedID, alias, err = qs.ReserveBeginExecute(ctx, rs.Target, session.SetPreQueries(), queries[i].Sql, queries[i].BindVariables, opts)
					})
				}
			case reserve:
				innerqr, reservedID, alias, err = qs.ReserveExecute(ctx, rs.Target, session.SetPreQueries(), queries[i].Sql, queries[i].BindVariables, transactionID, opts)
			case reserveBegin:
				innerqr, transactionID, reservedID, alias, err = qs.ReserveBeginExecute(ctx, rs.Target, session.SetPreQueries(), queries[i].Sql, queries[i].BindVariables, opts)
			default:
				return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] unexpected actionNeeded on query execution: %v", info.actionNeeded)
			}
			// We need to new shard info irrespective of the error.
			newInfo := info.updateTransactionAndReservedID(transactionID, reservedID, alias)
			if err != nil {
				return newInfo, err
			}
			mu.Lock()
			defer mu.Unlock()

			// Don't append more rows if row count is exceeded.
			if ignoreMaxMemoryRows || len(qr.Rows) <= *maxMemoryRows {
				qr.AppendResult(innerqr)
			}
			return newInfo, nil
		},
	)

	if !ignoreMaxMemoryRows && len(qr.Rows) > *maxMemoryRows {
		return nil, []error{vterrors.NewErrorf(vtrpcpb.Code_RESOURCE_EXHAUSTED, vterrors.NetPacketTooLarge, "in-memory row count exceeded allowed limit of %d", *maxMemoryRows)}
	}

	return qr, allErrors.GetErrors()
}

func checkAndResetShardSession(info *shardActionInfo, err error, session *SafeSession, target *querypb.Target) reset {
	retry := none
	if info.reservedID != 0 && info.transactionID == 0 {
		if wasConnectionClosed(err) {
			retry = shard
		}
		if requireNewQS(err, target) {
			retry = newQS
		}
	}
	if retry != none {
		_ = session.ResetShard(info.alias)
	}
	return retry
}

func getQueryService(rs *srvtopo.ResolvedShard, info *shardActionInfo) (queryservice.QueryService, error) {
	_, usingLegacyGw := rs.Gateway.(*DiscoveryGateway)
	if usingLegacyGw &&
		(info.actionNeeded == reserve || info.actionNeeded == reserveBegin) {
		return nil, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "reserved connections are not supported on old gen gateway")
	}
	if usingLegacyGw || info.alias == nil {
		return rs.Gateway, nil
	}
	return rs.Gateway.QueryServiceByAlias(info.alias, rs.Target)
}

func (stc *ScatterConn) processOneStreamingResult(mu *sync.Mutex, fieldSent *bool, qr *sqltypes.Result, callback func(*sqltypes.Result) error) error {
	mu.Lock()
	defer mu.Unlock()
	if *fieldSent {
		if len(qr.Rows) == 0 {
			// It's another field info result. Don't send.
			return nil
		}
	} else {
		if len(qr.Fields) == 0 {
			// Unreachable: this can happen only if vttablet misbehaves.
			return vterrors.New(vtrpcpb.Code_INTERNAL, "received rows before fields")
		}
		*fieldSent = true
	}

	return callback(qr)
}

// StreamExecute executes a streaming query on vttablet. The retry rules are the same.
// Note we guarantee the callback will not be called concurrently
// by multiple go routines, through processOneStreamingResult.
func (stc *ScatterConn) StreamExecute(
	ctx context.Context,
	query string,
	bindVars map[string]*querypb.BindVariable,
	rss []*srvtopo.ResolvedShard,
	options *querypb.ExecuteOptions,
	callback func(reply *sqltypes.Result) error,
) error {

	// mu protects fieldSent, replyErr and callback
	var mu sync.Mutex
	fieldSent := false

	allErrors := stc.multiGo("StreamExecute", rss, func(rs *srvtopo.ResolvedShard, i int) error {
		return rs.Gateway.StreamExecute(ctx, rs.Target, query, bindVars, 0, options, func(qr *sqltypes.Result) error {
			return stc.processOneStreamingResult(&mu, &fieldSent, qr, callback)
		})
	})
	return allErrors.AggrError(vterrors.Aggregate)
}

// StreamExecuteMulti is like StreamExecute,
// but each shard gets its own bindVars. If len(shards) is not equal to
// len(bindVars), the function panics.
// Note we guarantee the callback will not be called concurrently
// by multiple go routines, through processOneStreamingResult.
func (stc *ScatterConn) StreamExecuteMulti(
	ctx context.Context,
	query string,
	rss []*srvtopo.ResolvedShard,
	bindVars []map[string]*querypb.BindVariable,
	options *querypb.ExecuteOptions,
	callback func(reply *sqltypes.Result) error,
) []error {
	// mu protects fieldSent, callback and replyErr
	var mu sync.Mutex
	fieldSent := false

	allErrors := stc.multiGo("StreamExecute", rss, func(rs *srvtopo.ResolvedShard, i int) error {
		return rs.Gateway.StreamExecute(ctx, rs.Target, query, bindVars[i], 0, options, func(qr *sqltypes.Result) error {
			return stc.processOneStreamingResult(&mu, &fieldSent, qr, callback)
		})
	})
	return allErrors.GetErrors()
}

// timeTracker is a convenience wrapper used by MessageStream
// to track how long a stream has been unavailable.
type timeTracker struct {
	mu         sync.Mutex
	timestamps map[*querypb.Target]time.Time
}

func newTimeTracker() *timeTracker {
	return &timeTracker{
		timestamps: make(map[*querypb.Target]time.Time),
	}
}

// Reset resets the timestamp set by Record.
func (tt *timeTracker) Reset(target *querypb.Target) {
	tt.mu.Lock()
	defer tt.mu.Unlock()
	delete(tt.timestamps, target)
}

// Record records the time to Now if there was no previous timestamp,
// and it keeps returning that value until the next Reset.
func (tt *timeTracker) Record(target *querypb.Target) time.Time {
	tt.mu.Lock()
	defer tt.mu.Unlock()
	last, ok := tt.timestamps[target]
	if !ok {
		last = time.Now()
		tt.timestamps[target] = last
	}
	return last
}

// MessageStream streams messages from the specified shards.
// Note we guarantee the callback will not be called concurrently
// by multiple go routines, through processOneStreamingResult.
func (stc *ScatterConn) MessageStream(ctx context.Context, rss []*srvtopo.ResolvedShard, name string, callback func(*sqltypes.Result) error) error {
	// The cancelable context is used for handling errors
	// from individual streams.
	ctx, cancel := context.WithCancel(ctx)
	defer cancel()

	// mu is used to merge multiple callback calls into one.
	var mu sync.Mutex
	fieldSent := false
	lastErrors := newTimeTracker()
	allErrors := stc.multiGo("MessageStream", rss, func(rs *srvtopo.ResolvedShard, i int) error {
		// This loop handles the case where a reparent happens, which can cause
		// an individual stream to end. If we don't succeed on the retries for
		// messageStreamGracePeriod, we abort and return an error.
		for {
			err := rs.Gateway.MessageStream(ctx, rs.Target, name, func(qr *sqltypes.Result) error {
				lastErrors.Reset(rs.Target)
				return stc.processOneStreamingResult(&mu, &fieldSent, qr, callback)
			})
			// nil and EOF are equivalent. UNAVAILABLE can be returned by vttablet if it's demoted
			// from master to replica. For any of these conditions, we have to retry.
			if err != nil && err != io.EOF && vterrors.Code(err) != vtrpcpb.Code_UNAVAILABLE {
				cancel()
				return err
			}

			// There was no error. We have to see if we need to retry.
			// If context was canceled, likely due to client disconnect,
			// return normally without retrying.
			select {
			case <-ctx.Done():
				return nil
			default:
			}
			firstErrorTimeStamp := lastErrors.Record(rs.Target)
			if time.Since(firstErrorTimeStamp) >= *messageStreamGracePeriod {
				// Cancel all streams and return an error.
				cancel()
				return vterrors.Errorf(vtrpcpb.Code_DEADLINE_EXCEEDED, "message stream from %v has repeatedly failed for longer than %v", rs.Target, *messageStreamGracePeriod)
			}

			// It's not been too long since our last good send. Wait and retry.
			select {
			case <-ctx.Done():
				return nil
			case <-time.After(*messageStreamGracePeriod / 5):
			}
		}
	})
	return allErrors.AggrError(vterrors.Aggregate)
}

// Close closes the underlying Gateway.
func (stc *ScatterConn) Close() error {
	return stc.gateway.Close(context.Background())
}

// GetGatewayCacheStatus returns a displayable version of the Gateway cache.
func (stc *ScatterConn) GetGatewayCacheStatus() TabletCacheStatusList {
	return stc.gateway.CacheStatus()
}

// GetLegacyHealthCheckCacheStatus returns a displayable version of the HealthCheck cache.
func (stc *ScatterConn) GetLegacyHealthCheckCacheStatus() discovery.LegacyTabletsCacheStatusList {
	if stc.legacyHealthCheck != nil {
		return stc.legacyHealthCheck.CacheStatus()
	}
	return nil
}

// GetHealthCheckCacheStatus returns a displayable version of the HealthCheck cache.
func (stc *ScatterConn) GetHealthCheckCacheStatus() discovery.TabletsCacheStatusList {
	if UsingLegacyGateway() {
		panic("this should never be called")
	}

	return stc.gateway.TabletsCacheStatus()
}

// multiGo performs the requested 'action' on the specified
// shards in parallel. This does not handle any transaction state.
// The action function must match the shardActionFunc2 signature.
func (stc *ScatterConn) multiGo(
	name string,
	rss []*srvtopo.ResolvedShard,
	action shardActionFunc,
) (allErrors *concurrency.AllErrorRecorder) {
	allErrors = new(concurrency.AllErrorRecorder)
	if len(rss) == 0 {
		return allErrors
	}

	oneShard := func(rs *srvtopo.ResolvedShard, i int) {
		var err error
		startTime, statsKey := stc.startAction(name, rs.Target)
		// Send a dummy session.
		// TODO(sougou): plumb a real session through this call.
		defer stc.endAction(startTime, allErrors, statsKey, &err, NewSafeSession(nil))
		err = action(rs, i)
	}

	if len(rss) == 1 {
		// only one shard, do it synchronously.
		oneShard(rss[0], 0)
		return allErrors
	}

	var wg sync.WaitGroup
	for i, rs := range rss {
		wg.Add(1)
		go func(rs *srvtopo.ResolvedShard, i int) {
			defer wg.Done()
			oneShard(rs, i)
		}(rs, i)
	}
	wg.Wait()
	return allErrors
}

// multiGoTransaction performs the requested 'action' on the specified
// ResolvedShards in parallel. For each shard, if the requested
// session is in a transaction, it opens a new transactions on the connection,
// and updates the Session with the transaction id. If the session already
// contains a transaction id for the shard, it reuses it.
// The action function must match the shardActionTransactionFunc signature.
//
// It returns an error recorder in which each shard error is recorded positionally,
// i.e. if rss[2] had an error, then the error recorder will store that error
// in the second position.
func (stc *ScatterConn) multiGoTransaction(
	ctx context.Context,
	name string,
	rss []*srvtopo.ResolvedShard,
	session *SafeSession,
	autocommit bool,
	action shardActionTransactionFunc,
) (allErrors *concurrency.AllErrorRecorder) {

	numShards := len(rss)
	allErrors = new(concurrency.AllErrorRecorder)

	if numShards == 0 {
		return allErrors
	}
	oneShard := func(rs *srvtopo.ResolvedShard, i int) {
		var err error
		startTime, statsKey := stc.startAction(name, rs.Target)
		defer stc.endAction(startTime, allErrors, statsKey, &err, session)

		shardActionInfo := actionInfo(rs.Target, session, autocommit)
		updated, err := action(rs, i, shardActionInfo)
		if updated == nil {
			return
		}
		if updated.actionNeeded != nothing && (updated.transactionID != 0 || updated.reservedID != 0) {
			appendErr := session.AppendOrUpdate(&vtgatepb.Session_ShardSession{
				Target:        rs.Target,
				TransactionId: updated.transactionID,
				ReservedId:    updated.reservedID,
				TabletAlias:   updated.alias,
			}, stc.txConn.mode)
			if appendErr != nil {
				err = appendErr
			}
		}
	}

	if numShards == 1 {
		// only one shard, do it synchronously.
		for i, rs := range rss {
			oneShard(rs, i)
		}
	} else {
		var wg sync.WaitGroup
		for i, rs := range rss {
			wg.Add(1)
			go func(rs *srvtopo.ResolvedShard, i int) {
				defer wg.Done()
				oneShard(rs, i)
			}(rs, i)
		}
		wg.Wait()
	}

	if session.MustRollback() {
		stc.txConn.Rollback(ctx, session)
	}
	return allErrors
}

// ExecuteLock performs the requested 'action' on the specified
// ResolvedShard. If the lock session already has a reserved connection,
// it reuses it. Otherwise open a new reserved connection.
// The action function must match the shardActionTransactionFunc signature.
//
// It returns an error recorder in which each shard error is recorded positionally,
// i.e. if rss[2] had an error, then the error recorder will store that error
// in the second position.
func (stc *ScatterConn) ExecuteLock(
	ctx context.Context,
	rs *srvtopo.ResolvedShard,
	query *querypb.BoundQuery,
	session *SafeSession,
) (*sqltypes.Result, error) {

	var (
		qr    *sqltypes.Result
		err   error
		opts  *querypb.ExecuteOptions
		alias *topodatapb.TabletAlias
	)
	allErrors := new(concurrency.AllErrorRecorder)
	startTime, statsKey := stc.startAction("ExecuteLock", rs.Target)
	defer stc.endAction(startTime, allErrors, statsKey, &err, session)

	if session == nil || session.Session == nil {
		return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "session cannot be nil")
	}

	opts = session.Session.Options
	info, err := lockInfo(rs.Target, session)
	// Lock session is created on alphabetic sorted keyspace.
	// This error will occur if the existing session target does not match the current target.
	// This will happen either due to re-sharding or a new keyspace which comes before the existing order.
	// In which case, we will try to release old locks and return error.
	if err != nil {
		_ = stc.txConn.ReleaseLock(ctx, session)
		return nil, vterrors.Wrap(err, "Any previous held locks are released")
	}
	qs, err := getQueryService(rs, info)
	if err != nil {
		return nil, err
	}
	reservedID := info.reservedID

	switch info.actionNeeded {
	case nothing:
		if reservedID == 0 {
			return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] reserved id zero not expected %v", reservedID)
		}
		qr, err = qs.Execute(ctx, rs.Target, query.Sql, query.BindVariables, 0 /* transactionID */, reservedID, opts)
		if err != nil && wasConnectionClosed(err) {
			session.ResetLock()
			err = vterrors.Wrap(err, "held locks released")
		}
		session.UpdateLockHeartbeat()
	case reserve:
		qr, reservedID, alias, err = qs.ReserveExecute(ctx, rs.Target, session.SetPreQueries(), query.Sql, query.BindVariables, 0 /* transactionID */, opts)
		if err != nil && reservedID != 0 {
			_ = stc.txConn.ReleaseLock(ctx, session)
		}

		if reservedID != 0 {
			session.SetLockSession(&vtgatepb.Session_ShardSession{
				Target:      rs.Target,
				ReservedId:  reservedID,
				TabletAlias: alias,
			})
		}
	default:
		return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] unexpected actionNeeded on lock execution: %v", info.actionNeeded)
	}

	if err != nil {
		return nil, err
	}
	return qr, err
}

var txClosed = regexp.MustCompile("transaction ([a-z0-9:]+) (?:ended|not found)")

func wasConnectionClosed(err error) bool {
	sqlErr := mysql.NewSQLErrorFromError(err).(*mysql.SQLError)
	message := sqlErr.Error()

	return sqlErr.Number() == mysql.CRServerGone ||
		sqlErr.Number() == mysql.CRServerLost ||
		(sqlErr.Number() == mysql.ERQueryInterrupted && txClosed.MatchString(message))
}

func requireNewQS(err error, target *querypb.Target) bool {
	code := vterrors.Code(err)
	msg := err.Error()
	return (code == vtrpcpb.Code_FAILED_PRECONDITION && (vterrors.RxOp.MatchString(msg) || vterrors.RxWrongTablet.MatchString(msg))) ||
		(target != nil && target.TabletType == topodatapb.TabletType_MASTER && buffer.CausedByFailover(err))
}

// actionInfo looks at the current session, and returns information about what needs to be done for this tablet
func actionInfo(target *querypb.Target, session *SafeSession, autocommit bool) *shardActionInfo {
	if !(session.InTransaction() || session.InReservedConn()) {
		return &shardActionInfo{}
	}
	// No need to protect ourselves from the race condition between
	// Find and AppendOrUpdate. The higher level functions ensure that no
	// duplicate (target) tuples can execute
	// this at the same time.
	transactionID, reservedID, alias := session.Find(target.Keyspace, target.Shard, target.TabletType)

	shouldReserve := session.InReservedConn() && reservedID == 0
	shouldBegin := session.InTransaction() && transactionID == 0 && !autocommit

	var act = nothing
	switch {
	case shouldBegin && shouldReserve:
		act = reserveBegin
	case shouldReserve:
		act = reserve
	case shouldBegin:
		act = begin
	}

	return &shardActionInfo{
		actionNeeded:  act,
		transactionID: transactionID,
		reservedID:    reservedID,
		alias:         alias,
	}
}

// lockInfo looks at the current session, and returns information about what needs to be done for this tablet
func lockInfo(target *querypb.Target, session *SafeSession) (*shardActionInfo, error) {
	if session.LockSession == nil {
		return &shardActionInfo{actionNeeded: reserve}, nil
	}

	if !proto.Equal(target, session.LockSession.Target) {
		return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "target does match the existing lock session target: (%v, %v)", target, session.LockSession.Target)
	}

	return &shardActionInfo{
		actionNeeded: nothing,
		reservedID:   session.LockSession.ReservedId,
		alias:        session.LockSession.TabletAlias,
	}, nil
}

type shardActionInfo struct {
	actionNeeded              actionNeeded
	reservedID, transactionID int64
	alias                     *topodatapb.TabletAlias
}

func (sai *shardActionInfo) updateTransactionAndReservedID(txID int64, rID int64, alias *topodatapb.TabletAlias) *shardActionInfo {
	if txID == sai.transactionID && rID == sai.reservedID {
		// As transaction id and reserved id have not changed, there is nothing to update in session shard sessions.
		return nil
	}
	newInfo := *sai
	newInfo.reservedID = rID
	newInfo.transactionID = txID
	newInfo.alias = alias
	return &newInfo
}

type actionNeeded int

const (
	nothing actionNeeded = iota
	reserveBegin
	reserve
	begin
)

redpajama_set_name: RedPajamaGithub


text:
Q: HQL of a many-to-many relation I got a language and a country class.
@Entity
@Table(name = "countries")
@org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
@NamedQueries({
        @NamedQuery(name="Country.findLanguagesByCountryId",query="???")
})
public class Country implements IEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(nullable = false, unique = true)
    private String name;

    @ManyToMany(targetEntity = Language.class)
    @JoinTable(name = "country_language", joinColumns = {@JoinColumn(name = "cid")}, inverseJoinColumns = {@JoinColumn(name = "lid")})
    private Set<Language> languages;
}

@Entity
@Table(name = "languages")
public class Language implements IEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(nullable = false, unique = true)
    private String name;
}

As you can see country has a list of languages but language doesn't have a list of countries.
I need the HQL which should find languages by country id.

A: I think I've found the answer
select language from Country country
inner join country.languages language
where country.id=?1

redpajama_set_name: RedPajamaStackExchange


text:
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
import pandas
from pandas import DataFrame
import pandas.io.sql as psql
import KnowledgeBase
import NeuralNetworkController
import DecisionTreeController
import RandomForestController
import SVMController
import random
##############################################################################################################
# ML-Controller class																					     #
# SKLearn interface for NEMO																		 		 #
##############################################################################################################
# ***** INSTANCE VARIABLES*****																				 #
# data		-		attributes as retrieved from the DATA table 											 #
# target	-		classes as retrieved from the the DATA table											 #
# kb		-		instance of knowledge base object														 #
##############################################################################################################
class ML_Controller:
	#Constructor
	#imports data from knowledge base
	#Preconditions:
	# * A knowledge base has been set up and read data
	#Postconditions:
	# * Data will be imported from the
	def __init__(self, kb, algorithm_type):
		cols = ",".join(kb.X)
		stmt = "select " + cols + " from DATA;"
		#print stmt
		self.data = pandas.read_sql_query(stmt, kb.db)
		#print self.data
		#print "data length = " + str(len(self.data))
		stmt = "select " + kb.Y + " from DATA"
		#print stmt
		self.target = pandas.read_sql_query(stmt, kb.db)
		#print self.target
		#print "target length = " + str(len(self.target))
		self.kb = kb
		self.isCurrentlyOptimizing = False	#True when model is in optimization queue, false otherwise
		self.algorithm = None
		#print algorithm_type
		if algorithm_type == "Neural Network":
			self.algorithm = NeuralNetworkController.NeuralNetworkController(self.kb)
		if algorithm_type == "Decision Tree":
			self.algorithm = DecisionTreeController.DecisionTreeController(self.kb)
		if algorithm_type == 'SVM':
			self.algorithm = SVMController.SVMController(self.kb)
		if algorithm_type == "Random Forest":
			self.algorithm = RandomForestController.RandomForestController(self.kb)

	def get_params(self):
		return self.algorithm.get_params()

	def createModel(self, id=None):
		if id is None:
			self.algorithm.createModel(self.data, self.target)
		else:
			self.algorithm.createModelFromID(self.data, self.target, id)

	def createModelPreSplit(self, xtrain, xtest, ytrain, ytest, attributes=None):
		if attributes is None and self.algorithm.isModelCreated():
			attributes = self.get_params()
		self.algorithm.createModelPreSplit(xtrain, xtest, ytrain, ytest, attributes)

	def copyModel(self, id):
		self.algorithm.copyModel(self.data, self.target, id)

	def fit(self, x, y):

		self.algorithm.fit(x,y)

	def predict(self, x):
		return self.algorithm.predict(x)

	def runAlgorithm(self, x = None, y = None):
		results = self.algorithm.runModel(self.kb.multi, x, y)
		#self.kb.updateDatabaseWithResults(self.algorithm)
		return results

	def updateDatabaseWithResults(self):
		self.kb.updateDatabaseWithResults(self.algorithm)

	def getName(self):
		return self.algorithm.algorithm_name

	def getID(self):
		return self.algorithm.algorithm_id

	def optimizeAlgorithm(self):
		curr_id = self.algorithm.algorithm_id
		self.algorithm = self.algorithm.optimize('Accuracy', 'Coordinate Ascent')
		self.algorithm.algorithm_id = curr_id
		self.algorithm.results['ID'] = curr_id
		self.kb.updateDatabaseWithResults(self.algorithm)
		#self.kb.removeModelFromRepository(self.algorithm)
		self.kb.updateDatabaseWithModel(self.algorithm)


Redirection. A simple plugin that is incredibly powerful, it lets you identify a "broken" URL and provide it with a good replacement, select which kind of redirect you want (301/302/307) and then it will implement the redirect and log stats on how many times the redirect has been hit.
So I followed your advise and installed both plugins. However, the 404 notifier is still notifying me about all of the links that are redirected. Did you encounter this, and did you come up with a solution?


text:
Go to: « Kay's Originals Vol. 1 Kay's Originals Vol. 2 Title Pages Advetisement Notice to the First Edition CLXXI. Mr. John Dowie, Vintner, Libberton's Wynd CLXXII. Colin Campbell, Esq. of Kilberry, Argyleshire CLXXIII. The Lawnmarket Coach; or, A Journey Along the Mound CLXXIV. The Right Hon. Selina Countess Dowager of Huntingdon CLXXV. Jamie Duff, alias Bailie Duff CLXXVI. Major-General Alexander Mackay CLXXVII. Allan Maconochie, Lord Meadowbank CLXXVIII. General James Grant of Ballindalloch CLXXIX. The Right Hon. the Earl of Moira, commander-in-chief of the forces in Scotland CLXXX. The Commander-in-Chief addressing the Edinburgh Spearmen CLXXXI. Mr. John Wemyss, Mr. Robert Clerk, and George Pratt CLXXXII. Two booksellers. Mr. William Coke and Mr. John Guthrie CLXXXIII. William Butter, Esq., and Sir John Morrison CLXXXIV. James Alexander Haldane, Esq., Minister of the Tabernacle, Leith Walk CLXXXV. Sergeant-Major Patrick Gould, and an Edinburgh Volunteer CLXXXVI. Mr. Benjamin Bell, Surgeon CLXXXVII. "The Five Alls." CLXXXVIII. Rev. Dr. Thomas Hardie CLXXXIX. Sir James Campbell, Bart., of Ardkinglass CXC. Dr. Andrew Duncan, Sen. CXCI. Dr. Andrew Duncan in 1797 CXCII. Major Andrew Fraser, the Honourable Andrew Erskine, and Sir John Whitefoord, Bart. CXCIII. Sir John Sinclair, Bart. of Ulbster CXCIV. Lord Stonefield CXCV. John Home, Esq., of Ninewells CXCVI. Mr. William Grinly, Broker and Auctioneer CXCVII. The Hon. Alexander Leslie, Lieut.-General and Colonel of the Ninth Regiment of Foot. CXCVIII. Dr. James Hamilton, Senior CXCIX. Mr. William Mason, Secretary to the Grand Lodge CC. Rev. James Baine, A.M. CCI. Ebenezer Wilson, Brassfounder CCII. Sir Ilay Campbell, Bart. CCIII. Mr. John Campbell, Precentor CCIV. A medley of Musicians CCIV. A medley of Musicians CCV. William Wilson or "Mortar Willie" CCVI. Dr. Thomas Snell Jones, Minister of Lady Glenorchy's Chapel CCVII. William Forbes, Esq. of Callendar CCVIII. Dr. Gregory Grant CCIX. Rev. James Lapslie, Minister of Campsie CCX. O'Brien, the Irish Giant, and William Ranken, Esq. CCXI. Faithful Service Rewarded CCXII. Mr. George Williamson, King's Messenger and Admiral Macer for Scotland CCXIII. Mr. Francis Braidwood, Cabinet-Maker CCXIV. The Right Hon. the Earl of Eglinton CCXV. Rev. James Struthers, Minister of the Relief Chapel, College Street CCXVI. Rev. Mr. Struthers CCXVII. Lord Monboddo, in the Court of Session CCXVIII. Old Geordie Syme, a famous Piper in his time CCXIX. Sir John Leslie, Professor of Natural Philosophy in the University of Edinburgh CCXX. Old John Tait, the Broom-Maker CCXXI. James Hume Rigg, Esq. of Morton, Isaac Grant, Esq. of Hilton, Achibald Macarthur Stewart, Esq. of Ascog, The Hon. Captain (afterwards General), John Leslie, and Captain William Wemyss CCXXII. Rev. Dr. Buchanan, one of the Ministers of the Canongate Church CCXXIII. Old Widow Ellis CCXXIV. The City Tron-Men; or Chimney-Sweepers CCXXV. William Cumming, Esq. CCXXVI. Rev. John Wesley, Dr. Hamilton, and the Rev. Mr. Cole CCXXVII. Sir William Honyman, Bart., of Armadale CCXXVIII. Rev. Dr. Alexander Turnbull, of Dalladies CCXXIX. Margaret Suttie, a hawker of salt CCXXX. Archibald Hamilton Rowan, Esq., of Killileagh, in Ireland, and The Hon. Simon Butler CCXXXI. Citizen M. C. Browne CCXXXII. Rev. John Walker, D.D. CCXXXIII. M. De Latour, Painter to the King of France, Member of the Royal Academy of Painting at Paris, etc. CCXXXIV. Mr. Thomas Paine, Secretary for Foreign Affairs to the American Congress CCXXXV. Captain James Burnet, the Last Captain of the City Guard CCXXXVI. Samuel McDonald, in the Uniform of the Sutherland Fencibles CCXXXVII. Mr. Charles Sinclair CCXXXVIII. Rev. David Black, Minister of Lady Yester's Church, Edinburgh CCXXXIX. Thomas Jefferson, Esq., President of the United States of America CCXL. Major-General Aytoun and The Duc D'Angouleme CCXLI. Mr. Clinch and Mrs. Yates, in the characters of the Duke and Duchess of Braganza CCXLII. Alexander McKellar; or "The Cock o' the Green." CCXLIII. Lord Polkemmet CCXLIV. James Gillespie, Esq. of Spylaw, and his brother, Mr. John Gillespie CCXLV. Rev. Dr. John Colquhoun CCXLVI. Major Charles Johnstone CCXLVII. Andrew Donaldson, Teacher of Greek and Hebrew CCXLVIII. "Petticoat Government" CCXLIX. Campbell of Sonachan laughing at the Print of "Petticoat Government" CCL. Mr. Thomas Sommers, his Majesty's Glazier for Scotland CCLI. Mr. Francis Anderson, W.S., Mr. James Hunter, and his son, Mr. George Hunter CCLII. Rev. Robert Culbertson, of the Associate Congregation, Leith CCLIII. The Right Hon. Charles Hope of Granton, when Lord Advocate of Scotland CCLIV. Right Hon. Charles Hope CCLV. The Right Hon. William Pitt CCLVI. The Right Hon. William Pitt, and Henry Dundas, afterwards Lord Melville CCLVII. Mr. and Mrs. Lee Lewes CCLVIII. Dr. Thomas Hay, City Chamberlain, and Sir James Stirling, Bart. CCLIX. Colonel Monro, a well known blue-gown beggar CCLX. Sir Henry Moncreiff Wellwood, Bart. CCLXI. Sergeant William Duff CCLXII. Lord Balmuto CCLXIII. Rev. James Hall, D.D. CCLXIV. Mr. Hamilton Bell, W.S., carrying a Vintner's Boy from Edinburgh to Musselburgh, and Mr. John Rae, Surgeon-Dentist, accompanying him in the character of Bottle-Holder CCLXV. Mr. Edward Innes, and his second, Mr. James Cooper, following after Mr. Bell CCLXVI. The Artist under Examination by Sheriff Pringle, with the pursuers, Bell and Rae, sitting behind CCLXVII. The Hon. Sir Nash Grose, one of the Judges of the Court of King's Bench CCLXVIII. Harvey Christian Combe, Esq., Lord Mayor of London CCLXIX. Sir John Marjoribanks, Bart., Lord Provost of Edinburgh, in his robes CCLXX. Rev. Charles Simeon, M.A. of Trinity Church, Cambridge CCLXXI. Archibald McArthur, piper to the late Sir Reginald Macdonald Stewart Seton, of Touch and Staffa, Bart. CCLXXII. Mirza Aboul Hassan Khan, envoy extraordinary from the King of Persia to the Court of Great Britain CCLXXIII. Mr. John Finlayson, formerly a writer in Cupar-Fife CCLXXIV. Rev. David Dickson, minister of New North Church, Edinburgh CCLXXV. Hugh Macpherson, sometime Clerk to the Perth Carriers CCLXXVI. Mr. Henry Johnston, in the Character of Hamlet CCLXXVII. Rev. John Jamieson, D.D. CCLXXVIII. Robert Craig, Esq. of Riccarton CCLXXIX. David Smythe, Lord Methven CCLXXX. General Francis Dundas, Sir Henry Jardine, Sir Robert Dundas of Beechwood, Bart., Captain Hay, the Late Earl of Eglinton, and the Misses Maxwell, etc. CCLXXXI. Rev. John McDonald of the Gaelic Chapel, Castle Wynd, Edinburgh CCLXXXII. Lord Cullen, one of the senators of the College of Justice CCLXXXIII. The Edinburgh Fish-Women CCLXXXIV. William Macdonald, officer to the Highland Society of Scotland CCLXXXV. Sir William Miller of Glenlee, Bart. CCLXXXVI. Lieut.-General Vyse, in command of the Forces of Scotland CCLXXXVII. Rev. Dr. James Peddie, of the Associate Congregation, Bristo Street CCLXXXVIII. Rev. Dr. Peddie, in 1810 CCLXXXIX. Andrew McKinlay, tried for administering unlawful oaths CCXC. James Mackcoull, alias Captain Moffat CCXCI. Beetty Dick, Town-Crier of Dalkeith CCXCII. Two Chairmen; or, "The Social Pinch." CCXCIII. James McKean, at the Bar of the High Court of Justiciary CCXCIV. Sir William Macleod-Bannatyne (Lord Bannatyne) CCXCV. Training a Councillor CCXCVI. John Steele CCXCVII. Mr. John Austin, author of a "System of Stenographic Music" CCXCVIII. Robert Kay, Esq., Architect CCXCIX. Captain Billair and his Wife, who, though a tall woman, always wore high-heeled shoes CCC. The Last Sitting of The Old Court of Session CCCI. Rev. Alexander King, of the Relief Congregation, Dalkeith CCCII. Francis Jeffrey, Esq., Advocate CCCIII. Captain Dalrymple, and Miss Macdonald of Clanronald CCCIV. The Lovers CCCV. Dr. John Brown, alias "The Devil Killer" CCCVI. Miss Burns, a celebrated beauty of last century CCCVII. A Political Set-To; or, "Freedom of Election" Illustrated CCCVIII. Mr. Pierie and Mr. Maxwell. The Ladies are in the Costume of 1785 CCCIX. Rev. George Husband Baird, D.D. CCCX. Provost Elder and Principal Baird. CCCXI. Dr. John Hope, Professor of Botany in the University of Edinburgh CCCXII. Second Division of the Court of Session CCCXIII. Jerome William Knapp LL.D., Deputy-Clerk of Arraigns CCCXIV. Three Social Friends. Mr. Robert Kay, Mr. Louis Cauvin, and Mr. David Scott CCCXV. Mrs. Smith, in the costume of 1795 CCCXVI. The Hon. William Ramsay Maule, of Panmure, afterwards Lord Panmure of Brechin and Navar CCCXVII. A. Colquhoun, Esq., of Killermont, Lord Advocate of Scotland, and A. Maconochie, Esq. (Lord Meadowbank), then Solicitor-General CCCXVIII. The Hon. Francis William Grant of Grant, Colonel of the Inverness-shire Militia CCCXIX. Rev. David Dickson, D.D. CCCXX. Twelve Advocates who plead with wigs on CCCXXI. Rev. James-Francis Grant, of St. George's Chapel, York Place, Edinburgh CCCXXII. The Craft in Danger CCCXXIII. Robert Sym, Esq., writer to the Signet CCCXXIV. Rev. Henry Grey, A.M. CCCXXV. Mr. Robert Macgachen, Accountant of Excise CCCXXVI. Twelve Advocates, who plead without wigs CCCXXVII. John Rose, Esq. of Holme CCCXXVIII. Major Skey, and the Right Hon. Lord Clive (now Earl of Powis), of the Shropshire Militia CCCXXIX. Archibald Campbell, City Officer CCCXXIX.* Archibald Constable, Esq. Appendix Notes to Vol. 2 Index to the Portraits, etc. in Vol. 2 Index to the Names Incidentally Mentioned in the Second Volume » Memorials of Edinburgh in the Olden Time » Edinburgh Past and Present » Old and New Edinburgh Vol. I » Old and New Edinburgh Vol. II » Old and New Edinburgh Vol. III » Old and New Edinburgh Vol. IV » Old and New Edinburgh Vol. V » Old and New Edinburgh Vol. VI
BIOGRAPHIOAL SKETCHES. 467 esteemed and loved than "HOLMER OSE," the appellation by which he was distinguished in the district from other gentlemen of the same surname. He had twelve children, of whom three died in infancy, and one in early youth. His eldest son, Hugh, entered the East India Company's Service, in which he held several honourable and responsible situations. He was aide-de-camp to Lord Lake; and, after more than twenty years' service, returned home with his family in 1814, with the rank of Lieut.-Colonel. From that period he resided on his property, where he died in 1836.1 Two other sons of Mr. Rose, Alexander and Robert, died in India; the first in the military service, and the other captain of a country vessel. The youngest son, General Sir John Rose, K.C.B., succeeded to his brother Colonel Hugh, as Proprietor of Holme, where he resided with his family, the eldest of whom was for some time in the civil service of the East India Company. Lady Rose (Lilias) was a daughter of the late James Fraser, Esq., of Culduthel. hlr. Rose's four daughters, who reached maturity, were all married ; the eldest, Catherine, to Captain George Easton, of the 35th reb$nent of foot, both of whom died some years after marriage, of yellow fever, in the West Indies. Grace married the late William M'Intosh, Esq., of Geddes, whom she survived. She predeceased her husband, who died in 1814. They left a numerous family. Mr. Rose's youngest daughter, Helen, was married to Dr. Cormack, minister of Stow, in 1814.2 Maintaining in every respect the character of a country gentleman of the olden time, the great enjoyment of Mr. Rose was to live in the bosom of his family, and among his tenantry ; yet, at the call of his country, he was ever ready to sacrifice all to what he deemed its paramount claim. Hence, during the American war, he joined the Gordon Fencibles ; and towards the close of last century he raised a company, which he commanded, in the Grant Fencibles; and perhaps nothing can give a better idea of the affectionate regard in which he was held by bis own dependents and neighbourhood, than the simple fact that he raised his whole company within a week. Mr. Rose lost his excellent and pious lady while yet in early life ; but never afterwards formed any matrimonial connection. Four sons and four daughters lived to be settled in life. Jane was the wife of John Troup, Esq., of Firhall, near Nairn. He married Miss Ame Topham, an English lady, who predeceased him a few years. Several of their children died in infancy in India, and one son and two daughters came to this country. The son, a very promising boy, died by a fall from a pony. Charlotte, the youngest daughter, was married to General Sir John Burgoyne ; and Anne, the eldest, to Douglas Cheape, Esq., advocate, and late Professor of Civil Law in the University of Edinburgh. a Their only surviving child, John Rose Cormack, M.D., had the honour of gaining the Barveian Prize, in 1836, by his " Treatise on the Chemical, Medicinal, aud Physiological hoperties of CREOSOTEil,l ustrated by experiments on the lower animals, with some considerations on the embalmment of the Egyptians." To his "Inaugural Dissertation on the Presence of Au in the Organs of Circulation," the Medical Faculty of Edinburgh awarded the prize of their gold medal, on occasion of his receiving his Doctorate in 1837. He was chosen one of the Preidents of the Royal Nedical Society in 1836, and of the Royal Physical Society in 1837. .

redpajama_set_name: RedPajamaCommonCrawl


Weber Summit E 470 GBS BBQ Black The Barbecue Store Spain Con Barbecue Gaz Weber E Barbacoa Weber Summit E 470 Negra 1a 83 Con Barbecue Gaz Weber E 1219x1000px is one of pictures thet are related with the picture before in the collection gallery. If you would like to see the Weber Summit E 470 GBS BBQ Black The Barbecue Store Spain Con Barbecue Gaz Weber E Barbacoa Weber Summit E 470 Negra 1a 83 Con Barbecue Gaz Weber E 1219x1000px in High Resolution [HD Resolution] version, please press the right click on picures/image then choose "Save as Image" option, and done. You will get Weber Summit E 470 GBS BBQ Black The Barbecue Store Spain Con Barbecue Gaz Weber E Barbacoa Weber Summit E 470 Negra 1a 83 Con Barbecue Gaz Weber E 1219x1000px pictures that you want. The exactly dimension of Weber Summit E 470 GBS BBQ Black The Barbecue Store Spain Con Barbecue Gaz Weber E Barbacoa Weber Summit E 470 Negra 1a 83 Con Barbecue Gaz Weber E 1219x1000px was 1219x1000 pixels. You can also look for some pictures by collection on below this picture. Find the other picture or article about Idee Per Barbecue Gaz Weber Immagini Che Idee Di Decorazione here. We hope it can help you to get information of the picture.


text:
Improved FT-IR Instrumentation and Software for Complete Confidence in QA/QC Testing
Spectroscopy Supplements, Special Issues-08-01-2010, Volume 0, Issue 0
Establishing credibility and reliability of the information provided by a Fourier transform–infrared (FT-IR) spectrometer is paramount to mitigating risk in the QA/QC laboratory, where simple, fast and error-free analysis of unknown materials or material verification are required. To meet the demands of a modern QA/QC laboratory, FT-IR spectrometers must include capabilities that shift the burden of proving the reliability of the information away from the analyst so they can concentrate on the sample, not on verifying the integrity of the data. Recent design advances in both FT-IR spectrometer hardware and software give users greater confidence by continually reporting instrument status and performance verification, efficiently and effectively running pass–fail tests against specification, and easily adjusting to the degree of variation in a given set of products.
The primary function of a quality assurance/quality control (QA/QC) laboratory is to determine if an incoming raw material, in-process sample, or outgoing product meets specification as to identity, composition, or purity. At each step of the manufacturing process, issues in quality can subject the end product to the risk that it will not meet this specification. Analytical instrumentation, specifically Fourier transform–infrared (FT-IR) spectrometers, have long been a staple of the QA/QC laboratory to specify the composition of an unknown sample or verify the identity of a known sample. Given the high throughput of the typical QA/QC laboratory and the potential for sampling errors, the demand for simple, fast, and error-free analysis is significant and has driven enhancements in both the hardware and software of the modern FT-IR instrument.
Each step in the manufacturing process carries its own unique risks to product quality. Upstream, supplier quality dominates the risk profile as it feeds the manufacturing pipeline. Significant effort is devoted to goods-in or incoming raw material analysis in order to prevent supplier quality issues from contaminating the current manufacturing process. Midstream analytics where a sample, usually a grab-sample, is analyzed during processing, allow for process control where parameters such as starting material concentration, solubility, or temperature can be adjusted to maximize output or retain quality. Downstream, customer complaints regarding released product quality will trigger an investigation wherein the data from the QC laboratory play a critical role.
Laboratories that are not part of a manufacturing process — for example, in forensics — still carry their own risk based upon the verification of the data provided by analytical instrumentation. Doubt can be raised legitimately about the performance of any instrument because there might be no data showing its ongoing reliability. This can have real and significant consequences in a court of law, where scientific data are subject to extensive scrutiny playing on the lack of detailed understanding of complex analytical technologies by the general public.
Establishing credibility and reliability of the information provided by an FT-IR spectrometer is paramount to mitigating risk. In the past, frequent performance testing was carried out by personnel who started their careers during the age of "open cockpit" spectrometer operations. Knowledge of all facets of spectrometer operation, from properly loading chart paper to basic calibration methods to final data interpretation, was required to obtain reliable answers creating a generation of expert users. QC laboratories have since evolved substantially in terms of personnel, instrumentation, and throughput. To meet the demands of modern QA/QC laboratories, FT-IR spectrometers must include capabilities that shift the burden of proving the reliability of the information away from analysts so they can concentrate on the sample, not on verifying the integrity of the data.
Internal, regulatory, and legal bodies require that an independent verification of the instrument be performed regularly, with signed, archived reports, for the final spectral evidence and report to have force. The pharmaceutical industry has been living with scenarios like this for many years, as they are heavily regulated worldwide — all drug-related data must be backed with instrument performance verification and validation. The food and beverage industry is increasingly moving toward the same model as the legal system becomes more involved. Add-on software and hardware tools have made this process simpler, but the need for a set of routine tools fully integrated with the spectrometer (hardware and software) is clear. This study details some of the most significant changes in FT-IR instrument design for QA/QC laboratories including hardware, regulatory compliance, and software.
The QC laboratory environment is challenging for analytical instrumentation as the spectrometer can be exposed to noise, heavy machinery, solvent vapor, or varying humidity levels. Vibrational tolerance is critical for spectrometer signal-to-noise ratios and overall performance. Novel techniques are being applied to minimize the effects on spectral data resulting in significantly improved system performance. Advanced designs incorporate engineered baseplates with specific support shapes and, in some cases, lighter materials to shift the spectrometer's resonant frequency window away from interference with the spectral data. Other systematic improvements range from the simple, vibration isolation feet, to the complex, dynamic alignment for real-time optimization of signal. Systems now also include advanced gasketing designs and purge to slow the ingress of solvent and water vapors.
Source modularity is another hardware advance that provides flexibility in the laboratory and augments ease-of-use by allowing users to change wavelength range and by shortening downtime via user source replacement. FT-IR instruments that can accommodate either a standard glo-bar source or insert a white-light near-IR source allow simple incorporation of multiple wavelength analyses without interruption of the workflow. The source is, in the case of the iS10 FT-IR instrument (Thermo Scientific, Madison, Wisconsin), accessible from within the sample compartment itself, obviating the need to remove the cover and making this component user-accessible. Source failure would trigger, until recently, a service call. Current designs, however, allow users to remain up and running as these critical spectrometer components can now be changed quickly and easily without any need for alignment.
Spectrometer System Status
As the technology inherent to optical systems continues to advance, so does innate system intelligence. From washing machines to automobiles, systems can now give clues in real time as to their proper operation based on factory specifications. Cars have automated tire pressure gauges and airbag readiness indicators. Carpets are wired with sensors to detect if someone has sustained a fall and has not recovered (1). The same principles can be applied to spectrometers, in which a powerful combination of hardware, firmware, and software allows users in QA/QC laboratories to understand quickly and easily potential system issues that may occur during the lifetime of the spectrometer. The value of this type of feedback is that it frees analysts from having to be an expert in all parts of spectrometer operation and allows them to concentrate on their main tasks.
System intelligence as applied to a spectrometer can be grouped into four categories: scheduled maintenance, instrument status, performance verification (also referred to as operational qualification, in many cases), and system suitability. Taken together, these innovative features help guard against collecting data when the spectrometer is not within control specifications. These functions can alert users visually when an icon turns red, when no peaks were present, when the requested spectral range does not match the spectrometer hardware, or when severe water contamination is present. An example of one such set of indicators is shown in Figure 1.
Figure 1: An example of modern, innate system intelligence, the System Performance Verification control panel from the Thermo Scientific OMNIC software shows the ability to track dates of the last check of each feature.
Incorporation of the system maintenance status into the overall system indicator is a critical feature for modern FT-IR instruments in the QA/QC laboratory. Automation of the scheduled maintenance process allows users to set the interval for service either at installation or to change it at any time thereafter. When the specified reminder window for service is reached, much as with a standard Microsoft Outlook meeting, the user is notified and the System Performance Verification icon turns yellow. When the date for system service has passed, the indicator icon will go red. This part of the system's verification routine is critical, as laboratory personnel change over time, but the system will stay on the bench without the need for maintaining records on service and will notify any user immediately upon a need for routine service.
Although instrument status indicators have been incorporated into spectrometer designs for several years, their capacity for communicating vital, hard-to-access system performance data continues to grow, providing users with a real-time virtual "heartbeat" of their spectrometer. More-advanced Fourier transform spectrometers can check data, like interferogram size for both the background and sample showing that there is sufficient, but not excessive, throughput in both cases.
Performance verification routines provide greater detail on spectrometer performance. These tests will run an FT-IR system against manufacturer-published system specifications such as throughput and noise as well as against standard methods such as ASTM E 1421-99 (2004). These tests can use an automated, internal SOP to carry out the analysis, effectively excluding the possibility of operator error and making sure the analysis is done the same way every time to ensure a true "apples to apples" comparison. For QA/QC laboratories that require a more significant level of validation compliance (pharmaceuticals, for example), more extensive packages are available that include design qualification (DQ), installation qualification (IQ), operational qualification (OQ), and performance qualification (PQ). Instrument companies typically design these add-ons to comply with ASTM, U.S. FDA, Japanese Pharmacopeia, and European Pharmacopeia guidelines and to provide trend-charting for long-term evaluation of system-performance data.
To accomplish these measurements, standards are incorporated into and supported within the spectrometer beampath. This is typically done in a manner allowing for automated selection of either an unobstructed beam that goes directly to the sample in normal operation or a beam that transmits through one of the standards. These reference standards are protected against degradation, mishandling, or dropping by placing them internal to the spectrometer on a wheel. In addition to the benefit of permanently mounted standards, these systems also make life easier for analysts in that they no longer have to purchase, hold, and maintain a set of calibration standards in another location. Internally protected standards also benefit from the system purge and vapor seal.
The standards must be traceable to national measurement bodies to comply with current regulations and established industry guidelines. Standards such as NIST (National Institute of Standards and Technology, www.nist.gov) polystyrene SRM 1921a tests wavenumber accuracy on the x axis and NPL (National Physical Laboratory – www.npl.co.uk) NG11 Glass measures photometric linearity on the y axis. With the aforementioned standards incorporated into the system's automatic performance verification routine, multiple tests can be run automatically to ensure that the system is performing up to specification. Tests that do not require a sample also can be included in a performance verification routine in which the system will simply analyze, for example, spectrometer noise in specified frequency ranges on a 100% line or maximum throughput of the system. In total, these tests are designed to give users confidence using the known performance characteristics of the spectrometer against itself as well as against traceable standards confirming that both the wavenumber and intensity axes are reporting reliable values.
System suitability, also referred to as performance qualification (PQ), uses a sample to judge if the spectrometer is appropriate for the analysis to be performed. Whereas performance verification uses internal standards and blank beampaths to judge the level of system performance against established specifications, system suitability is a real-world test using a sample with a known performance profile. In some areas, this can be referred to loosely as a "Check Standard." The system suitability test can be configured by the QC laboratory to meet its own needs for specific sample types. This type of analysis can include tests for specified throughput, specific sample peaks that should be present, and their absorbance values. More advanced algorithms for system suitability include features like contamination analysis to test for the presence of material that might remain on an attenuated total reflectance (ATR) crystal from a previous experiment. As an example, Figure 2 shows the suitability tests set-up for a packaging laboratory, where the "gold standard" sample is low-density polyethylene (LDPE) run on a diamond ATR. As opposed to the completely automated and internal performance verification testing routine, some user interaction is required for system suitability since, by definition, a real sample is used. Modern testing methodologies such as this greatly enhance the user's confidence in peak ratio data and quantitative analyses because the analysis was done on an actual sample. Items 4 and 5 within Figure 2 report on peaks from an LDPE sample. The spectrum is checked for both peak location and intensity. The latter test provides confidence in the responsiveness of the spectrometer to the customer's specific samples.
Figure 2: The System Suitability set-up window. Each parameter can be edited or turned off. The test configured here uses a low-density polyethylene film as a reference material.
Software Design for Routine Use
Although distinct advances have been made in the recent past in both hardware and system status as discussed previously, the most powerful enhancements for laboratory operators have come from software. Modern software packages allow QA/QC users to run analyses one at a time at the touch of a button for rapid sample or contaminant identification or in automated multiple-run workflows or macros where there is a large queue of backlogged samples.
Advanced tools with information about, for example, how a new spectrum compares to other samples have also emerged. A spectrum of a test material can be compared against another spectrum of the same material (for example, from a different time), a stored reference (gold standard), or a stored directory of files. Even spectra taken under different conditions (different resolutions, for instance) can now be compared without difficultly. This type of comparison can be used, in a more advanced analysis, to discriminate two like materials based upon spectroscopic differences arising from routine variations in content that might not necessarily affect quality. Natural products are a good example of this type of material as variation is expected depending upon the natural source, but there is still an underlying similarity. Furthermore, the basic method of comparison gives users of present commercial packages a similar analysis result.
Differentiating materials based upon very slight differences in composition requires a higher level of discrimination power. Current quality algorithms may return multiple answers or pass criteria that are too wide, but solutions exist via advanced algorithms to clearly make a distinction, providing an even higher level of confidence. The example that follows illustrates this point.
Discrimination in the QC Laboratory: Ethylene Vinyl Acetate
Polymer blends of polyethylene and ethylene vinyl acetate (EVA) are used for making food packaging films and hot melt adhesives. The raw materials contain EVA at various concentrations in the polyethylene matrix. In the application here, a target value for the production line was set at 15% EVA, with a very high pass/fail criterion required.
A simple database of spectra from samples with a range of EVA concentrations was obtained and saved — neither processing or library creation was needed. A material from the production line was then run through QC using the basic algorithm. Figure 3 shows that the sample matched two possible EVA values, 15.24% and 18.21%, at a high level. The latter value placed the sample outside of the allowed variation, lowering the confidence of the operator in the method. Confusion of this kind is not satisfactory in the QC laboratory, where critical decisions can rest on small sampling sets.
Figure 3: EVA raw material of 15% expected concentration. Result in normal sensitivity correlation mode leaves some room for debate.
Turning on the high-sensitivity option provides the much more exacting result shown in Figure 4. Now, only the 15.24% match is within the allowed tolerance limit (0.980 match index), and the next closest is considerably lower. The algorithm stresses small differences, giving the QC laboratory a much higher level of confidence in the results. Furthermore, this provides a semiquantitative analysis of the sample without requiring regression or other fitting methods.
Figure 4: EVA raw material of 15% expected concentration. Result with High-Sensitivity turned on in QCheck is unambiguous.
Allowable Variation: Natural Products
Natural products will exhibit slight variations due to differences in source materials and growing conditions. Nutraceutical base components will display this inherent variability, while still being acceptable for commercial use. There are definitive characteristics of the components that can be used to generate classifications so QCheck can be used to clear materials for use. The natural variation implies, however, that some flexibility for a pass/fail condition must be allowed.
Samples of nutraceutical material classes were analyzed using diamond ATR including goldenseal powder, barberry bark, yellow dock, and goldenseal leaf. The spectra of the different classes of materials are different (Intercluster variability), but there is also some variation within each class (intracluster variability). A new sample of goldenseal leaf from a different supplier was first analyzed using the high sensitivity method mentioned earlier. The results, shown in Figure 5, are correct, but the match results are low, due to small (real) variations between the various goldenseal leaf samples, which are not detrimental to the usability of the material.
Figure 5: Nutraceutical material analyzed with the high-sensitivity option turned on. The correct material appears at the top of the list but the analysis fails due to natural variability within the sample class.
Switching to the normal QC method gives the results shown in Figure 6. The results now show a very high confidence that this material is goldenseal leaf. Given the expected variations in natural products, this provides affirmation for the use of this material in the production of nutraceuticals.
Figure 6: Nutraceutical material analyzed with the normal sensitivity setting in QCheck. There is now a clear pass condition.
Recent design advances in both FT-IR spectrometer hardware and software have made a significant impact on the modern QA/QC laboratory and users by retasking the system to take more responsibility for itself. Systems now can tell users when they require routine maintenance, when a spectrum does not meet minimum standards for quality, when a sample is highly unlike any others analyzed in that class in recent history, or if the spectrometer is not performing up to factory or regulatory specification. All these improvements, taken together, allow users to focus on their most important task, which is keeping up with the ever-increasing load of samples without needing to become experts on every facet of FT-IR systems operation.
Mike Bradley and Jeffrey Hirsch are with Thermo Fisher Scientific, Madison, Wisconsin. E-mail: mike.bradley@thermofisher.com.
(1) http://livtom.webfarm.hostbasket.com/upload/uk/Seniorflat_EN.pdf.
Infrared (IR) SpectroscopyAnalytical InstrumentationSpecial Issues-08-01-2010
Deep Learning Classification of Grassland Desertification in China via Low-Altitude UAV Hyperspectral Remote Sensing


Tucked away on Kensington Church Street in London you will find the hidden gem that is Dermavita Clinic. Opened in 2016 by leading aesthetician Anna Banas this clinic offers an amazing array of treatments and services from cosmetic procedures from their resident qualified doctor to nutritional advise from their resident nutritionist. They also offer long lasting result driven procedures for body and face performed by Anna Banas and her technician Florina including Exilis from BTL Industries, the treatment I was to review.
Patients interested in a non-invasive aesthetic procedure that is affordable, pain free and efficacious for body shaping and skin tightening need look no further than Exilis from BTL Industries. This appealing monopolar, focused radiofrequency device provides for precise delivery of thermal energy that can be uniquely tailored to every individual body. Exilis can also being used with complementary modalities and leading skincare products to enhance outcomes in an anti-aging program. The BTL treatments are safe for patients of all ages who are showing signs of aging or who want to improve those problem areas where exercise and diet have plateaued. This treatment is also an option for those who are looking for the aesthetic improvement without the cost and recovery time of surgery.
Entering the clinic on the lower ground floor you are welcomed by the cozy but clinical reception, after checking in and enjoying a complimentary coffee I was shown in to the treatment room by Anna who went through the machine and the procedure with me. Laying on the treatment bed my face was first cleansed to make sure that there were no traces of makeup so the treatment could penetrate my skin, after this Anna covered my face with ultrasound gel so the current from the Exilis machine could penetrate my skin. The sensation of the machine is somewhat odd, like a very warm stone being rolled around on your face, it's not painful, just a little uncomfortable when it feels really hot, oddly enough the machine does not actually heat up so it will not burn your skin, its just the sensation of the current reaching deep in to the tissue. The technology behind it focus thermal energy in to the collagen fibres of your skin, the triple helix of the structure is affected by heat and thus breaks down, the natural healing of the human body evokes fibroblasts to produce new collagen fibres thus renewing the skin. By layering the treatment the energy is delivered to the various depths in the tissue, changing the cooling during treatment allows you to treat deep tissue all the way up to the superficial layer renewing the skin from inside to out.
The process takes about 45 minutes for the full face and then the face is cleansed and moisturised. Straight away you can notice that the skin is fresher and softer with a healthy glow but the treatment gains the best results over a longer period. The recommended number of treatments is between 4 to 6 sessions and treatments are usually scheduled 7-10 days apart. Treatments are typically scheduled on a weekly basis and patients have reported visible improvements after the first treatment session, which I can safety say is true in my case, the lines around my mouth and eyes lessened within a week of my first treatment.
I went back for a further three treatments, making four treatments in total and I was shocked by the results. I have tried many facials and non-evasive procedures without ever really seeing any noticeable results, however the Exilis from BTL Industries administered by Anna of Dermavita was mind-boggling! The lines on my forehead, which were deeper and more noticeable, had all but gone and the lines around my eyes and mouth disappeared, my skin looked 10 years younger at least. Results wise patients have reported visible improvements after the second treatment session, but it is advised you will see improvements up to 6 months later as the new collagen is visible. Dermavita suggest for best results to follow the in-between treatment instructions, maintain a healthy diet and drink plenty of water.
It is now three months after my treatment and my skin is still looking great, the lines on my head have not returned despite stress and not so healthy eating over the holiday season.
I could not recommend the Exilis from BTL Industries treatment more highly in terms of non evasive anti aging technology and Dermavita administer this treatment with wonderful friendly professionalism. Anna was knowledgeable, attentive and it became a joy to visit the clinic to chat with her and the team before each treatment, something rare in the clinics of London I have found. If you are looking for cutting edge technology when it comes to face and body treatments but do not want to take the step to cosmetic surgery Dermavita is the place for you . . . tell Anna I sent you!


Let me just get this off my chest, I think Philosophy products are extremely overpriced and generally not worth the money. That being said I do feel like they have several great products that I am absolutely OBSESSED with. However, the moisturizer Hope in a Jar is not one of them. There, I said it.
Most people are probably scratching their heads right about now. I know it's considered a cult beauty product, and I know Oprah recommends it, but I just hate it. There is literally nothing special about it. It does not offer me hope, just despair and longing for the $40 I wasted on it.
I want to love this, I really do. I have tried to multiple times, it's always the same though. First I get a whiff of the smell, then I have to make myself apply it as I grimace. It's not a pretty sight. There is one good thing about this moisturizer, the texture. It feels like a souffle, that being said souffle's are better when eaten not applied to the face.
All in all, I don't feel like this is worth the money, Oprah's seal of approval, and certainly not mine. If hope isn't what you're looking for, go ahead and give it a whirl, otherwise stayaway. Far far away.
I also agree with regards to philosophy products. I have only used a few, but most of them have come as deluxe samples or birthday gifts from being a Sephora VIB. If you look at the ingredients in their products, there is nothing particularly special in there(and they are also not free of parabens, etc). You are pretty much paying for their name. They aren't BAD products, but definitely not worth the price. I do enjoy their Purity cleanser, and I rotate that with my other cleansers. Aside from that, (and I have used Hope in a Jar, their Vanilla cupcake body wash/shampoo/etc, Purity, and some other stuff), I prefer other brands.


text:
Nurse pleads guilty to stealing pain killers from 14 patients
(KCRG)
Published: Oct. 3, 2019 at 11:31 PM CDT
A nurse accused of fraudulently obtaining painkillers from her patients in eastern Iowa has taken a plea deal.
The Telegraph Herald reports that 31-year-old Katie Boll, of Manchester, pleaded guilty last month. She pleaded guilty to tampering with a consumer product resulting in injury and acquiring the painkiller oxycodone by deception. Federal prosecutors dropped 12 other counts in exchange for her pleas.
Authorities say Boll was a nurse for the Good Neighbor Society in Manchester when she schemed to acquire hydrocodone, morphine and other painkillers from at least 14 patients in her care. Prosecutors say she used mouthwash to dilute liquid morphine, resulting in injury to a patient.


Willem de Kooning was a Dutch American Abstract Expressionist painter, who moved to New York in 1926. He was an avid reader of philosophy and literature, and is well known for his black and white paintings and the Woman series.
De Kooning's female figures are an important milestone in the post-war, feminist movement, as well as a trademark of his work.


Rectangular palette of medium-gray finely-grained stone with 2 parallel incised lines forming a border around the top surface. There is wear on both sides. One corner is broken. The surface is uneven and mottled black, perhaps caused by environmental factors. There is a small reddish spot.
From Wadi Alaqi (ASN111/75/1).1911. Excavated by Harvard University–Boston Museum of Fine Arts Expedition for the Archaeological Survey of Nubia; assigned to the MFA in the division of finds by the Egyptian government.


Atheists say there is no God. Agnostics say they just aren't sure whether there is a God or not—that there's not enough evidence. But Paul says that these people have "suppressed the truth in unrighteousness, because what may be known of God is manifest in them, for God has shown it to them" (Rom. 3:18, 19). All men know that God exists. "For since the creation of the world His invisible attributes are clearly seen, being understood by the things that are made" (20). It's not that we humans have just taken creation for granted, living here day after day. But because of fallen man's hatred of God, man suppresses the truth.


Majeed was very attentive. I was picked at my terminal on time. The driver was very sweet and friendly. The car works great, fuel efficient, cold ac, comfortable to drive. I highly recommend renting from Majeed.


I was excited to be asked to share ideas about effective social media use for young people with Student Voice. Student Voice is a student-run and non-partisan, not-for-profit organization focusing on issues such as dropout rates, student achievement, and workforce readiness. Student Voice was created as a result of the research-based belief that all these issues will be improved with student voices in the classroom and in society.
In addition to their face-to-face work, Student Voice is also well-positioned to address these issues with a digital platform. Knowing how to use social media effectively is an important part of this work. You can check out these ten tips by clicking the caption on the thumbnail below.


text:
NHTSA says users are to blame for reports of Teslas suddenly accelerating
Igor Bonifacic
·Contributing Writer
Following a nearly year-long investigation, the National Highway Traffic Safety Administration (NHTSA) says Tesla vehicles don't have a design flaw that makes them prone to sudden and unintended acceleration. The federal agency began looking into the issue last January after it was petitioned to do so in 2019. As part of the investigation, the NHTSA's Office of Defects Investigation (ODI) examined a total of 246 incidents, 203 of which involved a crash of some kind.
"There is no evidence of any fault in the accelerator pedal assemblies, motor control systems or brake systems that has contributed to any the cited incidents," NHTSA said. In fact, it states that in every instance where event data was available, it found that "pedal misapplication" was the cause of what went on to happen.
For Tesla, today's decision will come as vindication. When the news of the petition first came out, the company said it was "completely false," and went on to claim it was a ploy by a "short-seller" to make some money off of its misfortune. At the time, Tesla claimed it had already designed its cars to avoid any potential issues with unintended acceleration. Each one of the company's cars comes with two pedal position sensors that will automatically shut off motor torque if they detect "any error." That failsafe is complimented by the company's Autopilot system, which it designed to catch any pedal abuse.
The person who had petitioned the NHTSA to look into the incidents had asked that the agency recall all Model S, X and 3 vehicles if it found any safety issues. As such, Tesla has avoided a potentially devastating recall, but that's not to say the automaker is in the clear for good. The NHTSA said it could revisit the issue in the future (or any other problem, for that matter) if new information comes to light.
Work progressing on travel in virus era
Australian Associated Press·3-min read
Gigi Hadid Found Out She Was Pregnant In The Most On-Brand Way
Meghan letter ended our relationship: father
Aldi budget cleaning buy delivers 'gobsmacking results'
The store's Di San Oxy Laundry Soaker and In Wash Booster isn't just for the laundry, it seems.
Influencer, 35, gives birth to her 21-year-old stepson's baby
Marina Balmasheva, a Russian influencer who married her former stepson has given birth to their first baby.


Attention Current Directory Users: Click here for information on updates made to the App and what you can expect to see upon your login for the 2017-18 school year.
One way we build community in the Shaker Schools is by connecting our families with a district-wide directory. The Shaker School Family Directory is convenient and user-friendly, accessible either online or as a smartphone app. Shaker families maintain their own directory information.
To sign up for Shaker Schools Family Directory, click here.
When you click on "Don't have an account? Signup Now" at the bottom of the screen, you will be prompted for the Zip Code. Use 44120.
Fill in the rest of the requested information on the signup screen.
If you already have an account, you will get a screen showing the emails associated with your account and an email will be sent with login information. Once you log in you can update your family's information if needed.
If you do not have an account, follow the prompts to create one. Once you login you can input your family's information, including as much or as little detail as you want. The program can accommodate various family arrangements.
Your information will go into a queue to await approval. Please allow a week for our PTO volunteer to approve your entry.
Once approved you will receive an email from ShakerSchools.FamilyDirectory@gmail.com with your login information and instructions how to download the app.


text:
Justice for Victims of School Shootings Act Could Have Unintended Consequences
COMMENTARY Crime and Justice
Sep 4th, 2019 3 min read
GianCarlo Canaparo
Legal Fellow
Lucas Drill
Summer 2019 member of the Young Leaders Program at The Heritage Foundation
There is no shortage of criminal charges for school shooters—or even would-be school shooters who are apprehended while still in the planning stages. RoschetzkyIstockPhoto/Getty Images
Rep. Randy Weber, R-Texas, on Aug. 23 introduced the Justice for Victims of School Shootings Act.
Every state already has a bevy of criminal statutes that they can use to put shooters behind bars for life. Or worse.
The overfederalization of crime—and the broader phenomenon of overcriminalization of which it is a part—is problematic by itself.
Another member of Congress, this time a Republican, has succumbed to the temptation of creating a federal crime where one isn't needed.
Rep. Randy Weber, R-Texas, on Aug. 23 introduced the Justice for Victims of School Shootings Act, which would make carrying out, or conspiring to carry out, a school shooting a federal crime.
At first blush, it sounds like a good idea. After all, Weber is right that currently there's no federal law that clearly applies to school shootings.
But he's wrong to assume that there needs to be one.
As the Supreme Court put it more than 40 years ago, "It goes without saying that preventing and dealing with crime is much more the business of the States than it is of the Federal Government."
It should still go without saying, but since the Supreme Court delivered that admonition in 1977, the federal government has become addicted to creating crimes.
Experts estimate that there are now nearly 5,000 federal statutes and more than 300,000 federal regulations that carry potential criminal penalties. There are, in fact, so many federal criminal statutes and regulations that nobody—not even the Justice Department—knows for sure.
How does this happen? As Heritage Foundation scholars have said on many occasions (see, for example, here and here), legislators are often the problem.
After a crisis, lawmakers' first impulse is often to criminalize the perpetrator's conduct to show their constituents that they're doing something. The result, however, is usually a series of vague or redundant laws, which can create their own series of problems.
>>>View the School Safety Initiative
To be sure, school shootings are a serious problem, and school shooters should be severely punished.
But every state already has a bevy of criminal statutes that they can use to put shooters behind bars for life. Or worse.
Premeditated murder (often called "first-degree murder") is a state-law crime. While each state has its own laws and sentencing guidelines for premeditated murder, in almost every state the maximum penalty is life imprisonment (often without parole) or death (in states with capital punishment).
States can, and often do, charge shooters with every criminal statute they have available. Every state will vigorously prosecute any school shooter. Nobody wants to see a school shooter go unpunished.
States have myriad laws to punish school shooters even if their victims don't die. A shooter can be charged with assault, assault with a deadly weapon, battery, attempted murder, and various gun-related crimes, among others. Each specific offending action is a separate crime that carries a separate punishment.
The point is, there is no shortage of criminal charges for school shooters—or even would-be school shooters who are apprehended while still in the planning stages. Making it a federal crime serves no additional purpose.
In fact, if enacted, the Justice for Victims of School Shootings Act could have some deleterious consequences.
By creating a new federal crime for school shooters, it creates the possibility that a school shooter will go through two separate trials—one in state court and one in federal court.
That means more media coverage; i.e., more national attention on the shooter's life, family, and social media posts. More attention could mean more copycats.
Extending a school shooter's 15 minutes of infamy not only takes attention away from victims and first responders, but increases the "reward" for other would-be shooters who crave the spotlight. We should not give them that attention.
If the law, despite its good intentions, actually increases the likelihood, however slight, that someone else will commit the crime that the law is designed to prevent, then it's not just problematic, it's perverse.
Rather than create a new federal crime with which to charge school shooters, federal legislators should instead step back, allow states to pursue justice when one of these horrendous incidents occur, and let the names and faces of those who commit school shootings fade quickly from memory.
Here's Why the Killing of Suleimani Was Legal
The Death Penalty Is Appropriate
Judges Cannot Rehabilitate Offenders With Extra Prison Time


text:
Are socio-economic groupings the most appropriate method for judging health equity between countries?
Chris Dibben PubMed articlesGoogle scholar articles
Frank Popham PubMed articlesGoogle scholar articles
Correspondence to Dr Chris Dibben, School of Geography and Geosciences, University of St Andrews, St Andrews KY16 9AL, UK; cjld{at}standrews.ac.uk
Dibben C, Popham F
Journal of Epidemiology & Community Health 2011;65:4-5.
First published October 28, 2010.
Previous version (28 October 2010).
© 2011, Published by the BMJ Publishing Group Limited. For permission to use (where not already granted under a licence) please go to http://group.bmj.com/group/rights-licensing/permissions.


text:
The Dollarton Bridge comprises a pair of two-lane reinforced concrete spans the Seymour River in North Vancouver, British Columbia, Canada. It replaced a two-lane steel truss bridge built in 1948. It is 153 meters (501 feet) long.

The bridge, which is part of the Dollarton Highway, provides 4 lanes of road traffic and two 3 metre wide pedestrian-bicycle sidewalks.

See also
 List of bridges in Canada

External links
District of North Vancouver Dollarton Bridge Replacement Project

Bridges completed in 2005
Bridges in Greater Vancouver
Transport in North Vancouver (district municipality)
Road bridges in British Columbia

redpajama_set_name: RedPajamaWikipedia


Your $5,000 Honda Civic is barely a new exhaust, some coilovers and a sound system away from changing into a $10,000 Honda Civic. Examine modified automobile insurance low-cost quotes online Examine modified automobile insurance coverage quotes from uk modified automobile insurance coverage suppliers whether your car has engine modifications, changes to the exhaust, modifications to. Automotive insurance coverage quotes swiftcover.
They'll nearly actually increase your car insurance premium but when your coronary heart is set on tuning your motor, there are just a few methods you can preserve your modified car insurance coverage premium down. One essential exclusion that auto insurance coverage firms often demand is the fact that you'll not be insured for those who have an damage while racing (regardless of its own legality). Whether or not it's essential kind out a hire automotive or a new windscreen, our claims service is obtainable 24 hours a day, 12 months a yr. Many insurance coverage providers take a one-measurement-fits-all approach to automotive insurance coverage, and when you need any modifications or additions to your coverage, they have a tendency to come back with a hefty price ticket.
They proceed on the assumption that, if the unique specification has been modified, the vehicle not conforms to their first analysis and thus modified car insurance coverage tends to be more expensive. Acceptance by insurance coverage firms is based on things like occupation, well being and lifestyle. When you do find a low-cost car insurance firm that will give you modified automotive insurance coverage, there are some methods which you can make it more inexpensive. Automobile insurance for autos that have been modified is slightly different to 'traditional' automobile insurance coverage as it requires a extra specialist strategy with data of the specifics of automobile modifications.
If you are a younger driver, then you definitely would possibly be capable to carry down the price of modified automotive insurance coverage by taking further driving skills, reminiscent of Go Plus. As one of the UK's leading modified automotive insurance coverage providers, we do not just love modified automobiles, we love to rejoice automobiles. Be sure to get the very best insurance for your modified or excessive performance automobile.
Summertime means Britain's nation roads are dusted with basic automobiles on their weekly outing to the nearest nation pub within the afternoon sun. A car modification will be one thing as minor as adding a spoiler or becoming alloy wheels, all the way as much as altering the exhaust to a turbo system. Modified car insurance is greater than other sorts as a result of modifications make a automotive appear more seemingly be uncovered to theft or involved in an accident. If you happen to drive an element modified or completely custom-made automobile, then a specialist insurer could be the reply to a price-for-money premium.
To point out our continued dedication to the Modified Car Scene, Sky Insurance coverage often sponsor status automobile events for automotive lovers. By way of our fundamental website, Drifting Discussion board and online Drift Shop, we hope to bring the Drift neighborhood and anybody interested in getting involved in drifting all they might want for, all from a reputation they know they'll rely on. That's why we also play an lively position within the modifed automobile scene and sponsor occasions like modified automobile rallies, shows and monitor days. If your automotive has been changed in such a manner, you should answer 'Yes' after which specify all the modifications from our simple-to-use drop-down menu. In fairly a short while he has remodeled the initially 300Bhp automobile to a 950Bhp+ automotive.
The the reason why modified car insurance usually costs more are diverse however one of many primary reasons is the priority over the origin of newly fitted components and the cost of changing them. When trying to find automotive insurance you must always inform your insurers of any modifications made to your vehicle. We at Sky Insurance are thought-about specialists in the discipline of modified automotive insurance, so that you're in good arms.


Our French Market Basket is a simple handwoven palm leaf basket with natural sisal cord handle. Based on traditional designs from provincial market towns.
Petite perfection, our market bag makes for a beautiful accessory and even doubles up as handy home storage.
Often mistaken for straw or wicker, our baskets are handwoven using palm leaf in villages just outside of Marrakech, Morocco. The palm leaf is harvested from the Doum plant which grows wild across the Moroccan countryside and is a natural, eco-friendly and sustainable fibre. You will find a little bump on the edge of every basket where the baskets are tied off after being woven in the round. Versatile, well-sized and sturdy they are great for carrying all your daily essentials.
Please note that when the leaves are freshly picked they can sometimes appear slightly green in hue, as they age this will develop into a neutral tone.
Our baskets are very sturdy so don't be afraid to pack down into your suitcases and fold if necessary. Try to keep them away from amp weather; slowly dry next to a gentle heat source if wet.


The inspiration for the branding, and subsequent website & sales page creations, for Nicole Jardim, Certified Women's Health and Functional Nutrition Coach, was the simple dandelion — because so much of a woman's fertility and health feels like a wish. These wishes are different for every woman and I wanted to create a visual contrast, using the traditional gender colors of navy and pink, to form the foundation of what was to be an essentially feminine, truly pretty, luxurious yet comforting online space.
This project included brand identity creation, social media branding & assets, custom WordPress website, complete development and integration (Ontraport), full brand collateral, and custom sales page designs.


The "Week of Prayer for Christian Unity" for 2008 celebrates the 100th anniversary of the inauguration of the "Church Unity Octave". One hundred years ago, Father Paul Wattson, Episcopal (Anglican) priest and co-founder of the Society of the Atonement at Graymoor (Garrison, New York), introduced a Prayer Octave for Christian Unity that was first celebrated from 18 to 25 January 1908. Exactly sixty years later, in 1968, churches and parishes around the world received for the first time material for the Week of Prayer for Christian Unity, which had been jointly prepared by Faith and Order of the World Council of Churches and the Secretariat for Promoting Christian Unity (Catholic Church).
Today the cooperation between Anglican, Protestant, Orthodox and Catholic churches, parishes and communities in preparing for and celebrating the week of prayer has become a familiar practice. This simple fact is in itself a strong evidence for the effectiveness of prayer for unity. It gives us every right to speak about the history of the Week of Prayer for Christian Unity as one of success, and a reason for great joy and gratitude. However, it is also evident that praying for unity is not an invention of the last century. Jesus himself prayed to the Father "that they all may be one". Christians have made this prayer their own in myriad ways ever since. In the midst of our divisions, Christians of all traditions have prayed with an awareness of their union with the prayer of Christ for the unity of all his disciples. The ancient daily liturgy of the Orthodox churches, for example, invites the faithful to pray for peace and for the unity of all. The antecedents of the Week of Prayer for Christian Unity date back to the middle of the 19th century. The importance and the need of prayer, and not least, of prayer for unity among divided Christians, was emphasized in a number of different church movements and circles — among them the Oxford Movement, the Evangelical Alliance and various women's prayer initiatives.
In our baptism we commit ourselves to the following of Christ and the fulfilment of his will. This will for his followers was expressed in a prayer for unity so that others would come to believe in him as the one sent by God. Prayer that joins Jesus' prayer for unity has come to be referred to by some churches as an expression of "spiritual ecumenism". This prayer is most intense during the Week of Prayer for Christian Unity but needs to flow out of this observance into our daily lives. We realize that Christian unity cannot be solely the fruit of human efforts, but is always the work of the Holy Spirit. We cannot as humans make or organize it. We can only receive it as a gift of the Spirit when we ourselves are prepared to receive it.
Spiritual ecumenism calls forth an exchange of spiritual gifts so that what is lacking in each of our traditions finds its needed complement; this enables us to go beyond denominational labels to the Giver of all gifts. The surprising thing about prayer is that its first effect is in us. Our own minds and hearts are shaped by prayer as we seek opportunities to translate that prayer into practice, the true test of its authenticity. Spiritual ecumenism leads us to a healing of our memories. We face those difficult events of the past that give rise to competing interpretations of what happened and why. As a result, we can go beyond those things which have kept us divided. In other words, the goal of spiritual ecumenism is Christian unity that leads us into mission for the glory of God.
If believers are to follow Jesus, they must work and pray for Christian unity. However, the churches have differing visions of the visible unity for which we are praying. For some, full visible unity is the goal, bringing churches together in common confession, worship and sacraments, witness, decision-making and structured life. Others look to a "reconciled diversity", with the present churches working together to present a coherent witness to the world. For still others unity is found rather in the invisible bonds linking us to Christ and with one another, with an emphasis on personal ways of living one's faith in the world.
In this context, prayer for Christian unity is a challenging prayer. It is prayer that effects change in our own personal identity as well as in our confessional identity. Ultimately it means that we will give up our way of seeing unity in favor of concentrating on seeing what God wants for his people. However this does not mean that we will divest ourselves of our uniqueness, for unity naturally expresses itself in diversity. It is unity in diversity which reflects the mystery of communion in love, as seen in God's own being.