text:
package org.apache.nifi.elasticsearch.integration;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.nifi.components.ConfigVerificationResult;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.controller.VerifiableControllerService;
import org.apache.nifi.elasticsearch.AuthorizationScheme;
import org.apache.nifi.elasticsearch.DeleteOperationResponse;
import org.apache.nifi.elasticsearch.ElasticSearchClientService;
import org.apache.nifi.elasticsearch.ElasticSearchClientServiceImpl;
import org.apache.nifi.elasticsearch.ElasticsearchException;
import org.apache.nifi.elasticsearch.IndexOperationRequest;
import org.apache.nifi.elasticsearch.IndexOperationResponse;
import org.apache.nifi.elasticsearch.MapBuilder;
import org.apache.nifi.elasticsearch.SearchResponse;
import org.apache.nifi.elasticsearch.TestControllerServiceProcessor;
import org.apache.nifi.elasticsearch.UpdateOperationResponse;
import org.apache.nifi.ssl.SSLContextService;
import org.apache.nifi.ssl.StandardRestrictedSSLContextService;
import org.apache.nifi.ssl.StandardSSLContextService;
import org.apache.nifi.util.MockConfigurationContext;
import org.apache.nifi.util.MockControllerServiceLookup;
import org.apache.nifi.util.MockVariableRegistry;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

class ElasticSearchClientService_IT extends AbstractElasticsearch_IT {
    @AfterEach
    void after() throws Exception {
        service.onDisabled();
    }

    private Map<PropertyDescriptor, String> getClientServiceProperties() {
        return ((MockControllerServiceLookup) runner.getProcessContext().getControllerServiceLookup())
                .getControllerServices().get(CLIENT_SERVICE_NAME).getProperties();
    }

    @Test
    void testVerifySuccess() {
        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(3, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SUCCESSFUL).count(), results.toString());
    }

    @Test
    void testVerifySuccessWithApiKeyAuth() throws IOException {
        final Pair<String, String> apiKey = createApiKeyForIndex("*");

        runner.disableControllerService(service);
        runner.setProperty(service, ElasticSearchClientService.AUTHORIZATION_SCHEME, AuthorizationScheme.API_KEY.getValue());
        runner.removeProperty(service, ElasticSearchClientService.USERNAME);
        runner.removeProperty(service, ElasticSearchClientService.PASSWORD);
        runner.setProperty(service, ElasticSearchClientService.API_KEY_ID, apiKey.getKey());
        runner.setProperty(service, ElasticSearchClientService.API_KEY, apiKey.getValue());
        runner.enableControllerService(service);

        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(3, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SUCCESSFUL).count(), results.toString());
    }

    @Test
    void testVerifyFailedURL() {
        runner.disableControllerService(service);
        runner.setProperty(service, ElasticSearchClientService.HTTP_HOSTS, "invalid");

        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(2, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SKIPPED).count(), results.toString());
        assertEquals(1, results.stream().filter(
                result -> Objects.equals(result.getVerificationStepName(), ElasticSearchClientServiceImpl.VERIFICATION_STEP_CLIENT_SETUP)
                        && Objects.equals(result.getExplanation(), "Incorrect/invalid " + ElasticSearchClientService.HTTP_HOSTS.getDisplayName())
                        && result.getOutcome() == ConfigVerificationResult.Outcome.FAILED).count(),
                results.toString()
        );
    }

    @Test
    void testVerifyFailedSSL() throws Exception {
        runner.disableControllerService(service);
        final SSLContextService sslContextService = new StandardRestrictedSSLContextService();
        runner.addControllerService("SSL Context", sslContextService);
        runner.setProperty(service, ElasticSearchClientService.PROP_SSL_CONTEXT_SERVICE, "SSL Context");
        runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "not/a/file");
        runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "ignored");
        try {
            runner.enableControllerService(sslContextService);
        } catch (final Exception ignored) {
            // expected, ignore
        }

        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(2, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SKIPPED).count(), results.toString());
        assertEquals(1, results.stream().filter(
                result -> Objects.equals(result.getVerificationStepName(), ElasticSearchClientServiceImpl.VERIFICATION_STEP_CLIENT_SETUP)
                        && Objects.equals(result.getExplanation(), "Incorrect/invalid " + ElasticSearchClientService.PROP_SSL_CONTEXT_SERVICE.getDisplayName())
                        && result.getOutcome() == ConfigVerificationResult.Outcome.FAILED).count(),
                results.toString()
        );
    }

    @Test
    void testVerifyFailedAuth() {
        runner.disableControllerService(service);
        runner.setProperty(service, ElasticSearchClientService.USERNAME, "invalid");
        runner.setProperty(service, ElasticSearchClientService.PASSWORD, "not-real");

        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(1, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SUCCESSFUL).count(), results.toString());
        assertEquals(1, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SKIPPED).count(), results.toString());
        assertEquals(1, results.stream().filter(
                result -> Objects.equals(result.getVerificationStepName(), ElasticSearchClientServiceImpl.VERIFICATION_STEP_CONNECTION)
                        && Objects.equals(result.getExplanation(), "Unable to retrieve system summary from Elasticsearch root endpoint")
                        && result.getOutcome() == ConfigVerificationResult.Outcome.FAILED).count(),
                results.toString()
        );
    }

    @Test
    void testVerifyFailedApiKeyAuth() {
        runner.disableControllerService(service);
        runner.setProperty(service, ElasticSearchClientService.AUTHORIZATION_SCHEME, AuthorizationScheme.API_KEY.getValue());
        runner.removeProperty(service, ElasticSearchClientService.USERNAME);
        runner.removeProperty(service, ElasticSearchClientService.PASSWORD);
        runner.setProperty(service, ElasticSearchClientService.API_KEY_ID, "invalid");
        runner.setProperty(service, ElasticSearchClientService.API_KEY, "not-real");
        runner.enableControllerService(service);

        final List<ConfigVerificationResult> results = ((VerifiableControllerService) service).verify(
                new MockConfigurationContext(service, getClientServiceProperties(), runner.getProcessContext().getControllerServiceLookup(), new MockVariableRegistry()),
                runner.getLogger(),
                Collections.emptyMap()
        );
        assertEquals(3, results.size());
        assertEquals(1, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SUCCESSFUL).count(), results.toString());
        assertEquals(1, results.stream().filter(result -> result.getOutcome() == ConfigVerificationResult.Outcome.SKIPPED).count(), results.toString());
        assertEquals(1, results.stream().filter(
                result -> Objects.equals(result.getVerificationStepName(), ElasticSearchClientServiceImpl.VERIFICATION_STEP_CONNECTION)
                        && Objects.equals(result.getExplanation(), "Unable to retrieve system summary from Elasticsearch root endpoint")
                        && result.getOutcome() == ConfigVerificationResult.Outcome.FAILED).count(),
                results.toString()
        );
    }

    @Test
    void testBasicSearch() throws Exception {
        final Map<String, Object> temp = new MapBuilder()
            .of("size", 10, "query", new MapBuilder().of("match_all", new HashMap<>()).build(),
                    "aggs", new MapBuilder()
                            .of("term_counts", new MapBuilder()
                                    .of("terms", new MapBuilder()
                                            .of("field", "msg", "size", 5)
                                            .build())
                                    .build())
                            .build())
                .build();
        final String query = prettyJson(temp);

        final SearchResponse response = service.search(query, INDEX, type, null);
        assertNotNull(response, "Response was null");

        assertEquals(15, response.getNumberOfHits(), "Wrong count");
        assertFalse(response.isTimedOut(), "Timed out");
        assertNotNull(response.getHits(), "Hits was null");
        assertEquals(10, response.getHits().size(), "Wrong number of hits");
        assertNotNull(response.getAggregations(), "Aggregations are missing");
        assertEquals(1, response.getAggregations().size(), "Aggregation count is wrong");
        assertNull(response.getScrollId(), "Unexpected ScrollId");
        assertNull(response.getSearchAfter(), "Unexpected Search_After");
        assertNull(response.getPitId(), "Unexpected pitId");

        @SuppressWarnings("unchecked") final Map<String, Object> termCounts = (Map<String, Object>) response.getAggregations().get("term_counts");
        assertNotNull(termCounts, "Term counts was missing");
        @SuppressWarnings("unchecked") final List<Map<String, Object>> buckets = (List<Map<String, Object>>) termCounts.get("buckets");
        assertNotNull(buckets, "Buckets branch was empty");
        final Map<String, Object> expected = new MapBuilder()
                .of("one", 1, "two", 2, "three", 3,
                        "four", 4, "five", 5)
                .build();

        buckets.forEach( aggRes -> {
            final String key = (String) aggRes.get("key");
            final Integer docCount = (Integer) aggRes.get("doc_count");
            assertEquals(expected.get(key), docCount, "${key} did not match.");
        });
    }

    @Test
    void testBasicSearchRequestParameters() throws Exception {
        final Map<String, Object> temp = new MapBuilder()
                .of("size", 10, "query", new MapBuilder().of("match_all", new HashMap<>()).build(),
                        "aggs", new MapBuilder()
                        .of("term_counts", new MapBuilder()
                                .of("terms", new MapBuilder()
                                        .of("field", "msg", "size", 5)
                                        .build())
                                .build())
                        .build())
                .build();
        final String query = prettyJson(temp);

        final SearchResponse response = service.search(query, "messages", type, createParameters("preference", "_local"));
        assertNotNull(response, "Response was null");

        assertEquals(15, response.getNumberOfHits(), "Wrong count");
        assertFalse(response.isTimedOut(), "Timed out");
        assertNotNull(response.getHits(), "Hits was null");
        assertEquals(10, response.getHits().size(), "Wrong number of hits");
        assertNotNull(response.getAggregations(), "Aggregations are missing");
        assertEquals(1, response.getAggregations().size(), "Aggregation count is wrong");

        @SuppressWarnings("unchecked") final Map<String, Object> termCounts = (Map<String, Object>) response.getAggregations().get("term_counts");
        assertNotNull(termCounts, "Term counts was missing");
        @SuppressWarnings("unchecked") final List<Map<String, Object>> buckets = (List<Map<String, Object>>) termCounts.get("buckets");
        assertNotNull(buckets, "Buckets branch was empty");
        final Map<String, Object> expected = new MapBuilder()
                .of("one", 1, "two", 2, "three", 3,
                        "four", 4, "five", 5)
                .build();

        buckets.forEach( (aggRes) -> {
            final String key = (String) aggRes.get("key");
            final Integer docCount = (Integer) aggRes.get("doc_count");
            assertEquals(expected.get(key), docCount, String.format("%s did not match.", key));
        });
    }

    @Test
    void testV6SearchWarnings() throws JsonProcessingException {
        assumeTrue(getElasticMajorVersion() == 6, "Requires Elasticsearch 6");
        final String query = prettyJson(new MapBuilder()
                .of("size", 1,
                        "query", new MapBuilder().of("query_string",
                                new MapBuilder().of("query", 1, "all_fields", true).build()
                        ).build())
                .build());
        final String type = "a-type";
        final SearchResponse response = service.search(query, INDEX, type, null);
        assertFalse(response.getWarnings().isEmpty(), "Missing warnings");
    }

    @Test
    void testV7SearchWarnings() throws JsonProcessingException {
        assumeTrue(getElasticMajorVersion() == 7, "Requires Elasticsearch 7");
        final String query = prettyJson(new MapBuilder()
                .of("size", 1, "query", new MapBuilder().of("match_all", new HashMap<>()).build())
                .build());
        final String type = "a-type";
        final SearchResponse response = service.search(query, INDEX, type, null);
        assertFalse(response.getWarnings().isEmpty(), "Missing warnings");
    }

    @Disabled("Skip until Elasticsearch 8.x has a _search API deprecation")
    @Test
    void testV8SearchWarnings() {
        assumeTrue(getElasticMajorVersion() == 8, "Requires Elasticsearch 8");
        fail("Elasticsearch 8 search API deprecations not currently available for test");
    }

    @Test
    void testScroll() throws JsonProcessingException {
        final String query = prettyJson(new MapBuilder()
                .of("size", 2, "query", new MapBuilder().of("match_all", new HashMap<>()).build(),
                        "aggs", new MapBuilder()
                        .of("term_counts", new MapBuilder()
                                .of("terms", new MapBuilder()
                                        .of("field", "msg", "size", 5)
                                        .build())
                                .build())
                        .build())
                .build());

        // initiate the scroll
        final SearchResponse response = service.search(query, INDEX, type, Collections.singletonMap("scroll", "10s"));
        assertNotNull(response, "Response was null");

        assertEquals(15, response.getNumberOfHits(), "Wrong count");
        assertFalse(response.isTimedOut(), "Timed out");
        assertNotNull(response.getHits(), "Hits was null");
        assertEquals(2, response.getHits().size(), "Wrong number of hits");
        assertNotNull(response.getAggregations(), "Aggregations are missing");
        assertEquals(1, response.getAggregations().size(), "Aggregation count is wrong");
        assertNotNull(response.getScrollId(), "ScrollId missing");
        assertNull(response.getSearchAfter(), "Unexpected Search_After");
        assertNull(response.getPitId(), "Unexpected pitId");

        @SuppressWarnings("unchecked") final Map<String, Object> termCounts = (Map<String, Object>) response.getAggregations().get("term_counts");
        assertNotNull(termCounts, "Term counts was missing");
        @SuppressWarnings("unchecked") final List<Map<String, Object>> buckets = (List<Map<String, Object>>) termCounts.get("buckets");
        assertEquals(5, buckets.size(), "Buckets count is wrong");

        // scroll the next page
        final Map<String, String> parameters = createParameters("scroll_id", response.getScrollId(), "scroll", "10s");
        final SearchResponse scrollResponse = service.scroll(prettyJson(parameters));
        assertNotNull(scrollResponse, "Scroll Response was null");

        assertEquals(15, scrollResponse.getNumberOfHits(), "Wrong count");
        assertFalse(scrollResponse.isTimedOut(), "Timed out");
        assertNotNull(scrollResponse.getHits(), "Hits was null");
        assertEquals(2, scrollResponse.getHits().size(), "Wrong number of hits");
        assertNotNull(scrollResponse.getAggregations(), "Aggregations missing");
        assertEquals(0, scrollResponse.getAggregations().size(), "Aggregation count is wrong");
        assertNotNull(scrollResponse.getScrollId(), "ScrollId missing");
        assertNull(scrollResponse.getSearchAfter(), "Unexpected Search_After");
        assertNull(scrollResponse.getPitId(), "Unexpected pitId");

        assertNotEquals(scrollResponse.getHits(), response.getHits(), "Same results");

        // delete the scroll
        DeleteOperationResponse deleteResponse = service.deleteScroll(scrollResponse.getScrollId());
        assertNotNull(deleteResponse, "Delete Response was null");
        assertTrue(deleteResponse.getTook() > 0);

        // delete scroll again (should now be unknown but the 404 caught and ignored)
        deleteResponse = service.deleteScroll(scrollResponse.getScrollId());
        assertNotNull(deleteResponse, "Delete Response was null");
        assertEquals(0L, deleteResponse.getTook());
    }

    @Test
    void testSearchAfter() throws JsonProcessingException {
        final Map<String, Object> queryMap = new MapBuilder()
                .of("size", 2, "query", new MapBuilder()
                        .of("match_all", new HashMap<>()).build(), "aggs", new MapBuilder()
                        .of("term_counts", new MapBuilder()
                            .of("terms", new MapBuilder()
                                    .of("field", "msg", "size", 5)
                                    .build())
                            .build()).build())
                .of("sort", Collections.singletonList(
                        new MapBuilder().of("msg", "desc").build()
                ))
                .build();
        final String query = prettyJson(queryMap);

        // search first page
        final SearchResponse response = service.search(query, INDEX, type, null);
        assertNotNull(response, "Response was null");

        assertEquals(15, response.getNumberOfHits(), "Wrong count");
        assertFalse(response.isTimedOut(), "Timed out");
        assertNotNull(response.getHits(), "Hits was null");
        assertEquals(2, response.getHits().size(), "Wrong number of hits");
        assertNotNull(response.getAggregations(), "Aggregations missing");
        assertEquals(1, response.getAggregations().size(), "Aggregation count is wrong");
        assertNull(response.getScrollId(), "Unexpected ScrollId");
        assertNotNull(response.getSearchAfter(), "Search_After missing");
        assertNull(response.getPitId(), "Unexpected pitId");

        @SuppressWarnings("unchecked") final Map<String, Object> termCounts = (Map<String, Object>) response.getAggregations().get("term_counts");
        assertNotNull(termCounts, "Term counts was missing");
        @SuppressWarnings("unchecked") final List<Map<String, Object>> buckets = (List<Map<String, Object>>) termCounts.get("buckets");
        assertEquals(5, buckets.size(), "Buckets count is wrong");

        // search the next page
        final Map<String, Object> page2QueryMap = new HashMap<>(queryMap);
        page2QueryMap.put("search_after", MAPPER.readValue(response.getSearchAfter(), List.class));
        page2QueryMap.remove("aggs");
        final String secondPage = prettyJson(page2QueryMap);
        final SearchResponse secondResponse = service.search(secondPage, INDEX, type, null);
        assertNotNull(secondResponse, "Second Response was null");

        assertEquals(15, secondResponse.getNumberOfHits(), "Wrong count");
        assertFalse(secondResponse.isTimedOut(), "Timed out");
        assertNotNull(secondResponse.getHits(), "Hits was null");
        assertEquals(2, secondResponse.getHits().size(), "Wrong number of hits");
        assertNotNull(secondResponse.getAggregations(), "Aggregations missing");
        assertEquals(0, secondResponse.getAggregations().size(), "Aggregation count is wrong");
        assertNull(secondResponse.getScrollId(), "Unexpected ScrollId");
        assertNotNull(secondResponse.getSearchAfter(), "Unexpected Search_After");
        assertNull(secondResponse.getPitId(), "Unexpected pitId");

        assertNotEquals(secondResponse.getHits(), response.getHits(), "Same results");
    }

    @Test
    void testPointInTime() throws JsonProcessingException {
        // Point in Time only available in 7.10+ with XPack enabled
        final double majorVersion = getElasticMajorVersion();
        final double minorVersion = getElasticMinorVersion();
        assumeTrue(majorVersion >= 8 || (majorVersion == 7 && minorVersion >= 10), "Requires version 7.10+");

        // initialise
        final String pitId = service.initialisePointInTime(INDEX, "10s");

        final Map<String, Object> queryMap = new MapBuilder()
                .of("size", 2, "query", new MapBuilder().of("match_all", new HashMap<>()).build())
                .of("aggs", new MapBuilder().of("term_counts", new MapBuilder()
                        .of("terms", new MapBuilder()
                                .of("field", "msg", "size", 5)
                                .build())
                        .build()).build())
                .of("sort", Collections.singletonList(
                        new MapBuilder().of("msg", "desc").build()
                ))
                .of("pit", new MapBuilder()
                        .of("id", pitId, "keep_alive", "10s")
                        .build())
                .build();
        final String query = prettyJson(queryMap);

        // search first page
        final SearchResponse response = service.search(query, null, type, null);
        assertNotNull(response, "Response was null");

        assertEquals(15, response.getNumberOfHits(), "Wrong count");
        assertFalse(response.isTimedOut(), "Timed out");
        assertNotNull(response.getHits(), "Hits was null");
        assertEquals(2, response.getHits().size(), "Wrong number of hits");
        assertNotNull(response.getAggregations(), "Aggregations missing");
        assertEquals(1, response.getAggregations().size(), "Aggregation count is wrong");
        assertNull(response.getScrollId(), "Unexpected ScrollId");
        assertNotNull(response.getSearchAfter(), "Unexpected Search_After");
        assertNotNull(response.getPitId(), "pitId missing");

        @SuppressWarnings("unchecked") final Map<String, Object> termCounts = (Map<String, Object>) response.getAggregations().get("term_counts");
        assertNotNull(termCounts, "Term counts was missing");
        @SuppressWarnings("unchecked") final List<Map<String, Object>> buckets = (List<Map<String, Object>>) termCounts.get("buckets");
        assertEquals(5, buckets.size(), "Buckets count is wrong");

        // search the next page
        final Map<String, Object> page2QueryMap = new HashMap<>(queryMap);
        page2QueryMap.put("search_after", MAPPER.readValue(response.getSearchAfter(), List.class));
        page2QueryMap.remove("aggs");
        final String secondPage = prettyJson(page2QueryMap);
        final SearchResponse secondResponse = service.search(secondPage, null, type, null);
        assertNotNull(secondResponse, "Second Response was null");

        assertEquals(15, secondResponse.getNumberOfHits(), "Wrong count");
        assertFalse(secondResponse.isTimedOut(), "Timed out");
        assertNotNull(secondResponse.getHits(), "Hits was null");
        assertEquals(2, secondResponse.getHits().size(), "Wrong number of hits");
        assertNotNull(secondResponse.getAggregations(), "Aggregations missing");
        assertEquals(0, secondResponse.getAggregations().size(), "Aggregation count is wrong");
        assertNull(secondResponse.getScrollId(), "Unexpected ScrollId");
        assertNotNull(secondResponse.getSearchAfter(), "Unexpected Search_After");
        assertNotNull(secondResponse.getPitId(), "pitId missing");

        assertNotEquals(secondResponse.getHits(), response.getHits(), "Same results");

        // delete pitId
        DeleteOperationResponse deleteResponse = service.deletePointInTime(pitId);
        assertNotNull(deleteResponse, "Delete Response was null");
        assertTrue(deleteResponse.getTook() > 0);

        // delete pitId again (should now be unknown but the 404 caught and ignored)
        deleteResponse = service.deletePointInTime(pitId);
        assertNotNull(deleteResponse, "Delete Response was null");
        assertEquals(0L, deleteResponse.getTook());
    }

    @Test
    void testDeleteByQuery() throws Exception {
        final String query = prettyJson(new MapBuilder()
                .of("query", new MapBuilder()
                        .of("match", new MapBuilder().of("msg", "five").build())
                                .build()).build());
        final DeleteOperationResponse response = service.deleteByQuery(query, INDEX, type, null);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
    }

    @Test
    void testDeleteByQueryRequestParameters() throws Exception {
        final String query = prettyJson(new MapBuilder()
                .of("query", new MapBuilder()
                        .of("match", new MapBuilder().of("msg", "six").build())
                        .build()).build());
        final Map<String, String> parameters = new HashMap<>();
        parameters.put("refresh", "true");
        final DeleteOperationResponse response = service.deleteByQuery(query, INDEX, type, parameters);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
    }

    @Test
    void testUpdateByQuery() throws Exception {
        final String query = prettyJson(new MapBuilder()
                .of("query", new MapBuilder()
                        .of("match", new MapBuilder().of("msg", "four").build())
                        .build()).build());
        final UpdateOperationResponse response = service.updateByQuery(query, INDEX, type, null);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
    }

    @Test
    void testUpdateByQueryRequestParameters() throws Exception {
        final String query = prettyJson(new MapBuilder()
                .of("query", new MapBuilder()
                        .of("match", new MapBuilder().of("msg", "four").build())
                        .build()).build());
        final Map<String, String> parameters = new HashMap<>();
        parameters.put("refresh", "true");
        parameters.put("slices", "1");
        final UpdateOperationResponse response = service.updateByQuery(query, INDEX, type, parameters);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
    }

    @Test
    void testDeleteById() throws Exception {
        final String ID = "1";
        final Map<String, Object> originalDoc = service.get(INDEX, type, ID, null);
        try {
            final DeleteOperationResponse response = service.deleteById(INDEX, type, ID, null);
            assertNotNull(response);
            assertTrue(response.getTook() > 0);
            final ElasticsearchException ee = assertThrows(ElasticsearchException.class, () ->
                service.get(INDEX, type, ID, null));
            assertTrue(ee.isNotFound());
            final Map<String, Object> doc = service.get(INDEX, type, "2", null);
            assertNotNull(doc);
        } finally {
            // replace the deleted doc
            service.add(new IndexOperationRequest(INDEX, type, "1", originalDoc, IndexOperationRequest.Operation.Index), null);
            waitForIndexRefresh(); // (affects later tests using _search or _bulk)
        }
    }

    @Test
    void testGet() {
        for (int index = 1; index <= 15; index++) {
            final String id = String.valueOf(index);
            final Map<String, Object> doc = service.get(INDEX, type, id, null);
            assertNotNull(doc, "Doc was null");
            assertNotNull(doc.get("msg"), "${doc.toString()}\t${doc.keySet().toString()}");
        }
    }

    @Test
    void testGetNotFound() {
        final ElasticsearchException ee = assertThrows(ElasticsearchException.class, () -> service.get(INDEX, type, "not_found", null));
        assertTrue(ee.isNotFound());
    }

    @Test
    void testExists() {
        assertTrue(service.exists(INDEX, null), "index does not exist");
        assertFalse(service.exists("index-does-not-exist", null), "index exists");
    }

    @Test
    void testNullSuppression() throws InterruptedException {
        final Map<String, Object> doc = new HashMap<>();
        doc.put("msg", "test");
        doc.put("is_null", null);
        doc.put("is_empty", "");
        doc.put("is_blank", " ");
        doc.put("empty_nested", Collections.emptyMap());
        doc.put("empty_array", Collections.emptyList());

        // index with nulls
        suppressNulls(false);
        IndexOperationResponse response = service.bulk(Collections.singletonList(new IndexOperationRequest("nulls", type, "1", doc, IndexOperationRequest.Operation.Index)), null);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
        waitForIndexRefresh();

        Map<String, Object> result = service.get("nulls", type, "1", null);
        assertEquals(doc, result);

        // suppress nulls
        suppressNulls(true);
        response = service.bulk(Collections.singletonList(new IndexOperationRequest("nulls", type, "2", doc, IndexOperationRequest.Operation.Index)), null);
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
        waitForIndexRefresh();

        result = service.get("nulls", type, "2", null);
        assertTrue(result.keySet().containsAll(Arrays.asList("msg", "is_blank")), "Non-nulls (present): " + result);
        assertFalse(result.containsKey("is_null"), "is_null (should be omitted): " + result);
        assertFalse(result.containsKey("is_empty"), "is_empty (should be omitted): " + result);
        assertFalse(result.containsKey("empty_nested"), "empty_nested (should be omitted): " + result);
        assertFalse(result.containsKey("empty_array"), "empty_array (should be omitted): " + result);
    }

    private void suppressNulls(final boolean suppressNulls) {
        runner.setProperty(TestControllerServiceProcessor.CLIENT_SERVICE, "Client Service");
        runner.disableControllerService(service);
        runner.setProperty(service, ElasticSearchClientService.SUPPRESS_NULLS, suppressNulls
                ? ElasticSearchClientService.ALWAYS_SUPPRESS.getValue()
                : ElasticSearchClientService.NEVER_SUPPRESS.getValue());
        runner.enableControllerService(service);
        runner.assertValid();
    }

    @Test
    void testBulkAddTwoIndexes() throws Exception {
        final List<IndexOperationRequest> payload = new ArrayList<>();
        for (int x = 0; x < 20; x++) {
            final String index = x % 2 == 0 ? "bulk_a": "bulk_b";
            payload.add(new IndexOperationRequest(index, type, String.valueOf(x), new HashMap<String, Object>(){{
                put("msg", "test");
            }}, IndexOperationRequest.Operation.Index));
        }
        for (int x = 0; x < 5; x++) {
            payload.add(new IndexOperationRequest("bulk_c", type, String.valueOf(x), new HashMap<String, Object>(){{
                put("msg", "test");
            }}, IndexOperationRequest.Operation.Index));
        }
        final IndexOperationResponse response = service.bulk(payload, createParameters("refresh", "true"));
        assertNotNull(response);
        assertTrue(response.getTook() > 0);
        waitForIndexRefresh();

        /*
         * Now, check to ensure that both indexes got populated appropriately.
         */
        final String query = "{ \"query\": { \"match_all\": {}}}";
        final Long indexA = service.count(query, "bulk_a", type, null);
        final Long indexB = service.count(query, "bulk_b", type, null);
        final Long indexC = service.count(query, "bulk_c", type, null);

        assertNotNull(indexA);
        assertNotNull(indexB);
        assertNotNull(indexC);
        assertEquals(indexA, indexB);
        assertEquals(10, indexA.intValue());
        assertEquals(10, indexB.intValue());
        assertEquals(5, indexC.intValue());

        final Long total = service.count(query, "bulk_*", type, null);
        assertNotNull(total);
        assertEquals(25, total.intValue());
    }

    @Test
    void testBulkRequestParameters() {
        final List<IndexOperationRequest> payload = new ArrayList<>();
        for (int x = 0; x < 20; x++) {
            final String index = x % 2 == 0 ? "bulk_a": "bulk_b";
            payload.add(new IndexOperationRequest(index, type, String.valueOf(x), new MapBuilder().of("msg", "test").build(), IndexOperationRequest.Operation.Index));
        }
        for (int x = 0; x < 5; x++) {
            payload.add(new IndexOperationRequest("bulk_c", type, String.valueOf(x), new MapBuilder().of("msg", "test").build(), IndexOperationRequest.Operation.Index));
        }
        final IndexOperationResponse response = service.bulk(payload, createParameters("refresh", "true"));
        assertNotNull(response);
        assertTrue(response.getTook() > 0);

        /*
         * Now, check to ensure that both indexes got populated and refreshed appropriately.
         */
        final String query = "{ \"query\": { \"match_all\": {}}}";
        final Long indexA = service.count(query, "bulk_a", type, null);
        final Long indexB = service.count(query, "bulk_b", type, null);
        final Long indexC = service.count(query, "bulk_c", type, null);

        assertNotNull(indexA);
        assertNotNull(indexB);
        assertNotNull(indexC);
        assertEquals(indexA, indexB);
        assertEquals(10, indexA.intValue());
        assertEquals(10, indexB.intValue());
        assertEquals(5, indexC.intValue());

        final Long total = service.count(query, "bulk_*", type, null);
        assertNotNull(total);
        assertEquals(25, total.intValue());
    }

    @Test
    void testUpdateAndUpsert() throws InterruptedException {
        final String TEST_ID = "update-test";
        final Map<String, Object> doc = new HashMap<>();
        doc.put("msg", "Buongiorno, mondo");
        service.add(new IndexOperationRequest(INDEX, type, TEST_ID, doc, IndexOperationRequest.Operation.Index), createParameters("refresh", "true"));
        Map<String, Object> result = service.get(INDEX, type, TEST_ID, null);
        assertEquals(doc, result, "Not the same");

        final Map<String, Object> updates = new HashMap<>();
        updates.put("from", "john.smith");
        final Map<String, Object> merged = new HashMap<>();
        merged.putAll(updates);
        merged.putAll(doc);
        IndexOperationRequest request = new IndexOperationRequest(INDEX, type, TEST_ID, updates, IndexOperationRequest.Operation.Update);
        service.add(request, createParameters("refresh", "true"));
        result = service.get(INDEX, type, TEST_ID, null);
        assertTrue(result.containsKey("from"));
        assertTrue(result.containsKey("msg"));
        assertEquals(merged, result, "Not the same after update.");

        final String UPSERTED_ID = "upsert-ftw";
        final Map<String, Object> upsertItems = new HashMap<>();
        upsertItems.put("upsert_1", "hello");
        upsertItems.put("upsert_2", 1);
        upsertItems.put("upsert_3", true);
        request = new IndexOperationRequest(INDEX, type, UPSERTED_ID, upsertItems, IndexOperationRequest.Operation.Upsert);
        service.add(request, createParameters("refresh", "true"));
        result = service.get(INDEX, type, UPSERTED_ID, null);
        assertEquals(upsertItems, result);

        final List<IndexOperationRequest> deletes = new ArrayList<>();
        deletes.add(new IndexOperationRequest(INDEX, type, TEST_ID, null, IndexOperationRequest.Operation.Delete));
        deletes.add(new IndexOperationRequest(INDEX, type, UPSERTED_ID, null, IndexOperationRequest.Operation.Delete));
        assertFalse(service.bulk(deletes, createParameters("refresh", "true")).hasErrors());
        waitForIndexRefresh(); // wait 1s for index refresh (doesn't prevent GET but affects later tests using _search or _bulk)
        ElasticsearchException ee = assertThrows(ElasticsearchException.class, () -> service.get(INDEX, type, TEST_ID, null) );
        assertTrue(ee.isNotFound());
        ee = assertThrows(ElasticsearchException.class, () -> service.get(INDEX, type, UPSERTED_ID, null));
        assertTrue(ee.isNotFound());
    }

    @SuppressWarnings("unchecked")
    @Test
    void testGetBulkResponsesWithErrors() {
        final List<IndexOperationRequest> ops = Arrays.asList(
                new IndexOperationRequest(INDEX, type, "1", new MapBuilder().of("msg", "one", "intField", 1).build(), IndexOperationRequest.Operation.Index), // OK
                new IndexOperationRequest(INDEX, type, "2", new MapBuilder().of("msg", "two", "intField", 1).build(), IndexOperationRequest.Operation.Create), // already exists
                new IndexOperationRequest(INDEX, type, "1", new MapBuilder().of("msg", "one", "intField", "notaninteger").build(), IndexOperationRequest.Operation.Index) // can't parse int field
        );
        final IndexOperationResponse response = service.bulk(ops, createParameters("refresh", "true"));
        assertTrue(response.hasErrors());
        assertEquals(2, response.getItems().stream().filter(it -> {
            final Optional<String> first = it.keySet().stream().findFirst();
            if (first.isPresent()) {
                final String key = first.get();
                return ((Map<String, Object>) it.get(key)).containsKey("error");
            } else {
                throw new IllegalStateException("Cannot find index response operation items");
            }
        }).count());
    }

    private Map<String, String> createParameters(final String... extra) {
        if (extra.length % 2 == 1) { //Putting this here to help maintainers catch stupid bugs before they happen
            throw new RuntimeException("createParameters must have an even number of String parameters.");
        }

        final Map<String, String> parameters = new HashMap<>();
        for (int index = 0; index < extra.length; index += 2) {
            parameters.put(extra[index], extra[index + 1]);
        }

        return parameters;
    }

    private static void waitForIndexRefresh() throws InterruptedException {
        Thread.sleep(1000);
    }

}

redpajama_set_name: RedPajamaGithub


Travel guide, Rough Guides asked their readers to rank the most beautiful countries of the world. Here are the 15 most beautiful countries voted by the readers.
Considered to be one of the most beautiful countries in the world, Switzerland's mountainous landscape, snowy ski runs, and hiking trails help it to the 15th spot on the list.


The New York Lotto's latest campaign affectionately highlights some of the eccentric habits of wealthy New Yorkers -- all in order to show you that you'd make a "better rich person."
Four new TV ads, plus a print and outdoor campaign, by McCann New York, bring caricatured examples of New York's spending habits to life -- the wealthy heir who bathes in expensive wine, the internet start-up guru who buys solid gold staples, the woman who spent a fortune becoming a pet whisperer and, seen here, the guy who spent millions on a dead bat for his bat collection. The spots, which also remind viewers that Lotto has made more millionaires out of more New Yorkers than any other in-state game, were directed by O Positive's Jim Jenkins.
The campaign also includes an amusingly illustrated "Field Guide" to identifying eccentric wealth at RichPeopleGuide.com. Here, New Yorkers can discover exactly which type of Rich Person they would be better than if they were wealthy, and find out more about some of the characters that appear in the ads.


text:
Segment your e-mail house file…or else
Ken Magill
Though many marketers still balk at segmenting their e-mail house files, the marketplace is moving in a direction that is increasingly making segmentation a necessity.
First, people are fed up with irrelevant e-mail, and this applies to business-to-business as well as business-to-consumer marketers. Merchants who send irrelevant e-mail risk not only damaging their reputations with recipients and the Internet service providers that process their mail, they risk losing customers.
According to a recent survey by the Chief Marketing Officer Council, 41% of respondents said they would consider ending a brand relationship because of irrelevant promotions, and an additional 22% said they would definitely defect from the brand.
Also, of the consumers who unsubscribe from e-mail programs, 46% said they are driven to brand defection because the messages are simply not relevant, according to the CMO Council.
The stink of spam
And if the risk of brand defection isn't enough to convince direct marketers to get e-mail-segmentation religion, there are huge reputation and deliverability risks for merchants who send one-size-fits-all e-mail blasts.
People who receive irrelevant and too frequent e-mails are more likely to report the sender to their inbox providers as a spammer — even if they previously opted in to receive the messages. Merchants who get too many spam complaints risk having all messages processed by the ISP that received the complaints diverted into recipients' spam folders or, worse, blocked from reaching recipients at all.
As a result, merchants who are perceived as spammers — even if their programs are 100% opt-in based — risk being unable to e-mail even their best customers, all because they couldn't resist sending every offer to every name on their files.
Still not convinced? Then consider the ISPs' increasing use of engagement metrics in deciding how to process incoming e-mail.
For example, AOL made an announcement recently about its enhanced whitelist — an internal list of non-spamming mailers whose messages are delivered with graphics and links intact — that has vast implications about where ISPs' spam-filtering techniques are headed and what marketers had better start doing if they want their e-mail lists to continue to perform.
"Historically, any IP [Internet Protocol address] on our regular whitelist that fell below a certain complaint threshold was added to the EWL [enhanced whitelist]. This meant that IPs with excellent mail statistics were not included in the EWL if they had not applied for the whitelist," reads the post. "Similarly, some IPs were on the EWL due to low complaints, even though the IP didn't have the best IP reputation," it adds.
"Taking this into consideration, we have modified our EWL process to benefit IPs with our highest internal reputation score," the post continues. "This means that IPs being added to the EWL have consistently maintained a low complaint level as well as high user engagement."
The most important phrase in that post is "high user engagement." According to deliverability expert Laura Atkins, one reason AOL may be making this move is because spammers have gamed the spam-complaint-rate metric — the percentage of recipients who hit the "report spam" button — rendering it less useful as a factor in determining whether incoming mail is unsolicited or not.
According to Atkins, some spammers have set up thousands of dummy e-mail accounts, sent e-mail to them, and then hit the "this is not spam" button to artificially drive their complaint percentages down.
"The spammers really destroyed the metric," she says.
Atkins adds that complaint rates can also be kept low simply by keeping older, nonresponsive addresses on a list, a practice inbox providers would like senders to avoid.
As a result, according to multiple sources, some e-mail inbox providers are increasingly looking at how engaged recipients are with mailers' messages when determining if the sender is a spammer or not.
How do they determine engagement? Hard to tell. But common sense says they'll look at such factors as open and click rates, how many people dig through their spam folders to move the mailer's messages into their inboxes, how many forward the mailer's messages, how many reply to the messages — where applicable — and how many add the mailer to their address books.
Moreover, inbox providers are also increasingly monitoring for when recipients don't interact with a mailer's messages, according to Deirdre Baird, president of e-mail deliverability and optimization consultancy Pivotal Veracity.
At AOL and Yahoo, for example, if someone signs up for an e-mail list and then never opens the messages, at some point the mailer's messages will start being shunted off to the recipient's spam folder — even though the messages are permission-based, says Baird.
As a result, where a mailer's reputation traditionally was primarily gauged by — among other things — the number of people who made the effort to hit the "report spam" button, now a mailer's reputation can be damaged by people who do nothing.
"People who don't interact are becoming as dangerous as those who explicitly, negatively interact," says Baird.
Adds Rick Buck, director of e-media and privacy/ISP relations for e-mail service provider e-Dialog: "You need to pay attention to when people stop responding and when they stop being deliverable, and have programs that assess that in some fixed period of time — say, every 30, 60 or 90 days."
Then, he says, "go back and look at these people and ask: 'Were any of these people my good customers to begin with? If they were, how can I build programs around them to either get a new e-mail address from them or get them back into my marketing program?' Or take a hard look at these people, see that they never were worth anything, and have the gumption to push these people off to the side."
So as painful as it sounds, it is imperative that marketers stop thinking in terms of mailing their entire e-mail lists with every offer they conceive. But the incentives to segment house files based on activity and non-activity aren't all negative.
Segmenting successes
Marketers who segment their e-mail files are reporting higher user engagement and increased revenue from their programs. For example, PETCO Animal Supplies segments its monthly newsletter by, among other things, online shoppers, offline shoppers and "don't know."
"But the three main segments aren't the only segments," says Margaux Abaya, PETCO's e-mail marketing manager. "They're then broken out by pet type, which loyalty programs they belong to, what city or state they live in. At the end of the day, it's 'What do they want to receive?'"
PETCO's e-mail segmentation varies from three to 10 segments per campaign, she says. "These are main segments, but each e-mail could be unique," adds Abaya. "The monthly newsletter may have three main segments, but there may be 250 unique versions."
Abaya says PETCO was already doing fairly simple segmentation when she joined the company about four years ago. But last year the merchant tapped e-Dialog as its new e-mail service provider and launched the detailed segmentation program it has in place now.
As a result, she says, where before the firm's e-mail open rates — the percentage of people viewing the messages with graphics turned on — were hovering around 10%, the newly revamped segmentation program has resulted in open rates of as high as 30%.
Moreover, the average order value driven by e-mail has gone from $66 to $85, she says.
Although segmentation is an obvious practice for PETCO — people who own only dogs don't want to hear about cat or aquarium products, for example — Abaya believes e-mail marketers are soon going to be left ith no choice but to segment.
"I've been in this industry about six years, and it seems every year we're having the same conversation: 'We've got to segment. We've got to segment.' And every year just a few do it," she says. "But I think we really are at a tipping point this year."
RELATED TAGS: Metrics

redpajama_set_name: RedPajamaCommonCrawl


One of the most important things to do is to listen to your body. Try to stay aware of when you're reaching for food out of boredom, rather than hunger. But beware, don't mistake dehydration for hunger - sometimes all you need is a large glass of water to quench those mid-morning hunger pangs. Or enjoy an organic cold pressed juice to infuse your body with nutrients. I'm a committed drinker and like to drink a few SimplyRaw Express juices to keep my energy levels up during the day. Raw juices are also fantastic for glowing skin!
Stay clear of any processed, packaged foods, refined carbs, and sugar, which are filled with empty calories. For example, a bag of chips—you will eat them, not feel full, and want to reach for more. Instead opt for whole foods that make you feel grounded, like root vegetables, nuts or seeds that will keep you full for longer. Have you tried our gRAWnola bars at SimplyRaw Express ? They always hit the spot for me!
Enjoy your food - don't rush through it. That means sitting down and eating at a table. Don't eat while on the go, whether it's while running from one appointment to the other or sitting in a car. It also means chewing your food properly before having another bite, savoring the flavours, and being in tune with how the food is making you feel. Remember, the stomach has no teeth so be sure to chew chew chew your food!
Having a regular exercise routine will make you more aware of the kind of foods you are putting on your plate. Feeling fitter will automatically help you reach for healthier options. It's much more tempting to reach for those fries because you have been sitting at a desk all week. That doesn't mean having to spend hours at the gym - even regular, brisk walks can make a vast improvement in how you feel!
Eat foods that taste good to you and are as close to their original state as possible. Eating healthy doesn't mean it has to taste bad—quite the opposite. Once your body cleanses out and becomes used to eating nutrient-dense and satisfying foods, that's all you will crave. I would much rather eat a delicious veggie-loaded Falafel Salad from SimplyRaw Express than a greasy pizza any day.


A bizarre apocalyptic scenario that originated decades ago is being raised again by autistic religious Jews in Israel who reportedly communicate spiritual messages through facilitated communication. Every aspect of this story is shrouded in controversy.
The Original Theory of Nibiru – Zechariah Sitchin (1920-2010) was a Russian-born Jewish scientist and author who suggested that there is a planet beyond Pluto called Nibiru (sometimes referred to as Planet X) which passes through our solar system every 3,600 years.
15 That day is a day of wrath, a day of trouble and distress, a day of wasteness and desolation, a day of darkness and gloominess, a day of clouds and thick darkness, 16 A day of the horn and alarm, against the fortified cities, and against the high towers. 17 And I will bring distress upon men, that they shall walk like the blind, because they have sinned against the LORD; and their blood shall be poured out as dust, and their flesh as dung. 18 Neither their silver nor their gold shall be able to deliver them in the day of the LORD'S wrath; but the whole earth shall be devoured by the fire of His jealousy; for He will make an end, yea, a terrible end, of all them that dwell in the earth.


text:
Zoraida cumulata är en insektsart som först beskrevs av Walker 1870.  Zoraida cumulata ingår i släktet Zoraida och familjen Derbidae. Inga underarter finns listade i Catalogue of Life.

Källor

Halvvingar
cumulata

redpajama_set_name: RedPajamaWikipedia


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.MultiProgress = undefined;

var _log;

function _load_log() {
    return _log = require("electron-builder-util/out/log");
}

var _progressEx;

function _load_progressEx() {
    return _progressEx = _interopRequireDefault(require("progress-ex"));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class MultiProgress {
    constructor() {
        this.stream = process.stdout;
        this.cursor = 0;
        this.totalLines = 0;
        this.isLogListenerAdded = false;
        this.barCount = 0;
    }
    createBar(format, options) {
        options.stream = this.stream;
        const bar = new (_progressEx || _load_progressEx()).default(format, options);
        this.barCount++;
        let index = -1;
        const render = bar.render;
        bar.render = tokens => {
            if (index === -1) {
                index = this.totalLines;
                this.allocateLines(1);
            } else {
                this.moveCursor(index);
            }
            render.call(bar, tokens);
            if (!this.isLogListenerAdded) {
                this.isLogListenerAdded = true;
                (0, (_log || _load_log()).setPrinter)(message => {
                    let newLineCount = 0;
                    let newLineIndex = message.indexOf("\n");
                    while (newLineIndex > -1) {
                        newLineCount++;
                        newLineIndex = message.indexOf("\n", ++newLineIndex);
                    }
                    this.allocateLines(newLineCount + 1);
                    this.stream.write(message);
                });
            }
        };
        bar.terminate = () => {
            this.barCount--;
            if (this.barCount === 0 && this.totalLines > 0) {
                this.allocateLines(1);
                this.totalLines = 0;
                this.cursor = 0;
                (0, (_log || _load_log()).setPrinter)(null);
                this.isLogListenerAdded = false;
            }
        };
        bar.tick = (len, tokens) => {
            if (len !== 0) {
                len = len || 1;
            }
            if (tokens != null) {
                bar.tokens = tokens;
            }
            // start time for eta
            if (bar.curr == 0) {
                bar.start = new Date();
            }
            bar.curr += len;
            if (bar.complete) {
                return;
            }
            bar.render();
            // progress complete
            if (bar.curr >= bar.total) {
                bar.complete = true;
                bar.terminate();
                bar.callback(this);
            }
        };
        return bar;
    }
    allocateLines(count) {
        this.stream.moveCursor(0, this.totalLines - 1);
        // if cursor pointed to previous line where \n is already printed, another \n is ignored, so, we can simply print it
        this.stream.write("\n");
        this.totalLines += count;
        this.cursor = this.totalLines - 1;
    }
    moveCursor(index) {
        this.stream.moveCursor(0, index - this.cursor);
        this.cursor = index;
    }
    terminate() {
        this.moveCursor(this.totalLines);
        this.stream.clearLine();
        this.stream.cursorTo(0);
    }
}
exports.MultiProgress = MultiProgress; //# sourceMappingURL=multiProgress.js.map


text:
Some Korean Stars Are Concerned About New Social App "Clubhouse"
Girls' Generation's Taeyeon and Yuri, DAY6's Jae, Heize, WINNER's Mino, and 2NE1's Sandara Park are just a few of the K-Pop stars who have already signed up to Clubhouse.
The new audio-chat app Clubhouse is Korea's latest social media craze, and numerous idols have already signed up to chat with fans. However, some Korean stars have expressed concern over how the platform is being used.
Clubhouse—which is currently run as invitation-only and exclusive to iOS devices—allows users to create virtual rooms where they can stream live audio talks, either alone, with friends, or with fans. Girls' Generation's Taeyeon and Yuri, DAY6's Jae, Heize, WINNER's Mino, and 2NE1's Sandara Park are just a few of the K-Pop stars who have already signed up to Clubhouse.
taeyeon: happy new years everyone, you too dahye aka heize
heize: happy new years and be healthy
taeize in clubhouse together🥺
pic.twitter.com/lSu8aVYGE2
— jenn♥ (@taevenger) February 11, 2021
But while some Korean celebrities seem to be loving the app's unique features, others have their hesitations. Kim Ji Hoon, a popular actor known for his roles in K-Dramas like Rich Family's Son and Jang Bo Ri Is Here, recently penned a long post about Clubhouse on Instagram.
| @jiraishin99/Instagram
In his post, Kim Ji Hoon opined that despite being the "most popular" social media platform right now, Clubhouse shows "the most vulnerable side of modern people's mentality." According to the actor, the app is creating two main categories of users: those who feel inferior and those who feel superior.
Kim explained that those who aren't in on the trend or don't have access to the "opinion-leading groups" may find themselves feeling "worthless" and "nervous". On the opposite side, those who use Clubhouse to seek acknowledgment from others "for being special and different" may feel a sense of superiority and begin to boast.
He went on to say that the platform does have its benefits—such as the ability to listen to experts in various fields. However, he asked followers not to send him an invite to the exclusive app as he doesn't want to use it for social media purposes.
Rapper DinDin, known for his extensive variety show appearances and collaborations with artists like MAMAMOO's Wheein, expressed a similar sentiment on a recent episode of his radio show on SBS. According to DinDin, Clubhouse could "boost division in communication" as much as it expands it.
| @dindinem/Instagram
Unlike Kim Ji Hoon, who is steering clear of the app, DinDin explained that he has accepted an invitation to Clubhouse himself and joined some of the rooms. He noted that the global nature of the app allows people from all corners of the world to talk about their current situations. However, he felt like Clubhouse rooms were "a small group of people [who] just talked to each other without giving others any chance to talk."
On top of that, he also heard that invitations to Clubhouse are being sold online for as much as ₩20,000 KRW (about $18.10 USD). To DinDin, the steep fee is reminiscent of "aristocrats [wanting] to join an upper-class party." He described the division as "pathetic to witness", akin to suggesting there are "upper and lower classes in the 21st century."
DinDin even tried making his own room, but was sadly soon met by advice from an acquaintance to not accept "ordinary people". "I thought the way of thinking was so authoritarian and irritating," he explained. Similarly to Kim Ji Hoon, he believes Clubhouse may further "power mechanisms in relationships."
Source: The Korea Times and News Culture (Image)


Lana Lee is a dedicated paralegal at Gruenberg Law. She grew up in Russia and is bilingual. She has a B.A. in Child Psychology, and attended Southwestern College for her Paralegal training. While at Southwestern she maintained a 3.8 GPA and was qualified for the Dean's List.
In addition to her professional accomplishments, Lana volunteers for the San Diego Humane Society and helped victims of domestic violence at YWCA.
In her spare time, Lana likes to play classical piano pieces of Beethoven and Chopin. She also enjoys camping and spending time with her family and her two cats, Alfie and Jibanyan.


When it rains hard in Yorktown Woods, some residents find fish in their front yards. Some have to drive their cars on sidewalks because the street is flooded and impassable. And others get water in their basements.
That`s what residents of the Lombard subdivision told the village board last week at a hearing on next year`s budget. They want funds to stop the flooding.
According to residents, the retention basin between 18th and 19th Streets (east of Elizabeth Street), put in by Current Development Corp., is not big enough and causes flooding during heavy rains. Current Development took over after the original developer went bankrupt.
subdivision, contributing to the problem.
Carle Wunderlich, 198 W. 18th St., said homes have had as much as $10,000 in damage. He and another resident showed pictures of flooded streets and yards.
The pond overflow is so bad that ''we can fish from our patio,'' one resident said.
Village Manager William Lichter said later that enlarging the retention basin would cost about $40,000 and that no such an expenditure has been authorized. Nor is there an estimate of what it would cost to stop flooding from the pond across 18th Street.
Wunderlich said Friday that homeowners have gotten a runaround from the village, which he said first blamed the developer. But the village is responsible because of slipshod inspection and engineering, he said.
Laura Vazquez, a new village board member who lives in Yorktown Woods but whose home doesn`t flood, is helping the homeowners. She said Friday that when she complained recently to village officials about the situation, they ''told me to get in line. They said Lombard has had a flooding problem for 29 years. ''If that is the stance village officials take, it will be up to the homeowners to take legal action against the village or the original developer`s engineer,'' Vazquez said.
She said she and others are concerned about whether the village staff can handle the large amount of development. ''Is the south side of town going to float as the north side did?'' she asked.
At the meeting, residents of the Highland Green subdivision were more successful with the board in getting part of what they want to reduce traffic problems in the area, immediately west of Yorktown Center.
The village board voted to have stop signs installed at the west and east ends of Majestic Drive. The signs are to be in place until May, 1987, pending a traffic survey to see how they are working out.
Ted Holman, president of the Highland Green Homeowners Association, said Majestic was once a quiet residential street but because of development has become ''a racetrack and main thoroughfare.'' He said cars drive across lawns and knock down mailboxes and garbage cans trying to get through the subdivision quickly.


Delivery : F9Furnitures offers free home delivery in select cities, so you can sit back and just be the one to choose what you need.
Warranty: For you to cherish the newness of our art pieces much longer, we offer a minimum of 03 year warranty on all our products.
Assembly Service: F9Furnitures provides incredible after sales services with an expert team of fitters who will guide and fit your product within 07 working days of delivery.
Hello India ! Now Enjoy F9Furnitures Home Delivery Decor Services To Your City. Enter Your City Pincode and Check Our Delivery Date Service Details.
What If The Delivery Gets Delayed?
All the products are transported and delivered using the F9Furnitures or its partner delivery network. While we try to ensure that the Product reaches you within the delivery time communicated while booking, exigencies may delay the delivery. In such cases, please do not worry. Get in touch with us for the latest update on your shipment, if we have already not got in touch with you.
How Much Would Be Shipping Charges?
When you enter a pin-code in the address field while ordering any of the product, the system will indicate whether we ship to your pin-code or not.
Best Way to check the status of your order is to go to our link "" and provide your Order Number and click on Submit button, this will help you in providing details where your order has been reached till time. We always try our best to deliver your Product before you can even think.
What If I received a damaged product ?
F9Furniture team has highly specialized quality control measures which ensure the product is up to our standards when you receive the product. In case you receive a damaged product, please bring it to the notice of the delivery personnel immediately. In case you notice an issue later, please call us at 1800 1236 255 or write to us at info@f9furnichair.in.


Founded in 2005, Broadband Facility Partners provides the communications industry a one-stop-shop for wide-ranging infrastructure solutions.
We can help either in the project planning stage, or in the execution stage through achieving objectives in sales/marketing, or sourcing cost effective high bandwidth and/or dark fiber and conduit solutions.
As we are not affiliated with a single supplier, we are in a "neutral" position involving resources with the ability to recommend the best solution for you and your customer's needs. We work hard to make sure our clients find us easy to work with. Contact us now!
BFP coordinates bi-lateral network build and facilitates corresponding bill of sale, O&M agreements.
BFP brokers customized dark fiber backbone solution in Mid-Atlantic for national carrier.
BFP facilitates Texas metro dark fiber expansion for regional SP.
BFP satisfies long term FTTT dark fiber requirement in northeast for national wireless provider.
BFP sources long term, southern California dark fiber solution on behalf of international service provider.
BFP coordinates long term dark fiber solutions for premier US cable company.
Copyright © 2015 Broadband Facility Partners, LLC.


text:
Kamala's Commitment to Full Inclusion and Civil Rights for People with Disabilities
Recommitting to building inclusive economic opportunity in America
According to CDC data, about a quarter of people in the United States have a disability. Kamala believes in an America that is fully accessible and inclusive for everyone and her administration will fight to make this a reality across all parts of our society. As president, Kamala will have diverse leaders with disabilities developing all the policies her administration champions, including priorities that will lift up people with disabilities.
To do this we must expand economic opportunity and security for people with disabilities. In 2018, the unemployment rate for workers with disabilities was more than twice that for workers without disabilities. Only 32 percent of people with disabilities who are working-age are employed. On the other hand, 73 percent of people without disabilities in the same age group are employed. Just as we fight to finally eliminate practices that lead to people with disabilities being paid subminimum wages, we also have to speak the truth about how we need to eliminate barriers that make it harder for people with disabilities to fully participate in our workforce.
Under Kamala's leadership, in partnership with the disability community, we can build an America that lives up to the promise of the Americans with Disabilities Act. Our country is stronger when everyone is valued, everyone has dignity, and everyone can be part of the competitive labor force.
WHAT SHE'LL DO:
She'll fight to create inclusive employment opportunities that pay people with disabilities their full value.
She'll pass the Transformation to Competitive Employment Act, which will establish a grant program for states to help redesign business models and strategies to increase employment of people with disabilities in competitive integrated employment.
People with disabilities are both more likely to work in low wage fields as well as be paid less than the minimum wage. That's why she'll pass the Raise the Wage Act, which will not only raise the minimum wage to $15 an hour but will also phase out the "subminimum" wage.
She'll remove barriers that make it harder for people with disabilities to take advantage of job opportunities.
Kamala will make changes to the vocational rehabilitation system at the Department of Education, which gives grants to states to help people with disabilities prepare for, secure, and retain employment. Kamala will make sure that the grant program covers a wider range of services and supports for a greater number of people to help more people with disabilities get the workplace accommodations, adaptive technology and devices, and other things that can be barriers to finding and maintaining a job.
And she'll fight to increase funding for the program so that it can serve everyone who would benefit from assistance under it.
She'll expand accessible, affordable transportation and housing options, which are key supports for anyone participating in the workforce.
Federal civil rights laws, including the Americans with Disabilities Act, Title VI of the Civil Rights Act of 1964, and Section 504 of the Rehabilitation Act already require that our transportation systems and housing projects be fully accessible. However, these accommodations still have accessibility issues because efforts to make the projects fully accessible are frequently not done at the front-end of the project.
For example, more than a quarter of rail stations across the country are not fully accessible to people with disabilities. The same is true of 12% of the U.S. rail fleet.
Kamala will address this by taking executive action to direct the Department of Transportation and the Department of Housing and Urban Development to require that funding recipients submit plans detailing how their projects will be fully accessible prior to receiving funding.
She'll fight to pass the IDEA Full Funding Act to make sure that students with disabilities are learning in classrooms that have funding to ensure they can get the education they deserve, which is key to ensuring long-term economic opportunity.
And she'll direct her education secretary to increase enforcement of civil rights laws designed to protect that right to an education.
And she'll work to increase resources to better prepare teachers to meet the needs of students with disabilities in inclusive classrooms and expand access to post-secondary education for people with disabilities.
She'll fight to finally ratify U.S. participation in the Convention on the Rights of Persons with Disabilities to affirm American leadership in fighting for the civil rights of people with disabilities around the world.
She'll fight to pass the Working Families Tax Credit to allow people without dependent children to take advantage of the Earned Income Tax Credit. And she'll make the Child Tax Credit fully refundable which would be particularly beneficial to families who have children with disabilities.
Because quality, affordable health care is core to economic security, she'll fight to pass her Medicare for All plan which addresses the significant barriers to quality health care that children and adults with disabilities face.
Kamala's plan fully covers comprehensive long-term services and supports, as well as assistive technologies and Early Periodic Screening, Diagnosis, and Treatment (EPSDT) services that are critical to children with disabilities. It also ensures that those long-term services and supports are consumer-directed and are provided in home- and community-based settings.
And it ensures that when families move, or people with disabilities change jobs, their coverage moves with them so that they have uninterrupted access to the care and services they need.
She'll ensure that people with disabilities impacted by disasters have the services and other civil rights protections they are entitled to under the Rehabilitation Act and the Americans with Disabilities Act, so they can return home, to work and school at the same time as the rest of the disaster impacted community.
And, she'll make sure the federal government leads by example.
Kamala will recommit us to the goal President Obama established in 2010 to make the federal government a model inclusive employer and strongly enforce Section 501 of the Rehabilitation Act. She will direct agencies to create updated plans for how to make the recruitment, hiring, and retention of people with disabilities a priority in her administration. And she'll make sure this diverse leadership is represented in senior positions and that there are opportunities for promotion.
Kamala will also take executive action to ensure that the technology the federal government buys, develops, or uses is fully accessible, as is currently required by federal law. This will include requiring each agency to implement a plan to ensure that any new technology developed or acquired is fully accessible before it is deployed, as well as doing an analysis of existing technology that is not compliant and develop a timeline for updating it.
And Kamala will create new senior-level positions in the White House to make sure that the priorities for people with disabilities are incorporated across all of her policymaking, particularly on the Domestic Policy Council and the economic work of her administration.
A quick guide to the 2021 Atlanta Mayor race
Branch Politics
Councilor Tyson Urges Citizens To Get Their Flu Shots On Tuesday
Denn's Venn
Jon Denn
Let's Talk About Obamacare, Part One!
Chris B in TheFreeCities
Momentum for Vote by mail surges
Mike Berland
Bannon, Breitbart, Pollak, Mercer, De Vos, Atlas Network, Acton Group, Hate Practices, Russia, and…
Yvonne Owens, PhD
The Week in Tweets: The Presidential Chaos Edition
Neil Turkewitz
Russian 2020 Election Suppression Tactics 2.0 / Q
Kritter Robin


Legends of Terris is a real time multi-user adventure. You play the part of a citizen of the continent of Norland in the realm of Terris. You choose a path of adventure, become a mighty warrior or a powerful wizard. You adventure within a land of dragons, fiends, caverns and dungeons.
While you play the game, you will find other real people playing as well. The great strength of Terris is its ability to let you interact with other real people.
Your aim in life is to complete quests and gain in power and standing.
Terris is a challenging world: monsters are constantly out to destroy you, while the Gods cause major developments in the lives of mortals.
You will find the game easy to learn and the players and Immortals quite friendly. To help you in your quest to play Terris as effectively as possible, write down the following help keywords and then issue the Help <keyword> command for each of them in turn. This will give you a good overall view of Terris and give you the help you need to get started.
If you are stuck at any point, type WISH <message> like WISH Help me please! and any online Immortals (players that run the game) will assist you as soon as possible. When you issue the WISH command, you will be told how many Gods heard your request. If the number is 0 (meaning no Gods were online), use the SHOUT <message> command to ask for help from other players, like SHOUT Help me please.
Accept the challenge and adventure onwards!


text:
Meet Judy Buenoano, The 'Black Widow' Serial Killer Who Murdered Her Family — And Almost Got Away With It
By Marco Margaritoff | Edited By Jaclyn Anglis
In the 1970s and '80s, Judy Buenoano killed her husband, her next boyfriend, and even her own son for insurance money. And no one suspected a thing — until she tried to firebomb her last fiancé's car.
U.S District Court/The Middle District of Florida Judy Buenoano was the first woman to die in the electric chair in Florida.
Judy Buenoano was one of the most cunning American serial killers of the 1970s and '80s. Though she didn't have the highest body count, she still became infamous for killing people who were close to her. She murdered her husband, her boyfriend, and even her own son — for insurance money.
After each death, Buenoano quietly collected thousands of dollars — and used the cash to start a salon, buy fancy jewelry, and purchase a new car. She was living the "high life" in Florida — and no one suspected a thing.
It was only when her last fiancé's car mysteriously exploded in 1983 that the police began to get suspicious. And once authorities dug a little deeper, they would soon uncover even more shocking crimes. By 1985, the woman known as the "Black Widow" was sentenced to death.
Today, Buenoano remains largely forgotten in comparison to more prolific serial killers. And yet her case still stands out — because of the disturbing greed behind the murders. Buenoano also made history: She was the first woman executed in Florida in 150 years and the first woman ever in the state to die in the electric chair. This is her twisted story.
The Early Life Of Judy Buenoano
PinterestThe "Black Widow" was given her infamous nickname because of her callousness in court.
Before she became Judy Buenoano, she was born Judias Welty on April 4, 1943, in Quanah, Texas. She had a difficult childhood. After her mother died when she was four years old, she was sent to live with other family members. Passed among a few relatives, she occasionally lived with foster families.
Buenoano claimed that she was sexually and physically abused at many of these homes. Even when she moved in with her father and his new wife at age 10, she said that she was often beaten while living there as well. Though Buenoano successfully graduated from a reform school in New Mexico in 1959, she also became pregnant when she was just 17.
In 1961, Buenoano gave birth to a son named Michael. Shortly after that, she met a young airman — Air Force Sgt. James Goodyear — and quickly began a relationship with him. They married in 1962. And a few years later, the family welcomed two more children, James and Kimberly.
https://youtu.be/vOphYTpIt58
In the late 1960s, the family moved to Orlando, Florida. This was mostly because Goodyear was reassigned to a Strategic Air Command base at McCoy Air Force Base (which is now the Orlando International Airport). Goodyear also spent about a year in Vietnam and came home in 1971.
But something strange happened when he got back. Just a few months after he returned in May, the healthy man began to suffer from mysterious symptoms. And by September, he was dead.
Shortly after Goodyear's tragic death, his widow collected $28,000 in life insurance and about $64,000 in Veterans Administration benefits.
Buenoano also decided to move to Pensacola, Florida. And it was there where she began a relationship with a new man named Bobby Morris in 1972.
The "Black Widow" Strikes Again
FacebookBuenoano never admitted to her crimes and once bragged that Florida would never execute her.
When Morris moved to Colorado, Buenoano and her children followed. But a few years later, Morris began to exhibit strange symptoms — eerily similar to the symptoms Goodyear had experienced. In 1978, Morris died.
Strangely, both Goodyear and Morris were believed to have died from heart attacks, according to their doctors.
As Morris's "common-law wife," Buenoano quietly collected on three separate life insurance policies taken out on his life. She then returned to Pensacola, Florida. It was around this time when she changed her last name to "Buenoano" — a grammatically incorrect Spanish translation of "Goodyear."
By 1979, Buenoano's adult son Michael had joined the U.S. Army — perhaps inspired by the late Goodyear. But yet again, distressing symptoms began to emerge — as Michael became very ill.
He was eventually diagnosed with arsenic poisoning — which affected his arms and legs. Discharged from the Army, he soon required the use of heavy metal leg braces. Then in 1980, Buenoano took Michael canoeing in Florida's East River. At some point during this trip, the canoe capsized.
Though Buenoano safely swam back to shore, Michael drowned after being dragged underwater by his heavy braces. Initially, his death was ruled an accidental drowning. And yet again, Buenoano quietly collected more money from her son's life insurance policy.
So far, Buenoano had killed stealthily, feeding her lovers arsenic and drowning her son in a secluded area. But the next time she tried to kill, she used a method that was far less covert — and attracted the attention of the authorities.
Judy Buenoano Slips Up
U.S District Court/The Middle District of FloridaBuenoano attracted far less sympathy than other female inmates on death row.
After Michael's death, Buenoano began dating a new man named John Gentry. He later described seeing her for the first time, recalling darkly: "[Judy] was standing at the bar, all dressed in black. She wore black quite a lot. In fact, psychologically, I think that says a lot about her."
Buenoano convinced Gentry — her future fiancé — that they should take out life insurance policies on each other. In the event of Gentry's death, Buenoano would receive $500,000. And so the "Black Widow" got to work.
She initially tried to kill him with "Vitamin C" capsules when he caught a cold. But the pills made Gentry seriously ill, and he ended up going to the hospital for his symptoms.
While he felt better after being treated, he soon needed to return to the hospital — because his car was firebombed in 1983. Miraculously, Gentry survived the explosion. But when investigators heard what happened, they soon became suspicious of Buenoano.
"Judy just went one murder too far," said Pensacola detective Ted Chamberlin. "If she'd just let that last boyfriend alone, she probably could have walked away from the other murders."
Chamberlin's investigation led to Buenoano's arrest — and the exhumation of Goodyear, Morris, and her son. It was later revealed that all three of them were victims of arsenic poisoning.
The Execution Of The "Black Widow"
U.S District Court/The Middle District of FloridaBuenoano had collected about $240,000 in life insurance money after the murders.
In 1984, Buenoano was found guilty of attempting to murder Gentry. And not long after that, investigators unearthed evidence that also found Buenoano guilty of the murder of Goodyear and the drowning of her son Michael.
While authorities also believed that she was responsible for the death of Morris, Colorado prosecutors decided not to formally file murder charges — since she was already given the death sentence in Florida in 1985.
Buenoano's crimes had spanned 12 years. She had collected about $240,000 total in life insurance money because of those crimes. And she never admitted to any of it. Not even when the "vitamins" she had been feeding Gentry were found to contain paraformaldehyde.
FacebookBuenoano's body being taken to the morgue in Gainesville, Florida.
Her callous indifference in court led Pensacola prosecutor Russell Edgar to give her an ominous nickname. "She's like a black widow," he said. "She feeds off her mates and her young."
Though Buenoano attempted to appeal, all of her claims were ultimately rejected. And so she ate her last meal on March 30, 1998. The 54-year-old enjoyed steamed vegetables, fresh strawberries, and hot tea.
The prison staff then prepared her for execution. And at 7:13 a.m, she died in the chair. To the end, Buenoano refused to admit to anything.
When asked if she had any last words, Buenoano murmured, "No, sir." She died as she had lived — quietly, with a twisted story hidden underneath the surface.
After reading about Judy Buenoano, learn about the nine most gruesome serial killer couples. Then, read about the crimes of 11 famous American serial killers.
Marco Margaritoff
A staff writer for All That's Interesting, Marco Margaritoff has also published work at outlets including People, VICE, and Complex, covering everything from film to finance to technology. He holds dual bachelor's degrees from Pace University and a master's degree from New York University.
Inside The Cold-Blooded Murder Of Jolee Callan At The Hands Of Her Jealous Ex
Holly Bobo Was Last Seen With A Mysterious Stranger — And Never Returned


text:
Home » Brain Function » Depression and Diabetes May Be Linked With Alzheimer's, Study Says
Depression and Diabetes May Be Linked With Alzheimer's, Study Says
By Dr. Richard Foxx, MD - July 8, 2015
When you research studies every day, like I do, you start to make connections between the diseases that affect average Americans. Ironically enough, everything seems to blend together. Let me explain…
Dementia and Alzheimer's disease are common mental health conditions, especially among older adults. It is estimated that one in nine people over the age of 65 suffers from Alzheimer's disease.
Depression is also a common mental illness that affects nearly one in five older adults. In particular, major depression affects nearly seven percent of all American adults. Depression is also commonly connected with diabetes, affecting over nine percent of the U.S. population.
Stick with me here. In a recent meta-analysis published in The American Journal of Psychiatry, researchers at the University College London found that people with mild cognitive impairment (MCI) have a high risk of dementia, especially when they also have diabetes or depression. MCI is considered a precursor of dementia—about 46% of those with MCI will develop dementia within three years.The review analyzed data from 62 studies, and followed 15,950 people with MCI. MCI progressed to dementia in 65% of people who also had diabetes. People with psychiatric symptoms, like depression, were also twice as likely to develop dementia.After poring over the research, I began to wonder; if these conditions are linked, then maybe their natural treatments are connected as well! It turns out there is a connection between certain nutrient deficiencies and other possible treatments for dementia, diabetes, and depression.
Alternative Treatments for Diabetes, Depression, and Dementia
Address common nutrient deficiencies
There are common nutrient deficiencies among people with depression, Alzheimer's disease, and diabetes. This includes a lack of vitamin C and zinc. Vitamin E deficiency is also common in diabetes and dementia patients, while diabetes and depression patients usually lack vitamin B6 and omega-3 fatty acids. Also, people with dementia and depression are generally deficient in B vitamins, especially B1 and B12. These deficiencies should be addressed with supplementation and diet changes.
Acupuncture is known to improve mood and depression, especially in patients with mild to moderate Alzheimer's disease. Acupuncture treatment can help relax the nervous system and may also improve insulin sensitivity. A 2000 study presented at the World Alzheimer's Conference reported that Alzheimer's patients could significantly improve their symptoms after receiving acupuncture. Clinical studies mainly support acupuncture to treat diabetic neuropathy; however, there is a lack of randomized controlled studies that support the use of acupuncture to treat diabetes in general. In China however, acupuncture it is still considered a common diabetes treatment.
There is supportive evidence for using ginkgo biloba extract in treating dementia, Alzheimer's disease, and depression. Ginkgo biloba is especially useful for treating depressed patients over the age of 50. Studies suggest that ginkgo biloba extract may counteract the reduction in serotonin receptor sites. There are also studies that link ginkgo biloba with improving circulation in older adults. This enhances memory, which may reduce the onset of Alzheimer's disease. Furthermore, studies have found that ginkgo biloba may treat diabetic-related complications, such as diabetic foot ulcers, diabetic nephropathy, and diabetic neuropathy.
Whole foods diet
A whole foods diet is definitely the way to go, especially one that includes high amounts of nutrient-dense vegetables. The Paleo diet would be a good approach to help address the nutrient deficiencies prevalent in these conditions. It contains high amounts of vegetables, some fruit and grass-fed meat, nuts and seeds, and low amounts of non-gluten grains. The diet also contains low glycemic index and glycemic load foods. These foods will help control blood sugar levels, insulin resistance, and other diabetes complications. Furthermore, the Paleo diet doesn't contain refined carbohydrates, but it is high in fiber. These factors also decrease the risk of diabetes, dementia, and depression. The diet should also not include dairy or bread products, as these foods could aggravate mental illness symptoms.
Remember—regular exercise, an active social life, quality sleep, and stress reduction are also important for reducing all three conditions. Regular exercise can include anything from walking, gardening, or cleaning the house. Qigong, tai chi, yoga, and meditation are also gentle exercises to help reduce the prevalence of diabetes and mental illness.
Cooper, C., et al., "Modifiable predictors of dementia in mild cognitive impairment: a systematic review and meta-analysis," The American Journal of Psychiatry 2015; 172(4): 323-334.
"Diabetes, depression predict dementia risk in people with slowing minds," Science Daily web site, February 20, 2015; http://www.sciencedaily.com/releases/2015/02/150220133335.htm.
Murray, M., et al, The Encyclopedia of Natural Medicine (New York: Atria Paperback, 2012), 276-291, 478-502, 503-547.
"Alzheimer's Disease and Acupuncture," Acupuncture Today web site; http://www.acupuncturetoday.com/mpacms/at/article.php?id=27681, last accessed July 8, 2015.
"Type-2 Diabetes," British Acupuncture Council web site; http://www.acupuncture.org.uk/a-to-z-of-conditions/a-to-z-of-conditions/type-2-diabetes.html, last accessed July 8, 2015.
Liang, F., et al., "Acupuncture: is it effective for treatment of insulin resistance?" Diabetes, Obesity & Metabolism 2010; 12(7): 555-569.
"Major Depression Among Adults," National Institute of Mental Health web site; http://www.nimh.nih.gov/health/statistics/prevalence/major-depression-among-adults.shtml, last accessed July 8, 2015.
"Statistics About Diabetes," American Diabetes Association web site, June 10, 2014; http://www.diabetes.org/diabetes-basics/statistics/.
"2015 Alzheimer's Disease Facts," Alzheimer's Association web site; http://www.alz.org/facts/overview.asp, last accessed July 8, 2015.
Smith, M., et al., "Alzheimer's and Dementia Prevention," HelpGuide.org; http://www.helpguide.org/articles/alzheimers-dementia/alzheimers-and-dementia-prevention.htm, last accessed July 8, 2015.
Tags: Brain Function, Dementia Breakthroughs, Diabetes Breakthroughs, Generel Health, Natural Health Breakthroughs, Potential Natural Treatments For Diabetes, Type 1 Diabetes Breakthroughs


Starting a enterprise is surprisingly easy-you just need to take the first step. To make sure, it does not harm that you've got expertise in a business, but that alone doesn't necessarily imply it is an excellent alternative. I additionally began one on palm oil enterprise i ended when i realized the constrains involved in sourcing for the product. You could have noticed a requirement in your neighborhood for a selected type of electrical work, and mixing your expertise with the market demand can allow you to attract clients. Each day my inbox is crammed with individuals telling me why they have not started a business but.
I began out with only one product – a e book about electronic mail advertising and marketing and at last after 12 months of banging my head towards a wall making an attempt to make cash online, I started to make gross sales. Similarly with the group and management workforce, it is OK if it's just you for now, or if you do not know who else you'll want to hire. You can also need to get some enterprise playing cards and other branded stationery printed at this stage, but only if you are positive about your branding.
Professor Kay Stice has received awards for top-high quality teaching at Arizona, Rice, and Brigham Young University, and he was twice chosen as one of many prime ten lecturers at HKUST. Business is nothing but making a profit from your individual merchandise or others products or services. A guide or software program with resell-rights signifies that the producer/creator legally lets you resell it as if it is your personal.
As you can see, I've already taken all the risk of discovering these things in your behalf, all you have to do is revenue & benefit from my years of palms-on Internet experience…while avoiding a number of of the expensive mistakes that I made. When you might be developing with business ideas, silence the inside critic that says you may't educate something until you are credentialed or the world's best expert on the topic. Treat the business plan as a draft that you're always updating as you get more information.
It's great to have a business plan and a method, but I want I had known that it's completely OK if you have to change directions. No surprise the youth of right now solicits the information of the way to begin a business at a younger age. Entrepreneurs ought to attempt to begin a enterprise sector or industry, where they have training or experience.
This entry was posted in business ethics and tagged business, overcome, starting. Bookmark the permalink.


2QB auction league - Dalton for Gronk?
Moved this from the keeper league discussion. My bad.
Been offered Gronk for Dalton from a QB needy team. He has Rudolph as his #2 TE. Dalton costs me $11 this year while Gronk is on the hook for $25. Keepers add $3 each season so Gronk is going to be expensive in a season or two and the "retirement" question always pops up each winter.
With a 5 year draft, I drafted Rosen and Allen more for the future and for bye weeks but was hoping to get an offer for one of them after QB injuries. Started 1-2 for the season mostly due to DJ's slow start and a couple of not so great lineup decisons (like not playing Kupp this week!).
Playing in a 2QB league, I think it's a bit early to take the chance on either Allen or Rosen suddenly being used every week and Burton should be fine as my starting TE. I can't see keeping Gronk at $31 in two seasons with a $200 budget on draft day. You just don't get him offered every day. Any thoughts out there. Thx.
Re: 2QB auction league - Dalton for Gronk?
2QB league with a MASSIVE salary differential? Easily, easily Dalton.