text:
package org.kie.server.services.jbpm;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.naming.InitialContext;
import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceProviderResolverHolder;
import javax.persistence.spi.PersistenceUnitInfo;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.drools.core.impl.InternalKieContainer;
import org.jbpm.document.service.impl.DocumentImpl;
import org.jbpm.executor.ExecutorServiceFactory;
import org.jbpm.executor.impl.ExecutorImpl;
import org.jbpm.executor.impl.ExecutorServiceImpl;
import org.jbpm.kie.services.impl.AbstractDeploymentService;
import org.jbpm.kie.services.impl.FormManagerService;
import org.jbpm.kie.services.impl.FormManagerServiceImpl;
import org.jbpm.kie.services.impl.KModuleDeploymentService;
import org.jbpm.kie.services.impl.KModuleDeploymentUnit;
import org.jbpm.kie.services.impl.ProcessServiceImpl;
import org.jbpm.kie.services.impl.RuntimeDataServiceImpl;
import org.jbpm.kie.services.impl.UserTaskServiceImpl;
import org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImpl;
import org.jbpm.kie.services.impl.admin.ProcessInstanceMigrationServiceImpl;
import org.jbpm.kie.services.impl.admin.UserTaskAdminServiceImpl;
import org.jbpm.kie.services.impl.bpmn2.BPMN2DataServiceImpl;
import org.jbpm.kie.services.impl.query.QueryServiceImpl;
import org.jbpm.kie.services.impl.utils.PreUndeployOperations;
import org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl;
import org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorManagerUtil;
import org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorMerger;
import org.jbpm.runtime.manager.impl.identity.UserDataServiceProvider;
import org.jbpm.runtime.manager.impl.jpa.EntityManagerFactoryManager;
import org.jbpm.services.api.DefinitionService;
import org.jbpm.services.api.DeploymentService;
import org.jbpm.services.api.ProcessService;
import org.jbpm.services.api.RuntimeDataService;
import org.jbpm.services.api.UserTaskService;
import org.jbpm.services.api.admin.ProcessInstanceAdminService;
import org.jbpm.services.api.admin.ProcessInstanceMigrationService;
import org.jbpm.services.api.admin.UserTaskAdminService;
import org.jbpm.services.api.model.DeployedUnit;
import org.jbpm.services.api.model.ProcessInstanceDesc;
import org.jbpm.services.api.query.QueryMapperRegistry;
import org.jbpm.services.api.query.QueryNotFoundException;
import org.jbpm.services.api.query.QueryService;
import org.jbpm.services.task.HumanTaskServiceFactory;
import org.jbpm.services.task.audit.TaskAuditServiceFactory;
import org.jbpm.services.task.identity.JAASUserGroupCallbackImpl;
import org.jbpm.shared.services.impl.TransactionalCommandService;
import org.kie.api.builder.ReleaseId;
import org.kie.api.builder.model.KieSessionModel;
import org.kie.api.executor.ExecutorService;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.query.QueryContext;
import org.kie.api.task.TaskService;
import org.kie.api.task.UserGroupCallback;
import org.kie.internal.runtime.conf.AuditMode;
import org.kie.internal.runtime.conf.DeploymentDescriptor;
import org.kie.internal.runtime.conf.MergeMode;
import org.kie.internal.runtime.conf.NamedObjectModel;
import org.kie.internal.runtime.conf.ObjectModel;
import org.kie.internal.runtime.conf.RuntimeStrategy;
import org.kie.internal.runtime.manager.deploy.DeploymentDescriptorManager;
import org.kie.internal.task.api.UserInfo;
import org.kie.scanner.KieModuleMetaData;
import org.kie.server.api.KieServerConstants;
import org.kie.server.api.KieServerEnvironment;
import org.kie.server.api.marshalling.MarshallerFactory;
import org.kie.server.api.marshalling.MarshallingException;
import org.kie.server.api.marshalling.MarshallingFormat;
import org.kie.server.api.model.KieServerConfig;
import org.kie.server.api.model.KieServerMode;
import org.kie.server.api.model.Message;
import org.kie.server.api.model.Severity;
import org.kie.server.api.model.definition.QueryDefinition;
import org.kie.server.services.api.KieContainerCommandService;
import org.kie.server.services.api.KieContainerInstance;
import org.kie.server.services.api.KieServerApplicationComponentsService;
import org.kie.server.services.api.KieServerExtension;
import org.kie.server.services.api.KieServerRegistry;
import org.kie.server.services.api.SupportedTransports;
import org.kie.server.services.impl.KieServerImpl;
import org.kie.server.services.jbpm.admin.ProcessAdminServiceBase;
import org.kie.server.services.jbpm.admin.UserTaskAdminServiceBase;
import org.kie.server.services.jbpm.jpa.PersistenceUnitInfoImpl;
import org.kie.server.services.jbpm.jpa.PersistenceUnitInfoLoader;
import org.kie.server.services.jbpm.security.JMSUserGroupAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JbpmKieServerExtension implements KieServerExtension {

    public static final String EXTENSION_NAME = "jBPM";
    private static final String PERSISTENCE_XML_LOCATION = "/jpa/META-INF/persistence.xml";
    private static final String IS_DISPOSE_CONTAINER_PARAM = "jBPMExtensionIsDisposeContainer";

    private static final Logger logger = LoggerFactory.getLogger(JbpmKieServerExtension.class);

    private static final Boolean disabled = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_JBPM_SERVER_EXT_DISABLED, "false"));

    protected static final Pattern PARAMETER_MATCHER = Pattern.compile("\\$\\{([\\S&&[^\\}]]+)\\}", Pattern.DOTALL);

    protected boolean isExecutorAvailable = false;

    protected String persistenceUnitName = KieServerConstants.KIE_SERVER_PERSISTENCE_UNIT_NAME;

    protected KieServerImpl kieServer;
    protected KieServerRegistry context;

    protected DeploymentService deploymentService;
    protected DefinitionService definitionService;
    protected ProcessService processService;
    protected UserTaskService userTaskService;
    protected RuntimeDataService runtimeDataService;
    protected FormManagerService formManagerService;

    protected ProcessInstanceMigrationService processInstanceMigrationService;
    protected ProcessInstanceAdminService processInstanceAdminService;
    protected UserTaskAdminService userTaskAdminService;

    protected ExecutorService executorService;

    protected QueryService queryService;

    protected KieContainerCommandService kieContainerCommandService;

    protected DeploymentDescriptorManager deploymentDescriptorManager = new DeploymentDescriptorManager(persistenceUnitName);
    protected DeploymentDescriptorMerger merger = new DeploymentDescriptorMerger();

    protected List<Object> services = new ArrayList<Object>();
    protected boolean initialized = false;

    protected Map<String, List<String>> containerMappers = new ConcurrentHashMap<String, List<String>>();
    protected Map<String, List<String>> containerQueries = new ConcurrentHashMap<String, List<String>>();

    @Override
    public boolean isInitialized() {
        return initialized;
    }

    @Override
    public boolean isActive() {
        return disabled == false;
    }

    @Override
    public void init(KieServerImpl kieServer, KieServerRegistry registry) {

        this.kieServer = kieServer;
        this.context = registry;
        configureServices(kieServer, registry);

        if (registry.getKieSessionLookupManager() != null) {
            registry.getKieSessionLookupManager().addHandler(new JBPMKieSessionLookupHandler());
        }

        services.add(formManagerService);
        services.add(deploymentService);
        services.add(definitionService);
        services.add(processService);
        services.add(userTaskService);
        services.add(runtimeDataService);
        services.add(executorService);
        services.add(queryService);
        services.add(processInstanceMigrationService);
        services.add(processInstanceAdminService);
        services.add(userTaskAdminService);

        registerDefaultQueryDefinitions();
        initialized = true;
    }

    protected void configureServices(KieServerImpl kieServer, KieServerRegistry registry) {
        KieServerConfig config = registry.getConfig();

        // loaded from system property as callback info isn't stored as configuration in kie server repository
        String callbackConfig = System.getProperty(KieServerConstants.CFG_HT_CALLBACK);

        // if no other callback set, use jaas by default
        if (callbackConfig == null || callbackConfig.isEmpty()) {
            System.setProperty(KieServerConstants.CFG_HT_CALLBACK, "jaas");
            JAASUserGroupCallbackImpl.addExternalUserGroupAdapter(new JMSUserGroupAdapter());
        }

        this.isExecutorAvailable = isExecutorOnClasspath();

        EntityManagerFactory emf = build(getPersistenceProperties(config));
        EntityManagerFactoryManager.get().addEntityManagerFactory(persistenceUnitName, emf);

        formManagerService = new FormManagerServiceImpl();

        // build definition service
        definitionService = new BPMN2DataServiceImpl();

        // build deployment service
        deploymentService = new KModuleDeploymentService();
        ((KModuleDeploymentService) deploymentService).setBpmn2Service(definitionService);
        ((KModuleDeploymentService) deploymentService).setEmf(emf);
        ((KModuleDeploymentService) deploymentService).setIdentityProvider(registry.getIdentityProvider());
        ((KModuleDeploymentService) deploymentService).setManagerFactory(new RuntimeManagerFactoryImpl());
        ((KModuleDeploymentService) deploymentService).setFormManagerService(formManagerService);

        // configure user group callback
        UserGroupCallback userGroupCallback = UserDataServiceProvider.getUserGroupCallback();

        UserInfo userInfo = UserDataServiceProvider.getUserInfo();

        TaskService taskService = HumanTaskServiceFactory.newTaskServiceConfigurator()
                .entityManagerFactory(emf)
                .userGroupCallback(userGroupCallback)
                .userInfo(userInfo)
                .getTaskService();

        // build runtime data service
        runtimeDataService = new RuntimeDataServiceImpl();
        ((RuntimeDataServiceImpl) runtimeDataService).setCommandService(new TransactionalCommandService(emf));
        ((RuntimeDataServiceImpl) runtimeDataService).setIdentityProvider(registry.getIdentityProvider());
        ((RuntimeDataServiceImpl) runtimeDataService).setTaskService(taskService);
        ((RuntimeDataServiceImpl) runtimeDataService).setTaskAuditService(TaskAuditServiceFactory.newTaskAuditServiceConfigurator()
                                                                                .setTaskService(taskService)
                                                                                .getTaskAuditService());
        ((KModuleDeploymentService) deploymentService).setRuntimeDataService(runtimeDataService);

        // build process service
        processService = new ProcessServiceImpl();
        ((ProcessServiceImpl) processService).setDataService(runtimeDataService);
        ((ProcessServiceImpl) processService).setDeploymentService(deploymentService);

        // build user task service
        userTaskService = new UserTaskServiceImpl();
        ((UserTaskServiceImpl) userTaskService).setDataService(runtimeDataService);
        ((UserTaskServiceImpl) userTaskService).setDeploymentService(deploymentService);

        // build query service
        queryService = new QueryServiceImpl();
        ((QueryServiceImpl) queryService).setIdentityProvider(registry.getIdentityProvider());
        ((QueryServiceImpl) queryService).setCommandService(new TransactionalCommandService(emf));
        Function<String, String> kieServerDataSourceResolver = input -> {
            String dataSource = input;
            Matcher matcher = PARAMETER_MATCHER.matcher(dataSource);
            while (matcher.find()) {
                String paramName = matcher.group(1);
                KieServerConfig configuration = context.getStateRepository().load(KieServerEnvironment.getServerId()).getConfiguration();
                dataSource = configuration.getConfigItemValue(paramName, "java:jboss/datasources/ExampleDS");
                logger.info("Data source expression {} resolved to {}", input, dataSource);
            }

            return dataSource;
        };
        ((QueryServiceImpl) queryService).setDataSourceResolver(kieServerDataSourceResolver);
        ((QueryServiceImpl) queryService).init();

        // set runtime data service as listener on deployment service
        ((KModuleDeploymentService) deploymentService).addListener(((RuntimeDataServiceImpl) runtimeDataService));
        ((KModuleDeploymentService) deploymentService).addListener(((BPMN2DataServiceImpl) definitionService));
        ((KModuleDeploymentService) deploymentService).addListener(((QueryServiceImpl) queryService));

        if (config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_DISABLED, "false").equalsIgnoreCase("false")) {
            String executorQueueName = config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_JMS_QUEUE, "queue/KIE.SERVER.EXECUTOR");

            // build executor service
            executorService = ExecutorServiceFactory.newExecutorService(emf);
            executorService.setInterval(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_INTERVAL, "0")));
            executorService.setRetries(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_RETRIES, "3")));
            executorService.setThreadPoolSize(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_POOL, "1")));
            executorService.setTimeunit(TimeUnit.valueOf(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_TIME_UNIT, "SECONDS")));

            ((ExecutorImpl) ((ExecutorServiceImpl) executorService).getExecutor()).setQueueName(executorQueueName);

            ((KModuleDeploymentService) deploymentService).setExecutorService(executorService);
        }

        // admin services
        this.processInstanceMigrationService = new ProcessInstanceMigrationServiceImpl();
        this.processInstanceAdminService = new ProcessInstanceAdminServiceImpl();
        ((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setProcessService(processService);
        ((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setRuntimeDataService(runtimeDataService);
        ((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setCommandService(new TransactionalCommandService(emf));
        ((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setIdentityProvider(registry.getIdentityProvider());

        this.userTaskAdminService = new UserTaskAdminServiceImpl();
        ((UserTaskAdminServiceImpl) this.userTaskAdminService).setRuntimeDataService(runtimeDataService);
        ((UserTaskAdminServiceImpl) this.userTaskAdminService).setUserTaskService(userTaskService);
        ((UserTaskAdminServiceImpl) this.userTaskAdminService).setIdentityProvider(context.getIdentityProvider());
        ((UserTaskAdminServiceImpl) this.userTaskAdminService).setCommandService(new TransactionalCommandService(emf));

        this.kieContainerCommandService = new JBPMKieContainerCommandServiceImpl(context, deploymentService, new DefinitionServiceBase(definitionService, context),
                                                                                new ProcessServiceBase(processService, definitionService, runtimeDataService, context), new UserTaskServiceBase(userTaskService, context),
                                                                                new RuntimeDataServiceBase(runtimeDataService, context), new ExecutorServiceBase(executorService, context), new QueryDataServiceBase(queryService, context),
                                                                                new DocumentServiceBase(context), new ProcessAdminServiceBase(processInstanceMigrationService, processInstanceAdminService, context),
                                                                                new UserTaskAdminServiceBase(userTaskAdminService, context));
    }

    @Override
    public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
        ((AbstractDeploymentService) deploymentService).shutdown();

        if (executorService != null) {
            executorService.destroy();
        }

        EntityManagerFactory emf = EntityManagerFactoryManager.get().remove(persistenceUnitName);
        if (emf != null && emf.isOpen()) {
            emf.close();
        }
    }

    @Override
    public void serverStarted() {
        if (executorService != null) {
            executorService.init();
        }
    }

    @SuppressWarnings("unchecked")
    @Override
    public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES);
        try {
            KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA);
            if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) {
                logger.info("Container {} does not include processes, {} skipped", id, this);
                return;
            }

            boolean hasStatefulSession = false;
            boolean hasDefaultSession = false;
            // let validate if they are any stateful sessions defined and in case there are not, skip this container
            InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer();
            Collection<String> kbaseNames = kieContainer.getKieBaseNames();
            Collection<String> ksessionNames = new ArrayList<String>();
            for (String kbaseName : kbaseNames) {
                ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName);

                for (String ksessionName : ksessionNames) {
                    KieSessionModel model = kieContainer.getKieSessionModel(ksessionName);
                    if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) {
                        hasStatefulSession = true;
                    }

                    if (model.isDefault()) {
                        hasDefaultSession = true;
                    }
                }
            }
            if (!hasStatefulSession) {
                logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this);
                return;
            }
            ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId();

            KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion());

            if (!hasDefaultSession) {
                unit.setKbaseName(kbaseNames.iterator().next());
                unit.setKsessionName(ksessionNames.iterator().next());
            }
            // override defaults if config options are given
            KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems());

            String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY);
            if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) {
                unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy));
            }
            String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE);
            if (mergeMode != null && !mergeMode.isEmpty()) {
                unit.setMergeMode(MergeMode.valueOf(mergeMode));
            }
            String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION);
            unit.setKsessionName(ksession);
            String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE);
            unit.setKbaseName(kbase);

            // reuse kieContainer to avoid unneeded bootstrap
            unit.setKieContainer(kieContainer);

            addAsyncHandler(unit, kieContainer);

            if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) {
                logger.debug("Registering TaskCleanUpProcessEventListener");
                addTaskCleanUpProcessListener(unit, kieContainer);
            }

            if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) {
                logger.debug("Registering BAMTaskEventListener");
                addTaskBAMEventListener(unit, kieContainer);
            }

            if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) {
                logger.debug("Registering IdentityProviderAwareProcessListener");
                addProcessIdentityProcessListener(unit, kieContainer);
            }

            deploymentService.deploy(unit);
            // in case it was deployed successfully pass all known classes to marshallers (jaxb, json etc)
            DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier());
            Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses());
            // add custom classes that come from extension itself
            customClasses.add(DocumentImpl.class);
            kieContainerInstance.addExtraClasses(customClasses);

            // add any query result mappers from kjar
            List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader());
            if (addedMappers != null && !addedMappers.isEmpty()) {
                containerMappers.put(id, addedMappers);
            }
            // add any query param builder factories
            QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader());

            // add any query definition found in kjar
            Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json");
            while (queryDefinitionsFiles.hasMoreElements()) {

                URL definitionsURL = queryDefinitionsFiles.nextElement();
                InputStream qdStream = definitionsURL.openStream();

                loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id);
            }

            logger.debug("Container {} created successfully by extension {}", id, this);
        } catch (Exception e) {
            Throwable root = ExceptionUtils.getRootCause(e);
            if (root == null) {
                root = e;
            }
            messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage()));
            logger.error("Error when creating container {} by extension {}", id, this, e);
        }
    }

    @Override
    public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {

        // Allowing container updates when Kie Server runs in DEVELOPMENT mode.
        if (isDevelopmentMode()) {
            return true;
        }

        // first check if there are any active process instances
        List<Integer> states = new ArrayList<Integer>();
        states.add(ProcessInstance.STATE_ACTIVE);
        states.add(ProcessInstance.STATE_PENDING);
        states.add(ProcessInstance.STATE_SUSPENDED);
        Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext());
        if (!activeProcesses.isEmpty()) {
            parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id);
            return false;
        }

        return true;
    }

    @Override
    public void prepareContainerUpdate(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        if (!deploymentService.isDeployed(id)) {
            logger.info("No container with id {} found", id);
            return;
        }

        KModuleDeploymentUnit unit = (KModuleDeploymentUnit) deploymentService.getDeployedUnit(id).getDeploymentUnit();

        Boolean abortInstances = (Boolean) parameters.getOrDefault(KieServerConstants.KIE_SERVER_PARAM_RESET_BEFORE_UPDATE, Boolean.FALSE);

        // Aborting active process instances only if the server runs in DEVELOPMENT mode & we are on a redeployment
        if (isDevelopmentMode() && abortInstances) {
            PreUndeployOperations.abortUnitActiveProcessInstances(runtimeDataService, deploymentService).apply(unit);
        }
    }

    @Override
    public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        // essentially it's a redeploy to make sure all components are up to date,
        // though update of kie base is done only once on kie server level and KieContainer is reused across all extensions
        parameters.put(IS_DISPOSE_CONTAINER_PARAM, Boolean.FALSE);

        disposeContainer(id, kieContainerInstance, parameters);

        createContainer(id, kieContainerInstance, parameters);
    }

    @Override
    public void activateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        deploymentService.activate(id);
    }

    @Override
    public void deactivateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        deploymentService.deactivate(id);
    }

    @Override
    public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        if (!deploymentService.isDeployed(id)) {
            logger.info("No container with id {} found", id);
            return;
        }

        KModuleDeploymentUnit unit = (KModuleDeploymentUnit) deploymentService.getDeployedUnit(id).getDeploymentUnit();

        if (kieServer.getInfo().getResult().getMode().equals(KieServerMode.PRODUCTION)) {
            deploymentService.undeploy(new CustomIdKmoduleDeploymentUnit(id, unit.getGroupId(), unit.getArtifactId(), unit.getVersion()));
        } else {
            // Checking if we are disposing or updating the container. We must only keep process instances only when updating.
            Boolean isDispose = (Boolean) parameters.getOrDefault(IS_DISPOSE_CONTAINER_PARAM, Boolean.TRUE);

            if (isDispose) {
                deploymentService.undeploy(new CustomIdKmoduleDeploymentUnit(id, unit.getGroupId(), unit.getArtifactId(), unit.getVersion()), PreUndeployOperations.abortUnitActiveProcessInstances(runtimeDataService, deploymentService));
            } else {
                deploymentService.undeploy(new CustomIdKmoduleDeploymentUnit(id, unit.getGroupId(), unit.getArtifactId(), unit.getVersion()), PreUndeployOperations.doNothing());
            }
        }

        // remove any query result mappers for container
        List<String> addedMappers = containerMappers.get(id);
        if (addedMappers != null && !addedMappers.isEmpty()) {

            for (String mapper : addedMappers) {
                QueryMapperRegistry.get().removeMapper(mapper);
            }
        }
        // remove any query param builder factories
        QueryParamBuilderManager.get().removeQueryFactories(id);
        logger.debug("Container {} disposed successfully by extension {}", id, this);

        // remove any container specific queries
        List<String> queries = containerQueries.remove(id);
        if (queries != null) {
            logger.debug("Removing queries {} that comes from container {} that is being disposed", queries, id);
            queries.forEach(q -> {
                try {
                    queryService.unregisterQuery(q);
                } catch (QueryNotFoundException e) {
                    logger.debug("Query {} not found when being removed on container dispose", q);
                }
            });
        }
    }

    @Override
    public List<Object> getAppComponents(SupportedTransports type) {
        ServiceLoader<KieServerApplicationComponentsService> appComponentsServices
                = ServiceLoader.load(KieServerApplicationComponentsService.class);
        List<Object> appComponentsList = new ArrayList<Object>();
        Object[] services = {
                deploymentService,
                definitionService,
                processService,
                userTaskService,
                runtimeDataService,
                executorService,
                formManagerService,
                queryService,
                processInstanceMigrationService,
                processInstanceAdminService,
                userTaskAdminService,
                context
        };
        for (KieServerApplicationComponentsService appComponentsService : appComponentsServices) {
            appComponentsList.addAll(appComponentsService.getAppComponents(EXTENSION_NAME, type, services));
        }
        return appComponentsList;
    }

    @Override
    public <T> T getAppComponents(Class<T> serviceType) {
        if (serviceType.isAssignableFrom(kieContainerCommandService.getClass())) {
            return (T) kieContainerCommandService;
        }

        Object[] services = {
                deploymentService,
                definitionService,
                processService,
                userTaskService,
                runtimeDataService,
                executorService,
                formManagerService,
                queryService,
                processInstanceMigrationService,
                processInstanceAdminService,
                userTaskAdminService,
                context
        };

        for (Object service : services) {
            if (service != null && serviceType.isAssignableFrom(service.getClass())) {
                return (T) service;
            }
        }

        return null;
    }

    @Override
    public String getImplementedCapability() {
        return KieServerConstants.CAPABILITY_BPM;
    }

    @Override
    public List<Object> getServices() {
        return services;
    }

    @Override
    public String getExtensionName() {
        return EXTENSION_NAME;
    }

    @Override
    public Integer getStartOrder() {
        return 0;
    }

    @Override
    public String toString() {
        return EXTENSION_NAME + " KIE Server extension";
    }

    private boolean isDevelopmentMode() {
        return kieServer.getInfo().getResult().getMode().equals(KieServerMode.DEVELOPMENT);
    }

    private static class CustomIdKmoduleDeploymentUnit extends KModuleDeploymentUnit {

        private String id;

        public CustomIdKmoduleDeploymentUnit(String id, String groupId, String artifactId, String version) {
            super(groupId, artifactId, version);
            this.id = id;
        }

        @Override
        public String getIdentifier() {
            return this.id;
        }
    }

    protected void addAsyncHandler(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) {
        // add async only when the executor component is not disabled
        if (isExecutorAvailable && executorService != null) {
            final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer);
            descriptor.getBuilder()
                    .addWorkItemHandler(new NamedObjectModel("mvel", "async",
                                                             "new org.jbpm.executor.impl.wih.AsyncWorkItemHandler(org.jbpm.executor.ExecutorServiceFactory.newExecutorService(null),\"org.jbpm.executor.commands.PrintOutCommand\")"));

            unit.setDeploymentDescriptor(descriptor);
        }
    }

    protected void addTaskBAMEventListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) {
        final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer);
        if (descriptor.getAuditMode() != AuditMode.NONE) {
            descriptor.getBuilder().addTaskEventListener(
                    new ObjectModel(
                            "mvel",
                            "new org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener(false)"
                    )
            );
            unit.setDeploymentDescriptor(descriptor);
        }
    }

    protected void addTaskCleanUpProcessListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) {
        final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer);
        descriptor.getBuilder().addEventListener(
                new ObjectModel(
                        "mvel",
                        "new org.jbpm.services.task.admin.listener.TaskCleanUpProcessEventListener(taskService)"
                )
        );
        unit.setDeploymentDescriptor(descriptor);
    }

    protected void addProcessIdentityProcessListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) {
        final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer);
        descriptor.getBuilder().addEventListener(
                new ObjectModel(
                        "mvel",
                        "new org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener(ksession)"
                )
        );
        unit.setDeploymentDescriptor(descriptor);
    }

    protected DeploymentDescriptor getDeploymentDescriptor(KModuleDeploymentUnit unit, InternalKieContainer kieContainer) {
        DeploymentDescriptor descriptor = unit.getDeploymentDescriptor();
        if (descriptor == null) {
            List<DeploymentDescriptor> descriptorHierarchy = DeploymentDescriptorManagerUtil.getDeploymentDescriptorHierarchy(deploymentDescriptorManager, kieContainer);
            descriptor = merger.merge(descriptorHierarchy, MergeMode.MERGE_COLLECTIONS);
        }
        return descriptor;
    }

    protected boolean isExecutorOnClasspath() {
        try {
            Class.forName("org.jbpm.executor.impl.wih.AsyncWorkItemHandler");

            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

    protected Map<String, String> getPersistenceProperties(KieServerConfig config) {
        Map<String, String> persistenceProperties = new HashMap<String, String>();

        persistenceProperties.put("hibernate.dialect", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DIALECT, "org.hibernate.dialect.H2Dialect"));
        persistenceProperties.put("hibernate.default_schema", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DEFAULT_SCHEMA));
        persistenceProperties.put("hibernate.transaction.jta.platform", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_TM, "JBossAS"));
        persistenceProperties.put("javax.persistence.jtaDataSource", config.getConfigItemValue(KieServerConstants.CFG_PERSISTANCE_DS, "java:jboss/datasources/ExampleDS"));

        System.getProperties().stringPropertyNames()
                .stream()
                .filter(PersistenceUnitInfoLoader::isValidPersistenceKey)
                .forEach(name -> persistenceProperties.put(name, System.getProperty(name)));

        return persistenceProperties;
    }

    protected EntityManagerFactory build(Map<String, String> properties) {
        try {
            InitialContext ctx = new InitialContext();
            InputStream inputStream = PersistenceUnitInfoLoader.class.getResourceAsStream(PERSISTENCE_XML_LOCATION);
            PersistenceUnitInfo info = PersistenceUnitInfoLoader.load(inputStream, ctx, this.getClass().getClassLoader());
            // prepare persistence unit root location
            URL root = PersistenceUnitInfoLoader.class.getResource(PERSISTENCE_XML_LOCATION);
            String jarLocation = root.toExternalForm().split("!")[0].replace(PERSISTENCE_XML_LOCATION, "");
            try {
                ((PersistenceUnitInfoImpl) info).setPersistenceUnitRootUrl(new URL(jarLocation));
            } catch (Exception e) {
                // in case setting URL to jar file location only fails, fallback to complete URL
                ((PersistenceUnitInfoImpl) info).setPersistenceUnitRootUrl(root);
            }
            // Need to explicitly set jtaDataSource here, its value is fetched in Hibernate logger before configuration
            ((PersistenceUnitInfoImpl) info).setJtaDataSource(properties.get("javax.persistence.jtaDataSource"));
            List<PersistenceProvider> persistenceProviders = PersistenceProviderResolverHolder.getPersistenceProviderResolver().getPersistenceProviders();
            PersistenceProvider selectedProvider = null;
            if (persistenceProviders != null) {
                for (PersistenceProvider provider : persistenceProviders) {
                    if (provider.getClass().getName().equals(info.getPersistenceProviderClassName())) {
                        selectedProvider = provider;
                        break;
                    }
                }
            }

            return selectedProvider.createContainerEntityManagerFactory(info, properties);
        } catch (Exception e) {
            throw new RuntimeException("Unable to create EntityManagerFactory due to " + e.getMessage(), e);
        }
    }

    protected void loadAndRegisterQueryDefinitions(InputStream qdStream, org.kie.server.api.marshalling.Marshaller marshaller, String containerId) throws IOException {
        if (qdStream != null) {
            String qdString = IOUtils.toString(qdStream, Charset.forName("UTF-8"));

            try {
                QueryDefinition[] queryDefinitionList = marshaller.unmarshall(qdString, QueryDefinition[].class);
                List<String> queries = new ArrayList<>();
                Arrays.asList(queryDefinitionList).forEach(qd ->
                                                           {
                                                               queryService.replaceQuery(QueryDataServiceBase.build(context, qd));
                                                               queries.add(qd.getName());
                                                               logger.debug("Registered '{}' query from container '{}' successfully", qd.getName(), containerId);
                                                           });

                if (containerId != null) {
                    containerQueries.put(containerId, queries);
                }
            } catch (MarshallingException e) {
                logger.error("Error when unmarshalling query definitions from stream.", e);
            }
        }
    }

    protected void registerDefaultQueryDefinitions() {
        try {
            // load any default query definitions
            InputStream qdStream = this.getClass().getResourceAsStream("/default-query-definitions.json");
            if (qdStream == null) {
                String externalLocationQueryDefinitions = System.getProperty(KieServerConstants.CFG_DEFAULT_QUERY_DEFS_LOCATION);
                if (externalLocationQueryDefinitions != null) {
                    qdStream = new FileInputStream(externalLocationQueryDefinitions);
                }
            }

            loadAndRegisterQueryDefinitions(qdStream, MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()), null);

            if (qdStream != null) {
                qdStream.close();
            }
        } catch (Exception e) {
            logger.error("Error when loading default query definitions from default-query-definitions.json", e);
        }
    }

    // just for tests
    void setQueryService(QueryService queryService) {
        this.queryService = queryService;
    }

    void setContext(KieServerRegistry context) {
        this.context = context;
    }

    @Override
    public List<Message> healthCheck(boolean report) {
        List<Message> messages = KieServerExtension.super.healthCheck(report);

        try {
            // run base query to make sure data access layer is available
            runtimeDataService.getProcessInstanceById(-99999);
            if (report) {
                messages.add(new Message(Severity.INFO, getExtensionName() + " is alive"));
            }
        } catch (Exception e) {
            messages.add(new Message(Severity.ERROR, getExtensionName() + " failed due to " + e.getMessage()));
        }

        return messages;
    }
}

redpajama_set_name: RedPajamaGithub


Most buildings area covered by a Replacement with New insurance policy, which is the very best basis of settlement as it protects you with "new for old" coverage. To maximise the benefit of this coverage, it does mean you need to ensure that the declared building value or sum insured is adequate to fully replace the asset(s)in accordance with the current building code and with today's ever-increasing building costs.
The 'Co-Insurance' clause is found in most insurance policies and dictates that if you are under insured, only a proportion of the actual cost of repairing or replacing your asset will be paid by your insurer.
Steven owns a six level office building and has insured it for $4,000,000. The property is damaged by fire with a damage bill of $3,000,000. The insurers determine that the actual replacement value of the building is $8,000,000. Steven is therefore under insured by 50%. Although Steven may think that the $4,000,000 cover he has is sufficient to cover the damage bill of $3,000,000, the application of the 'Co-Insurance' clause means that Steven is in fact an insurer himself for part of the risk. In other words he shares in the risk associated with under-insuring his building.
Lets examine how an insurer would assess payment for such a claim.
It's clear that although there was a buffer of $1,000,000 between the damage bill and the declared value. The insured is still out of pocket due to the application of the 'co insurance' clause because they failed to insure the building for its true replacement value. It may appear to be cheaper to under-insure to save a little in the annual insurance premium; however it is simply not worth it in the event of a claim.
We strongly recommend that a building insurance valuation is carried out every three years to reduce the substantial financial risk associated with under insurance by a qualified valuer with experience in building reinstatement valuations.


I've a problem while running a class with gui forms feature with ant java task.
It run without problem with the IDE. It compile with ant, but when running with the ant task java, any windows form is launched. Any solution? Thanks in advance.
source code generation in the UI Designer settings.


text:
package eclipseLib;

/**
 * Created in IntelliJ IDEA.
 * By: Alexander.Chernikov
 * When: 19.02.2009, 20:55:48
 * Русский текст.
 */
public class SourceSeven {
	public static final String ELIB_CONST = "value 7";

	public void elibMethod() {
	}
}


text:
« Q & A on the Death Penalty | Main | A reply to D. Brooks »
Did World War Three begin last Thursday night? I fear it may have done. Forgive my language, but on this occasion I think it justified. How can anyone possibly have been so bloody stupid? We know from history that assassinations can have limitless effects. And when the President of the United States orders the state murder (for this, alas, is what it was) of an Iranian general, it is hard to see a good end.
There will be retaliation. Other countries will be drawn in. Our own ability to make moral objections to such acts is gravely weakened because Donald Trump's action lies miles outside the laws of civilised war. Iran has no long-range drones (as far as we know) but can you begin to imagine the justified rage in the USA if a senior American general was shot dead on the steps of the Pentagon by an Iranian hit team? Yet what, in the end, would be the moral difference between the two acts?
Now we can only tremble at what might come next. Any fool can see that this action was perilous beyond belief. Anyone wise and mature enough to say 'That's enough!' after the first retaliation would have had the sense not to start this in the first place.
For the first 40 years of my life we were supposed to be living on the brink of nuclear war. But it never came, because even the stupidest and most evil politicians could see that you could not win such a war.
Now, the nuclear threat has slipped away into the background. I am not saying it will not return. But a US President can now start a war, if he picks his enemy carefully, without needing to fear a nuclear exchange. We have seen this already in Iraq, a continuing disaster, and in Afghanistan, where, as newly released secret papers show, nobody ever had a clue what they were doing. We see it Ukraine, where American and EU aggression finally came up against hard resistance. We see it in Syria. Britain and France started their own war in Libya, so destroying that country and beginning one of the biggest waves of uncontrolled migration in human history, and unqualified disaster.
How odd it is that we persist with these follies. Modern non-nuclear weapons are quite terrifying enough in themselves. I visited Baghdad soon after the 2003 invasion and was repeatedly astonished by the vast destruction caused by the power and accuracy of 21st century conventional munitions. Ramadi and Fallujah later ended up as moonscapes. Pictures from Syria after the war we caused show a country that has truly been bombed and shelled back into the Stone Age.
And now we have drones, which turn murder into a videogame. You can sit in front of a screen and arrange the killing of another human being, at no direct risk to yourself, thousands of miles away. Then you can lock up your office and go out for a beer or, if you don't like beer, you can have a cheeseburger.
But above all, what is all this about? It does not defend us, but exposes us to danger which may reach our towns and cities. At least in the past we could say we were defending liberty against a defined menace which would not stop threatening us until it was defeated in the field. But in these cases, what precisely are we fighting for? How will we know if we have won? Or are we heading for the permanent war envisaged in George Orwell's 1984, in which we can switch from one enemy to the other in the blink of an eye, and pretend nothing has changed, but the fighting never stops? You think this far-fetched? Then bear in mind that this country has been supporting an Al Qaeda faction in Syria for several years. These are crazy times.
Only Grammar Schools can Save Poor Children from Ignorance
I can quite understand why Winchester College and Dulwich College turned down the offer of a legacy to pay for bursaries for poor white scholars. It is easy to see how they would have been smeared as 'racist' if the story had come out in the left-wing media.
But in any case it would have done almost no good. Britain's white working class cannot be saved by a few bursaries. It has been the main victim of the hideous social experiment of the last 60 years.
Its settled communities have been broken up by council house sales and mass immigration. Its steady jobs have been abolished by free-market fanatics. Its families have been devastated by the state's long war against lifelong marriage. And its schools – decent, disciplined state schools which taught real skills and real knowledge - were swept away by comprehensive zealots in both parties.
I will here repeat my favourite statistic, from the Gurney-Dixon report of 1953. It states that 64% of grammar school pupils in that year were working class. Now children from poor homes who would once have gone to such schools fail in horrible sink establishments full of noise and bullying, and the nation loses a huge store of talent.
The German-speaking nations of Europe, far more economically successful and less class-prejudiced than we are, still have selective grammar schools. The old Communist East Germany abolished them, but when Communism fell they were rebuilt and now flourish there too.
The reintroduction of such schools would do more for the white working class, and everyone else in the country too, than any number of scholarships.
That's enough Profumo Dramas . We need a drama about the much bigger scandal of Suez
Dramatisations of the Profumo Affair come along as regularly as flu epidemics, and, while I am quite enjoying 'The Trial of Christine Keeler', may I make a plea for this to be the last?
For the truth is that nothing really happened. A junior minister (John Profumo was not in the Cabinet) slept with a prostitute. It came out by accident. He lied. He resigned. That was it.
Probably the most enduring thing that came out of it was the performance of Mandy Rice-Davies, in many ways the enduring spirit of our age. Her dismissal of an incredible denial with the words 'He would say that, wouldn't he?' is the thinking person's response to most statements by public figures. Her later material success (unlike poor Christine Keeler's unhappy burned-out life) showed just what an amoral era this is. She rightly reckoneed that if Tory politicians could behave as John Profumo did, she was free to behave as she did.
But can someone now make a decent three-part documentary drama about the Suez crisis, in which the Prime Minister and the Foreign Secretary lied us into war, the Americans crushed us as if we were an insect, and we ceased to be a world power? Not much sex, but such a drama.
Flop after Flop, but Pullman's Atheism keeps the dramatisations coming
The atheist author Philip Pullman is, I suspect, more admired and bought than read. When his finger-wagging anti-Christian books are dramatised, on stage or film, they flop. Yet people still keep trying to stage them. Why? My diligent colleague James Heale has obtained for me the viewing figures for the BBC's recent costly TV version of 'His Dark Materials'. They started at 7.2 million in Episode 1. Then they fell almost continuously, with one hiccup at Episode 5, to a poor 4.1 million at the end. But how many of them were awake? It was quite boring. A friend who stuck it out to the end confesses that he fell asleep during the final bout.
Yet the BBC is even now airing a radio version of his latest book and , as far as I know, plans to go ahead with another heavy-handed slice of Pullman on TV. This must surely be the triumph of ideology over common sense or commercial reality.
January 5, 2020 Comments (196) Categories: Atheism , BBC , BBC bias , Education , Grammar Schools , History , Human Wrongs , Intervention, Liberal , Iran , Iraq , Terrorism , USA , warfare | Permalink
Bill 18th Jan 2020 at 11:39am
It is nonsense to suggest that the Ukrainian pilot was responsible for this incident. 19 other pilots, at least, took off from the same airport at similar times. They were not all negligent.
I shall quote General Amir Ali Hazijadeh, Commander of the Iranian Revolutionary Guard:
"If there was a mistake it was made by one of our members."
That is from the horse's mouth: an acknowledgement of absolute culpability, from someone with access to all the facts. Not what one could expect from such a person, heading such an organisation, unless the evidence were overwhelming.
Not, though, good enough for Bill, seated in his armchair, thousands of miles away, expounding on his "expertise".
It would, sadly, seem that there exist the aeronautical equivalents lof "old sailors".
Posted by: Mike B | 18 January 2020 at 02:48 PM
Mike B | 17 January 2020 at 06:53 AM writes "the Ukrainian pilot was entitled to rely on clearance from the Iranian civil aviation authorities".
No, he emphatically was not.
Clearly you are not a pilot, or you would know that the Air Navigation Act states that "the pilot in command of an aircraft in flight is responsible for the safety of that aircraft and its passengers". [The legal definition of "in flight" begins with the moment the engines are started with the intention of flying.]
It also states that "notwithstanding anything else contained in these regulations the pilot in command of an aircraft in flight shall take whatever action is in his opinion necessary to ensure the safety of the aircraft and its occupants".
To summarise: the pilot in command is empowered to overrule ATC (and indeed break any other law), and it follows that if he fails to do so he cannot blame them; he is *responsible*, both legally and morally.
(However, it is also the case that if he exercises that power he had better be prepared to provide the authorities with a plausible explanation as to why he deemed the flight to be in danger if he hadn't.)
The law of the air is derived from the law of the sea, and the command pilot of an aircraft in flight is in exactly the same legal position as the captain of a ship on the high seas.
Just as the captain of the "Titanic" was not entitled to blame his lookout for failing to spot the iceberg, so the Ukrainian pilot was not entitled to blame ATC for failing to inform him that there was a SAM battery in the vicinity.
Reverting to the Ukrainian pilot, it was entirely his responsibility to determine whether or not it was safe to take off. Given that it was known that the Iranians were striking American bases, common sense would suggest that there was a strong possibility of American retaliation, and of the Iranian defences beng activated to block that retaliation.
BTW, I memorised that piece of law 46 years ago, and have been flying according to its precepts ever since. So please stop trying to "teach your grandmother to suck eggs".
Posted by: Bill | 18 January 2020 at 11:39 AM
To Martin | 16 January 2020 at 09:00 PM: My word, you really have shifted the goalposts!
When first you challenged my view that no "guilt" is involved, you postulated a "complete" (your word) accident.
Now you go on about "rather foolishly Bill starts fumbling around trying to reach his phone. Having taken his eyes off the road he didn't notice the oncoming pedestrian".
How can that possibly be a "complete" accident? It is both reckless and unlawful, so of course guilt would be felt.
Here's an example of a "complete" accident. You are driving sedately along the road when the steering fails, your car mounts the pavement and kills a pedestrian.
The subsequent enquiry reveals that the cause was a deep-seated flaw in the steel of which the steering mechanism was made, a flaw which could only be detected by an engineer equipped with a sophisticated X-ray machine.
@Bill 24th Jan 2020 at 4:23pm
"Here is a piece of evidence to begin with. The Ukrainian pilot took off."
Very insightful, Bill. So did the pilots on 9/11. They had every reason to do so, relying on the security provided by other parties. Just as the Ukrainian pilot was entitled to rely on clearance from the Iranian civil aviation authorities, who are the parties charged with making these calls.
Posted by: Mike B | 17 January 2020 at 06:53 AM
Bill "No, not guilt, and not remorse either (on your terms it was *a complete accident*)."
Sorry my fault. I have clearly not been detailed enough in setting the scene. Bill is driving home from the Russian Embassy and all of a sudden his I Phone is bleeping, probably C. Morrison with another conspiracy theory about the Henry Jackson Society, and rather foolishly Bill starts fumblng around trying to reach his phone. Having taken his eyes off the road he didn't notice the oncoming pedestrian crossing and runs straight into several people who unfortunately die as a result. Are you telling me that Bill, who I assume is a human and not a robot, would not feel the smallest amount of guilt or remorse for his reckless and careless actions albeit that he had no intention of harming anyone and it was an accident? What emotion would it be again?
Posted by: Martin | 16 January 2020 at 09:00 PM
Mrs. B "The gang ethos in America and the, "drill" music and videos are having an adverse effect on young minds"
I agree with .many of the things you say but on the music influence do you not accept that music is a performance art? What are you going to do, ban free speech as in banning a film because it had bad language or a scene with violence?
I have listened to my fair share of hip-hop music but surprisingly it has never made me want to pick up a gun and shoot one of my 'homies'? Surely, the problem resides with the individual and the parents rather than solely with the artist. I have found some lyrics from an eminem record which offes tthe counter argument;
"That's why these prosecutors wanna convict me, Strictly just to get me off of these streets quickly, But all their kids been listenin' to me religiously, So I'm signing CD's while police fingerprint me, They're for the judges daughter, but his grudge is against me, If I'm such a menace, this doesn't make sense b, It's all political, if my music is literal then I'm a criminal, How can I raise a little girl? I couldn't, I wouldn't be fit to.....
They say music can alter moods and talk to you
Well can it load a gun up for you and cock it too?
Well if it can, then the next time you assault a dude, Just tell the judge it was my fault, and I'll get sued, See what these kids do, is hear about us totin' pistols, And they want to get one, 'cus they think the **** cool. Not knowin' we're really just protectin' ourselves. We entertainers, of course this is affecting ourselves ,You ignoramus.
Martin | 15 January 2020 at 05:31 PM asks if I were driving a car and happened to knock down and kill several pedestrians in what was a complete accident would I not feel a certain amount of guilt?
No, not guilt, and not remorse either (on your terms it was *a complete accident*).
Why should I feel guilt, when guilt implies deliberately doing something wrong?
Why should I feel remorse, when remorse implies the possibility of doing something differently?
However, I should be appalled, and would doubtless feel other emotions, such as horror and consternation.
Posted by: Bill | 16 January 2020 at 12:14 PM
" Kids these days". Trouble is too many of them aren't, kids. They are children whose parents are too, often consumed in the world of indulging them with what the ad men and the TV tells them they need, while forgetting to teach them the basics in behaviour.
As I talk to my peers, we see a reversal of our lives, where we were not indulged by spending power on us in our childhood, but had gifts of greater worth in not being indulged.
There was an article recently that young do not do theSaturday jobs that were teaching social skills and earning own money.
While life has changed for female earning power, children's behaviour and resilience and monitoring of them has deteriorated. Coinciding with falling education standards, a lessening of authority on the streets leaving then exposed and the bedroom and the I phone and games their influence.
I read ,"Stormzy" was in a classroom answering a pupil, by telling them, " Boris was a bad man".
School is not where I would want music stars influencing my young.
I cringe at the show business influence on young and would have preferred ed to see Harry had attended the other event for servicemen on the gala night.
The gang ethos in America and the, "drill" music and videos are having an adverse effect on young minds.
Especially those more vulnerable. It's something that makes those trying to help young from this mindset, that frustrates and angers.
If you read Jason Farrell, he explains the links.
With more drug gangs homegrown and imported, never have children been left so exposed.
We see a lot of questionable funding along with the black economy. Much closer to the ground than politicians. Frustrating.
Posted by: Mrs.B. | 16 January 2020 at 07:51 AM
Bill "the word "guilt" is charged with an implication of deliberate wrongdoing."
Is it? So if you were driving a car and happened to knock down and kill several pedestrians in what was a complete accident would you not feel a certain amount of guilt at having done so? Similarly, if you intend to fire missiles at a specific target but end up shooting a passenger plane out of the sky in error would the person who fired the wayward missile not be guilty of gross incompetence / manslaughter / reckless endangerment / war crimes? The rest of your post in regard to the pilot staying grounded and the application of his own common sense is all academic to the fact that Iran should never have fired missiles in airspaces which would endanger passenger carriers.
Mrs. B "An ethos I saw grow by 80's as mums who worked had purchase power and the trainer, also accepted at school as uniformity, dumbed down, (now the sweetener to young to,"do a favour") grew as the Internet allowed young to view the drill videos and music....Only a game, the crime glamorising, mysogynistic view of females in Call of Duty."
Jeepers I'm glad you got that off your chest Mrs. B. Kids these days eh? I used to play Kid Gloves and The Legend of Zelda, Ocarina of Time. Remember the Amiga? They don't make real games anymore. And Goldeneye on the 64, a classic Don't get me wrong, I'm sure we all loved pumping a Russian Infantry soldier full of lead but it was easy to distinguish from reality. The problem now is these games like World of Warcraft and Final Fantasy get people hooked so they never leave the house and think they are actually within the game. Maybe this is where C. Morrison gets his ideas? What would Stormzy say about your views on Drill music? When I was young my dad bought me football boots from a car boot sale, there was no £100 predators but it didn't stop me being the league's top scorer. It's all cosmetic these days.
I agree with you on phones for kids, it has a lot to answer for as well as social media...the Instagram crowd. Meghan and Harry are keen to get in on the act. It makes life a lot easier for parents when you can give them a phone to shut them up. As for the welfare state it's a big mess. Last I heard, some Europeans were coming hear just to sign on the books as single parents out of work and then heading straight back to their home nation so British taxpayers are funding people who aren't even here and never have been. The system is not fit for purpose
Mike B | 13 January 2020 at 10:17 AM writes "There is simply no evidence that a party from any other nation [than Iran] was responsible. The Iranians have admitted their guilt".
(In fact the Iranians said they did it, by accident; the word "guilt" is charged with an implication of deliberate wrongdoing.)
Well, here's a piece of evidence to begin with. The Ukranian pilot took off. If he hadn't, then self-evidently he would not have been shot down.
If he was aware that there was a "hot" air defence zone nearby, then that act defied common sense, never mind airmanship, whether or not the airfield was closed. It would be similar to going for a hike across an active artillery range.
It seems that he wasn't the only one to take off, so presumably he was not aware. But shouldn't he, and the others, have suspected that there might have been?
Perhaps their excuse (or reasoning, depending on your point of view) would be that they thought Teheran was far enough away from the launching point of the Iranian missiles hitting empty warehouses, that it wouldn't be affected.
It is worth pointing out that air traffic control in Third World countries marches to a different drummer than in First World countries. (Is Iran First or Third?).
Here's a small example. A flight from Nairobi to Johannesburg had to pass over Zimbabwe in the wee hours, and the government there required it to land at Harare (so it could pay landing fees!).
The flight was running late, and the captain said it might be possible to make up time by not landing at Harare. I asked him how he was going to get away with that. He said he would call ATC once - just to cover his backside by getting the call on tape - and if they didn't answer he would simply keep going. He added that by 3am they were usually blind drunk and passed out, so he didn't think they would reply. And they didn't.
As usual in these cases, the best is to wait for the board of enquiry to publish its findings. That should give us answers to these questions, though you or I may well disagree with its interpretation of them.
Peter Hitchens wrote:
"The German-speaking nations of Europe, far more economically successful and less class-prejudiced than we are, still have selective grammar schools. The old Communist East Germany abolished them, but when Communism fell they were rebuilt and now flourish there too."
Perhaps, reasonably enough, they regard grammar schools as schools where children are taught that long-neglected cinderella of education - er, grammar. Perhaps they also see - as our nation does not - that in order to accomplish that particular aim there is available, to the brighter pupils at least, a ready-made tool in the linguistic teaching of Latin as a foreign language.
Posted by: Peter Preston | 14 January 2020 at 02:51 PM
"Unsettled" On the gangster style fashion. Well I suggest you read Jason Farrell's article from his book on release on his investigative work on County Lines, from Saturday Mail, or online version, Saturday, yesterday and today on Mail online.
A frightening story, which has been allowed to take hold over many years of change for young.
Honesty, or lack of it is often the cause of continuation that unsettles or ruins in this case many young lives.
In that mix is change of immigration controls. Change in stable family structure. The rise of children with phones. The ability to purchase pay as you go, with no register. The burner phones used to control young drug mules.
The allowing of phones, I phones in school. The rise of the, "Brand generation". An ethos I saw grow by 80's as mums who worked had purchase power and the trainer, also accepted at school as uniformity, dumbed down, (now the sweetener to young to,"do a favour") grew as the Internet allowed young to view the drill videos and music, that naive, complacent or non parenting swept into young lives.
Following from the purchase power of parents, whether from wages or benefit.
Only a game, the crime glamorising, mysogynistic view of females in Call of Duty.
The power of the TV push for things that many in my generation's warning voice couldn't compete with the school gate ethos of guilt that little Jimmy's parent had bought into it.
The power of TV, music role models.
The retreat of bobbies and arrival of Blunkett's bobbies.
The failure to admit why we are here, the biggest crime of all.
The instant money culture, from the more important promotion of becoming a pop star.
An easy route to a lifestyle to the young on estates, who used to be apprentices, settle down and marry and have families, before the welfare state moved from support to a lifestyle choice.
Less fathers and male teachers and less authority of a police presence left estates. Estates now with the changes, that affect the old ordered way.
@C.Morrison 12th January 2020 at 6:57pm
There is no reasoning with you, Mr Morrison. If you are really going to bring up an anti-hijack system as a possible cause of a missile attack, you are well beyond reason.
I'll leave you to your fantasies.
@Bill 12th January 2020 at 9:44pm
I am saying no more than that this was the fault of the Iranians and I am in no position to identify the culpability of an individual.
There is simply no evidence that a party from any other nation was responsible. The Iranians have admitted their guilt.
What more do you want?
-"Alan Thomas | 10 January 2020 at 04:45 PM writes "I very much doubt that the problem of bad behaviour in schools and poor results can be remedied without some form of strict segregation". May I say a fervent Amen to that. Indeed, it would be a solution to many of society's other problems too. The PC crowd think it a good idea to force people to live cheek-by-jowl with people they dislike. I have never been able to understand how that could lead to anything other than resentment - inevitably followed by friction."-
Foreigners have the rest of the world and most of the MPs we used to have saw it as only fair to take over this country as well.
Progressives say they are all about diversity. *Except* for being against: 1) diverse opinion; and 2) diverse countries (whole nations being different from each other).
Posted by: adeledicnander | 13 January 2020 at 07:16 AM
Mike B | 12 January 2020 at 05:45 PM writes, in response to my post of 12 January 2020 at 02:57 PM "If you suspect that this as anything but a cock-up on the part of the Iranians, you need to provide some evidence".
I thought I WAS saying that it was a cock-up on the part of somebody, possibly the Ukrainian captain, possibly the Iranians - but which Iranians? Teheran ATC? Or the the anti-aircraft battery responsible?
He also implies the airport was not closed, a position supported by C. Morrison | 12 January 2020 at 05:46 PM.
It most certainly should have been closed - that would be standard procedure in circumstances like these - and a TV news item stated that it was closed. But if it is correct that all those other aircraft took off then probably it was not. That in turn begs the question: why wasn't it? Was that the cock-up?
Or perhaps the cock-up was crossed lines between the battery and ATC, i.e. the battery crew asked for it to be closed, and believed that their request had been actioned?
However, I revert to my central point. That button was pressed by somebody who surely must genuinely have believed in his own mind that his target was an incoming hostile. (He would hardly have deliberately shot down a civil airliner belonging to one of Iran's few friends.)
If it had been an incoming hostile, he would have had only seconds to react before being blown to smithereens.
It is a fact of aviation life that sometimes life-or-death decisions have to be made in a fraction of a second, though usually by the man in the cockpit, rather than by the man on the ground.
Those of us who have been there, and made that sort of decision, tend to resent "Monday morning quarter-backing", by those who sit in the comfort of an armchair, with plenty of time to think, no adrenalin rush to contend with, and all sorts of information-by-hindsight which was not available to the fellow who made the decision.
@ Mrs.B "Tony Blair had that song Things can only get better". He made sure he unsettled life for us, that's for sure"
Was that before or after Iraq, the recession and Brexit? Unsettled would be putting it mildly, personally I prefer the term ruined the country or certainly the futures of many. Have you seen the latest fashion trend by the way? Major retailers are now selling stab vests as fashion accessories. I'm guessing you don't approve? Seems to me that they are trying to make money from glamourising gangsters and violence. I bet these fashion victims think they look real tough strutting down to the local bar strip in their new clobber. Personally, I find it pathetic.
Now that the Iranians themselves have accepted responsibility for their error in taking down the Ukrainian Airways flight, which they quickly tried to conceal in a botched cover up before it became clear the evidence against them was overwhelming, I did hope that C. Morrison and Bill might now accept that the theory they were clinging to about a technical fault has gone up in smoke. Sadly, as it appears they are still reluctant to accept the admission of the Iranians themselves in the hope of clinging to some sort of delirious US conspiracy plot I think any further attempts at reasonable dialogue with this pair might be a dead loss.
Mike B | 12 January 2020 at 05:45 PM :
*** What is clear is that there is no evidence to indict the USA, Boeing, the Ukrainian carrier or its crew.***
In different ways, both the US military (jamming or distorting ID signals, communications and radar?) and Boeing (for technical/construction matters, or even malfunction of the standard anti-hijack over-ride control system built into their aircraft if exposed to the aforementioned electronic warfare?) surely cannot be so readily disregarded as potential contributory suspects.
Not noticed any information yet as to how diligent or not the carrier company were with regard to aircraft maintenance, but by now that lack of negatives indicates they were ok, and likewise the plane's crew.
Posted by: C. Morrison | 12 January 2020 at 06:57 PM
Posted by: Bill | 12 January 2020 at 02:57 PM :
*** Why did the Ukrainian captain elect to take-off - and why was he allowed to do so? If the airport was closed, ATC should not have given him a take-off clearance.***
The airport was not closed.
Eight or nine commercial flights had taken off shortly before the downed one, itself originally scheduled to have left about an hour earlier.
@Bill 12th January at 2:57pm
The initial radar trace clearly showed it making a U-turn and heading back to the airport - for reasons unspecified."
Oh, for crying out loud. That was according to the initial response of the Iranian Civil Aircraft Organisation, a version which has been completely discredited as a futile attempt to obfuscate the truth, now admitted, that the Iranian Revolutionary Guard was responsible.
"More to the point, what was it doing there at all?"
No doubt. it should not have been, but it was one of nineteen aircraft to take off in the hours after the Iranian retaliatory attacks and the others were all unscathed.
If you suspect that this as anything but a cock-up on the part of the Iranians, you need to provide some evidence, rather than just engage in baseless conspiracy theories.
How could it get any worse for the Iranians than it already is? Unless it could be shown that this was the work of a rogue operator. Even then, the fault would still lay at Iran's door.
What is clear is that there is no evidence to indict the USA, Boeing, the Ukrainian carrier or its crew.
Why cannot people just accept that cock-ups occur?
I learnt today that Joan Baez has penned a song about Trump.
Here's a little song,
about a man gone wrong,
while building up his evil empire.
And after months of ifs and buts,
the papers got the guts,
to call the Man of the Year a liar,
to call the Man of the Year a liar.
Hustlin 'and buslin'
across the big green lawn
stomping 'through the famous rose garden.
But every little rose,
turned up its pretty nose,
sayin '"you owe the earth a pardon,"
sayin' "you owe the earth a pardon."
Fumblin 'and bumblin'
through the halls at night,
turning every light switch on,
searching for the room,
where you used to be the groom
but she's packed all her jew-ler-ee and gone.
Yeah she's scooped up all of her jew-ler-ee and gone.
Well the former resident,
and Missus President,
left you corn an lima beans and tomatoes.
You said, "rip 'em all out.
They'll only give me gout.
And that's unbecoming for a future dictator.
That's unbecoming for a future dictator. "
And you're gonna build a wall,
the biggiest wall, the beautifulist wall round our borders.
But here's what I think,
you better talk to a shrink,
'cuz you've got serious psychological disorders.
You've got dangerous pathological disorders.
Well that's my little song,
about a man gone wrong.
He's nasty from his head to his feet.
When the dirt on this man finally hits the fan,
and no one gives a damn about his tweets,
he'll be finally and forever obsolete..
Posted by: William | 12 January 2020 at 03:42 PM
Mike B | 12 January 2020 at 01:01 PM chastises C. Morrison for asking "What about the reports of the plane veering off course".
The initial radar trace clearly showed it making a U-turn and heading back to the airport - for reasons unspecified.
More to the point, why was it there at all? We are told that Teheran airport was closed some hours earlier, before the bombardment of American bases commenced. That makes sense.
Almost certainly the anti-aircraft battery responsible for the shooting-down would have been notified - and that means that whoever pressed the button would not have been expecting a civilian airliner to be in that piece of airspace. Look at it from this individual's viewpoint: he saw a large fast-moving return, which was not civilian. What could it be? Obviously, an incoming hostile.
Why did the Ukrainian captain elect to take-off - and why was he allowed to do so? If the airport was closed, ATC should not have given him a take-off clearance.
Technically, the captain of an aircraft in flight is allowed to over-ride ATC if he deems it necessary to ensure the safety of the aircraft and its occupants. (Legally, an aircraft is "in flight" from the moment the engines are started with the intention of flying, regardless of whether or not it has actually left the ground.) However, it is pretty difficult to justify declaring an emergency and then taking-off!
Taking-off into a "hot" air-defence zone strikes me as reckless in the extreme so again, why did he do it?
There was a report that departure was delayed because the captain was not satisfied with the way the aircraft was loaded. Is this true? I haven't the faintest idea.
But even if it is, it still doesn't explain why he requested take-off clearance nor why he was given it, bearing in mind that the airport was closed.
I have a nasty feeling that the man who pressed the button - probably a youngster of very junior rank - is going to be made the scapegoat for the whole sorry business.
What about the reports of the plane veering off course and of an engine fire?, you ask. And you thought that Martin was joking.
Those were lies, Mr Morrison, put out by the Iranian Civil Aviation Organisation, and now acknowledged as such by General Amir Ali Hazidajeh, Head of the Iranian Revolutionary Guard, who has admitted that he was aware of that organisation's responsibility for the incident, immediately, and who has apologised for it.
Sometimes, Mr Morrison, you make Monty Python's Black Knight appear the acme of hard-headed realism.

redpajama_set_name: RedPajamaCommonCrawl


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace CloudStack.Net
{
    public class ListVPCsRequest : APIListRequest
    {
        public ListVPCsRequest() : base("listVPCs") {}

        /// <summary>
        /// list resources by account. Must be used with the domainId parameter.
        /// </summary>
        public string Account {
            get { return GetParameterValue<string>(nameof(Account).ToLower()); }
            set { SetParameterValue(nameof(Account).ToLower(), value); }
        }

        /// <summary>
        /// list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR
        /// </summary>
        public string Cidr {
            get { return GetParameterValue<string>(nameof(Cidr).ToLower()); }
            set { SetParameterValue(nameof(Cidr).ToLower(), value); }
        }

        /// <summary>
        /// List by display text of the VPC
        /// </summary>
        public string DisplayText {
            get { return GetParameterValue<string>(nameof(DisplayText).ToLower()); }
            set { SetParameterValue(nameof(DisplayText).ToLower(), value); }
        }

        /// <summary>
        /// list only resources belonging to the domain specified
        /// </summary>
        public Guid? DomainId {
            get { return GetParameterValue<Guid?>(nameof(DomainId).ToLower()); }
            set { SetParameterValue(nameof(DomainId).ToLower(), value); }
        }

        /// <summary>
        /// list resources by display flag; only ROOT admin is eligible to pass this parameter
        /// </summary>
        public bool? Fordisplay {
            get { return GetParameterValue<bool?>(nameof(Fordisplay).ToLower()); }
            set { SetParameterValue(nameof(Fordisplay).ToLower(), value); }
        }

        /// <summary>
        /// list VPC by id
        /// </summary>
        public Guid? Id {
            get { return GetParameterValue<Guid?>(nameof(Id).ToLower()); }
            set { SetParameterValue(nameof(Id).ToLower(), value); }
        }

        /// <summary>
        /// defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
        /// </summary>
        public bool? Isrecursive {
            get { return GetParameterValue<bool?>(nameof(Isrecursive).ToLower()); }
            set { SetParameterValue(nameof(Isrecursive).ToLower(), value); }
        }

        /// <summary>
        /// List by keyword
        /// </summary>
        public string Keyword {
            get { return GetParameterValue<string>(nameof(Keyword).ToLower()); }
            set { SetParameterValue(nameof(Keyword).ToLower(), value); }
        }

        /// <summary>
        /// If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false
        /// </summary>
        public bool? ListAll {
            get { return GetParameterValue<bool?>(nameof(ListAll).ToLower()); }
            set { SetParameterValue(nameof(ListAll).ToLower(), value); }
        }

        /// <summary>
        /// list by name of the VPC
        /// </summary>
        public string Name {
            get { return GetParameterValue<string>(nameof(Name).ToLower()); }
            set { SetParameterValue(nameof(Name).ToLower(), value); }
        }

        /// <summary>
        /// list objects by project
        /// </summary>
        public Guid? ProjectId {
            get { return GetParameterValue<Guid?>(nameof(ProjectId).ToLower()); }
            set { SetParameterValue(nameof(ProjectId).ToLower(), value); }
        }

        /// <summary>
        /// list VPCs by restartRequired option
        /// </summary>
        public bool? RestartRequired {
            get { return GetParameterValue<bool?>(nameof(RestartRequired).ToLower()); }
            set { SetParameterValue(nameof(RestartRequired).ToLower(), value); }
        }

        /// <summary>
        /// list VPCs by state
        /// </summary>
        public string State {
            get { return GetParameterValue<string>(nameof(State).ToLower()); }
            set { SetParameterValue(nameof(State).ToLower(), value); }
        }

        /// <summary>
        /// list VPC supporting certain services
        /// </summary>
        public IList<string> SupportedServices {
            get { return GetList<string>(nameof(SupportedServices).ToLower()); }
            set { SetParameterValue(nameof(SupportedServices).ToLower(), value); }
        }

        /// <summary>
        /// List resources by tags (key/value pairs)
        /// </summary>
        public IList<IDictionary<string, object>> Tags {
            get { return GetList<IDictionary<string, object>>(nameof(Tags).ToLower()); }
            set { SetParameterValue(nameof(Tags).ToLower(), value); }
        }

        /// <summary>
        /// list by ID of the VPC offering
        /// </summary>
        public Guid? Vpcofferingid {
            get { return GetParameterValue<Guid?>(nameof(Vpcofferingid).ToLower()); }
            set { SetParameterValue(nameof(Vpcofferingid).ToLower(), value); }
        }

        /// <summary>
        /// list by zone
        /// </summary>
        public Guid? ZoneId {
            get { return GetParameterValue<Guid?>(nameof(ZoneId).ToLower()); }
            set { SetParameterValue(nameof(ZoneId).ToLower(), value); }
        }

    }
    /// <summary>
    /// Lists VPCs
    /// </summary>
    public partial interface ICloudStackAPIClient
    {
        ListResponse<VpcResponse> ListVPCs(ListVPCsRequest request);
        Task<ListResponse<VpcResponse>> ListVPCsAsync(ListVPCsRequest request);
        ListResponse<VpcResponse> ListVPCsAllPages(ListVPCsRequest request);
        Task<ListResponse<VpcResponse>> ListVPCsAllPagesAsync(ListVPCsRequest request);
    }
    public partial class CloudStackAPIClient : ICloudStackAPIClient
    {
        public ListResponse<VpcResponse> ListVPCs(ListVPCsRequest request) => Proxy.Request<ListResponse<VpcResponse>>(request);
        public Task<ListResponse<VpcResponse>> ListVPCsAsync(ListVPCsRequest request) => Proxy.RequestAsync<ListResponse<VpcResponse>>(request);
        public ListResponse<VpcResponse> ListVPCsAllPages(ListVPCsRequest request) => Proxy.RequestAllPages<VpcResponse>(request);
        public Task<ListResponse<VpcResponse>> ListVPCsAllPagesAsync(ListVPCsRequest request) => Proxy.RequestAllPagesAsync<VpcResponse>(request);
    }
}


text:
10-Year-Old Completes 50 5Ks In 50 Days For Grandpa
Kids have big hearts, and most of them choose to do kind things to help others. When Niall McDermott found out that his grandpa had been diagnosed with lung cancer, the 10-year-old wanted to find a way to help.
He wasn't sure what he could do, but then he got an idea.
Niall had always enjoyed being active, so he thought that he could raise money to help by running in a 5K.
Then, he decided to take it to the next level. He had recently watched a movie called "Iron Cowboy," about a man who had completed 50 5Ks in 50 days. He thought maybe he could do the same. His family warned him that it wouldn't be easy and were even worried that he would suffer from exhaustion during the races. Still, they allowed him to try it.
Niall said:
"I wanted to do 50 5Ks in 50 days."
His parents explained that they were shocked when their son told them about his plans.
They wanted to encourage him, so they took him to the doctor for a physical to make sure he was in good shape and healthy enough to run in one 5K, let alone another one. Ryan McDermott, the boy's father, said:
"No, I thought it was very unlikely. Ten-year-olds are fantastic, but they embark on a lot of things that they don't finish."
The doctor cleared him, and Niall started running.
He spent the next 50 days running in 5Ks. Sometimes, his family members and friends would enter them with him, and sometimes, he would just enter them on his own. His mom is impressed by Niall's dedication. She said:
"He never complained a single day, said he didn't want to do it, or he's too tired or something hurt. He was just ready to go every day. I'm amazed. I've never really known a kid to do something like this, personally. I'm proud to be his mom."
He has had numerous people to pledge and donate to him based on his 5K performance.
He has also become an inspiration for many people. His mom said that her son has taught her that children are capable of doing big things. They just need to be given the chance and the right support.
Niall recently completed his final 5K alongside a friend. When he was asked what he was thinking during that race, he said:
"I was thinking 'I'm gonna finish this and I can do it, and when I finish it, I won't have to do it anymore.'"
Now that Niall is finished, he is taking a break for a while.
That doesn't mean he is done, though. He now knows that he can make a difference and wants to do even more to help. He donated all of the money he raised from his 5K races to the Bonnie J Addario Lung Cancer Foundation in honor of his grandfather.
According to the website:
"The Bonnie J. Addario Lung Cancer Foundation (ALCF) is one of the largest philanthropies (patient-founded, patient-focused, and patient-driven) devoted exclusively to eradicating Lung Cancer through research, early detection, education, and treatment. The Foundation's goal is to work with a diverse group of physicians, organizations, industry partners, individuals, patients, survivors, and their families to identify solutions and make a timely and meaningful change and turn lung cancer into a chronically managed disease by 2023. The ALCF was established on March 1, 2006, as a 501c(3) non-profit organization and has raised over $30 million for lung cancer research and related programs."
There's no telling what Niall will be up to next.
Maybe he will choose to continue to run 5Ks and raise money in his grandfather's honor, or maybe he will use his smart mind and physical abilities to help someone else. This boy has proved that he can make a difference and can do anything he puts his mind to.
Watch his story below.
Source: CBS, KPIX CBS SF Bay Area
Jaden Smith Opens Free Vegan Food Truck For The Homeless
Entire School Learning Sign Language For Deaf Girl
This Comic Strip About Sexism Is So Important
Elderly Woman Leaves Crowd In Awe With Her Piano Skills
40 Adorable Celebrity Couples Who Have Literally Been Together For Ages


A GREAT journey BEGINS With a powerful 160cc BS-IV engine, AHO and Matte Blue Colour, let the stylish CB Unicorn 160 take you on a great journey.
When the machine echoes your growl. When it revs like your heart. When it has the works to rock every runway it treads on. You know it is a rocking beast,BUILT AFTER YOU.


text:
The Supreme Personality of Godhead
Shabda Blog Religion The Supreme Personality of Godhead
December 7, 2019 February 22, 2021
Most religions speak about the Supreme Person simply as "God". In Vedic texts, He is described as Īśvara. But in the Gaudīya Vaishnava literature, since the time of Śrīla Bhaktisiddhānta Sarasvati Thakur, the term "Supreme Personality of Godhead" is often employed to describe what is otherwise simply referred to by the word "God". Why use this complex term when a simpler "God" suffices? This post discusses the meaning of the term "Supreme Personality of Godhead" and why it is different from the conventional notions of "God". Many nuances of Vaishnavism are illustrated by this usage.
The Concept of Leadership
Godhead is the Whole Truth
Who Created the Whole Truth?
The Role of the Supreme Person's Śakti
Dormant and Reactivated Persons
Every nation, society, institution, or organization has a leader. The leader is a part of the whole, and yet he or she represents the whole. A country, for instance, has a national leader who is a citizen of the country and yet represents the entire country. A business organization has a CEO who is an employee of the business and yet represents the entire business. The country or the business are the whole, and citizens of the country and employees of the business are its parts. However, one citizen of the country or employee of the business becomes a symbolic representation of the whole. The leader is a part of the country or the business, and yet he or she is a representative of the whole.
In one sense, the country or organization are "bigger" than the leader who represents them. After all, the leader is a citizen of the country or a member of the organization, and there are many other citizens and members besides the leader. And yet, in another sense, the entire country or organization is represented by the leader. The leader is a part of the whole, and a symbol of the whole.
To understand the term "Supreme Personality of Godhead", we need to distinguish between the country and the leader of the country. Godhead means the entire created world, of which God is one citizen. The other citizens are the individual spiritual souls. Just as a country has many citizens, similarly, Godhead is the country that has many citizens. God is one of the citizens of Godhead.
The term "Supreme Personality of Godhead" represents the leader of the creation. Like a nation has a president or an organization has a CEO, similarly, Godhead has a leader—the Supreme Person of Godhead. However, we must remember that this Supreme Person is also a citizen of Godhead.
Thus, in one sense, the Supreme Person is part of Godhead—like the president is a citizen of the country. In another sense, the Supreme Person is a representative of Godhead—like the president represents the entire country. As a citizen, the Supreme Person is one part of the whole truth. As a representative of the whole, the Supreme Person is representing the whole truth. Thus, "Supreme Personality of Godhead" is both a part of the whole and a representative of the whole.
And yet, this description of Supreme Person is only a partial understanding of Godhead. The bigger question is: How did Godhead come into existence? For example, a president of the country doesn't create the citizens of the country. The leadership of the country is different from creating the country itself. In the same way, leadership of Godhead is different from the creation of Godhead.
This is where a more nuanced understanding of Godhead is described: Godhead expanded out of the Supreme Person. Like a spider expands a web out of itself, and then becomes a part of the web, in the same way, the Supreme Person expands Godhead, and then becomes its Supreme Personality. The leadership of the president of a country can be challenged because the president did not create the country. But the leadership of the Supreme Person cannot be challenged because He expanded the world out of Himself. The world is non-different from Him. Notably, the world is not identical to the Supreme Person because it is expanded from His person. And it is not different from the Supreme Person because it previously existed in God's person. While other religions say that God "created" the world, in the Vaishnava system of philosophy, God "expanded" the world from His person.
This 'expansion' of the world from the Supreme Person is much like an artist externalizing his personality on a canvas, or a reflection of a person into a mirror. The 'canvas' or 'mirror' are the Supreme Person's Śakti or energy. Thus, Godhead or the created world is not the Supreme Person per se but His Śakti.
In one sense, this Śakti is within the Supreme Person, and in another sense the Śakti is not identical to the Supreme Person. When the Śakti is considered to exist within the Supreme Person, it is described as the Supreme Person's power to know and express Himself. The Śakti is nothing other than the Supreme Person's 'consciousness' by which the Supreme Person becomes aware of His own existence. When the Śakti is described as different from the Supreme Person, the difference is simply that the power can lie dormant and hence unused. The Supreme Person is simply the possibility of bliss and knowledge. The possibility exists, so the Supreme Person exists. And yet, to convert this possibility into the experience of knowledge and bliss, Śakti is required. The Śakti is the Supreme Person's power. And yet, just like the power can lie unused and therefore dormant, similarly, the Śakti can remain inactive.
Thus, the Supreme Person is by Himself the dormant state of possibility in which Godhead doesn't exist. When the Supreme Person activates His Śakti, then Godhead is manifest from the Supreme Person, through the act of converting the possibility into reality in knowing and expressing His personality.
In a simple sense we can say that the Supreme Person exists, but when the Śakti is inactive, then He doesn't know and express Himself. When Śakti is activated then He knows Himself by expressing Himself. Godhead is the manifest world, which is expanded from the Supreme Person in His endeavor to know and express Himself. And this expansion is mediated by the Supreme Person's Śakti.
There is hence a Supreme Person before He expands into a Godhead or the world. Then, when the Supreme Person has expanded into Godhead, He is the "Supreme Personality of Godhead".
The "Supreme Personality of Godhead" is the self-aware stage of the Supreme Person in which His Śakti is active. But because the Śakti can be inactive, there is a Supreme Person who is not "Supreme Personality of Godhead". He exists although in a non-self-aware state. This state in which the Śakti is inactive is called the "deep-sleep" state of the Supreme Person. When He goes to "sleep", He loses consciousness of His own existence, and the world expanded from His person merges back into His person. When He "wakes up", and becomes self-aware, the word expands from His person.
Certain forms of Supreme Person are never in "deep sleep", and the Godhead created from their person is never merged back into His body. The spiritual world is such a Godhead in which the Śakti never becomes inactive and God never loses awareness of His own nature. But there is also the Godhead of the material world in which God sometimes goes into "deep sleep" and loses consciousness of His person. In this state, His Śakti becomes dormant, and the material creation disappears. When the Supreme Person wakes up again, the Śakti is reactivated, and the world appears. Notably, the material world must also be considered Godhead because it is expanded from the Supreme Person. Thus, the leader of the material world is also referred to as the "Supreme Personality of Godhead".
But since the Godhead may not always be expanded, therefore, the "Supreme Personality of Godhead" is technically different from the eternal "Supreme Person". The former is simply the self-aware state of the Supreme Person, while the latter is the non-self-aware of state of the Supreme Person. In the self-aware state, the Supreme Person has reactivated His Śakti to create His experience. But in the non-self-aware state, the Śakti exists in the Supreme Person but remains dormant and inactive.
The picture above depicts the Japanese God Amaterasu who is the Shinto/Japanese representation of the Sun god. The picture shows how the Sun god emerges from a "cave" and thereby creates the world in the process of illuminating it.
Previous ArticleThree Aspects of Love
Next ArticleWhy Theism Needs Alternative Causation
The Knot in the Heart
I Am The Creator, From Me Comes Everything
The Hierarchy of Yoga Systems


Dr. Charles A. Hall, a professor emeritus at the SUNY College of Environmental Science and Forestry, was featured in WalletHub's recent study examining The Most & Least Energy Expensive States.
According to the website, "In the United States, 7.1 percent of the average consumer's total income is spent on energy costs, including fuel, natural gas and electricity. During the summer, when many Americans undergo major life transitions such as relocating to start a new job … the difference in energy costs among states becomes an important financial consideration."
To help consumers make an informed decision, WalletHub identified the Most & Least Energy-Expensive States using six key metrics to rank the states according to their tendency to produce the highest or lowest monthly energy bills.
Hall's comments can be found under the "Ask the Experts" section. Hall taught systems ecology while at ESF.