text:
package org.apache.jackrabbit.core.observation;

import org.apache.jackrabbit.core.SessionImpl;
import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
import org.apache.jackrabbit.core.id.ItemId;
import org.apache.jackrabbit.core.id.PropertyId;
import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.core.value.InternalValue;
import org.apache.jackrabbit.core.state.ItemStateException;
import org.apache.jackrabbit.spi.Path;
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver;
import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
import org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver;
import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;

import javax.jcr.observation.Event;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import javax.jcr.NamespaceException;
import javax.jcr.Session;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
import javax.jcr.nodetype.NodeType;

import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Collections;
import java.util.Map;
import java.util.HashMap;

/**
 * The EventState class encapsulates the session
 * independent state of an {@link javax.jcr.observation.Event}.
 */
public class EventState {

    /**
     * The logger instance for this class.
     */
    private static final Logger log = LoggerFactory.getLogger(EventState.class);

    /**
     * The caching path resolver.
     */
    private static CachingPathResolver cachingPathResolver;

    /**
     * The key srcAbsPath in the info map.
     */
    static final String SRC_ABS_PATH = "srcAbsPath";

    /**
     * The key destAbsPath in the info map.
     */
    static final String DEST_ABS_PATH = "destAbsPath";

    /**
     * The key srcChildRelPath in the info map.
     */
    static final String SRC_CHILD_REL_PATH = "srcChildRelPath";

    /**
     * The key destChildRelPath in the info map.
     */
    static final String DEST_CHILD_REL_PATH = "destChildRelPath";

    /**
     * The {@link javax.jcr.observation.Event} of this event.
     */
    private final int type;

    /**
     * The Id of the parent node associated with this event.
     */
    private final NodeId parentId;

    /**
     * The path of the parent node associated with this event.
     */
    private final Path parentPath;

    /**
     * The UUID of a child node, in case this EventState is of type
     * {@link javax.jcr.observation.Event#NODE_ADDED} or
     * {@link javax.jcr.observation.Event#NODE_REMOVED}.
     */
    private final NodeId childId;

    /**
     * The relative path of the child item associated with this event.
     * This is basically the name of the item with an optional index.
     */
    private final Path childRelPath;

    /**
     * The node type name of the parent node.
     */
    private final Name nodeType;

    /**
     * Set of mixin QNames assigned to the parent node.
     */
    private final Set<Name> mixins;

    /**
     * Set of node types. This Set consists of the primary node type and all
     * mixin types assigned to the associated parent node of this event state.
     *

     * This Set is initialized when
     * {@link #getNodeTypes(NodeTypeManagerImpl)} is called for the first time.
     */
    private Set<NodeType> allTypes;

    /**
     * The session that caused this event.
     */
    private final Session session;

    /**
     * Cached String representation of this EventState.
     */
    private String stringValue;

    /**
     * Cached hashCode value for this Event.
     */
    private int hashCode;

    /**
     * Flag indicating whether this is an external event, e.g. originating from
     * another node in a clustered environment.
     */
    private final boolean external;

    /**
     * The info Map associated with this event.
     */
    private Map<String, InternalValue> info = Collections.emptyMap();

    /**
     * If set to true, indicates that the child node of a node
     * added or removed event is a shareable node.
     */
    private boolean shareableNode;

    /**
     * Creates a new EventState instance.
     *
     * @param type       the type of this event.
     * @param parentId   the id of the parent node associated with this event.
     * @param parentPath the path of the parent node associated with this
     *                   event.
     * @param childId    the id of the child node associated with this event.
     *                   If the event type is one of: PROPERTY_ADDED,
     *                   PROPERTY_CHANGED or PROPERTY_REMOVED
     *                   this parameter must be null.
     * @param childPath  the relative path of the child item associated with
     *                   this event.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the {@link javax.jcr.Session} that caused this event.
     */
    private EventState(int type, NodeId parentId, Path parentPath,
                       NodeId childId, Path childPath, Name nodeType,
                       Set<Name> mixins, Session session, boolean external) {

        int mask = (Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED);
        if ((type & mask) > 0) {
            if (childId != null) {
                throw new IllegalArgumentException("childId only allowed for Node events.");
            }
        } else {
            if (childId == null && type != Event.PERSIST) {
                throw new IllegalArgumentException("childId must not be null for Node events.");
            }
        }
        this.type = type;
        this.parentId = parentId;
        this.parentPath = parentPath;
        this.childId = childId;
        this.childRelPath = childPath;
        this.nodeType = nodeType;
        this.mixins = mixins;
        this.session = session;
        this.external = external;
    }

    //-----------------< factory methods >--------------------------------------

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#NODE_ADDED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childId    the id of the child node associated with this event.
     * @param childPath  the relative path of the child node that was added.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that added the node.
     * @return an EventState instance.
     */
    public static EventState childNodeAdded(NodeId parentId,
                                            Path parentPath,
                                            NodeId childId,
                                            Path childPath,
                                            Name nodeType,
                                            Set<Name> mixins,
                                            Session session) {

        return childNodeAdded(parentId, parentPath, childId,
                childPath, nodeType, mixins, session, false);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#NODE_ADDED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childId    the id of the child node associated with this event.
     * @param childPath  the relative path of the child node that was added.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that added the node.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState childNodeAdded(NodeId parentId,
                                            Path parentPath,
                                            NodeId childId,
                                            Path childPath,
                                            Name nodeType,
                                            Set<Name> mixins,
                                            Session session,
                                            boolean external) {

        return new EventState(Event.NODE_ADDED, parentId, parentPath,
                childId, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#NODE_REMOVED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childId    the id of the child node associated with this event.
     * @param childPath  the relative path of the child node that was removed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that removed the node.
     * @return an EventState instance.
     */
    public static EventState childNodeRemoved(NodeId parentId,
                                              Path parentPath,
                                              NodeId childId,
                                              Path childPath,
                                              Name nodeType,
                                              Set<Name> mixins,
                                              Session session) {

        return childNodeRemoved(parentId, parentPath, childId,
                childPath, nodeType, mixins, session, false);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#NODE_REMOVED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childId    the id of the child node associated with this event.
     * @param childPath  the relative path of the child node that was removed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that removed the node.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState childNodeRemoved(NodeId parentId,
                                              Path parentPath,
                                              NodeId childId,
                                              Path childPath,
                                              Name nodeType,
                                              Set<Name> mixins,
                                              Session session,
                                              boolean external) {

        return new EventState(Event.NODE_REMOVED, parentId, parentPath,
                childId, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * NODE_MOVED. The parent node associated with this event type
     * is the parent node of the destination of the move!
     * This method creates an event state without an info map. A caller of this
     * method must ensure that it is properly set afterwards.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childId    the id of the child node associated with this event.
     * @param childPath  the relative path of the child node that was moved.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that moved the node.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState nodeMoved(NodeId parentId,
                                       Path parentPath,
                                       NodeId childId,
                                       Path childPath,
                                       Name nodeType,
                                       Set<Name> mixins,
                                       Session session,
                                       boolean external) {
        return new EventState(Event.NODE_MOVED, parentId, parentPath,
                childId, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * NODE_MOVED. The parent node associated with this event type
     * is the parent node of the destination of the move!
     *
     * @param parentId the id of the parent node associated with this
     *                 EventState.
     * @param destPath the path of the destination of the move.
     * @param childId  the id of the child node associated with this event.
     * @param srcPath  the path of the source of the move.
     * @param nodeType the node type of the parent node.
     * @param mixins   mixins assigned to the parent node.
     * @param session  the session that removed the node.
     * @param external flag indicating whether this is an external event
     * @return an EventState instance.
     * @throws ItemStateException if destPath does not have a
     *                            parent.
     */
    public static EventState nodeMovedWithInfo(
            NodeId parentId, Path destPath, NodeId childId, Path srcPath,
            Name nodeType, Set<Name> mixins, Session session, boolean external)
            throws ItemStateException {
        try {
            EventState es = nodeMoved(parentId, destPath.getAncestor(1),
                    childId, destPath, nodeType, mixins,
                    session, external);
            Map<String, InternalValue> info = new HashMap<String, InternalValue>();
            info.put(SRC_ABS_PATH, InternalValue.create(srcPath));
            info.put(DEST_ABS_PATH, InternalValue.create(destPath));
            es.setInfo(info);
            return es;
        } catch (RepositoryException e) {
            // should never happen actually
            String msg = "Unable to resolve parent for path: " + destPath;
            log.error(msg);
            throw new ItemStateException(msg, e);
        }
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * NODE_MOVED. The parent node associated with this event type
     * is the parent node of the destination of the reorder!
     *
     * @param parentId      the id of the parent node associated with this
     *                      EventState.
     * @param parentPath    the path of the parent node associated with
     *                      this EventState.
     * @param childId       the id of the child node associated with this
     *                      event.
     * @param destChildPath the name element of the node before it was reordered.
     * @param srcChildPath  the name element of the reordered node before the
     *                      reorder operation.
     * @param beforeChildPath the name element of the node before which the
     *                      reordered node is placed. (may be null
     *                      if reordered to the end.
     * @param nodeType      the node type of the parent node.
     * @param mixins        mixins assigned to the parent node.
     * @param session       the session that removed the node.
     * @param external      flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState nodeReordered(NodeId parentId,
                                           Path parentPath,
                                           NodeId childId,
                                           Path destChildPath,
                                           Path srcChildPath,
                                           Path beforeChildPath,
                                           Name nodeType,
                                           Set<Name> mixins,
                                           Session session,
                                           boolean external) {
        EventState es = nodeMoved(
                parentId, parentPath, childId, destChildPath,
                nodeType, mixins, session, external);
        Map<String, InternalValue> info = new HashMap<String, InternalValue>();
        info.put(SRC_CHILD_REL_PATH, createValue(srcChildPath));
        InternalValue value = null;
        if (beforeChildPath != null) {
            value = createValue(beforeChildPath);
        }
        info.put(DEST_CHILD_REL_PATH, value);
        es.setInfo(info);
        return es;
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_ADDED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that was added.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that added the property.
     * @return an EventState instance.
     */
    public static EventState propertyAdded(NodeId parentId,
                                           Path parentPath,
                                           Path childPath,
                                           Name nodeType,
                                           Set<Name> mixins,
                                           Session session) {

        return propertyAdded(parentId, parentPath, childPath,
                nodeType, mixins, session, false);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_ADDED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that was added.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that added the property.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState propertyAdded(NodeId parentId,
                                           Path parentPath,
                                           Path childPath,
                                           Name nodeType,
                                           Set<Name> mixins,
                                           Session session,
                                           boolean external) {

        return new EventState(Event.PROPERTY_ADDED, parentId, parentPath,
                null, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_REMOVED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that was removed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that removed the property.
     * @return an EventState instance.
     */
    public static EventState propertyRemoved(NodeId parentId,
                                             Path parentPath,
                                             Path childPath,
                                             Name nodeType,
                                             Set<Name> mixins,
                                             Session session) {

        return propertyRemoved(parentId, parentPath, childPath,
                nodeType, mixins, session, false);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_REMOVED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that was removed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that removed the property.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState propertyRemoved(NodeId parentId,
                                             Path parentPath,
                                             Path childPath,
                                             Name nodeType,
                                             Set<Name> mixins,
                                             Session session,
                                             boolean external) {

        return new EventState(Event.PROPERTY_REMOVED, parentId, parentPath,
                null, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_CHANGED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that changed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that changed the property.
     * @return an EventState instance.
     */
    public static EventState propertyChanged(NodeId parentId,
                                             Path parentPath,
                                             Path childPath,
                                             Name nodeType,
                                             Set<Name> mixins,
                                             Session session) {

        return propertyChanged(parentId, parentPath, childPath,
                nodeType, mixins, session, false);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PROPERTY_CHANGED}.
     *
     * @param parentId   the id of the parent node associated with
     *                   this EventState.
     * @param parentPath the path of the parent node associated with
     *                   this EventState.
     * @param childPath  the relative path of the property that changed.
     * @param nodeType   the node type of the parent node.
     * @param mixins     mixins assigned to the parent node.
     * @param session    the session that changed the property.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState propertyChanged(NodeId parentId,
                                             Path parentPath,
                                             Path childPath,
                                             Name nodeType,
                                             Set<Name> mixins,
                                             Session session,
                                             boolean external) {

        return new EventState(Event.PROPERTY_CHANGED, parentId, parentPath,
                null, childPath, nodeType, mixins, session, external);
    }

    /**
     * Creates a new {@link javax.jcr.observation.Event} of type
     * {@link javax.jcr.observation.Event#PERSIST}.
     *
     * @param session    the session that changed the property.
     * @param external   flag indicating whether this is an external event
     * @return an EventState instance.
     */
    public static EventState persist(Session session, boolean external) {

        return new EventState(Event.PERSIST, null, null, null, null,
                null, null, session, external);
    }

    /**
     * {@inheritDoc}
     */
    public int getType() {
        return type;
    }

    /**
     * Returns the uuid of the parent node.
     *
     * @return the uuid of the parent node.
     */
    public NodeId getParentId() {
        return parentId;
    }

    /**
     * Returns the path of the parent node.
     *
     * @return the path of the parent node.
     */
    public Path getParentPath() {
        return parentPath;
    }

    /**
     * Returns the Id of a child node operation.
     * If this EventState was generated for a property
     * operation this method returns null.
     *
     * @return the id of a child node operation.
     */
    public NodeId getChildId() {
        return childId;
    }

    /**
     * Returns the relative {@link Path} of the child
     * {@link javax.jcr.Item} associated with this event.
     *
     * @return the Path associated with this event.
     */
    public Path getChildRelPath() {
        return childRelPath;
    }

    /**
     * Returns the node type of the parent node associated with this event.
     *
     * @return the node type of the parent associated with this event.
     */
    public Name getNodeType() {
        return nodeType;
    }

    /**
     * Returns a set of Names which are the names of the mixins
     * assigned to the parent node associated with this event.
     *
     * @return the mixin names as Names.
     */
    public Set<Name> getMixinNames() {
        return mixins;
    }

    /**
     * Returns the Set of {@link javax.jcr.nodetype.NodeType}s
     * assigned to the parent node associated with this event. This
     * Set includes the primary type as well as all the mixin types
     * assigned to the parent node.
     *
     * @return Set of {@link javax.jcr.nodetype.NodeType}s.
     */
    public Set<NodeType> getNodeTypes(NodeTypeManagerImpl ntMgr) {
        if (allTypes == null) {
            Set<NodeType> tmp = new HashSet<NodeType>();
            try {
                tmp.add(ntMgr.getNodeType(nodeType));
            } catch (NoSuchNodeTypeException e) {
                log.warn("Unknown node type: " + nodeType);
            }
            Iterator<Name> it = mixins.iterator();
            while (it.hasNext()) {
                Name mixinName = it.next();
                try {
                    tmp.add(ntMgr.getNodeType(mixinName));
                } catch (NoSuchNodeTypeException e) {
                    log.warn("Unknown node type: " + mixinName);
                }
            }
            allTypes = Collections.unmodifiableSet(tmp);
        }
        return allTypes;
    }

    /**
     * {@inheritDoc}
     */
    public String getUserId() {
        return session.getUserID();
    }

    /**
     * Returns the Session that caused / created this
     * EventState.
     *
     * @return the Session that caused / created this
     *         EventState.
     */
    Session getSession() {
        return session;
    }

    /**
     * Returns the id of the associated item of this EventState.
     *
     * @return the ItemId or null for {@link Event#PERSIST} events
     */
    ItemId getTargetId() {
        if (type == Event.PERSIST) {
            return null;
        } else if (childId == null) {
            // property event
            return new PropertyId(parentId, childRelPath.getName());
        } else {
            // node event
            return childId;
        }
    }

    /**
     * Return a flag indicating whether this is an externally generated event.
     *
     * @return true if this is an external event;
     *         false otherwise
     */
    boolean isExternal() {
        return external;
    }

    /**
     * @return an unmodifiable info Map.
     */
    public Map<String, InternalValue> getInfo() {
        return info;
    }

    /**
     * Sets a new info map for this event.
     *
     * @param info the new info map.
     */
    public void setInfo(Map<String, InternalValue> info) {
        this.info = Collections.unmodifiableMap(new HashMap<String, InternalValue>(info));
    }

    /**
     * Returns a flag indicating whether the child node of this event is a
     * shareable node. Only applies to node added/removed events.
     *
     * @return true for a shareable child node, false
     *         otherwise.
     */
    boolean isShareableNode() {
        return shareableNode;
    }

    /**
     * Sets a new value for the {@link #shareableNode} flag.
     *
     * @param shareableNode whether the child node is shareable.
     * @see #isShareableNode()
     */
    void setShareableNode(boolean shareableNode) {
        this.shareableNode = shareableNode;
    }

    /**
     * Returns a String representation of this EventState.
     *
     * @return a String representation of this EventState.
     */
    public String toString() {
        if (stringValue == null) {
            StringBuilder sb = new StringBuilder();
            sb.append("EventState: ").append(valueOf(type));
            sb.append(", Parent: ").append(parentId);
            sb.append(", Child: ").append(childRelPath);
            sb.append(", UserId: ").append(session.getUserID());
            sb.append(", Info: ").append(info);
            stringValue = sb.toString();
        }
        return stringValue;
    }

    /**
     * Returns a hashCode for this EventState.
     *
     * @return a hashCode for this EventState.
     */
    public int hashCode() {
        int h = hashCode;
        if (h == 0) {
            h = 37;
            h = 37 * h + type;
            h = 37 * h + (parentId != null ? parentId.hashCode() : 0);
            h = 37 * h + (childRelPath != null ? childRelPath.hashCode() : 0);
            h = 37 * h + session.hashCode();
            h = 37 * h + info.hashCode();
            hashCode = h;
        }
        return hashCode;
    }

    /**
     * Returns true if this EventState is equal to
     * another object.
     *
     * @param obj the reference object with which to compare.
     * @return true if object obj is equal to this
     *         EventState; false otherwise.
     */
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof EventState) {
            EventState other = (EventState) obj;
            return this.type == other.type
                    && this.parentId.equals(other.parentId)
                    && this.childRelPath.equals(other.childRelPath)
                    && this.session.equals(other.session)
                    && this.info.equals(other.info);
        }
        return false;
    }

    /**
     * Returns a String representation of eventType.
     *
     * @param eventType an event type defined by {@link Event}.
     * @return a String representation of eventType.
     */
    public static String valueOf(int eventType) {
        if (eventType == Event.NODE_ADDED) {
            return "NodeAdded";
        } else if (eventType == Event.NODE_MOVED) {
            return "NodeMoved";
        } else if (eventType == Event.NODE_REMOVED) {
            return "NodeRemoved";
        } else if (eventType == Event.PROPERTY_ADDED) {
            return "PropertyAdded";
        } else if (eventType == Event.PROPERTY_CHANGED) {
            return "PropertyChanged";
        } else if (eventType == Event.PROPERTY_REMOVED) {
            return "PropertyRemoved";
        } else if (eventType == Event.PERSIST) {
            return "Persist";
        } else {
            return "UnknownEventType";
        }
    }

    /**
     * Creates an internal path value from the given path.
     *
     * @param path the path
     * @return an internal value wrapping the path
     */
    private static InternalValue createValue(Path path) {
        return InternalValue.create(path);
    }

    /**
     * Get the longest common path of all event state paths.
     *
     * @param events The list of EventState
     * @param session The associated session; it can be null
     * @return the longest common path
     */
    public static String getCommonPath(List<EventState> events, SessionImpl session) {
        String common = null;
        try {
            for (int i = 0; i < events.size(); i++) {
                EventState state = events.get(i);
                Path parentPath = state.getParentPath();
                String s;
                if (session == null) {
                    s = getJCRPath(parentPath);
                } else {
                    s = session.getJCRPath(parentPath);
                }

                if (common == null) {
                    common = s;
                } else if (!common.equals(s)) {

                    // Assign the shorter path to common.
                    if (s.length() < common.length()) {
                        String temp = common;
                        common = s;
                        s = temp;
                    }

                    // Find the real common.
                    while (!s.startsWith(common)) {
                        int idx = s.lastIndexOf('/');
                        if (idx < 0) {
                            break;
                        }
                        common = s.substring(0, idx + 1);
                    }
                }
            }
        } catch (NamespaceException e) {
            log.debug("Problem in retrieving JCR path", e);
        }
        return common;
    }

    private static String getJCRPath(Path path) {

        setupCachingPathResolver();

        String jcrPath;
        try {
            jcrPath = cachingPathResolver.getJCRPath(path);
        } catch (NamespaceException e) {
            jcrPath = "";
            log.debug("Problem in retrieving JCR path", e);
        }
        return jcrPath;
    }

    private static void setupCachingPathResolver() {
        if (cachingPathResolver != null) {
            return;
        }

        PathResolver pathResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), new NameResolver() {
            public Name getQName(String name) throws IllegalNameException, NamespaceException {
                return null;
            }

            public String getJCRName(Name name) throws NamespaceException {
                return name.getLocalName();
            }
        });

        cachingPathResolver = new CachingPathResolver(pathResolver);
    }
}

redpajama_set_name: RedPajamaGithub


If you are using Microsoft.SqlServer.SMO set SqlServer.ConnectionContext.DatabaseName to "master".
If you are using TSQL, select master database (USE master).
Keys: error, smo, tsql, c#.
If you're still experiencing problems, try to restart the service.


Devi & Co.'s signature Real Orchid necklaces are a tropical oasis that you can wear! This gorgeous Hawaiian statement necklace is so vibrant and fun! It would make a lovely gift for a landlocked mermaid who dreams of sun, sand, and surf!
This design features a stunning cream white orchid, which has been preserved in resin. Yes, you read that right! The flower pendant on this necklace is an actual orchid blossom, not blown glass or plastic! That's one of the things that makes Devi & Co. flower statement necklaces so special.
In addition, this gemstone necklace features genuine raw amethyst , shimmering labradorite rondelles, and a sterling silver closure.
This stunner measures approximately 18 inches long. Please refer to our sizing chart for more information on necklace fit!


William Holt, Professor in the Geosciences Department at Stony Brook (right) and Attreyee Ghosh, a post-doctoral researcher, discuss earthquake activity near a seismometer located in the Earth and Space Sciences building at Stony Brook.
STONY BROOK, N.Y., February 17, 2012 – Stony Brook University researchers have devised a numerical model to help explain the linkage between earthquakes and the powerful forces that cause them, according to a research paper scheduled to be published in the journal Science on Feb. 17. Their findings hold implications for long-term forecasting of earthquakes.
"If you take into account the effects of topography and all density variations within the plates – the earth's crust varies in thickness depending on where you are – if you take all that into account, together with the mantle convection system, you can do a good job explaining what is going on at the surface," said Dr. Holt.
Data for their global computer model came from Global Positioning System (GPS) measurements, which track the movements of the Earth's crust within the deforming plate boundary zones; measurements on the orientation of the Earth's stress field gleaned from earthquake faults; and a network of global seismometers that provided a picture of the Earth's interior density variations. They compared output from their model with these measurements from the Earth's surface.
"These observations – GPS, faults – allow one to test the completeness of the model," Dr. Holt said.
Drs. Ghosh and Holt found that plate tectonics is an integrated system, driven by density variations found between the surface of the Earth all the way to the Earth's core-mantle boundary. A surprising find was the variation in influence between relatively shallow features (topography and crustal thickness variations) and deeper large-scale mantle flow patterns that assist and, in some places, resist plate motions. Ghosh and Holt also found that it is the large-scale mantle flow patterns, set up by the long history of sinking plates, that are important for influencing the stresses within, and motions of, the plates.
Topography also has a major influence on the plate tectonic system, the researchers found. That result suggests a powerful feedback between the forces that make the topography and the 'push-back' on the system exerted by the topography, they explained.


text:
package com.cloudera.alfredo.server;

import com.cloudera.alfredo.client.AuthenticationException;

import java.security.Principal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;

/**
 * The AuthenticationToken contains information about an authenticated HTTP client and doubles
 * as the Principal to be returned by authenticated HttpServletRequests
 *

 * The token can be serialized/deserialized to and from string and it is send and received in HTTP client
 * responses and requests as a HTTP cookie (this is done by the {@link AuthenticationFilter}).
 */
public class AuthenticationToken implements Principal {

    /**
     * Constant that identifies an anonymous request.
     */
    public static final AuthenticationToken ANONYMOUS = new AuthenticationToken();

    private static final String ATTR_SEPARATOR = "&";
    private static final String USER_NAME = "u";
    private static final String PRINCIPAL = "p";
    private static final String EXPIRES = "e";
    private static final String TYPE = "t";

    private final static Set<String> ATTRIBUTES =
            new HashSet<String>(Arrays.asList(USER_NAME, PRINCIPAL, EXPIRES, TYPE));

    private String userName;
    private String principal;
    private String type;
    private long expires;
    private String token;

    private AuthenticationToken() {
        userName = null;
        principal = null;
        type = null;
        expires = -1;
        token = "ANONYMOUS";
        generateToken();
    }

    private static final String ILLEGAL_ARG_MSG = " NULL, empty or contains a '" + ATTR_SEPARATOR + "'";

    /**
     * Creates an authentication token.
     *
     * @param userName user name.
     * @param principal principal (commonly matches the user name, with Kerberos is the full/long principal
     * name while the userName is the short name).
     * @param type the authentication mechanism name.
     * (System.currentTimeMillis() + validityPeriod).
     */
    public AuthenticationToken(String userName, String principal, String type) {
        if (userName == null || userName.length() == 0 || userName.contains(ATTR_SEPARATOR)) {
            throw new IllegalArgumentException("userName" + ILLEGAL_ARG_MSG);
        }
        if (principal == null || principal.length() == 0 || principal.contains(ATTR_SEPARATOR)) {
            throw new IllegalArgumentException("principal" + ILLEGAL_ARG_MSG);
        }
        if (type == null || type.length() == 0 || type.contains(ATTR_SEPARATOR)) {
            throw new IllegalArgumentException("type" + ILLEGAL_ARG_MSG);
        }
        this.userName = userName;
        this.principal = principal;
        this.type = type;
        this.expires = -1;
    }

    /**
     * Sets the expiration of the token.
     *
     * @param expires expiration time of the token in milliseconds since Epoc.
     */
    public void setExpires(long expires) {
        if (this != AuthenticationToken.ANONYMOUS) {
            this.expires = expires;
            generateToken();
        }
    }

    /**
     * Generates the token.
     */
    private void generateToken() {
        StringBuffer sb = new StringBuffer();
        sb.append(USER_NAME).append("=").append(userName).append(ATTR_SEPARATOR);
        sb.append(PRINCIPAL).append("=").append(principal).append(ATTR_SEPARATOR);
        sb.append(TYPE).append("=").append(type).append(ATTR_SEPARATOR);
        sb.append(EXPIRES).append("=").append(expires);
        token = sb.toString();
    }

    /**
     * Returns the user name.
     *
     * @return the user name.
     */
    public String getUserName() {
        return userName;
    }

    /**
     * Returns the principal name (this method name comes from the JDK Principal interface).
     *
     * @return the principal name.
     */
    @Override
    public String getName() {
        return principal;
    }

    /**
     * Returns the authentication mechanism of the token.
     *
     * @return the authentication mechanism of the token.
     */
    public String getType() {
        return type;
    }

    /**
     * Returns the expiration time of the token.
     *
     * @return the expiration time of the token, in milliseconds since Epoc.
     */
    public long getExpires() {
        return expires;
    }

    /**
     * Returns if the token has expired.
     *
     * @return if the token has expired.
     */
    public boolean isExpired() {
        return expires != -1 && System.currentTimeMillis() > expires;
    }

    /**
     * Returns the string representation of the token.
     *

     * This string representation is parseable by the {@link #parse} method.
     *
     * @return the string representation of the token.
     */
    @Override
    public String toString() {
        return token;
    }

    /**
     * Parses a string into an authentication token.
     *
     * @param tokenStr string representation of a token.
     * @return the parsed authentication token.
     * @throws AuthenticationException thrown if the string representation could not be parsed into
     * an authentication token.
     */
    public static AuthenticationToken parse(String tokenStr) throws AuthenticationException {
        Map<String, String> map = split(tokenStr);
        if (!map.keySet().equals(ATTRIBUTES)) {
            throw new AuthenticationException("Invalid token string, missing attributes",
                    AuthenticationException.AuthenticationExceptionCode.INVALID_TOKEN_STRING);
        }
        long expires = Long.parseLong(map.get(EXPIRES));
        AuthenticationToken token = new AuthenticationToken(map.get(USER_NAME), map.get(PRINCIPAL), map.get(TYPE));
        token.setExpires(expires);
        return token;
    }

    /**
     * Splits the string representation of a token into attributes pairs.
     *
     * @param tokenStr string representation of a token.
     * @return a map with the attribute pairs of the token.
     * @throws AuthenticationException thrown if the string representation of the token could not be broken into
     * attribute pairs.
     */
    private static Map<String, String> split(String tokenStr) throws AuthenticationException {
        Map<String, String> map = new HashMap<String, String>();
        StringTokenizer st = new StringTokenizer(tokenStr, ATTR_SEPARATOR);
        while (st.hasMoreTokens()) {
            String part = st.nextToken();
            int separator = part.indexOf('=');
            if (separator == -1) {
                throw new AuthenticationException("Invalid authentication token",
                        AuthenticationException.AuthenticationExceptionCode.INVALID_TOKEN);
            }
            String key = part.substring(0, separator);
            String value = part.substring(separator + 1);
            map.put(key, value);
        }
        return map;
    }

}


The University of Massachusetts Dartmouth Center for Marketing Research has released its latest analysis of social media usage in the marketing efforts of companies on the Fortune 500 list. As always, the study has a number of interesting insights into how corporations view different online platforms and how they can contribute to their marketing efforts. Here are some of the report's key takeaways.
In 2015 corporate blog usage fell to a low of 21%. That was the height of the buzz around "distributed" media when everyone was seeking off-site solutions. After beginning to grow again last year it's now at 42%, twice the 2015 number and, in fact, the highest it's ever been. Blog usage is still highest among those at the top of the list as well among tech and other consumer-centric industries.
All of that is good news, but there's also that fewer corporate blogs than ever before allow on-domain comments, just 51%. On the one hand that's not surprising and forgoing comments in favor of social media conversations is a trend throughout the media world. But it's also disappointing since allowing such comments can be a valuable customer service and audience feedback tool.
As the study notes, one reason for the resurgence in blog adoption is that it's a wholly-owned platform, a notion that seems to be coming back into vogue as companies get whiplash from ever-changing algorithms and terms of service on other services. They are unencumbered by character restrictions, can offer a variety of distribution options for the reader to choose from and more while owning their content.
Because it appeals to all industries and is a valuable corporate reputation tool, LinkedIn continues to be the most widely-used social network by companies of all types. 98% of the Fortune 500 maintain active LinkedIn profiles, which can be used not only for news but are powerful recruiting tools.
More surprising given Facebook's dominant stature worldwide is that it falls to third place in usage after not just LinkedIn but also Twitter. The numbers are close – 88% to 85% – but Twitter's second-place showing indicates it's still viewed as more important for its timeliness in breaking news and as a customer service platform than Facebook.
Instagram continues to gain more and more usage among these companies, growing to 53% this year from just 95 in 2013. Specifically the study calls out its usage as not just a marketing/corporate reputation tool but also a sales platform, something the company has been trying to encourage with more tools geared in that direction.
Also growing is Snapchat, which is used by 10% of the Fortune 500. That may seem small, but it's going to keep getting bigger if the company can make changes, as it plans to do, that ease the on-ramp for new users and make advertising a more sustainable revenue source.
The increase of corporate blogs is very good news! Just when people thought blogs were dying, people are starting to see that there is value in hosting a blog on your own website. Hoorah!


text:
Q: Asymptotic exactness of Welch's t-test under arbitrary distributions A common recommendation when using the Welch t-test for comparing two unpaired sample means is that the assumption of normality is not a problem when the sample size $n$ is bigger than some constant $c$; for example, $c=30$.
Can this recommendation be backed up using theoretic results? Specifically, is Welch's $t$-test asymptotically exact even if the distributions are not normal? Only considering well-behaved distributions, for example, finite moments.
I mostly found simulation studies investigating the robustness of Welch's $t$-test. Looking at the results, it seems like the type-I errors always converge to the nominal alpha ($.05$ in the studies I found); suggesting that Welch's $t$-test is indeed asymptotically exact. But it would be nice to know whether this is always the case.

redpajama_set_name: RedPajamaStackExchange


2002 Civic Si For Sale. 2002 civic si for sale in florida 12 000 obo. 2002 honda civic si for sale excellent shape youtube. 2002 honda civic si hatchback cars for sale. buy used 2002 honda civic si ep3 k24a1 5spd blown head. 2002 honda civic si for sale sioux falls south dakota. stock. find used 2002 honda civic si hatchback ep3 30k all. 2002 honda civic si for sale orange indiana. used honda civic for sale in. photos 2002 honda civic si for sale. [Dinarjat.com].


Parents have a significant impact in helping their child transition successfully to high school. There are many factors that educators believe lead to this dismal trend, especially focusing on the academic achievement of a student. Parents should use a holistic approach with their child, focusing on emotional well-being, social well-being, physical health, and academic achievement. All of these factors affect how a child performs in high school.
Today I will address the emotional and social well-being approaches. In part two of this series, which will publish next week, I will address the physical health and academic achievement approaches.
Your child may be feeling anxious and nervous about transitioning to high school.
Talk to your child about your own high school experiences, and encourage him or her to be excited for this milestone in his or her life.
Make quality time with your child and develop a trusting relationship in which your child feels comfortable discussing any issues he or she encounters at school with you.
Attend Freshman Orientation with your child so you are both well prepared for the beginning of the year. Anything that helps your child avoid any embarrassing mistakes as a freshman will help his or her nerves.
It is critical that your child socializes with friends who will positively influence your child's path.
Help your child transition into a responsible and independent young adult. Make it clear what your expectations are for curfews, homework and grades, household chores, driving, dating, social media and technology use, etc., as well as the consequences for not following your rules. It will help your child to balance his or her social life with your expectations, and avoid misunderstandings between you and your child.
Encourage your child to join extracurricular activities at the school and make friends with similar interests. Extracurricular activities boost self-esteem and look great on college and scholarship applications.
Find opportunities to meet your child's friends and their parents. Building that support network allows you to provide more trust and freedom for your child to socialize.
These efforts are relatively easy ways for you as a parent to engage with your child and prevent him or her from dropping out of school. Next week I will give you tips on addressing your child's physical health and academic achievement.


City breaks are guaranteed to offer an immersive experience of a new culture, and Marrakech is no exception. Within just a few days you will find yourself answering the animated calls of sellers in the soukh and navigating the labyrinth of the Medina, soaking up the vibrant atmosphere. After all that time spent on your feet, however, some relaxation is certainly on the cards. The hidden paradise of Selman Marrakech lies just a 15-minute drive from the city centre, but in atmosphere feels a whole world away.
With its sun-kissed terrace and spectacular 80-metre outdoor pool, the family-owned resort is a place of tranquillity. From the sensual bespoke fragrance that fills the reception area to the tapestries that decorate the walls, Jacques Garcia's interiors offer an opulent take on traditional Moroccan style. Black and white mosaics, sculpted woodwork, and rich purples, oranges and yellows fill the rooms. Guests lucky enough to stay in one of the five riads can relax in their own heated pool and walled garden, forming a quiet, secluded retreat that's perfect for honeymoons.
If you can bear to leave your room – and the king-size bed, private terrace and complimentary ghoriba cookies may make it difficult – the generous layout of the hotel complex leaves much to explore. The space is expansive, but always feels intimate, and as I take a midday stroll down footpaths veiled by the shade of olive-trees, I don't pass another soul other than the gardeners picking the fruit to make Selman's own oil. The avenues lead to the pièce de résistance: a small herd of exquisite Arabian thoroughbred horses, housed in two palace-like stables, that are available for saddled treks, dressage lessons and, most magnificently, theatrical performances to accompany Sunday brunch at the hotel's Mediterranean restaurant.
For the ultimate in relaxation, I head to the tile-adorned spa, the tranquil heart of Selman. The therapists follow the Méthode Chenot regime, which is based on the principles of traditional Chinese medicine, offering guests personalised procedures. I am treated to a hammam, a traditional Middle Eastern treatment that uses eucalyptus black soap and orange flower extract in a full-body rejuvenating scrub, and the following day I enjoy a detox massage, where everything from the tips of my toes to my scalp and hair is cared for. With my skin feeling sumptuously soft, it's time for some light exercise, so I take part in a personal tai chi session overlooking the spa's two outdoor heated pools, moving to a soundtrack of birdsong and the gentle lapping of water.
On offer at each of the hotel's three restaurants for those guests following a health programme are Biolight meals, which are high in nutrients and natural vegetable-based foods to complement their daily spa activity. Opting instead for a holiday of indulgence, I taste the wide variety of fine food and drink on offer. I sample rich squid-ink tagliatelle and burrata at Le Pavillon, the Mediterranean brasserie with a terrace nestled between lawns and paddocks; crème de champignons and lobster gyoza in Le Selman, the international fusion lounge where a buffet breakfast is also served every morning; and, best of all, a traditional vegetable tagine, spiced couscous and almond sweets in Assyl, the hotel's Moroccan restaurant, where Andalusian musicians entertain diners with live folk songs every evening.
The beauty of Selman lies not just in its attentive staff, luscious green spaces or exquisite décor, but in the quiet splendour of the surrounds. For a hotel of its size and grandeur, it retains a delightful intimacy, giving you time for relaxation and contemplation before you're ready to get lost in the lively buzz of Marrakech once again.
For more information and to book, visit www.selman-marrakech.com.


text:
The Threat of Fascism Won't End with Trump
It will take sustained progressive political pressure now and into the future to dismantle the powerful fascist forces that threaten our democracy.
September 28, 2020 Betsy Hartmann Portside
Is Trump a fascist?
In the increasingly perilous build-up to the November 3 presidential election, that question is on many people's minds, including my own. Four years ago when Trump was first elected, I read up on German and Italian fascism to prepare myself for such a possibility here. While historical comparisons are difficult to make – Hitler and Mussolini's rise to power took place almost a century ago – there are some striking parallels. These include:
The strategic deployment of fear and loathing. The fascist project defines itself in opposition to both internal and external enemies who ostensibly threaten the purity of the community/race and very survival of the nation. Fascist propaganda uses demonization, dehumanization, and disinformation to spread hate and justify violence against the Other. Conspiracy theories feed the frenzy. Sound familiar? Just as European fascists drummed up fear of communists to secure political power, the Trump administration's current bogeyman is antifa. The Justice Department recently named New York City, Portland and Seattle as "anarchist jurisdictions" subject to the possible withdrawal of federal financial support.
The subversion and perversion of democratic institutions. Trump's relentless assault on government institutions and agencies, whether through hollowing them out, inserting his own cronies, twisting their mission, or a combination of all three, attempts to weaken the very foundations of constitutional democracy. Even the Post Office has been put in play as a means of voter suppression, and with RBG's death, the independence of the Supreme Court is in dire jeopardy. In Nazi Germany and Mussolini's Italy, the collusion of conservatives was a precondition of fascist takeover of the state. With a few exceptions, the Republic Party has been Trump's all too willing partner. "The Republican party has and will continue to enthusiastically support the President's America-first agenda," reads the short resolution that substituted for a bonafide platform at the party's recent presidential convention.
Blunting the edge of critical thinking. The late Italian scholar and novelist Umberto Eco, who grew up under Mussolini, underscores the crucial role of language manipulation in what he termed Ur-Fascism, or Eternal Fascism. "Nazi or Fascist schoolbooks made use of an impoverished vocabulary, and an elementary syntax, in order to limit the instruments for complex and critical reasoning," he wrote. According to English scholar Stephen Clingman, the effects of Trump's purposeful dumbing down of discourse and attack on the very foundations of meaning are darkly multiplied many times over by the internet and social media, .
Paramilitaries and parallel police: In their march to power, the infamous paramilitary Brownshirts of the Nazis and Blackshirts of Mussolini spread terror in the name of rooting out enemies. Once in control of the state, fascist leaders created special police forces outside established organs of law and order to perform their dirty work. The much-feared Gestapo is an example.
While the U.S. is not yet at this point, Trump's cozy relationship with racist and antisemitic armed white nationalists gives a dangerous greenlight to Far Right vigilantism. He has helped enable the right-wing media's hero worship of Kyle Rittenhouse, the 17-year-old shooter accused of killing two protesters and injuring another in Kenosha, Wisconsin. The ties and overlaps between militia members, local police forces and military veterans amplify the risk of violence against communities of color and progressive protestors should the upcoming presidential election be closely contested.
Organizing and deploying the Border Patrol as a parallel quasi-military police force is perhaps the most ominous prefascist development. The special tactical unit, BORTAC, which has a record of racism and brutality, has worked with ICE to ruthlessly pursue undocumented immigrants in Democrat-run sanctuary cities. This summer BORTAC agents were implicated in police state-style intimidation of protestors in Portland, Oregon. The idea of a border line, epitomized by the wall between the U.S. and Mexico, disguises the fact that the Border Patrol already has extra-constitutional powers in wider border zones within 100 miles of our land and coastal boundaries. These zones are home to two-thirds of the U.S. population.
Do such developments mean Trump is a fascist? Fascism expert Jason Stanley argues that it's not very helpful to frame the question that way. While it's true that Trump "is pushing already existing fascist forces further," those forces have a long history that didn't begin with Trump nor will they end with him. Conservatives and liberals alike share the blame for the contemporary build-up of the racist prison-industrial complex and the assault on immigrants. Congressional support of hyper-militarization and permanent war remains a largely consensual bipartisan affair.
Within the Trump administration, perhaps the person closest to being an overt fascist is senior adviser Stephen Miller, who spearheaded the 2018 family separation policy at the border that caged children in concentration camps. Before the practice was forced to end, 3,000 children were separated from their parents, and Miller wanted to separate 25,000 more. Arguably he was testing the waters for more severe and widespread repressive measures, not only against immigrants.
In the moral universe I inhabit, the caging of children alone is a reason not to vote for Trump. But one of the lessons the history of fascism teaches us is that conventionally "good people" are willing to go along with evil things. At its electoral height, the German Nazi Party gained 37 percent of the vote. Trump's base is a similar size.
A resounding defeat of Trump and his Republican allies is necessary but not sufficient to stop the growth of fascism in America. There is no guarantee, for example, that under a Biden administration the police state mission-creep of the Border Patrol and ICE will cease. It will take sustained progressive political pressure now and into the future to dismantle the powerful fascist forces that threaten our democracy.
Betsy Hartmann is the author of The America Syndrome: Apocalypse, War and Our Call to Greatness (Seven Stories Press/NY) and Reproductive Rights and Wrongs (third edition, Haymarket Books) as well as two political thrillers about the Far Right. She is a professor emerita of Development Studies at Hampshire College in Amherst, MA and a well-known commentator on ecofascism. Visit her website BetsyHartmann.com.
militarization of police
Child detention
The Capitol Riot: Documents You Should Read
The Capitol Riot Reveals the Dangers From the Enemy Within
Trump Is the Republican Party's Past and Its Future

redpajama_set_name: RedPajamaCommonCrawl


Home » Retro Computing » What does scroll lock do? Or scrlk?
What does scroll lock do? Or scrlk?
What's the purpose of the scroll lock key? What does scroll lock do? With modern windowing operating systems we don't need the scroll lock or scrlk key very often, but it solved a very real problem in the days of DOS.
The scrlk key is an abbreviation for scroll lock. Some keyboards abbreviate it even further. I one keyboard that just says "scr" on that key. However your keyboard abbreviates it, it's almost always the key in between the print screen and pause keys.
What does scroll lock do? In the 1980s it provided a way to scroll the screen before the mouse existed. Today the scroll lock key sits forgotten in a lonely part of town on modern keyboards. Well, that's assuming the key is even present at all. Sometimes it's discarded like that crumpled piece of paper next to it.
Under MS-DOS, when all we had was a single screen of plain text with one window, we might still want to scroll around the screen rather than moving the cursor. Under Windows or Mac OS, we accomplish that with the arrow gadgets in the corner of each window. That facility didn't exist in DOS. So instead, we hit Scroll Lock, then hit the arrow keys to move where we wanted.
It wasn't intuitive. But in 1981, few things were.
A less skilled salesperson could at least say the IBM had 83 keys when some competing computers had fewer than 60. What was the advantage? You could type faster and not have to remember as many control-key combinations. It made the IBM PC easier to use, relatively speaking. In 1981 no computer was particularly easy to use by modern standards, so little things like a scroll lock key mattered.
Today, IBM gets remembered as the company that created the PC standard and the industry around it and got chased out due to greed and incompetence. But IBM did a good job of studying the fledgling personal computer industry, asking lots of questions, and designing something that addressed a lot of the shortfalls of the day.
That said, even in the 1980s, "what does scroll lock do?" was a fair question. Not a lot of people used the key. It was there, but it probably made for a more impressive sales demo than it did practical, everyday use. It turned out that few enough people used it that DOS utilities could usurp the key to use for other purposes, like copying and pasting between programs. Even people who knew what scroll lock was supposed to do often found these alternatives uses for it more helpful.
What does scroll lock do today?
Today, the best known Windows program that uses functionality similar to this is Excel. A handful of other programs also do it, like Libre Office Calc, which competes with Excel. Probably the second-best known program that uses it is Lotus Notes. If you hit Scroll Lock, you can zoom around the screen with your arrow keys. DOS veterans can find this behavior handy. People who didn't use the scroll lock key in the 1980s find it confusing. If anything, they hit the key, enable a weird mode, and then they can't figure out how to get things back to normal.
The other major use for scroll lock today is with KVM switches in server rooms. The scroll lock key activates the KVM, since you'd almost never have any reason to use scroll lock on a server.
Most people regard the Scroll Lock key as a vestigial organ today. Some laptops, such as Lenovo and Dell, bury its functionality in an unmarked key combination like FN+K, FN+C, or FN+S to save space. And usually, unless someone accidentally hits that hidden key combination when trying to do something else, they never miss it.


Why do clocks run that direction? Why are they called hands?
Inventors living in the northern hemisphere were trying to mimic the movement of the sun over a sundial, and the shadows moving across a sundial move that direction in the northern hemisphere.
Noon, or 12 o'clock (of the clock) is at the top because of the sundial tradition. The word noon comes from the Latin word 'nona' or ninth, because in Roman times, midday was the ninth hour of the day or la hora nona.
The first timepieces were actually bells set up in the town square to call the public to prayer. Like cloche in French, clock literally means bell.
Soon, dials and indicators were added for a visual display in addition to the audible, but the peasants were illiterate and couldn't read or do math. They could perform calculations by counting on their fingers. Four slash marks were much easier for them to contend with than "IV" when taking one away from five. That's why when Roman numerals are used, the IV is traditionally IIII to this day.
Early clocks in the 14th century, had a carving shaped like a hand, and the dial moved around it. Soon, the creators realized the hand could be made to move instead, and in 1690 a minute hand was introduced when the pendulum and anchor escapement were perfected, making precision time keeping possible.
Time hasn't always been divided the same, at least not in France. During the French Revolution, in 1793, France attempted to introduce a decimal time system with 10 hours in the day, 100 decimal minutes and 100 decimal seconds per minute.
The decimal hour was almost twice as long as the present hour, or 144 minutes. The decimal minute was slightly longer than the present minute at 86 seconds, and the decimal second was slightly shorter…0.86 sec. Clocks were manufactured with both markings, but obviously decimal time didn't catch on, and France discontinued its mandatory use on April 7, 1795.
A case can be made for daylight saving time being made before Benjamin Franklin. Albert Edward, The Prince of Wales, liked to be outdoors as much as possible, so the clocks all over Sandringham Estate were advanced by half an hour to give him more time for hunting and shooting. King George V maintained this custom during his lifetime, but King Edward VIII abolished it on his accession in 1936.
Big Ben is actually the name of the bell, not the clock, inside the tower in London. It was recently named Elizabeth Tower, for the Queen in her Diamond Jubilee year, 2012.
To contribute and link to your book, blog or business, email or comment below, and find out how to be a part of our team of Adventur-istas.
This entry was posted in Coffee Break Escape on September 25, 2012 by Bev.
How romantic…could you imagine if we still said "of the bells." I love it! Your coffee break escape is such a great idea, Bev. I've had the pleasure of seeing Big Ben in life a few years ago and its such a special memory.
Thanks, Joanne. It is romantic, now that you mention it. I am having fun with these coffee breaks…now if I only had more time to write many more! Get it…time?


text:
Stenobothrus cobresianus är en insektsart som beskrevs av Bei-bienko 1949. Stenobothrus cobresianus ingår i släktet Stenobothrus och familjen gräshoppor. Inga underarter finns listade i Catalogue of Life.

Källor

Gräshoppor
cobresianus

redpajama_set_name: RedPajamaWikipedia


This could be an alternative name for my business! I am increasingly asked to talk to people who are obstructing use of social tools in their business or otherwise getting in the way of change. One grey haired old codger talking to other grey haired old codgers to try to get them out of the way.
Seriously though having been a senior manager in a big organisation myself I can relate to their challenges. Managers are under pressure to deliver. Especially middle managers are in a tough place, getting grief from above and below, blamed for everything, and invariably in a situation of competing for resources and profile with their peers.
The sorts of behaviours that got them where they are today, and that appear to keep them safe and successful, are based on some deeply held assumptions. Challenging those assumptions is not for the faint hearted because doing so provokes an almost existential crisis and they, naturally, resist!
Like I say, people change one at a time and for their reasons and not yours. You have to find a way to relate the changes you want to bring about to the challenges the people you are talking to face. You need to really work hard at building trust and finding ways to relate to their fears and deal with them. Challenging but rewarding work.


Revolved Triangle Pose – Parivrtta Trikonasana: Tips and videos on alignment, partner guiding, & yoga sequencing. Improve thoracic spinal mobility.
Turn to Root the Feet: Turn the right foot 90 degrees to the right (so your toe turns out). Turn the left foot 45-60 degrees to the right. Maintain muscle tightness in the quadriceps to protect the knees. Knees should be open (not bent.) Position the front heel and the back hell in a straight line.
Set your Base Hand: Rotate your left shoulder so that it comes over your right left leg. Extend you hand down, touch the floor with your palm. You touch to the outside of your right foot. Use a yoga block if you cannot reach the floor.
Set Your Lead Hand: Stretch the right arm up to the ceiling so that you shoulders are stacked vertically.
Set your Eyes: Your gaze goes up towards the tips of your fingers and right thumb.
Parivrtta Trikonasana is said to be the counter pose Utthita Trikonasana (Triangle Pose).1. In truth, it's not really a counter pose as compared to downdog vs updog. Extended Triangle pose is a powerful hamstring and oblique stretch. It also improves balance and core strength. Revolved Triangle pose is more of a twisting pose, but one of the few that can be done from a standing position.
Extended Triangle Pose and Revolved Triangle Pose are often sequenced together in flows because transitions between them doesn't require changing foot positions. Various experts from BKS Iyengar to Mark Stephens 2 often puts Chandrasana, Extended Triangle, Revolved Triangle Pose, Warrior II, Ashta Chandrasa, and Parsvottanasana in the same flows because transitions are simple and fast. Sequencing using these poses creates a deep burn in the legs, because transitions can be accomplished that maintain muscle tension.
Straight Spine: One of the most important aspects of the Revolved Triangle Pose (Parivrtta Trikonasa) is the spine should be straight. The teacher or partner should inspect the spine and cue the student to lengthen the spine before allowing the student to rotate. Rotating the spine in a bent position can cause injury.
Stabilize the Yoga Student: Balance in Revolved Triangle Pose (Parivrtta Trikonasa) is challenging. As the teacher, you should position yourself behind the student and help the student maintain balance. Falling in this position (especially for older yogis) can lead to shoulder or back injury. Plus you can also encourage lengthening the spine from this same position.
Rotate from the Shoulder: Never pull on the lead arm. In the picture of me teaching Dawn Parivrtta Trikonasa, I'm bracing her shoulder and biasing her thoracic spine (T-spine) to rotate.
The Hip Handle: In this same picture, you can see that I'm holding onto Illiac Crest (the hip handle) to help Dawn's Pelvis stay in alignment. New yoga students may try to internationally rotate the hip of the lead leg to gain range of motion. This "cheat" defeats the purpose of the pose, and increases strain on the knee.


text:
Q: Why do C++ classes have two names? Simple question:
Why do classes in C++ have two names as in:
class name1 {
//variables and functions
} name2;

A: name2 is an object of type name1, just as if the code was
class name1 {
// variables and functions
};
name1 name2;

A: We can create objects from a class in two way:

*

*Writing name of object after class definition:
class name1 {
    //variables and functions
} name2;

In this sample name1 is the name of class, and name2 is an oject of type name1.

*Creating objects using variable definition notation:
name1 name2;

in this sample name2 is an object that is created of type name1.


text:
World Cup notebook: Crosby puts an impressive streak on the line
Sidney Crosby has won 22 straight and his only concern is making it 23...Swedes must be smarter...Carey Price on beer league hockey.
Ken Campbell
Team Canada captain Sidney Crosby is on something of a roll lately. Not only did he win his second Stanley Cup in the spring, he enters the World Cup of Hockey semifinal riding a 22-game winning streak in a Canadian uniform dating back to the Vancouver Olympics in 2010.
Since losing 5-3 to USA in the last game of the preliminary round, Canada won the next four games en route to the gold medal. Crosby's teams then went 6-0-0 in Sochi and 9-0-0 in games in which he played in the 2015 World Championship before going 3-0-0 in the World Cup. Crosby has nine goals and 20 points in those games, including the golden goal in overtime in Vancouver and a goal in the 3-0 win in the gold medal game in Sochi.
"I didn't even know about that until today," Crosby said. "Those don't really matter going into tomorrow, right? It's all about tomorrow right now."
SWEDES CAN'T PLAY 'STUPID'
Swedish defenseman Oliver Ekman-Larsson said his team can't afford a repeat of its play in the final pre-tournament game when it lost 6-2 to Team Europe, the same team it plays in the semifinal Sunday afternoon. "We played a really stupid game," Ekman-Larsson said. "We turned over too many pucks at their blueline, at our blueline, all over the ice. When you do that against a team with that much skill, you're in big trouble."
Team Europe coach Ralph Kruger said that late in that game, Frans Nielsen pointed to the Danish shoulder patch flag and reckoned he had lost to the Swedes about 200 times during his career. He then said how happy he was to finally beat them. The Swedes know they'll be playing an opponent motivated by a desire to knock off one of the world's hockey powers.
"I said right from the beginning I thought it would be great for the guys on Team Europe to have a chance to beat some of these teams," said Swedish defenseman Erik Karlsson. "Good for them. I wish then all the best, except for on Sunday."
CAREY PRICE HAVING SOME FUN
During his media scrum yesterday, Canadian goalie Carey Price seemed a little perplexed by a question from Marc-Andre Perreault of TVA Sports in Quebec. Perreault asked Price why Canada always comes into these big games saying it's just another game when clearly there is so much on the line.
"Because that's what it is," Price said. What followed was this rather interesting exchange:
Perreault: "But in my beer league, when we play Maggie's Corner Store, we get all excited."
Price: "I don't know. Maggie's Corner Store must be pretty good, huh?"
CANADA, TEAM EUROPE WILL KEEP IT PREDICTABLE
Exciting hockey doesn't always win, but boring hockey almost never loses. And that's why Team Canada and Team Europe will continue to play predictable hockey for the rest of the tournament.
"I don't like to feed my family on hope. I like to feed my family on know," said Team Canada coach Mike Babcock. "I don't like surprises, not on Christmas, not on my birthday. So I don't want it anymore. I want it under control."
Team Europe, meanwhile, won't be in the mood to trade chances, either. "We're playing a boring style of hockey, but it's proving to be a successful one," said Team Europe captain Anze Kopitar. "We're proud of it and we're going to keep doing it."
BUT TEAM EUROPE WILL BE FAST
If there was one thing we learned about Team Sweden from its game against North America it was that the Swedes had all sorts of trouble handling the speed of the under-24 team. Team Europe is considerably older, but coach Ralph Kruger is keenly aware that it will have move quickly in order to win.
"There's no question that we really need to be a strong transition team," Kruger said. "We've created a lot of offense out of that. And (Sweden) is probably the best in the world at just defending and staying within their structure right through an entire game. We need to be patient with that. I'm expecting a one-goal game and we need to find our advantage like we did against the Czechs. It will be a similar game at a higher level and we're going to have to pick it up."
world cupworld championshipolympics