text:
Q: Play-Slick generating errors in routes I was trying to get started with Slick and Play Framework but I keep getting those errors.
I have added slick, play-slick and mysql connector to library dependencies and also the following lines to application.conf:
slick.dbs.default.driver= "slick.driver.MySQLDriver"
slick.dbs.default.db.driver="com.mysql.jdbc.Driver"
slick.dbs.default.db.url="jdbc:mysql://cronline.pl"

I get the following errors:
Information:Play 2 Compiler: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Information:Play 2 Compiler: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Information:Play 2 Compiler:  Loading project definition from /home/haito/IdeaProjects/Scrapper/project
Information:Play 2 Compiler:  Set current project to Scrapper (in build file:/home/haito/IdeaProjects/Scrapper/)
Information:Play 2 Compiler:  Updating {file:/home/haito/IdeaProjects/Scrapper/}root...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-library;2.11.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#twirl-api_2.11;1.0.2 ...
Information:Play 2 Compiler:  Resolving org.apache.commons#commons-lang3;3.1 ...
Information:Play 2 Compiler:  Resolving org.scala-lang.modules#scala-xml_2.11;1.0.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#build-link;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-exceptions;2.3.9 ...
Information:Play 2 Compiler:  Resolving org.javassist#javassist;3.18.2-GA ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-iteratees_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving org.scala-stm#scala-stm_2.11;0.7 ...
Information:Play 2 Compiler:  Resolving com.typesafe#config;1.2.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-json_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-functional_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-datacommons_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving joda-time#joda-time;2.3 ...
Information:Play 2 Compiler:  Resolving org.joda#joda-convert;1.6 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-annotations;2.3.2 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-core;2.3.2 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-databind;2.3.2 ...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-reflect;2.11.1 ...
Information:Play 2 Compiler:  Resolving org.scala-lang.modules#scala-parser-combinators_2.11;1.0.1 ...
Information:Play 2 Compiler:  Resolving io.netty#netty;3.9.8.Final ...
Information:Play 2 Compiler:  Resolving com.typesafe.netty#netty-http-pipelining;1.1.2 ...
Information:Play 2 Compiler:  Resolving org.slf4j#slf4j-api;1.7.6 ...
Information:Play 2 Compiler:  Resolving org.slf4j#jul-to-slf4j;1.7.6 ...
Information:Play 2 Compiler:  Resolving org.slf4j#jcl-over-slf4j;1.7.6 ...
Information:Play 2 Compiler:  Resolving ch.qos.logback#logback-core;1.1.1 ...
Information:Play 2 Compiler:  Resolving ch.qos.logback#logback-classic;1.1.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.akka#akka-actor_2.11;2.3.4 ...
Information:Play 2 Compiler:  Resolving com.typesafe.akka#akka-slf4j_2.11;2.3.4 ...
Information:Play 2 Compiler:  Resolving commons-codec#commons-codec;1.9 ...
Information:Play 2 Compiler:  Resolving xerces#xercesImpl;2.11.0 ...
Information:Play 2 Compiler:  Resolving xml-apis#xml-apis;1.4.01 ...
Information:Play 2 Compiler:  Resolving javax.transaction#jta;1.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-jdbc_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.jolbox#bonecp;0.8.0.RELEASE ...
Information:Play 2 Compiler:  Resolving com.google.guava#guava;15.0 ...
Information:Play 2 Compiler:  Resolving com.h2database#h2;1.3.175 ...
Information:Play 2 Compiler:  Resolving tyrex#tyrex;1.0.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#anorm_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.jsuereth#scala-arm_2.11;1.4 ...
Information:Play 2 Compiler:  Resolving org.scala-lang.plugins#scala-continuations-library_2.11;1.0.1 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-cache_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving net.sf.ehcache#ehcache-core;2.6.8 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-ws_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.google.guava#guava;16.0.1 ...
Information:Play 2 Compiler:  Resolving com.ning#async-http-client;1.8.15 ...
Information:Play 2 Compiler:  Resolving oauth.signpost#signpost-core;1.2.1.2 ...
Information:Play 2 Compiler:  Resolving oauth.signpost#signpost-commonshttp4;1.2.1.2 ...
Information:Play 2 Compiler:  Resolving org.apache.httpcomponents#httpcore;4.0.1 ...
Information:Play 2 Compiler:  Resolving org.apache.httpcomponents#httpclient;4.0.1 ...
Information:Play 2 Compiler:  Resolving commons-logging#commons-logging;1.1.1 ...
Information:Play 2 Compiler:  Resolving mysql#mysql-connector-java;5.1.18 ...
Information:Play 2 Compiler:  Resolving com.typesafe.slick#slick_2.11;3.0.0 ...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-library;2.11.6 ...
Information:Play 2 Compiler:  Resolving org.reactivestreams#reactive-streams;1.0.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-slick_2.11;1.0.0 ...
Information:Play 2 Compiler:  Resolving com.zaxxer#HikariCP;2.3.7 ...
Information:Play 2 Compiler:  Resolving org.slf4j#slf4j-api;1.7.10 ...
Information:Play 2 Compiler:  Resolving org.javassist#javassist;3.19.0-GA ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-jdbc-api_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#build-link;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-exceptions;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-iteratees_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe#config;1.3.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-json_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-functional_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-datacommons_2.11;2.4.0 ...
Information:Play 2 Compiler:  Resolving joda-time#joda-time;2.7 ...
Information:Play 2 Compiler:  Resolving org.joda#joda-convert;1.7 ...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-reflect;2.11.6 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-core;2.5.3 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-annotations;2.5.3 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.core#jackson-databind;2.5.3 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.datatype#jackson-datatype-jdk8;2.5.3 ...
Information:Play 2 Compiler:  Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.5.3 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-netty-utils;2.4.0 ...
Information:Play 2 Compiler:  Resolving org.slf4j#slf4j-api;1.7.12 ...
Information:Play 2 Compiler:  Resolving org.slf4j#jul-to-slf4j;1.7.12 ...
Information:Play 2 Compiler:  Resolving org.slf4j#jcl-over-slf4j;1.7.12 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#twirl-api_2.11;1.1.1 ...
Information:Play 2 Compiler:  Resolving org.apache.commons#commons-lang3;3.4 ...
Information:Play 2 Compiler:  Resolving ch.qos.logback#logback-core;1.1.3 ...
Information:Play 2 Compiler:  Resolving ch.qos.logback#logback-classic;1.1.3 ...
Information:Play 2 Compiler:  Resolving com.typesafe.akka#akka-actor_2.11;2.3.11 ...
Information:Play 2 Compiler:  Resolving com.typesafe.akka#akka-slf4j_2.11;2.3.11 ...
Information:Play 2 Compiler:  Resolving commons-codec#commons-codec;1.10 ...
Information:Play 2 Compiler:  Resolving com.google.inject#guice;4.0 ...
Information:Play 2 Compiler:  Resolving javax.inject#javax.inject;1 ...
Information:Play 2 Compiler:  Resolving aopalliance#aopalliance;1.0 ...
Information:Play 2 Compiler:  Resolving com.google.inject.extensions#guice-assistedinject;4.0 ...
Information:Play 2 Compiler:  Resolving com.google.inject.extensions#extensions-parent;4.0 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-test_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving junit#junit;4.11 ...
Information:Play 2 Compiler:  Resolving org.hamcrest#hamcrest-core;1.3 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-core_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-matcher_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-common_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.scalaz#scalaz-core_2.11;7.0.6 ...
Information:Play 2 Compiler:  Resolving org.scalaz#scalaz-concurrent_2.11;7.0.6 ...
Information:Play 2 Compiler:  Resolving org.scalaz#scalaz-effect_2.11;7.0.6 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-junit_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-mock_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.mockito#mockito-core;1.9.5 ...
Information:Play 2 Compiler:  Resolving org.objenesis#objenesis;1.0 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-matcher-extra_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.specs2#specs2-analysis_2.11;2.3.12 ...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-compiler;2.11.0 ...
Information:Play 2 Compiler:  Resolving org.specs2#classycle;1.4.3 ...
Information:Play 2 Compiler:  Resolving com.novocode#junit-interface;0.11-RC1 ...
Information:Play 2 Compiler:  Resolving org.scala-sbt#test-interface;1.0 ...
Information:Play 2 Compiler:  Resolving com.google.code.findbugs#jsr305;2.0.3 ...
Information:Play 2 Compiler:  Resolving org.fluentlenium#fluentlenium-festassert;0.9.2 ...
Information:Play 2 Compiler:  Resolving org.fluentlenium#fluentlenium-core;0.9.2 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-java;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-android-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-remote-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving cglib#cglib-nodep;2.1_3 ...
Information:Play 2 Compiler:  Resolving org.json#json;20080701 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-api;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.apache.httpcomponents#httpclient;4.3.1 ...
Information:Play 2 Compiler:  Resolving org.apache.httpcomponents#httpcore;4.3 ...
Information:Play 2 Compiler:  Resolving commons-logging#commons-logging;1.1.3 ...
Information:Play 2 Compiler:  Resolving org.apache.commons#commons-exec;1.1 ...
Information:Play 2 Compiler:  Resolving net.java.dev.jna#jna;3.4.0 ...
Information:Play 2 Compiler:  Resolving net.java.dev.jna#platform;3.4.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-chrome-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-htmlunit-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving net.sourceforge.htmlunit#htmlunit;2.13 ...
Information:Play 2 Compiler:  Resolving xalan#xalan;2.7.1 ...
Information:Play 2 Compiler:  Resolving xalan#serializer;2.7.1 ...
Information:Play 2 Compiler:  Resolving commons-collections#commons-collections;3.2.1 ...
Information:Play 2 Compiler:  Resolving org.apache.httpcomponents#httpmime;4.3.1 ...
Information:Play 2 Compiler:  Resolving net.sourceforge.htmlunit#htmlunit-core-js;2.13 ...
Information:Play 2 Compiler:  Resolving net.sourceforge.nekohtml#nekohtml;1.9.19 ...
Information:Play 2 Compiler:  Resolving net.sourceforge.cssparser#cssparser;0.9.11 ...
Information:Play 2 Compiler:  Resolving org.w3c.css#sac;1.3 ...
Information:Play 2 Compiler:  Resolving commons-io#commons-io;2.2 ...
Information:Play 2 Compiler:  Resolving org.eclipse.jetty#jetty-websocket;8.1.12.v20130726 ...
Information:Play 2 Compiler:  Resolving org.eclipse.jetty#jetty-util;8.1.12.v20130726 ...
Information:Play 2 Compiler:  Resolving org.eclipse.jetty#jetty-io;8.1.12.v20130726 ...
Information:Play 2 Compiler:  Resolving org.eclipse.jetty#jetty-http;8.1.12.v20130726 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-firefox-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-ie-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-iphone-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-safari-driver;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.webbitserver#webbit;0.4.14 ...
Information:Play 2 Compiler:  Resolving org.seleniumhq.selenium#selenium-support;2.39.0 ...
Information:Play 2 Compiler:  Resolving org.easytesting#fest-assert;1.4 ...
Information:Play 2 Compiler:  Resolving org.easytesting#fest-util;1.1.6 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-docs_2.11;2.3.9 ...
Information:Play 2 Compiler:  Resolving com.typesafe.play#play-doc_2.11;1.1.0 ...
Information:Play 2 Compiler:  Resolving org.pegdown#pegdown;1.4.0 ...
Information:Play 2 Compiler:  Resolving org.parboiled#parboiled-java;1.1.5 ...
Information:Play 2 Compiler:  Resolving org.parboiled#parboiled-core;1.1.5 ...
Information:Play 2 Compiler:  Resolving org.ow2.asm#asm;4.1 ...
Information:Play 2 Compiler:  Resolving org.ow2.asm#asm-tree;4.1 ...
Information:Play 2 Compiler:  Resolving org.ow2.asm#asm-analysis;4.1 ...
Information:Play 2 Compiler:  Resolving org.ow2.asm#asm-util;4.1 ...
Information:Play 2 Compiler:  Resolving commons-io#commons-io;2.4 ...
Information:Play 2 Compiler:  Resolving org.scala-lang#scala-compiler;2.11.1 ...
Information:Play 2 Compiler:  Resolving org.scala-lang.modules#scala-xml_2.11;1.0.2 ...
Information:Play 2 Compiler:  Resolving jline#jline;2.11 ...
Information:Play 2 Compiler:  Done updating.
Information:Play 2 Compiler:  Compiling 5 Scala sources and 1 Java source to /home/haito/IdeaProjects/Scrapper/target/scala-2.11/classes...
Information:Module "root" was fully rebuilt due to project configuration/dependencies changes
Information:28.05.15 09:03 - Compilation completed with 54 errors and 0 warnings in 16s 761ms
Error:Play 2 Compiler:  GET        /assets/*file        controllers.Assets.at(path="/public", file)
Error:Play 2 Compiler:  GET        /                    controllers.Application.currentDayIndex
/home/haito/IdeaProjects/Scrapper/conf/routes
    Error:Error:Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes: value HandlerInvokerFactory is not a member of object play.core.Router
 /home/haito/IdeaProjects/Scrapper/conf/routes: value HandlerInvokerFactory is not a member of object play.core.Router
    Error:Error:Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes: value queryString is not a member of object play.core.Router
 /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: type ReverseRouteContext
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value ReverseRouteContext
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value dynamicString
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value ReverseRouteContext
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value ReverseRouteContext
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value dynamicString
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: object ReverseRouteContext
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: type JavascriptReverseRoute
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value JavascriptReverseRoute
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: type JavascriptReverseRoute
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value JavascriptReverseRoute
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: type JavascriptReverseRoute
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value JavascriptReverseRoute
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: type JavascriptReverseRoute
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value JavascriptReverseRoute
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: type HandlerRef is not a member of package play.api.mvc
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value HandlerDef
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: type HandlerRef is not a member of package play.api.mvc
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value HandlerDef
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: type HandlerRef is not a member of package play.api.mvc
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value HandlerDef
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: type HandlerRef is not a member of package play.api.mvc
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value HandlerDef
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes: value queryString is not a member of object play.core.Router
 /home/haito/IdeaProjects/Scrapper/conf/routes: not found: value ReverseRouteContext
    Error:Error:Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes: value setPrefix is not a member of play.core.Router.Routes
 /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value Route
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value PathPattern
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value StaticPart
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value createInvoker
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value Route
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value PathPattern
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value StaticPart
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value DynamicPart
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value createInvoker
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value fakeValue
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value Route
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value PathPattern
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value StaticPart
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value DynamicPart
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value createInvoker
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value fakeValue
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value Route
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value PathPattern
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value StaticPart
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value DynamicPart
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value createInvoker
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value fakeValue
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (6)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:6: not found: value call
 GET        /                    controllers.Application.currentDayIndex
    Error:Error:line (7)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:7: not found: value call
 GET        /:data               controllers.Application.index(data: String)
    Error:Error:line (9)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:9: not found: value call
 GET        /data/:data               controllers.Application.getJsonedData(data: String)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value call
 GET        /assets/*file        controllers.Assets.at(path="/public", file)
    Error:Error:line (12)Play 2 Compiler:  /home/haito/IdeaProjects/Scrapper/conf/routes:12: not found: value Param
 GET        /assets/*file        controllers.Assets.at(path="/public", file)

A: You most likely have incompatible versions of play framework and play-slick plugin.
See compatibility table to make sure everything is all right (taken from play-slick readme):

Edit:
I had the same issue when using play 2.3.x and play-slick 1.0


text:
Q: how to tabulate word transition function in discrete math? The state transition table is
$$
\begin{array}{c|cc}
   && f_a && f_b \\ \hline
S_0 && S_1 && S_6 \\
S_1 && S_1 && S_4 \\
S_2 && S_3 && S_5 \\
S_3 && S_1 && S_4 \\
S_4 && S_6 && S_5 \\
S_5 && S_6 && S_5 \\
S_6 && S_4 && S_5\\
\end{array}
$$
Question:
Tabulate the word transition function $f_{abaa}$
My answer:
$\begin{align}
f_{abaa} &=f_a(f_a(f_b(f_a(S_0)))) \\
&= f_a(f_a(f_b(S_1(S_0)))) \\
&= f_a(f_a(f_b(S_1))) \\
&= f_a(f_a(S_4)) \\
&= f_a(S_6) \\
&= S_4
\end{align}$
is it correct?

A: is it correct... yes and no.
The question asked for a tabulation, so if I were assessing this I would be delighted to see a table of the various intermediate combinations leading to the final column showing the required combined mapping.
As for the assertion that it evaluates to a single value; in fact it does, but you have not done enough to prove it. I will use your order for function composition, although it may possibly be the other way around - applying the mappings right to left.
The range (image) of $fa, \text{rng}(fa) = \{S1, S3, S4, S6\}$. Then $\text{rng}(fab) = \{S4, S5\}$ (because these are the values generated by $\text{rng}(fa)$ under $fb$ ), $\text{rng}(faba)=\{S6\}$ and $\text{rng}(fabaa)=\{S4\}$.
With the opposite order of composition, the final set consists of $S6$ alone.

A: The second line of the expansion of $f_{abaa}$ shouldn't be there; the rest of your calculation of $f_{abaa}(S_0)$ is correct, however.
More important, you haven't answered the question: it requires you to construct a table showing $f_{abaa}$. That table has the following form:
$$\begin{array}{c|c}
&f_{abaa}\\ \hline
S_0&S_4\\
S_1&f_{abaa}(S_1)\\
S_2&f_{abaa}(S_2)\\
S_3&f_{abaa}(S_3)\\
S_4&f_{abaa}(S_4)\\
S_5&f_{abaa}(S_5)\\
S_6&f_{abaa}(S_6)
\end{array}$$
Here I've filled in the one value that you've actually calculated. Thus, you still need to find $f_{abaa}(S_n)$ for $1\le n\le 6$. As Joffan's answer points out, this doesn't require actually doing six more calculations like the one that you've already done. You need only notice

*

*that $f_a(S_n)$ is always $S_1,S_3,S_4$, or $S_6$,

*that if $n\in\{1,3,4,6\}$, then $f_b(S_n)$ is $S_4$ or $S_5$,

*that $f_a(S_4)=f_a(S_5)=S_6$, and

*that $f_a(S_6)=S_4$,

so that every entry in the transition table above is $S_4$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: TypeError: Cannot read property 'length' of undefined | Finding the shortest word in a string | Codewars Challenge I am currently trying to create a function that looks for the shortest word in a string of words.
Problem: I am getting the following error
TypeError: Cannot read property 'length' of undefined
    at findShort
    at Test.describe._
    at /runner/frameworks/javascript/cw-2.js:152:11
    at Promise._execute
    at Promise._resolveFromExecutor
    at new Promise
    at Object.describe
    at /home/codewarrior/index.js:24:10
    at /home/codewarrior/index.js:28:5
    at Object.handleError
Here is my code

findShort("turns out random test cases are easier than writing out basic ones");

function findShort(s){

  let array = s.split(" ");
  let shortestWord = array[0];

  for (i = 0; i < array.length; i++) {
    let str = array[i + 1];

    if (shortestWord.length > str.length) {
      shortestWord = str.length;
    }

  }

  return shortestWord;
}

A: I believe this is a more concise way of doing what you're looking for:

console.log(findShort("turns out random test cases are easier than writing out basic ones"));

function findShort(s){
  let input = s;
  let array = input.split(" ");

  var shortest = array.reduce((shortestWord, currentWord) => {
    return currentWord.length < shortestWord.length ? currentWord : shortestWord;
  }, array[0]);
  return shortest;
}

https://jsfiddle.net/02z5oyh1/

A: I see two problems:

*

*The line let str = array[i + 1] is going to result in undefined on the last run of your loop. That's because on the last run, i is one less than the array length, so i + 1 is therefore out of the array bounds. To compensate for that, consider changing the loop condition to i < array.length - 1.

*Second, you are assigning the word length to the shortestWord variable, where I think you meant to assign the word itself to that.
Taking those two changes into account, you could modify your code like so:

function findShort(s) {

  let array = s.split(" ");
  let shortestWord = array[0];

  for (i = 0; i < array.length - 1; i++) { // -1 here to compensate for the +1 on the next line.
    let str = array[i + 1];

    if (shortestWord.length > str.length) {
      shortestWord = str; // Just assign the word itself to this variable, not the length of it.
    }

  }

  return shortestWord;
}

const result = findShort("turns out random test cases are easier than writing out basic ones");
console.log(result);


text:
Q: Show JQuery image slider over flash website Currently I am building flash website.
But I would like to have images presented using JQuery slider Galleria http://galleria.aino.se/
Basically, the web is built of the menu on the left. when clicking one of the items from the menu i would like the Jquery Slider show in the middle (over the flash, may be box 700x500).
Any clue?

A: <object ...>
        <param name="wmode" value="transparent" />
        <embed ... wmode="transparent">
</embed>
</object>

Is suppose to do the trick.
http://kb2.adobe.com/cps/127/tn_12701.html has documentation on wmode values and what they are suppose to do. It is not complete I don't see value="gpu" ... http://niquimerret.com/?p=159 ... wmode=opaque may also do the trick because it turns off GPU rendering which may be the cause of the flash appearing over other content.


text:
Q: Assign position in array as react key? I have an array which consists of different strings. I want to map through it and display it in React. React does not like it when two strings are the same.
My question is this: Is there a way for me to map through the array and assign the position of the element in the array (0,1,2,3..) as the key? I am not sure how I would access this? Can I?
let renderthis = this.props.myreducer.somearray.map((element) =>
  {element}
);

I tried this btw, but it did not work:
let renderthis = this.props.myreducer.somearray.map((element, i) =>
  {element}
);

Warning: flattenChildren(...): Encountered two children with the same
  key, .1:$afaf. Child keys must be unique; when two children share a
  key, only the first child will be used.

A: Array.prototype.map callback accepts the second argument as an item index.
That means that if you simply need unique keys per a collection of element and you don't have any other values that are naturally unique you can simply do:
let renderthis = this.props.myreducer.somearray.map((element, i) =>
  {element}
);


text:
Q: category and url without https redirect to homepage in magento we have enabled https in our website and enabled 301 in admin section.
But the issue is with the category or product urls
example: i have https://www.boxdoccia.it/box-doccia/box-doccia-angolari/ , when change to http://www.boxdoccia.it/box-doccia/box-doccia-angolari/ return to homepage
Magento 1.7.0.2
-multiple store (ssl only for boxdoccia.it)
-Auto-redirect to Base URL -> yes 301
-secure and unsecure url -> https://www.boxdoccia.it
this is htaccess:

<IfModule mod_ssl.c>

############################################

## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################

## enable rewrites

    Options +FollowSymLinks

    RewriteEngine on

############################################

## workaround for HTTP authorization

## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################

## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]

    RewriteRule .* - [L,R=302]

############################################

## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################

## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-l

############################################

## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

############################################

## Prevent character encoding issues from server overrides

## If you still have problems, use the second line instead

    AddDefaultCharset Off

    #AddDefaultCharset UTF-8

    FileETag none

#####

RewriteCond %{HTTP_HOST} ^(.*)boxdoccia.it
RewriteRule ^ - [E=MAGE_RUN_CODE:boxdoccia_it]
RewriteCond %{HTTP_HOST} ^(.*)boxdoccia.it
RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
RewriteCond %{HTTP_HOST} ^(.*)allandmore.com
RewriteRule ^ - [E=MAGE_RUN_CODE:allandmore_com]
RewriteCond %{HTTP_HOST} ^(.*)allandmore.com
RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
RewriteCond %{HTTP_HOST} ^(.*)piattodoccia.it
RewriteRule ^ - [E=MAGE_RUN_CODE:piattodoccia_it]
RewriteCond %{HTTP_HOST} ^(.*)piattodoccia.it
RewriteRule ^ - [E=MAGE_RUN_TYPE:website]

A: try this after
   RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


text:
Q: Counter script not counting down I have this counter script but for some reason it isn't working, I'm wondering if you guys can help me! (It is supposed to count downwards)
function updateTime() {
  var totalSec = 120;
  var hours = parseInt( totalSec / 3600) % 24;
  var minutes = parseInt( totalSec / 60) % 60;
  var seconds = totalSec % 60;

  var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds  < 10 ? "0" + seconds : seconds);
  document.getElementById("timeLeft").innerHTML = result;
  totalSec = totalSec - 1;
}

setInterval(function(){ updateTime(); }, 1000);

The script turns the totalSec into a format like this: 00:00:00, in this case it's 120 seconds which is 00:02:00, but the script isn't counting down, why not?

A: var totalSec = 120; should be outside the function. Your code declares it local and initializes it every time the function is called.

A: The function updateTime is being called every second, which means the totalSec variable is being set to 120 each time.
Move that var out of the function. Keep in mind that global vars are a bad idea.

A: You need to delcare var totalSec=120; outside of your function.  Your code is working, but every time the function is called it is setting totalSec to 120, so you never see any change.


text:
Q: SandCastle generate doc. from website I am trying to generate documentation for a WebSite, but, I don't have a project, in other words, I just go in Visual Studio and I Open a WebSite, I can't generate the XML documentation from this web project style:

And, I see in that documentation I need to put this:
  <system.codedom>
    <compilers>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        compilerOptions="/docpath:C:\Publish\Docs"
        type="EWSoftware.CodeDom.VBCodeProviderWithDocs,
              EWSoftware.CodeDom, Version=1.1.0.0, Culture=neutral,
              PublicKeyToken=d633d7d5b41cbb65">
        <providerOption name="CompilerVersion" value="v2.0"/>
      </compiler>
    </compilers>
  </system.codedom>

Ok, but when i put this in my web.config, and When I try to build, the compiler return a lot of errors, like that:
error BC30451: 'DDtoCC' is not declared. It may be inaccessible due to its protection level.
0error BC30451: 'HojetoCC' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'CCtoDD' is not declared. It may be inaccessible due to its protection level.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30451: 'DataDiff' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'AddDiastoCC' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'AddDiastoCC' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'QueryDB' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'AddDiastoCC' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'QueryDB' is not declared. It may be inaccessible due to its protection level.
error BC30451: 'Truncate' is not declared. It may be inaccessible due to its protection level.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlDataReader' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30451: 'QueryDB' is not declared. It may be inaccessible due to its protection level.
error BC30002: Type 'SqlConnection' is not defined.
error BC30002: Type 'SqlCommand' is not defined.
error BC30451: 'HojetoCC' is not declared. It may be inaccessible due to its protection level.

And, When I remove this, the code is compiled normaly ;x
And, I have tried to create a web project whit this code, BUt, I got the same error..
How I can generate the documentation of this web syte project ??

A: Because there is a bug in the VisualBasic compiler (according to the Sandcastle documentation) you need to add all imports manually. Even essential imports like System or Microsoft.VisualBasic. Here is an example of my web.config:
<system.codedom>
 <compilers>
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
      compilerOptions="/docpath:C:\Sandcastle\XML /imports:System,System.Resources,System.Web,Microsoft.VisualBasic,..."
      type="EWSoftware.CodeDom.VBCodeProviderWithDocs, EWSoftware.CodeDom,
      Version=1.1.0.0, Culture=neutral, PublicKeyToken=d633d7d5b41cbb65">
    <providerOption name="CompilerVersion" value="v4.0"/>
  </compiler>
 </compilers>
</system.codedom>

When you add all your needed imports, then these errors don't affect the publishing process. Although, there could be still some compile errors when you publish your project. I had problems with the impicit assignment of datatypes in all my for each loops.
I had to change my loops to
For Each i as Integer = 0 In List(Of Object)
After that it all worked perfectly.


text:
Q: Ionic 4 Popover implementation Error: No component factory found for ProfileComponent I'm trying to implement the popover in ionic 4 and it's displaying this error for me, I've created a unique component for the popover and I'm implementing on the page, so I click the button to create the component it gives this error.
I'm using lazy loading and importing the module into the files, what am I doing wrong?
ERROR Error: "Uncaught (in promise): Error: No component factory found for ProfileComponent. Did you add it to @NgModule.entryComponents?

PopoverModule
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ProfileComponent } from './profile.component';

@NgModule({
  declarations: [ProfileComponent],
  imports: [
    CommonModule,
  ],
  entryComponents: [ProfileComponent],
})
export class ProfileModule { }

PageModule:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { ProfilePage } from './profile.page';
import { ValidationSummaryComponent } from '../../../components/validation-summary/validation-summary.component';
import { ProfileComponent } from '../../../components/popovers/profile/profile.component';
import { IonicSelectableModule } from 'ionic-selectable';

const routes: Routes = [
  {
    path: '',
    component: ProfilePage
  }
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    ReactiveFormsModule,
    IonicSelectableModule,
    RouterModule.forChild(routes)
  ],
  declarations: [
    ProfileComponent,
    ProfilePage,
    ValidationSummaryComponent,
  ]
})
export class ProfilePageModule {}

Page.ts method for create popover:
import { ProfileComponent } from '../../../components/popovers/profile/profile.component';
async openPopover(ev: any) {
        const popover = await this.popoverCtrl.create({
          component: ProfileComponent,
          event: ev,
          translucent: true
        });
        return await popover.present();
      }

A: If you create your component from Page.ts you should declare your component as entry component in PageModule :
declarations: [
    ...,
    ProfileComponent,
],
entryComponents: [ProfileComponent]

[UPDATE 6/11/2020]
With Angular 9, entryComponents will not be needed anymore. See this link for more info


text:
Q: How to center an oversize image in HTML/CSS while allowing scroll left/right/up/down I have a page with series of oversize images that go over the left, right and even bottom of the screen. One of these images might look like so:

I would like:
(a) The image to appear centered a top on first load (as in illustration)
(b) For the user to be able to scroll left, right, up down to all corners of the image, after the page has loaded
I emphasize that I am NOT looking for a fixed height solution; the image's height WILL go beyond the height of screen.
I have looked around but I can't figure out how to do this.


text:
Q: I deleted /etc/alternatives/java I'm on Ubuntu 12.04 on a 32-bits Dell machine.
I was trying to install java JDK for 32-bits linux platform and I accidentally deleted the file /etc/alternatives/java.
I would love to recreate my old good file in order to build the link with /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java OR with /usr/lib/jvm/jdk1.7.0_45/jre/bin/java  I don't really which one I have to build, but to try I need my alternative executable.

A: On Ubuntu (and other Debian based distributions) /usr/bin/java is just a symlink to /etc/alternatives/java, which is itself a symlink to /usr/lib/jvm/$SOMEVERSION/bin/java.
This way you can choose your preferred java version just by changing this one link.
As you removed /etc/alternatives/java you can just create a new link using:
 ln -s /usr/lib/jvm/jdk1.7.0_45/jre/bin/java /etc/alternatives/java

Alternatively you should be able to use the alternatives-system:
 update-alternatives --set java /usr/lib/jvm/jdk1.7.0_45/jre/bin/java

A: See man update-alternatives.  This is slightly different on fedora than debian/ubuntu but seems to amount to the same thing; it's used by the package manager to maintain the symlinks in /etc/alternatives, but it can be used manually.

--all
  Call --config on all alternatives. It can be usefully combined  with
                --skip-auto  to  review and configure all alternatives which are not
                configured in automatic mode.  Broken  alternatives  are  also  displayed.  Thus a simple way to fix all broken alternatives is to call
                yes '' | update-alternatives --force --all.

So I would try that first, presuming the java you are talking about is a distro package java.


text:
Q: In SQL Server how do I tell what values were in a row at a specific date/time? I have a database that I can view/read data from, but don't have the ability to modify (i.e. can't add triggers or log tables or really do anything to change/modify how it works).
It looks like some data was changed in one of the tables in that database (in fact looks like it was changed multiple times), but there is now no record of those changes or what the historic values are.
My goal: to be able to do something (SQL, logs, fn_dblog, ???) to get the state of a row of a table was on a particular date or to get the list of changes to a table between two particular dates.
I'm hoping from something like
SELECT   Table.ColumnOld, Table.ColumnNew
FROM     fn_dblog(NULL, NULL)
WHERE    Operation = '[delete or update]'
         AND ChangeTime BETWEEN [StartDateTime] and [EndDateTime]

Again, unfortunately I don't have the ability to modify or add to the SQL database to auto-log or similar activity, so now I'm just looking for a way of accessing SQL data to know what that row/cloumn looked like at a specific date/time in the past.


text:
Q: General solution to discrete dynamical system. I am trying to find the general solution to the following discrete dynamical system:
$$H(n+1) = 0.89H(n) + 30$$
$$E(n+1) = 0.64E(n) + 0.11H(n)$$
$$o(n+1) = 0.88o(n) + 0.36E(n) + 30$$
$H(0) = 3500$
$E(0) = 1800$
$o(0) = 2400$
The equilibrium values are:$(272.73, 83.333, 500)$
After some work, I was able to find the particular solution to $H(n)$:
$$H(n) = 3227.27(0.89)^n + 272.73$$
I am totally lost when it comes to finding the general solution to this system. I'd really appreciate it if someone could please point me in the right direction.

A: I assume here that you care more about the solution than the process of getting to the solution - the process is just an extremely messy recurrence computation.
I shall solve the set of equations in general by replacing our values with variables and then solving for our particular case by plugging the values back in at the end. We are trying to solve
$$H(n+1)=aH(n)+b$$
$$E(n+1)=dE(n)+eH(n)$$
$$O(n+1)=gO(n)+hE(n)+i$$
with $H(0)=c$, $E(0)=f$, $O(0)=j$
By a WolframAlpha computation we have
$$H(n)=\left(c+\frac{b}{a-1}\right)a^n-\frac{b}{a-1}$$
Hence our second equation becomes
$$E(n+1)=dE(n)+e\left(\left(c+\frac{b}{a-1}\right)a^n-\frac{b}{a-1}\right)$$
Now for convenience we write new constants: $k:=e\left(c+\frac{b}{a-1}\right)$ and $l:=-\frac{eb}{a-1}$, so now the equation reads
$$E(n+1)=dE(n)+ka^n+l$$
By another WolframAlpha computation we have
$$E(n)=\frac{k}{a-d}a^n+\left(f+\frac{k}{d-a}+\frac{l}{d-1}\right)d^n+\frac{l}{1-d}$$
Now again we compactify variables: $m:=\frac{hk}{a-d}$, $o:=hf+\frac{hk}{d-a}+\frac{hl}{d-1}$, $p=\frac{hl}{1-d}+i$, so now the third equation reads
$$O(n+1)=gO(n)+ma^n+od^n+p$$
WolframAlpha wouldn't do the last computation for me, so I used Mathematica to get the solution for $O(n)$ as
$$\frac{-adg^nj+ag^{1+n}j+dg^{1+n}j+adg^{1+n}j-g^{2+n}j-ag^{2+n}j-dg^{2+n}j+g^{3+n}j-a^ndm+a^ngm+a^ndgm-a^ng^2m+dg^nm-g^{1+n}m-dg^{1+n}m+g^{2+n}m-ad^no+d^ngo+ad^ngo-d^ng^2o+ag^no-g^{1+n}o-ag^{1+n}o+g^{2+n}o-adp+agp+dgp-g^2p+adg^np-ag^{1+n}p-dg^{1+n}p+g^{2+n}p}{(g-1)(g-a)(g-d)}$$
(doubtless nicer expressions are possible, but I didn't want to expend the effort to find one)
Plugging your specific variables back in, I get (to three decimal places)
$$H(n)=3227.273(.89)^n+272.727$$
$$E(n)=1420(.89)^n+296.667(.64)^n+83.333$$
$$O(n)=3472.22 (0.144 - 0.128(.64)^n - 910.644(0.88)^n +
   3907.02 (0.88)^{1 + n} - 5394(0.88)^{2 + n} + 2400 (.88)^{3 + n} +
   14.7226 (0.89)^n)$$
Notice this checks out with your equilibrium solution since $3472.22\times0.144\approx500$ (off by only $3$ ten-thousandths).


text:
Q: Xna Texture3D loading I am trying to load texture3D(tga). I used tga from http://xbox.create.msdn.com/downloads/?id=43 and i load texture with:
Content.Load<Texture3D>("path to TGA")

When I debug i get an error saying that I am trying to load texture2D as texture3D. Anyone knows what is the problem?
and btw i'm also wondering if its possible to make texture3D from 1 color.

A: I found the solution! You don't even have to load texture because the location of it is already stored in model(fbx file) and it is loaded automatically. :D
Thanks Nico Schertler for showing me that link!


text:
Q: Compare distributions (with replicates) and visualization The experimental set-up is an almost typical control vs treatment, in which we are counting how many reads map to a particular class of genes in each condition (RNA-seq), done in triplicate. An example table would look like this:
feature  c1  c2  c3  t1  t2  t3
   A     10  7   11  5   3   4
   B     9  10   15  6   7   8
   C     15  6   10  11  5   9
   (.. up to several hundreds)

The question we are asking is:

"Is the distribution of counts in the control different from the
  treatment?".

Which would be the most appropriate test for this? From a previous question, an anova sounds like the way to go. Knowing R I could melt the data.table and run aov(Counts~Conditions, data). Would this be acceptable?
Extra points for suggestions on how to represent the data, including the replicates. Since there is more than one treatment, something like this, or boxplots for each replicate will become too cluttered.

A: Edit : after Roland comments I think that a poisson glm is suitable there.
I could be wrong, but if your triplicate comes by pair (c1 counting more or less the same thing as t1), using two factors might be more convenient. It allow to represent the category and the treatment/control condition in a separated manner as you want to focus on the difference between condition and treatment.
It would then give :
glm(Counts~Condition+Categ, data,family=poisson)


text:
Q: GDAL driver.Create() TypeError for datatype argument I have used the osgeo.gdal module to save numpy arrays as GeoTIFF files successfully in python for some time. Today I decided to write a simple module to handle the driver and file creation routines. Calling my module to save a numpy array gives the following error:
Traceback (most recent call last):
File "saveRaster.py", line 30, in <module>
    save_raster(destination,1,array,srs,gt)
File "saveRaster.py", line 10, in save_raster
    dataset_out = driver.Create(path, cols, rows, bands, dtype)
File "/Library/Frameworks/GDAL.framework/Versions/2.1/Python/2.7/site-packages/osgeo/gdal.py", line 1440, in Create
    return _gdal.Driver_Create(self, *args, **kwargs)
TypeError: in method 'Driver_Create', argument 5 of type 'int'

This is odd since argument 5 is the datatype argument, which should take a gdal data type such as gdal.GDT_Float32. However, if it try type(gdal.GDT_Float32) it returns <type 'int'>. Why then is gdal giving me a TypeError if an integer ought to be exactly what it is expecting?
Code below:
#! /usr/bin/env python

from osgeo import gdal,osr
import numpy as np

def save_raster(path, band_count, bands, srs, gt, format='GTiff', dtype=gdal.GDT_Float32):
    cols,rows = bands.shape
    # Initialize driver & create file
    driver = gdal.GetDriverByName(format)
    dataset_out = driver.Create(path, cols, rows, bands, dtype)
    dataset_out.SetGeoTransform(gt)
    dataset_out.SetProjection(srs)
    # Write the array to raster bands
    for b in range(band_count):
        out_band = dataset_out.GetRasterBand(b+1)
        out_band.WriteArray(bands[b])
    # Write file to disk
    dataset_out.FlushCache()

gt = [0,1,0,0,0,-1]

srs = osr.SpatialReference()
srs.ImportFromEPSG(epsg)
srs = srs.ExportToWkt()

destination = '~/Desktop/arr.tif'

array = np.arange(0,25).reshape(5,5)

save_raster(destination,1,array,srs,gt)

A: You have several issues. One of them is by using '~/Desktop/arr.tif' as your destination path. It should be 'Desktop/arr.tif'. Other are produced for your particular "band" concepts. In your code, bands is your numpy array to be written as raster. Avoiding this misunderstanding and by using right band concept, I fixed your code as follow (however, you should change your name variables):
#! /usr/bin/env python

from osgeo import gdal,osr
import numpy as np

def save_raster(path, band_count, bands, srs, gt, format='GTiff', dtype = gdal.GDT_Float32):
    cols,rows = bands.shape
    # Initialize driver & create file
    driver = gdal.GetDriverByName(format)
    dataset_out = driver.Create(path, cols, rows, 1, dtype)
    dataset_out.SetGeoTransform(gt)
    dataset_out.SetProjection(srs)
    # Write file to disk
    dataset_out.GetRasterBand(1).WriteArray(bands)
    dataset_out = None

epsg = 4326

gt = [0,1,0,0,0,-1]

srs = osr.SpatialReference()
srs.ImportFromEPSG(epsg)
srs = srs.ExportToWkt()

destination = 'Desktop/arr.tif'

array = np.arange(0, 25).reshape(5,5)

save_raster(destination,1,array,srs,gt)

After running above code at Python Console, I got following raster (as expected):


text:
Q: Android Newsreader Example - No Bin Folder I am learning to develop for Android devices.
However, when I download the example from:
http://developer.android.com/training/multiscreen/screensizes.html
There is no bin folder.  I am developing from the command line (as opposed to through Eclipse), and
ant debug install

requires a bin folder.
What step am I missing to generate the bin?


text:
Q: Locking cells and replacing content with data validation/VBA E5 is a dropdown with the following 3 options: None, Self-Consumption, Overnight Charging

*

*When 'none' is selected, the content in cells F37, F41:H41, F50:H51 needs to be cleared and the cells locked.

*When 'self-consumption' is selected, F37 needs to be unlocked, and F41:H41, F50:H51 need to be cleared and locked.

*When 'overnight-charging' is selected, F37 needs to be cleared and locked, and F41:H41, F50:H51 need to be unlocked.

E4 is a checkbox and when this is unchecked the following cells need to be cleared and locked:
F25:J25, F26, F28:J29, F31:J31.
I've saved the following macros to clear and lock the cells. Please can someone let me know what I do next to add the conditions as above. Many thanks.
Sub Solar()
'
' Solar Macro
' clear and lock cells if no panels being installed
'

'
    Range("F25:J25,F26,F28:J29,F31:J31").Select
    Range("F31").Activate
    Selection.ClearContents
    Selection.Locked = True
    Selection.FormulaHidden = False
End Sub
Sub Battery_SC()
'
' Battery_SC Macro
' Clear and lock cell if no self-consumption battery being installed
'

'
    Range("F37").Select
    ActiveCell.FormulaR1C1 = "0%"
    Range("F37").Select
    Selection.Locked = True
    Selection.FormulaHidden = False
End Sub

Sub Battery_OC()
'
' Battery_OC
' Clear and lock cells if no overnight battery being installed
'

'
    Range("F41:H41,F50:H50,F51:H51").Select
    Range("F51").Activate
    Selection.ClearContents
    ActiveWindow.SmallScroll Down:=-9
    Selection.Locked = True
    Selection.FormulaHidden = False
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$E$5" Then
        If Target.Value = "None" Then
            Range("F37,F41:H41,F50:H50,F51:H51").Select
            Range("F51").Activate
            Selection.ClearContents
            Selection.Locked = True
            Selection.FormulaHidden = False
        End If
        If Target.Value = "Self-Consumption" Then
            Range("F41:H41,F50:H50,F51:H51").Select
            Range("F51").Activate
            Selection.ClearContents
            Selection.Locked = True
            Selection.FormulaHidden = False
        End If
        If Target.Value = "Overnight Charging" Then
            Range("F37").Select
            Selection.ClearContents
            Selection.Locked = True
            Selection.FormulaHidden = False
        End If
    End If
End Sub

A: What you are trying to do is called a "Worksheet Change" event.  When something changes in a specified cell, known as the "Target, then do something.  This is the outline, you would need to fill in the "Do Something" parts.
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$E$5" Then
        If Target.Value = "None" Then
            Cells(1, 1) = 1
        End If
        If Target.Value = "Self-Consumption" Then
            Cells(1, 1) = 2
        End If
        If Target.Value = "Overnight Charging" Then
            Cells(1, 1) = 3
        End If
    End If
End Sub

@Darrell - Is this wrong?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$5" Then
    If Target.Value = "None" Then
        With Range("F37,F41:H41,F50:H50,F51:H51")
             .ClearContents
             .Locked = True
             .FormulaHidden = False
        End With
    End If
    If Target.Value = "Self-Consumption" Then
        With Range("F41:H41,F50:H50,F51:H51")
             .ClearContents
             .Locked = True
             .FormulaHidden = False
        End With
    End If
    If Target.Value = "Overnight Charging" Then
        With Range("F37")
             .ClearContents
             .Locked = True
             .FormulaHidden = False
        End With
    End If
End If

End Sub


text:
Q: remove
* based on button click How can I delete a list based on the button clicked?

<input type ="button" name="Clear" value = "Clear1"/>

<input type ="button" name="Clear" value = "Clear2"/>

<input type ="button" name="Clear" value = "Clear3"/>

e.g If I click clear2, it must remove the list it belongs.

A: $("input[type=button]").click(function() {
   $(this).parent().remove();
}

A: Try this:
$(document).ready(function()
{
  $("input[type=button]").click(function()
  {
    $(this).parent().remove();
  });
});

Note: Using Jquery here.

A: this should be the accurate answer:
$(document).ready(function(){

  $("#list :button").click(function(){
    $(this).parent().remove();
  });

});

for if you use suggestions of womp's and Sarfraz's, you might be removing the wrong element.. You can see what I mean here.


text:
Q: how to create horizontal list inside vertical scroll in react native for IOS and android I want to create view like following image:
I am beginner in react native.
=> Which control i have to use?
=>How to design App architecture?

A: Suggested Model Type
[{
   type:"MOST_SEARCHED",
   data:[],//your data comes here for horizontal row's
   orientation:'horizontal'
 },
 {
   type:"BLOGS",
   data:[],//your data comes here for horizontal row's
   orientation:'horizontal'
 }]

After this you need to design the View (Inner component)
 _wallList=(item)=>{
 return( <Carousel
        data={item.data}
        extraData={this.state}
        inactiveSlideScale={1}
        renderItem={(item) => {
                if (wallType === MOST_SEARCHED) {
                   this._renderMostSearched()// view for most searched
                }
        }}
        sliderWidth={SLIDER_WIDTH}
        itemWidth={SLIDER_WIDTH - 32}
  />)
 }

Outer flatlist
  <FlatList
        ref={(c) => {
              this._flatList = c
            }}
        style={{overflow: 'visible'}}
        directionalLockEnabled={true}
         data={this.state.data}
         renderItem={(item) => (this._wallList(item))}
         refreshing={this.state.refreshing}
         onRefresh={this._refreshHome}
         onScroll={this.handleScroll} />


text:
Q: How do I handle button presses in Gtk2::Image objects? I've been trying to get an Gtk2::Image object in this Perl Gtk2 application to get to react to button presses, but to no avail. The image shows as expected but the button events don't get handled. What am I missing?
  my $img = Gtk2::Image->new_from_file( $file );
  $img->set_property( sensitive => 1 );
  $img->can_focus( 1 );
  $img->set_events([qw/ button-press-mask button-release-mask /]);
  $img->signal_connect(
    'button-press-event' => sub {
      my ( $self, $event ) = @_;
      print STDERR "Coords: ", $event->get_coords;
      return;
    });
  $window->add( $img );
  $window->show_all;

A: GtkImage does not have any window associated to it; in other words it does not react to any X event (generally, the ones ending with -event).
The common way to handle events on those widgets is by using GtkEventBox, that is placing the GtkImage widget inside a GtkEventBox and connecting X event signals to this GtkEventBox.


text:
Q: How to find information from three tables related to each other (MySQL) I have created a database dealer in MySQL which has all the info about
         a dealer like :
     dealer id
     dealer name
     dealer email
     dealer phone no
     dealer's primary address
     dealer's billing address
     dealer's contact person
     dealer's contact person's name
     dealer's contact person's email

And this information is stored in three tables namely:
    dealer
    address
    contact_person

The fields and data of tables are given below :
This table dealer has dealer_id as primary key.
    `mysql> select * from dealer;
    +-----------+-------------+----------------+-----------------+
    | dealer_id | dealer_name | dealer_email   | dealer_phone_no |
    +-----------+-------------+----------------+-----------------+
    |       101 | dell        | dell@gmail.com |      9000000000 |
    |       102 | asus        | asus@gmail.com |      8000000000 |
    |       103 | hp          | hp@gmail.com   |      7000000000 |
    +-----------+-------------+----------------+-----------------+
    3 rows in set (0.02 sec)
    `

This table address has field dealer_address_id as primary keyand field add_dealer_id as foreign key which references to the table dealer's field dealer_id.
    `mysql> select * from address;
    +-------------------+---------------+----------------------+-------------+----------------+
    | dealer_address_id | add_dealer_id | add_line1            |  city       |   address_type |
    +-------------------+---------------+----------------------+-------------+----------------+
    |             10001 |           101 | 1, Dell Avenue       | Round Rock  | Primary        |
    |             10002 |           101 | 1, Dell Avenue       | Round Rock  |  Billing       |
    |             10003 |           102 | 1, Asus Computer     | Fremont     |  Primary       |
    |             10004 |           102 | 1, Asus Headquarters | Taipei      | Billing        |
    |             10005 |           103 | HP Inc               | Palo Alto   |  Primary       |
    |             10006 |           103 | HP Inc               | Bristol     |  Billing       |
    +-------------------+---------------+----------------------+-------------+----------------+
    6 rows in set (0.01 sec)
    `

And this table contact_person has field contact_person_id as primary key and field cp_dealer_id as foreign key which also references to the tables dealer's field dealer_id.
    `mysql> select * from contact_person;
    +-------------------+--------------+-----------------+------------------------+
    | contact_person_id | cp_dealer_id | con_per_name    | con_per_email          |
    +-------------------+--------------+-----------------+------------------------+
    |              1001 |          101 | Michael S. Dell | michael.dell@gmail.com |
    |              1002 |          101 | Sam Greenblatt  | sam.dell@gmail.com     |
    |              1003 |          102 | Jerry Shen      | jerry.asus@gmail.com   |
    |              1004 |          103 | Dion J. Weisler | dion.hp@gmail.com      |
    +-------------------+--------------+-----------------+------------------------+
    4 rows in set (0.01 sec)`

I want to find all the information about a dealer like :
    dealer id
     dealer name
     dealer email
     dealer phone no
     dealer's primary address
     dealer's billing address
     dealer's contact person
     dealer's contact person's name
     dealer's contact person's email

For example i have queries :
    `Find dealer on the basis of dealer id `

    `Find dealer on the basis of dealer name `

    `Find dealer on the basis of dealer email `

So please help me how do I do this ?

A: What you are looking for is a join statement in MySQL.
Here is an example:
SELECT Dealer.dealer_id, Dealer.Name, Dealer.Email
FROM Dealer
INNER JOIN Address
ON Dealer.dealer_id=Address.dealer_id;


text:
Q: SQL Server : split column based on parent child relationship The table has a parent child relationship between the two columns as below:

I would like to split the ID columns into 3 different columns as below:

Basically the one which has 0 as ParentID would be in Cat1. Cat2 is linked with Cat1 by ParentID and similarly Cat3 is linked to Cat2.
If anyone has an approach to solve this could you please share your thoughts ?

A: That's a simple query to do. And you've actually perfectly described what the query should do.
Let's go step by step:

Basically the one which has 0 as ParentID would be in Cat1.

So the first step is to get Cat1 values:
SELECT Cat1.id FROM tablename AS Cat1
WHERE Cat1.ParentID = 0

Cat2 is linked with Cat1 by ParentID

It's a JOIN. LEFT JOIN to be specific, because apparently you want to get rows with null values in these columns, if there are no rows with such ParentID:
SELECT Cat1.id, Cat2.id FROM tablename AS Cat1
LEFT JOIN tablename AS Cat2 ON Cat2.ParentID = Cat1.id
WHERE Cat1.ParentID = 0

similarly Cat3 is linked to Cat2.

Now, we do the same for Cat3:
SELECT Cat1.id, Cat2.id, Cat3.id FROM tablename AS Cat1
LEFT JOIN tablename AS Cat2 ON Cat2.ParentID = Cat1.id
LEFT JOIN tablename AS Cat3 ON Cat3.ParentID = Cat2.id
WHERE Cat1.ParentID = 0


text:
Q: Numpy time based vector operations where state of preceding elements matters - are for loops appropriate? What do numpy arrays provide when performing time based calculations where state matters. In other words, where what has occurred in earlier or later in a sequence is important.
Consider the following time based vectors,
TIME = np.array([0.,   10.,  20.,  30.,  40.,  50.,  60.,  70.,  80.,  90.])
FLOW = np.array([100., 75.,  60.,  20.0, 60.0, 50.0, 20.0, 30.0, 20.0, 10.0])
TEMP = np.array([300., 310., 305., 300., 310., 305., 310., 305., 300., 295.0])

Let's say that an exponential decay in TEMP should be applied once the FLOW falls below 30 without raising again above 50. In the data above, a function would be applied at TIME=60 above and the last two values of TEMP would be updated by this secondary function which would began with the corresponding TEMP value.
There is a need to "look ahead" to determine if the FLOW rises above 50 in the elements after the <30 condition is requested. It does not seem that the numpy functions are aimed at time based vectors where state is important and the traditional method of nested for loops perhaps remains the way to go. But given given my newness to numpy and the fact that I have to perform alot of these types of state based manipulations, I would appreciate direction or affirmation.

A: While Joe Kington's answer is certainly correct (and quite flexible), it is rather more circuitous than need be. For someone trying to learn Numpy, I think a more direct route might be easier to understand.
As I noted under your question (and as Joe also noticed), there seems to be an inconsistency between your description of the code's behaviour and your example. Like Joe, I'm also going to assume you describe the correct behaviour.
A couple notes:

*

*Numpy works well with filter arrays to specify to which elements an operation should be applied. I make use of them several times.

*The np.flatnonzero function returns an array of indices specifying the locations at which the given array is non-zero (or True).

The code uses the example arrays you provided.
import numpy as np

TIME = np.array([0.,   10.,  20.,  30.,  40.,  50.,  60.,  70.,  80.,  90.])
FLOW = np.array([100., 75.,  60.,  20.0, 60.0, 50.0, 20.0, 30.0, 20.0, 10.0])
TEMP = np.array([300., 310., 305., 300., 310., 305., 310., 305., 300., 295.0])

last_high_flow_index = np.flatnonzero(FLOW > 50)[-1]
low_flow_indices = np.flatnonzero(FLOW < 30)
acceptable_low_flow_indices = low_flow_indices[low_flow_indices > last_high_flow_index]
apply_after_index = acceptable_low_flow_indices[0]

We now have the index after which the function should be applied to TEMP. If I am reading your question correctly, you would like the temperature to begin decaying once your condition is met. This can be done as follows:
time_delta = TIME[apply_after_index:] - TIME[apply_after_index]
TEMP[apply_after_index:] = TEMP[apply_after_index:] * np.exp(-0.05 * time_delta)

TEMP has been updated, so print TEMP outputs
[ 300.          310.          305.          300.          310.          305.
  310.          184.99185121  110.36383235   65.82339724]

Alternatively, you can apply an arbitrary Python function to the appropriate elements by first vectorizing the function:
def myfunc(x):
    ''' a normal python function that acts on individual numbers'''
    return x + 3

myfunc_v = np.vectorize(myfunc)

and then updating the TEMP array:
TEMP[apply_after:] = myfunc_v(TEMP[apply_after:])

A: You can certainly do this without nested loops in numpy.  If you want to get really fancy, you could probably vectorize the entire thing, but it's probably the most readable to just vectorize it to the point that you only need one loop.
Generally speaking, try to vectorize things unless it becomes excessively clunky/unreadable or you're having memory usage issues.  Then do it another way.
In some cases loops are more readable, and they'll commonly use less memory than vectorized expressions, but they're generally slower than vectorized expressions.
You'd probably be surprised at how flexible the various indexing tricks are, though. It's rare that you have to use loops to do a calculation, but they often wind up being more readable in complex cases.
However, I'm slightly confused by what you state as the correct case... You say that you want to apply a function to portions of temp where the flow falls below 30 without rising above 50.  By this logic, the function should be applied to the last 4 elements of the temp array.  However, you state that it should only be applied to the last two... I'm confused!  I'm going to go with my reading of things and have it applied to the last 4 elements of the array...
Here's how I would do it. This uses random data rather than your data so that there are multiple regions...
Note that there aren't any nested loops, and we're only iterating over the number of contiguous regions in the array where your "asymmetric" threshold conditions are met (i.e. there's only one iteration, in this case).
import numpy as np
import matplotlib.pyplot as plt

def main():
    num = 500
    flow = np.cumsum(np.random.random(num) - 0.5)
    temp = np.cumsum(np.random.random(num) - 0.5)
    temp -= temp.min() - 10
    time = np.linspace(0, 10, num)

    low, high = -1, 1
    # For regions of "flow" where flow drops below low and thereafter
    # stays below high...
    for start, stop in asymmetric_threshold_regions(flow, low, high):
        # Apply an exponential decay function to temp...
        t = time[start:stop+1] - time[start]
        temp[start:stop+1] = temp[start] * np.exp(-0.5 * t)

    plot(flow, temp, time, low, high)

def contiguous_regions(condition):
    """Finds contiguous True regions of the boolean array "condition". Returns
    a 2D array where the first column is the start index of the region and the
    second column is the end index."""

    # Find the indicies of changes in "condition"
    d = np.diff(condition)
    idx, = d.nonzero()

    if condition[0]:
        # If the start of condition is True prepend a 0
        idx = np.r_[0, idx]

    if condition[-1]:
        # If the end of condition is True, append the length of the array
        idx = np.r_[idx, len(condition)-1]

    # Reshape the result into two columns
    idx.shape = (-1,2)
    return idx

def asymmetric_threshold_regions(x, low, high):
    """Returns an iterator over regions where "x" drops below "low" and
    doesn't rise above "high"."""

    # Start with contiguous regions over the high threshold...
    for region in contiguous_regions(x < high):
        start, stop = region

        # Find where "x" drops below low within these
        below_start, = np.nonzero(x[start:stop] < low)

        # If it does, start at where "x" drops below "low" instead of where
        # it drops below "high"
        if below_start.size > 0:
            start += below_start[0]
            yield start, stop

def plot(flow, temp, time, low, high):
    fig = plt.figure()
    ax1 = fig.add_subplot(2,1,1)
    ax1.plot(time, flow, 'g-')
    ax1.set_ylabel('Flow')

    ax1.axhline(y=low, color='b')
    ax1.axhline(y=high, color='g')
    ax1.text(time.min()+1, low, 'Low Threshold', va='top')
    ax1.text(time.min()+1, high, 'High Threshold', va='bottom')

    ax2 = fig.add_subplot(2,1,2, sharex=ax1)
    ax2.plot(time, temp, 'b-')
    ax2.set_ylabel('Temp')
    ax2.set_xlabel('Time (s)')

    for start, stop in asymmetric_threshold_regions(flow, low, high):
        ax1.axvspan(time[start], time[stop], color='r', alpha=0.5)
        ax2.axvspan(time[start], time[stop], color='r', alpha=0.5)

    plt.setp(ax1.get_xticklabels(), visible=False)
    plt.show()

if __name__ == '__main__':
    main()


text:
Q: Sending a JSON request to launch a Google Apps Script I am trying to create a new Google Doc using Apps Script.
Here's the code of my macros:
function createDoc() {

      var doc = DocumentApp.create('Sample Document');
      var body = doc.getBody();
      var rowsData = [['Plants', 'Animals']];
      body.insertParagraph(0, doc.getName())
          .setHeading(DocumentApp.ParagraphHeading.HEADING1);
      table = body.appendTable(rowsData);
      table.getRow(0).editAsText().setBold(true);
    }

I have also generated a link for this script as a web app (it looks like this: https://script.google.com/macros/s/[SCRIPTID]/exec). Now I have to send GET request but I don't know what JSON command should I send. Could you please help?
Many thanks in advance!


text:
Q: Apply multiple condition in using jquery selector I want to apply click event in this div
<input class="form_button_submit" type="submit" name="submit" value="Submit Request">

It should satisfy both this condition means should be of class .form_button_submit and input[value='Submit Request']
I want to do something like this :
$(".form_button_submit && input[value='Submit Request']").click(function() {
    alert("Nothing")
});

A: You can do this like:
$("input.form_button_submit[value='Submit Request']")

Demo:
You can see in the below demo only first button works, as it satisfies both this condition means should be of class .form_button_submit and input[value='Submit Request']

$("input.form_button_submit[value='Submit Request']").click(function() {
    alert("Nothing")
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input class="form_button_submit" type="submit" name="submit" value="Submit Request">
<input class="form_button_submit" type="submit" name="submit" value="Submit Request2">
<input class="form_button_submit2" type="submit" name="submit" value="Submit Request">

A: Multiple selectors can be used in JQuery with commas ,
$(".form_button_submit, input[value='Submit Request']").click(function() {
    alert("Nothing")
});


text:
Q: get matplotlib lines from pandas plot pandas df.plot returns
axes : matplotlib.AxesSubplot or np.array of them
I need to get the lines object, as returned from matplotlib.plot:
Return value is a list of lines that were added.
Obviously, I can just use mpl directly instead of pandas.plot, but is there a way to do this?

A: The pandas plotting function indeed returns the axes object.
ax = df.plot()  # returns matplotlib.axes._subplots.AxesSubplot

If the plot creates a single line, you can easily get that with
line = ax.lines[0]

If it creates several lines, you would need to know the order by which they are created to index the axes'  lines
line4 = ax.lines[3]


text:
Q: Data location on Gitlab Background: I'm trying to set-up automated deployment with rsync with gitlab runners.
I'm trying to find the actual code stored on a gitlab installation but i don't seem to be able to. I've found the repositories but the data so far is nowhere to be found. Since the repositories should be bare, I haven't really searched the whole repo.
I've tried searching the web, but almost everything only covers the repository locations and not that of the data. A lot also cover moving the data, but only by providing a new storage location which has no original folder, which again, doesn't help me much. I have looked in the default locations, but those folders don't exist.
The only mention of git_data_dir in gitlab.rb is commented, so that's no help as well.
Where should I be able to find the actual code? Or where in the repositories/config files can i find where it is stored?

A: It depends on how you installed gitlab. If you use the omnibus package installation, the actual repositories would normally reside in /var/opt/gitlab/git-data/repositories
If you mean the content that is maintained within the repository: it is not checked out anywhere. A runner checks it out and cleans up afterwards.


text:
Q: Using JavaScript to Un-Populate Form in Email Forward My organization directs users to a form whose fields successfully pre-populate with user information when they access the form via a URL we email to them.  The URL contains a unique identifier for each recipient that corresponds to their record in our info system.
Due to privacy considerations, we want this form NOT to pre-populate if the intended recipient of the URL forwards the email to a friend.  Moreover, we need the user's unique ID in the URL disabled altogether so that the form doesn't overwrite the original user's record with the friend's information upon submission.
I don't have access to the source code of this form.  However, the form builder does allow for custom JavaScript.  Unfortunately, my office doesn't know a lot of JavaScript, and we don't really have a dev team.
So, any suggestions would be greatly appreciated!  Thanks in advance!


text:
Q: Is it possible to install Windows 7 Professional 64-bit on a virtual disk when starting the setup by booting the installation disc? I have been reading up on the native virtual hard disk support in Windows 7. The problem is installing Windows 7 on the virtual hard disk. Whenever I boot from the installation disc, follow the usual instructions to attach a vdisk and select the vdisk as the destination for the install, the setup responds with an error (I've had different errors, I'll post one the next time I reboot to try again).
There are a lot of instructions to be found on the web, for example this blogpost on MSDN:

Select the new unallocated partition
and click Next. You may see a warning
that reads, "Windows cannot be
installed to this disk. (Show
details)" but can often safely ignore
this.

It's clear to me that ignoring this is not an option on my machine, but I have no idea why.
In another article on TechNet I read:

To put a Windows 7 or Windows Server
2008 R2 operating system image in the
VHD file, you have to apply an image
to the partition in the VHD file.
Running Setup from the install DVD and
selecting a partition in a VHD file
for installation is not supported.

So is it possible, unpossible (as Homer Simpson would say) or just unlikely (and thus, "not supported" as in the TechNet article)?
Thanks!

A: I would recommend burning your Windows 7 install disk to a ISO Image .   Then, mount the .iso image as a CDRom for your VMWare system.   I'm not saying that is the answer but I bet you learn a lot from it.


text:
Q: Create custom extension Laravel Markdown I used Laravel Markdown to view content. and i want create custom extension to render @image(image_id) => .
i have used this Inline Parsing but still didn't understand how to detect the @image(image_id).
Here the example code i have tried:
class ImageParser extends AbstractInlineParser
{

    /**
     * @return string[]
     */
    public function getCharacters()
    {
        return ['@'];
    }

    /**
     * @param InlineParserContext $inlineContext
     *
     * @return bool
     */
    public function parse(InlineParserContext $inlineContext)
    {
        $cursor = $inlineContext->getCursor();

        $previous = $cursor->peek(-1);
        if ($previous !== null && $previous !== ' ') {
            return false;
        }

        $previousState = $cursor->saveState();
        $cursor->advance();

        $handle = $cursor->match('/image\((\d+)\)/');
        if (empty($handle)) {
            $cursor->restoreState($previousState);

            return false;
        }

        $imageId = preg_replace("/image\((\d+)\)/", "$1", $handle);
        $image = Image::find($imageId);

        if (is_null($image)) {
            return false;
        }

        $inlineContext->getContainer()->appendChild(new HtmlInline($this->render($image)));

        return true;
    }

    /**
     * Render the image figure.
     *
     * @param \PYM\Storage\Image $image
     *
     * @return string
     */
    protected function render(Image $image)
    {
        $source = empty($image->source) ? null : "
{$image->source}
";

        return '
getUrl('wide') . '" alt="' . $image->alt_tag . '">' . $source . '
';
    }
}

I didn't understand how to use parse() method. maybe anyone here can explain to me or give an example :)


text:
Q: Which design pattern to use for Step wise object update I have to write a logic that would update an Object through a series of methods and would detect what step has failed :
EntryPointForLogic() {
    Object obj = CreateObject();

    UpdateObj1(obj);
    UpdateObj2(obj);
    ....
    UpdateObj_(obj);
}

Is there a preferred / standard design pattern for writing similar logic.
The different steps could fail and I want to detect which one of them failed.

A: This roughly maps to something like a chain of responsibility, you could use an abstract class along with step name information and logging to create an audit trail.
Again, this is not exactly a chain of responsibility because the previous handler is not changing the steps in my example
Abstract class
This is not perfect, you'll need to handle the implementation of stuff as you need it, and wouldn't recommend building your own logging library but still an OK example
public abstract class Updater<T>
{
     private readonly ILog _logger;
     public Name {get; private set;}
     public Updater(string name, ILog logger)
     {
         _logger= logger;
         Name = name;
     }

     protected abstract UpdateImpl(T updating);

     public Update(T updating)
     {
         _logger.Log("Started updater " + Name);
         try
         {
             UpdateImpl(updating);
         }
         //DON'T DO THIS IN ACTUAL IMPLEMENTATION
         //DO NOT EAT ALL OF THE EXCEPTIONS
         catch ( Exception e)
         {
            _logger.Log(e);
         }
         finally
         {
             _logger.Log("Finished Updater " + Name);
         }
     }
}

Example Implementation
Then you just define the individual updaters, for example
public class AwesomeObjectNameUpdater : Updater<AwesomeObject>
{
      public AwesomeObjectNameUpdater(ILogger logger) :base("Awesome Name Updater", logger)
      {

      }

      protected override UpdateImpl(AwesomeObject updating)
      {
           //here your mission critical business logic will go
           updating.Name = "Mr.Fancy-Pants " + updating.Name;
      }
}

Actual Chain
You can just create an enumerable with all of the different implementations of your Updaters and apply them in order
//assume it is assign in a constructor
private readonly IEnumerable<Updater<AwesomeObject>> _updaters;
public void ApplyUpdaters(AwesomeObject obj)
{
    foreach(var updater in _updaters)
    {
        updater.Update(obj);
    }
}

Further reading
If you want to read more about the pattern you can see the links provided below

*

*Chain-of-responsibility pattern , Wikipedia

*Chain of Responsibility Pattern Tutorial with Java Examples, DZone

A: You can use List of Action and Iterate through them:
EntryPointForLogic() {
    Object obj = CreateObject();
    List<Action<object>> actions = new List<Action<object>>()
    {
         UpdateObj1,UpdateObj2,UpdateObj3
    };

    for(int i =0; i<actions.Count; i++)
    {
        try
        {
             actions[i](obj);
        }
        catch(Exception ex)
        {
            Console.WriteLine($"Error occured in update nr {i}");
        }
    }
}

To add name of each action you can use
- inside method : List<Tuple<string,Action<object>>>
- in interface you should not expose Tuple so create your own class/struct with name and action.


text:
Q: rails: deleting objects in has_many through only if no longer referenced A posts model:
class Post < ActiveRecord::Base
  has_many :taggings, dependent: :destroy
  has_many :tags, through: :taggings

and a tags model:
class Tag < ActiveRecord::Base
  has_many :taggings
  has_many :posts, through: :taggings

and the associated join table:
class Tagging < ActiveRecord::Base
  belongs_to :tag, dependent: :destroy
  belongs_to :post

so, the dependent: :destroy in Post makes the db entries in Tagging to be destroyed when doing for instance Post.last.destroy, and the dependent: :destroy in Tagging makes the associated Tag object to be destroyed as well. Fine.
My problem is, 2 posts may share the same Tag, and I would like to destroy that tag -only- if the post being deleted is the last one referencing it. I don't allow duplicate entries in the Tag table. The tags for a post are submitted as a a string with the tags separated by commas, and upon creation of a post I do the following:
  def tag_names=(names)
    self.tags = names.split(",").map{ |tag| Tag.where(name: tag.squish).first_or_create! }
  end

Any idea on how I could achieve this? Thanks!

A: Are you using a plugin? act_as_taggable or something like that?
If so, take a look to the docs because probably is already implemented.
If not, you can always implement the after_destroy callback to count the elements associated to a tag and delete the tag in the case that you have "empty" tags.
For instance, in your Post model:
class Post

  before_destroy :clean_up_tags

  protected

  def clean_up_tags
    tags_to_delete = Tagging.where(id: self.tag_ids).group(:tag_id).having("count(distinct taggable_id) = 1").pluck(:id)
    Tag.find(tags_to_delete).map(&:destroy)
  end

end

This method is assuming that you have a method tag_ids that returns the tags associated to an specific Post and that your taggings model is polymorphic).
As you probably have more than one model with the tags feature, a good approach would be packing this method into a module and include it in all the models, in this way you keep the things DRY.


text:
Q: How to make one wide tileable, vertical redstone in minecraft When looking around at multiple sources, I found that vertical redstone was possible, although far  from tileable. When designing, this is the closest I came. While it is relatively compact, it expands horizontally too much to be useful, and the torches are not on the same level. My question is, is there any way to reverse the torch cascade, and make it tileable?

A: In 1-tileable redstone either avoid dust like a plague or painstakingly engineer the power levels it emits. There are many techniques for transmitting signal in 1-tileable way, and using the best for your job is pretty important.
If you still want the torch cascade, you can exploit the quirk of comparators that they can read container through a block and output its fill level, unless the block is powered to power level 15, then they output 15.

A much neater way is to utilize interleaved slime and honey with pistons (transporting power by up to 12 blocks).

Or you might want to employ pulse-based transmission and simple T flip-flops (just a sticky piston with a redstone block, powered by a short pulse, like from an observer) to convert levels back. One of methods of transporting the signal down like that in 1.16 is using walls and their behavior of forming pillars when something attaches from the side - e.g. a trapdoor opens.

Or you can use observer chains - you can save a lot of resources and speed things up by interleaving observers, solid blocks and blocks that change state in an observable way, like noteblocks or trapdoors.

For horizontal and diagonal transport, rails (powered and activator) are particularly graceful, especially that you can mix them and one kind won't power the other even linked end to end.

Or - as mentioned in the beginning, use dust and specific distance and power level, so that the signal only reaches the destination in the desired slice.

There are other curious and tricky ways of transporting signal in a 1-tileable way, but I think this should get you started.


text:
Q: Python win32com - Class not registered error I'm trying to control a device (Gamry Interface 5000 Potentiostat) via its COM interface using win32com.
# Imports
import win32com.client as client

# Get device list
devices = client.Dispatch('GamryCOM.GamryDeviceList')

# Iterate through devices
for i in range(devices.Count()):
    # Get device (this wors as we only have one connected yet)
    device = devices.EnumSections()[i]
    print(device)

# Setup potentiostat object
potentiostat = client.Dispatch('GamryCOM.GamryPstat')

When I run this, I got the following error message:
IFC5000-10519
Traceback (most recent call last):
  File "c:\Users\Rob\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\client\dynamic.py", line 86, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\[...]\gamry_control_01.py", line 23, in <module>
    potentiostat = client.Dispatch('GamryCOM.GamryPstat', clsctx = pythoncom.CLSCTX_LOCAL_SERVER )
  File "c:\Users\Rob\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\client\__init__.py", line 117, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch, userName, clsctx)
  File "c:\Users\Rob\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\client\dynamic.py", line 106, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "c:\Users\Rob\AppData\Local\Programs\Python\Python39-32\lib\site-packages\win32com\client\dynamic.py", line 88, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

Funnily enough, the first dispatch-statement just works fine, Just the second one fails.
I'm using a 64 Bit Windows 11 setup and tested different Python environments:

*

*Python 3.10 64 Bit, win32com-303 64 Bit

*Python 3.9 32 Bit, win32com-303 32 Bit

I also tried using comtypes instead of win32com which resulted in the same error.
Thank you very much for your help!
Regards

A: "Class not registered" means it cannot find the class factory for the class. That's an error independent of Python and has nothing to do with it...other than the bitness of Python (whether it is 32 or 64-bit, and whether the COM server is 32 or 64-bit). It also matters whether the server is In Process (a DLL) or Out of Process (EXE). For EXE, it really doesn't matter, but for an In-Process server, the bitness of the calling program and the COM server have to match.  In order to see if you have a bitness problem, do this...
Create the following VB Script, call it test.vbs
set obj = CreateObject("GamryCOM.GamryDeviceList")
MsgBox TypeName(obj)

Call the script two times from the command line, one with the 64-bit VB Script engine, and once with the 32-bit engine. If you're running from a directory other where test.vbs is located, you'll have to supply the path to test.vbs as well.
64-bit engine:
c:\windows\system32\wscript.exe test.vbs

32-bit engine:
c:\windows\syswow64\wscript.exe test.vbs

If the object is correctly registered and an EXE server, it should succeed for the script run both as 32 and 64-bit. If the object is correctly registered and a DLL server, it will succeed for only one run of the above script. If the object is incorrectly registered, it will fail for the script run with both engines.
In the case of double failure, you will have to figure out how the producer of the COM object expects you to call it. It could be licensing is involved.
In the case of single failure, you will have to use a different bitness of Python to match the server, or if you're truly running 64-bit Python as you say, then maybe figure a way to host the 32-bit DLL in 64-bits using something like DllHost. I've never done it, but there are articles online on how to do it.

A: I had the same problem and contacted a Salesman.
He sent me a document, saying that on some devices you have to use
pstat = client.CreateObject('GamryCOM.GamryPC5Pstat') for the Reference family and
pstat = client.CreateObject('GamryCOM.GamryPC6Pstat') for the Interface family.
For me, at least the OSError: [WinError -2147221164] Class not registered disappears.
I've used "comtypes".

A: To add on to the 64bit VS 32bit COM objects this article was helpful
https://www.codeproject.com/Tips/267554/Using-32-bit-COM-Object-from-64-bit-Application
I will list out the steps in case of internet decay
Using a 32-bit COM Object from a 64-bit Application:

*

*Locate your COM object GUID under HKey_Classes_Root/Wow6432Node/CLSID.

*Once located, add a new REG_SZ (string) value. The name should be AppID and
the data should be the same COM object GUID you have just searched for.

*Add a new key under HKey_Classes_Root/Wow6432Node/AppID. The new key should
be called the same as the COM object GUID.

*Under the new key you just added, add a new REG_SZ (string) value, and call
it DllSurrogate. Leave the value empty.

*Create a new key under HKey_Local_Machine/Software/Classes/AppID, if it
doesn't already exist. Again, the new key should be called the same as the
COM object's GUID. No values
are necessary to be added under this key.

Using these steps I created the necessary .reg files to automate the process in cases like switching computers etc..


text:
Q: Issue Running Python Script using os.listdir() I am using os.listdir() to list contents of a directory and print those contents:
import os

def scanfiles(path):
    for item in os.listdir(path):
    print(item)

path = str(os.path.normpath(input("Please enter a path: \n")))
scanfiles(path)

This program will work if, at the prompt, I enter something like: '/foo/bar'
(with quotes).
However, if I do not enter quotes, such as:
/foo/bar
the program gives me this error:
Traceback (most recent call last):
  File "scanfiles.py", line 7, in <module>
  path = str(os.path.normpath(input("Please enter a path: \n")))
  File "<string>", line 1
    /foo/bar
    ^
SyntaxError: invalid syntax

I need a way to make this run without entering quotes before and after the path.
I don't want to make a new string my concatenating quotes on each end because that doesn't seem very elegant to me.