text:
Q: WAR module can't connect EJB module inside Wicket class Last time I try learn Maven Enterprice Aplication with Wicket but I can't start.
I use:
Netbeans 8.2,
Wicket 7,
EJB3,
wildfly 10
Project structure:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>SampleWicketProject</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>SampleWicketProject</name>
  <modules>
    <module>SampleWicketProject-ear</module>
    <module>SampleWicketProject-web</module>
    <module>SampleWicketProject-ejb</module>
  </modules>
</project>

SampleWicketProject-ear pom:
        <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <parent>
        <artifactId>SampleWicketProject</artifactId>
        <groupId>com.example</groupId>
        <version>1.0-SNAPSHOT</version>
      </parent>

        <groupId>com.example</groupId>
        <artifactId>SampleWicketProject-ear</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>ear</packaging>

        <name>SampleWicketProject-ear</name>

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ear-plugin</artifactId>
                    <version>2.8</version>
                    <configuration>
                        <version>6</version>
                        <defaultLibBundleDir>lib</defaultLibBundleDir>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>com.example</groupId>
                <artifactId>SampleWicketProject-ejb</artifactId>
                <version>1.0-SNAPSHOT</version>
                <type>ejb</type>
            </dependency>
            <dependency>
                <groupId>com.example</groupId>
                <artifactId>SampleWicketProject-web</artifactId>
                <version>1.0-SNAPSHOT</version>
                <type>war</type>
            </dependency>
        </dependencies>
    </project>

SampleWicketProject-ejb pom:
    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <artifactId>SampleWicketProject</artifactId>
    <groupId>com.example</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

    <groupId>com.example</groupId>
    <artifactId>SampleWicketProject-ejb</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>ejb</packaging>

    <name>SampleWicketProject-ejb</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>hibernate-jpamodelgen-4.3.1.Final</artifactId>
            <version>SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>unknown-jars-temp-repo</id>
            <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
            <url>file:${project.basedir}/lib</url>
        </repository>
    </repositories>
</project>

SampleWicketProject-ejb persistance.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="myPersistance" transaction-type="JTA">
    <jta-data-source>java:/jboss/datasources/PostgreDataSource</jta-data-source>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <class>com.example.entities.Person</class>
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
       <property name="hibernate.hbm2ddl.auto" value="update"/>
        <property name="hibernate.show_sql" value="true" />
    </properties>
  </persistence-unit>
</persistence>

SampleWicketProject-ejb interface:
package com.example.Repository;

import com.example.entities.Person;
import javax.ejb.Local;

//@Local
public interface NewSessionBeanLocal {

    public void addPerson(Person person);
}

SampleWicketProject-ejb class:
package com.example.Repository;

import com.example.entities.Person;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
//@LocalBean
public class NewSessionBean  implements NewSessionBeanLocal{

    @PersistenceContext(unitName = "myPersistance")
    EntityManager em;

    @Override
    public void addPerson(Person person) {
        em.persist(person);
    }
}

SampleWicketProject-web pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <artifactId>SampleWicketProject</artifactId>
    <groupId>com.example</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

    <groupId>com.example</groupId>
    <artifactId>SampleWicketProject-web</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>SampleWicketProject-web</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <wicket.version>7.6.0</wicket.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>SampleWicketProject-ejb</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-core</artifactId>
            <version>${wicket.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-extensions</artifactId>
            <version>${wicket.version}</version>
        </dependency>
        <dependency>
           <groupId>org.wicketstuff</groupId>
           <artifactId>wicketstuff-javaee-inject</artifactId>
           <version>${wicket.version}</version>
       </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/java</directory>
                <includes>
                    <include>**</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
    </build>

</project>

SampleWicketProject-web web.xml:
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
     version="3.1">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

    <filter>
        <filter-name>SampleWicketProject-web</filter-name>
        <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>com.example.WicketApplication</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>SampleWicketProject-web</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

SampleWicketProject-web classes:
WicketApplication.class
package com.example;

import org.apache.wicket.markup.html.WebPage;
ipackage com.example;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.wicketstuff.javaee.injection.JavaEEComponentInjector;

public class WicketApplication extends WebApplication{

    @Override
    public Class<? extends WebPage> getHomePage()
    {
        return StartPage.class;
    }

    @Override
    protected void init(){
        super.init();
        getComponentInstantiationListeners().add(new JavaEEComponentInjector(this));
    }
}

StartPage.class
package com.example;

import com.example.Repository.NewSessionBeanLocal;
import com.example.entities.Person;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import org.apache.wicket.markup.html.WebPage;
@Named
@SessionScoped
public class StartPage extends WebPage {

    @EJB
    NewSessionBeanLocal beanLocal;

    public StartPage() {
        Person person = new Person();
        person.setSurname("ABC");
        person.setUsername("DEF");

        beanLocal.addPerson(person);
    }
}

StartPage.html

        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

Hello World : Project Wicket + EJB

I added EJB dependency to WAR module but all the time i have this error:
    16:28:45,104 ERROR [org.apache.wicket.DefaultExceptionMapper] (default task-2) Unexpected error occurred: org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.example.StartPage()'. An exception has been thrown during construction!
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:194)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:67)
    at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:102)
    at org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:271)
    at org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:169)
    at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
    at org.apache.wicket.request.handler.render.WebPageRenderer.isPageStateless(WebPageRenderer.java:287)
    at org.apache.wicket.request.handler.render.WebPageRenderer.shouldRenderPageAndWriteResponse(WebPageRenderer.java:329)
    at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:193)
    at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:175)
    ... 46 more
Caused by: java.lang.NoClassDefFoundError: Lcom/example/Repository/NewSessionBeanLocal;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.apache.wicket.injection.Injector.findFields(Injector.java:145)
    at org.apache.wicket.injection.Injector.inject(Injector.java:93)
    at org.wicketstuff.javaee.injection.JavaEEComponentInjector.inject(JavaEEComponentInjector.java:68)
    at org.wicketstuff.javaee.injection.JavaEEComponentInjector.onInstantiation(JavaEEComponentInjector.java:74)
    at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
    at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
    at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
    at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
    at org.apache.wicket.Component.<init>(Component.java:688)
    at org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:180)
    at org.apache.wicket.Page.<init>(Page.java:170)
    at org.apache.wicket.Page.<init>(Page.java:134)
    at org.apache.wicket.markup.html.WebPage.<init>(WebPage.java:75)
    at com.example.StartPage.<init>(StartPage.java:17)
    ... 51 more
Caused by: java.lang.ClassNotFoundException: com.example.Repository.NewSessionBeanLocal from [Module "deployment.SampleWicketProject-web-1.0-SNAPSHOT.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
    ... 68 more

I don't understand what is wrong. It doesn't matter if I add another dependences like hibernate, jpa … or no. I correctly set up the database on Wildfly local server. I think it's looks like WAR have some problem with EJB module inside wicket class...? Does anybody have a clue what might be the problem? Thank you for any advice


text:
Q: Change URLs with percent signs back to their original language How can I convert a link which has percentages and dollars in the URL into its original language?
I don't want it displayed like the following
http://tantrarahasya.wordpress.com/2008/09/30/%e0%a4%b6%e0%a5%8d%e0%a4%b0%e0%a5%80-%e0%a4%ae%e0%a4%b9%e0%a4%be-%e0%a4%b5%e0%a4%bf%e0%a4%aa%e0%a4%b0%e0%a5%80%e0%a4%a4-%e0%a4%aa%e0%a5%8d%e0%a4%b0%e0%a4%a4%e0%a5%8d%e0%a4%af%e0%a4%82%e0%a4%97
… on my Wordpress blog etc.
What exactly can I do to see it in its original language?

A: These are percent-encoded URLs. They convert all characters to a simple ASCII representation. This process is also known as "URL encoding".
If you only want to your links in their original language, look for an URL decoding utility (there are plenty of them online too, like this one). Insert the link, click "decode", and see:
http://tantrarahasya.wordpress.com/2008/09/30/श्री-महा-विपरीत-प्रत्यंग
This URL will also work, it links back to your blog and opens the article.

A: You could also use a service such as http://tiny.cc/ to create a shortened URL, which they then map to the original and redirect the visitor.
I've just done one for you: http://tiny.cc/h954l

redpajama_set_name: RedPajamaStackExchange


text:
Q: How find this equation solution $2\sqrt[3]{2y-1}=y^3+1$ find this equation roots:
$$2\sqrt[3]{2y-1}=y^3+1$$
My try: since
$$8(2y-1)=(y^3+1)^3=y^9+1+3y^3(y^3+1)$$
then
$$y^9+3y^6+3y^3-16y+9=0$$
Then I can't.Thank you someone can take hand  find the equation roots.

A: Another approach:
Put $x=\sqrt[3]{2y-1}$ then $x^3=2y-1$. So, $x^3+1=2y$
Then we have the system of equation:
$\left\{\begin{matrix} x^3+1=2y\\y^3+1=2x \end{matrix}\right.$
Subtracting these two equations from each other, we have
$(x-y)(x^2+xy+y^2+2)=0$
which gives $x=y$ as ($x^2+xy+y^2+2>0 $  $\forall$ $x,y$)
Hence we have $y=\sqrt[3]{2y-1}$
$\Rightarrow y^3-2y+1=0$
$\Leftrightarrow(y-1)(y^2+y-1)=0$
Therefore, $y=1$ or $y=\frac{-1\pm \sqrt{5} }{2}$

A: $$y^9+3y^6+3y^3-16y+9=0\iff(y-1)(y^2 + y - 1)(y^6 + 2y^4 + 2y^3 + 4y^2 + 2y +9) = 0$$
Three real-valued roots: $$y = 1, y = \dfrac{-1 \pm \sqrt 5}{2}$$
I noticed by inspection that $y = 1$ solves the equation. Then, using polynomial division, and manipulation with the resulting quotient, was able to find the quadratic factor. The sixth degree polynomial has no real roots.
Additional tip: Sometimes it helps to graph the equation to learn how many real roots there are: look for points intersecting the x-axis. Here's the graph of your 9th-degree polynomial:

A: Let $f(y) = \frac12 (y^3+1)$, we have
$$2\sqrt[3]{2y-1} = y^3+1\quad\iff\quad f^{-1}(y) = f(y) \quad\implies\quad y = f(f(y))$$
Since $f(y)$ is a strictly increasing function in $y$, we have

*

*If $f(x) > x$, then $f(f(x)) > x$.

*If $f(x) < x$, then $f(f(x)) < x$.

This means
$$\begin{align}
y = f(f(y)) \implies & y = f(y)\\
\iff & y^3+1 - 2y = 0\\
\iff & (y^2 + y -1 )(y-1) = 0\\
\implies & y = 1\text{ or }  \frac{-1\pm \sqrt{5}}{2}
\end{align}$$


text:
Q: What is the function of "can" in the following sentences? It's hot in summer, we can go swimming.
It's cold in winter, we can't go swimming.
What is the function of can? Is it ability or possibility?

A: It depends a bit on what the speaker has in mind and the circumstances. Generally, if you know how to swim, it's technically possible for you to swim regardless of what season it is. Whether you want to is a different question. You might also have a health condition that makes it dangerous to swim in certain cases, for example in the cold. Without more context, it can be hard to tell what the speaker wanted to convey.
"It's hot in summer, we can go swimming" - to me, this sentence is about the fact that swimming can cool you off when it's hot out. If you're the person suggesting that, you're presumably able to swim and have an idea where to go swimming.
"It's cold in winter, we can't go swimming" - this really depends on what the speaker means. I'd guess the underlying implication is "we would get sick if we go swimming when it's cold out", so even if it's possible (the beach is right there) and you're able to (you know how to swim), you'd choose not to.


text:
Q: wrap around task environment not working I am trying to create an environment wrapping a task environment (from the tasks package). To build the new environment I am using the xparse package.
\documentclass{article}

\usepackage{xparse}
\usepackage{tasks}

\NewTasks[%
counter-format=tsk[a]),
item-indent=0pt,
after-item-skip=0pt,
%label-offset=0.1em
]{aaaa}

\DeclareDocumentEnvironment{bbbb}{}
{%
    \begin{aaaa}
}{%
    \end{aaaa}
}%

\begin{document}
\begin{bbbb}
  \task first
  \task secod
\end{bbbb}
\end{document}

But when I compile I got the error:
ERROR: LaTeX Error: \begin{aaaa} on input line 23 ended by \end{bbbb}.

--- TeX said ---

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.25 \end{bbbb}

It seems that tne \DeclareDocumentEnvironemnt is not working fine in this case.


text:
Q: Using SCIM, can my app ask the IdP whether the user is part of a group? The usual use of SCIM seems to be that user information (provisioning) can flow from the IdP to the app (aka, service provider).  But what if the app has a question for the IdP, like: "what is the group membership of this user?"  I don't see anything in SCIM to prevent that, but maybe I am missing something , maybe the IdP won't typically be listening for a query like that through SCIM, or maybe the SCIM server/gateway implementations readily available don't support it.  To implement single sign-on, wouldn't the app ask the IdP for whether a user is authenticated -- maybe that would be a similar flow to what I am asking?

A: There are two distinct roles in SCIM - "client" and "service provider". The client makes RESTful requests to the SCIM API hosted by the service provider. The example you've given would require that both parties (IdP + App) had implemented the ability to handle both client and service provider roles, so that both can make requests to each other. IdPs almost universally will have SCIM clients implemented, but the IdP having a SCIM service provider implemented isn't as sure of a thing - this will depend on the specific IdP you are working with.


text:
Q: Soot:Invalid option -android-jars While I wanted to run soot using the option -android-jars from command line, I got the error "Invalid option". I downloaded the soot source code (sootall-2.5.0) from https://www.sable.mcgill.ca/soot/soot_download.html, and I built the project in eclipse successfully.
I also downloaded soot-master and soot-develop source code. I saw this two have the option "-android-jars" but when I built project, there were too many errors... So I failed again.
How can I solve this problem? I am very very fresh new about Soot. I hope somebody can help me. thx~

A: The version you are using is too old. The command-line option was not yet present in Soot 2.5.0.


text:
Q: Stack and heap in C#
Possible Duplicate:
What and where are the stack and heap

There is a difference in C# between the heap and stack. I've just realized that I always thought that the stack is RAM and the heap is a hard drive. But now I'm not sure if it's correct. If it isn't, then what's is the difference if they are stored in one place?

A: "The stack" (or more precisely the call stack) is automatically managed memory (even in "unmanaged languages" like C): Local variables are stored on the stack in stack frames that also contain the procedures or functions arguments and the return address and maybe some machine-specific state that needs to be restored upon return.
Heap memory is that part of RAM (or rather: virtual address space) used to satisfy dynamic memory allocations (malloc in C).
Yet, in C# heap and stack usage is an implementation detail. In practice though, objects of reference type are heap-allocated; value type data can both be stored on the stack and on the heap, depending on the context (e.g. if it's part of an reference-type object).


text:
Q: Why are shared libraries (.so files) loaded as private? This is from an smaps file:
b750d000-b76bc000 r-xp 00000000 08:01 918842     /lib/i386-linux-gnu/libc-2.23.so
The p in r-xp indicates it is loaded as private I believe. Why is this so? Doesn't this defeat the purpose of shared libraries if a copy of each .so file is loaded into different memory addresses for different processes? What advantage does this private loading offer?


text:
Q: Unknown publisher warning in application developed in VB.Net on Win7 Hi
I have developed application using VB 2008 and develop a MSI setup for installation.
Now problem is on windows 7 it generate a warning message on installation of software that "The publisher is unknown", but the software install well on continue of this warning.
When I run the software it did connect to Access database which is on installation directory, but it didn't allow to insert or update any data in the database.
But when I run the software by right click on the EXE file "Run as a Administrator" then software works perfectly OK.
I add some information of signing certificate from the project explorer but not able to succeed.
Please help me out I am going crazy with this stuff....
Thanks

A: The warining is just that - a warning. You can prevent it by buying a certificate and use that to sign the app.
You should not install a database or any other writable file in the application folder. A normal user has no Write privileges there. The certificate will make no difference.
You can use Environment.GetFolderPath(Environment.SpecialFolder) to find a more suitable location for the Db.


text:
Q: Get HTML output of results of a SELECT statement I'm using Pl/SQL and Oracle Application Express 4.1 on Oracle Database 11g.
I've been trying send an email including HTML output of the result of a SELECT statement I have. I found the owa_utils.cellsprint function that prints out HTML, but I'm hoping to actually get the HTML in a big varchar or clob returned from a similar function. Then I can add some more text of my own and eventually send the email with the table inside. I searched around, but couldn't find anything besides the cellsprint function.
So what I have is this:
owa_utils.cellsprint('SELECT col1, col2, col3 FROM my_table WHERE condition');
But what I would ideally like is something similar to this:
l_clob := some_function('SELECT col1, col2, col3 FROM mytable WHERE condition');
Then I would add some more HTML to l_clob and send the email.
Is there any way to do this without writing my own function to iterate through the result set and create the table using <tr> and <td> myself?


text:
Q: Server and Database role memberships required to add columns and constraints I have a user with the following server and database role memberships:

*

*securityadmin (server)

*public (server)

*db_owner (database)

*db_accessadmin (database)

*db_securityadmin (database)

When running the below script in SQL 2005, it runs through without any issues:
BEGIN TRAN
IF NOT EXISTS (SELECT COLUMN_NAME
               FROM INFORMATION_SCHEMA.COLUMNS
               WHERE TABLE_NAME = 'Opfix'
                 AND COLUMN_NAME = 'ModifiedBy')
BEGIN
    ALTER TABLE [OpFix] ADD [ModifiedBy] [int] NOT NULL
    CONSTRAINT DF_OpFixModifiedBy DEFAULT ([dbo].[fnSoftmarLoginUserID]())
END
ROLLBACK TRAN

When running the same script on SQL 2008 and SQL 2012, I get the below error:

Cannot find the object "Opfix" because it does not exist or you do
  not have permissions.

So, my questions are:

*

*Does it makes sense that I get different results between SQL 2005 and SQL 2008+, with the same update and the exact same user permissions?

*What are the minimum requirements for this script to run through?

*The only way I could get this script to run through on SQL 2008+ was to grant sysadmin membership, is that as expected?

A: First, the rollback transaction will undo what you are doing. Use commit transaction instead.

*

*Yes

*DB_owner in a database named XXX

*Do you have a "USE XXX" in your script? I normally remove that stuff to protect DB names and server names when posting.  What you are saying here does not make sense to me.


text:
Q: Why simple code doesn`t work corectly c++? #include <iostream>
bool check_number(unsigned short int a, unsigned short int b) {
    if ((a || b == 30) || a + b == 30) {
        return true;
    }
    return false;
}

int main() {

    std::cout << check_number(15, 16) << std::endl;
    std::cin.get();
    return 0;
}

Why I get "true" result? Why not false, we know that 15 + 16 is 31

A: if ((a || b == 30) is not "either a or b equal 30" it is "either (a) or (b equals 30)". As a is non-zero it is true when converted to bool.
So you have
if ((true || other condition) || just_another_condition)

and because || is short-circuiting the condition as a whole is true.
If you actually wanted "either a equals 30 or b equals 30" that is (a == 30) || (b == 30).
Last but not least, if you have code like this:
if (condition) {
     return true;
} else {
     return false;
}

Then this is just return condition;


text:
Q: How to switch power supply between two sensors I have two ultrasonic sensors, when one sensor acts as a transmitter other acts a receiver and vice-versa.
How can I supply power for the 1st sensor for 20 microseconds  and switch the power source to the second sensor for 20 microseconds with a delay of 10 milliseconds in between. For example, the powering up sequence appears like the below.

*

*Power to 1st sensor for 20 micro seconds

*Switch off power for 10 milli seconds

*Power to 2nd sensor for 20 micro seconds

*Switch off power for 10 milliseconds

*Repeat steps 1 to 4

Note: Only one sensor is powered at a time.
edit: Ultrasonic sensor electrical supply:
The exact voltage applied to transducer depends on signal attenuation through the medium, which I am yet to determine, for this reason I would like to have the flexibility to go up to 200V (if need be). Ultrasonic transducer typically require 30mA.
edit: Ultrasonic sensor operation summary:
I would like to apply 2MHz sine wave (or pulse) to one sensor and listen with the other and then switch the pulse and listening mode.
edit: Transducer spec.

A: OK I'll take a stab at an answer.  I don't know what you have on the receiver end but I'll assume an opamp.  (with +/-15 V rails.)  Then if you could keep the pulse down below 30V p-p you'd be all set.  The problem will be if you have to go to higher voltages.  You can then either protect the input (to the reciever opamp) from the high voltage.  The typical series resistor and diodes to the supply rails.. or by some other scheme.  The other option would be to switch between the Tx and Rx channels.  I think you can do this with a solid state relay (SSR).  But I'm not sure about finding a SSR that works at 2 MHz.  I don't think that would be a problem but I just don't know.  You could also perhaps use mechanical relays, though I don't know how fast they are... what's the settling time for a mechanical relay?  So I'd start with small <30V pulses maybe that will be good enough.  (Turn up the gain on the receiver side.)


text:
Q: TextIO.outputSubstr() does not write anything I have a really annoying problem.
This function:
fun writeAFile() =
  let
    val outstream = TextIO.openOut "look_at_me_im_a_file.txt"
  in
    TextIO.outputSubstr(outstream,Substring.full("I'm so sad right now :("))
  end;

Just creates the file look_at_me_im_a_file.txt but it's empty.
I get no errors and it does not work with either SML/NJ or PolyML.
I have no problems reading from files.

A: First of all, Substring.full isn't needed - it doesn't really do anything other than give you something of the substring type. Instead, you can do:
TextIO.output (outstream, "I'm so sad right now :(");

Now, the reason it doesn't work:
When you tell sml to write something to a file (using TextIO.output or TextIO.outputSubstr) it doesn't actually write it in the file right away. It writes to a buffer. Well, sometimes it writes to the file right away, but not often enough that you can depend on it.
Now, this seems terribly impractical, but it's more efficient - if you tell it to write several small pieces of data after each other, it can just lump it all together in one write operation.
The way to get around it is to tell sml "Hey, I really want that write to happen right now." There's a function just for that, which is called TextIO.flushOut. Alternatively, closing the stream will also cause everything to be written.
Actually, you should always remember to close your streams. Leaving open file handles lying around is messy - how will the filesystem know that you're done with it, and that it can let other programs write to the file?

A: Being an rookie i didn't check our lecture notes :/
a functioning version of the code is
fun writeAFile() =
let
        val outstream = TextIO.openOut "look_at_me_im_a_file.txt"
in
    (
        TextIO.output(outstream,"I'm so glad right now :)");
        TextIO.closeOut(outstream)
    )
end;

Although its noteworthy that the online documentation at  http://www.standardml.org/Basis/text-io.html only gives a vague reference to the output function.
And looking at the documentation for the IMPERATIVE_IO says val output : outstream * vector -> unit which is confusing since it is non apparent that string is actually of type CharVector.vector and is thus a valid argument for the output function.
I hope this will be of help to some other rookie out there.


text:
Q: Getting "Subscript Out of Range" error when accessing Range.Value in Excel VBA I'm trying to access the data from an Excel Range in VBA.
Set fcr = Sheets("FC_Detail").UsedRange
row2 = fcr.Offset(1, 0).Resize(1).Value
row2Val = row2(1)

In this example the Variant row2 should store a 2D array of the 2nd row of the worksheet "FC_Detail" and the Variant row2Val should store the 1D array. (I split into 2 steps to aid debugging.) I can see from the debug window that row2 is exactly what I expect, but I get an error calling row2(1) in my code and in the debug window.

What's weird is that the debug window here says that row2 is a Variant of size (1,45) and that row2(1) is a Variant of size (45). But when I try looking at row2(1) I get an error.
What am I doing wrong?


text:
Q: Как из массива полученного через json_encode из GET запроса сделать запрос к БД? Есть GET запрос вида: http://127.0.0.1/test.php?key=foo&value=bar.
Необходимо что бы при переходе по данной ссылке в БД (noSQL), создавался ключ foo со значением bar. Как реализовать данную возможность?
C помощью json_encode($_GET) получаем строку {"key":"foo","value":"bar"}. Как можно данную строку превратить в значения для передачи их в дальнейшем в БД?

A: А зачем вам json_encode? У вас же уже есть массив ключ-значение
insert_into_no_sql_db($_GET['key'], $_GET['value']);

A: $str = '{"key":"foo","value":"bar"}';
$obj = json_decode($str);
echo $obj->key;
echo $obj->value;


text:
Q: Cant Gradle Sync after clicking update Gradle in Android Studio - Error:Gradle 2.14.1 requires Android Gradle plugin 2.1.3 (or newer) This is the exact error I am getting when trying to Gradle Sync in Android Studio. All I did was click the update button when the newer version of Gradle dialog came up.

Error:Gradle 2.14.1 requires Android Gradle plugin 2.1.3 (or newer) but project is using version 2.1.0.
Upgrade plugin to version 2.3.0 and sync project
Open Documentation

This is on my master branch which I know builds/syncs with other people.
Project Build file
// This is used to improve build server performance by disable pre-dexing when building.
// To enable this feature, use "./gradlew clean assemble -PdisablePreDex"
// Refer: http://tools.android.com/tech-docs/new-build-system/tips
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
    project.plugins.whenPluginAdded { plugin ->
        if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        }
    }
}

// This is used to control Android properties of all modules from the main project.
// Refer: http://tools.android.com/tech-docs/new-build-system/tips
ext {
    compileSdkVersion = 24
    buildToolsVersion = '24'
    gradleBuildToolClassPath = 'com.android.tools.build:gradle:2.2.2'
}

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:1.2.0"
        classpath "com.google.gms:google-services:3.0.0"
    }
}

Application Build file
buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath rootProject.ext.gradleBuildToolClassPath
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    // Projects
    releaseCompile project(path: ':LibProjects:Android-Library', configuration: 'release')
    debugCompile project(path: ':LibProjects:Android-Library', configuration: 'debug')
    compile project(':LibProjects:photoview')
    compile project(':LibProjects:viewpagerindicator')

    // Maven libraries
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:gridlayout-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.android.support:preference-v7:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-ads:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.edmodo:rangebar:1.0.0'
    compile 'com.edmodo:cropper:1.0.1'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:+'
    compile 'com.tonicartos:stickygridheaders:1.0.1'
    compile 'com.intellij:annotations:+@jar'
    compile 'com.mixpanel.android:mixpanel-android:4.5.3'
    compile 'com.splitwise:tokenautocomplete:2.0.7@aar'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') { transitive = true; }
    compile 'com.github.clans:fab:1.6.4'
    compile ('com.facebook.android:audience-network-sdk:4.6.0') { exclude group: 'com.google.android.gms' }
    compile('com.mopub:mopub-sdk-base:4.11.0@aar')
    compile('com.mopub:mopub-sdk-native-static:4.11.0@aar')

    // File libraries
    compile fileTree(dir: 'libs', include: '*.jar')
    compile(name:'adsnative-sdk-2.5.3', ext:'aar')

    // Testing
    androidTestCompile 'com.android.support:support-annotations:24.0.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.fusionprojects.edmodo"
        minSdkVersion 15
        targetSdkVersion rootProject.ext.compileSdkVersion
        versionCode 50111
        versionName "6.5.2"
        proguardFile getDefaultProguardFile('proguard-android.txt')
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
    }

    packagingOptions {
        // These statements are required for solving a very annoying gradle build error:
        // "Duplicate files copied in APK META-INF/DEPENDENCIES"
        // Refer: http://blog.csdn.net/zhouzme/article/details/18923293
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')

        // Testing
        androidTest.setRoot('androidTest')
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFile file('proguard-project.txt')
            signingConfig signingConfigs.releaseConfig
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
        jumboMode true
    }

    lintOptions {
        abortOnError false
    }
}

apply plugin: 'com.google.gms.google-services'

Gradle wrapper
#Tue Sep 06 16:30:01 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

A: You may try this :
Go to --> gradle.wrapper.properties
and replace the distribution Url with this :
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip

Hope this helps !


text:
Q: Xcode 7.3, Swift 2.2 Storyboards Extremely Slow I have a huge app in process, and since updating to Xcode 7.3, doing anything in storyboard is like molasses!!
About a month ago, I had about the same speed using one HUGE storyboard, so I split the project up into 5 separate storyboards, and Hallelujah, a hundred times faster!
But now, after updating, even dividing to 7; slow as can be!
I'm about to back up, then try and recreate one big one, then back up again, then divide again - to see if that does anything; but I am doubtful.
Anyone know how to fix this, or what is wrong with the latest update?

A: Well, not a great solution but, all I can determine is that; if the number of items and constraints in the view gets over a certain amount (using Xcode 7.3), the speed suddenly drops horribly.
So what I ended up having to do with this last storyboard (8 of 8) is to take a slide out side pane full of buttons and subviews, and place it in a container view - so that I could give it its own VC and thereby make it a stand alone 9th storyboard.
Not a great solution that's for sure, especially since I had to tie all of the buttons and methods to the parent view controller. I was lucky in this event in that the parent view (my main app map) is a single instance occurrence so I was able to reference it at launch, and merely prefix my former methods with the reference. If this was not so, I guess I would have to have done some serious protocol / delegation.
So, a proper solution (or 'fix' if it is Xcode's doing) is still wanting :)


text:
Q: How can I run a sublime plugin command when user types ; or } I have a plugin for Sublime but I want to do something when the user types a } or ;
I've tried to handle it on a on_modified event but I can't quite get it to work.
Is this the best approach to take?

A: Add a new keybinding that is bundled with your plugin. As an example, here is the default keybindings that trigger the auto-pairing of curly brackets:
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true }
    ]
},
{ "keys": ["{"], "command": "wrap_block", "args": {"begin": "{", "end": "}"}, "context":
    [
        { "key": "indented_block", "match_all": true },
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true },
    ]
},
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{${0:$SELECTION}}"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
    ]
},

Note that by using a single character as a keybinding, you are intercepting the keypress and it will not show up in the buffer. If you want the character to be sent to the buffer, you will need to put it there as part of your command.
You can see that in the example. The two insert_snippet commands wrap any arguments with curly-brackets: "contents": "{$0}" and the wrap_block command sends the curly-brackets as beginning and ending args: "args": {"begin": "{", "end": "}"}


text:
Q: Android map application crashes on emulator I have created a very basic android map activity application after installing Android Studio and installing all the needed SDKs for my platform, google play services and google repository from the SDK Manager.
But when I launch the app regardless of the API level I set for my device I get a message "SampleApplication won't run unless you update Google Play services" with an Update button as soon as the emulator launches.
Clicking on the update button crashes the application and I see this in the logs:
08-20 13:07:35.225    1768-1768/? D/dalvikvm? Not late-enabling CheckJNI (already on) 08-20 13:07:35.565
1768-1768/example.com.sampleMapApp E/Trace? error opening trace file: No such file or directory (2) 08-20 13:07:35.875
1768-1768/example.com.sampleMapApp I/dalvikvm? Could not find method android.app.Notification$Builder.setLocalOnly,
referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza 08-20 13:07:35.875
1768-1768/example.com.sampleMapApp W/dalvikvm? VFY: unable to resolve virtual method 242:
Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder; 08-20 13:07:35.875
1768-1768/example.com.sampleMapApp D/dalvikvm? VFY: replacing opcode 0x6e at 0x00c2 08-20 13:07:35.885
1768-1768/example.com.sampleMapApp I/dalvikvm? DexOpt: access denied from Lcom/google/android/gms/common/GooglePlayServicesUtil;
to field Landroid/app/Notification;.extras 08-20 13:07:35.885
1768-1768/example.com.sampleMapApp W/dalvikvm? VFY: unable to resolve instance field 18 08-20 13:07:35.885
1768-1768/example.com.sampleMapApp D/dalvikvm? VFY: replacing opcode 0x54 at 0x00e1 08-20 13:07:35.895
1768-1768/example.com.sampleMapApp E/dalvikvm? Could not find class 'android.app.AppOpsManager',
referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza 08-20 13:07:35.895
1768-1768/example.com.sampleMapApp W/dalvikvm? VFY: unable to resolve check-cast 25 (Landroid/app/AppOpsManager;)
in Lcom/google/android/gms/common/GooglePlayServicesUtil; 08-20 13:07:35.895
1768-1768/example.com.sampleMapApp D/dalvikvm? VFY: replacing opcode 0x1f at 0x000e 08-20 13:07:35.905
1768-1768/example.com.sampleMapApp I/dalvikvm? Could not find method android.content.pm.PackageManager.getPackageInstaller,
referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh 08-20 13:07:35.905
1768-1768/example.com.sampleMapApp W/dalvikvm? VFY: unable to resolve virtual method 532:
Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller; 08-20 13:07:35.905
1768-1768/example.com.sampleMapApp D/dalvikvm? VFY: replacing opcode 0x6e at 0x000b 08-20 13:07:35.935
1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:35.946    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:35.955    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:35.965    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:35.975    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:35.985    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.005    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.015    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.035    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.085    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.106    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.135    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.156    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.185    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.205    1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.
Requires 7571000 but found 3136130 08-20 13:07:36.355    1768-1768/example.com.sampleMapApp D/libEGL? loaded /system/lib/egl/libEGL_emulation.so 08-20 13:07:36.355
1768-1768/example.com.sampleMapApp D/libEGL? loaded /system/lib/egl/libGLESv1_CM_emulation.so 08-20 13:07:36.376
1768-1768/example.com.sampleMapApp D/libEGL? loaded /system/lib/egl/libGLESv2_emulation.so 08-20 13:07:36.396
1768-1772/example.com.sampleMapApp D/dalvikvm? GC_CONCURRENT freed 259K, 12% free 2510K/2832K, paused 12ms+3ms, total 141ms 08-20 13:07:36.405
1768-1768/example.com.sampleMapApp D/? HostConnection::get() New Host Connection established 0x2a139d08, tid 1768 08-20 13:07:36.515
1768-1768/example.com.sampleMapApp W/EGL_emulation? eglSurfaceAttrib not implemented 08-20 13:07:36.556
1768-1768/example.com.sampleMapApp D/OpenGLRenderer? Enabling debug mode 0 08-20 13:08:57.456
1768-1768/example.com.sampleMapApp D/AndroidRuntime? Shutting down VM 08-20 13:08:57.456
1768-1768/example.com.sampleMapApp W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40a71930) 08-20 13:08:57.496
1768-1768/example.com.sampleMapApp E/AndroidRuntime? FATAL EXCEPTION: main
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
            at android.app.Activity.startActivityForResult(Activity.java:3370)
            at android.app.Activity.startActivityForResult(Activity.java:3331)
            at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)
            at android.app.Activity.startActivity(Activity.java:3566)
            at android.app.Activity.startActivity(Activity.java:3534)
            at com.google.android.gms.dynamic.zza$5.onClick(Unknown Source)
            at android.view.View.performClick(View.java:4204)
            at android.view.View$PerformClick.run(View.java:17355)
            at android.os.Handler.handleCallback(Handler.java:725)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method) 08-20 13:09:00.516    1768-1768/? I/Process? Sending signal. PID: 1768 SIG: 9"

After seeing this ("Google Play services out of date.  Requires 7571000 but found 3136130")  in the log,
I have tried installing the Google play services apk com.google.android.gms-v7.5.74 by using the terminal's "adb install" command to no avail.

Please help me find out what am I missing.
PS: I have searched lot of other related questions on SO about this, but they all more or less point to the fact that the google play services might not be installed.

A: Your error clearly says
1768-1768/example.com.sampleMapApp W/GooglePlayServicesUtil? Google Play services out of date.

Go to SDK manage and update your Google API and create a new emulator.

A: I could resolve my issue by choosing "Lollipop 22 x86 Google APIs" for my emulator. Before this I was using Lollipop 22 x86_64 Android 5.1.1 for my target. Adding Google APIs in the target and updating all pending updates for my SDK solved this for me.
Edit: Also there were lot of other SDKs for different flavours of android present which I had to clean up and only retain API levels 19 and above for this to work.


text:
Q: 'Keeping up-to-date on' or 'Keeping up-to-date with'? I recently replied to someone who was informing me about my application for something. I replied "Thank you for keeping me up-to-date on my application". Afterwards I wondered if I should have written "Thank you for keeping me up-to-date with my application".
Which is grammatically correct?

A: If you are a job applicant, and corresponding with someone at a company that is considering hiring you, neither on or with is correct, and the phrase up-to-date is a little too casual.  Thank you for keeping me updated about the status of my application, or Thank you for updating me about the status of my application would be more appropriate.  The first of my suggested rewordings would be appropriate if you have been updated more than once; the second, if only once.
I hope this helps.

A: You might use on for a topic ("keeping up to date on politics"), and with for a source of information ("keeping up to date with the television news") or an ongoing task ("keeping up to date with the housework"). For a particular matter, you'd keep up to date about it, which is what you want here.
You might also prefer informed. "Thank you for keeping me informed about the status of my application".

A: In this example, the phrase up-to-date does not take hyphens because it does not refer to/precede a noun. "My up-to-date application" is correct, but "keeping me up-to-date on the status" is incorrect. No hyphens are used in the second example.


text:
Q: How to change zero-terminated byte values with Numpy? I have an array that looks like this:
array([(    0, 1579014911203, b"19'03.5", b'2'),
       (    1, 1579014911560, b"19'03.5", b'30'),
       (    2, 1579014912968, b"19'04.0", b'23'), ...,
       (14532, 1579124953407, b"19'12.0", b'15'),
       (14533, 1579124955508, b"19'11.5", b'50'),
       (14534, 1579124966108, b"19'11.5", b'27'],
      dtype={'names':['order','time','degree','speed'], 'formats':['<u4','<u8','S15','S15']})

I can change the type of speed using astype, but how can I change the type of degree into float or decimal? I want to remove any characters except for numbers and a dot. How could I do this without using Pandas?

A: I don't now of another way than looping over your data and transforming the string into a valid float. Depending on the notation you could use:
import re
import numb as np

degrees = np.zeros_like(arr['degree'], dtype=float)
for i, deg in enumerate(arr['degree']):
    # Find all numbers in the string
    numbers = re.findall(r"\d+", str(deg))

    # Transform the numbers to your desired float
    deg_new = float(numbers[0] + numbers[1] + '.' + numbers[2])
    # deg_new = int(numbers[0]) + float(numbers[1] + '.' + numbers[2])/60
    # deg_new = int(numbers[0]) + int(numbers[1])/60 + int(numbers[2])/3600
    degrees[i] = deg_new


text:
Q: Pass arguments to console.log as first class arguments via proxy function console.log takes an unspecified number of arguments and dumps their content in a single line.
Is there a way I can write a function that passes arguments passed to it directly to console.log to maintain that behaviour? For example:
function log(){
    if(console){
        /* code here */
    }
}

This would not be the same as:
function log(){
    if(console){
        console.log(arguments);
    }
}

Since arguments is an array and console.log will dump the contents of that array. Nor will it be the same as:
function log(){
    if(console){
        for(i=0;i<arguments.length;console.log(arguments[i]),i++);
    }
}

Since that will print everything in different lines. The point is to maintain console.log's behaviour, but through a proxy function log.
+---
I was looking for a solution I could apply to all functions in the future (create a proxy for a function keeping the handling of arguments intact). If that can't be done however, I'll accept a console.log specific answer.

A: This should do it ..
function log() {
    if(typeof(console) !== 'undefined') {
        console.log.apply(console, arguments);
    }
}

Just adding another option (using the spread operator and the rest parameters - although arguments could be used directly with the spread)
function log(...args) {
    if(typeof(console) !== 'undefined') {
        console.log(...args);
    }
}

A: There is a good example from the html5boilerplate code that wraps console.log in a similar way to make sure you don't disrupt any browsers that don't recognize it. It also adds a history and smoothes out any differences in the console.log implementation.
It was developed by Paul Irish and he has written up a post on it here.
I've pasted the relevant code below, here is a link to the file in the project: https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console) {
    arguments.callee = arguments.callee.caller;
    var newarr = [].slice.call(arguments);
    (typeof console.log === 'object' ? log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
  }
};

// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}}((function(){try {console.log();return window.console;}catch(err){return window.console={};}})());

A: Yes.
console.log.apply(null,arguments);

Although, you may need to loop through the arguments object and create a regular array from it, but apart from that that's how you do it.


text:
Q: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException con Neodatis Tengo el código siguiente que se dispara con un evento al pulsar enter en en jtextfield
El problema lo tengo es que cuando se ejecuta al pulsar "Enter" me da el siguiente error, indicándome que es una excepción de tipo
Algún alma caritativa me puede decir por que se me produce?
Gracias de antemano a todos.
Saludos
private void JtfEmpresaKeyReleased(java.awt.event.KeyEvent evt) {
    char t = evt.getKeyChar();
    if(t== KeyEvent.VK_ENTER){
        this.dni = this.JtfDni.getText().toUpperCase().trim();
        this.empresa = this.JtfEmpresa.getText().toUpperCase().trim();
        System.out.println(this.empresa);
        ODB od1 = ODBFactory.open("/Users/jesusgomez/datos/Productores.db");
        IQuery elquery = new CriteriaQuery(Productores.class, Where.equal("PrdNif", this.dni.toString().toUpperCase().trim()));
        //Productores productor = (Productores) od1.getObjects(elquery).getFirst();
        //System.out.println(productor.getPrdEmpCif());

        //productor.setPrdEmpCif(this.empresa.toString());
        //od1.store(productor);
        //od1.commit();
        //od1.close();

        Productores objeto = (Productores) od1.getObjects(elquery).getFirst();
        objeto.setPrdEmpCif(this.empresa);
        od1.store(objeto);
        this.JtfCentro.requestFocus();
    }
}

        `

A: El problema se debe a que no se pudo abrir la base de datos, regularmente ocurre porque la ruta es incorrecta.
ODB od1 = ODBFactory.open("/Users/jesusgomez/datos/Productores.db");

Si usas Neodatis ODB te sugiero cambiar el path por la ruta absoluta de la base de datos en tu pc, ejemplo:
 ODB od1 = ODBFactory.open("c:\\Users\jesusgomez\datos\Productores.db");


text:
Q: How to know query generated by Fluent NHibernate I am using linq to Nhibernate to fire some select query to data base.
My question is, how do I know, the query generated by Fluent NHibernate?

A: You might also find this useful http://nhprof.com/

A: If you want the SQL to be in log4net, make sure you set the logger in your configuration section.
I put the NHibernate package at "INFO" to reduce the noise and the NHibernate.SQL to all so I can log all SQL statements.

 <logger name="NHibernate">
   <level value="INFO" />
 </logger>

  <logger name="NHibernate.SQL">
    <level value="ALL" />
  </logger>

A: I have found 4 options to know sql query in nhibernate and fluent nhibernate.

*

*Log - Joey V. said in answer of this same question.

*ShowSql - Kevin Berridge said in answer of this same question.

*NHProf - This is a awesome profiler. NHProf

*Intercepter - It is really good to see sql. we can put it in our Output of Visual Studio and even in log file.
ISessionFactory sf = Fluently.Configure()
        .Database(MySQLConfiguration.Standard.ConnectionString(ConnectionString).ShowSql())
        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Stock>())
        .ExposeConfiguration(c => c.SetInterceptor(new ABCInterceptor()))
        .BuildSessionFactory();

public class ABCInterceptor : EmptyInterceptor
{
    public override NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql)
    {
       Trace.WriteLine(sql.ToString());
       return sql;
    }
 }

A: With Fluent NHibernate, you can turn on show_sql like this:
Fluently.Configure()
    .Database( MsSqlConfiguration.MsSql2005.ShowSql().ConnectionString(...) )...

NHibernate will now print every sql statement to Console.Out.

A: See this. What you need is hibernate.show_sql.

A: You can use sql profilers like this one too.

A: Definitely buy and use NHProf.  This is an awesome product and not only shows you what queries are being run, but also shows you any potential performance problems with your NHibernate mappings and queries.

A: You can also hook in log4net.


text:
Q: Google Spreadsheets API: Notes in cells I made a php script to export some information to google spreadsheets using api v4. When I try to add notes into a cell I should do a request to the API for every note, and this arises a issue for me, explained ahead.
My current approach is the following one, I'm trying to add notes on every column of a single row ($headerNotes is an array):
public function writeHeaderNotes($headerNotes, $spreadsheetId, $sheetId, $row)
{
    $client = $this->getClient();
    $service = new Google_Service_Sheets($client);
    $cellstart = 0;
    $cellend = 1;

    foreach ($headerNotes as $note)
    {
        $body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array(
            'requests' => array(
                'updateCells' => array(
                    'rows' => array(
                        'values' => array(
                            'note' => $note)),
                    'fields' => 'note',
                    'range' => array(
                        'sheetId' => $sheetId,
                        'startRowIndex' => $row-1,
                        'endRowIndex' => $row,
                        'startColumnIndex' => $cellstart,
                        'endColumnIndex' => $cellend)))
        ));
        $service->spreadsheets->batchUpdate($spreadsheetId, $body);
        $cellstart++;
        $cellend++;
    }

}

In this approach, notes are added one by one (using loop) and it's working fine. The main problem is that I'm doing as many requests as notes and google has limited cuotas. (100 write requests per user per 100 seconds). I need to optimize the number of requests and I need make just one request to add different notes in different cells of the same row. Reading google spreadsheet documentation, i can see that "note" node in request, is asking for a string value:
  "note": string,

https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatecellsrequest
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#RowData
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellData
How could I add different notes to different single-row cells, without the need to make so many requests?

A: As stated in the docs for the RowData object [1], the values field is an array where each value (CellData object) is the value to be inserted in each cell. You also need to use a Range that can cover all the values you want to insert in each row. I modified and tested your code to insert notes in the first 5 columns of the first row and worked succesfully:
$client = getClient();
$service = new Google_Service_Sheets($client);
$cellstart = 0;
$cellend = 5;
$note = "whatever";
$row = 1;

$body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array(
    'requests' => array(
        'updateCells' => array(
            'rows' => array(
                'values' => array(
                    array('note' => $note),
                    array('note' => $note),
                    array('note' => $note),
                    array('note' => $note),
                    array('note' => $note)
                )
            ),
            'fields' => 'note',
            'range' => array(
                'sheetId' => $sheetId,
                'startRowIndex' => $row-1,
                'endRowIndex' => $row,
                'startColumnIndex' => $cellstart,
                'endColumnIndex' => $cellend
            )
        )
    )
));
$service->spreadsheets->batchUpdate($spreadsheetId, $body)

[1] https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#RowData


text:
Q: События клика jquery У меня есть див, хочу отловить клик в нем. Про событие click знаю, когда в диве обычный текст то все работает как нужно, но я вывожу в нем кнопки соц сетей, на которые код не реагирует, как бы отловить клики по ним ?
Вот сам див:

<g:plusone></g:plusone>

А вот код jq котоым я пытался сделать это:

A: В вашем случае:
http://code.google.com/apis/+1button/
Смотреть после заголовка "+1 Tag Attributes"
Там есть колбэк функции. Туда можно назначить свои функции, которые отработают при "нажатии".
Вообще можно пробовать перехватывать события для ДИВ или ИФРЕЙМ объекта соцсети, но там на самом деле все индивидуально - событие могут прибить раньше, чем оно дойдет до вашего обработчика.
Универсально - наверно никак.
A: Можно исследовать в инструментах типа Opera Dragonfly или аналога в Хроме, как называются кнопочки (дивы это? какие у них классы?).
И заменить строчку на эту (например):
$(".shit div").click(function() {

Или может быть просто воспользоваться методом children(): http://api.jquery.com/children/
Исходя из слов

У меня есть див, хочу отловить клик в нем.

У вас есть возможность тупо назначить клик-событие на все элементы, находящиеся внутри этого div'а, т.е. сделать просто $(".shit *").click(function () { - Этот код я не проверял, но смысл такой.
A:

A: Кнопки соцсетей выводятся в самом конце, поэтому на них click() может банально не успеть повеситься. Пользуйтесь live('click', function(){});


text:
Q: Apply vba function to cell directly above button In my vba code the goal is to add 500 to the cell above the button. Right now the button in question is in cell "c7". I want the cell directly above it which is cell be "b7" to add 500 every time the button is pressed. I would like to copy the button to add for cells throughout the worksheet. So the code has to be something like cell.above +500 or something like that. I added my current code below.

Range("b7").Value = Range("b7").Value + 500

A: If you're using a form button, it's like this:
Sub FormButtonClick()
With Shapes(Application.Caller).TopLeftCell.Offset(-1, 0)
    .Value = IIF(Not IsNumeric(.Value),500,.Value + 500)
End With
End Sub

You can add the IIF to see if it's blank and "initialize" it at 500 (or whatever) if that's you're desire.

Make sure you're looking at the right sheet - this was added in the Sheet1 object code module.
Otherwise, you may need to specify a sheet.
Also, when you're copying them, you need to rename them (by default they are copied with the same name).


text:
Q: Displaying logo in JSP I have been trying to display an image in my JSP file but can't seem to it right. The picture is inside a folder named "img" which is in the same directory as my WEB-INF folder.
Inside my JSP I am trying to show the logo using normal HTML way of finding image but I can't seem to get it right. This is what I have for trying to display it. What I don't get it is when I am in Dreamweaver I see the image displayed but after deploying I no longer there.
I have a structure like servlet (which is root folder and name of my WAR file) and the img and WEB-INF folder are under it.
Folders follow the hierarchy below:

servlet
---->img
     --->psyberAssess.png
---->WEB-INF

This is the code from JSP that is not working:

A: just add the img folder in WEB-INF folder instead of other folder.

A: Images and other resources must be outside the WEB-INF folder, they should be organized in folders in the root path of your web application. This is because the WEB-INF folder and its contents can be accessed only from the application server.
In short, your project should have this structure (the names are just a reference, you can name it as you want/prefer)
Project Name
- webapp
  - resources
    - images
    - js
    - css
  - WEB-INF
    - lib (libraries used on the project go here ALWAYS)

A: Try this with JSTL tag:
<img src="<c:url value="/img/psyberAssess.png"/>" width="450" height="100" border="0" />


text:
Q: For $f(x) = x^4 -x ^2 - 2 = (x^2-2)(x^2+1)$ in $\Bbb Q[x]$, show that $\Bbb Q(\sqrt{2}, i)$ is the splitting field. For $f(x) = x^4 -x ^2 - 2 = (x^2-2)(x^2+1)$ in $\Bbb Q$, show that $\Bbb Q(\sqrt{2}, i)$ is the splitting field.
I can see that the field is $\{a+b\sqrt{2} + i(c+d\sqrt{2}): a,b,c,d \in \Bbb Q\}$ and that $f(x)$ splits in it, but I don't know how to show that it's the smallest field extension that $f(x)$ splits in.
Anyone have any ideas?

A: The splitting field of $f$ is generated over $\Bbb Q$ by the roots $\{±\sqrt 2, i\}$ of $f$. Therefore it is $\Bbb Q(\sqrt 2, i)$.
Indeed, if $f$ splits over $K \supset \Bbb Q$, then every root $r_j$ of $f$ belongs to $K$, so that $\Bbb Q(r_1,\dots,r_n) \subset K$.

A: Maybe the answer is hiding behind the definition of the splitting field of a polynomial $f$. That is, given an extension $\mathbb{L} / \mathbb{K}$ and a polynomial $f \in \mathbb{K}[x]$, $\mathbb{L}$ is a splitting field of $f$, if $\mathbb{L}$ is generated
over $\mathbb{K}$ by the roots $\{α_{1},...,α_{k}\}$ of $f$, in other words, $\mathbb{K}(α_{1},...,α_{k}) = \mathbb{L}$.
If you check the definition of a field after adjoining a number of roots you'll get your answer.


text:
Q: VPS FTP access to Wordpress I've set up a VPS with LEMP on Ubuntu 16.04 and installed Wordpress with this tutorial
How can I setup a FTP account to access my Wordpress files?

A: Create a new user (for FTP access) with its home directory as the web root.
E.g
useradd -m -d /var/www/html USERNAME

That will create a user with the web root as its home directory.
Then you can sort the password out:
passwd USERNAME

And then use an FTP server like vsftpd and it will work when you log in.
You might have to mess with the permissions a bit. E.g adding the user to the web server group and giving the files and folders correct permissions.
https://www.ostechnix.com/install-vsftpd-server-ubuntu-16-04-lts/
For permissions see this
Correct file permissions for WordPress
You might need to tweak the groups etc depending on what you setup.


text:
Q: Multiply element of list with other elements in the same list I want to multiply an element of a list with all other elements.
For example:
def product(a,b,c):
    return (a*b, a*c, a*b*c)

I have done this
def product(*args):
    list = []
    for index,element in enumerate(args):
        for i in args:
            if (args[index]*i) not in list:
                list.append(args[index]*i)
    return list

but this gives me [a*a, a*b,a*c, b*b] etc. I don't want the a*a, b*b, c*c bit in there.

A: itertools is your friend here:
from itertools import combinations
from functools import reduce, partial
from operator import mul

# Make a sum-like function for multiplication; I'd call it product,
# but that overlaps a name in itertools and our own function
multiplyall = partial(reduce, mul)

def product(*args):
    # Loop so you get all two elements combinations, then all three element, etc.
    for n in range(2, len(args) + 1):
        # Get the combinations for the current combo count
        for comb in combinations(args, n):
            # Compute product and yield it
            # yielding comb as well just for illustration
            yield comb, multiplyall(comb)

I made it a generator function, because frankly, almost any function that's just slowly building a list element by element and returning it should really be a generator function (if the caller wants a list, they just do mylist = list(generatorfunc(...))), making it easier to use iteratively without blowing main memory when many arguments are passed.
Example usage:
>>> for pieces, prod in product(2, 3, 4):
        print ' * '.join(map(str, pieces)), '=', prod

Which outputs:
2 * 3 = 6
2 * 4 = 8
3 * 4 = 12
2 * 3 * 4 = 24

A: you could check for equality
if (args[index]*i) not in list and args[index] != i:

A: So if the values are 2, 3, 4, 5 you want all and only these products:
2*3=6, 2*4=8, 2*5=10, 2*3*4=24, 2*3*5=30, 2*4*5=40, 2*3*4*5=120

This means taking all combinations of 3, 4, 5 and then multiplying them togther with 2. The itertools module has a combinations function, and reduce can be used in conjunction with operator.mul to do the calculation:
def product(first, *other):
    for n in range(1, len(other) + 1):
        for m in combinations(other, n):
            yield reduce(mul, m, first)

list(product(2, 3, 4, 5))

Output:
[6, 8, 10, 24, 30, 40, 120]

A: Does your list have duplicate elements, like [2, 3, 4, 2]?
If it does not, here is a one liner:
First, with tags to illustrate the pattern:
a = ['a1','a2','a3']

lsta = [[x+y for y in [z for z in a if z != x]] for x in a]
lsta

[['a1a2', 'a1a3'], ['a2a1', 'a2a3'], ['a3a1', 'a3a2']]

And here, with numbers:
a =[2,3,4,5]

print  [[x*y for y in [z for z in a if z != x]] for x in a]

[[6, 8, 10], [6, 12, 15], [8, 12, 20], [10, 15, 20]]

or the sum of the products, if you wish:
a =[2,3,4,5]

print  [sum([x*y for y in [z for z in a if z != x]]) for x in a]

[24, 33, 40, 45]

If the list has duplicates, it gets more complicated.  Do you want the first occurrence and the second occurrence of 2 in [2,3,4,2] to be separately calculated (you might need that for some purposes even though you will get the same value for both)?


text:
Q: Cypress page objects model - use data-test-id or use React test Library cy.findByText to find page object elements? I am creating a page object for a webpage for a web app that I am testing.  I am using Cypress for my automated tests.
I was thinking about using one of two methods for finding page elements. See my options below:-
Option 1 - get the developers to add data-test-ids to page elements. See example:-**
elements = {
    homePageNavLink: () => cy.get('[data-test-id="home-page"]')
}

clickHomePageLink(vehicleNum) {
     this.elements.homePageNavLink().click();
}

Option 2 - Use the React testing library - @testing-library/cypress. See example:-**
elements = {
    vehicleNumberInput: () => cy.findByText('home')
}

clickHomePageLink(vehicleNum) {
     this.elements.homePageNavLink().click();
}

Are there any benefits of choosing one way over the other?

A: According to Cypress best practices you should use data- attributes for e2e testing.
findByText() method is commonly used for unit testing. If you want to select an element by text with Cypress you can use cy.contains().
Source: https://docs.cypress.io/guides/references/best-practices

A: I did some experimentation I came to the conclusion that if you use the findByText() method and there are two elements on the page with the same text, then Cypress falls over. So its best to use the 'data-testid' if it has been provided


text:
Q: Touch ID Issue with Sandbox Purchases Hi I was wondering if anyone else is having the same issue or has a fix for it.
When i'm trying to make an in app purchase in the sandbox for my app and i try and use touch id, it repeats the touch id alert three times then fails, i've tried using it in apples IAP demo app as well and get the same issue. is this issue only for sandbox mode? or has someone found a way around this?
Thanks in advance!

A:
I'm pretty certain that Touch ID is not supported in the sandbox test environement (sic)"
  - Rich Kubota @ Apple.

https://forums.developer.apple.com/thread/43228
I also see the behaviour you describe, and it has been this way for at least a year or two - it seems that TouchID is only supported by the production environment. I could not find any official documentation to support this however - there is no mention of it in, for example, Apple's In-App Purchase Programming Guide.

A: This is an issue with iOS. If you have a contact with Apple, be sure to bump it.


text:
Q: How to make a game over sequence for tic tac toe when there are no winners? I would like to display a label that says game over when there are no winners. I just thought to make an else statement but once there is one click game over would be display since the elif statements are false. Any ideas.
from tkinter import*

#Window stuff
window = Tk()
window.title("Tic Tac Toe")
window.configure(background = "black")
window.geometry("400x400")

#Variables
global clickable
playerXturn = True
ticker = 0

#Display X or O
def buttonClicked(c) :
    global playerXturn
    if playerXturn == True :
        buttonList[c]["image"] = picX
        buttonList[c]["state"] = DISABLED
        playerXturn = False
        labelTurn ["text"] = "O's turn"

    elif clickable[c] == "" :
        buttonList[c]["image"] = picO
        buttonList[c]["state"] = DISABLED
        playerXturn = True
        labelTurn ["text"] = "X's turn"
#Info for user
    global ticker
    ticker += 1
    if ticker == 500 :
        labelInfo["text"] = "Timed Out"
        labelInfo["bg"] = "red"

#Three in a row
    elif (button1["image"] == str(picX) and button2["image"] == str(picX) and button3["image"] == str(picX) or
          button4["image"] == str(picX) and button5["image"] == str(picX) and button6["image"] == str(picX) or
          button7["image"] == str(picX) and button8["image"] == str(picX) and button9["image"] == str(picX) or
          button1["image"] == str(picX) and button4["image"] == str(picX) and button7["image"] == str(picX) or
          button2["image"] == str(picX) and button5["image"] == str(picX) and button8["image"] == str(picX) or
          button3["image"] == str(picX) and button6["image"] == str(picX) and button9["image"] == str(picX) or
          button1["image"] == str(picX) and button5["image"] == str(picX) and button9["image"] == str(picX) or
          button3["image"] == str(picX) and button5["image"] == str(picX) and button7["image"] == str(picX)) :
        #print ("X")
        labelInfo["text"] = "X Wins"
        labelInfo["bg"] = "red"
        button1["state"] = DISABLED
        button2["state"] = DISABLED
        button3["state"] = DISABLED
        button4["state"] = DISABLED
        button5["state"] = DISABLED
        button6["state"] = DISABLED
        button7["state"] = DISABLED
        button8["state"] = DISABLED
        button9["state"] = DISABLED
        labelTurn ["bg"] = "black"

    elif (button1["image"] == str(picO) and button2["image"] == str(picO) and button3["image"] == str(picO) or
          button4["image"] == str(picO) and button5["image"] == str(picO) and button6["image"] == str(picO) or
          button7["image"] == str(picO) and button8["image"] == str(picO) and button9["image"] == str(picO) or
          button1["image"] == str(picO) and button4["image"] == str(picO) and button7["image"] == str(picO) or
          button2["image"] == str(picO) and button5["image"] == str(picO) and button8["image"] == str(picO) or
          button3["image"] == str(picO) and button6["image"] == str(picO) and button9["image"] == str(picO) or
          button1["image"] == str(picO) and button5["image"] == str(picO) and button9["image"] == str(picO) or
          button3["image"] == str(picO) and button5["image"] == str(picO) and button7["image"] == str(picO)) :
        #print("O")
        labelInfo["text"] = "O Wins"
        labelInfo["bg"] = "red"
        button1["state"] = DISABLED
        button2["state"] = DISABLED
        button3["state"] = DISABLED
        button4["state"] = DISABLED
        button5["state"] = DISABLED
        button6["state"] = DISABLED
        button7["state"] = DISABLED
        button8["state"] = DISABLED
        button9["state"] = DISABLED
        labelTurn ["bg"] = "black"

#Images
picX = PhotoImage (file = "x.gif")
picO = PhotoImage (file = "o.gif")
picBlank = PhotoImage (file = "sw.gif")

#Buttons
button1 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(0))
button1.grid (row = 0, column = 0)
#button1["state"] = DISABLED
button2 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(1))
button2.grid (row = 0, column = 1)
#button2["state"] = DISABLED
button3 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(2))
button3.grid (row = 0, column = 2)
#button3["state"] = DISABLED
button4 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(3))
button4.grid (row = 1, column = 0)
#button4["state"] = DISABLED
button5 = Button (window, text = "", image = picBlank,  command = lambda: buttonClicked(4))
button5.grid (row = 1, column = 1)
#button5["state"] = DISABLED
button6 = Button (window, text = "", image = picBlank,  command = lambda: buttonClicked(5))
button6.grid (row= 1, column = 2)
#button6["state"] = DISABLED
button7 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(6))
button7.grid (row = 2, column = 0)
#button7["state"] = DISABLED
button8 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(7))
button8.grid (row = 2, column = 1)
#button8["state"] = DISABLED
button9 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(8))
button9.grid (row = 2, column = 2)
#button9["state"] = DISABLED

#Lists
buttonList = [button1, button2, button3, button4, button5, button6, button7, button8, button9]
clickable = ["", "", "", "", "", "", "", "", ""]

#Reset
def processReset():
    button1["state"] = NORMAL
    button2["state"] = NORMAL
    button3["state"] = NORMAL
    button4["state"] = NORMAL
    button5["state"] = NORMAL
    button6["state"] = NORMAL
    button7["state"] = NORMAL
    button8["state"] = NORMAL
    button9["state"] = NORMAL
    button1["image"] = picBlank
    button2["image"] = picBlank
    button3["image"] = picBlank
    button4["image"] = picBlank
    button5["image"] = picBlank
    button6["image"] = picBlank
    button7["image"] = picBlank
    button8["image"] = picBlank
    button9["image"] = picBlank
    labelTurn["bg"] = "white"
    labelInfo["text"] = "Continue Playing"
    labelInfo["bg"] = "white"

#Extra labels and buttons
labelMenu = Label (window, text = "Menu and Info", height = 2, width = 24, bg = "yellow")
labelMenu.grid (row = 4, column = 4)
labelTurn = Label (window, text = "X goes first", height = 2, width = 10)
labelTurn.grid (row = 6, column = 4)
labelInfo = Label (window, text = "Continue Playing", height = 2, width = 14)
labelInfo.grid (row = 5, column = 4)
buttonReset = Button(window, text = "Reset/New Game", bg = "Orange", command = processReset)
buttonReset.grid (row = 7, column = 4)
labelNote = Label (window, text = "Note: Losing player goes first next game", bg = "Pink")
labelNote.grid (row = 8, column = 4)
window.mainloop()

A: You want an elif statement at the end of your else-if chain that checks whether there's any empty spaces left. If there's no spaces left, and a winner wasn't declared by one of the statements before this one, it's necessarily a tie.
Something like:
elif (check that no empty board spaces remain) :
#print("-")
labelInfo["text"] = "It's a tie!"


text:
Q: Make a `` width equal to its children `` I have a
 that I would like to have a width that contains its children .
Unfortunately, I can only assign classes to the  columns, and not the  columns - so I can't use table-layout: fixed as I usually would. w3 spec on table-layout: http://www.w3.org/TR/CSS2/tables.html#width-layout
Do you know how to make a
 width equal to its children ?
HTML

                First

                Last

                Info

                Join Date

                Don

                P

                Here is some rando info that can vary in length. I talk a lot.

                2013-03-01

                Tom

                Smith

                I'm a quiet person.

                2013-04-22

CSS
table {
    table-layout: fixed;
}

.first, .last, .join-date {
    width: 250px;
}

.info {
    min-width: 400px;
    width: 200%; /* so this column will expand */
}

A: If the content is fixed, assign manual width to the  of just the 1st .
The table will then adjust according to the width that you specify.
Eg :


text:
Q: Sinatra matches params[:id] as string type, additional conversion needed to match the database id? I am using sinatra and DataMapper to access an sqlite3 database. I always get an nil when calling get(params[:id]). But when I call get(params[:id].to_i) I can get the right record. Is there anything wrong such that I have to do the conversion explicitly?
The sinatra app is simple:
class Record
  include DataMapper::Resource
  property :id, Serial
  ....
end

get '/list/:id' do
  r = Record.get(params[:id])
  ...
end

A: Obviously this is a problem with Datamapper (if you believe it should be casting strings to numbers for id's), but there are ways Sinatra can mitigate it. When params come in you need to check:

*

*They exist.

*They're the right type (or castable).

*They're within the range of values required or expected.

For example:
get '/list/:id' do
  r = Record.get(params[:id].to_i)
  # more code…

curl http://example.org/list/ddd

That won't work well, better to check and return an error message:
get '/list/:id' do |id| # the block syntax is helpful here
  halt 400, "Supply an I.D. *number*" unless id =~ /\d+/

Then consider whether you want a default value, whether the value is in the right range etc. When taking in ID's I tend to use the regex syntax for routes, as it stops following sub routes being gobbled up too, while providing a bit of easy type checking:
get %r{/list/(\d+)} do |id|

Helpers are also useful in this situation:
helpers do
  # it's not required to take an argument,
  # the params helper is accessible inside other helpers
  # it's but easier to test, and (perhaps) philosophically better.
  def id( ps )
    if ps[:id]
      ps[:id].to_i
    else
      # raise an error, halt, or redirect, or whatever!
    end
  end
end

get '/list/:id' do
  r = Record.get id(params)

A: To clarify, the comment in the original question by @mbj is correct. This is a bug in dm-core with Ruby 2.0. It worked fine with ruby 1.9. You are likely on dm-core version 1.2 and need 1.2.1, which you can get by running 'gem update dm-core'.


text:
Q: Java- redirecting input stream How do I redirect the input stream for a program so that it will run from the console as main > myProgram with no filename specified within the code? This is what I have so far.
public static void main (String[ ] args) throws IOException {
    BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
    while(in.next != null){
        in.read();
    }
}

I know it's going to be something to do with System.setIn but I have no clue as to how to write it so that it will detect a filename after Main > is typed.

A: Use standard System.in and System.out streams.

A: In order to redirect the streams, it is the methods of the System class: setIn(), setOut(), setErr() , which will help.
now in order to redirect the stream you have to redirect it to the specific file type.
For instance if want to redirect the output stream, then you need to use the setOut(). the setOut() takes an object of print stream and print stream has a parameterized constructor which takes string, you will be providing the path in that manner.
here's the program which is linked to a test file.
whenever you call the println() method on it, the stream will redirect it to the test file instead of the output console in this case.
import java.io.FileNotFoundException;
import java.io.PrintStream;

public class Redirect1 {

    public static void main(String[] args)throws FileNotFoundException {
        System.setOut(new PrintStream("C:\\Users\\nEW u\\Desktop\\Test.txt"));

        System.out.println("Hello");
    }

}

And here is the program for the input stream:
import java.io.*;
import java.lang.System;

public class Redirect {

    public static void main(String[] args)throws IOException {
        System.setIn(new FileInputStream("C:\\Users\\nEW u\\Desktop\\dev.txt"));
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String s="";
        while((s=br.readLine())!=null)
        System.out.println(s);
    }

}