text:
import Queue
import sys
import threading
import time
from collections import OrderedDict, namedtuple
from copy import deepcopy

from cassandra import ConsistencyLevel, consistency_value_to_name
from cassandra.query import SimpleStatement
from nose.plugins.attrib import attr
from nose.tools import assert_greater_equal

from tools.assertions import assert_length_equal, assert_none, assert_unavailable
from dtest import DISABLE_VNODES, MultiError, Tester, debug, create_ks, create_cf
from tools.data import (create_c1c2_table, insert_c1c2, insert_columns,
                        query_c1c2, rows_to_list)
from tools.decorators import since

ExpectedConsistency = namedtuple('ExpectedConsistency', ('num_write_nodes', 'num_read_nodes', 'is_strong'))

class TestHelper(Tester):

    def __init__(self, *args, **kwargs):
        Tester.__init__(self, *args, **kwargs)
        self.lock = threading.Lock()

    def log(self, message):
        with self.lock:
            debug(message)

    def _is_local(self, cl):
        return (cl == ConsistencyLevel.LOCAL_QUORUM or
                cl == ConsistencyLevel.LOCAL_ONE or
                cl == ConsistencyLevel.LOCAL_SERIAL)

    def _is_conditional(self, cl):
        return (cl == ConsistencyLevel.SERIAL or
                cl == ConsistencyLevel.LOCAL_SERIAL)

    def _required_nodes(self, cl, rf_factors, dc):
        """
        Return the number of nodes required by this consistency level
        in the current data center, specified by the dc parameter,
        given a list of replication factors, one per dc.
        """
        return {
            ConsistencyLevel.ANY: 1,
            ConsistencyLevel.ONE: 1,
            ConsistencyLevel.TWO: 2,
            ConsistencyLevel.THREE: 3,
            ConsistencyLevel.QUORUM: sum(rf_factors) / 2 + 1,
            ConsistencyLevel.ALL: sum(rf_factors),
            ConsistencyLevel.LOCAL_QUORUM: rf_factors[dc] / 2 + 1,
            ConsistencyLevel.EACH_QUORUM: rf_factors[dc] / 2 + 1,
            ConsistencyLevel.SERIAL: sum(rf_factors) / 2 + 1,
            ConsistencyLevel.LOCAL_SERIAL: rf_factors[dc] / 2 + 1,
            ConsistencyLevel.LOCAL_ONE: 1,
        }[cl]

    def get_expected_consistency(self, idx, rf_factors, write_cl, read_cl):
            """
            Given a node index, identify to which data center we are connecting and return
            the expected consistency: number of nodes we write to, read from, and whether
            we should have strong consistency, that is whether R + W > N
            """
            nodes = [self.nodes] if isinstance(self.nodes, int) else self.nodes

            def get_data_center():
                """
                :return: the data center corresponding to this node
                """
                dc = 0
                for i in xrange(1, len(nodes)):
                    if idx < sum(nodes[:i]):
                        break
                    dc += 1
                return dc

            data_center = get_data_center()
            if write_cl == ConsistencyLevel.EACH_QUORUM:
                write_nodes = sum([self._required_nodes(write_cl, rf_factors, i) for i in range(0, len(nodes))])
            else:
                write_nodes = self._required_nodes(write_cl, rf_factors, data_center)

            read_nodes = self._required_nodes(read_cl, rf_factors, data_center)
            is_strong = read_nodes + write_nodes > sum(rf_factors)

            return ExpectedConsistency(num_write_nodes=write_nodes,
                                       num_read_nodes=read_nodes,
                                       is_strong=is_strong)

    def _should_succeed(self, cl, rf_factors, num_nodes_alive, current):
        """
        Return true if the read or write operation should succeed based on
        the consistency level requested, the replication factors and the
        number of nodes alive in each data center.
        """
        if self._is_local(cl):
            return num_nodes_alive[current] >= self._required_nodes(cl, rf_factors, current)
        elif cl == ConsistencyLevel.EACH_QUORUM:
            for i in xrange(0, len(rf_factors)):
                if num_nodes_alive[i] < self._required_nodes(cl, rf_factors, i):
                    return False
            return True
        else:
            return sum(num_nodes_alive) >= self._required_nodes(cl, rf_factors, current)

    def _start_cluster(self, save_sessions=False, requires_local_reads=False):
        cluster = self.cluster
        nodes = self.nodes
        rf = self.rf

        configuration_options = {'hinted_handoff_enabled': False}

        # If we must read from the local replica first, then the dynamic snitch poses a problem
        # because occasionally it may think that another replica is preferable even if the
        # coordinator is a replica
        if requires_local_reads:
            configuration_options['dynamic_snitch'] = False

        cluster.set_configuration_options(values=configuration_options)
        cluster.populate(nodes)

        if requires_local_reads and isinstance(nodes, int):
            # Changing the snitch to PropertyFileSnitch even in the
            # single dc tests ensures that StorageProxy sorts the replicas eligible
            # for reading by proximity to the local host, essentially picking the
            # local host for local reads, see IEndpointSnitch.sortByProximity() and
            # StorageProxy.getLiveSortedEndpoints(), which is called by the AbstractReadExecutor
            # to determine the target replicas. The default case, a SimpleSnitch wrapped in
            # a dynamic snitch, may rarely choose a different replica.
            debug('Changing snitch for single dc case')
            for node in cluster.nodelist():
                node.data_center = 'dc1'
            cluster.set_configuration_options(values={
                'endpoint_snitch': 'org.apache.cassandra.locator.PropertyFileSnitch'})

        cluster.start(wait_for_binary_proto=True, wait_other_notice=True)

        self.ksname = 'mytestks'
        session = self.patient_exclusive_cql_connection(cluster.nodelist()[0])

        create_ks(session, self.ksname, rf)
        self.create_tables(session, requires_local_reads)

        if save_sessions:
            self.sessions = []
            self.sessions.append(session)
            for node in cluster.nodelist()[1:]:
                self.sessions.append(self.patient_exclusive_cql_connection(node, self.ksname))

    def create_tables(self, session, requires_local_reads):
        self.create_users_table(session, requires_local_reads)
        self.create_counters_table(session, requires_local_reads)
        session.cluster.control_connection.wait_for_schema_agreement(wait_time=60)

    def truncate_tables(self, session):
        statement = SimpleStatement("TRUNCATE users", ConsistencyLevel.ALL)
        session.execute(statement)
        statement = SimpleStatement("TRUNCATE counters", ConsistencyLevel.ALL)
        session.execute(statement)

    def create_users_table(self, session, requires_local_reads):
        create_cmd = """
            CREATE TABLE users (
                userid int PRIMARY KEY,
                firstname text,
                lastname text,
                age int
            ) WITH COMPACT STORAGE"""

        if requires_local_reads:
            create_cmd += " AND " + self.get_local_reads_properties()

        session.execute(create_cmd)

    @staticmethod
    def get_local_reads_properties():
        """
        If we must read from the local replica first, then we should disable read repair and
        speculative retry, see CASSANDRA-12092
        """
        return " dclocal_read_repair_chance = 0 AND read_repair_chance = 0 AND speculative_retry =  'NONE'"

    def insert_user(self, session, userid, age, consistency, serial_consistency=None):
        text = "INSERT INTO users (userid, firstname, lastname, age) VALUES ({}, 'first{}', 'last{}', {}) {}"\
            .format(userid, userid, userid, age, "IF NOT EXISTS" if serial_consistency else "")
        statement = SimpleStatement(text, consistency_level=consistency, serial_consistency_level=serial_consistency)
        session.execute(statement)

    def update_user(self, session, userid, age, consistency, serial_consistency=None, prev_age=None):
        text = "UPDATE users SET age = {} WHERE userid = {}".format(age, userid)
        if serial_consistency and prev_age:
            text = text + " IF age = {}".format(prev_age)
        statement = SimpleStatement(text, consistency_level=consistency, serial_consistency_level=serial_consistency)
        session.execute(statement)

    def delete_user(self, session, userid, consistency):
        statement = SimpleStatement("DELETE FROM users where userid = {}".format(userid), consistency_level=consistency)
        session.execute(statement)

    def query_user(self, session, userid, age, consistency, check_ret=True):
        statement = SimpleStatement("SELECT userid, age FROM users where userid = {}".format(userid), consistency_level=consistency)
        res = session.execute(statement)
        expected = [[userid, age]] if age else []
        ret = rows_to_list(res) == expected
        if check_ret:
            self.assertTrue(ret, "Got {} from {}, expected {} at {}".format(rows_to_list(res), session.cluster.contact_points, expected, consistency_value_to_name(consistency)))
        return ret

    def create_counters_table(self, session, requires_local_reads):
        create_cmd = """
            CREATE TABLE counters (
                id int PRIMARY KEY,
                c counter
            )"""

        if requires_local_reads:
            create_cmd += " WITH " + self.get_local_reads_properties()

        session.execute(create_cmd)

    def update_counter(self, session, id, consistency, serial_consistency=None):
        text = "UPDATE counters SET c = c + 1 WHERE id = {}".format(id)
        statement = SimpleStatement(text, consistency_level=consistency, serial_consistency_level=serial_consistency)
        session.execute(statement)
        return statement

    def query_counter(self, session, id, val, consistency, check_ret=True):
        statement = SimpleStatement("SELECT * from counters WHERE id = {}".format(id), consistency_level=consistency)
        ret = rows_to_list(session.execute(statement))
        if check_ret:
            self.assertEqual(ret[0][1], val, "Got {} from {}, expected {} at {}".format(ret[0][1],
                                                                                session.cluster.contact_points,
                                                                                val,
                                                                                consistency_value_to_name(consistency)))
        return ret[0][1] if ret else 0

class TestAvailability(TestHelper):
    """
    Test that we can read and write depending on the number of nodes that are alive and the consistency levels.
    """

    def _test_simple_strategy(self, combinations):
        """
        Helper test function for a single data center: invoke _test_insert_query_from_node() for each node
        and each combination, progressively stopping nodes.
        """
        cluster = self.cluster
        nodes = self.nodes
        rf = self.rf

        num_alive = nodes
        for node in xrange(nodes):
            debug('Testing node {} in single dc with {} nodes alive'.format(node, num_alive))
            session = self.patient_exclusive_cql_connection(cluster.nodelist()[node], self.ksname)
            for combination in combinations:
                self._test_insert_query_from_node(session, 0, [rf], [num_alive], *combination)

            self.cluster.nodelist()[node].stop()
            num_alive -= 1

    def _test_network_topology_strategy(self, combinations):
        """
        Helper test function for multiple data centers, invoke _test_insert_query_from_node() for each node
        in each dc and each combination, progressively stopping nodes.
        """
        cluster = self.cluster
        nodes = self.nodes
        rf = self.rf

        nodes_alive = deepcopy(nodes)
        rf_factors = rf.values()

        for i in xrange(0, len(nodes)):  # for each dc
            self.log('Testing dc {} with rf {} and {} nodes alive'.format(i, rf_factors[i], nodes_alive))
            for n in xrange(nodes[i]):  # for each node in this dc
                self.log('Testing node {} in dc {} with {} nodes alive'.format(n, i, nodes_alive))
                node = n + sum(nodes[:i])
                session = self.patient_exclusive_cql_connection(cluster.nodelist()[node], self.ksname)
                for combination in combinations:
                    self._test_insert_query_from_node(session, i, rf_factors, nodes_alive, *combination)

                self.cluster.nodelist()[node].stop(wait_other_notice=True)
                nodes_alive[i] -= 1

    def _test_insert_query_from_node(self, session, dc_idx, rf_factors, num_nodes_alive, write_cl, read_cl, serial_cl=None, check_ret=True):
        """
        Test availability for read and write via the session passed in as a parameter.
        """
        self.log("Connected to %s for %s/%s/%s" %
                 (session.cluster.contact_points, consistency_value_to_name(write_cl), consistency_value_to_name(read_cl), consistency_value_to_name(serial_cl)))

        start = 0
        end = 100
        age = 30

        if self._should_succeed(write_cl, rf_factors, num_nodes_alive, dc_idx):
            for n in xrange(start, end):
                self.insert_user(session, n, age, write_cl, serial_cl)
        else:
            assert_unavailable(self.insert_user, session, end, age, write_cl, serial_cl)

        if self._should_succeed(read_cl, rf_factors, num_nodes_alive, dc_idx):
            for n in xrange(start, end):
                self.query_user(session, n, age, read_cl, check_ret)
        else:
            assert_unavailable(self.query_user, session, end, age, read_cl, check_ret)

    def test_simple_strategy(self):
        """
        Test for a single datacenter, using simple replication strategy.
        """
        self.nodes = 3
        self.rf = 3

        self._start_cluster()

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE, None, False),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.TWO),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.THREE),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ANY, ConsistencyLevel.ONE, None, False),
            (ConsistencyLevel.LOCAL_ONE, ConsistencyLevel.LOCAL_ONE, None, False),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.LOCAL_SERIAL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.LOCAL_SERIAL),
        ]

        self._test_simple_strategy(combinations)

    @since("3.0")
    def test_simple_strategy_each_quorum(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for a single datacenter, using simple replication strategy, only
        the each quorum reads.
        """
        self.nodes = 3
        self.rf = 3

        self._start_cluster()

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self._test_simple_strategy(combinations)

    @attr("resource-intensive")
    def test_network_topology_strategy(self):
        """
        Test for multiple datacenters, using network topology replication strategy.
        """
        self.nodes = [3, 3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3), ('dc3', 3)])

        self._start_cluster()

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE, None, False),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.TWO),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.THREE),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ANY, ConsistencyLevel.ONE, None, False),
            (ConsistencyLevel.LOCAL_ONE, ConsistencyLevel.LOCAL_ONE, None, False),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.LOCAL_SERIAL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.LOCAL_SERIAL),
        ]

        self._test_network_topology_strategy(combinations)

    @attr("resource-intensive")
    @since("3.0")
    def test_network_topology_strategy_each_quorum(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for multiple datacenters, using network topology strategy, only
        the each quorum reads.
        """
        self.nodes = [3, 3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3), ('dc3', 3)])

        self._start_cluster()

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self._test_network_topology_strategy(combinations)

class TestAccuracy(TestHelper):
    """
    Test that we can consistently read back what we wrote depending on the write and read consistency levels.
    """

    class Validation:

        def __init__(self, outer, sessions, nodes, rf_factors, start, end, write_cl, read_cl, serial_cl=None):
            self.outer = outer
            self.sessions = sessions
            self.nodes = nodes
            self.rf_factors = rf_factors
            self.start = start
            self.end = end
            self.write_cl = write_cl
            self.read_cl = read_cl
            self.serial_cl = serial_cl

            outer.log('Testing accuracy with WRITE/READ/SERIAL consistency set to {}/{}/{} (keys : {} to {})'
                      .format(consistency_value_to_name(write_cl), consistency_value_to_name(read_cl), consistency_value_to_name(serial_cl), start, end - 1))

        def get_expected_consistency(self, idx):
            return self.outer.get_expected_consistency(idx, self.rf_factors, self.write_cl, self.read_cl)

        def validate_users(self):
            """
            First validation function: update the users table sending different values to different sessions
            and check that when strong_consistency is true (R + W > N) we read back the latest value from all sessions.
            If strong_consistency is false we instead check that we read back the latest value from at least
            the number of nodes we wrote to.
            """
            outer = self.outer
            sessions = self.sessions
            start = self.start
            end = self.end
            write_cl = self.write_cl
            read_cl = self.read_cl
            serial_cl = self.serial_cl

            def check_all_sessions(idx, n, val):
                expected_consistency = self.get_expected_consistency(idx)
                num = 0
                for s in sessions:
                    if outer.query_user(s, n, val, read_cl, check_ret=expected_consistency.is_strong):
                        num += 1
                assert_greater_equal(num, expected_consistency.num_write_nodes,
                                     "Failed to read value from sufficient number of nodes,"
                                     " required {} but got {} - [{}, {}]"
                                     .format(expected_consistency.num_write_nodes, num, n, val))

            for n in xrange(start, end):
                age = 30
                for s in range(0, len(sessions)):
                    outer.insert_user(sessions[s], n, age, write_cl, serial_cl)
                    check_all_sessions(s, n, age)
                    if serial_cl is None:
                        age += 1
                for s in range(0, len(sessions)):
                    outer.update_user(sessions[s], n, age, write_cl, serial_cl, age - 1)
                    check_all_sessions(s, n, age)
                    age += 1
                outer.delete_user(sessions[0], n, write_cl)
                check_all_sessions(s, n, None)

        def validate_counters(self):
            """
            Second validation function: update the counters table sending different values to different sessions
            and check that when strong_consistency is true (R + W > N) we read back the latest value from all sessions.
            If strong_consistency is false we instead check that we read back the latest value from at least
            the number of nodes we wrote to.
            """
            outer = self.outer
            sessions = self.sessions
            start = self.start
            end = self.end
            write_cl = self.write_cl
            read_cl = self.read_cl
            serial_cl = self.serial_cl

            def check_all_sessions(idx, n, val):
                expected_consistency = self.get_expected_consistency(idx)
                results = []
                for s in sessions:
                    results.append(outer.query_counter(s, n, val, read_cl, check_ret=expected_consistency.is_strong))

                assert_greater_equal(results.count(val), expected_consistency.num_write_nodes,
                                     "Failed to read value from sufficient number of nodes, required {} nodes to have a"
                                     " counter value of {} at key {}, instead got these values: {}"
                                     .format(expected_consistency.num_write_nodes, val, n, results))

            for n in xrange(start, end):
                c = 1
                for s in range(0, len(sessions)):
                    outer.update_counter(sessions[s], n, write_cl, serial_cl)
                    check_all_sessions(s, n, c)
                    # Update the counter again at CL ALL to make sure all nodes are on the same page
                    # since a counter update requires a read
                    outer.update_counter(sessions[s], n, ConsistencyLevel.ALL)
                    c += 2  # the counter was updated twice

    def _run_test_function_in_parallel(self, valid_fcn, nodes, rf_factors, combinations):
        """
        Run a test function in parallel.
        """

        requires_local_reads = False
        for combination in combinations:
            for i, _ in enumerate(nodes):
                expected_consistency = self.get_expected_consistency(i, rf_factors, combination[0], combination[1])
                if not expected_consistency.is_strong:
                    # if at least one combination does not reach strong consistency, in order to validate weak
                    # consistency we require local reads, see CASSANDRA-12092 for details.
                    requires_local_reads = True
                    break

            if requires_local_reads:
                break

        self._start_cluster(save_sessions=True, requires_local_reads=requires_local_reads)

        input_queue = Queue.Queue()
        exceptions_queue = Queue.Queue()

        def run():
            while not input_queue.empty():
                try:
                    v = TestAccuracy.Validation(self, self.sessions, nodes, rf_factors, *input_queue.get(block=False))
                    valid_fcn(v)
                except Queue.Empty:
                    pass
                except:
                    exceptions_queue.put(sys.exc_info())

        start = 0
        num_keys = 50
        for combination in combinations:
            input_queue.put((start, start + num_keys) + combination)
            start += num_keys

        threads = []
        for n in range(0, 8):
            t = threading.Thread(target=run)
            t.setDaemon(True)
            t.start()
            threads.append(t)

        self.log("Waiting for workers to complete")
        while exceptions_queue.empty():
            time.sleep(0.1)
            if len(filter(lambda t: t.isAlive(), threads)) == 0:
                break

        if not exceptions_queue.empty():
            _, exceptions, tracebacks = zip(*exceptions_queue.queue)
            raise MultiError(exceptions=exceptions, tracebacks=tracebacks)

    @attr("resource-intensive")
    def test_simple_strategy_users(self):
        """
        Test for a single datacenter, users table, only the each quorum reads.
        """
        self.nodes = 5
        self.rf = 3

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.ONE, ConsistencyLevel.THREE),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ANY, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.TWO),
            (ConsistencyLevel.TWO, ConsistencyLevel.ONE),
            # These are multi-DC consistency levels that should default to quorum calls
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.SERIAL),
        ]

        self.log("Testing single dc, users")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_users, [self.nodes], [self.rf], combinations)

    @attr("resource-intensive")
    @since("3.0")
    def test_simple_strategy_each_quorum_users(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for a single datacenter, users table, only the each quorum reads.
        """
        self.nodes = 5
        self.rf = 3

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self.log("Testing single dc, users, each quorum reads")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_users, [self.nodes], [self.rf], combinations)

    @attr("resource-intensive")
    def test_network_topology_strategy_users(self):
        """
        Test for multiple datacenters, users table.
        """
        self.nodes = [3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3)])

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.ONE, ConsistencyLevel.THREE),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ANY, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.TWO),
            (ConsistencyLevel.TWO, ConsistencyLevel.ONE),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.LOCAL_SERIAL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.LOCAL_SERIAL, ConsistencyLevel.SERIAL),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.SERIAL, ConsistencyLevel.LOCAL_SERIAL),
        ]

        self.log("Testing multiple dcs, users")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_users, self.nodes, self.rf.values(), combinations),

    @attr("resource-intensive")
    @since("3.0")
    def test_network_topology_strategy_each_quorum_users(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for a multiple datacenters, users table, only the each quorum
        reads.
        """
        self.nodes = [3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3)])

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self.log("Testing multiple dcs, users, each quorum reads")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_users, self.nodes, self.rf.values(), combinations)

    def test_simple_strategy_counters(self):
        """
        Test for a single datacenter, counters table.
        """
        self.nodes = 3
        self.rf = 3

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.ONE, ConsistencyLevel.THREE),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.TWO),
            (ConsistencyLevel.TWO, ConsistencyLevel.ONE),
            # These are multi-DC consistency levels that should default to quorum calls
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
        ]

        self.log("Testing single dc, counters")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_counters, [self.nodes], [self.rf], combinations)

    @since("3.0")
    def test_simple_strategy_each_quorum_counters(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for a single datacenter, counters table, only the each quorum
        reads.
        """
        self.nodes = 3
        self.rf = 3

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self.log("Testing single dc, counters, each quorum reads")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_counters, [self.nodes], [self.rf], combinations)

    @attr("resource-intensive")
    def test_network_topology_strategy_counters(self):
        """
        Test for multiple datacenters, counters table.
        """
        self.nodes = [3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3)])

        combinations = [
            (ConsistencyLevel.ALL, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.ALL, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ALL),
            (ConsistencyLevel.QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.QUORUM),
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.LOCAL_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.ONE),
            (ConsistencyLevel.TWO, ConsistencyLevel.TWO),
            (ConsistencyLevel.ONE, ConsistencyLevel.THREE),
            (ConsistencyLevel.THREE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.ONE),
            (ConsistencyLevel.ONE, ConsistencyLevel.TWO),
            (ConsistencyLevel.TWO, ConsistencyLevel.ONE),
        ]

        self.log("Testing multiple dcs, counters")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_counters, self.nodes, self.rf.values(), combinations),

    @attr("resource-intensive")
    @since("3.0")
    def test_network_topology_strategy_each_quorum_counters(self):
        """
        @jira_ticket CASSANDRA-10584
        Test for multiple datacenters, counters table, only the each quorum
        reads.
        """
        self.nodes = [3, 3]
        self.rf = OrderedDict([('dc1', 3), ('dc2', 3)])

        combinations = [
            (ConsistencyLevel.LOCAL_QUORUM, ConsistencyLevel.EACH_QUORUM),
            (ConsistencyLevel.EACH_QUORUM, ConsistencyLevel.EACH_QUORUM),
        ]

        self.log("Testing multiple dcs, counters, each quorum reads")
        self._run_test_function_in_parallel(TestAccuracy.Validation.validate_counters, self.nodes, self.rf.values(), combinations),

class TestConsistency(Tester):

    def short_read_test(self):
        """
        @jira_ticket CASSANDRA-9460
        """
        cluster = self.cluster

        # Disable hinted handoff and set batch commit log so this doesn't
        # interfer with the test
        cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
        cluster.set_batch_commitlog(enabled=True)

        cluster.populate(3).start(wait_other_notice=True)
        node1, node2, node3 = cluster.nodelist()

        session = self.patient_cql_connection(node1)
        create_ks(session, 'ks', 3)
        create_cf(session, 'cf', read_repair=0.0)

        normal_key = 'normal'
        reversed_key = 'reversed'

        # Repeat this test 10 times to make it more easy to spot a null pointer exception caused by a race, see CASSANDRA-9460
        for k in xrange(10):
            # insert 9 columns in two rows
            insert_columns(self, session, normal_key, 9)
            insert_columns(self, session, reversed_key, 9)

            # Delete 3 first columns (and 3 last columns, for the reversed version) with a different node dead each time
            for node, column_number_to_delete in zip(range(1, 4), range(3)):
                self.stop_node(node)
                self.delete(node, normal_key, column_number_to_delete)
                self.delete(node, reversed_key, 8 - column_number_to_delete)
                self.restart_node(node)

            # Query 3 firsts columns in normal order
            session = self.patient_cql_connection(node1, 'ks')
            query = SimpleStatement(
                'SELECT c, v FROM cf WHERE key=\'k{}\' LIMIT 3'.format(normal_key),
                consistency_level=ConsistencyLevel.QUORUM)
            rows = list(session.execute(query))
            res = rows
            assert_length_equal(res, 3)

            # value 0, 1 and 2 have been deleted
            for i in xrange(1, 4):
                self.assertEqual('value{}'.format(i + 2), res[i - 1][1])

            # Query 3 firsts columns in reverse order
            session = self.patient_cql_connection(node1, 'ks')
            query = SimpleStatement(
                'SELECT c, v FROM cf WHERE key=\'k{}\' ORDER BY c DESC LIMIT 3'.format(reversed_key),
                consistency_level=ConsistencyLevel.QUORUM)
            rows = list(session.execute(query))
            res = rows
            assert_length_equal(res, 3)

            # value 6, 7 and 8 have been deleted
            for i in xrange(0, 3):
                self.assertEqual('value{}'.format(5 - i), res[i][1])

            session.execute('TRUNCATE cf')

    def short_read_delete_test(self):
        """ Test short reads ultimately leaving no columns alive [#4000] """
        cluster = self.cluster

        # Disable hinted handoff and set batch commit log so this doesn't
        # interfere with the test
        cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
        cluster.set_batch_commitlog(enabled=True)

        cluster.populate(2).start(wait_other_notice=True)
        node1, node2 = cluster.nodelist()

        session = self.patient_cql_connection(node1)
        create_ks(session, 'ks', 3)
        create_cf(session, 'cf', read_repair=0.0)
        # insert 2 columns in one row
        insert_columns(self, session, 0, 2)

        # Delete the row while first node is dead
        node1.flush()
        node1.stop(wait_other_notice=True)
        session = self.patient_cql_connection(node2, 'ks')

        query = SimpleStatement('DELETE FROM cf WHERE key=\'k0\'', consistency_level=ConsistencyLevel.ONE)
        session.execute(query)

        node1.start(wait_other_notice=True)

        # Query first column
        session = self.patient_cql_connection(node1, 'ks')

        assert_none(session, "SELECT c, v FROM cf WHERE key=\'k0\' LIMIT 1", cl=ConsistencyLevel.QUORUM)

    def short_read_quorum_delete_test(self):
        """
        @jira_ticket CASSANDRA-8933
        """
        cluster = self.cluster
        # Consider however 3 nodes A, B, C (RF=3), and following sequence of operations (all done at QUORUM):

        # Disable hinted handoff and set batch commit log so this doesn't
        # interfere with the test
        cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
        cluster.set_batch_commitlog(enabled=True)

        cluster.populate(3).start(wait_other_notice=True)
        node1, node2, node3 = cluster.nodelist()

        session = self.patient_cql_connection(node1)
        create_ks(session, 'ks', 3)

        session.execute("CREATE TABLE t (id int, v int, PRIMARY KEY(id, v)) WITH read_repair_chance = 0.0")
        # we write 1 and 2 in a partition: all nodes get it.
        session.execute(SimpleStatement("INSERT INTO t (id, v) VALUES (0, 1)", consistency_level=ConsistencyLevel.ALL))
        session.execute(SimpleStatement("INSERT INTO t (id, v) VALUES (0, 2)", consistency_level=ConsistencyLevel.ALL))

        # we delete 1: only A and C get it.
        node2.flush()
        node2.stop(wait_other_notice=True)
        session.execute(SimpleStatement("DELETE FROM t WHERE id = 0 AND v = 1", consistency_level=ConsistencyLevel.QUORUM))
        node2.start(wait_other_notice=True)

        # we delete 2: only B and C get it.
        node1.flush()
        node1.stop(wait_other_notice=True)
        session = self.patient_cql_connection(node2, 'ks')
        session.execute(SimpleStatement("DELETE FROM t WHERE id = 0 AND v = 2", consistency_level=ConsistencyLevel.QUORUM))
        node1.start(wait_other_notice=True)
        session = self.patient_cql_connection(node1, 'ks')

        # we read the first row in the partition (so with a LIMIT 1) and A and B answer first.
        node3.flush()
        node3.stop(wait_other_notice=True)
        assert_none(session, "SELECT * FROM t WHERE id = 0 LIMIT 1", cl=ConsistencyLevel.QUORUM)

    def readrepair_test(self):
        cluster = self.cluster
        cluster.set_configuration_options(values={'hinted_handoff_enabled': False})

        if DISABLE_VNODES:
            cluster.populate(2).start()
        else:
            tokens = cluster.balanced_tokens(2)
            cluster.populate(2, tokens=tokens).start()
        node1, node2 = cluster.nodelist()

        session = self.patient_cql_connection(node1)
        create_ks(session, 'ks', 2)
        create_c1c2_table(self, session, read_repair=1.0)

        node2.stop(wait_other_notice=True)

        insert_c1c2(session, n=10000, consistency=ConsistencyLevel.ONE)

        node2.start(wait_for_binary_proto=True, wait_other_notice=True)

        # query everything to cause RR
        for n in xrange(0, 10000):
            query_c1c2(session, n, ConsistencyLevel.QUORUM)

        node1.stop(wait_other_notice=True)

        # Check node2 for all the keys that should have been repaired
        session = self.patient_cql_connection(node2, keyspace='ks')
        for n in xrange(0, 10000):
            query_c1c2(session, n, ConsistencyLevel.ONE)

    def quorum_available_during_failure_test(self):
        CL = ConsistencyLevel.QUORUM
        RF = 3

        debug("Creating a ring")
        cluster = self.cluster
        if DISABLE_VNODES:
            cluster.populate(3).start()
        else:
            tokens = cluster.balanced_tokens(3)
            cluster.populate(3, tokens=tokens).start()
        node1, node2, node3 = cluster.nodelist()

        debug("Set to talk to node 2")
        session = self.patient_cql_connection(node2)
        create_ks(session, 'ks', RF)
        create_c1c2_table(self, session)

        debug("Generating some data")
        insert_c1c2(session, n=100, consistency=CL)

        debug("Taking down node1")
        node1.stop(wait_other_notice=True)

        debug("Reading back data.")
        for n in xrange(100):
            query_c1c2(session, n, CL)

    def stop_node(self, node_number):
        to_stop = self.cluster.nodes["node%d" % node_number]
        to_stop.flush()
        to_stop.stop(wait_other_notice=True)

    def delete(self, stopped_node_number, key, column):
        next_node = self.cluster.nodes["node%d" % (((stopped_node_number + 1) % 3) + 1)]
        session = self.patient_cql_connection(next_node, 'ks')

        # delete data for normal key
        query = 'BEGIN BATCH '
        query = query + 'DELETE FROM cf WHERE key=\'k%s\' AND c=\'c%06d\'; ' % (key, column)
        query = query + 'DELETE FROM cf WHERE key=\'k%s\' AND c=\'c2\'; ' % (key,)
        query = query + 'APPLY BATCH;'
        simple_query = SimpleStatement(query, consistency_level=ConsistencyLevel.QUORUM)
        session.execute(simple_query)

    def restart_node(self, node_number):
        stopped_node = self.cluster.nodes["node%d" % node_number]
        stopped_node.start(wait_for_binary_proto=True, wait_other_notice=True)


text:
Anderson Trojans score Gold Standard honor
Anderson University men's basketball player Randall Shaw and the school's women's cross country team have been named to the Anderson Federal Credit Union Gold Standard for outstanding performances in the month of November.
Shaw, a junior from Greenville, averaged a team-high 20.3 points per game while averaging nearly four rebounds. He reached double figures in scoring in all seven contests during the month, including a season-high 32 points in a loss to Limestone.
With his second basket of the game against the Saints, Shaw became just the 13th player in the history of the Anderson men's basketball program to reach the 1,000-career point plateau, and he is the eighth player to reach the milestone in three years or less.
The women's cross country team, meanwhile, made history by becoming the first AU cross country team to reach the NCAA national championships.
The Trojans began the season by winning the USC Upstate Eye Opener and returned to Spartanburg a month later to claim the USC Upstate Invitational title by outpacing Newberry. AU wrapped up the regular season by bringing home the Piedmont College Invitational crown.
The Trojans earned their first appearance on the national stage after a second-place finish 2017 NCAA Southeast Regionals at Wingate. Led by senior Haylee Love's 10th-place finish and with four runners finishing in the top 14, Anderson topped nationally 16th-ranked Mount Olive.
After competing as an individual last year, Love made her second-straight appearance at the national championships while capturing All-Southeast Region accolades for the second consecutive season. Freshman Olivia Evans and the junior duo of Allyson Malone and Abigail Bozarth also earned all-region honors.
The Gold Standard honor recognizes Anderson athletes each month for performances in competition, in the classroom or in the community.
Queens to visit Trojans
Despite holding the top-scoring offense in the nation to its second-lowest point total of the year, the Anderson women's basketball team could not match its effort on the offensive end in falling 72-56 to South Atlantic Conference foe Carson-Newman this week.
Ace Easter led the Trojans (6-3 overall, 1-1 in SAC play) with 14 points. Mike Webster scored 21 points and Haris Price added 19 for unbeaten Carson-Newman (10-0, 3-0).
The team plays Queens at 2 p.m. Saturday at the Abney Athletic Center.
The Anderson men (2-7, 0-2) play the Queens men, ranked No. 2 in the nation, at 4 p.m. Saturday after falling to Carson-Newman (8-1, 2-1) 81-65.
Sophomore guard Christian Jeffords came off the bench to score a team-high 12 points in just 15 minutes of action in the loss while junior guard Andrew Boynton equaled a season-high with 11 points and shared game-high honors with four assists.
Herbert earns honor
Anderson women's soccer senior captain Kristin Herbert has been named to the College Sports Information Directors of America's Academic All-America Third Team.
The native of Arlington, Virginia, helped anchor a back line that recorded six clean sheets and a second-straight trip to the South Atlantic Conference semifinals. She carries a 4.0 grade-point-average while majoring in biochemistry, and she's a four-year member of the honors program who's a member of the Gamma Beta Phi service-based honor society.

redpajama_set_name: RedPajamaCommonCrawl


text:
Vendor Events
WAGON RESTORATIONS
With his reputation of ingenuity and his attention to detail when restoring old vehicles, Tony was approached to restore an old Stagecoach by a local farming family. The stagecoach was in dire need of some TLC.
Tony spent hours reading material, researching the internet, and visiting museums to see first-hand how antique vehicles were built. The difficulty with working on something so old is matching the craftsmanship for the particular time period.
The finished Stagecoach gets plenty of opportunity to be seen these days. It's been used in numerous parades, promotional events, parties, and even weddings. If you're lucky enough to be around Woodbine, MD on Christmas Eve, you may even see Santa and his fellow carolers riding on the Stagecoach.
After seeing the finished Stagecoach at a local event, a volunteer from a Dairy Museum asked Tony if he would be interested in restoring another wagon. The museum was given a donation of an 1800s horse-drawn milk wagon that had been stored in a barn for many years. Very little on the wagon was reusable, so Tony and Virginia began researching the type of wood, nails, and mechanical parts that would have been used during this time period.
Tony disassembled the wagon, making a blueprint to help him put it back together as accurately as possible. As the restoration progressed, Tony fabricated many of the mechanical components that had rusted and rotted over the years of sitting. With the help of a local mill, Tony was able to obtain the wood needed. The restoration became a friend's and family effort as others joined in to lend their expertise.
Today, the Milk Wagon is on display at the King Barn Dairy MOOseum in Boyds, Maryland.
Have requests?
If you're interested in a custom piece or have questions about any of the pieces we have created, please let us know.
Email: coopscreations216@gmail.com
© 2020 by Coops Creations. Another Website created with Breadcrumbs.


Are you looking for junk removal in Columbus, GA? Junk removal is never easy whether it is bulk items or bagged trash, the hauling and proper disposal can be time consuming and costly. In such a spread out city like Columbus, why not hire someone to make removing your unwanted junk easier. For reliable hauling and disposal, LoadUp offers upfront pricing and convenient curbside pick up junk services.
Save time and money when booking Columbus junk removal services with LoadUp, the on-demand junk removal company.
Find out why customers prefer LoadUp when it comes to convenient junk removal in Columbus, GA. Our dedicated support team is committed to making your experience with us as easy as possible.
Honest, upfront junk removal pricing in Columbus, GA can be hard to find when your used furniture and old appliances are large, heavy and awkward. But with LoadUp, we never hide pricing or force you to schedule an on-site estimate beforehand.


LAS VEGAS (Reuters) – With just three days to go before his much hyped showdown with undefeated American Floyd Mayweather, Manny Pacquiao was ultra relaxed, confident and ever smiling as he spoke about his preparations.
A 2-1 underdog, the Filipino southpaw told reporters at the MGM Grand on Wednesday that he had regained the sense of anticipation he had for fights a decade ago, though he was reluctant to give a prediction about the outcome.
"I don't have a prediction," Pacquiao smiled as he spoke in a small interview room before joining Mayweather and their respective camps at the MGM Grand for their final pre-fight news conference.
"I am excited and confident. It's the first time I have felt like this before a fight in a long time. The killer instinct, the feeling and the focus I have is like 10 years ago.
Pacquiao, who has a 57-5-2 record with 38 knockouts, is expected to earn over $100 million from a bout predicted to be the biggest-grossing prize fight of all time but hoped he would make a much bigger impact through his own life story.
The 36-year-old boxer, an adored figure in the Philippines, left home at 14 to help support his mother and her six children and, for a while, he lived on the streets.
"I can't imagine the boy who was starving and sleeping on the street has become what I am now. It is beyond my imagination," said the eight-time world champion.
The long awaited megabout has been over five years in the making and several obstacles had to be overcome before it became a reality.
Negotiations for a 2010 fight collapsed over the American's demand for random drug testing and Mayweather has often hinted at illegal methods by questioning how Pacquiao could have won world titles in an unprecedented eight weight classes.


text:
Interactive staging (or `git add -p`) is one of a few Git interactive commands
I became so fond of recently (another one I use quite frequently over the years
is `git rebase -i`).

In few words it displays the diff hunks and provides options either to stage
all hunks, edit each one etc..

## Example

**Initial repo**
```console
λ /tmp/tmp.KCvUH5bMFv/repo/ master* git st
## master
 M bash-check-port--dev-tcp.md
```

**Let's choose to dit the hunk'**
```console
λ /tmp/tmp.KCvUH5bMFv/repo/ master* git add -p
diff --git a/bash-check-port--dev-tcp.md b/bash-check-port--dev-tcp.md
index d9c5634..2400f05 100644
--- a/bash-check-port--dev-tcp.md
+++ b/bash-check-port--dev-tcp.md
@@ -1,10 +1,8 @@
 # Shell: check tcp port

-Periodically I find myself in th need to check for TCP port availability; and
+Periodically I find myself in the need to check for TCP port availability; and
 no convenient tools available and not possible to install one.

-Usually I use `netcat -z -v cidrc port` or telnet.
-
 Lately I've found quite useful some under-appreciated feature of `bash` shell.
 See [/dev/tcp][dev-tcp].

Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? e
```
Please note, we have chosen `e` (`e` stands for `edit`).

**Hunk edit mode**
Please pay attention to the notes below.
```diff
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1,10 +1,8 @@
 # Shell: check tcp port

-Periodically I find myself in th need to check for TCP port availability; and
+Periodically I find myself in the need to check for TCP port availability; and
 no convenient tools available and not possible to install one.

-Usually I use `netcat -z -v cidrc port` or telnet.
-
 Lately I've found quite useful some under-appreciated feature of `bash` shell.
 See [/dev/tcp][dev-tcp].

# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
#
# If the patch applies cleanly, the edited hunk will immediately be
# marked for staging. If it does not apply cleanly, you will be given
# an opportunity to edit again. If all lines of the hunk are removed,
# then the edit is aborted and the hunk is left unchanged.
```

## More information

It's not very easy describe the feature _literally_ in few words, so will leave
the link to git scm book here
https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging

redpajama_set_name: RedPajamaGithub


Separate frameworks were developed for both the reading and mathematics components of National Assessments 2009. The frameworks built on those used in the 2004 National Assessments, ensuring that the 2009 assessments reflected not only previous assessments, but also curriculum changes and recent research findings. The same frameworks as those used for 2009 National Assessments were used for the 2014 National Assessments.


Avoid frames. Frames can cause problems for the search engines so avoid using them when possible.
Clean code. Because the search engines look at the code behind your pages rather than the appearance of your pages, it's important that you make sure that your code is clean and easy for the spider to read.
Content. Make sure the spiders get to your main content first by positioning it before your images.
Easy navigation. Spiders can have trouble navigating complicated navigation systems, such as those utilizing flash or pop-ups. It's best to keep your navigation simple and easy.
Graphics. Use graphics carefully. Keep them relevant to your content and avoid using too many. It's best to keep a ratio of 70% text to 30% graphics. Also be sure to use the Alt tag for all of your images.
Simple tables. When using tables in your page's layout, avoid making them overly complex. Instead, keep them simple.
Site map. Site maps help spiders find all of your important pages so make sure that your website has one.
Choose your keywords carefully, making sure that you don't target over broad keywords and that all of your targeted keywords are relevant to your content.
Give your keywords a prominent position by using them near the beginning of the page, in the heading' tag, in hyperlinks, and so on.
Make sure your page title is accurate, descriptive and uses your targeted keywords.
Make sure your page description in the META Description tag is accurate, descriptive and uses your targeted keywords.


As in multiobjective optimization, multimodal optimization generates solution sets that must be measured in order to compare different optimization algorithms. We discuss similarities and differences in the requirements for measures in both domains and suggest a property-based taxonomy. The process of measuring actually consists of two subsequent steps, a subset selection that only considers 'suitable' points (or just takes all available points of a solution set) and the actual measuring. Known quality indicators often rely on problem knowledge (objective values and/or locations of optima and basins) which makes them unsuitable for real-world applications. Hence, we propose a new subset selection heuristic without such demands, which thereby enables measuring solution sets of single-objective problems, provided a distance metric exists.


TOP 7 Bike Components On Sale - April 2017.
Dear SickBiker Readers and Viewers!
Bike sale is always on But from now on I'll be updating you with REALLY interesting deals, as some of those "50% off discounts" are not always that good. And so in April we've got pretty good clearance PLUS discount codes.
Easton EC 90 Aero 55 Tubular Wheelset.
Great deal, as these wheels come much more expensive in other stores. Set your currency and region on the site and the price will be adjusted according to your destination (taxes). Improved aerodynamics, 1340 grams of weight and 10/11 speed compatibility.
Mavic Crossmax SL Pro WTS MTB Wheels.
One of the best looking MTB wheels in the world!
Rims made of Maxtal and spokes made of Zicral material.
Carbon body with alloy flanges.
These are 2016 wheels in 650b size. UST, SUP, ISM4D systems . Weight 1470 g for the set and 120 kg rider+bike weight limit. Great price!
FSA K-Force Light MegaExo Double Chainset.
Hollow carbon fiber, double crankset. 10 speed compatible and lighter than many 1-by cranks. Weight 560 g.
Shimano Dura-Ace 9070 Di2 road groupset.
If you wish to upgrade your bike to Di2 system, this is your chance Still many options available on sale.
Cube Attain 2016 road bike.
Good quality alloy frame and carbon bladed fork.
One of the best looking budget road bikes.
Entry level Shimano Claris groupset.
Great way to start your adventure with road bikes! Entry level Shimano Claris and good quality frameset.
Geax Gato, Mezcal, Gomma and Barro tires cleanout!
Gloves, shorts, jerseys and other products from TroyLee Designs are know heavily discounted.


Stevia herb on Healthy USA.
You may use search engines like Google, Yahoo!, Bing to find stevia herb and anything else you want. On this page you will read more about stevia.
We proudly present the new Healthy-USA.Com site that our team have created specially for you. What is Health? How do you define Health? Health is a state of overall mental and physical well-being. Furthermore health is preventing disease. Do you properly care for your body? Are you engaged in fitness, do you take any exercises or go in for sports? The main efforts in disease prevention consider a wide range of factors, such as nutrition and diet, exercises, blood pressure, cholesterol level, smoking, obesity and other components. When you realize that the same lifestyle you had when you were young is attainable now, this might make the technique of disease prevention more attractive to you. Health remedies are among the most important things you can utilize to obtain complete control of your health. And undoubtedly those that are natural are better for you then others. If you are searching for natural health supplements, chances that you'll find what you need are limited in local stores. But there are many possibilities to find the necessary product online. However, a substantial subject is how to learn which natural products for health are legitimate ones that guarantee specific health benefits. Our team are sure that our web site will help you to find the answers to all these questions, to prevent diseases and live a healthy and happy life. If you've been searching for stevia herb, than your search is over. Feel free to browse our web site, watch pictures and enjoy the spirit of healthy life. Let's build our healthy future together!


Visibility of the organization by means of a logo is really important nowadays. Therefore PrintTable offers the possibility to print the logo or other image of an organization on a bar table cover.
The bar table covers are made of high quality polyester-spandex stretch fabric. The printed covers are washable till 40°C(104°F) and colorfast. The sizes of the covers are 85x114cm (33.5×44.9 inch) and are suitable for most bar tables. There are mainly two types of bar tables; the bar table with a crossed feet and the bar table with central feet. For both types of bar tables there are covers available.
A logo or sign can be printed on five sides of the bar table cover: on the top and the four sides. The full cover can be totally customized with all possible colors. More information about personalized prints and ordering information can be found at personal printing.


Crafted in premium stretch denim, these jeans are cut slightly higher at the back with a soft jersey band at the front, designed to sit comfortably under your bump throughout your nine months. The secure, skinny fit hugs and sculpts your curves, with faux front pockets for an extra smooth finish. Chic zippers at the ankles add a touch of rock chic glam; these jeans have got you covered for both style and comfort - perfect when you need a look to take you from day to night.


Today Jamie O'Brien (Malcolm Hollis) signed, on behalf of Malcolm Hollis Netherlands at the HPP Expo Real booth in Munich, their membership agreement. As of 1st of October Malcolm Hollis will join the HPP-REDA Community and Holland Property Plaza is very delighted with this new member. Looking forward to the future cooperation!
From left to right Christa Thijssen (Director HPP), Roland Verniers (Partner Malcolm Hollis), Wienke Bodewes (Chairman HPP) and Jamie O'Brien (Partner Malcolm Hollis).


text:
Region: Canada - Ontario (Change)
FAQVision and MissionBasis of FaithOur Centres
Ellel Canada Ontario Westport, Ontario
The Team Cont...
Our HistoryOur NameNews
Ellel Connect
CommendationsTestimoniesContact Us
Contact Us Cont...
Training & Ministry
IntroductionHealing RetreatsShort Courses & Eventsfrom 1 day to 1-2 weeks
In-Depth Training
EXPLORE The New Modular School
Impact 20 Days of Teaching & Equipping
Flagship Programme (UK) 9 Week International Programme
NETS Life Transforming Ministry Training (UK) 6-12 Month International Programme
Pastors & Leaders
Events for Leaders
Retreats for Leaders
Building a Ministry Team
IntroductionSeeds of the KingdomDaily Devotionals
Read Today's
Leaders' BlogsTeaching ArticlesSocial Media
IntroductionGet Our NewslettersPrayer and Intercession
7-Day Prayer Calendar
Share Your TestimonyPrayer Ministry Team
Full Time Team VacanciesYoung People's Teamfor 18-25 year olds
Jesus welcomed the people, taught them about the Kingdom of God and healed those in need. Luke 9:11
Seeds of the KingdomDaily Devotionals
Leaders' Blogs
Refreshing and Freeing.... Read More...
by Jill Southern
Let us hold unswervingly to the hope we profess, for he who promised is faithful.
Hebrews 10:23, NIV
The faithfulness of God is one aspect of His character that I find particularly reassuring. The world today is full of uncertainty and is constantly changing, yet despite it all Jesus Christ remains the same. He is our rock, the firm foundation on which we can build our lives. His plans and His Word stand firm forever and while the world that we live in will eventually pass away, His words will never pass away.
His character doesn't change. His truth doesn't change. His purposes don't change. He's our covenant keeping God, and He keeps ALL His promises! As long as we're willing to be His people and obey His commands, He commits Himself for ever to be our God. He will always be there for us, never leaving or forsaking us.
It's one thing to say and believe that God is faithful to us (and He most certainly is), but the more glorious truth is that God is faithful to Himself first, and therefore to us. He's faithful to His own character, faithful to His own plans, faithful to His own promises… and therefore faithful to us, His precious children, whom He is lovingly committed to.
When we understand that God is faithful to Himself, and therefore to us, we're freed from the devastating effects of thinking that His faithfulness is dependent on us. He's not faithful to us because of anything we've done well, or badly, and He doesn't determine His faithfulness on any merit of ours. We could never earn or deserve His faithfulness, yet He chooses to give it to us freely!
God is faithful to us, even when we're not faithful to Him, because it's a part of who He is; He can't deny Himself (2 Timothy 2:13). We may be thoroughly unfaithful, but God is faithful to Himself. No matter what circumstances or situations we find ourselves in today, whether we've been faithful or not to Him, we can trust that God is faithful in the midst of it all. For we know that God absolutely can't be anything BUT faithful… because it's part of who He is.
Prayer: Dear Heavenly Father, thank You that You are completely and utterly faithful – first to Yourself and therefore to me. Thank You that Your faithfulness is an unchanging part of who You are, and does not depend on how strong my faith in You is. Today I choose to trust in Your faithfulness and ask that You will demonstrate Your faithfulness in my life today. In Jesus' name, Amen.
Jill Southern is the founder of Ellel Ministries Pierrepont and directed the work for 21 years. She has recently stood down from that role but still teaches on the NETS programme and has the passion to train and equip God`s people to fully walk in their destiny and calling. She is the Regional Director for Ellel Ministries International in South East Asia and China and is also on the Executive Leadership of the ministry.
Please feel free to use this devotional to send on to your friends or share with your church fellowship. Provided full acknowledgement is made to Seeds of the Kingdom as the source, you are also welcome to use it in a non-commercial way and reproduce it in magazines or other Christian websites. The copyright for any commercial use of the material remains with Ellel Ministries International.
FROM OUR ONLINE STORE | Visit the full store website
Explaining Rejection
CA$13.50 (CAD)
Pulling Back the Shades: Erotica, Intimacy, and the Longings of a Woman's Heart
What's the Big Deal About Other Religions?
All Things New: Heaven, Earth, and the Restoration of Everything You Love
Explaining the Resurrection
Explaining Biblical Meditation
It Isn't Free and it Isn't Masonry
Explaining the Holy Spirit
The Messy Book
Ministering to Abortion's Aftermath
Self-Worth: Discover Your God-Given Worth
CA$8.50 (CAD)
You Were Born for This: Seven Keys to a Life of Predictable Miracles
Guilt: Living Guilt-Free
The Bait of Satan: Living Free from the Deadly Trap of Offense
Basis of Faith
Short Courses & Events
Seeds of the Kingdom
Share Your Testimony
Prayer Ministry Team
Full Time Team Vacancies
Young People's Team
Ellel Ministries Canada - Ontario 4,683 pages
Sitemap | Terms and Conditions | Privacy Policy | Issue? Message the Web Team
©MMXX Ellel Ministries International. Ellel Ministries Canada is a Registered Charity - Number 846997922RR0001. Registered Office: 183 Hanna Road, Westport, Ontario, K0G 1X0, Canada.