text:
Q: How to lookup an EJB with appclient -client? (NamingException) Tried more than a few ways of looking up this EJB through appclient without success.
stacktrace for JNDI lookup failure:
thufir@dur:~/NetBeansProjects/ejbClient$
thufir@dur:~/NetBeansProjects/ejbClient$ gradle clean shadowJar
> Task :shadowJar
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle 5.0. Please use WorkResults.didWork() instead.

BUILD SUCCESSFUL in 0s
4 actionable tasks: 4 executed
thufir@dur:~/NetBeansProjects/ejbClient$
thufir@dur:~/NetBeansProjects/ejbClient$ appclient -client build/libs/ejbClient.jar Nov 06, 2017 5:13:34 PM net.bounceme.dur.ejb.client.App main
SEVERE: null
javax.naming.NamingException: Lookup failed for 'java:global/EJBModule1/FooBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacenet.bounceme.dur.ejb.NewSessionBeanRemote [Root exception is java.lang.ClassNotFoundException: net.bounceme.dur.ejb.NewSessionBeanRemote]]
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at net.bounceme.dur.ejb.client.App.run(App.java:19)
    at net.bounceme.dur.ejb.client.App.main(App.java:24)
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacenet.bounceme.dur.ejb.NewSessionBeanRemote [Root exception is java.lang.ClassNotFoundException: net.bounceme.dur.ejb.NewSessionBeanRemote]
    at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:433)
    at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:527)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:487)
    ... 4 more
Caused by: java.lang.ClassNotFoundException: net.bounceme.dur.ejb.NewSessionBeanRemote
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:237)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:685)
    at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:462)
    at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:413)
    ... 8 more

thufir@dur:~/NetBeansProjects/ejbClient$

clean, build and deploy from Netbeans default ant:
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$ asadmin list-applications
Nothing to list.
No applications are deployed to this target server.
Command list-applications executed successfully.
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$ ant -p
Buildfile: /home/thufir/NetBeansProjects/EJBModule1/build.xml
Builds, tests, and runs the project EJBModule1.
Main targets:

 -profile-pre72         Profile a J2EE project in the IDE.
 clean                  Clean build products.
 compile                Compile project.
 debug                  Debug project in IDE.
 default                Build whole project.
 dist                   Build distribution (JAR).
 dist-directory-deploy  Build distribution (JAR) - if directory deployment is not supported.
 dist-ear               Build distribution (JAR) to be packaged into an EAR.
 javadoc                Build Javadoc.
 profile                Profile a J2EE project in the IDE.
 run                    Deploy to server.
 test                   Run unit tests.
 test-single            Run single unit test.
 test-single-method     Run single unit test.
Default target: default
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$ ant clean run
Buildfile: /home/thufir/NetBeansProjects/EJBModule1/build.xml

-pre-init:

-init-private:

-init-userdir:

-init-user:

-init-project:

-init-macrodef-property:

-do-init:

-post-init:

-init-check:

-init-ap-cmdline-properties:

-init-macrodef-javac-with-processors:

-init-macrodef-javac-without-processors:

-init-macrodef-javac:

-init-macrodef-test-impl:

-init-macrodef-junit-init:

-init-macrodef-junit-single:

-init-test-properties:

-init-macrodef-junit-batch:

-init-macrodef-junit:

-init-macrodef-junit-impl:

-init-macrodef-testng:

-init-macrodef-testng-impl:

-init-macrodef-test:

-init-macrodef-junit-debug:

-init-macrodef-junit-debug-batch:

-init-macrodef-junit-debug-impl:

-init-macrodef-test-debug-junit:

-init-macrodef-testng-debug:

-init-macrodef-testng-debug-impl:

-init-macrodef-test-debug-testng:

-init-macrodef-test-debug:

-init-macrodef-java:

-init-debug-args:

-init-macrodef-nbjpda:

-init-macrodef-debug:

-init-taskdefs:

-init-ap-cmdline-supported:

-init-ap-cmdline:

init:

undeploy-clean:

deps-clean:

-do-clean:
   [delete] Deleting directory /home/thufir/NetBeansProjects/EJBModule1/build
   [delete] Deleting directory /home/thufir/NetBeansProjects/EJBModule1/dist

-post-clean:

clean:

-pre-init:

-init-private:

-init-userdir:

-init-user:

-init-project:

-init-macrodef-property:

-do-init:

-post-init:

-init-check:

-init-ap-cmdline-properties:

-init-macrodef-javac-with-processors:

-init-macrodef-javac-without-processors:

-init-macrodef-javac:

-init-macrodef-test-impl:

-init-macrodef-junit-init:

-init-macrodef-junit-single:

-init-test-properties:

-init-macrodef-junit-batch:

-init-macrodef-junit:

-init-macrodef-junit-impl:

-init-macrodef-testng:

-init-macrodef-testng-impl:

-init-macrodef-test:

-init-macrodef-junit-debug:

-init-macrodef-junit-debug-batch:

-init-macrodef-junit-debug-impl:

-init-macrodef-test-debug-junit:

-init-macrodef-testng-debug:

-init-macrodef-testng-debug-impl:

-init-macrodef-test-debug-testng:

-init-macrodef-test-debug:

-init-macrodef-java:

-init-debug-args:

-init-macrodef-nbjpda:

-init-macrodef-debug:

-init-taskdefs:

-init-ap-cmdline-supported:

-init-ap-cmdline:

init:

-init-cos:

-init-deploy:

-deps-module-jar:

-deps-ear-jar:

deps-jar:

-pre-pre-compile:
    [mkdir] Created dir: /home/thufir/NetBeansProjects/EJBModule1/build/classes

-pre-compile:

-copy-meta-inf:
     [copy] Copying 1 file to /home/thufir/NetBeansProjects/EJBModule1/build/classes/META-INF

-do-compile:
    [mkdir] Created dir: /home/thufir/NetBeansProjects/EJBModule1/build/empty
    [mkdir] Created dir: /home/thufir/NetBeansProjects/EJBModule1/build/generated-sources/ap-source-output
    [javac] Compiling 2 source files to /home/thufir/NetBeansProjects/EJBModule1/build/classes

-post-compile:

compile:

-library-inclusion-in-archive-weblogic:

-library-inclusion-in-archive-by-user:

library-inclusion-in-archive:

-pre-dist:

-do-tmp-dist-without-manifest:

-do-tmp-dist-with-manifest:
    [mkdir] Created dir: /home/thufir/NetBeansProjects/EJBModule1/dist
      [jar] Building jar: /home/thufir/NetBeansProjects/EJBModule1/dist/EJBModule1.jar

-do-dist-directory-deploy:

-post-dist:

dist-directory-deploy:

pre-run-deploy:

-pre-nbmodule-run-deploy:

-run-deploy-nb:

-init-deploy-ant:

-init-cl-deployment-env:

-parse-glassfish-web:

-parse-sun-web:

-no-parse-sun-web:

-add-resources:

-deploy-ant:

-deploy-without-pw:
     [echo] Deploying dist/EJBModule1.jar
      [get] Getting: http://localhost:4848/__asadmin/deploy?path=/home/thufir/NetBeansProjects/EJBModule1/dist/EJBModule1.jar&force=true&name=EJBModule1
      [get] To: /tmp/gfv31064357726
   [delete] Deleting: /tmp/gfv31064357726

-deploy-with-pw:

-run-deploy-am:

-post-nbmodule-run-deploy:

post-run-deploy:

-do-update-breakpoints:

run-deploy:

run:

BUILD SUCCESSFUL
Total time: 1 second
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$ asadmin list-applications
EJBModule1  <ejb>
Command list-applications executed successfully.
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$
thufir@dur:~/NetBeansProjects/EJBModule1$

glassfish log:
[2017-11-06T16:40:44.695-0800] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244695] [levelValue: 800] [[
  visiting unvisited references]]

[2017-11-06T16:40:44.699-0800] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244699] [levelValue: 800] [[
  visiting unvisited references]]

[2017-11-06T16:40:44.746-0800] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244746] [levelValue: 800] [[
  Portable JNDI names for EJB FooBean: [java:global/EJBModule1/FooBean!net.bounceme.dur.ejb.NewSessionBeanRemote, java:global/EJBModule1/FooBean]]]

[2017-11-06T16:40:44.746-0800] [glassfish 4.1] [INFO] [AS-EJB-00055] [javax.enterprise.ejb.container] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244746] [levelValue: 800] [[
  Glassfish-specific (Non-portable) JNDI names for EJB FooBean: [ejb/FooBean, ejb/FooBean#net.bounceme.dur.ejb.NewSessionBeanRemote]]]

[2017-11-06T16:40:44.797-0800] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244797] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2017-11-06T16:40:44.800-0800] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244800] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2017-11-06T16:40:44.803-0800] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015244803] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2017-11-06T16:40:45.010-0800] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=43 _ThreadName=admin-listener(2)] [timeMillis: 1510015245010] [levelValue: 800] [[
  EJBModule1 was successfully deployed in 321 milliseconds.]]

^C
thufir@dur:~$
thufir@dur:~$ tail -f GlassFish_Server/glassfish/domains/dur/logs/server.log

Is that not how to lookup the EJB?  Client code:
package net.bounceme.dur.ejb.client;

import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.Name;
import javax.naming.NamingException;

public class App {

    private static final Logger log = Logger.getLogger(App.class.getName());

    public void run() throws NamingException {
        log.fine("looking up jndi");
        Context context = null;
        context = new InitialContext();
        context.lookup("java:global/EJBModule1/FooBean");
    }

    public static void main(String[] args) {
        try {
            new App().run();
        } catch (NamingException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

A: Seems that your code is ok, but you need bean interfaces and parameters and returned objects in client classpath too.
Modify this line:
context.lookup("java:global/EJBModule1/FooBean");

To:
NewSessionBeanRemote bean = (NewSessionBeanRemote) context.lookup("java:global/EJBModule1/FooBean");

And resolve classpath problems. It will work.


text:
Q: Matlab incorrect sum value In Matlab, I have a vector res of size 1*10.
Also, I have this code:
disp("Matrix:");
disp(res);
disp("Size:");
disp(size(res));
disp("Sum of elements:");
disp(sum(res));

Which outputs:
Matrix:
   1.0e+05 *

    1.9183    1.6247    1.5875    1.6979    1.3663    1.6511    1.5198    1.3014    1.2067    1.3661

Size:
     1    10

Sum of elements:
   1.5240e+06

1. What is 1.0e+05 *?
2. How can the sum of 1.9183    1.6247    1.5875    1.6979    1.3663    1.6511    1.5198    1.3014    1.2067    1.3661 be 1.5240e+06?
What I did so far:
I tried to see if there is a name conflict with whos ('res') but no other variable with the same name is in context.
I also tried to eliminate other sum name in context with clear sum but still I get the same result.

A: The Following notation:
Matrix:
1.0e+05 *

1.9183    1.6247    1.5875    1.6979    1.3663    1.6511    1.5198    1.3014    1.2067

means:
 Matrix:
191830    162470    158750    169790    136630    165110    151980    130140    120670

it is a scientific notation to show the result in a standard format. Therefore, the problem of summing is solved by this description.

redpajama_set_name: RedPajamaStackExchange


text:
Q: File invisible to many software I installed the RSAT tools to try to mange some certificates via the standard CA library certadm.dll.
The dll is showing in C:\Windows\System32 in the windows explorer

But is invisible in other programs like in everything

or, more importantly for my use, in Visual Studio 2019 :

Why is it showing this behavior, and what can I do to make it reapear ?

A: As a workaround, have you ever tried to select the file by copying the file's path, and then appending the file's name?

eg. pasting this into the "file name" part of the popup asking for file selection:
  C:\Windows\System32\certadm.dll

Furthermore, I might be very stupid even bothering to suggest this, but have you ever checked while the file was hidden?
File > Properties > Attributes > Hidden


text:
Q: Pass object using JSON right now i am using Json for passing status and message like
return Json(new { Success = true, Message = "Save successfully" });

 Project model=new Project()

Is there any way, i can send model in json also?
I am using c# and asp.net mvc

A: Yes - it is very easy. The Json method accepts any object:
return Json(new Project());


text:
Q: How can I test if Tomcat has SSL support enabled? I have a problem: I'm configuring a Tomcat server to serve a webservice through HTTPS, and it isn't working.
If I go to the 38080 port, the service is working perfectly, but if I go to the 8443 port (using the https prefix), the browser shows me an error message (The page can't be shown).
The server is a Windows 2008 R2, Tomcat is 6.0.35 and Java is 1.6.0_29.
The SSL content of the server.xml file is:
<Connector port="8443" SSLEnabled="true" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" scheme="https" secure="true" keyAlias="server"
           keystoreFile="${catalina.base}\conf\test-keystore.jks"
           keypass="patata"
           clientAuth="false" sslProtocol="TLS" />

The file test-keystore.jks is a self-generated keystore, based on the documentation at https://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html. The order used was: keytool -genkey -alias tomcat -keyalg RSA -keystore test-keystore.jks.
Anyone knows what I'm doing wrong, and how to solve this problem?
MORE INFORMATION
The logs doesn't show any error. Neither stdout or the ${catalina.base}/logs/manager-{date}.log or the ${catalina.base}/logs/localhost-{date}.log

A: FIXED!
The problem was with the configuration. The keyAlias parameter is incorrect, it should be keyAlias="tomcat" and not keyAlias="server".


text:
Q: Use credentials from terraformrc file in modules I have a terraformrc file setup as described here. It contains a gitlab token and is used to fetch a terraform module from an on-prem gitlab instance. However, I also need this token inside my actual terraform module for the gitlab provider.
At the moment I have said terraformrc file and in addition I add the access token as command line argument to use it inside my terraform modules. It seems odd to manage a token at two different location: Is it possible to reference the content of the terraformrc file within my project?

A: The credentials in the CLI Configuration (the "terraformrc" file is an example of a "CLI Configuration" file) are only for Terraform-native Services, as described in Internals: Remote Service Discovery.
GitLab has an implementation of the module registry protocol, which is one of the Terraform-native Services and so the credentials in your CLI configuration apply to those requests.
However, the credentials in the CLI configuration don't apply to any protocols that are not "Terraform-native", which is to say protocols that are defined by some other system outside of Terraform. That includes the GitLab provider, because that provider implement's GitLab's own API, which has its own authentication scheme, separate from the Terraform-native one.
Therefore you will need to configure these two separately, even though by coincidence they may happen to accept the same token because both of these distinct protocols are implemented by the same remote server. There is no way to automatically use a Terraform-specific credential to authenticate to a non-Terraform protocol. The GitLab provider documentation describes some different ways you can configure credentials for that provider to use.


text:
Q: D3.js: Treemap doesn't load from JSON file I am trying to run this very example of a treemap on localhost, but I can't load the JSON file (which, by the way, is the same JSON file that the example uses).
The console returns the next error in Google Chrome:
XMLHttpRequest cannot load file:///C:/Users/Usuario/Downloads/d3/flare.json. Cross origin requests are only supported for HTTP.

The JSON file is in the same folder as the html file.
Thanks in advance for your help.

A: You cannot load local files because of the security policy. To quote the D3 website:

When developing locally, note that your browser may enforce strict permissions for reading files out of the local file system. If you use d3.xhr locally (including d3.json et al.), you must have a local web server. For example, you can run Python's built-in server:
python -m SimpleHTTPServer 8888 &
or for Python 3+
python -m http.server 8888 &
Once this is running, go to http://127.0.0.1:8888/.

A: If people working d3.js on the xampp or wamp they can run their html file as like php file by starting the server.
I found the same issue then I started the wampp server then the file get loaded successfully without any issue like "XmlHttpRequest Access control allow orgin".
I am working in WAMP.  I hope same thing for XAMPP,  but I am not sure...


text:
Q: Terminal doesn't end process after using rails g model command I recently find sometimes when I use rails command in terminal, it won't end the process itself:
blog (master) $ rails g model Article title:string text:text
Running via Spring preloader in process 33892
      invoke  active_record
      create    db/migrate/20161029085205_create_articles.rb
      create    app/models/article.rb
      invoke    test_unit
      create      test/models/article_test.rb
      create      test/fixtures/articles.yml

and I have to manually close it with cmd + c:
blog (master) $ rails g model Article title:string text:text
Running via Spring preloader in process 33892
      invoke  active_record
      create    db/migrate/20161029085205_create_articles.rb
      create    app/models/article.rb
      invoke    test_unit
      create      test/models/article_test.rb
      create      test/fixtures/articles.yml
^Cblog (master) $

It was fine before I updated MacOS to Sierra, but I'm not sure if that's the cause.
I followed all the step from http://railsapps.github.io/ to install rvm, rails, etc. All I did additionally was to change my bash_profile to this:
export PATH="/usr/local/sbin:$PATH"
export PATH="$PATH:$HOME/.rvm/bin"
source /Users/xiaohuli/.rvm/scripts/rvm

Does anyone have the same problem like mine? Why this is happening?


text:
Q: how to Pdf rendering in android application I've hard time trying to do pdf rendering (viewing pdf content, copying/pasting text, copying image etc.) but i didn't get any open source api for this.
Can anybody share his experiences in this concern.
Any kind of help would be highly appreciated.
Thanks in advance.

A: You can use an intent to allow the pdf to be viewed in some external application. An example can be seen here.


text:
Q: Integral of $(1+\cos(t))^n$ from $-\pi$ to $\pi$ Using an integration solver (Mathematica), I've gotten the following result
$$\int_{-\pi }^{\pi } (1+\cos (t))^n \, {\rm d}t = 2^{1-n} \pi \binom{2 n}{n}$$
Any suggestion on how to prove this would be appreciated. I'm not sure how the binomial coefficient gets introduced, my best guess is to use some properties of the gamma function although in not sure which. I'm also familiar with the basics of contour integration but not sure if that can be applied here. Also, if anyone knows a source for this integral that would be appreciated.

A: Let $u=t/2$ so $1+\cos t=2\cos^2u$. Since the integrand is even, the integral is$$a_n:=2^{n+2}\int_0^{\pi/2}\cos^{2n}udu=2^{n+1}\operatorname{B}(n+\tfrac12,\,\tfrac12)=\frac{2^{n+1}\sqrt{\pi}}{n!}\Gamma(n+\tfrac12).$$Since $a_0=2\pi,\,\frac{a_{n+1}}{a_n}=\frac{2n+1}{n+1}$, you can prove your conjecture by induction.

A: This is not a complete answer yet, but i got this far, maybe this helps you to get to a correct solution. As mentioned in the comments, something is wrong with yours.:
According to Wikipedia it holds for even $n$:
$$ \int_{-\pi}^\pi \cos(t)^n dt = \frac{2\pi}{2^n}\binom{n}{\frac n 2}.$$
This is rather a standard integral and probably could be proven with the recursion formula for cosine integrals. For odd $n$ the above integral is obviously equal to zero. We thus get by the binomial theorem:
\begin{align}
 \int_{-\pi}^\pi (1 + \cos(t))^n dt &= \sum_{i = 0}^n \binom{n}{i}\int_{-\pi}^\pi \cos(t)^n dt \\
&=\sum_{i = 0}^{\left\lfloor \frac n 2 \right\rfloor} \binom{n}{2i}\frac{2\pi}{2^{2i}} \binom{2i}{i} \\
&= 2\pi \sum_{i = 0}^{\left\lfloor \frac n 2 \right\rfloor}\frac{1}{4^i}\binom{n}{2i}\binom{2i}{i}.
\end{align}
Maybe the sum could be simplified further.

A: Put first $\;t=x-\pi\implies dt=dx\;$ so your integral becomes
$$I:=\int_0^{2\pi}\left(1-\cos x\right)^ndx$$
Now the complex substitution: $\;z=e^{ix}\implies dx=-\frac izdz\;$ ,and $\;\cos x=\frac12\left(z+\frac1z\right)=\frac{z^2+1}{2z}\;$ , so we get
$$I=-i\oint_{S^1\iff|z|=1}\left(1-\frac{z^2+1}{2z}\right)^n\frac1z\,dz=-\frac i{2^n}\oint_{S^1}\frac{(z-1)^{2n}}{z^{n+1}}\,dz$$
That function has a pole or order $\;n+1\;$ at $\;z=0\;$ , and its residue there is
$$\left.\frac1{n!}\frac d{dz^n}\left((z-1)^{2n}\right)\right|_{z=0}=\frac1{n!}\cdot2n\cdot(2n-1)\cdot\ldots\cdot(n+1)=\binom{2n}n$$
so we finally (Cauchy Theorem of Residues for complex integrals)
$$I=-\frac i{2^n}2\pi i\binom{2n}n=\frac\pi{2^{n-1}}\binom{2n}n$$


text:
Q: Usage of "Full stop. Fresh line" phrase instead of "full stop" or "period" In Malta, there's a phrase "full stop. Fresh line" (or "full stop, fresh line") that seems to be in use by some speakers. It is equivalent to the British English "full stop" or the American English "period".
Curiously, I've never heard it used by British or American speakers of English, and a quick Google search shows nothing but Maltese sources, but I am curious whether this phrase is actually used in certain parts of the UK/USA (even if informally), or whether it is found in some other forms of English.

A: A friend of mine worked at one of the British national newspapers in Fleet Street, London, during the 1970s. His job was in the 'copy' office, and he gave me a guided tour one evening.
A reporter would use a public telephone to call the copy office to dictate his story.
The reporter spoke to a person who typed the story using a typewriter, and 'full stop' was used to mark the end of a sentence, and 'fresh line' was for a new line.
There are some videos on youtube of documentaries made around this time, although I couldn't find one that used the exact phrase. Have a look at Thames TV documentary "Working for a newspaper 1977" for an example of 'copy' being taken, where the reporter reads out 'apostrophe' and digits for clarity.
With laptops and mobile phones, this practice ceased. I have not heard this phrase being used anywhere else.
I can imagine though it being used to add importance to a subject, perhaps preceding it with "Hold the Front Page!".


text:
Q: Не могу считать текстовый файл, вместо русских сиволов пишет вопросики Пишу программу на Java, которая считывает текстовый файл побайтово и отправляет серверу, сервер принимает побайтово и конвертирует в текст, выводя на консоль.
Но на этапе считывания файла он не может писать русские символы. Знаю, что проблема в кодировке, но уже всю голову сломал, не знаю куда копать. Кто может с этим подсказать?)

A: Да, проблема в кодировке, когда читаешь поток байтов и конвертируешь в строку(текст) надо явно задавать кодировку и тоже самое при отправке. Если не задавать явно, то используется кодировка по дефолту.
Пример:
String test = "Тест Тест Hello World! @";
InputStream stream  = new ByteArrayInputStream(test.getBytes(StandardCharsets.UTF_8));

BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));

while(reader.ready()){
    System.out.println(reader.readLine());
}


text:
Q: Retrieving mysql data on to one php page from multiple tables I am a student still new to php and mysql,i am developing a website which is database driven. It has two pages i.e index.php and subpage.php.
On the index page there appears 14 links namely about_us,projects,services,partners and among others. And for the case of the subpage.php, it has "a blank body",the header, navigation and the footer.
My goal is to not to create pages for every link that appears on the index.php. So i want to use only the "blank body" in the subpage.php to display the data for every link that is on the index.php whenever it is clicked on.
In my struggle to achieve this, i have created a database with 14 tables so that each should cater for every link on the index.php.
So I would like you guys to help me how i can RETRIEVE DATA FROM THE DATABASE FROM DIFFERENT TABLES ON TO THE SUBPAGE.PHP
Forexample;
If am am on the index.php and i click about_us, it should ONLY retrieve data from the table called about us in the database.
And if i click another link it should on retrieve data specifically for that link i have clicked on.
Here is the sample php codes that am using to retrieve data for only projects_table onto the subpage.php
<?php
require_once("connection.php");
?>

<?php
mysql_select_db("cognative_db",$sql);
$sql="SELECT * FROM projects_table ";
$result=mysql_query($sql);

while($row=mysql_fetch_array($result)){
?>

<?php echo $row['project_title'];?>

<?php echo $row['project_details'];?>
 <?php echo " ";?>

<?php
}
?>
<?php
mysql_close();
?>

Any help will be highly appreciated

A: I don't know why for every link you made the table. But just for displaying multiple table data, you can pass table name in query string as:
Click

// and on subpage.php retrieve it by get method as:

$table=$_GET['q'];

//and make your sql query
$sql="SELECT * FROM $table";

A: I can't agree with your database design concepts. But to  problem of having one page for all links , one way can be - you can create links like this
http://yoursite/subpage.php?page=content
http://yoursite/subpage.php?page=aboutus

On your subpage.php
$page= $_GET['page'];

depending upon the value of $page you can choose which query to run and what to display in the page.
To add to all these, you don't need to have 14 tables to cater 14 links. Perhaps you can start looking at Joins

A: simply create simple table structure for your website,like below one instead of assigning one menu one table
     |id    | menu      | content   |
     |1     | about_us  | asds....  |
     |2     | services  | asds....  |


text:
Q: Get Object Instantiation and Access Its Related Attributes and Methods with AspectJ Can we get an object created or instantiated using AspectJ and access object's attributes and methods? I know with AspectJ we can get input parameters of the methods but will it be the same with the object creation?
For example, in the code it has this line
testing test = new testing();

And I would like to get the test object using AspectJ and access the method and variables of class testing(), like method aa().
Here is the code for testing class.
package testMaven;

public class testing {

    public int dd;

    public int getDd() {
        return dd;
    }

    public void setDd(int dd) {
        this.dd = dd;
    }

    public void aa(int a){
        System.out.println(a);
    }
}

Real Coding Problem
The above coding is only merely an example of the abstract problem I currently have the problem. Thanks to the answer below, it works in this example, but in the real project that I have it is not working. Basically the code as follow:
@After("execution(de.hpi.cloudraid.dto.control.storedObjectService.CreateFileFinalResponseDto.new(..))")
    public void constructorInvocation(JoinPoint joinPoint) throws Throwable {
        CreateFileFinalResponseDto instance = (CreateFileFinalResponseDto) joinPoint.getTarget();
        System.err.println("testing new object creation");
        System.err.println("id upload = " + instance.getFileObjectID());

    }

But the code is not working as it gives the warning of advice has not been applied (xlint : adviceDidNotMatch). CreateFileFinalResponseDto class is basically from different project called shared and I already include the shared project in the pom.xml and AspectJ dependencies and plugin as follow:
   <dependencies>
            <!-- Project -->
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>shared</artifactId>
                <version>${project.server.version}</version>
            </dependency>
    ...
    <!-- AspectJ -->
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjtools</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
...

     <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.8</version>
                <configuration>
                    <complianceLevel>${java.version}</complianceLevel>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <showWeaveInfo>true</showWeaveInfo>
                </configuration>
                <executions>
                    <execution>
                        <id>AspectJ-Classes</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>AspectJ-Test-Classes</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjrt</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

Any help is appreciated. Thanks

A: To catch class instantiate one could use the following aspect:
@Aspect
public class Interceptor {
    /**
     * Matches constructor testMaven.testing.
     * <p/>
     * *NOTE:* This will only work when class compiled with aspectj.
     */
    @After("execution(* testMaven.testing.new(..))")
    public void constructorInvocation(JoinPoint joinPoint)
            throws Throwable {
        testing instance = (testing) joinPoint.getTarget();
        instance.aa(2);
    }
}

In case you want to catch the instantiate Before there won't be a instance of course.


text:
Q: Reason to use anything other than RecId as a clustered index Is there any reason to use an index other than RecId (SurrogateKey in AX2012) as the clustered index?
Confirmed by a quick Google search (*), one should consider at least 4 criteria when deciding on clustered indexes:

*

*Index must be unique.

*Index must be narrow (As few fields as possible - since these would be copied to every other index).

*Index must be static (As updating the index field value(s) will cause SQL server to physically move the record to a new location)

*Index must be ordered (Ascending / Descending).

RecId adheres to all of the above, in a better way than any index you can create yourself. Any index you create yourself will violate at least the 2nd and/or the 4th, since it would automatically include DataAreaId.
What I think...
Could it be that the option to set this is just a legacy property from AX3.0 or lower, and that its use could be deprecated now?
*TechNet SQL Server Index Design Guide and Effective Clustered Indexes

A: While RecId is a good choice, you can make a shorter key on say an int on a global table (SaveDataPerCompany = No).
Access patterns matters, if you often access your customers by account number, you might as well store the records in that order.
Also, if you only have one index as is often the case for group and parameter tables, you are not punished for having a longer key, it will need storage somewhere anyway.
See also What do Clustered and Non clustered index actually mean?


text:
Q: Connect SFTP in Dolphin with keyfile and passphrase and nonstandard port I am not finding an option to enter the keyfile when adding a network folder in Dolphin.
The "Add Network Folder" type is SSH. Dolphin allows me to enter a username, a server IP address, a port, the protocol (which is SFTP), and a folder. But Dolphin does not allow me to specify the SSH key. BTW, the SSH key requires a passphrase.
Can I make Dolphin work with an SSH key that requires a passphrase?

A: You should be able to add a custom host entry in your ~/.ssh/config file, specifying the port, key file, and domain to use. Something like this, modified to have the values you need:

Host specialport
  HostName real.domain.com
  Port 50000
  IdentityFile ~/.ssh/special-key_rsa.1

You can make the specialport value in there be whatever you want. Once you place that in the ssh config file, you can use that value as the hostname to connect to in Dolphin, like sftp://specialport/home/ (if that is the URL scheme that Dolphin uses these days).


text:
Q: on option item is selected EDIT:
I forgot http:// on the links. This is not my problem. I'll fix the question...
i have some options, like this:
<select class="mySelect">
    <option value="http://www.url1.com">Url 1</option> <!--Default displayed--->
    <option value="http://www.url2.com">Url 2</option>
    <option value="http://www.url3.com">Url 3</option>
</select>

To this i have a jquery listener, looks like this:
$('.mySelect').change(function(){
    window.location.replace($(this).val());
});

Since this just responds to a change made, i can't be redirected to "www.url1.com". What should i use? I only get suggestions for change on google.
EDIT 2: I've got a bunch of solutions on using a dummy as first option. I also got the other solution of using a button to read the selected option and then redirect, but that's not usable in the project i'm working on, even if these are really good solutions otherwise.
In this case, i want it to listen for usage, even if the change is made to itself, like i'm selecting the first option (that's selected by default) i want it to do something with it - In the case above a redirect. I'll leave it open if someone have a good solution to this problem.

A: Try putting in an empty valued first option:
<select class="mySelect">
    <option value="">Please select...</option>
    <option value="http://www.url1.com">Url 1</option>
    <option value="http://www.url2.com">Url 2</option>
    <option value="http://www.url3.com">Url 3</option>
</select>

You can then amend your jQuery to make sure there is a value before redirecting:
$('.mySelect').change(function(){
    var value = $(this).val();
    if (value != "") {
       window.location.replace(value);
    }
});

Example fiddle
Note also that http:// (or whichever protocol you're using) is required on the link values.

Updated
If you would prefer to not have the dummy option, you would need to change the logic to work on button click:
<select class="mySelect">
    <option value="http://www.url1.com">Url 1</option>
    <option value="http://www.url2.com">Url 2</option>
    <option value="http://www.url3.com">Url 3</option>
</select>
<button id="redirect">Go</button>

$("#redirect").click(function() {
    window.location.replace($(".mySelect").val());
});

A: You have to put http:// also
window.location.replace("http://"+$(this).val());

A: One option can be that you change the first option like
    <select class="mySelect">
    <option value="select">Select URL</option> <!--Default displayed--->
    <option value="www.url1.com">Url 1</option>
    <option value="www.url2.com">Url 2</option>
    <option value="www.url3.com">Url 3</option>
    </select>

or you can use click jquery event for combo box .

A: <form>
<select class="mySelect">
    <option value="" selected="selected">Please Select</option>
    <option value="www.url1.com">Url 1</option>
    <option value="www.url2.com">Url 2</option>
    <option value="www.url3.com">Url 3</option>
</select>
</form>

$(".mySelect").change( function() {
var n = $(this).val();
if(n != "") {
window.location.assign("http://"+n);
}
});


text:
Q: What email service should I use for my React+Node based Ecommerce Website? I'm working on an E-Commerce project for a while now and want to set up email functionality for the customers. I want to send them emails regarding new releases and other company related stuff (newsletters,etc.).
I've used mailgun in my previous personal projects. What would you recommend I should be using here because this is a big project and I want a good performance.
Thank you!

A: Install Node mailer package with npm:
npm install nodemailer

Then include it in a relevant email message script:
var nodemailer = require('nodemailer');

For more info, you can consult this easy to understand guide: https://www.w3schools.com/nodejs/nodejs_email.asp

A: I usually use SES (Simple Email Service) on AWS. It's not expensive at all (0.10$) 1000 emails.
You just have to connect your NodeJS API to the SES service when setup (many tutorials exists).
It's cheap, secure, and if you have a big quantity of users on your website, SES will surely not crash.
Best regards,


text:
Q: Tenés un arreglo de objetos con : 'nombre' y 'mesa', creá un objeto con los invitados ordenados por mesa Debo crear un objeto en el cual contenga el nombre de la mesa, y las personas que pertenecen a esa mesa.
No puedo lograr que los nombres se concatenen dentro del array, porque tampoco puedo ubicarlos en un array externo, porque de esa manera se juntarian con el resto de nombres de la otra mesa
//Debe verse así:

//{
//     mesa1: [juan, perez, ...],
//     mesa2: [juan, perez, ...]
//}

Aqui esta la lista de invitados:
let invitados = [
  {
    nombre: 'javi',
    mesa: 1
  },
  {
    nombre: 'juli',
    mesa: 1
  },
  {
    nombre: 'mica',
    mesa: 2
  },
  {
    nombre: 'nancy',
    mesa: 2
  },
  {
    nombre: 'nacho',
    mesa: 2
  },
  {
    nombre: 'cami',
    mesa: 3
  },
];

aqui mi intento por resolverlo:
const mesa = (arr) => {
  let mesas = {}
  let array = [];

  arr.forEach(el => {
      mesas[`mesa${el.mesa}`] = [el.nombre];
      mesas[`mesa${el.mesa}`] = [el.nombre];
  })
  console.log(mesas)
}

mesa(invitados)

A: Lo que se utiliza en estos casos es una función push() para poder agregar cosas a un array. Y lo que puedes hacer es una validación para saber si ya se creo la mesa.
arr.forEach(el => {
      if(mesas[`mesa${el.mesa}`] == undefined){
          mesas[`mesa${el.mesa}`] = [];
      }

      mesas[`mesa${el.mesa}`].push(el.nombre);
  });

Entonces si realizas ese cambio en esa parte de tu código ya te aparecerá con todos los invitados sin que se te borre el anterior.


text:
Q: how to perform unit testing with route::resource Laravel 5.2 i want to perform unit testing on index page
this is my sample test code:
public function testBasicExample()
{
   $this->visit('/admin/newsmaster')->seePageIs('NewsMaster.index');
}

this is my route:
Route::resource('admin/newsmaster','FeedController',['only'  => ['index']]);

when i do phpunit in terminal i am getting message as:
FAILURES!

*

*Tests: 1, Assertions: 1, Failures: 1.

*what is the problem with this..??

A: seePageIs() verifies if current url is the wanted one, after navigation, for example:
    $this->visit('/admin')
         ->click('Newsmaster')
         ->seePageIs('/admin/newsmaster');


text:
Q: How to navigate to page when on resume is called in app.xaml.cs for mvvm in xamarin forms app I have an issue with navigation. When I click home screen button of device and get back to app I get app homescreen instead of pin page. Ideally it should show pin page and its working fine with back button of device.
OnStart() method has navigationasync but the same is not working with OnResume() method.
Do I have to go to each of the Platform project cs file and add the navigation there like for Android OnRestart()/OnResume() method?
If anyone knows the solution please let me know

A: Most commonly when writing your Xamarin Application with Prism you will have something like:
protected override void OnInitialized()
{
    NavigationService.NavigateAsync("SomePage");
}

OnInitialized is called each time the App's ctor is invoked. This is an important consideration here because this means that any time that the native platform tombstones the app in the background or otherwise refreshes the app by calling OnCreate in your MainActivity or FinishedLaunching in your AppDelegate, then OnInitialized will be invoked resetting your App's Navigation stack to SomePage.
You can however override the OnStart/OnResume in PrismApplication and use whatever business logic you need to determine where to navigate and how you might want to restore your application.
public override void OnStart()
{
    NavigationService.NavigateAsync("MainPage");
}

public override void OnResume()
{
    if(someCondition)
    {
        NavigationService.NavigateAsync("SomePage");
    }
    else
    {
        NavigationService.NavigateAsync("AnotherPage");
    }
}


text:
Q: Is it possible to permanently set environment variables? I need a way to set an environment variable permanently. I could get away with having this only work in Windows for now, but ideally i'd like a solution that is OS agnostic. From what I can tell though, Node will only set the var for the current process/children processes. Is what I want even possible?

A: Can probably use setx and export, though not sure of implications/privileges required (I would assume in windows a UAC bump would be necessary, and in linux you'd need sudo). Here's a best-guess:
var exec = require('child_process').exec;

// Add FOO to global environment with value BAR
//   setEnv('FOO', 'BAR', callback)
// Append /foo/bar to PATH
//   setEnv('PATH', '+=;/foo/bar', callback)
function setEnv(name, value, cb) {
  if (!name) throw new Error('name required.');
  if (typeof value === 'undefined') throw new Error('value required.');

  var cmd;
  if (value.indexOf('+=') === 0) value = process.env[name] + value.substring(2);
  value = value.indexOf(' ') > -1 ? `"${value}"` : value;

  switch (process.platform) {
    case 'linux': cmd = `export ${name}=${value}`; break;
    case 'win32': cmd = `setx ${name} ${value} /m"; break;
    default: throw new Error('unsupported platform.'); break;
  }

  exec(cmd, cb);
}

I should mention this really isn't ideal; I recommend defining them as part of your execution task or look at using something like dotenv.

A: Write a file named setEnv.js and paste the following code in that.
Save file somewhere in your system, eg. in D:\Codes\JS.
step 1
const {spawnSync} = require("child_process");

// setx  -m  MyDownloads  H:\temp\downloads
var result = spawnSync('setx', ['-m', 'MyDownloads', 'H:\\temp\\downloads'])

// STDOUT
var stdOut = result.stdout.toString();
console.log(stdOut)

// STDERR
var stdErr =  result.stderr.toString();

if(stdErr === '') {
    console.log('Successfully set environment variable')
} else {
    console.log(`ERROR: ${stderr}`)
}

step 2
Open console window as an administrator and type the below commands.

otherwise »
ERROR: Access to the registry path is denied.

*

*cd D:\Codes\JS

*node setEnv.js
Now, have a look at the below images, in my case.
Before

After

References
Execute a command line binary with Node.js
SETX command: error: Access to the registry path is denied
https://www.codejava.net/java-core/how-to-set-environment-variables-for-java-using-command-line

A: I use a generic script for mac and windows like this:
#!/bin/node

const { exec } = require("child_process");
const currentOs = require("./getOs");

const os = currentOs();

//==========================================================================
function changeMinNodeVersion() {
    console.log("\nChanging yargs min node version...");

    const minNodeVersion = String(process.versions.node).split('.')[0];
    const yargsVariable = `YARGS_MIN_NODE_VERSION=${minNodeVersion}`;
    const command = `${os === 'darwin' ? `export ${yargsVariable}` : `set ${yargsVariable}`}`;

    console.log(`Excecuting ${command}`);

    exec(command, (error, stdout, stderr) => {
        if (error) {
            console.log(`\nFailed to change min node version: ${error.message}`);
            return;
        }
        if (stderr) {
            console.log(`\nFailed to change min node version: ${stderr}`);
            return;
        }

        console.log(`\nVersion changed to ${minNodeVersion}`);
    });
}

//=========================================================================
changeMinNodeVersion();

So i just run using:
node ./scriptName.js


text:
Q: Point set topology exercise: prove that the following subset of the complex plane is open. Assume that $f:{\mathbb{C}}\rightarrow{\mathbb{C}}$ is a continuous function. I want to prove that for any real positive constant $M$, the set $$G=\{z\in{\mathbb{C}}:|f(z)|<M\}$$ is open. My argument is as follows: Since $f$ is continuous as is $z\mapsto{|z|}$, the mapping $z\mapsto{|f(z)|}$ must be a continuous mapping from ${\mathbb{C}}\rightarrow{[0,\infty]}$, and since $[0,M)$ is an open set in the subspace topology that $[0,\infty)$ inherits from the real line, $G=f^{-1}([0,M))$ must be open in $\mathbb{C}$. This argument (if correct) seems to provide a unified proof that any open disc (centered anywhere), or sets of the form (say) $$G=\{z\in{\mathbb{C}}:|z^{2}+z|<M\},$$ or $$G=\{z\in{\mathbb{C}}:|z^{3}+z+1|<M\}$$ are open. These statements seem to be hard to establish directly i.e. by proving that every point is an interior point explicitly (as one would for the open unit disc say). [I feel a little uncomfortable about invoking the subspace topology! But cannot see why it would be wrong].

A: Your argument is fine. The "hardness" of establishing that the sets at the end of your post are open is hidden in the proof of the continuity of the polynomials. Proving that all polynomials are continuous is not that difficult, but it requires some work.
To avoid the subspace topology, you can just note that
$$
G = f^{-1}((-M,M)).
$$


text:
Q: How to display the content on product pages without using tabs? What's the more elegant way to remove the tabs on the Magento (2.4.2) product page? I'd like to simply show the content without using the tabs.
I was thinking to use some Javascript code in order to "disarm" the tabs widget.

A: You have to shift 2 blocks to show content without tab. The first block is description and the another block is product more attributes. In my case i move 2 block from tab section to main product info main area.
In my theme there is layout file Magento_Catalog\layout\catalog_product_view.xml file.
I write these 2 lines only.
    <move  element="product.info.description" destination="product.info.main" after="-" />
    <move  element="product.attributes" destination="product.info.main" after="-" />

This code show tab for Review but the description and attributes shifted to product info area. Hope this help you.

A: This is how you can remove the Tabs widget in the cleanest way possible.
Basically I took out the blocks from the main block which renders the widget.
This is what I did:
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_product_view.xml
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceContainer name="content">
            <container name="product.info.detailed" htmlTag="div" htmlClass="product info detailed">

                <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" as="description" template="Magento_Catalog::product/view/attribute.phtml" group="detailed_info">
                    <arguments>
                        <argument name="at_call" xsi:type="string">getDescription</argument>
                        <argument name="at_code" xsi:type="string">description</argument>
                        <argument name="css_class" xsi:type="string">description</argument>
                    </arguments>
                </block>

                <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="Magento_Catalog::product/view/attributes.phtml" group="detailed_info" />

                <block class="Magento\Framework\View\Element\Template" name="product.review.anchor" template="Magento_Review::anchor.phtml" before="product.info.details" />

                <container name="product.info.details" htmlTag="div" htmlClass="product reviews wrapper" after="product.attributes">
                    <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form" ifconfig="catalog/review/active" after="product_review_list.toolbar">
                        <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before" htmlTag="div" htmlClass="rewards"/>
                    </block>
                    <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml" ifconfig="catalog/review/active"/>
                    <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar" ifconfig="catalog/review/active"/>
                </container>
            </container>
        </referenceContainer>

</page>

I also had to recreate the Anchor target link for Reviews since it was included in the block.
app/design/frontend/Vendor/Theme/Magento_Review/templates/anchor.phtml

It seems to work pretty well and, as I said, I think this is the cleanest way to achieve that.

A: To remove any blocks in Magento, you can do this from the layout file.
In your theme/Magento_Catalog/layout/catalog_product_view.xml file add this:
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

           <referenceBlock name="block.name.to.be.removed" remove="true" />

</page>

Replace block.name.to.be.removed with the actual block you want to remove.
And you can add this to add any content of your own:
<block class="Magento\Catalog\Block\Product\View" name="your.own.content" template="Magento_Catalog::product/view/my-own-content.phtml" after="-" />

So it becomes this:
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

           <referenceBlock name="block.name.to.be.removed" remove="true" />
           <block class="Magento\Catalog\Block\Product\View" name="your.own.content" template="Magento_Catalog::product/view/my-own-content.phtml" after="-" />

</page>

Now, in your theme/Magento_Catalog/templates/product/view/my-own-content.phtml file:
<?php $product = $block->getProduct();
<?php echo $product->getDescription();?>

Hope this helps.
UPDATE 1
To add/move other contents from layout:
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

           <referenceBlock name="block.name.to.be.removed" remove="true" />
           <block class="Magento\Catalog\Block\Product\View" name="your.own.content" template="Magento_Catalog::product/view/my-own-content.phtml" after="-" />
           <move element="reviews.tab" destination="your.own.content" after="-"/>

</page>

A: I have used following code to show them:
<?php
  $layout = $block->getLayout();
?>

          <?= /* @noEscape */ $layout->renderElement('reviews.tab') ?>

          <?= /* @noEscape */ $layout->renderElement('productfaq.tab') ?>

          <?= /* @noEscape */ $layout->renderElement('productcare.tab') ?>


text:
Q: Can't access variables from _bootstrap.php in codeception I test my laravel5 application using codeception and because I need a user for most of my unit tests I tried to create one in my unit/_bootstrap.php file:
$user = \App\User::register($credentials);

But it seems like this file is not getting loaded into my tests since I cant access the $user variable. The test always fails with the following error:

[PHPUnit_Framework_Exception] Undefined variable: user

I use the default codeception configuration and just added the laravel5 module. Also I know for sure that the bootstrap file gets executed since I can break the tests by throwing an exception in there.
unit.suit.yml:
class_name: UnitTester
modules:
    enabled:
        - Asserts
        - \Helper\Unit
        - Laravel5:
            enviroment_file: .env.testing

codeception.yml
actor: Tester
coverage:
    enabled: true
    include:
        - app/Services/*
        - app/Http/*
        - app/Token.php
        - app/User.php
    exclude:
        - app/Http/routes.php
        - app/Http/Kernel.php
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
extensions:
    enabled:
        - Codeception\Extension\RunFailed
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql

A: I don't see any error here. If you use variable $user inside class, you should then add global $user; and then use this variable because it will be a global variable.
However using global variables is not a best solution. It's probably better add new base class for example BaseCest and extend it in your test classes and then in your BaseClass you can define such variable in _before method.


text:
Q: Conditional Glyphicon using Jquery for Stock Price using Google Finance I am trying to get a stock quote working for a website.
What I'm trying to achieve is to have a glyphicon displayed at "StockDirectionValue" instead of stockInfo.cp value.
The glyphicon needs to be conditional... depending on the output of StockInfo.cp which could be positive, negative or static.
This is the jquery code I'm using and this is working fine.
var gstock = ["NASDAQ:AAPL", "PPY:000001"];
for (var i = 0; i < gstock.length; i++) {
    $.getJSON("https://finance.google.com/finance/info?client=ig&q="+gstock[i]+"&callback=?", function (response) {
        var stockInfo = response[0];
        var stockString = '
Nasdaq:';
        stockString += '' + stockInfo.cp + '';
        stockString += '' + stockInfo.l + '';
        stockString += '' + stockInfo.c + '';
        stockString += '
';
        $('.stockNasdaq').prepend(stockString);
    });
}

The HTML is pretty simple.

Can someone help!

A:

function getGlyph(cp) {
        var glyphicon = '';
        if (cp < 0) {
            glyphicon = ' glyphicon glyphicon-arrow-down';
        }else if (cp >= 0) {
            glyphicon = ' glyphicon glyphicon-arrow-up';
        }
        return glyphicon;
    }
    var gstock = ["NASDAQ:AAPL", "PPY:000001"];
    for (var i = 0; i < gstock.length; i++) {
        $.getJSON("https://finance.google.com/finance/info?client=ig&q=" + gstock[i] + "&callback=?", function (response) {
            var stockInfo = response[0];
            var stockString = '
Nasdaq: ';
            stockString += ' ' + stockInfo.cp + '';
            stockString += '' + stockInfo.l + '';
            stockString += '' + stockInfo.c + '';
            stockString += '
';
            $('.stockNasdaq').prepend(stockString);
        });
    }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>


text:
Q: How To Count and Sum in Same Table To Become Parent Dataset This is extended from previous question regarding Query Top Three Reference ID. Since "level" column become dynamic and I need to keep it while display on gridview.
My plan to create 2 dataset (Parent and Child).
1)
Regarding Child Dataset already have a answer (thanks to Rudolf) like below:-
Table Test
ID  Name    RefID
A   AAAA    null
B   BBBB    A
C   CCCC    B
D   DDDD    C
E   EEEE    D
F   FFFF    E

Sql Statement
select ID, 'Level(' + cast(level as varchar(255)) + ')' GroupLevel, RefID from (
      select t0.ID,
        case level.level
          when 1 then t1.ID
          when 2 then t2.ID
          when 3 then t3.ID
        end RefID,
        level.level
      from Test t0
        left outer join Test t1 on t1.RefID = t0.ID
        left outer join Test t2 on t2.RefID = t1.ID
        left outer join Test t3 on t3.RefID = t2.ID
        cross join (
          select 1 level union all
          select 2 union all
          select 3
        ) level
    ) t
    where t.RefID is not null

Output:
ID | GroupLevel | RefID |
---+------------+-------+
A  | Level(1)   | B     |
A  | Level(2)   | C     |
A  | Level(3)   | D     |
B  | Level(1)   | C     |
B  | Level(2)   | D     |
B  | Level(3)   | E     |
C  | Level(1)   | D     |
C  | Level(2)   | E     |
D  | Level(1)   | E     |

Now I need to create Parent Dataset like below:-
Output in GridView with "+" and "-"
Introducer  Level      Total Id
A           Level (1)      2
-   Id  Name
    --  -----
    B   BBBB
    C   CCCC

A           Level(2)       1
-   Id  Name
    --  -----
    D   DDDD

Before that, I need to create sql statement with Count(*) to get total id based table above. I try many time to place it on Rudolf statement but can get total correctly:-
select ID,
'Level(' + cast(level as varchar(255)) + ')' GroupLevel,
RefID,

*second try - result error
     count(*) as reccount*

from (
      select t0.ID,
        case level.level
          when 1 then t1.ID
          when 2 then t2.ID
          when 3 then t3.ID
        end RefID,

*first try - result count double
           count(*) as reccount*

        level.level
      from Test t0
        left outer join Test t1 on t1.RefID = t0.ID
        left outer join Test t2 on t2.RefID = t1.ID
        left outer join Test t3 on t3.RefID = t2.ID
        cross join (
          select 1 level union all
          select 2 union all
          select 3
        ) level
    ) t
    where t.RefID is not null

I can figure out where to put count statement to get total record based level group.
2)
I also need to add column and sum value from any related table. Let say I have table child for each id like below:-
Table Child
ID  Date Join   Child
B   XX/XX/XXXX  2
C   XX/XX/XXXX  5

My desire output should be:-
Introducer  Level      Total Id Total Child
A           Level (1)   2        7
-   Id  Name    Date Join   Child
    --  ----    ---------   -----
    B   BBBB    XX/XX/XX    2
    C   CCCC    XX/XX/XX    5
A           Level(2)    1        0
-   Id  Name    Date Join   Child
    --  ----    ---------   ------
    D   DDDD    XX/XX/XX    Null

I am very appreciate and thanks on advance for yours time and read this thread and hope anybody cross this problem have a solutions regarding this questions please share with me.
Thanks you.

A: I found answer for question no 2
" I also need to add column and sum value from any related table. Let say I have table child for each id like below:-
Table Child
ID  Date Join   Child
B   XX/XX/XXXX  2
C   XX/XX/XXXX  5

On sql statement I put:-
.....
(Select
      1 As level
    union All
    Select
      2
    union All
    Select
      3) level) t Left Join
  child On t.RefID = child.memberid
......

where I get my desired output like below:-
Id  Name    Date Join   Child
--  ----    ---------   -----
B   BBBB    XX/XX/XX    2
C   CCCC    XX/XX/XX    5

By using Left Join I can scan and show all Table Child related with RefID either exist on not as Child dataset.
I still need to show child = 0 if record not found in Table Child instead of null or blank value.
I am very appreciate if yours all can improve this solutions. Maybe have others sql statement more effective and faster than this.
And, please help me to figure out regarding COUNT and SUM on Parent dataset. I still no idea how to overcome this problem yet.
Thanks you.


text:
Q: how to use the properrty Can anyone assist me to solve this query in the below mentioned scenario…?
first of all i've created a testsuite for every individual web service, for handling all types of its respective testcases like, request succeeded, internal server error bla bla.
My app is login based. and on successful login, login API returns session id and some other values in the response.
ive another suite which fetches the latest studies from the server for that sessionid which is generated as a response in testsuite 1. Can you help me to use this property (sessionid ) as a param while invoking the other APIs (for instance, getlateststudies) being the part of other testsuites….in this case i want to fetch the latest studies for that sessionid.
As you know that values for such params, like, sessionid is system generated. so can the wild character (*) be sued in this case.
Im sort of new to SOAPUI , have already taken help from soap UI online help links but the entire help is related to using the property as a param in the same testsuite and NOT across the various testsuites.
Please elaborate all the steps if you know how to proceed ahead.
for more clarity , let me the define the hierarchy which i've structured in my workspace.
Userlogin /testsuite 1, represents the login API/
Request succeeded /testcase name , represents a scenario/
teststep1
method1-request1
/This testcases returns system generated sessionid as a value upon invoking/
getlateststudies /*test suite 2, represents the API to fetch the latest studies from server for
that sessionid */
Request succeeded /testcase name , represents a scenario/
teststep1
method1-request1
Do i need to use any groovy script for it ?
I've already tried using property transefer feature of soap UI within the same testsuite but
tell me some suitable solution to use it across the test suites of the same project.

@ Steve, Thanks for ur reply. i actually followed the steps mentioned in the 2nd most link  provided by you as per my last conversation with you, the sessionid param is a server generated id and it couldn't be hard coded.Just want to  discuss with you what i did!i defined a property at the project level sessionid and imported its value from an external source, say .txt file and in which ive saved the value of sessionid with a wild character , i-e, *. keeping in view the fact that it will pick the server generated sessionid and i really didn't want to pass the hard-coded value. i later made use of property transfer feature to select the source and target properties names and their values. want to double-check with you  is my approach correct , if not , then please provide your valuable comments! or if passing the wild card character is not correct for the server generated id , then what should be the other possible option to represent this ?

A: You are close, it sounds like you are just using the wrong property type.  soapUI has several levels.

*

*Global- available globally

*Project- available across the project

*TestSuite- available across the suite

*TestCase- available in the testcase

You need to use a property transfer to a project level property, so add a custom property at the project level and then use property transfer to that property you created.  Use xpath to pull the piece of data you need.  Finally, you need to use that project property in your new request ${#Project#PropertyName}
All the tools to put this together are available from the soapUI website.
http://www.soapui.org/Functional-Testing/xpath-and-xquery-assertions.html#1-the-xpath-match-assertion
http://www.soapui.org/Functional-Testing/working-with-properties.html
http://www.soapui.org/Functional-Testing/transferring-property-values.html


text:
Q: Activity window on standard call screen - to Enable buttons I would like to add a small window (Popup) on call screen activity.
Google voice and worldcallplaceandtime are both adding the same window during a call.
The problem is that when I open a new activity on the top part of the screen, the rest of the buttons are disabled (End call, Mute etc). The only option to click the end call button is only when I close the new activity that was added.
Can anyone please tell me how can I add a small window one the screen and still be able to use the call standard buttons?

A: This is the code I used to add an overlay button on the call screen without disabling the buttons.
I hope it helps..
    public void addInvitePopup(final String number){
    //check if pref is ok with invite in call
    if(!Preferences.getInstance(getApplicationContext()).getInviteInCall()){return ; }
    // sets the WindowManager
    wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);

    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            PixelFormat.TRANSLUCENT);
    params.x = 250;
    params.height = LayoutParams.WRAP_CONTENT;
    params.width = LayoutParams.WRAP_CONTENT;
    params.format = PixelFormat.TRANSLUCENT;

    params.gravity = Gravity.TOP;
    params.setTitle("Testing");

    ly = new LinearLayout(getApplicationContext());
    ly.setOrientation(LinearLayout.VERTICAL);

    Button inviteButton = new Button(getApplicationContext());
    inviteButton.setClickable(true);
    inviteButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.invite_incall_off));
    inviteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(v.getContext(), "Inviting by free SMS..", Toast.LENGTH_LONG).show();
            v.setBackgroundDrawable(getResources().getDrawable(R.drawable.invite_incall_on));
            v.setClickable(false);
            sendMessage(v, number);

            //Track this event:
            MixPanelTracking.setPropKeyValue(getApplicationContext(), null, null, "Add friend - During Call");
        }
    });

    //closeInviteButton. ///////////////////////
    closeInviteButton = new Button(getApplicationContext());
    closeInviteButton.setClickable(true);
    //closeInviteButton.setGravity(Button.);
    closeInviteButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.close_invitebutton_off));
    closeInviteButton.setWidth(30);
    closeInviteButton.setHeight(30);
//  closeInviteButton.setLayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
//          WindowManager.LayoutParams.WRAP_CONTENT);

    closeInviteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            removeInvitePopup();
            //Add to Preferences:
            //Preferences.getInstance(v.getContext()).setInviteInCall(false);
            //Track this event:

        }
    });
    ////////////////////////////////////////////
    ly.addView(inviteButton);

    wm.addView(ly, params);
    wm.addView(closeInviteButton, params);
    Log.i("TTT", "after add view");
}
public void removeInvitePopup(){
    if(ly != null){
        wm.removeView(ly);
        wm.removeView(closeInviteButton);
        ly =  null;
        closeInviteButton = null;
    }
}

A: If I use that i receive an exception when using removeInvitePopup() on IDLE state. Close invite button does not dissapear when you miss the call


text:
Q: How to process events one by one while using @SqsListener I am using spring cloud @SQSlistener to read events from AWS SQS
    @SqsListener(value="queue_name", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
    public void sqsQueueListener(S3EventNotification event) {
        //Read file from S3
        //Process the file
        //Delete file from S3
    }

    @Bean
    public QueueMessagingTemplate queueMessagingTemplate(AmazonSQSAsync amazonSQSAsync) {
        return new QueueMessagingTemplate(amazonSQSAsync);
    }

    @Bean
    public QueueMessageHandlerFactory queueMessageHandlerFactory(final ObjectMapper mapper,
                                                                 final AmazonSQSAsync amazonSQSAsync) {
        final QueueMessageHandlerFactory queueHandlerFactory = new QueueMessageHandlerFactory();
        queueHandlerFactory.setAmazonSqs(amazonSQSAsync);
        queueHandlerFactory.setArgumentResolvers(
                Collections.singletonList(new PayloadMethodArgumentResolver(jackson2MessageConverter(mapper))));
        return queueHandlerFactory;
    }

If there are multiple events from SQS, All the event are getting processed in parallel
How can i make sure that only one event is processed at a time.


text:
Q: Restrict access to download the application on Google Play I'm developing an application that is still in beta version but I'm interested in uploading it to Google Play in order to test the market.
As I mentioned before the application has not been released yet, so I would like to know if it's possible to restrict the access so that only a restrict number of users will be able to download it?

A: You can restrict access to your published applications in the Google Play developer console, but the restrictions you can use are restrictions like country, type of device (tablet, smartphone), screen size, Android version, etc. Limiting access to specific users or specific devices is however not possible.
You can always publish the apk file on a restriced access download location and then share it amongst your beta users. Another possibility would be to publish the application in the Google Play market and then check in your application whether an user is allowed to run it, but I think that would be more work for you.

Edit: This answer has become outdated since Google introduced beta testing through Google Play, see JuanMa Cuevas' answer.

A: The Play Store doesn't provide this facility.
You could change the namespace (for testing), and upload it using a different name. i.e. cloak it as a different branded app, and if it does well, upload the real one.
You could set up a web site with downloads, or use another app store.
You could use a third-party service to manage beta a release. e.g. https://www.zubhium.com/

A: Starting on May '13 Google Play Developer Console lets you test your app with groups of users through alpha- and beta-testing and staged rollouts feature.  You need to:

*

*Select an APK for your alpha or beta test.

*Select the group of users for each test.

*Publish your alpha- or beta-test APK.

*Ask your testers to opt in.

The alpha/beta testers must be part of either a Google group or a Google+ community.
the app will only appear in Google Play for testers that opt-in and not to any other users. Another inconvenient is that it may take up to 24 hours after publishing for the test link to become active, but normally it will be less time
Here you can find more information about Beta-testing and staged rollouts

A: Why don't you just host the apk yourself and distribute the link to your selected testers.
Or you could use a private market such as http://www.push-link.com/ which seems free and apparently has the ability to push updates to your users


text:
Q: Change background image of page dynamically I want to change background image of my page dynamically.
Code in my aspx page is:

/newtheme/images/city-images/ this part of URL is staic.
while City-name.jpg will keep on changing like California.jpg, Dubai.jpg, etc.
Please help,
Thanks

A: If you want to do it server-side in your the give your LI an ID and runat="server" attribute:

Then in your C# code you will be able to do something like
liCity.Style["background"] = string.Format("url(/newtheme/images/city-images/{0}.jpg) no-repeat center 93px;", "Moscow");


text:
Q: How to get sidebar to scroll and resize properly It seems to be working except I can't get the entire menu on the right to show up on many displays. It seems to get cut off depending on your screen size.
 .mainDiv{ position: absolute; height: auto;}
.right{ position: fixed;  top: 400px; right: 200px; bottom:5px; background:none;padding-bottom: 60px;border:none; z-index: 5000;margin: 2em; height:100%; width:auto; verflow-y: scroll;}

http://jsfiddle.net/6YDRB/
Any ideas?

A: Maybe you should define a min-width
Example: http://jsfiddle.net/6YDRB/2/

A: What is happening is your .right div is fixed in position with top:300px and right:100px in your jsfiddle. Remove these static value and try with % if you are looking for responsiveness. Also set min-width as suggested by Sam.


text:
Q: Using iterate function to extract time series in Google Earth Engine? The code below extracts average rainfall for each US county for one given day and send the table result to drive. Now, how can I use iterate function to extract a time series for one year for example?
 // load precip data (mm, daily )
var precipCollection = ee.ImageCollection('OREGONSTATE/PRISM/AN81d')
                    .select('ppt')   // select  precip band only
                    .filterDate('2017-01-01'); // e.g. one day
print(precipCollection, 'precipCollection');

//reduce the image collection
var dailyPrecip = precipCollection.reduce(ee.Reducer.sum());
print(dailyPrecip);

// visualize annual precipitation
var precipPal = ['white','blue','red','pink'] // store palette as variable
Map.addLayer(dailyPrecip, {min: 1, max: 100, palette: precipPal}, 'precip');

////////////////////////////////////

// load regions: counties from a public fusion table, removing non-conus states
// by using a custom filter
var nonCONUS = [2,15,60,66,69,72,78] // state FIPS codes that we don't want
var counties = ee.FeatureCollection('ft:1ZMnPbFshUI3qbk9XE0H7t1N5CjsEGyl8lZfWfVn4')
        .filter(ee.Filter.inList('STATEFP',nonCONUS).not());
print(counties, 'counties');

// visualize
Map.addLayer(counties,{},'counties');

// get mean precipitation values by county polygon
var countyPrecip = dailyPrecip.reduceRegions({
  collection: counties,
  reducer: ee.Reducer.mean(),
  scale: 4000 // the resolution of the prism dataset
});
print(countyPrecip);

// select features
var out = countyPrecip.select(['.*']);

// add a new column for date
out = out.map(function(feature){
return feature.set('date','2017-01-01');
});

// Table to Drive Export Example

Export.table.toDrive({
  collection: out,
  description: 'precip_by_county',
  folder: 'GEE',
  fileFormat: 'CSV'
});

A: You can have a try about pkg_export.
 // load precip data (mm, daily )
var precipCollection = ee.ImageCollection('OREGONSTATE/PRISM/AN81d')
                    .select('ppt')   // select  precip band only
                    .filterDate('2017-01-01', '2018-12-31'); // e.g. two year
print(precipCollection.limit(3), 'precipCollection');

// load regions: counties from a public fusion table, removing non-conus states
// by using a custom filter
var nonCONUS = [2,15,60,66,69,72,78]; // state FIPS codes that we don't want
var counties = ee.FeatureCollection('ft:1ZMnPbFshUI3qbk9XE0H7t1N5CjsEGyl8lZfWfVn4')
        .filter(ee.Filter.inList('STATEFP',nonCONUS).not());
print(counties, 'counties');
Map.addLayer(counties, {}, 'counties');

/** pkg_export --------------------------------------------------------- */
var options = {
    reducers : ['mean'],  // 1th: non-buffer; 2th: buffer; Only one means no buffer
    buffer   : false,      // whether to use buffer
    list     : false,
    folder   : '', // drive forder
    fileFormat: 'csv'      // 'csv' or 'geojson'
    // scale    : 1000
};

var pkgs = require('users/kongdd/pkgs:pkgs.js');
pkgs.spClipImgCol(precipCollection, counties, "precipCollection", options);

https://code.earthengine.google.com/8221ae9a4ae68a42f6b775a2cf84d6b2


text:
Q: Logging big data I got memory limit error In laravel 6 app sometimes I need to debug with loging some data
\Log::info('$taskAssignedToUser::');
\Log::info($taskAssignedToUserCollection);

and I got  memory limit error.
My question is are there some tools/pluging/scripts to wrap collection(or request)
to show not all all nested data, but maybe some top elements?
Thanks!


text:
Q: How to filter string "1M,3F,2M" to "1,3,2" through jquery? I have String 2M,1F,5M,6F selected seats with gender. how to filter this string to only numbers with comma?
something like this,
stringVal.replace(/, /g, ",").replace(/,/g, ", ");

this one returns with space after comma but i want only numbers with comma.

A: Why not replace all alphabetical characters with the empty string?

const stringVal = '1M,3F,2M';
console.log(
  stringVal.replace(/[a-z]/gi, '')
);

A: You can use split() on comma and then parseInt() each value of array to get the number and then join() it using comma.

var stringVal = '1M,3F,2M';
stringVal = stringVal.split(',').map(x=> parseInt(x)).join(',');
console.log(stringVal);

A: You can use this for getting numbers,

console.log('2M,1F,5M,6F'.replace(/[^\d,]+/g, ''));

A:
I have String 2M,1F,5M,6F selected seats with gender

It seems the string contains M and F so you can replace those with empty string.

var stringVal = '2M,1F,5M,6F'

stringVal = stringVal.replace(/[MF]/g, "")
console.log(stringVal);

A: Here is an approach using split directly on the input string to generate an output array of values:

var input = "2M,1F,5M,6F";
input = input + ",";
var genders = input.split(/[A-Z],/);
genders.pop();
console.log(genders);

We add a trailing comma to the end of the input string, so that the split pattern will fire (and consume) the very last comma and gender code.  But this produces an extra empty entry in the output array, which we then pop off.
The possible advantage of this approach might be if you needed to have these values in an array anyway, and you wanted to achieve this in a single step.


text:
Q: What is c# AVRO schema for Date I have a java kafka streams application which consumes avro events produced by a C# application. On the C#, it's a built-in-house avro library. For the Date type field, it generates avro schema to { "name": "dateOfBirth", "type": "int" } without logicalType. Obviously, this causes trouble in the java consumer side.
I would like to ask anyone using AVRO C#, what's the avro schema of date field generated by the standard C# avro lib?

A:
Obviously, this causes trouble in the java consumer side.

It shouldn't. The schema registry would store that schema as-is, then the consumer would then read that data as an integer.
I would like to point out, however, that dates should be long, represented as unix epoch.

by the standard C# avro lib?

That is exactly what the C# confluent-dotnet uses, AFAIK; they don't re-write their own


text:
Q: Setting caret position in JTextArea I have a JTextArea. I have a function that selects some amount of text when some combination is called. It's done properly. The thing is, I want to move caret to the selection beginning when some text is selected and VK_LEFT is pressed. KeyListener is implemented properly, I tested it in other way. The thing is, that when I write following code:
@Override public void keyPressed( KeyEvent e) {
        if(e.getKeyChar()==KeyEvent.VK_LEFT)
            if(mainarea.getSelectedText()!=null)
                mainarea.setCaretPosition(mainarea.getSelectionStart());
    }

and add an instance of this listener to mainarea, select some text (using my function) and press left arrow key, the caret position is set to the end of selection... And I wont it to be in the beginning... What's the matter? :S

A: Here's a code snippet
    Action moveToSelectionStart = new AbstractAction("moveCaret") {

        @Override
        public void actionPerformed(ActionEvent e) {
            int selectionStart = textComponent.getSelectionStart();
            int selectionEnd = textComponent.getSelectionEnd();
            if (selectionStart != selectionEnd) {
                textComponent.setCaretPosition(selectionEnd);
                textComponent.moveCaretPosition(selectionStart);
            }
        }

        public boolean isEnabled() {
            return textComponent.getSelectedText() != null;
        }
    };
    Object actionMapKey = "caret-to-start";
    textComponent.getInputMap().put(KeyStroke.getKeyStroke("LEFT"), actionMapKey);
    textComponent.getActionMap().put(actionMapKey, moveToSelectionStart);

Note: it's not recommended to re-define typically installed keybindings like f.i. any of the arrow keys, users might get really annoyed ;-) Better look for some that's not already bound.


text:
Q: Rails Paypal Express Error: Please enter a valid credit card number and type I am trying to use paypal express checkout on my rails app and I keep getting the "Please enter a valid credit card number and type." error. Here's my code
in the model:
def process(order)
  return true if !self.new_record?

  ActiveMerchant::Billing::Base.mode = Piggybak.config.activemerchant_mode
      calculator = ::PiggybakPaypal::PaymentCalculator::Paypal.new(self.payment_method)
      self.month = Time.now.month
      self.year = Time.now.year
      order_total = (order.total_due * 100).to_i
      res = calculator.gateway.purchase(order_total, express_purchase_options)

  if res.success?
      return true
    else
      logger.debug "This is from debug"
      order.errors.add :payment_method_id, res.message.to_s
      return false
  end
end

def express_purchase_options
{
  :ip => request.remote_ip,
  :token => self.token,
  :payer_id => self.payer_id
}
end

Right now I'm really confused. Is it the option I send in wrong? If so how can I check it? Or is it the way I use paypal gateway wrong? I search around and someone said paypal sandbox might cause the problem?


text:
Q: How to add default value in json object array? I have a JSON object array as shown below. The following o/p is achieved by doing echo '<pre>'; print_r($data->abc_def_ghi); echo '</pre>';
[abc_def_ghi] => Array
    (
        [0] => no
        [1] => yes
        [2] => yes
        [3] => nada
        [4] => nada
        [5] => nada
    )

In the JSON object array above, I want to add the default value nada for all the values above.  What I want to achieve is this on the 1st day of every month.
[abc_def_ghi] => Array
    (
        [0] => nada
        [1] => nada
        [2] => nada
        [3] => nada
        [4] => nada
        [5] => nada
    )

This is what I have tried but it is deleting the json object array from the whole json.
$isSet = true;
if((date('j') == 1) && $isSet)
{
    unset($data->abc_def_ghi);
     $isSet=false;
}

Problem Statement:
I am wondering what changes I should make in the php code above so that so all the default values are present in the json object array when
it 1st day of every month.


text:
Q: Is there a way to align the middle of the circle to the top of the grey rectangles? I'd like the circles to be vertically aligned so that the middle of the circle is in line with the top of the div box.
Is there a way to make it the "most responsive" if that makes sense.
CSS:
    #feature .feature-thumb {
      background-color: #eaeaea;
      position: relative;
      padding: 40px;
      margin-top: 32px;
    }

    #feature .feature-icon {
      background-color: #64beeb;
      width: 85px;
      height: 85px;
      margin: 0 auto;
      top: 0;
      position: relative;
      -webkit-border-radius: 50%;
      -moz-border-radius: 50%;
      -ms-border-radius: 50%;
      border-radius: 50%;
      display: table;
      text-align: center;
      vertical-align: middle;
      transition: all 0.4s ease-in-out;
    }

    #feature .feature-icon:hover {
      background-color: #eaeaea;
    }

    #feature .feature-icon span {
      display: table-cell;
      vertical-align: middle;
    }
    #feature .feature-icon .fa {
      color: #ffffff;
      font-size: 36px;
      margin: 0;
      padding: 0;
    }

Codepen Demo

A: If You want to adjust that icon circle only small screens you can use media query @media for that and then you can style which you want.
And If you want this for all screen you can use this style as well outside of media query in you icon class style which you are already using.
Here is the solved example of your project
@media screen and (max-width: 768px) and (min-width: 320px){
   #feature .feature-icon {
      top:-70px;
   }
}

Codepen

A: You need to set feature_icon with the following style:
position: absolute;
margin-top: -42.5px;
left: 50%;
margin-left: -42.5px;

And you need to set the padding on #feature .feature-thumb
padding:0px 40px 40px 40px;

This will get you started .. You'll still have to push your text down with either padding or margin because it will be alinged to the top of the gray box with this CSS change.

A: Try the following:
#feature .feature-icon {
  background-color: #64beeb;
  width: 85px;
  height: 85px;
  top: 0; /* Changed here */
  left: 50%; /* Changed here */
  position: absolute; /* Changed here */
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  -ms-border-radius: 50%;
  border-radius: 50%;
  display: table;
  text-align: center;
  vertical-align: middle;
  transition: all 0.4s ease-in-out;
  transform: translate(-50%, -50%); /* Changed here */
  -webkit-transform: translate(-50%, -50%); /* Changed here */
  -ms-transform: translate(-50%, -50%); /* Changed here */
  -o-transform: translate(-50%, -50%); /* Changed here */
  -moz-transform: translate(-50%, -50%); /* Changed here */
}


text:
Q: Scraping: cannot extract content from webpage I am trying to scrape the news content from the following page, but with no success.
https://www.business-humanrights.org/en/latest-news/?&search=nike
I have tried with Beautifulsoup :
r = requests.get("https://www.business-humanrights.org/en/latest-news/?&search=nike")
soup = BeautifulSoup(r.content, 'lxml')
soup

but the content that I am looking for - the bits of news that are tagged as div class = 'card__content', do not appear in the soup output.
I also checked, but I could not find any frames to switch to.
Finally, I tried with phantomjs and the following code but with no success:
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

url = "https://www.business-humanrights.org/en/latest-news/?&search=nike"
driver = webdriver.PhantomJS(executable_path= '~\Chromedriver\phantomjs-2.1.1-windows\bin\phantomjs.exe')

driver.get(url)
time.sleep(7)
page = driver.page_source
driver.quit()
soup = BeautifulSoup(page, 'html.parser')
container = soup.find_all('div', attrs={
    'class':'card__content'})
print(container)

I am running out of options, anyone can help?

A: Use API
import requests

r = requests.get("https://www.business-humanrights.org/en/api/internal/explore/?format=json&search=nike")

print(r.json())

A: I didn't understand why you're facing this. I tried the same above but not with requests and bs4. I used requests_html. xpaths can be used directly in this library without any other libraries.
import requests_html

session = requests_html.HTMLSession()
URL = 'https://www.business-humanrights.org/en/latest-news/?&search=nike'
res = session.get(URL)

divs_with_required_class = res.html.xpath(r'//div[@class="card__content"]')

for item in divs_with_required_class:
    print(f'Div {divs_with_required_class.index(item) + 1}:\n', item.text, end='\n\n')

A: driver.page_source returns initial HTML-doc content no matter how long you wait (time.sleep(7) has no effect).
Try below:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver.get(url)
cards = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, "//div[@class='card__content' and normalize-space(.)]")))
texts = [card.text for card in cards]
print(texts)
driver.quit()


text:
Q: Javascript setTimeout works on desktop, not on android? I have a function that plays an different audio file at random every n seconds (based on input from a web page) when the user hits start.  As you would expect, it stops when they hit stop.
It works fantastic on my desktop (using chrome), but I've tried it on two different android devices (note 4 and note 8) in chrome but it will only play the audio once before bailing.
Workflow: User clicks start, the function startstop is called.  If it's the start button, play the audio and create a timeout with n seconds (plus 2 to allow each audio file to play through)
If it's the stop button, clear the timeout, pause any audio, and reset the button to start.
var audiofiles = ['audio/Are your fingers curved.mp3','audio/Curve fingers.mp3','audio/Curve them up.mp3','audio/Curve them.mp3','audio/Curve your fingers.mp3','audio/Curve.mp3']

var playSounds;
var audio;

function startstop()
{
    var text = document.getElementById("StartStop").firstChild;
    if (text.innerHTML == 'Start')
    {
        if (!validateInputValue())
        {
            return;
        }
        playAudio();
        text.innerHTML = 'Stop';
    }
    else
    {
        clearTimeout(playSounds);
        audio.pause();
        text.innerHTML = 'Start';
    }
}

function playAudio()
{
    var delta = document.getElementById("timeDelta").value;
    delta = parseInt(delta, 10) + 2; // add two since they're all about two seconds.  Easier than blocking when you play a file.

    var fileToPlay = audiofiles[Math.round(Math.random() * (audiofiles.length - 1))];
    audio = new Audio(fileToPlay);
    audio.play();

    playSounds = setTimeout(playAudio, delta*1000);
}

function validateInputValue()
{
    document.getElementById("warning").innerHTML = "   ";

    //Get the value to evaluate
    delta = parseInt(document.getElementById("timeDelta").value, 10);

    if (delta < 0 || delta > 300)
    {
        document.getElementById("warning").innerHTML = "Please enter a number from 0 to 300";
        document.getElementById("timeDelta").value = 30;
        return false;
    }
    return true;
}

I feel like I'm taking crazy pills.  The website is live, and can be found at susannavalleau.com/fingers. It's a silly web-app I'm making for my sister who's a piano teacher to remind her students to curve their fingers.

A: The issue is caused by most mobile browsers, which block videos and sounds from being played without user interaction (loading them may result in extra costs for the user, depending on their data contract).
So you can't use new Audio() after a setTimeout. What you can do, however, after at least one user interaction, is replace the src of an audio element and make it play. The good news is: you do require at least one user interaction already.
1. First step, add an <audio> element in your HTML:
<audio id="sound"></audio>

2. When the page is done loading the HTML, save that element in the audio variable, by adding this at the end of your code:
window.addEventListener('DOMContentLoaded', function(){
    audio = document.getElementById('sound');
});

3. In your playAudio function, instead of using audio = new Audio(), do this:
audio.src = fileToPlay;


text:
Q: ANTLR lexer error: no viable alternative at character '\n' I am writing an ANTLR parser that attempts to recognize GDB backtrace output from a given input string.
I'm ignoring new lines with the following lexer grammar:
RETURN : ('\r' | '\n' | '\r\n') { skip(); };

However, when I run the parser against some input, ANTLR gives the following lexer error:
line 20:21 no viable alternative at character '\n'
line 23:14 no viable alternative at character '\n'
line 30:21 no viable alternative at character '\n'
line 33:31 no viable alternative at character '\n'

I am not sure why this would ever happen, since I have already specified '\n' in the lexer.
Does anybody has any ideas? Thanks.

A: It looks like the problem is elsewhere in your grammar: it is still lexing a different element  that has not yet ended, and unexpectedly encountered the end of line while it was still expecting to finish the current element.


text:
Q: Spark (Scala) - how to optimize objective function parameters I have function f going from R2 to R which takes 2 parameters (a and b) and returns a scalar.
I would like to use an optimizer to estimate the values of a and b for which the value returned by f is maximized (or minimized, I can work with -f).
I have looked into the LBFGS optimizer from mllib, see:

*

*the doc at https://spark.apache.org/docs/2.1.0/api/scala/index.html#org.apache.spark.mllib.optimization.LBFGS and https://spark.apache.org/docs/2.1.0/api/scala/index.html#org.apache.spark.mllib.optimization.LBFGS$

*an example for logistic regression at https://spark.apache.org/docs/2.1.0/mllib-optimization.html
My issue is that I am not sure I fully understand how this optimizer works.
The optimizers I have seen before in python and R usually expect the following parameters: an implementation of the objective function, a set of initial values for the parameters of the objective function (and optionally: additional arguments for the objective function, boundaries for the domain within which the parameters should be searched...).
Usually, the optimizer invokes the function iteratively using a set of inital parameters provided by the user and calculates a gradient until the value returned by the objective function has converged (or the loss). It then returns the best set of parameters and corresponding value of the objective function. Pretty standard stuff.
In this case, I see org.apache.spark.mllib.optimization.LBFGS.runLBFGS expects to be given an RDD of labeled data and a gradient.

*

*What is this data RDD argument the optimizer is expecting?

*Is the argument gradient an implementation of the gradient of the objective function?

*If I am to code my own gradient for my own objective function, how should the loss function be calculated (ratio of the value returned by the objective function at iteration n / (n-1)?

*What is the argument initialWeights? Is it an array containing the initial values of the parameters to be optimized?

*Ideally, would you be able to provide a very simple code example showing how a simple objective function can be optimized using org.apache.spark.mllib.optimization.LBFGS.runLBFGS?

*Finally, could Breeze be an interesting alternative? https://github.com/scalanlp/breeze/blob/master/math/src/main/scala/breeze/optimize/package.scala
Thanks!