text:
package io.fabric8.devops.connector;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.Realm;
import com.ning.http.client.Response;
import io.fabric8.devops.ProjectConfig;
import io.fabric8.devops.ProjectConfigs;
import io.fabric8.devops.ProjectRepositories;
import io.fabric8.gerrit.CreateRepositoryDTO;
import io.fabric8.kubernetes.api.Controller;
import io.fabric8.kubernetes.api.KubernetesHelper;
import io.fabric8.kubernetes.api.ServiceNames;
import io.fabric8.kubernetes.api.builders.ListEnvVarBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.letschat.LetsChatClient;
import io.fabric8.letschat.LetsChatKubernetes;
import io.fabric8.letschat.RoomDTO;
import io.fabric8.openshift.api.model.BuildConfig;
import io.fabric8.openshift.api.model.BuildConfigBuilder;
import io.fabric8.openshift.api.model.BuildConfigFluent;
import io.fabric8.repo.git.GitRepoClient;
import io.fabric8.repo.git.GitRepoKubernetes;
import io.fabric8.taiga.ModuleDTO;
import io.fabric8.taiga.ProjectDTO;
import io.fabric8.taiga.TaigaClient;
import io.fabric8.taiga.TaigaKubernetes;
import io.fabric8.taiga.TaigaModule;
import io.fabric8.utils.DomHelper;
import io.fabric8.utils.GitHelpers;
import io.fabric8.utils.IOHelpers;
import io.fabric8.utils.Strings;
import io.fabric8.utils.Systems;
import io.fabric8.utils.URLUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import javax.annotation.Priority;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.ext.ReaderInterceptor;
import javax.ws.rs.ext.ReaderInterceptorContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;

/**
 * Updates a project's connections to its various DevOps resources like issue tracking, chat and jenkins builds
 */
public class DevOpsConnector {
    private transient Logger log = LoggerFactory.getLogger(DevOpsConnector.class);

    private static final String JSON_MAGIC = ")]}'";
    private static final ObjectMapper MAPPER = new ObjectMapper();

    private File basedir;
    private ProjectConfig projectConfig;

    private String username;
    private String password;
    private String branch;
    private String repoName;
    private String fullName;

    private String gitUrl;
    private String secret = "secret101";
    private String buildImageStream = "triggerJenkins";
    private String buildImageTag = "latest";
    private String s2iCustomBuilderImage = "fabric8/openshift-s2i-jenkins-trigger";
    private String jenkinsJob;
    private boolean triggerJenkinsJob = true;

    private String jenkinsMonitorView;
    private String jenkinsPipelineView;
    private String taigaProjectName;
    private String taigaProjectSlug;
    private String taigaProjectLinkPage = "backlog";
    private String taigaProjectLinkLabel = "Backlog";

    private String issueTrackerUrl;
    private String issueTrackerLabel = "Issues";

    private String teamUrl;
    private String teamLabel = "Team";

    private String releasesUrl;
    private String releasesLabel = "Releases";

    private String repositoryBrowseLink;
    private String repositoryBrowseLabel = "Repository";

    private String taigaTeamLinkPage = "team";
    private String taigaTeamLinkLabel = "Team";
    private boolean taigaAutoCreate = true;
    private boolean taigaEnabled = true;

    private boolean letschatEnabled = true;
    private String letschatRoomLinkLabel = "Room";
    private String letschatRoomExpression = "fabric8_${namespace}";

    private String flowGitUrl = Systems.getEnvVar("JENKINS_WORKFLOW_GIT_REPOSITORY", "https://github.com/fabric8io/jenkins-workflow-library.git");
    private String gerritUser = Systems.getEnvVar("GERRIT_ADMIN_USER", "admin");
    private String gerritPwd = Systems.getEnvVar("GERRIT_ADMIN_PWD", "secret");
    private String gerritGitInitialCommit = Systems.getEnvVar("GERRIT_INITIAL_COMMIT", "false");
    private String gerritGitRepoDesription = Systems.getEnvVar("GERRIT_REPO_DESCRIPTION", "Description of the gerrit git repo");

    private boolean recreateMode;
    private String namespace = KubernetesHelper.defaultNamespace();
    private String fabric8ConsoleNamespace = KubernetesHelper.defaultNamespace();
    private String jenkinsNamespace = KubernetesHelper.defaultNamespace();

    private boolean tryLoadConfigFileFromRemoteGit = true;
    private boolean modifiedConfig;
    private boolean registerWebHooks;

    private GitRepoClient gitRepoClient;
    private KubernetesClient kubernetes;
    private String jenkinsJobUrl;
    private ProjectDTO taigaProject;
    private TaigaClient taiga;
    private String jenkinsJobName;

    @Override
    public String toString() {
        return "DevOpsConnector{" +
                "gitUrl='" + gitUrl + '\'' +
                ", basedir=" + basedir +
                ", username='" + username + '\'' +
                ", branch='" + branch + '\'' +
                ", repoName='" + repoName + '\'' +
                '}';
    }

    /**
     * For a given project this operation will try to update the associated DevOps resources
     *
     * @throws Exception
     */
    public void execute() throws Exception {
        loadConfigFile();
        KubernetesClient kubernetes = getKubernetes();

        String name = null;
        if (projectConfig != null) {
            name = projectConfig.getBuildName();
        }
        if (Strings.isNullOrBlank(name)) {
            name = jenkinsJob;
        }
        if (Strings.isNullOrBlank(name)) {
            name = ProjectRepositories.createBuildName(username, repoName);
            if (projectConfig != null) {
                projectConfig.setBuildName(name);
            }
        }
        Map<String, String> labels = new HashMap<>();
        labels.put("user", username);
        labels.put("repo", repoName);

        getLog().info("build name " + name);

        taiga = null;
        taigaProject = null;
        try {
            taiga = createTaiga();
            taigaProject = createTaigaProject(taiga);
        } catch (Exception e) {
            getLog().error("Failed to load or lazily create the Taiga project: " + e, e);
        }
        getLog().info("taiga " + taiga);

        LetsChatClient letschat = null;
        try {
            letschat = createLetsChat();
        } catch (Exception e) {
            getLog().error("Failed to load or lazily create the LetsChat client: " + e, e);
        }
        getLog().info("letschat " + letschat);

        /*
         * Create Gerrit Git to if isGerritReview is enabled
         */
        if (projectConfig.hasCodeReview()) {
            try {
                createGerritRepo(repoName, gerritUser, gerritPwd, gerritGitInitialCommit, gerritGitRepoDesription);
            } catch (Exception e) {
                getLog().error("Failed to create GerritGit repo : " + e, e);
            }
        }

        Map<String, String> annotations = new HashMap<>();
        jenkinsJobUrl = null;
        String jenkinsUrl = null;
        try {
            jenkinsUrl = getJenkinsServiceUrl();

            if (Strings.isNotBlank(jenkinsUrl)) {
                if (Strings.isNotBlank(jenkinsMonitorView)) {
                    String url = URLUtils.pathJoin(jenkinsUrl, "/view", jenkinsMonitorView);
                    annotationLink(annotations, "fabric8.link.jenkins.monitor/", url, "Monitor");
                }
                if (Strings.isNotBlank(jenkinsPipelineView)) {
                    String url = URLUtils.pathJoin(jenkinsUrl, "/view", jenkinsPipelineView);
                    annotationLink(annotations, "fabric8.link.jenkins.pipeline/", url, "Pipeline");
                }
                if (Strings.isNotBlank(name)) {
                    jenkinsJobUrl = URLUtils.pathJoin(jenkinsUrl, "/job", name);
                    annotationLink(annotations, "fabric8.link.jenkins.job/", jenkinsJobUrl, "Job");
                }
            }
        } catch (Exception e) {
            getLog().warn("Could not find the Jenkins URL!: " + e, e);
        }
        getLog().info("jenkins " + jenkinsUrl);

        if (!annotationLink(annotations, "fabric8.link.issues/", issueTrackerUrl, issueTrackerLabel)) {
            String taigaLink = getProjectPageLink(taiga, taigaProject, this.taigaProjectLinkPage);
            annotationLink(annotations, "fabric8.link.taiga/", taigaLink, taigaProjectLinkLabel);
        }
        if (!annotationLink(annotations, "fabric8.link.team/", teamUrl, teamLabel)) {
            String taigaTeamLink = getProjectPageLink(taiga, taigaProject, this.taigaTeamLinkPage);
            annotationLink(annotations, "fabric8.link.taiga.team/", taigaTeamLink, taigaTeamLinkLabel);
        }
        annotationLink(annotations, "fabric8.link.releases/", releasesUrl, releasesLabel);

        String chatRoomLink = getChatRoomLink(letschat);
        annotationLink(annotations, "fabric8.link.letschat.room/", chatRoomLink, letschatRoomLinkLabel);

        annotationLink(annotations, "fabric8.link.repository.browse/", repositoryBrowseLink, repositoryBrowseLabel);

        ProjectConfigs.defaultEnvironments(projectConfig);

        String consoleUrl = getServiceUrl(ServiceNames.FABRIC8_CONSOLE, namespace, fabric8ConsoleNamespace);
        if (Strings.isNotBlank(consoleUrl) && projectConfig != null) {
            Map<String, String> environments = projectConfig.getEnvironments();
            if (environments != null) {
                for (Map.Entry<String, String> entry : environments.entrySet()) {
                    String label = entry.getKey();
                    String value = entry.getValue();
                    String key = value;
                    String environmentLink = URLUtils.pathJoin(consoleUrl, "/kubernetes/pods?namespace=" + value);
                    annotations.put("fabric8.link.environment." + key + "/url", environmentLink);
                    annotations.put("fabric8.link.environment." + key + "/label", label);
                    addLink(label, environmentLink);
                }
            }
        }

        BuildConfigFluent.SpecNested<BuildConfigBuilder> specBuilder = new BuildConfigBuilder().
                withNewMetadata().withName(name).withLabels(labels).withAnnotations(annotations).endMetadata().
                withNewSpec();

        if (Strings.isNotBlank(gitUrl)) {
            specBuilder = specBuilder.withNewSource().
                    withType("Git").withNewGit().withUri(gitUrl).endGit().
                    endSource();
        }
        if (Strings.isNotBlank(buildImageStream) && Strings.isNotBlank(buildImageTag)) {

            ListEnvVarBuilder envBuilder = new ListEnvVarBuilder();
            envBuilder.withEnvVar("BASE_URI", jenkinsUrl);
            envBuilder.withEnvVar("JOB_NAME", name);

            specBuilder = specBuilder.
                    withNewStrategy().
                    withType("Custom").withNewCustomStrategy().withNewFrom().withKind("DockerImage").withName(s2iCustomBuilderImage).endFrom()
                    .withEnv(envBuilder.build()).endCustomStrategy().
                            endStrategy();

        }
        BuildConfig buildConfig = specBuilder.
                addNewTrigger().
                withType("GitHub").withNewGithub().withSecret(secret).endGithub().
                endTrigger().
                addNewTrigger().
                withType("Generic").withNewGeneric().withSecret(secret).endGeneric().
                endTrigger().
                endSpec().
                build();

        Controller controller = createController();
        try {
            getLog().info("About to apply build config: " + new JSONObject(KubernetesHelper.toJson(buildConfig)).toString(4));
            controller.applyBuildConfig(buildConfig, "maven");

            getLog().info("Created build configuration for " + name + " in namespace: " + controller.getNamespace() + " at " + kubernetes.getMasterUrl());
        } catch (Exception e) {
            getLog().error("Failed to create BuildConfig for " + KubernetesHelper.toJson(buildConfig) + ". " + e, e);
        }
        this.jenkinsJobName = name;
        if (isRegisterWebHooks()) {
            registerWebHooks();
            getLog().info("webhooks done");
        }
        if (modifiedConfig) {
            if (basedir == null) {
                getLog().error("Could not save updated " + ProjectConfigs.FILE_NAME + " due to missing basedir");
            } else {
                try {
                    ProjectConfigs.saveToFolder(basedir, projectConfig, true);
                    getLog().info("Updated " + ProjectConfigs.FILE_NAME);
                } catch (IOException e) {
                    getLog().error("Could not save updated " + ProjectConfigs.FILE_NAME + ": " + e, e);
                }
            }
        }
    }

    protected String getJenkinsServiceUrl() {
        return getServiceUrl(ServiceNames.JENKINS, namespace, jenkinsNamespace);
    }

    /**
     * Looks in the given namespaces for the given service or returns null if it could not be found
     */
    protected String getServiceUrl(String serviceName, String... namespaces) {
        return getServiceUrl(serviceName, true, namespaces);
    }

    private String getServiceUrl(String serviceName, boolean serviceExternal, String... namespaces) {
        List<String> namespaceList = new ArrayList<>(Arrays.asList(namespaces));
        String[] defaults = {KubernetesHelper.defaultNamespace(), "default"};
        for (String defaultNamespace : defaults) {
            if (namespaceList.contains(defaultNamespace)) {
                namespaceList.add(defaultNamespace);
            }
        }
        for (String namespace : namespaceList) {
            try {
                return KubernetesHelper.getServiceURL(getKubernetes(), serviceName, namespace, "http", serviceExternal);
            } catch (Exception e) {
                // ignore
            }
        }
        return null;
    }

    protected boolean annotationLink(Map<String, String> annotations, String annotationPrefix, String issueTrackerUrl, String issueTrackerLabel) {
        if (Strings.isNotBlank(issueTrackerUrl)) {
            annotations.put(annotationPrefix + "url", issueTrackerUrl);
            annotations.put(annotationPrefix + "label", issueTrackerLabel);
            addLink(issueTrackerLabel, issueTrackerUrl);
            return true;
        } else {
            return false;
        }
    }

    public void registerWebHooks() {
        if (Strings.isNotBlank(jenkinsJobName)) {
            createJenkinsJob(jenkinsJobName, jenkinsJobUrl);
            getLog().info("created jenkins job");
        }
        if (Strings.isNotBlank(jenkinsJobUrl)) {
            createJenkinsWebhook(jenkinsJobUrl);
        }
        if (taiga != null && taigaProject != null) {
            createTaigaWebhook(taiga, taigaProject);
        }
    }

    public void addLink(String label, String url) {
        if (projectConfig == null) {
            projectConfig = new ProjectConfig();
        }
        projectConfig.addLink(label, url);
        modifiedConfig = true;
    }

    public Logger getLog() {
        return log;
    }

    public void setLog(Logger log) {
        this.log = log;
    }

    public KubernetesClient getKubernetes() {
        if (kubernetes == null) {
            kubernetes = new DefaultKubernetesClient();
        }
        return kubernetes;
    }

    public GitRepoClient getGitRepoClient() {
        if (gitRepoClient == null) {
            gitRepoClient = GitRepoKubernetes.createGitRepoClient(getKubernetes(), username, password);
            if (gitRepoClient != null) {
                if (Strings.isNullOrBlank(username)) {
                    username = gitRepoClient.getUsername();
                }
                if (Strings.isNullOrBlank(password)) {
                    password = gitRepoClient.getPassword();
                }
            }
        }
        return gitRepoClient;
    }

    // Properties
    //-------------------------------------------------------------------------

    public File getBasedir() {
        return basedir;
    }

    public void setBasedir(File basedir) {
        this.basedir = basedir;
    }

    public String getBranch() {
        return branch;
    }

    public void setBranch(String branch) {
        this.branch = branch;
    }

    public String getBuildImageStream() {
        return buildImageStream;
    }

    public void setBuildImageStream(String buildImageStream) {
        this.buildImageStream = buildImageStream;
    }

    public String getBuildImageTag() {
        return buildImageTag;
    }

    public void setBuildImageTag(String buildImageTag) {
        this.buildImageTag = buildImageTag;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public void setGitRepoClient(GitRepoClient gitRepoClient) {
        this.gitRepoClient = gitRepoClient;
    }

    public String getGitUrl() {
        return gitUrl;
    }

    public void setGitUrl(String gitUrl) {
        this.gitUrl = gitUrl;
    }

    public String getJenkinsJob() {
        return jenkinsJob;
    }

    public void setJenkinsJob(String jenkinsJob) {
        this.jenkinsJob = jenkinsJob;
    }

    public String getJenkinsMonitorView() {
        return jenkinsMonitorView;
    }

    public void setJenkinsMonitorView(String jenkinsMonitorView) {
        this.jenkinsMonitorView = jenkinsMonitorView;
    }

    public String getJenkinsPipelineView() {
        return jenkinsPipelineView;
    }

    public void setJenkinsPipelineView(String jenkinsPipelineView) {
        this.jenkinsPipelineView = jenkinsPipelineView;
    }

    public void setKubernetes(KubernetesClient kubernetes) {
        this.kubernetes = kubernetes;
    }

    public boolean isTriggerJenkinsJob() {
        return triggerJenkinsJob;
    }

    public void setTriggerJenkinsJob(boolean triggerJenkinsJob) {
        this.triggerJenkinsJob = triggerJenkinsJob;
    }

    public boolean isLetschatEnabled() {
        return letschatEnabled;
    }

    public void setLetschatEnabled(boolean letschatEnabled) {
        this.letschatEnabled = letschatEnabled;
    }

    public String getLetschatRoomExpression() {
        return letschatRoomExpression;
    }

    public void setLetschatRoomExpression(String letschatRoomExpression) {
        this.letschatRoomExpression = letschatRoomExpression;
    }

    public String getLetschatRoomLinkLabel() {
        return letschatRoomLinkLabel;
    }

    public void setLetschatRoomLinkLabel(String letschatRoomLinkLabel) {
        this.letschatRoomLinkLabel = letschatRoomLinkLabel;
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }

    public String getFabric8ConsoleNamespace() {
        return fabric8ConsoleNamespace;
    }

    public void setFabric8ConsoleNamespace(String fabric8ConsoleNamespace) {
        this.fabric8ConsoleNamespace = fabric8ConsoleNamespace;
    }

    public String getJenkinsNamespace() {
        return jenkinsNamespace;
    }

    public void setJenkinsNamespace(String jenkinsNamespace) {
        this.jenkinsNamespace = jenkinsNamespace;
    }

    public String getPassword() {
        return password;
    }

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

    public boolean isRecreateMode() {
        return recreateMode;
    }

    public void setRecreateMode(boolean recreateMode) {
        this.recreateMode = recreateMode;
    }

    public String getRepoName() {
        return repoName;
    }

    public void setRepoName(String repoName) {
        this.repoName = repoName;
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public boolean isTaigaAutoCreate() {
        return taigaAutoCreate;
    }

    public void setTaigaAutoCreate(boolean taigaAutoCreate) {
        this.taigaAutoCreate = taigaAutoCreate;
    }

    public boolean isTaigaEnabled() {
        return taigaEnabled;
    }

    public void setTaigaEnabled(boolean taigaEnabled) {
        this.taigaEnabled = taigaEnabled;
    }

    public String getTaigaProjectLinkLabel() {
        return taigaProjectLinkLabel;
    }

    public void setTaigaProjectLinkLabel(String taigaProjectLinkLabel) {
        this.taigaProjectLinkLabel = taigaProjectLinkLabel;
    }

    public String getTaigaProjectLinkPage() {
        return taigaProjectLinkPage;
    }

    public void setTaigaProjectLinkPage(String taigaProjectLinkPage) {
        this.taigaProjectLinkPage = taigaProjectLinkPage;
    }

    public String getTaigaProjectName() {
        return taigaProjectName;
    }

    public void setTaigaProjectName(String taigaProjectName) {
        this.taigaProjectName = taigaProjectName;
    }

    public String getTaigaProjectSlug() {
        return taigaProjectSlug;
    }

    public void setTaigaProjectSlug(String taigaProjectSlug) {
        this.taigaProjectSlug = taigaProjectSlug;
    }

    public String getTaigaTeamLinkLabel() {
        return taigaTeamLinkLabel;
    }

    public void setTaigaTeamLinkLabel(String taigaTeamLinkLabel) {
        this.taigaTeamLinkLabel = taigaTeamLinkLabel;
    }

    public String getTaigaTeamLinkPage() {
        return taigaTeamLinkPage;
    }

    public void setTaigaTeamLinkPage(String taigaTeamLinkPage) {
        this.taigaTeamLinkPage = taigaTeamLinkPage;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public boolean isTryLoadConfigFileFromRemoteGit() {
        return tryLoadConfigFileFromRemoteGit;
    }

    public void setTryLoadConfigFileFromRemoteGit(boolean tryLoadConfigFileFromRemoteGit) {
        this.tryLoadConfigFileFromRemoteGit = tryLoadConfigFileFromRemoteGit;
    }

    public ProjectConfig getProjectConfig() {
        return projectConfig;
    }

    public void setProjectConfig(ProjectConfig projectConfig) {
        this.projectConfig = projectConfig;
    }

    public void setRegisterWebHooks(boolean registerWebHooks) {
        this.registerWebHooks = registerWebHooks;
    }

    public boolean isRegisterWebHooks() {
        return registerWebHooks;
    }

    public String getIssueTrackerLabel() {
        return issueTrackerLabel;
    }

    public void setIssueTrackerLabel(String issueTrackerLabel) {
        this.issueTrackerLabel = issueTrackerLabel;
    }

    public String getIssueTrackerUrl() {
        return issueTrackerUrl;
    }

    public void setIssueTrackerUrl(String issueTrackerUrl) {
        this.issueTrackerUrl = issueTrackerUrl;
    }

    public String getTeamUrl() {
        return teamUrl;
    }

    public void setTeamUrl(String teamUrl) {
        this.teamUrl = teamUrl;
    }

    public String getTeamLabel() {
        return teamLabel;
    }

    public void setTeamLabel(String teamLabel) {
        this.teamLabel = teamLabel;
    }

    public String getReleasesUrl() {
        return releasesUrl;
    }

    public void setReleasesUrl(String releasesUrl) {
        this.releasesUrl = releasesUrl;
    }

    public String getReleasesLabel() {
        return releasesLabel;
    }

    public void setReleasesLabel(String releasesLabel) {
        this.releasesLabel = releasesLabel;
    }

    public String getRepositoryBrowseLabel() {
        return repositoryBrowseLabel;
    }

    public void setRepositoryBrowseLabel(String repositoryBrowseLabel) {
        this.repositoryBrowseLabel = repositoryBrowseLabel;
    }

    public String getRepositoryBrowseLink() {
        return repositoryBrowseLink;
    }

    public void setRepositoryBrowseLink(String repositoryBrowseLink) {
        this.repositoryBrowseLink = repositoryBrowseLink;
    }

    // Implementation methods
    //-------------------------------------------------------------------------

    protected Controller createController() {
        Controller controller = new Controller(getKubernetes());
        controller.setNamespace(namespace);
        controller.setThrowExceptionOnError(true);
        controller.setRecreateMode(recreateMode);
        return controller;
    }

    protected void loadConfigFile() {
        if (projectConfig == null) {
            GitRepoClient gitRepo = getGitRepoClient();
            boolean hasLocalConfig = false;
            if (basedir != null && basedir.isDirectory()) {
                projectConfig = ProjectConfigs.loadFromFolder(basedir);
                if (!projectConfig.isEmpty() || ProjectConfigs.hasConfigFile(basedir)) {
                    hasLocalConfig = true;
                }
            }
            if (!hasLocalConfig && tryLoadConfigFileFromRemoteGit && Strings.isNotBlank(repoName) && gitRepo != null) {
                try {
                    InputStream input = gitRepo.getRawFile(username, repoName, branch, ProjectConfigs.FILE_NAME);
                    if (input != null) {
                        try {
                            getLog().info("Parsing " + ProjectConfigs.FILE_NAME + " from the git repo " + repoName + " user " + username + " in branch " + branch);
                            projectConfig = ProjectConfigs.parseProjectConfig(input);
                        } catch (IOException e) {
                            getLog().warn("Failed to parse " + ProjectConfigs.FILE_NAME + " from the repo " + repoName + " for user " + username + " branch: " + branch + ". " + e, e);
                        }
                    }
                } catch (Exception e) {
                    getLog().warn("Failed to load " + ProjectConfigs.FILE_NAME + " from the repo " + repoName + " for user " + username + " branch: " + branch + ". " + e, e);
                }
            }
        }
        if (projectConfig != null) {
            String chatRoom = projectConfig.getChatRoom();
            if (Strings.isNotBlank(chatRoom)) {
                getLog().info("Found chat room: " + chatRoom);
                letschatRoomExpression = chatRoom;
            }
            String issueProjectName = projectConfig.getIssueProjectName();
            if (Strings.isNotBlank(issueProjectName)) {
                taigaProjectName = issueProjectName;
            }
        } else {
            getLog().info("No fabric8.yml file found for " + basedir);
        }
        if (Strings.isNullOrBlank(gitUrl)) {
            try {
                gitUrl = GitHelpers.extractGitUrl(basedir);
            } catch (IOException e) {
                getLog().warn("Could not load git URL from directory: " + e, e);
            }
        }
        if (Strings.isNullOrBlank(taigaProjectName)) {
            taigaProjectName = repoName;
        }
        if (Strings.isNullOrBlank(taigaProjectSlug)) {
            // TODO should we upper case it or anything?
            taigaProjectSlug = taigaProjectName;
        }
    }

    protected String getChatRoomLink(LetsChatClient letschat) {
        if (letschat != null) {
            try {
                String url = letschat.getAddress();
                String slug = evaluateRoomExpression(letschatRoomExpression);
                if (Strings.isNotBlank(url) && Strings.isNotBlank(slug)) {
                    RoomDTO room = letschat.getOrCreateRoom(slug);
                    if (room != null) {
                        String roomId = room.getId();
                        if (Strings.isNotBlank(roomId)) {
                            return URLUtils.pathJoin(url, "/#!/room/" + roomId);
                        }
                    }
                }
            } catch (Exception e) {
                getLog().error("Failed to get the link to the chat room: " + e, e);
            }
        }
        return null;
    }

    protected String evaluateRoomExpression(String roomExpresion) {
        if (Strings.isNotBlank(roomExpresion)) {
            String namespace = KubernetesHelper.defaultNamespace();
            String answer = roomExpresion;
            answer = replaceExpression(answer, "namespace", namespace);
            answer = replaceExpression(answer, "repoName", repoName);
            answer = replaceExpression(answer, "username", username);
            return answer;
        } else {
            return null;
        }
    }

    protected String replaceExpression(String text, String key, String value) {
        if (Strings.isNotBlank(key) && Strings.isNotBlank(value)) {
            String replace = "${" + key + "}";
            return text.replace(replace, value);
        } else {
            return text;
        }
    }

    protected LetsChatClient createLetsChat() {
        if (!letschatEnabled) {
            return null;
        }
        KubernetesClient kubernetes = getKubernetes();
        LetsChatClient letsChat = LetsChatKubernetes.createLetsChat(kubernetes);
        if (letsChat == null) {
            getLog().warn("No letschat service availble n kubernetes " + namespace + " on address: " + kubernetes.getMasterUrl());
            return null;
        }
        if (!letsChat.isValid()) {
            getLog().warn("No $" + LetsChatKubernetes.LETSCHAT_HUBOT_TOKEN + " environment variable defined so LetsChat support is disabled");
            return null;
        }
        return letsChat;
    }

    protected TaigaClient createTaiga() {
        if (!taigaEnabled) {
            return null;
        }
        TaigaClient taiga = TaigaKubernetes.createTaiga(getKubernetes(), namespace);
        if (taiga != null) {
            taiga.setAutoCreateProjects(taigaAutoCreate);
        }
        return taiga;
    }

    protected String getProjectPageLink(TaigaClient taiga, ProjectDTO taigaProject, String projectRelativePage) {
        if (taiga != null && taigaProject != null) {
            try {
                String url = taiga.getAddress();
                String slug = taigaProject.getSlug();
                if (Strings.isNullOrBlank(slug)) {
                    slug = taigaProjectSlug;
                }
                String userName = taiga.getUsername();
                if (Strings.isNullOrBlank(slug)) {
                    slug = userName + "-" + taigaProjectName;
                }
                if (Strings.isNotBlank(url) && Strings.isNotBlank(slug) && Strings.isNotBlank(projectRelativePage)) {
                    return URLUtils.pathJoin(url, "/project/", slug + "/", projectRelativePage);
                }
            } catch (Exception e) {
                getLog().error("Failed to get project page link for " + projectRelativePage + " : " + e, e);
            }
        }
        return null;
    }

    protected void createJenkinsJob(String buildName, String jenkinsJobUrl) {
        if (projectConfig != null) {
            String flow = projectConfig.getPipeline();
            String flowGitUrlValue = null;
            boolean localFlow = false;
            if (Strings.isNotBlank(flow)) {
                flowGitUrlValue = this.flowGitUrl;
            } else if (projectConfig.isUseLocalFlow()) {
                flow = ProjectConfigs.LOCAL_FLOW_FILE_NAME;
                flowGitUrlValue = this.gitUrl;
                localFlow = true;
            } else {
                getLog().info("Not creating Jenkins job as no pipeline defined for project configuration!");
            }
            String versionPrefix = Systems.getSystemPropertyOrEnvVar("VERSION_PREFIX", "VERSION_PREFIX", "1.0");
            if (Strings.isNotBlank(flow) && Strings.isNotBlank(gitUrl) && Strings.isNotBlank(flowGitUrlValue)) {
                String template = loadJenkinsBuildTemplate(getLog());
                if (Strings.isNotBlank(template)) {
                    template = template.replace("${FLOW_PATH}", flow);
                    template = template.replace("${FLOW_GIT_URL}", flowGitUrlValue);
                    template = template.replace("${GIT_URL}", gitUrl);
                    template = template.replace("${VERSION_PREFIX}", versionPrefix);
                    if (localFlow) {
                        // lets remove the GIT_URL parameter
                        template = removeBuildParameter(getLog(), template, "GIT_URL");
                    }
                    postJenkinsBuild(buildName, template);
                }
            }
        }
    }

    public static String loadJenkinsBuildTemplate(Logger log) {
        String template = null;
        String templateName = "jenkinsBuildConfig.xml";
        URL url = DevOpsConnector.class.getResource(templateName);
        if (url == null) {
            log.error("Could not load " + templateName + " on the classpath!");
        } else {
            try {
                template = IOHelpers.loadFully(url);
            } catch (IOException e) {
                log.error("Failed to load template " + templateName + " from " + url + ". " + e, e);
            }
        }
        return template;
    }

    public static String removeBuildParameter(Logger log, String template, String parameterName) {
        try {
            DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = documentBuilder.parse(new InputSource(new StringReader(template)));
            Element rootElement = doc.getDocumentElement();
            NodeList stringDefs = rootElement.getElementsByTagName("hudson.model.StringParameterDefinition");
            if (stringDefs != null) {
                for (int i = 0, size = stringDefs.getLength(); i < size; i++) {
                    Node item = stringDefs.item(i);
                    if (item instanceof Element) {
                        Element element = (Element) item;
                        Element name = DomHelper.firstChild(element, "name");
                        if (name != null) {
                            String textContent = name.getTextContent();
                            if (textContent != null) {
                                if (parameterName.equals(textContent.trim())) {
                                    Node parameterDefinitions = item.getParentNode();
                                    Node parametersDefinitionProperty = parameterDefinitions != null ? parameterDefinitions.getParentNode() : null;
                                    DomHelper.detach(item);
                                    if (DomHelper.firstChildElement(parameterDefinitions) == null) {
                                        DomHelper.detach(parameterDefinitions);
                                    }
                                    if (DomHelper.firstChildElement(parametersDefinitionProperty) == null) {
                                        DomHelper.detach(parametersDefinitionProperty);
                                    }
                                    return DomHelper.toXml(doc);
                                }
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            log.error("Failed to remove the build parameter from the Jenkins XML. " + e, e);
        }
        return template;
    }

    protected void postJenkinsBuild(String jobName, String xml) {
        String address = getServiceUrl(ServiceNames.JENKINS, false, namespace, jenkinsNamespace);
        if (Strings.isNotBlank(address)) {
            String jobUrl = URLUtils.pathJoin(address, "/createItem") + "?name=" + jobName;

            getLog().info("POSTING the jenkins job to: " + jobUrl);
            getLog().debug("Jenkins XML: " + xml);

            HttpURLConnection connection = null;
            try {
                URL url = new URL(jobUrl);
                connection = (HttpURLConnection) url.openConnection();
                connection.setRequestMethod("POST");
                connection.setRequestProperty("Content-Type", "text/xml");
                connection.setDoOutput(true);

                OutputStreamWriter out = new OutputStreamWriter(
                        connection.getOutputStream());
                out.write(xml);

                out.close();
                int status = connection.getResponseCode();
                String message = connection.getResponseMessage();
                getLog().info("Got response code from Jenkins: " + status + " message: " + message);
                if (status != 200) {
                    getLog().error("Failed to register job " + jobName + " on " + jobUrl + ". Status: " + status + " message: " + message);
                }
            } catch (Exception e) {
                getLog().error("Failed to register jenkins on " + jobUrl + ". " + e, e);
            } finally {
                if (connection != null) {
                    connection.disconnect();
                }
            }
        }

    }

    protected void createJenkinsWebhook(String jenkinsJobUrl) {
        if (Strings.isNotBlank(jenkinsJobUrl)) {
            String jenkinsWebHook = URLUtils.pathJoin(jenkinsJobUrl, "/build");
            Map<String, String> buildParameters = getBuildParameters();
            if (!buildParameters.isEmpty()) {
                String postfix = "";
                for (Map.Entry<String, String> entry : buildParameters.entrySet()) {
                    if (postfix.length() > 0) {
                        postfix += "&";
                    }
                    postfix += entry.getKey() + "=" + entry.getValue();
                }
                jenkinsWebHook += "WithParameters?" + postfix;
            }
            createWebhook(jenkinsWebHook, this.secret);

            if (triggerJenkinsJob) {
                triggerJenkinsWebHook(jenkinsJobUrl, jenkinsWebHook, this.secret);
            }
        }
    }

    protected void triggerJenkinsWebHook(String jobUrl, String triggerUrl, String secret) {
        // lets check if this build is already running in which case do nothing
        String lastBuild = URLUtils.pathJoin(jobUrl, "/lastBuild/api/json");
        JsonNode lastBuildJson = parseLastBuildJson(lastBuild);
        JsonNode building = null;
        if (lastBuildJson != null && lastBuildJson.isObject()) {
            building = lastBuildJson.get("building");
            if (building != null && building.isBoolean()) {
                if (building.booleanValue()) {
                    getLog().info("Build is already running so lets not trigger another one!");
                    return;
                }
            }
        }
        getLog().info("Got last build JSON: " + lastBuildJson + " building: " + building);

        getLog().info("Triggering Jenkins webhook: " + triggerUrl);
        String json = "{}";
        HttpURLConnection connection = null;
        try {
            URL url = new URL(triggerUrl);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setDoOutput(true);

            OutputStreamWriter out = new OutputStreamWriter(
                    connection.getOutputStream());
            out.write(json);

            out.close();
            int status = connection.getResponseCode();
            String message = connection.getResponseMessage();
            getLog().info("Got response code from Jenkins: " + status + " message: " + message);
            if (status != 200) {
                getLog().error("Failed to trigger job " + triggerUrl + ". Status: " + status + " message: " + message);
            }
        } catch (Exception e) {
            getLog().error("Failed to trigger jenkins on " + triggerUrl + ". " + e, e);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }

    protected JsonNode parseLastBuildJson(String urlText) {
        HttpURLConnection connection = null;
        String message = null;
        try {
            URL url = new URL(urlText);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Content-Type", "application/json");

            int status = connection.getResponseCode();
            message = connection.getResponseMessage();
            getLog().info("Got response code from URL: " + url +" " + status + " message: " + message);
            if (status != 200 || Strings.isNullOrBlank(message)) {
                getLog().debug("Failed to load URL " + url + ". Status: " + status + " message: " + message);
            } else {
                ObjectMapper objectMapper = new ObjectMapper();
                return objectMapper.reader().readTree(message);
            }
        } catch (Exception e) {
            getLog().debug("Failed to load URL " + urlText + ". " + e, e);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }

        return null;
    }

    /**
     * If the build is parameterised lets return the build parameters
     */
    protected Map<String, String> getBuildParameters() {
        Map<String, String> answer = new HashMap<>();
        if (projectConfig != null) {
            String flow = projectConfig.getPipeline();
            if (flow != null && Strings.isNotBlank(gitUrl)) {
                answer.put("GIT_URL", gitUrl);
            }
            Map<String, String> parameters = projectConfig.getBuildParameters();
            if (parameters != null) {
                answer.putAll(parameters);
            }
            if (!answer.containsKey("VERSION_PREFIX")) {
                answer.put("VERSION_PREFIX", "1.0");
            }
        }
        return answer;
    }

    protected ProjectDTO createTaigaProject(TaigaClient taiga) {
        if (taiga != null) {
            if (Strings.isNullOrBlank(taigaProjectName)) {
                getLog().info("Not creating Taiga project as no `fabric8.tagiaProjectName` property specified");
                return null;
            }
            if (Strings.isNullOrBlank(taigaProjectSlug)) {
                getLog().info("Not creating Taiga project as no `fabric8.taigaProjectSlug` property specified");
                return null;
            }
            getLog().info("About to create Taiga project " + taigaProjectName + " with slug: " + taigaProjectSlug);
            return taiga.getOrCreateProject(taigaProjectName, taigaProjectSlug);
        }
        return null;
    }

    protected void createGerritRepo(String repoName, String gerritUser, String gerritPwd, String gerritGitInitialCommit, String gerritGitRepoDescription) throws Exception {

        // lets add defaults if not env vars
        if (Strings.isNullOrBlank(gerritUser)) {
            gerritUser = "admin";
        }
        if (Strings.isNullOrBlank(gerritPwd)) {
            gerritPwd = "secret";
        }

        log.info("A Gerrit git repo will be created for this name : " + repoName);

        String gerritAddress = KubernetesHelper.getServiceURL(kubernetes, ServiceNames.GERRIT, namespace, "http", true);
        log.info("Found gerrit address: " + gerritAddress + " for namespace: " + namespace + " on Kubernetes address: " + kubernetes.getMasterUrl());

        if (Strings.isNullOrBlank(gerritAddress)) {
            throw new Exception("No address for service " + ServiceNames.GERRIT + " in namespace: "
                    + namespace + " on Kubernetes address: " + kubernetes.getMasterUrl());
        }

        String GERRIT_URL = gerritAddress + "/a/projects/" + repoName;
        Realm realm = new Realm.RealmBuilder()
                .setPrincipal(gerritUser)
                .setPassword(gerritPwd)
                .setUsePreemptiveAuth(false)
                .setScheme(Realm.AuthScheme.DIGEST)
                .build();

        AsyncHttpClientConfig.Builder configBuilder = new AsyncHttpClientConfig.Builder().setRealm(realm);

        AsyncHttpClient client = new AsyncHttpClient(configBuilder.build());
        System.out.println("Requesting : " + GERRIT_URL);

        try {
            CreateRepositoryDTO createRepoDTO = new CreateRepositoryDTO();
            createRepoDTO.setDescription(gerritGitRepoDescription);
            createRepoDTO.setName(repoName);
            createRepoDTO.setCreate_empty_commit(Boolean.valueOf(gerritGitInitialCommit));

            String json = MAPPER.writeValueAsString(createRepoDTO);
            Future<Response> future = client.preparePost(GERRIT_URL).addHeader("Content-Type", "application/json").setBody(json).execute();
            Response response = future.get();
            System.out.println("responseBody : " + response.getResponseBody());

        } catch (Throwable t) {
            throw new RuntimeException(t);
        } finally {
            client.close();
        }
    }

    @Priority(value = 1000)
    protected static class RemovePrefix implements ReaderInterceptor {

        @Override
        public Object aroundReadFrom(ReaderInterceptorContext interceptorContext)
                throws IOException, WebApplicationException {
            InputStream in = interceptorContext.getInputStream();

            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
            StringBuilder received = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                received.append(line);
            }

            String s = received.toString();
            s = s.replace(JSON_MAGIC, "");

            System.out.println("Reader Interceptor removing the prefix invoked.");
            System.out.println("Content cleaned : " + s);

            String responseContent = new String(s);
            interceptorContext.setInputStream(new ByteArrayInputStream(
                    responseContent.getBytes()));

            return interceptorContext.proceed();
        }
    }

    protected void createTaigaWebhook(TaigaClient taiga, ProjectDTO project) {
        if (taiga != null && project != null) {
            Long projectId = project.getId();
            ModuleDTO module = taiga.moduleForProject(projectId, TaigaModule.GOGS);
            if (module != null) {
                String webhookSecret = module.getSecret();
                String webhook = taiga.getPublicWebhookUrl(module);
                if (Strings.isNotBlank(webhookSecret) && Strings.isNotBlank(webhook)) {
                    createWebhook(webhook, webhookSecret);
                } else {
                    getLog().warn("Could not create webhook for Taiga. Missing module data for url: " + webhook + " secret: " + webhookSecret);
                }
            } else {
                getLog().warn("No module for gogs so cannot create Taiga webhook");
            }
        }
    }

    protected void createWebhook(String url, String webhookSecret) {
        try {
            GitRepoClient gitRepoClient = getGitRepoClient();
            WebHooks.createGogsWebhook(gitRepoClient, getLog(), username, repoName, url, webhookSecret);
        } catch (Exception e) {
            getLog().error("Failed to create webhook " + url + " on repository " + repoName + ". Reason: " + e, e);
        }
    }

}

redpajama_set_name: RedPajamaGithub


This is the second in a series on Becoming a Great Kingdom Church.
A person's character is very difficult to change. But it can be done, though it takes time. Today let us study the character of John and James, and see what we can learn from them.
You have been called by God according to His glorious grace.
I take no pleasure of anyone going to hell - but God's justice is satisfied, and today UBL's knees bow and his tongue confesses Jesus Christ as Lord! Link inc. to formatted text, audio, PowerPoint.
There are certain lifestyles that promotes the preaching of the gospel.
All Christians are to be growing Christians.
The way we direct our lives says everything about our greatest allegiance(s), and thus we bear the image or the imprint of those allegiances.
When God gives us a task, His perfect plan includes the resources to do it: strength, action, and courage. Sermon for deacon ordination service.
Message on the Foundations for our Unity in Christ.
If you were brought up in George Mueller's orphanage as opposed to one of the state-run facilities for orphaned children, would there be a difference? Definitely, all of your opinions, philosophies, values, and ethics would be worlds apart.
Our dedication to arms-building reflects our personal insecurity and our lack of faith. God is Lord of History and efforts to make peace build His Kingdom.
When we put on the full armor of God, we are prepared to not fight the wars of the world, but to withstand the world's hostilities, even as we fight for God's peace.
Why did the common people perceive Jesus' authority as being greater than the Scribes and Pharisees?


Do you take kids out of school during term time to save money on holidays? Well, that could be about to stop!
Parents at a UK school are risking fines of £1,000 per child – and per parent – if their child skips school to go on holiday.
That's £4,000 (over AU$7,000) for a family with two children and two parents. AY CARAMBA! Should it happen here too?
The current fine system in place in Lancashire, UK, for taking children on holiday during term time isn't working so they're pulling out the big guns. Is it too extreme though? And what happens if our schools follow?
Children skipping school for unauthorised holidays or breaks during the term isn't taken lightly in the English county of Lancashire, it appears. Last year the council issued 7,575 fines at a fixed rate of £120 (around AU$216) per child. This was nearly 700 more fines that the previous year, prompting a new get-tough approach.
In order to deter parents from taking trips when it suits them instead of during official school holiday periods, Lancashire County Council has now upped the fine to £1,000 per child, per parent. So if you have two kids and two parents, that's £4,000 (over AU$7,000) your school-skipping family needs to fork out. This means any cash you save NOT travelling in school holidays goes straight back to the school – and then some.
The controversial new system aims to crack down on the number of kids missing classes. It's currently in the pilot stage, but is expected to spread to other schools at any moment. And we're pretty sure there will be a LOT of unhappy campers.
Going on holiday during school term is the only way many Aussie families can afford a break. Flights and accommodation are usually thousands of dollars more expensive during peak school holiday times. But do you get in trouble here if skipping school for holidays?
Well, the rules are different in each state and territory, but there aren't any strict fines or other penalties in place for taking kids on holiday in term time. It IS frowned upon and discouraged though – particularly in New South Wales, Queensland and Tasmania. Most schools require advance notice of any scheduled breaks outside of school holidays. Parents have been fined for allowing truancy, but those cases don't involve family holidays. So while schools and officials say "don't do it", there's no real rules to stop it.
While parents may not think much of kids skipping a week or two here and there (especially in the younger years), the reason it's viewed so negatively by the education system is because children can suffer from long absences – missing out on important lessons and falling behind academically, or even socially. So even though there isn't any financial consequences for us Aussies taking advantage of the discount family travel packages in term dates, thinking about how it might affect your children at school is something to consider.
On the flip side, travelling to new places and experiencing different cultures and people can benefit a child's wider education. It sparks a lot of new questions and conversations – so there are some positives to doing it as well.
If you want to take your child out of school this year for a family holiday (or another valid reason), the best thing you can do is chat to your child's teacher first. Then write an official letter to the school advising of the dates they will be absent and why. The teachers may recommend some homework so they don't fall behind in class. This is probably more on a case-by-case basis looking at both the individual child and the school requirements.
Thinking about taking a family holiday this year but not sure if it will fall in or out of term? Here are all the Australian school term dates for 2019 to help your get organised.


Sun Kwong Works - products including fishing rods , fishing reels, fishing lures and fishing accessory.
Isohk; 磯釣人網站 - 磯釣資訊, 最新釣具, 釣手專訪, 店鋪專區, 釣友互動區.
Triton Fishing Equipment Co.; 釣魚發燒友 - 漁具零售經營漁具的連鎖店,並生產Albana品牌漁具、漁竿、玉柄、漁鮫、浮波、水中、套裝浮波、漁絲、炭絲、布線、鉤假餌,誘餌粉,生餌,竿架,釘鞋。 Lures, rods, landing nets, reels, floats, suichuu, float sets, hooks, dyneema boots, bait powder, bait, rod stands.
Big Fish Iso Club; 大漁磯社 - 一個結交五湖四海釣魚發燒友的天地.
The Hong Kong Amateur Fishing Society Ltd.;香港業餘釣魚會 - 政府註冊非謀利社團, 受社團條例監管. 會員來自社會各階層,會址為自置物業, 每月定期舉辦釣魚活動, 歡迎各界人仕參加.


text:
Man of the Year is a 2002 American black comedy film directed by Straw Weisman, starring John Ritter.

Cast
 John Ritter as Bill
 Jade Carter as Jim
 Adria Dawn as Chloe
 Brian Cousins as Phil
 Heidi Mark as Carol
 Idalis DeLeón as Joan
 Clayton Landey as Stuart
 Khrystyne Haje as Vanessa
 Danny Ponce as Mickey
 Lin Shaye as Flora
 Kathleen Gati as Ella
 Leeza Gibbons as The Reporter
 Archie Hahn as Nick
 Amy Hill as The Maid
 Jon Jacobs as Johnathan
 Shawnee Free Jones as Anna
 Samantha Lloyd as Sylvia
 Ivo Lopez as The Butler
 Kristen Miller as Sally
 Jack Mosshammer as Parker
 Oliver Muirhead as Reg
 Annie Sorell as Shauna
 Rebecca Harrell Tickell as Donna
 James Wilder as Vaughn
  as Zarita

Reception
Robert Koehler of Variety wrote that while the cast "proves improvisationally capable", the plot is "rather conventional".

Kevin Thomas of the Los Angeles Times wrote that Weisman "slices and dices his images to such an extent that it takes a lot of time for the story lines and the key characters and their tangled and changing relationships to emerge with any clarity", and that "when it becomes possible to identify the people and keep track of them, they by and large prove to be generic characters rather than distinctive individuals."

References

External links

American black comedy films
2002 black comedy films
2002 films

redpajama_set_name: RedPajamaWikipedia


on May 15, 2018 at 19:26 UTC ( #1214580=note: print w/replies, xml ) Need Help??
in reply to Re^4: Goto-labels for exception handling?
in thread Goto-labels for exception handling?
Personally, when it helps readability and maintainability, I have used goto - just very very rarely. Usually, where goto might be used, last can be used, though sometimes requires also using an error variable.
As for "missing receptors", the only idea I have come up with is to make sure that all "goto" labels are unique. A major problem doing this is finding all the labels. (Maybe Perl::Critic can help with this.) Pre- or post- fixing labels can reduce collisions, but this is very tedious extra work. Maybe defining Pluggable keywords, for example, throw and catch could automate this.
Comment on Re^5: Goto-labels for exception handling?


Looking for Drug Rehab and treatment centers in Brittany, Louisiana?
There are numerous drug and alcohol treatment centers options available to people residing in the Brittany area. You will need to recognize each of the types of treatment choices that exist in Brittany, AB., in order to choose the suitable rehab approach for yourself or a loved one. Choosing the right alcohol and drug rehabilitation facility in Brittany is the central element in the treatment of substance abuse, addiction and alcoholism. The following information will help you to recognize your numerous rehabilitation choices allowing an individual to have the best possibility of a successful end result.
Let's check out the many drug rehab centers in Brittany, Louisiana options that correlate with the condition of the person seeking rehab.
Inpatient alcohol and drug rehabilitation in Brittany, AB. can be a rehab choice best in case you will need health-related intervention in the course of treatment or clients with substantial substance abuse histories. People can develop physical and mental dependence to alcohol and drugs even after a short period of time, so inpatient alcohol and drug rehabilitation in Brittany is among the most beneficial treatment choice in virtually all situations. Because of substance abuse and addiction, men and women will most likely struggle to recover using the minimal solutions made available from outpatient rehabilitation centers in Brittany, Louisiana where alcohol and drugs are still easily obtainable when they leave the outpatient center. In addition, people in treatment who receive outpatient rehabilitation as an alternative to inpatient drug and alcohol rehabilitation in Brittany remain vulnerable to negative relationships and conditions which can get in the way of their process of recovery. If an individual lives with an abusive companion or continues to maintain relationships which involve substance abuse, any rehab activities in outpatient rehab will be in vain. This is the reason in-patient alcohol and drug rehab in Brittany, AB. will most certainly result in more tangible results that may prove lasting in contrast to an outpatient alcohol and drug rehab center where benefits could be very limited and short-lived.
In Brittany there is both short-term and long-term inpatient drug treatment. Short-term is a 30-day facility, while long-term inpatient drug and alcohol treatment in Brittany, Louisiana is more in depth and rehab lasts 3 to 6 months on average. It is deemed an ideal environment for clients because it is a completely drug free setting where they can heal both physically and mentally without distraction. Preferably, women and men will continue inside a long-term in-patient alcohol and drug rehab center in Brittany for the optimum stretch of time permitted, to be able to handle anything which can cut across their sobriety once they leave rehab. Because of the fact that detoxing and becoming physically stable can require 2-3 weeks alone, the 3 to 6 months in long-term in-patient alcohol and drug rehabilitation in Brittany will be time spent well and a lot more efficient than short-term centers.
The main factor of all if you or a loved one is struggling with a drug abuse or addiction concern is to get it resolved right away, make calls and seek advice from skilled addiction specialists and get an evaluation and rehab options to guarantee the best potential for a full recovery.


text:
Tuvsnäppa (Calidris melanotos) är en vadarfågel som ingår i familjen snäppor. Den häckar på tundra i Nordamerika och nordöstra Asien, möjligen även in i nordöstligaste Europa. Vintertid flyttar de flesta individer till Sydamerika. Under flyttningen ses den regelbundet i västra Europa, med flera fynd årligen i Sverige. Beståndet anses vara livskraftigt.

Utseende
Tuvsnäppan är 19–24 centimeter stor, har en vingbredd på 26–45 centimeter och väger 31–126 gram. Den har gråbrun rygg: brunast hos hanen i sommardräkt, och gråast på vintern. Bröstet är grått med en skarp gräns nedåt. Benen är gulaktiga. Ungfåglarna är mer färgstarkt mönstrade på ovansidan med rödbrun färgning och vita mantelstrimmor.

Tuvsnäppan är lik spetsstjärtad snäppa (Calidris acuminata) som häckar inom en del av tuvsnäppans utbredningsområde, men denna har dock ett annat bröstmönster, diskretare ögonbrynsstreck och gråare hjässa.

Läte
Flyktlätet beskrivs som ett lågt och hårt "drrup" eller "jrrff". Under spelet hörs ett mistlurslikt tutande.

Utbredning
Tuvsnäppan är en flyttfågel som häckar i nordöstra Asien och Nordamerika. Det sibiriska utbredningsområdet kan sträcka sig västerut in i europeiska delen av Ryssland, åtminstone oregelbundet. Den häckar troligen årligen på Svalbard och har noterats häcka i norra Skottland.

Tuvsnäppan är en långväga flyttfågel. De nordamerikanska och de flesta asiatiska fåglarna övervintrar i Sydamerika, men några asiatiska häckfåglar övervintrar i Australien och Nya Zeeland. Den flyttar också sällsynt genom Västeuropa. Spridda fynd har också gjorts i Afrika, Kazakstan, Indien, Malaysia, Indonesien och de flesta delar av Stilla havet.

Tuvsnäppans flyttmönster kan liksom många andra fåglar som häckar i Arktis ha påverkats av växthuseffekten. För hundra år sedan passerade tuvsnäppor genom norra Ohio i början eller mitten av maj och igen i slutet av augusti. Idag ses de allra flesta redan i april och de flesta fåglar återvänder inte förrän mitten av september.

Tuvsnäppan i Europa
Tuvsnäppan observeras ofta i Västeuropa och kategoriseras inte som ovanlig på Irland och i Storbritannien. Möjligen är det asiatiska häckfåglar som passerar Europa på väg till övervintringsområden i Sydafrika. I Sverige är tuvsnäppan en sällsynt men regelbunden gäst som ses med flera exemplar årligen.

Systematik
Genetiska studier visar att tuvsnäppan är närmast släkt med de nordamerikanska småvadarna tundrasnäppa och sandsnäppa, men även med den utseendemässigt avvikande prärielöparen. Tidigare troddes den stå nära spetsstjärtad snäppa som den liknar i utseendet, men denna är avlägset släkt och står närmare myrsnäppan och brushanen. Tuvsnäppan är monotypisk, det vill säga att den inte delas in i några underarter.

Ekologi
Tuvsnäppan häckar på sumpig tundra. Under flytten och vintertid påträffas tuvsnäppan normalt vid sötvatten. Den äter mestadels insekter och andra ryggradslösa djur. Under parningsleken blåser hanen upp sitt bröst. Tuvsnäppan lägger sitt bo på marken och lägger oftast fyra ägg.

Man har funnit att tuvsnäppan i mycket sällsynta fall kan hybridisera med spovsnäppa (Calidris ferruginea). Deras avkomma kallas då för coxsnäppa (C. melanotos X C. ferruginea).

Tuvsnäppan och människan

Status och hot
Arten har ett stort utbredningsområde och en stor population med stabil utveckling. Utifrån dessa kriterier kategoriserar IUCN arten som livskraftig (LC). Världspopulationen uppskattas till 25 000–100 000 individer.

Namn
Tuvsnäppan beskrevs som art av Louis Jean Pierre Vieillot 1819 som Tringa melanotos. Det vetenskapliga artnamnet ''melanotos betyder "svartryggad", av grekiskans melas (μελας) för "svart" och ändelsen -nōtos (-νωτος) för "tillhörande ryggen". Fågeln har på svenska även kallats gråbröstad snäppa.

 Referenser Texten bygger bland annat på översättningar från engelskspråkiga Wikipedias artikel Pectoral Sandpiper och finskspråkiga Wikipedia artikel Palsasirri, läst 17 september 2005 Noter

 Källor
 Hayman, Marchant & Prater (1986) Shorebirds: an Identification Guide to the Wader of the World'',

Externa länkar

 Bilder och filmer på Internet Bird Collection

 Läten på xeno-canto.org

Snäppor
Fåglar i palearktiska regionen
Fåglar i nearktiska regionen
Fåglar i neotropiska regionen
Fåglar i australiska regionen


In cooperation with the Austrian Federal Railways (OeBB) and the Austrian Ministry for Infrastructure (BMVIT), the International Institute for Information Design (IIID) is organising a worldwide unique conference in the city centre of Vienna.
"Barrierfree information for public transport" is the second in a series of "Expert Forums on Traffic Guiding Systems". The focus of this year's event will be on ways of making public transportation accessible in the full meaning of the word. Not only barrierfree architecture which is slowly becoming the norm, but also barrierfree information that enables everyone, handicapped or not, to swiftly find their way around airports, train stations, bus terminals or parking lots, and to track down without delay any relevant pieces of information such as time-tables, ticket prices or departure and arrival platforms/bays with ease.
Top-notch experts from all over Europe (including information design, web and graphic design professionals, public transport authorities, firms involved in the production and development of ticket vending machines, display manufacturing and passenger information systems as well as experts concerned with the needs of handicapped travellers) will be presenting and discussing the latest developments in the area of barrierfree information in the area of public transport.
For further information, please go to www.iiid.net or send an email to christopher.hanacek@iiid.net.


text:
Тамаш Берзица (, р.15 августа 1975) — венгерский борец греко-римского стиля, призёр чемпионатов мира и Европы.

Биография
Родился в 1975 году в Залаэгерсеге. В 1995 году занял 22-е место на чемпионате мира. В 1996 году занял 9-е место на чемпионате Европы, а также принял участие в Олимпийских играх в Атланте, где стал 6-м. В 1997 году стал серебряным призёром чемпионата мира, а на чемпионате Европы занял 7-е место. В 1998 году занял 9-е место на чемпионате Европы, и 12-е - на чемпионате мира. В 1999 году стал серебряным призёром чемпионата Европы, а на чемпионате мира занял 5-е место. В 2000 году занял 13-е место на чемпионате Европы, а также принял участие в Олимпийских играх в Сиднее, где стал 14-м. В 2001 году опять занял 5-е место на чемпионате мира и 13-е - на чемпионате Европы. В 2002 году и на чемпионате мира, и на чемпионате Европы занял 5-е места. В 2003 году занял 16-е место на чемпионате мира. В 2004 году принял участие в Олимпийских играх в Афинах, но занял в итоге лишь 8-е место.

Примечания

Ссылки

Борцы на летних Олимпийских играх 1996 года
Борцы на летних Олимпийских играх 2000 года
Борцы на летних Олимпийских играх 2004 года
Борцы Венгрии


What do people like to share on Facebook, Twitter, Instagram, Pinterest, and LinkedIn?
That's an easy question for anyone with a social media channel. It's mostly, pictures, images, and videos. I'd say that about five our of every 10 posts that are shared are photos, memes, or videos.
Some people like to share opinions including their own. About 1/4 of all social media posts that are share are opinion or statements revealing opinion, belief, and values. This would include reviews on brands, products, and services.
Nearly 504% of the "opinions" shared are focused on changing minds, compelling people to like or dislike products, change opinions, or encourage action such as "vote for Bernie".
Other things people like to share on social media networks are status updates, links to articles of interest, personal recommendations about the things they like, news items, other people's posts, and upcoming events.
Content marketing is real big right now. If it wasn't there certainly wouldn't be bloggers earning thousands every month.
And one of your biggest questions is probably how do they do it.
The first and the second component, however, go hand by hand. In order to get search engine traffic and in order to draw people's attention on the social networks you need namely content.
Content isn't created equally, however. Successful blogging and social media marketing don't come down to simply writing, publishing and sharing whatever's on your mind.
And today's post is all about helping you discover what the best types of content in the social and the blogging world are.
Some of my longest posts are the ones that have received the most shares.
If you start right off the bat with precise advice and step-by-step instructions on how to do something, you sure are on the right path.
Because it tells people exactly what to do!
One of the ways to get Facebook traffic is by setting up a Facebook fan page. However in order to make your page a success, you need to post more than links to your own articles.
There are lots of ways to increase the visibility of your fan page, and humor is a sure-fire one. People love it and they'd be especially inclined to click the like button if your topics aren't all that fun in general.
In order to get the attention of your fans, you have to spice things up a bit every now and then. And one of the biggest mistakes that online businesses and internet marketers make is that they believe everything they post should be strictly official.
That's plain wrong. Prove people you are a living person who actually has that thing called emotions!
First because it makes sense and is something others can relate to and secondly because it is kinda funny.
If you are into affiliate arketing you should know what importance product reviews hold. For those of you who haven't, the idea is simple.
As a marketer the chances are you've tried lots of tools to help you improve results. Although most are probably free, there might just be some premium ones.
And since affiliate marketing is pretty much the best way to monetize your blog, you could write an in-depth review of the products you like and place affiliate links within. Those kinds of reviews convert far better than a banner in the sidebar, plus if they are well-written, lots of folks will take a minute to share them.
So in the end you have some money in your pockets and some traffic from all the social shares.
If you've actually chosen useful tools and have grounded your opinion, you are almost sure to end up with a post that goes viral.
And again why is that so?
You definitely know about the importance of creating engagement and building relationships. After all when it comes to social media, building real contacts and NOT simply tweeting your message over and over is how you spin the wheel.
And sometimes the simple things are the ones that work best.
What is the most obvious way to create a communication channel?
Being the one to ask a question!
You might think that folks on social media are quite passive, but you'd be wrong. Only when you start seeking feedback, you will realize that people are far more willing to share their thoughts and get in touch with you than you think.
Twice every week pose a question that is relevant to your niche on both your Facebook page and on Twitter. Wait for reactions and don't forget to reply back and give your own thoughts!
Namely those seemingly small details might just end up building your credibility!
Similarly to funny pictures that people can in one way or another relate to, quotes,especially the ones that come from famous figures, tend to get a lot of exposure.
That is why quotes should absolutely be the next type of content to incorporate in your social media streams alongside the links you post to your own articles. Just make sure you post the quotes in the form of an image rather than plain text – that results in pretty much double and even triple the usual thumb ups.
You will find a ton of posterized quotes if you simply look them up in Google's image search.
NOTE: The perfect dimensions for Google Plus images are 495 x 370 and for Facebook images 403 x 403.
That's pretty much it guys.
If you take the time to incorporate all five content types in your blogging and social media strategy, you are sure to see an improvement in your overall stats.
Content marketing is a powerful weapon, and if you don't have the time to work on your site, check some online marketing services, which are indeed a valid and alternative solution.
What makes an article shareable?
When do you decide you should click the retweet button and share the piece you just read with your audience?


CERTIFIED Mercedes-Benz GLS450, Black over Espresso Brown, only 4,700 miles! 5 year, Unlimited mileage warranty! Featuring the Premium Package with Navigation, Smartphone Integration, Sirius Satellite Radio, Multi-Color Ambient Lighting with Illuminated Door Sills, Keyless-GO, Lighting Package with Adaptive Highbeam Assist and Full LED Headlamps, Appearance Package with 20" Wheels and Illuminated Running Boards, Lane Tracking Package with Blind Spot Assist and Lane Keeping Assist, Parking Assist Package with Active Parking Assist and Surround View Camera, Illuminated Star, Chrome Hood Fin Covers, Heated/Cooled Front Cup Holders, Panorama Sunroof, Heated Steering Wheel, Trailer Hitch, Harmon/Kardon LOGIC7 Surround Sound System, Power Easy-Entry, Power Rear Quarter Windows, and much more! Call Mercedes-Benz of North Olmsted for more information, 440-716-2700!


"Specially created by Maurizio Cattelan in collaboration with fellow countryman Pierpaolo Ferrari for Cattelan's major retrospective at the Guggenheim Museum in New York City, Toilet Paper 4 is a brilliant new creation from the aberrant, animated mind of the Italian-born provocateur, mischief-maker and macabre witness to our times. Published by Deste, this part artist's book, part magazine contains no text; only full spreads of color photographs with imagery that often appropriates the slick production values of commercial photography to deliver dreamlike (or nightmarish) images that are as appropriate for the coffee table as they are for the WC. In an interview with Vogue Italia, Ferrari said that "the magazine springs from a passion/obsession that Maurizio and I have in common. Each picture springs from an idea, even a simple one, and then becomes a complex orchestration of people who build tableaux vivants. This project is also a sort of mental outburst." -- publisher's statement.


text:
OUR TEAM▼
Greg Jessie
ABOUT CNI 1
Learn more about our company on this page
William (Bill) Handy Jr. | Founder & President CNI1
As the creative force and founder of Consulting Network Investments (CNI), Mr. William (Bill) Handy Jr. has brought style and content to the Urban and Hip Hop Entertainment Industry, with emphasis in management, consulting, concert promotions, and event merchandising.
Handy's career started in the late 1980's as the West Coast road manager of Motown recording artists "The Mary Jane Girls". As he progressed in the music industry, he became and assistant executive producer for Columbia Records' artist, Richie Haven.
In the early 90's, Handy decided to form a company, Veragon Productions with Donald Lazar the creator of such films as "Friday the 13th" and "Kickboxing", starring VanDam. Handy was responsible for the introduction of Russell Simmons' Def Jam artist "YNV' and Death Row's Platinum artist "Snoop Doggy Dogg" to the entertainment industry .In 1993, Handy incorporated Veragon with a new company Steam Records that was headed by John Bult, Chairman of Paine Webber International.
Handy was named VP of the A&R Department for the company. Handy was the primary consultant to Ruthless Records, CEO/ Artist Easy-E last platinum record project, "Real Compton City G's, as well as Outburst Records' artist Domino. Handy has handled merchandising rights for platinum artist "Blackstreet", "Bone Thugs- N-Harmony", and the world famous Tupac Shakur.
In 1998, he decided to expand his career to film in which Handy executive produced a short film called, "Room without Doors" starring Michael Beech. This film won the New York Film Festival Award, which landed the project on Showtime. He has also co-wrote a Feature Film titled "Bet They Don't Come, and has executive produced a series of comedies called the "Funny Further Muckers"- with stars like AJ Jamal, TP Hems, Spencer, and Larry B. Scott star of the movie the "Nerds".
Handy ended 1999 with a bang and executive produced famed clothing designer, Karl Kani' s New Years Eve party for his 10th anniversary as a successful designer .
Handy is currently consulting the manager of Steven Seagal, Mr. Eddie Wenrick of Mpeg, and is currently the business manager to Tichina Arnold, formally "Pam on the Martin Show", and assisting Ragina King "Enemy of the State" on her new commercial ventures.
Create a website with SnapPages

redpajama_set_name: RedPajamaCommonCrawl


text:
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Xunit;

namespace System.Linq.Parallel.Tests
{
    public static class ParallelEnumerableTests
    {
        //
        // Null query
        //
        [Fact]
        public static void NullQuery()
        {
            AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable<int>)null).AsParallel());
            AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable)null).AsParallel());
            AssertExtensions.Throws<ArgumentNullException>("source", () => ((Partitioner<int>)null).AsParallel());
            AssertExtensions.Throws<ArgumentNullException>("source", () => ((int[])null).AsParallel());

            AssertExtensions.Throws<ArgumentNullException>("source", () => ParallelEnumerable.AsOrdered((ParallelQuery<int>)null));
            AssertExtensions.Throws<ArgumentNullException>("source", () => ParallelEnumerable.AsOrdered((ParallelQuery)null));
            AssertExtensions.Throws<ArgumentNullException>("source", () => ParallelEnumerable.AsUnordered<int>((ParallelQuery<int>)null));
        }

        //
        // Range
        //
        public static IEnumerable<object[]> RangeData()
        {
            int[] datapoints = { 0, 1, 2, 16, };
            foreach (int sign in new[] { -1, 1 })
            {
                foreach (int start in datapoints)
                {
                    foreach (int count in datapoints)
                    {
                        yield return new object[] { start * sign, count };
                    }
                }
            }
            yield return new object[] { int.MaxValue, 0 };
            yield return new object[] { int.MaxValue, 1 };
            yield return new object[] { int.MaxValue - 8, 8 + 1 };
            yield return new object[] { int.MinValue, 0 };
            yield return new object[] { int.MinValue, 1 };
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_UndefinedOrder(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count);

            IntegerRangeSet seen = new IntegerRangeSet(start, count);
            Assert.All(query, x => seen.Add(x));
            seen.AssertComplete();
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_AsOrdered(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count).AsOrdered();

            int current = start;
            Assert.All(query, x => Assert.Equal(unchecked(current++), x));
            Assert.Equal(count, unchecked(current - start));
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_AsSequential(int start, int count)
        {
            IEnumerable<int> query = ParallelEnumerable.Range(start, count).AsSequential();

            int current = start;
            Assert.All(query, x => Assert.Equal(unchecked(current++), x));
            Assert.Equal(count, unchecked(current - start));
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_First(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count);

            if (count == 0)
            {
                Assert.Throws<InvalidOperationException>(() => query.First());
            }
            else
            {
                Assert.Equal(start, query.First());
            }
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_FirstOrDefault(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count);

            Assert.Equal(count == 0 ? 0 : start, query.FirstOrDefault());
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_Last(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count);

            if (count == 0)
            {
                Assert.Throws<InvalidOperationException>(() => query.Last());
            }
            else
            {
                Assert.Equal(start + (count - 1), query.Last());
            }
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_LastOrDefault(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count);

            Assert.Equal(count == 0 ? 0 : start + (count - 1), query.LastOrDefault());
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_Take(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count).Take(count / 2);

            // Elements are taken from the first half of the list, but order is indeterminate.
            IntegerRangeSet seen = new IntegerRangeSet(start, count / 2);
            Assert.All(query, x => seen.Add(x));
            seen.AssertComplete();
        }

        [Theory]
        [MemberData(nameof(RangeData))]
        public static void Range_Skip(int start, int count)
        {
            ParallelQuery<int> query = ParallelEnumerable.Range(start, count).Skip(count / 2);

            // Skips over the first half of the list, but order is indeterminate.
            IntegerRangeSet seen = new IntegerRangeSet(start + count / 2, (count + 1) / 2);
            Assert.All(query, x => seen.Add(x));
            seen.AssertComplete();
            Assert.Empty(ParallelEnumerable.Range(start, count).Skip(count + 1));
        }

        [Fact]
        public static void Range_Exception()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Range(0, -1));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Range(-8, -8));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Range(int.MaxValue, 2));
        }

        //
        // Repeat
        //
        public static IEnumerable<object[]> RepeatData()
        {
            int[] datapoints = new[] { 0, 1, 2, 16, 128, 1024 };
            foreach (int count in datapoints)
            {
                foreach (int element in datapoints)
                {
                    yield return new object[] { element, count };
                    yield return new object[] { (long)element, count };
                    yield return new object[] { (double)element, count };
                    // [ActiveIssue("https://github.com/xunit/xunit/issues/1771")]
                    //yield return new object[] { (decimal)element, count };
                    yield return new object[] { "" + element, count };
                }
                yield return new object[] { (object)null, count };
                yield return new object[] { (string)null, count };
            }
        }

        [Theory]
        [MemberData(nameof(RepeatData))]
        public static void Repeat<T>(T element, int count)
        {
            ParallelQuery<T> query = ParallelEnumerable.Repeat(element, count);

            int counted = 0;
            Assert.All(query, e => { counted++; Assert.Equal(element, e); });
            Assert.Equal(count, counted);
        }

        [Theory]
        [MemberData(nameof(RepeatData))]
        public static void Repeat_Select<T>(T element, int count)
        {
            ParallelQuery<T> query = ParallelEnumerable.Repeat(element, count).Select(i => i);

            int counted = 0;
            Assert.All(query, e => { counted++; Assert.Equal(element, e); });
            Assert.Equal(count, counted);
        }

        [Fact]
        public static void Repeat_Exception()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat(1, -1));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat((long)1024, -1024));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat(2.0, -2));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat((decimal)8, -8));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat("fail", -1));
            Assert.Throws<ArgumentOutOfRangeException>(() => ParallelEnumerable.Repeat((string)null, -1));
        }

        [Fact]
        public static void Repeat_Reset()
        {
            const int Value = 42;
            const int Iterations = 3;

            ParallelQuery<int> q = ParallelEnumerable.Repeat(Value, Iterations);

            IEnumerator<int> e = q.GetEnumerator();
            for (int i = 0; i < 2; i++)
            {
                int count = 0;
                while (e.MoveNext())
                {
                    Assert.Equal(Value, e.Current);
                    count++;
                }
                Assert.False(e.MoveNext());
                Assert.Equal(Iterations, count);

                e.Reset();
            }
        }

        //
        // Empty
        //

        [Fact]
        public static void EmptyStruct() => Empty<int>();

        [Fact]
        public static void EmptyClass() => Empty<string>();

        private static void Empty<T>()
        {
            Assert.Empty(ParallelEnumerable.Empty<T>());
            Assert.False(ParallelEnumerable.Empty<T>().Any(x => true));
            Assert.False(ParallelEnumerable.Empty<T>().Contains(default(T)));
            Assert.Equal(0, ParallelEnumerable.Empty<T>().Count());
            Assert.Equal(0, ParallelEnumerable.Empty<T>().LongCount());
            Assert.Equal(new T[0], ParallelEnumerable.Empty<T>().ToArray());
            Assert.Equal(new Dictionary<T, T>(), ParallelEnumerable.Empty<T>().ToDictionary(x => x));
            Assert.Equal(new List<T>(), ParallelEnumerable.Empty<T>().ToList());
            Assert.Throws<InvalidOperationException>(() => ParallelEnumerable.Empty<T>().First());
            Assert.Throws<InvalidOperationException>(() => ParallelEnumerable.Empty<T>().Last());
        }
    }
}


text:
Linkage disequilibrium--understanding the evolutionary past and mapping the medical future
Nat Rev Genet. 2008 Jun;9(6):477-85. doi: 10.1038/nrg2361.
Montgomery Slatkin 1
1 Department of Integrative Biology, University of California, Berkeley, California 94720-3140, USA. slatkin@berkeley.edu
DOI: 10.1038/nrg2361
Linkage disequilibrium--the nonrandom association of alleles at different loci--is a sensitive indicator of the population genetic forces that structure a genome. Because of the explosive growth of methods for assessing genetic variation at a fine scale, evolutionary biologists and human geneticists are increasingly exploiting linkage disequilibrium in order to understand past evolutionary and demographic events, to map genes that are associated with quantitative characters and inherited diseases, and to understand the joint evolution of linked sets of genes. This article introduces linkage disequilibrium, reviews the population genetic processes that affect it and describes some of its uses. At present, linkage disequilibrium is used much more extensively in the study of humans than in non-humans, but that is changing as technological advances make extensive genomic studies feasible in other species.
Chromosome Mapping*
Evolution, Molecular*
Genetics, Medical*
Linkage Disequilibrium*
Population / genetics*
R01-GM40282/GM/NIGMS NIH HHS/United States


Lifespan strategies refer to techniques or methods students use to learn, develop workplace skills, manage time, study, or take tests, navigate the balance of school, work, and daily living, and many others. A student meets individually with a SLC Learning Specialist or Strategist; strategies covered depend on the student's particular learning needs. It is our expectation that most students will be able to apply these strategies independently after several sessions and are taught not only within the context of school but also work and life in general.


text:
Litigation challenging EPA administrative action
Consumer products manufacturer
Our attorneys successfully represented a major consumer products company in federal district and appellate courts in Washington, D.C. The Company brought an action against the U.S. Environmental Protection Agency in federal district court challenging the manner in which the Agency was implementing its Risk Mitigation Decision for Ten Rodenticides ("RMD"). In a landmark decision that resolved an important issue that had remained unsettled for more than 30 years, the district court held that EPA may not bring an enforcement action in lieu of the administrative cancellation procedures set forth in FIFRA Section 6.
Lawrence E. Culleen
lawrence.culleen@arnoldporter.com
Find more content tagged:
Philip Morris USA
Price v. Philip Morris, Inc., 43 N.E. 3d 53 (Ill. 2015) (Ill. S. Ct.)
Avon Products, Inc.
Avon Anti-Aging Skincare Creams and Products Marketing and Sales Practices Litigation
Smith v. Philip Morris Inc.


text:
February 20, 1832 to March 3, 1832
The Forgotten Plague
Date(s): March 1, 1832 Location: ROSS, Ohio Tag(s): letter, influenza, epidemic, Ohio, 1832
In present day, the "flu" is more commonly consider an inconvenient virus, which puts one out of commission for a day or two. But in 1832, influenza frequently ran its full course causing respiratory failure and death. In a letter from Fanny Wilson Johnson to her sister Eliza, Fanny discussed their father's health, church happenings, and town affairs. Amidst her small talk, written sideways...
Worcester v. Georgia Changes Indian Relations with Government
Date(s): February 20, 1832 to March 3, 1832 Location: Washington City, District of Columbia Tag(s): Chief Justice Marshall, American Indian Policy, Cherokee Indians
Cherokee leaders appealed to the Supreme Court in the monumental case Worcester v. Georgia ruling in favor of the Cherokee people and missionary Samuel Worcester and overturning a previous Georgia law from 1831. Chief Justice John Marshall's majority opinion stated, "Although it had surrendered sovereign powers in those treaties with the United States, the Cherokee Nation remains...
Presbyterianism and the Creation of Cherokee Sovereignty
Date(s): July 6, 1831 to March 3, 1832 Location: INDIAN LANDS, Georgia Tag(s): Church/Religious-Activity, Government, Law, Native-Americans
On July 6th, 1831 Presbyterian ministers of the American Board of Commissioners for Foreign Missions Elizur Butler and Samuel Austin Worcester began their 110 mile march to a Georgia penitentiary from the neighboring Cherokee lands in chains. Arrested in New Echota by the Georgia Guard and detained indefinitely, Butler and Worcester were charged with the direct violation of a new Georgia state law...


A Different Kind of Music | Thrive!
In the United States we have some fairly standard ways of defining success and failure. Success is a good position. Success is a good salary. Success is power. Success is being the boss, the big fish.
Success in America is also often defined by vibrancy. It is being healthy — on the youngish side — strong, beautiful.
Success is also things. It is stuff — good clothing, a good house, a good neighborhood, a luxury car, expensive jewelry, a brag-worthy vacation.
And success in the U.S. is people, families, spouses, marriages, children. It includes "our people," as if we could still own them — housekeepers, maids, lawyers, shoppers, perhaps a trailing retinue of admiring and secretly jealous friends, perhaps some fleshly conquests.
Failure — it is not having these things.
By such definitions many of the people that I know are not successes.
Not to vilify the middle class or the wealthy — there are numerous super excellent people with stuff and fluff and family enough — but many of the smartest, bravest, hardiest, kindest, funniest people I know are unemployed, or formerly employed. They are not wealthy. They are old. They are moms, grandmas, widows, divorced, sick, perhaps lonely. They live in rooms in small houses. They live in small apartments, in other people's houses — in less than desirable neighborhoods — some are in and out of hospitals. They have little, they know relatively few people in the grand scheme of things, they run nothing. People they pay do not prop them up.
And yet, and yet, just yet — how lovely they are.
Bill Holm has put it eloquently. The sunk, lost, unimportant, Whitman's "numberless" — they play a kind of beautiful music. They play the gorgeous, melodic, halting and yet lovely "music of failure." Perhaps they are failures as defined by our pre-paid, power-laid, beauty-bade, family-weighed American dream. But when these lesser lights are judged by their resilience, their good humor, their kindness, their godliness, their grit and their gumption — they play gorgeous music.
To me it sounds like the voices of some of my most brave, fun, resilient friends.


SELLING A RIGHT SIDE NEW AMAL PREMIER 932 CARBURETOR. YOU WILL RECEIVE 1 RIGHT HAND CARBURETOR. THESE CARBS ARE FACTORY SET FOR A DUAL CARB BIKE. THE AMAL COMPANY IS FITTING THESE CARB WITH #3 SLIDE (TO ACCOMMODATE FOR NEW GAS), A 230 MAIN JET, AND A 106 NEEDLE JET. DIRECTIONS AND MAINTENANCE ARE INCLUDED IN THE BOX. ALL YOU HAVE TO DO IS BOLT IT ON AND TUNE IT. AMAL CARBS DO GET TO THE POINT WHERE THEY JUST CANNOT BE REBUILT. TRIUMPHS, NORTON & BSA ARE RELIABLE WHEN EVERYTHING IS CORRECT. IF YOU CARBS ARE THE ORIGINAL CARBS AND HAVE HIGH MILEAGE... IT MAY BE TIME.


text:
Pixable Aims to Change the Way You Browse Facebook Photos
By Sarah Kessler 2011-01-11 08:01:02 UTC
Photo-project startup Pixable is launching a new Facebook app today that looks to change the way the social network's members browse photos online.
The free app allows users to see all of their friend's photos without jumping from profile to profile, browse photos by categories such as "most popular," and get updates when specific friends add or are tagged in new photos.
As apps for sharing photos multiply and photographers upload their snapshots in record numbers, the move to create an organized way to rank and share photos could be a smart one. My 650 Facebook friends have uploaded a total of 107,900 photos, but I haven't heard of a single service that will help me sort them or find the ones that are important to me.
Pixable says it's attempting to fill the same niche in the online photo world that Google and Yahoo filled on the web when the number of web pages started to become overwhelming.
"It's exactly the same with photos in 2010," says CEO and co-founder, Inaki Berenguer regarding the early web's growth rate and need for organization. "Two or three years ago there weren't that many photos online, but now all of those photos are being uploaded. You have a way to access them through your social graph, but it is impossible to keep track of all of them."
Though today's version of the app focuses on Facebook, Pixable plans to add options to pull in friend's' photos from photo services like Flickr and Picasa as well as apps like Picplz and Instagram.
All of these photos would then be ranked using the same algorithm the app currently uses to rank Facebook photos, which takes into account the number of comments, likes, and tags on each photo. Users will be able to review the most popular photos and follow friends' activities across all of their photo-sharing platforms.
Plans for customizable categories would also make browsing friends' photos of "weddings" or "men under age 25" possible. At which point, we think, there's potential for it to become a really important resource in any photo lover's arsenal.
Topics: Facebook, facebook photos, Flickr, photo sharing, Photography, Pixable, Social Media, Startups


text:
3M will stop making hazardous 'forever chemicals' starting in 2025
Leave a Comment / Latest / By millssy
3M, the conglomerate behind Post-It notes and Scotch tape, will stop making controversial per- and polyfluoroalkyl substances (PFAS) by the end of 2025.
The chemicals, commonly known as "forever chemicals," are found in hundreds of household items and used to make coatings and products that can repel water, grease, heat and oil. The most recent science suggests that these chemicals are much more hazardous to human health than scientists had initially thought and probably more dangerous at levels thousands of times lower than previously believed.
In a statement Tuesday, 3M said its decision is "based on careful consideration and a thorough evaluation of the evolving external landscape," acknowledging that regulations are cracking down on the chemicals.
For example, the Environmental Protection Agency announced a proposal earlier this year to label "forever chemicals" as hazardous substances. California also announced a lawsuit recently to recoup the clean-up costs from PFAS.
"While PFAS can be safely made and used, we also see an opportunity to lead in a rapidly evolving external regulatory and business landscape to make the greatest impact for those we serve," said 3M CEO Mike Roman in a statement. "This action is another example of how we are positioning 3M for continued sustainable growth by optimizing our portfolio, innovating for our customers, and delivering long-term value for our shareholders."
The company expects to take a financial hit of about $1.3 billion to $2.3 billion over the next few years because of the PFAS discontinuation. Yet 3M (MMM) said PFAS represents a "small portion" of its revenue.
Over the past decade, chemical manufacturers have voluntarily stopped producing two of the most commonly used forever chemicals, including PFOS and PFOA.
At the federal level, the US Food and Drug Administration phased out the use of certain PFAS chemicals in 2016. The FDA and manufacturers agreed in 2020 to phase out some PFAS chemicals from food packaging and other items that came into contact with food. However, FDA monitoring of the environment showed that the chemicals tend to linger.
– CNN's Jen Christensen contributed to this report.