Rundeck Runtime issue

Question: I am trying to upgrade Rundeck war file from rundeck-3.4.3-20210823.war to rundeck-4.1.0-20220420.war and getting SQL statement errors can some please help us from this issue.
Upgrade steps followed by below URL:
https://docs.rundeck.com/docs/upgrading/upgrading.html#runnable-war
Error:
<code>[2022-04-21T15:42:31,978] WARN  internal.JdbcEnvironmentInitiator - HHH000339: Could not obtain connection metadata: org.h2.jdbc.JdbcSQLNonTransientException: General error: "The write format 1 is smaller than the supported format 2 [2.1.210/5]" [50000-210]
[2022-04-21T15:42:33,130] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
org.h2.jdbc.JdbcSQLNonTransientException: General error: "The write format 1 is smaller than the supported format 2 [2.1.210/5]" [50000-210]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:573) ~[h2-2.1.210.jar!/:?]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) ~[h2-2.1.210.jar!/:?]
    at org.h2.message.DbException.get(DbException.java:216) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:166) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.db.Store.<init>(Store.java:140) ~[h2-2.1.210.jar!/:?]
    at org.h2.engine.Database.<init>(Database.java:324) ~[h2-2.1.210.jar!/:?]
    at org.h2.engine.Engine.openSession(Engine.java:92) ~[h2-2.1.210.jar!/:?]
    at org.h2.engine.Engine.openSession(Engine.java:222) ~[h2-2.1.210.jar!/:?]
    at org.h2.engine.Engine.createSession(Engine.java:201) ~[h2-2.1.210.jar!/:?]
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338) ~[h2-2.1.210.jar!/:?]
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122) ~[h2-2.1.210.jar!/:?]
    at org.h2.Driver.connect(Driver.java:59) ~[h2-2.1.210.jar!/:?]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-9.0.44.jar!/:?]
    at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:405) ~[spring-jdbc-5.3.18.jar!/:5.3.18]
    at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:378) ~[spring-jdbc-5.3.18.jar!/:5.3.18]
    at com.sun.proxy.$Proxy161.getMetaData(Unknown Source) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:238) ~[spring-jdbc-5.3.18.jar!/:5.3.18]
    at com.sun.proxy.$Proxy161.getMetaData(Unknown Source) ~[?:?]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:70) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:473) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:84) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689) ~[hibernate-core-5.4.24.Final.jar!/:5.4.24.Final]
    at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:287) ~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
    at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.create(HibernateConnectionSourceFactory.java:86) ~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
    at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:39) ~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
    at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:23) ~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
    at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:64) ~[grails-datastore-core-7.2.1.jar!/:?]
    at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52) ~[grails-datastore-core-7.2.1.jar!/:?]
    at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24) ~[grails-datastore-core-7.2.1.jar!/:?]
    at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:212) ~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:311) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:296) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1607) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1571) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1437) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1347) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:428) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:173) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:707) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:198) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.18.jar!/:5.3.18]
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234) ~[spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.embedded.jetty.ServletContextInitializerConfiguration.callInitializers(ServletContextInitializerConfiguration.java:65) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.embedded.jetty.ServletContextInitializerConfiguration.configure(ServletContextInitializerConfiguration.java:54) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:498) [jetty-webapp-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409) [jetty-webapp-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:910) [jetty-server-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288) [jetty-servlet-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524) [jetty-webapp-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) [jetty-util-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) [jetty-util-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.server.Server.start(Server.java:423) [jetty-server-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) [jetty-util-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) [jetty-server-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.server.Server.doStart(Server.java:387) [jetty-server-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) [jetty-util-9.4.44.v20210927.jar!/:9.4.44.v20210927]
    at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:447) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:181) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) [spring-context-5.3.18.jar!/:5.3.18]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.6.2.jar!/:2.6.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.2.jar!/:2.6.2]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:99) [grails-core-5.1.6.jar!/:5.1.6]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:485) [grails-core-5.1.6.jar!/:5.1.6]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:472) [grails-core-5.1.6.jar!/:5.1.6]
    at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-5.1.6.jar!/:?]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) [groovy-3.0.9.jar!/:3.0.9]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-3.0.9.jar!/:3.0.9]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148) [groovy-3.0.9.jar!/:3.0.9]
    at rundeckapp.Application.main(Application.groovy:32) [classes!/:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [rundeck-4.1.0-20220420.war:?]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [rundeck-4.1.0-20220420.war:?]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [rundeck-4.1.0-20220420.war:?]
    at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) [rundeck-4.1.0-20220420.war:?]
Caused by: org.h2.mvstore.MVStoreException: The write format 1 is smaller than the supported format 2 [2.1.210/5]
    at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.MVStore.getUnsupportedWriteFormatException(MVStore.java:1059) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:878) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.MVStore.<init>(MVStore.java:455) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056) ~[h2-2.1.210.jar!/:?]
    at org.h2.mvstore.db.Store.<init>(Store.java:129) ~[h2-2.1.210.jar!/:?]
    ... 173 more
[2022-04-21T15:42:33,134] WARN  internal.JdbcEnvironmentInitiator - HHH000339: Could not obtain connection metadata: org.h2.jdbc.JdbcSQLNonTransientException: General error: "The write format 1 is smaller than the supported format 2 [2.1.210/5]" [50000-210]
[2022-04-21T15:42:33,135] WARN  webapp.WebAppContext - Failed startup of context o.s.b.w.e.j.JettyEmbeddedWebAppContext@3467d540{application,/,[org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory$LoaderHidingResource@67710b92, jar:file:/ngs/app/dcf5d/rundeck/rundeck-4.1.0-20220420.war!/WEB-INF/lib/jquery-3.5.1.jar!/META-INF/resources],UNAVAILABLE}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rundeckPreauthFilterDeReg': Cannot resolve reference to bean 'rundeckPreauthFilter' while setting bean property 'filter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rundeckPreauthFilter': Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager': Cannot resolve reference to bean 'daoAuthenticationProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
</code>
Comment: Hi! Could you elaborate? Are you using some database as a backend?
Comment: I would think the 1st thing is to contact rundeck tech support, no?
Comment: Hi OldProgrammer, the dedicated tech support is for Process Automation On Prem (Formely Rundeck Enterprise).
Comment: Hi MehaDrive68k, I have followed below link for database migration steps..

https://docs.rundeck.com/docs/upgrading/upgrading-to-rundeck-3.4.html#package-repositories

Still i am facing the same issue. Please suggest if anything i am missing here.
Comment: Hi Rajesh, Which database and version are you using? Could you share (at the question) the full stack trace?
Comment: Rajesh, the database migration process isn't needed for Rundeck 3.3.5 or above. Could you try again in a non-prod environment? (without the DB migration process)
Comment: Yeah, I am trying in non-prod only.. Initially i have tried without DB migration but its issue occurs then i have seen few blogs and i have followed.
Comment: Existing data base is h2.  Updating Full stack trace in the description,
Answer: Problem context
Rundeck versions before 4.1.0 use the H2v1 database as the default testing backend, 4.1.0 and above use H2v2, H2v2 fixes a lot of issues but the bad news here is that doesn't exist a way to upgrade this H2v1 to h2v2 automatically (because H2v2 breaks the compatibility with H2v1 drivers).
You can read more about this here.
So, you have two alternatives

Start your previous instance, backup all projects and keys, run 4.1.0 against a real database backend like MySQL or PostgreSQL and then import your projects and keys. Here you can see how to configure against a "real" backend.

Migrate your old H2v1 (Rundeck 3.4.3) database to H2v2 (Rundeck 4.1.0) using this script following these steps.

Definitely, the recommended option is the first one, H2 is a database only for testing purposes, not for production environments.
You can read more about it here.
"Don't use the H2 embedded database for anything except testing and non-production."
UPDATE 04/25/2022:
Some steps to move to a "real database" latest Rundeck instance:

Upgrade all your server data.
Start your old instance and follow this to backup your projects and this to backup your keys. Also, make sure to backup your model sources (<code>resources.xml</code> or <code>resources.yaml</code> files).
Stop the old instance.
Upgrade your instance following this and remove the <code>{RUNDECK_HOME}/server/config/bootstrap.yml</code> file (or <code>/etc/rundeck/bootstrap.yml</code> file).
Create a new database following this, make sure to configure Rundeck correctly. Check the MySQL example.
Start the 4.1.0 instance and import your projects following this (using the files exported in the second step).
Comment: Hi Team, I have followed the first option but still having issue while starting the rundeck application.
Comment: Hi Rajesh, could you elaborate? which steps are you following? the error appears when starting the old instance or when running the new one against MySQL/PostgreSQL?
Comment: I added a few steps to upgrade to the new Rundeck version against a "real database".
Comment: I have followed the below link https://docs.rundeck.com/docs/upgrading/upgrading-to-4.1.html#h2-database-upgrade.   -- The error appears while staring the old instance only..
Comment: Rajesh, if you decided to follow the 2nd way (the h2 upgrade process), please follow this guide: https://github.com/rundeck-plugins/h2-v2-migration#preparation. Now, I'm not sure what is your current process when you say "I have followed the first option", the first option is to move your projects to MySQL/PostgreSQL/Oracle.
Comment: Sorry, I have followed the second option only..
Comment: Thank You MegaDrive68k, Finally, I can upgrade rundeck war file to latest one. While starting the server getting some WARN jdbc messages. Can you please check..

Rundeck Runtime issue


How do I execute a view in a custom module and print the output (as HTML markup)?

Question: I want to print the output from a simple view in my custom module. But is doesnt work. I have tried many options from forums and stackoverflow. All of them print "array" instead of html-markup.
My controller:
class DefaultController extends ControllerBase {

    public function myfunc1() {

        $view = Views::getView('myfirstview');

        $view->setDisplay('page_1');
        $view->preExecute();
        $view->execute();

        // $myresults = $view->preview();  = array
        // $myresults = $view->render();  = array
        $myresults = $view->result; // = array

        return array(
            '#title' => 'Hello World!',
            '#markup' => $myresults,
        );
    }
}

How can I print the result/output of a view programmatically?
I dont want to make it without "embed view" , because I want to set some exposed filters later.
Answer: Views implements its own render element type (Drupal\views\Element\View), which you can use like so:
return [
  '#title' => 'Hello world',
  'view' => [
    '#type' => 'view',
    '#name' => 'myfirstview',
    '#display_id' => 'page_1',
    '#arguments' => ['foo', 'bar'],
    '#embed' => TRUE,
  ],
];

If you need to manipulate the View before rendering it, (you mentioned exposed filters), you can do that first and pass along the object:
$view = Views::getView('myfirstview');
$view->setFoo('bar');

return [
  '#type' => 'view',
  '#name' => 'myfirstview',
  '#view' => $view,
  '#display_id' => 'page_1',
  '#embed' => TRUE,
];

Answer: Notes:
The View has to be a block.
Exposed filters can be added but will not be displayed on your page.
You can set them in your page, eg for a 'severity' field:
$filters = $view->getDisplay()->getOption('filters');
$filters['severity']['value'] = [0,1,2,3,4,5,6]; // include a set of values.
$view->getDisplay()->overrideOption('filters', $filters);


The associated graded ring of the localization $k[x_1,\dots,x_n]_{(x_1,\dots,x_n)}$

Question: I was reading the Atiyah-Macdonald p. 121:

Example. Let $A$ be polynomial ring $k[x_1,\dots,x_n]$ localized at the maximal ideal $\mathfrak{m}=(x_1,\dots,x_n)$.
Then $G_{\mathfrak{m}}(A)$ is a polynomial ring in $n$ indeterminates and so its Poincare series is $(1-t)^{-n}$. Hence we deduce that $\dim A_{\mathfrak{m}}=n$.

I don't know how to show that

$G_{\mathfrak{m}}(A)$ is a polynomial ring in $n$ indeterminates.

I think this is true for $A=k[x_1,\dots,x_n]$. But here $A$ is the localization $k[x_1,\dots,x_n]_{(x_1,\dots,x_n)}$.
Also, I think "$A_{\mathfrak{m}}$" might be a typo since $A$ is already the localization ring.
Any answer and hints are welcome! Thanks a lot.

Here the associated graded ring $G_{\mathfrak{m}}(A)$ is defined by
$$G_{\mathfrak{m}}(A)=\bigoplus_{n=0}^{\infty}\mathfrak{m^n}/\mathfrak{m}^{n+1}=(A/\mathfrak{m})\oplus (\mathfrak{m}/\mathfrak{m}^2)\oplus \cdots.$$
Answer: In general, if $B$ is a ring with a maximal ideal $\mathfrak{m}$, then $G_\mathfrak{m}(B)\cong G_{\mathfrak{m}}(A)$ where $A$ is the localization $B_{\mathfrak{m}}$.  Indeed, the modules $\mathfrak{m}^n/\mathfrak{m}^{n+1}$ are all already $\mathfrak{m}$-local (i.e., all elements of $A\setminus\mathfrak{m}$ act invertibly on them) since they are $A/\mathfrak{m}$-modules, and so localizing doesn't change them.  So your case, you can compute $G_\mathfrak{m}(A)$ using the polynomial ring $B=k[x_1,\dots,x_n]$, in which case it is easy to identify $\mathfrak{m}^n/\mathfrak{m}^{n+1}$ as the homogeneous polynomials of degree $n$ and so $G_\mathfrak{m}(B)$ will just be isomorphic to $B$ with its natural grading by degree.
Comment: Would it be possible to help me out with my question which is similar to your answer? https://math.stackexchange.com/questions/3785312/what-is-the-associated-graded-ring-of-the-localized-ring-kx-x-at-its-max


How to adjust to practicing with a junior varsity and varsity football team?

Question: I'm a freshman in high school going into sophomore year. I played on the freshman team this year and now it's onto JV. JV and Varsity practice together, so I will be with the varsity players also.
I am a tailback and this year was my first year of football. I was the hardest hitter on the freshman team, not including linemen because they hit harder due to their size, but anyways that means I can deliver a decent hit when I'm running and didn't really get knocked around so far.
But this year I will be running into the varsity defense and don't know what to do....I'm most worried about when we practice inside run because they will throw me in there and I'm gonna get hit. I know that there is no avoiding it, I just want some tips on how to survive as a little sophomore against big seniors at tailback.
Comment: Welcome Sports SE! You had tagged `football` on this question, instead of `american-football`, to which I believe your question is pertaining. The `football` tag is for the sport you would call 'soccer', which the rest of the world calls 'football'. I have edited it for you. Please read the the description of the tag before posting your next question.
Comment: Also, I updated the title to be less specific to your circumstances, but to capture the general concept of what you will be experiencing to be more helpful to anyone who may be experiencing a similar thing. Feel free to roll back if I have changed the title too much.
Answer: There are several factors to consider in this situation:

The size of the varsity players who will be defending you in comparison to your size.
The amount of actual practice time that you will be with the varsity team.
Most High School football teams run "daily doubles" that focus on strength and conditioning as well as running plays.  You shouldn't be thrown in right from the beginning to be "hit" by seasoned varsity players.
Speak to your coach.  Most coaches are aware of smaller or younger players practicing and playing with older and more seasoned players.

Also, most High School practices do not consist of full gear hitting and practice every day.  I believe that most teams practice without pads for 2 days a week to just run plays.  Even with full pads, there shouldn't be blocking or hitting going on during practice like what will be happening during a game.
The best thing to do is to ensure that you are conditioned and strengthened to take a hit.  Practice with a friend with full pads.  Do some sort of drills such as "bull in the ring" with your friends.
Just remember that safety is the key and to not do anything that will endanger you or your friends.


How to remove duplicates in Exim .forward file?

Question: I would like to remove duplicates messages in some mailing-lists (cross-list posting) in my Exim .forward file.
I was using procmail before with these commands:
<code>:0 Wh: msgid.lock
| /usr/bin/formail -D 8192 msgid.cache
</code>
What is the right way to achieve this using .forward Exim files?
Answer: This isn't really possible to do with Exim filter files. It might be possible to do with embedded Perl or abusing the database lookups, but this would require changing the system exim.conf.


Fourier transform and lebesgue integral

Question: Let $f:\mathbb{R}^d \rightarrow \mathbb{R}^d$ be the function with $f(x) = \exp(-\frac{1}{2}\mid x \mid^2)$. Show that the fourier transform of $f$ is given by $\hat f = (\sqrt{2 \pi})^d f$.
The fourier transform is given by $\hat f (\xi ) := \displaystyle\int_{\mathbb{R}^d} f(x) \exp(-i\xi \cdot x)\ \mu(dx)$.
I would like to start with looking at the case $d = 1$ but I dont know how to proceed.
Answer: It's a Gaussian integral---complete the square up in the exponential to get $(2\pi)^{d/2} e^{-\|\xi\|^2/2}$. Standard result on multivariate Gaussians (and no need to worry about Lebesgue).
Comment: How do you know that $\int_{-\infty}^\infty e^{- (x-i \xi)^2/2}dx =\int_{-\infty}^\infty e^{- x^2/2}dx$
Answer: For $d=1$, we have $f(x)=e^{-x^2/2}$ and therefore (remember that $(i\xi+x)^2=-\xi^2+2i\xi x+x^2$)
\begin{equation*}
\begin{split}
\hat{f}(\xi) & = \int_{-\infty}^{\infty} e^{-1/2(2i\xi x + x^2)} {\rm d}\mu(x) \\
& = \int_{-\infty}^{\infty} e^{-1/2((i\xi+x)^2+\xi^2)} {\rm d}\mu(x) \\
& = f(\xi) \int_{-\infty}^{\infty} e^{-(i\xi+x)^2/2} {\rm d}\mu(x) \\
& =f(\xi) \int_{-\infty}^{\infty} e^{-y^2/2} {\rm d}\mu(y) \\
& = \sqrt{2\pi} f(\xi).
\end{split}
\end{equation*}
It's pretty similar for $d>1$.
Comment: How do you know that $\int_{-\infty}^\infty e^{- (x-i \xi)^2/2}dx =\int_{-\infty}^\infty e^{- x^2/2}dx$
Comment: Change variable and the contribution from the ends of the contour (which gets shifted up or down) is negligible.
Comment: How do I continue for $d=2$ and so on?
Comment: For any $d\geq 1$ you will get $$\hat{f}(\xi)=f(\xi)\int_{\mathbb{R}^d} e^{-|y|^2/2} {\rm d}\mu(y)$$ which is just $\hat{f}(\xi)=(2\pi)^{d/2} f(\xi)$.
Comment: Actually the fourth equality requires complex analysis which is not allowed in this task.

Fourier transform and lebesgue integral


Convert Array of Decimal Digits to an Array of Binary Digits

Question: This is probably a quite exotic question.
My Problem is as follows:
The TI 83+ graphing calculator allows you to program on it using either Assembly and a link cable to a computer or its built-in TI-BASIC programming language.
According to what I've found, it supports only 16-Bit Integers and some emulated floats.
I want to work with a bit larger numbers however (around 64 bit), so for that I use an array with the single digits:
{1, 2, 3, 4, 5}

would be the Decimal 12345.
In binary, that's 110000 00111001, or as a binary digit array:
{1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1}

which would be how the calculator displays it.
How would i go about converting this array of decimal digits (which is too large for the calculator to display it as a native type) into an array of decimal digits?
Efficiency is not an issue. This is NOT homework.
This would leave me free to implement Addition for such arrays and such.
thanks!
Answer: Thought about it and I think I would do it with the following 'algorithm'

check the last digit (5 in the example case)
if it is odd, store (from the reverse order) a 1 in the binary array
now divide the number by 2 through the following method:
begin with the first digit and clear the 'carry' variable.
divide it by 2 and add the 'carry' variable. If the remainder is 1 (check this before you do the divide with an and&1) then put 5 in the carry
repeat untill all digits have been done

repeat both steps again untill the whole number is reduced to 0's.
the number in your binary array is the binary representation
your example:
1,2,3,4,5

the 5 is odd so we store 1 in the binary array:    1
we divide the array by 2 using the algorithm:
0,2,3,4,5  =>  0,1+5,3,4,5 =>  0,6,1,4,5 => 0,6,1,2+5,5 => 0,6,1,7,2

and repeat:
0,6,1,7,2   last digit is even so we store a 0: 0,1   (notice we fill the binary string from right to left)
etc
you end up with a binary
EDIT:
Just to clarify above: All I'm doing is the age old algorithm:
 int value=12345;
 while(value>0)
 {
      binaryArray.push(value&1);
      value>>=1;     //divide by 2
 }

except in your example we don't have an int but an array which represents a (10 base) int ;^)
Comment: excellent, this works. although the divide-by-two algorithm baffled me at first: you start with the first digit (and work to the right), and each time the digit you're on is odd you carry a 5 to add to the division-result of the next digit.
Comment: Cool!  The 5 actually comes from the fact that the number is of base 10. And base 10 divided by 2 is 5. With binary division you'd add a 1 in the carry (base 2 divided by 2)  ;^)
Answer: On way would be to convert each digit in the decimal representation to it's binary representation and then add the binary representations of all the digits:
5 = 101
40 = 101000
300 = 100101100
2000 = 11111010000
10000 = 10011100010000

             101
          101000
       100101100
     11111010000
+ 10011100010000
----------------
  11000000111001

Proof of concept in C#:
Methods for converting to an array of binary digits, adding arrays and multiplying an array by ten:
private static byte[] GetBinary(int value) {
  int bit = 1, len = 1;
  while (bit * 2 < value) {
    bit <<= 1;
    len++;
  }
  byte[] result = new byte[len];
  for (int i = 0; value > 0;i++ ) {
    if (value >= bit) {
      value -= bit;
      result[i] = 1;
    }
    bit >>= 1;
  }
  return result;
}

private static byte[] Add(byte[] a, byte[] b) {
  byte[] result = new byte[Math.Max(a.Length, b.Length) + 1];
  int carry = 0;
  for (int i = 1; i <= result.Length; i++) {
    if (i <= a.Length) carry += a[a.Length - i];
    if (i <= b.Length) carry += b[b.Length - i];
    result[result.Length - i] = (byte)(carry & 1);
    carry >>= 1;
  }
  if (result[0] == 0) {
    byte[] shorter = new byte[result.Length - 1];
    Array.Copy(result, 1, shorter, 0, shorter.Length);
    result = shorter;
  }
  return result;
}

private static byte[] Mul2(byte[] a, int exp) {
  byte[] result = new byte[a.Length + exp];
  Array.Copy(a, result, a.Length);
  return result;
}

private static byte[] Mul10(byte[] a, int exp) {
  for (int i = 0; i < exp; i++) {
    a = Add(Mul2(a, 3), Mul2(a, 1));
  }
  return a;
}

Converting an array:
byte[] digits = { 1, 2, 3, 4, 5 };

byte[][] bin = new byte[digits.Length][];
int exp = 0;
for (int i = digits.Length - 1; i >= 0; i--) {
  bin[i] = Mul10(GetBinary(digits[i]), exp);
  exp++;
}
byte[] result = null;
foreach (byte[] digit in bin) {
  result = result == null ? digit: Add(result, digit);
}

// output array
Console.WriteLine(
  result.Aggregate(
    new StringBuilder(),
    (s, n) => s.Append(s.Length == 0 ? "" : ",").Append(n)
  ).ToString()
);

Output:
1,1,0,0,0,0,0,0,1,1,1,0,0,1

Edit:
Added methods for multiplying an array by tens. Intead of multiplying the digit before converting it to a binary array, it has to be done to the array.
Comment: This doesn't work since the MUL variable would overflow the int if the numbers became larger than an int.   So converting: 4294967296 (0x100000000) would not be possible.
Comment: If anything, you could have just as easily added the numbers together right away after mulling them and then converting them to binary all at once instead of doing binary addition. Again this would also be limited to the range of int
Comment: how do you propose to convert, say the 7th digit (of a 7+ digit number, duh), to binary if you can't represent it as an integer on the calculator?
Comment: @wsd: You don't have to. You represent the single digit as binary (for example 2 in 2000 as {1,0}), then you multiply the binary by tens (which is easily done by shifting and adding).
Comment: I just tested to convert the decimal number {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0} to binary, and the result is the correct {1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,1,0,1,1,0,1,0,0,1,0}.
Answer: The main issue here is that you're going between bases which aren't multiples of one another, and thus there isn't a direct isolated mapping between input digits and output digits. You're probably going to have to start with your least significant digit, output as many least significant digits of the output as you can before you need to consult the next digit, and so on. That way you only need to have at most 2 of your input digits being examined at any given point in time.
You might find it advantageous in terms of processing order to store your numbers in reversed form (such that the least significant digits come first in the array).
Comment: however, the second binary digit can influence the previous ones: the number 17 for instance: the last digit translates to a binary 0111, and moving on to the decimal digit 10 (which needs to be stored...) it represents in bnary 1010, and to add that to 0111 requires binary addition, and now imagine doing binary additions for 99-binary-digit numbers 30 times (30 decimal digits <= 99 binary digits)


Oracle Database Recovery Problem

Question: I am very new to Oracle, and trying to restore a oracle 8i database on win 2000 server.

I have one week old database backup (backup taken with exp command), and i want to restore it now.
Now I am unable to login through sqlplus (got shutdown in progress error)
I have a backup and i want to restore it, but oracle is not starting at all, and 'imp' command is failing.

I started sqlplus / as sysdba  and following is the log of what i am trying to do. Can some one guide me further.
<code>SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area  143423516 bytes
Fixed Size                    75804 bytes
Variable Size              58105856 bytes
Database Buffers           85164032 bytes
Redo Buffers                  77824 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  143423516 bytes
Fixed Size                    75804 bytes
Variable Size              58105856 bytes
Database Buffers           85164032 bytes
Redo Buffers                  77824 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01245: offline file 1 will be lost if RESETLOGS is done
ORA-01110: data file 1: 'C:\ORACLE\ORADATA\ABCD\SYSTEM01.DBF'
</code>
Comment: Do you know what corruption has occurred? What are you trying to fix with reverting to the week-old exp?
Comment: is there any way , i can delete all data files, and import my old backup ?
Answer: EXP and IMP are not 'backups'. They are copies of data.
They expect to be imported into an operational database (often with users, grants and tablespaces already existing). You could try to get your existing database operational, but whether that is possible depends on what caused it to break in the first place. If you've lost important things like the datafiles for the system tablespace and don't have copies, then give up on it.
As advised by DCookie, you'd probably be best off creating a new database and importing into that.
You don't say whether the export is for the entire database or specific schemas, or whether you have non-schema objects (eg PUBLIC SYNONYMS).
If you have a full database export, then I'd recommend creating an 8i database and doing a full database import (which will include non-schema objects, users, tablespaces etc). Adding a database version upgrade would, IMHO, complicate things.
If you have schema exports, then you can look at a later version of Oracle as you have to to create the users, roles, tablespaces etc to get things loaded anyway.
Answer: Is there a requirement to stay with 8i? You can simply create an empty database with 11g or 10g and import the 8i database export into it, and then you'll be relatively current. Otherwise, you can create an empty 8i database as well and use import.
Run the Oracle Database Configuration Assistant. From there you can create a database instance fairly easily.

Oracle Database Recovery Problem


Blank lines in a .csv files created through SSMS :OUT command

Question: I'm using code like this in MSSQL 2008 R2 management Studio to write the results of a SELECT statement to a csv file on a network share:
SET NOCOUNT ON;
GO
:OUT \\126.96.36.1998\SomeFolder\mydata.csv
SELECT id, name, surname FROM sometable;
GO

This creates the mydata.csv file at the correct location but there is an extra blank line at the end of the csv file. How do I prevent that blank line from being created in the csv file?
Is the above the best way to write the output of a sql query to a text file? I can't use BCP.
Thanks.
Comment: I see the same results here whenever I run this. My thought is that this is "just the way it works". Can use use SSIS?
Comment: It seems that the blank line is part of the "x rows affected" message that would be displayed if NOCOUNT is OFF.
Comment: @coge.soft, the syntax he is using (e.g. :OUT blah) is SQLCMD being run through SSMS.
Comment: Are you sure that this is an extra blank line and not just the result of a carriage return /line feed at the end of the last line? Do you have trouble re importing the file? Is another process complaining about the line?
Answer: I think you can use SSIS package to get the query result in .CSV format. sometime you may get blank line or space in between two lisne, in that case 'Derived Column' transformation task and remove or trim the unwanted spaces and lines.
Answer: Can you try the following from the command prompt?
C:\>sqlcmd -S SQLServerHost -W -Q "SET NOCOUNT ON; SELECT TOP 5 date_id, previous_date, next_date FROM dates WHERE month_key = 201212" > testNoLine.txt

The result:

The generated file has no extra line at the bottom (unlike the SSMS execution).
Comment: The MSDN link (http://msdn.microsoft.com/en-us/library/ms162773(v=sql.105).aspx) is not providing a switch for the W parameter. Another reason for a difference is OLE DB vs .Net client - maybe one of them is returning an extra line all the time?
Answer: In the end using a SSIS package was a much better solution.


Get all Parse objects with single API request

Question: Is it possible to get all Parse objects (of different classes) with a single API request, using the Parse iOS/Android SDK? How?
Comment: @rdurand https://parse.com/questions/get-all-parse-objects-with-single-api-request
Comment: I'd like to know too, I haven't found any solution so far. I have 4 classes and use 4 API requests to get all my objects. Have you tried their forums ?
Comment: Thanks ! Too bad it's not possible !
Answer: From the Parse Help forum:

At the moment, it is not possible to do this with a single API request.
Answer: Include latest library i.e. Parse-1.3.1.jar and then go to the queries section of android and ios
https://www.parse.com/docs/android_guide#queries


How Do I Test nested ES6 Generators using Mocha?

Question: I'm trying to use co-mocha to test some nested generators functionality in my koa app.  The class works just fine at runtime, but when I attempt to test the functionality, I cannot get the nested generator to run in my test.
Class being tested:
import Promise from 'bluebird'

class FooService {
  _doAsync(){
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve({
          foo: 'FOO'
        })
      }, 500)
    })
  }

  create(){
    console.log('This never gets logged')
    let self = this
    return function*(){
      console.log(`This doesn't either`)
      return yield self._doAsync()
    }
  }
}
export default new FooService()

Test File
import fooService '../services/foo-service'
import Chai from 'chai'
let expect = Chai.expect

describe('Testing generators', () => {
  it('Should just work', function *(){
    console.log('This log never happens')
    let result = yield fooService.create()
    expect(result).to.equal({foo: 'FOO'})
  })
})

I'm running mocha w/ --require co-mocha and Node 4.2.6
While the tests complete w/o errors, NONE of the console above ever get logged and so I'm quite sure the actual test generator is never running at all.
If I try using the npm package, mocha-generators instead, while I get the log from inside the test generator, the underlying generator returned from the create() method on the service never fires...
What am I doing wrong??
Comment: You probably want to `yield* fooService.create()()`
Comment: @RavenHursT The primary issue is that if you are exporting a class singleton, you might as well just export an object. You gain nothing by using class syntax. You could just as easily `export default function create(){}` or if you do have multiple functions, `export function create(){}`.
Comment: Never export class instances! Either export the class, or don't use `class` syntax and create an object literal instead.
Comment: @Bergi how would changing that line change anything (in the case of `co-mocha`) when the generator that line is sitting in, never appears to run in the first place?
Comment: @Bergi Your line modification worked with the `mocha-generators` library!  Thank you!  Please add it as an answer?

On a side note, why the assertion that we should "never" export a class instance?  I was under the impression that, in the case of singletons, this pattern works quite well due to `require`'s build-in caching?
Comment: @RavenHursT: And worse, not only do you gain nothing, but you also create a useless prototype chain and leak the class constructor of the would-be singleton. See also [here](http://stackoverflow.com/q/10406552/1048572).
Answer: Without mocha-generators, the it callback returns a generator that will not be run by anyone. You'd need to wrap it in co manually so that mocha would receive a promise.
With mocha-generators, your generator is executed but yields a generator function. That's not expected, you are supposed to yield promises. You need to call the generator function that the create() call returns yourself, and then you shouldn't yield a generator itself but rather delegate to it via yield*:
let result = yield* fooService.create()();


Deploy a docker image on Google Cloud Run

Question: I am trying to deploy a Java Socket application that will serve incoming requests on some port over TCP. The image is building fine and the container is running as expected locally.
However when deploying to GCR it throws the following error
{
  "textPayload": "terminated: Application failed to start: Failed to create init process: failed to load /usr/lib/jvm/java-17-openjdk//bin/java: exec format error",
  "insertId": "631891ef0005eae9ece915df",
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "project_id": "cumulus-0",
      "service_name": "cumulus",
      "revision_name": "cumulus-00001-hib",
      "location": "asia-south1",
      "configuration_name": "cumulus"
    }
  },
  "timestamp": "2022-09-07T12:43:27.387764458Z",
  "severity": "ERROR",
  "labels": {
    "instanceId": "00c527f6d4880e8a5a96fbdadc4536870f1e55a884c529efc6f860386bb3766d594380d65a657a35adebed119b05e2007cbef26928db216236f1641e97b306"
  },
  "logName": "projects/cumulus-0/logs/run.googleapis.com%2Fvarlog%2Fsystem",
  "receiveTimestamp": "2022-09-07T12:43:27.390641080Z"
}

Specifically - terminated: Application failed to start: Failed to create init process: failed to load /usr/lib/jvm/java-17-openjdk//bin/java: exec format error
this comes when the platform in unsupported for the jvm to run. But it is inside a docker container. I dont know whats the matter with this.
Here is my Dockerfile
FROM alpine:latest
RUN apk update && \
    apk add openjdk17-jre=18.104.22.168_p1-r0

ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk

LABEL in.rainycloud.cumulus="firstname.lastname@example.com"

COPY build/libs/cumulus*.jar /usr/lib/

CMD ["/usr/lib/jvm/java-17-openjdk/bin/java", "-jar", "/usr/lib/cumulus-v0.1.jar", "in.rainycloud.cumulus.Main"]

EXPOSE 33333/tcp

Comment: You MUST serve HTTP traffic with Cloud Run. You can't serve custom TCP traffic. Use GKE (autopilot or standard) or Compute Engine for that use case.
Comment: You have incorrectly set up Java in the container. I recommend starting with an official Docker Java image and build from that.
Answer: Firstly, the path seems to be fishy.
Why do you have to provide full java bin path. If your build is depending upon some other libraries which requires c,make tools then try with full jdk too.
Also,check this code. It provides start point for your server
# java -jar /usr/local/runme/app.jar
ENTRYPOINT ["java","-jar","app.jar"]

Full code reference: https://mkyong.com/docker/docker-and-java-application-examples/


Edit tab available to anonymous user on some but not all pages?

Question: On a Drupal 6 site that I've inherited, there is a custom content type for staff profiles.  Editing should be limited to two user roles "content creator" and "careers."  This has worked fine for the past 2+ years, but a few weeks ago we noticed that some, but not all, of the individual staff page/nodes are editable buy anonymous users (anyone!).
I've looked at the permissions for this content type as well as for all our user roles-- nothing indicates that this should be possible at all.
The only way I've been able to "fix" this is by recreating the nodes 1-by-1 and deleting the "broken" ones.
I'm particularly curious as to why this only affects some nodes-- I have so far been unable to detect any sort of pattern that connects them.
Any ideas where I should be looking to diagnose this?
Comment: have you installed/enabled a contributed module before you notice this issue?
Comment: Are there any node access modules installed? If so, I'd try rebuilding access permissions.
Comment: @Aboodred1 - Haven't installed any modules in the past few months, and the problem reared its ugly head a couple of weeks ago...
Comment: @AlfredArmstrong - excellent suggestion, but no joy...
Answer: We finally found out what was happening.  Drupal was configured so that when an authorized user account was deleted, the owner for all their content was changed to Anonymous.  Modified the setup so that the owner of all "orphaned" pages is set to Admin.
Comment: I'm having the same issue. How/where did you make that change to owner of all 'orphaned' pages is set to Admin?


Same nested selection

Question: Is there any performance difference between:
size.width += this->font->chars[*ch].advance + this->font->chars[*ch].offset.x;

and
char_data *chars = this->font->chars;
while(...) {
   size.width += chars[*ch].advance + chars[*ch].offset.x;
}

In first example are always read vars( this->font, font->chars ) within loop, or they are cached?
Answer: That would depend on your compiler and optimization settings. At the most basic level, the first one will be slower because you're doing extra dereferencing and access operations. But in reality, the optimizer can identify these repetitions and eliminate them.
To definitively answer this, you should run a test and compare the two to see if there is a statistically significant difference in running times.
Comment: Would the optimizer do this?  Who's to say I'm not changing `font` in another thread?
Comment: @John at CashCommons: Nothing. That's why you need to use mutexes if you have two threads accessing the same data with one writing to it. If you expect this to happen, declare it volatile (I think that's the one) and it won't do this optimization.

Same nested selection


creating jQuery function to reduce code

Question: currently i have separate functions for hover and click events but list of icons is growing and i want to make universal function that can work with all the icons, but I'm not sure where to start at. btw I'm aware that I'm using same images for backhoe and excavator src.
var excavator = false;
var backhoe = false;
var paver = false;
var compactor = false;
var motorgrator = false;

$("#excavator").mouseleave(function () {
    if(!excavator)
        $(this).attr("src", "img/default_excavator.png");
});
$("#excavator").mouseenter(
  function () {
      if(!excavator)
        $(this).attr("src", "img/hover_excavator.png");
});
$("#excavator").click(
  function () {
    $(this).attr("src", "img/active_excavator.png");
    $("#equipmentList").load('partials/excavator.php');
    excavator = true;
    backhoe = false;
    $("#backhoe").attr("src", "img/default_excavator.png");
});

/******************** end of excavator ********************/

$("#backhoe").mouseleave(function () {
    if(!backhoe)
        $(this).attr("src", "img/default_excavator.png");
});
$("#backhoe").mouseenter(
  function () {
      if(!backhoe)
        $(this).attr("src", "img/hover_excavator.png");
});
$("#backhoe").click(
  function () {
    $(this).attr("src", "img/active_excavator.png");
    $("#equipmentList").load('partials/backhoe.php');
    backhoe = true;
    excavator = false;
    $("#excavator").attr("src", "img/default_excavator.png");
});

$('#top').click(function(){
    $("html, body").animate({ scrollTop: 0 }, 600);
    return false;
 });

below is the part from html

Equipments

Select above to browse our equipments

Comment: don't really understand logic... why do you have to click on image before you can toggle the source for that image in hover?
Comment: i have three image for each button, one to indicate hovering, and one default state, and third to indicate if button is clicked, because upon click it will show data related to that button
Comment: easy enough to add a class to one that's clicked and change it's style with that class
Answer: Bind your function to the generic container class, and check inside your function which is the id of the current element:
$(".container .row-fluid .col-lg-12 img").mouseleave(function () {
    if ( $(this).attr('id') == 'excavator' )
    {
        // DO SOMETHING HERE
    }

    if ( $(this).attr('id') == 'backhoe' )
    {
        // DO SOMETHING ELSE HERE
    }
});

Comment: on your answer first line can i replace that with just $("#equipmentSelection").mouseleve ? since all the icons/buttons are inside that div with equipmentSelection id.
Comment: yes you can, but in that case you will not know which IMG was being hovered
Comment: @GrafiCodeStudio not true... in any jQuery event `this` is element acted on so can do same with `mouseenter`
Comment: @charlietfl, I've never said he cannot do the same with mouseenter. I said if he binds the function to a different element he won't be able to check WHICH IMG was being mousehovered.

creating jQuery function to reduce code


Dicionários recebendo lista com valores

Question: Galera meu código esta tendo uns pequenos problemas, ele recebe "instituiçoes"(nomes que o usuario quiser no input) dentro de um dicionario esse input ta passando pro dicionario como uma lista, e depois uso a lista pra fazer uma "doação" até ai ta tranquilo o problema acontece quando esta em um laço de repetição fazendo esse processo mais de uma vez na parte da "instituição" funciona normalmente sem sobrescrever o anterior porem quando e na doação o ultimo valor adicionado e subsistido pelo atual ex: foi doado 1000 e na segunda doação foi doado mais 200 deveria guarda o valor 1200, porem o valor 1000 some e fica somente o ultimo valor o 200, aqui esta o código, se poderem ajuda o mais rápido possível.
instituicoes = []
def doação():
    while True:
       instituicao_add = input("0 para deixar de adicionar\ndigite alguma instituicao\n:") #ex: 'stack overflow pt'
       if(instituicao_add == '0'):
           break
       instituicoes.append({'nome': instituicao_add})
    while True:
       for i, xc in enumerate(instituicoes):
            print(i,"-",xc)
       x = int(input("\nQual instituição deseja escolher?")) # ex: 0

    while x >= len(instituicoes) or x < 0: # Verificar se index existe na nossa lista de instituicoes
        x = int(input("\nQual instituição deseja escolher?")) # ex: 0

        dinheiro = int(input("\nQuanto deseja doar?\n"))

        instituicoes[x]['doação'] = dinheiro # ex: 1000
        print("Obrigado por ajudar esta instituição")
        print(instituicoes[x]) # output: {'nome':'stack overflow pt', 'doação': 1000}

    #para imprimir só o valor doado
        print(instituicoes[x]['doação'])
doação()

Answer: Não consigo testar esse código agora. Mas tente  cada vez que adiciona uma instituição pode definir também a doação a 0
nesta linha pode ficar:
...
instituicoes.append({'nome': instituicao_add, 'doação': 0})
...

despois mais tarde é só incrementar a doação na instituição que desejar doar:
...
instituicoes[x]['doação'] += dinheiro
...

Estruturei um pouco melhor o seu código com base naquilo que me pareceu que queria:
instituicoes = []
def doação():
    while True:
       instituicao_add = input("0 para deixar de adicionar\ndigite alguma instituicao\n:")
       if(instituicao_add == '0'):
           break
       instituicoes.append({'nome': instituicao_add, 'doação': 0})

    for i, v in enumerate(instituicoes):
       print(i, '-', instituicoes[i])

    for i in instituicoes: #não sei bem se é isto que quer, pelo o código que mostrou parece que quer que o numero de doações a fazer sejam iguais ao numero de instituiçoes que temos

       x = int(input("\nQual instituição deseja escolher?"))
       while x >= len(instituicoes) or x < 0:
           x = int(input("\nNão existe na lista. Qual instituição deseja escolher?"))

       dinheiro = int(input("\nQuanto deseja doar a " +instituicoes[x]['nome']+ "?\n"))
       instituicoes[x]['doação'] += dinheiro
       print("Obrigado por ajudar esta instituição: ", instituicoes[x]['nome'])
       print(instituicoes[x])

    print(instituicoes)

doação()

Comment: Certo o código e basicamente aquele que vc tinha corrigido antes com pequenas mudanças mas são besteiras, vou testa e lhe passo o feedback.
Comment: Exatamente isso cara, vlw você é o cara nota 10.
Comment: Obrigado. Ainda  bem que ajudei @Alysson
Comment: só a nível de curiosidade teria como somar o resultado final se eu tivesse vamos supor 4 ou mais instituições  no caso tudo arrecadado ?
Comment: O total de todas as doaçoẽs? No final até pode fazer em duas linhas: `doacoes = [i['doação'] for i in instituicoes]` e na linha abaixo pode `total = sum(doacoes)` . Esta maneira chama-se list compreension. Você poderia atingir o mesmo só com ciclo for

Dicionários recebendo lista com valores


How to avoid excessive bow-hair damage when playing "scratch percussion" on string instruments?

Question: Prominently featured in Bluegrass fiddle playing, the ever-so-feared noise of a bow "squaking" over the strings can be used to produce distinctive, yet surprisingly sweet percussive accents if well controlled.

(Especially 5:20)
I start to get the grips of how to do this on cello, but – less suprisingly – it turns out it causes much more wear to the bow hairs than conventional techniques, indeed quite unacceptably high – about three hairs broken per minute of practising it is for me right now. Yet proficient players seem to have not such a big problem with that, e.g. Nat Smith plays entire songs with such a style on the cello, apparently without any hairs failing.

What should I mind to get such powerful accents, yet minimise wear on the bow hairs?
Comment: If it seems shallow to give you a +1 just for the first link at 5m20s . . . then too bad!
Answer: There are some things that will make you lose less: a big revelation for me was when I realized I was using way more bow and force than necessary. A combination of weight (literal weight, let gravity do more of the work than muscle) and a slow stroke using minimal bow length helped a lot. Also, the examples here are amplified; if possible, practice the effect while amplified because it turns out a relatively quiet scratch percussion effect has more than enough sound once amplified. Using tons of rosin, especially around the frog area, also helps substantially. Ultimately, however, the best solution is to talk to your bowmaker next time you get a rehair. There are types of hair, as well as rehairing methods, that are better for this kind of agressive use than the standard rehairing job. In my experience, I didn't like my regular sound as much when I did this, so it might depend on just how much of this effect you do vs. how much regular playing. I have a couple of colleagues that have two bows precisely for this reason.
Comment: Thanks! I've already stopped using my regular bow for this to spare it, only do it with my carbon-fibre one now. So I'll definitely try having that rehaired in this different fashion. — As for rosin, I've already been experimenting (even with that gluey double-bass stuff), unfortunately it rather seemed to _increase_ the failure rate. Probably just too much force indeed; practising amplified is an interesting suggestion!
Answer: Done properly, you don't need to lose hairs. You end up losing hairs when you have too much sideways or twisting movement. It's the type of movement that makes you break them, not the aggressiveness. I don't do it enough to be comfortable explaining, especially in words rather than in person with instrument in hand, so I'll refer you to the world's experts.
Both Casey Driessen and Darol Anger have video tutorials on chops and other techniques for rhythm violin. Darol Anger's DVD "Chops and Grooves" has been around longer, and has a very good reputation. Casey Driessen has a series of online lessons (http://caseydriessen.com/lessonseriesdebut/), with information available through his own website. I haven't looked into them, but I took a live workshop with him once, and he was a very good teacher in person. I would expect the videos to be of equal quality. I think that the videos would translate somewhat to the cello, although obviously most of the technique would change, even if the general idea was the same.
That said, I've also heard of a rock violinist buying the cheapest $5 bows by the hundred, since she goes through hair so fast.
Answer: When rock guitarists sacrifice their guitars in what appears to be a moment of pure emotion it is often pre-planned and they have already swapped to a cheaper guitar than their main instrument(s). Perhaps you could keep some cheaper bows purely for this technique?
Another idea, though from a different context, would be to try a viola bow. I know that Steve Bingham often uses a carbon fibre viola bow when he plays the electric violin because the additional weight and different feel of the viola bow help to speed up the attack of the electric violin's sound.
(N.B. I guess the equivalent move for a cellist would be to a double bass bow, but that sounds impractical since double bass bows, even entry level ones, are more expensive and the increase in weight looks prohibitive:

Violin 58 - 64 grams
Viola 65 - 75 grams
Cello 78 - 88 grams
Double Bass 130 - 162 grams

so while moving from a violin bow to a viola bow is an increased weight of about 15% moving from a cello bow to a double bass bow is about a 79% increase!)
Comment: I think I _might_ start looking for a light french-style bass bow... would probably also get a bit more sound out of my low-F string!
Answer: Another vote for plenty of rosin.  One brand once advertised that it "could make your triplets sound like a cougar coughing up hairballs."


connecting to phpclould using netbeans 7.2

Question: I am trying to connect to phpclould using netbeans.
I am following the instruction writen on eschrade blog
On the following step, I have provided all necessary information and private key

But I am getting following error when I press the test connection button
<code>Cannot connect to server XXX.my.phpcloud.com
(Cause: invalid privatekey: key.ppk)
</code>
I know key is correct bucause I used the same key with winScp and it worked perfectly fine.
Any Idea?
Comment: I am having the same problem. Have you got the solution already?
Answer: It turns out the the private key must be in OpenSSH format.  Use Puttygen to load your .ppk file and then export it as an openssh key (.priv).  Then specify the .priv file in the Netbeans dialog box.
See this link.
Comment: that is what I did. I made it work. But honestly speaking I myself don't remember now. its been couple of months now.


How do you play a 3 note jazz voicing for a slash chord?

Question: Please answer for piano specifically.
So classic 3 note jazz voicing to my understanding is Root in the left hand and the 3 and 7 in the right. But what if you have an inversion with 3 or 7 in the bass? Do you still play 3 and 7 in the right hand or does that change?
Answer: An even more 'classic' piano voicing might be LH 'shell' (3rd and 7th), melodic stuff in RH and leave the bass to the bass player.  But that's not the whole answer either.
Remember, the inversion is determined by the bass note - whoever's playing it!  If there's just a piano, your main responsibility is to provide the bass line.  YOU decide what inversion the harmony takes.   If there is a bass, your job is to keep out of his way and do whatever is useful, rhythmically, harmonically and melodically, with either hand, you won't be playing in the range that determines the inversion.   If there's a guitar as well you've got someone else's toes not to tread on (and he on yours, though it can be hard to stop a guitarist strumming along :-).
Replying to your comment - for SOLO piano, your RH will generally want to play the tune, whether a tasteful rendition of the original melody or your own improvisation!   There are various techniques of adding the harmony 'in the middle', a stride LH, block chord voicings under the melody in the RH, sustained 'thumb notes'...    We're (presumably) not improvising Bach-style choral harmony, so we don't have to worry too much about doubled major 3rds, parallel 5ths etc.' although, as in all music, they WILL stand out aurally.
Comment: I'm looking for basic solo piano. I have seem in a number of places that learning the bass in the left and 3 and 7 in the right is a great place to start for Jazz piano. So I will be playing the bass note. I just want clarification on how to do this with slash chords. Do I need to change the upper two notes to something other than the 3 and 7. For example do I play the root in the right hand or do I double the bass note and keep the 3 and 7 in the right hand?
Answer: Laurence Payne's answer is good as far as it goes, but I understand your question to mean that you are playing a solo.
There is no way to give a solid or definitive answer without more real context.  But, speaking generically, if you're doing a piano solo with, say, C7/E, your instinct to give the root and seventh to the right hand is probably a good one.  It gets more complex if they ask for a note that would normally be skipped, such as C7/G.  In that case, since the left hand is given, and the chord must contain its primary color tone and its major mode, you would typically skip the root of the chord.
In reality, of course, it will also depend on where you are coming from and where you are going to.  You may be forced to make less typical choices in unusual or tricky situations.


What does exacly mean by Entity CRUD API?

Question: Here in the documentation comment for entity_export() says:

Note: Currently, this only works for entity types provided with the entity CRUD API.

So, what does it actually mean?
Background info:
We are going to create two modules. One for defining an entity type using hook_entity_info() and other providing UI for adding, editing, managing etc. There will be two drupal 7 installations. One will be installed with both of above modules and other only with first module defining entity type.
On first drupal installation, we will be creating/editing entities of type what we defined. And exported to second installation. So, we are checking for the capabilities of entity_export() and entity_import() functions for integration of entity export/import functionality.
Answer: The CRUD API is the set of functions that allows an entity to be Created, Readed, Updated and Deleted.
An entity has a CRUD API when its entity controller implementes de EntityAPIControllerInterface. The EntityAPIController class, the default Entity API entity controller class implements this interface.
So you only have to define your entity using the Entity API contrib module and use that class as controller (or your custom subclass of that class).
If you read the entity_export code you can see:
 if (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
    return entity_get_controller($entity_type)->export($entity, $prefix);
  }

The function checks if the entity controller implements EntityAPIControllerInterface interface; if yes the export method is called.


Stop rendering of a component after componentDidMount()

Question: I have a search page with three components. The browse topics component lists the topics to choose from. The browse articles component lists all the articles based on the topic ID and loads all articles if there is no topic id. The home component holds the browsetopics and browsearticles component, and changes its state according to the topic which is clicked.
class BrowseTopics extends React.Component {
  constructor(props) {
    super(props);
    this.topicSelect = this.topicSelect.bind(this);
    this.state = {error: "", topics: []};
  }
  componentDidMount(){
    // API call which updates state topics with the list of topics
  }
  topicSelect(id,e) {
    e.preventDefault();
    this.props.topicChange(id);
  }
 render () {
    // Rendering list of topics from API and nothing if request has not been sent
  }
}

class BrowseArticles extends React.Component {
  constructor(props) {
    super(props);
    this.state = {error: "", articles: [], url: "/api/articles"};
  }
  componentDidMount() {
    if(this.props.topicId){
    var url = '/api/topic/'+this.props.topicId+'/articles';
    this.setState({url: url});
    }
    // Make a request to url and get articles
  }
  render () {
    // Renders the list of articles
  }
}

class Home extends React.Component {
  constructor(props) {
    super(props);
    this.handleUpdate = this.handleUpdate.bind(this);
    this.state = {topicId: ""};
  }

  handleUpdate(topicId) {
    this.setState({topicId: topicId});
  }

  render () {

    return(

<BrowseTopics user={this.props.user} topicChange={this.handleUpdate}/>
          <BrowseArticles user={this.props.user} topicId={this.state.topicId}/>

      );
  }
}

What I need is, I want the browseTopics component to stop re-rendering on parent state change.
I tried using shouldComponentUpdate() (which returns false) but that even stops the componentDidMount() part and the list isn't populated.
Once the request to API is made and component is rendered, I want all further re-rendering of browseTopics to stop for the sorting to function properly.
Answer: From docs:

if shouldComponentUpdate() returns false, then componentWillUpdate(), render(), and componentDidUpdate() will not be invoked

I'd probably want to set some sort of flag telling my BrowseTopics component that the API request has been made and I no longer need/want the component to update:
class BrowseTopics extends React.Component {
  constructor(props) {
    super(props);
    this.topicSelect = this.topicSelect.bind(this);
    this.state = {
      error: "",
      topics: [],
      hasFetched: false // flag for API
    };
  }
  componentDidMount(){
    // API call which updates state topics with the list of topics
    fetch( 'myapi.json' )
      .then( res => {
        // set flag denoting API results have been fetcehd
        this.setState({
          hasFetched: true,
          topics: <your topics>
        });
      })
  }

  shouldComponentUpdate(nextProps, nextState) {
    if ( this.state.hasFetched ) {
      return false;
    }
    return true;
  }
  ...


Compiler error: invalid conversion from 'int' to 'int*' [-fpermissive]|

Question: I got a compiler error:

main.cpp|59|error: invalid conversion from 'int' to 'int*' [-fpermissive]|

The offending line is
int *pComienzo = vector, *pFinal = vector[nElementos-1];

Why there is an error?  Can someone help me?
Below is my code:
#include <iostream>
#include <ctype.h>

using namespace std;
const unsigned short int MAX_VAL = 10;

int LongitudCadena(char*);

int BuscarCaracter(char *cadena, char caracter);

void Ordenar(int *vector, int nElementos, bool ascendente);

int main()
{
    char *cadena = "asdasd";

    cout << LongitudCadena(cadena) << endl;

    cout << BuscarCaracter(cadena, 'a') << endl;

    int iArray[] = {5,4,3,2,1};

    Ordenar(iArray, 5, 1);

    cout << iArray << endl;

    return 0;
}

int LongitudCadena(char *cadena)
{
    char *c = cadena;
    for(int i = 0; i < MAX_VAL; i++)
    {
        if (c[i] == 0) break;
        cadena++;
    }

    return  cadena - c;
}

int BuscarCaracter(char * cadena, char caracter)
{
    char *pCadena = cadena;
    for (int i = 0; i < MAX_VAL; i++)
    {
        pCadena++;
        if (toupper(cadena[i]) == toupper(caracter))
        return pCadena- cadena;
    }

    return -1;
}

void Ordenar(int *vector, int nElementos, bool ascendente)
{

    int *pComienzo = vector, *pFinal = vector[nElementos-1];

    if (ascendente)
    {
        for (int i = 0; i < nElementos; i++)
        {
            for (; pComienzo < pFinal; pComienzo++, pFinal--)
            {
                if (*pComienzo > *pFinal)
                {
                    *pComienzo += *pFinal;
                    *pFinal -= *pComienzo;
                    *pComienzo -= *pFinal;
                }
            }
        }
    }
}

I'm learning...
Comment: I'm pretty sure it's the `*pFinal = vector[nElementos-1]` section.  Remember that the although "vector" is an `int*`, it's individual elements are regular `int`s.
Answer: Your error is in this line:
int *pComienzo = vector, *pFinal = vector[nElementos-1];

The reason for this is that vector is an int*, but vector[nElementos - 1] is a regular int.  Thus the declaration
int *pFinal = vector[nElementos - 1];

is trying to assign the integer value at the last index of vector to the pointer pFinal, hence the compiler error.
To fix this, you may want to do either
int *pFinal = &vector[nElementos - 1];

which makes pFinal point to the last element of vector, or
int *pFinal = vector + (nElementos - 1);

which accomplishes the same thing using pointer arithmetic.
That said, since you're working in C++, why not use the provided std::vector type and avoid working with pointers altogether?
Hope this helps!
Comment: +1, but I think it's probably better to write `vector + (nElementos - 1)`. (Note that something like `vector + nElementos + 1 - 2` would be undefined behavior. `vector + nElementos - 1` is technically fine, but is living on the edge!)
Comment: @ruakh: I've moved out of C/C++ land so I don't have a compiler handy to try this, but I was under the impression that "vector + nElementos + 1 - 2" is completely legal. I thought that in general a pointer plus an arithmetic expression results in, internally, adding the integer value times the size of the object pointed to to the pointer.
Comment: @Jay- The C++ ISO spec states that pointer arithmetic in arrays is valid as long as you stay within the array or point one step past the end of the array.  Going any further technically results in Undefined Behavior, though most implementations would probably have no problem with this.
Comment: @Jay: Right, but `vector + nElementos + 1` is not a valid pointer. I don't just mean that it points to unallocated memory; I mean that you can't even assume that your compiler can actually create such a pointer. (Pointers are not necessarily integers -- and even if they are, what happens if `vector + nElementos` is the maximum possible integer?) The expression `vector + nElementos + 1`, when evaluated, triggers undefined behavior, even if you never dereference that pointer, and even if you immediately subtract `2`.
Comment: thank you all!!! I'm studying c++, so i don't know about std::vector, I will take a look, again, thank you! nice comunity!

edit: sorry for my english
Comment: @ruakh: Hmm, interesting. So I take it you're saying that "vector+(nElementos+1-2)" is defined but "(vector+nElementos+1)-2" is not. Pointer addition is not associative. Okay, there's validity to that. I strongly suspect that in practice you'd get the same results on any compiler, but I'll grant you, you shouldn't rely on "technically illegal but appears to work in practice". On the other hand, you may be making invalid assumptions about evaluation order. If I really cared I'd study the specs, I guess.
Answer: vector is a pointer, but subscripting it as vector[nElementos-1] dereferences it to simply an int.  What it looks like you want is instead
int *pComienzo = vector, *pFinal = &(vector[nElementos-1]);

Answer: An array access/subscript (i.e., a[i] where a is an array/pointer and i is an integer) is an expression with the type being the thing you have in the array.
Simply use the address-of operator & to store the address in the pointer:
int *pComienzo = vector, *pFinal = &vector[nElementos-1];

Answer: You forgot &. vector[nElementos-1] is the value, while you need an address for pFinal.
Either *pFinal = &(vector[nElementos-1]) or *pFinal = vector + nElementos-1.


PCA on a Likert scale data

Question: I am trying to conduct a small experiment based on Likert style data. I have a total of 20 questions, 10 are referring to a latent construct of happiness, and the other 10 to a latent construct of depression.
I would like to identify (preferably using the PCA) the existence of those two latent constructs in my data. I am basing the technical part of the research on the following two references: 1 and 2. Initially I perform the KMO and Bartlett's tests and obtain satisfactory results. Then I run the PCA on the correlation matrix of the data. I've read about a rule of thumb when using the correlation based PCA, i.e., keeping those PCs that have eigenvalues larger than one. And in my case I have 3 such components.
My question is, how can I interpret the results of such a PCA. I know this might be a basic question but I am in need of some confirmation. Should I look an the rotations (I am using prcomp in R) and see with which variables the component is mostly correlated? Because in the ideal world I would like to obtain two components, one which describes the construct of happiness (i.e. is correlated with those variables that are created from questions regarding happiness) and the other depression. What if the number of components is larger than 2? What is the interpretation than?
Comment: Lots of related threads here e.g. http://stats.stackexchange.com/questions/11713/whether-to-use-efa-or-pca-to-assess-dimensionality-of-a-set-of-likert-items You will get, I trust, more detailed replies but in the interim one big red flag. You are maklng extraordinarily strong assumptions that you can just take Likert style data (exactly what you mean by that needs more detail) and then treat them as if they were just measured. If you haven't encountered it yet, know that there's an entire spectrum of reactions ranging from (at least) "completely invalid" to "defensible with caution".
Comment: I don't think there is a useful general answer to that beyond sometimes the data make you change your mind. That's good.
Comment: Thanks for your comment. I am using the 1-7 Likert scale in my research, if that is what you meant by more detail.
Comment: OK, but watch out for legions of researchers, some gatekeepers in your path, who will warn that's not interval scale measurement.
Comment: I will watch out, thanks. Do you have any idea about the interpretation of the PCs when their number is different than the underlying assumptions?
Answer: I think EFA (or CFA) would be a better fit for this analysis.  The reason I'm stating this is because you already have a proposed model (two latent constructs, each associated with ten items) and factor analysis would allow you to assess how well your data fits the model.  Additionally, it will give you meaningful information about how much the variance in each item is accounted for in the model.
Comment: Thanks for your answer. But shouldn't the PCA confirm that two PCs do indeed represent the latent constructs?

PCA on a Likert scale data


DNS query limit WinServer 2008R2

Question: Situation:
I am currently seeing a huge wave of incoming DNS requests arriving in burst of around 85 queries per 2-3 seconds from one IP. Then another IP sends a new wave and so on (currently my DNS service is turned off, so that it does not take part in what looks like another amplification attack).
Question:
Is there a way to set a query limit per IP?
It is very unlikely that the same client needs to resolve more than 2 or 3 domains within a second, so that sounds like a reasonable step.
Comment: How are you certain this is unlikely?  Perhaps they are running a script or application that performs dns lookups.
Comment: 85 querries over 2-3 seconds doesn't sound that malicious. Is it querries for the same FQDN?
Comment: Yes, all for the same FQDN: directedat.asia: type ANY, class IN
Comment: When you say inbound, to you mean from the Internet, or internally?  Just asking, as it's possible to tunnel data through DNS queries.
Comment: Yes, from external IPs.
Answer: No shipping version of Windows Server has any built-in functionality to do rate-limiting like you're looking for, either in the IP stack or in the DNS server. You're stuck putting a firewall that can rate-limit in front of the Windows machine if you want this type of functionality.
Answer: Philip is is possible that you are running a public Recursive DNS server?
I see that you currently have disabled your DNS service but your IP is most likely still in the 'servers to abuse' list of criminals.
What you can do:

Check if your public IP is listed on: openresolverproject.org
Disable recursion on your DNS server completely or only listen on an internal interface.
See http://technet.microsoft.com/en-us/library/cc755068.aspx
Have a look at Bind DNS server under Linux. Its free and allows you to configer from what subnets you want to allow recursion.

Blog post on directedat.asia domain: http://dnsamplificationattacks.blogspot.com/2013/05/domain-directedatasia.html

DNS query limit WinServer 2008R2


Certain options not taking effect in fullpage.js

Question: I'm using fullpage.js (which is brilliant), but I haven't been able to get a few of its options to have any effect. For example, the navigation won't appear, nor is the content vertically centered. Here is a link to the code I am using. These are the options that aren't taking effect so far:
$('#fullpage').fullpage({
    navigation: true,
    navigationPosition: 'right',
    verticalCentered: true
});

If anyone familiar with fullpage.js could take a look it would be much appreciated.
Answer: I did never use fullpage.js but I just checked out the source and your example.
This is what I came up with:

The "navigation" option doesn't work because fullpage.js can't append the section navigation items to the element with the id #fp-nav. That's probably because it sets the "nav" selector before it adds this element to the body. You can see that it was correct in a previously tagged version: https://github.com/alvarotrigo/fullPage.js/blob/v.2.2.8/jquery.fullPage.js vs https://github.com/alvarotrigo/fullPage.js/blob/master/jquery.fullPage.js

I'm not sure what's up with the "master" branch, but it seems like this is broken (or it only works with a specific version of jQuery).
You could however dirty-fix the navigation problem by adding a

somewhere in your body.

The vertical alignment seems to work for me.
Comment: Thanks a lot. Your solution worked. I'll try and mention this on Github.
Comment: Indeed it is a bug in the latest version. 18.104.22.168. Use 2.6.7 instead. It will be solved in a few days.
Answer: It looks like your settings are being applied, but you are expecting the results to be different. for example, verticalCentered is working as you can tell by inspecting the page and seeing that vertical-align:middle is happening.

and your navbar is there, just not visible for some reason (maybe you need to pass in more settings? Not sure on this one.)

I am not sure what you are looking for it to look like exactly, but I would use chrome devtools if you aren't already to help check if things are actually changing.
Comment: Good point, I was confusing a vertical center with a horizontal center.