text:
Q: how to run springboot maven project in weblogic from eclipse for development i have a springboot webservices project created in eclipse neon and working fine with embeded tomcat provided by spring boot, but i want my spring-boot maven webservices project to be run on weblogic instead of tomcat because at the end of the day we are going to deploy our project in welogic as a webservices which will be used by angulr5 ui.
what i tried so far.
my pom.xml looks something like this.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>springboot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>springboot</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>-->

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>tomcat-embed-el</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <artifactId>tomcat-embed-el</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

my src->main->webapp->WEB-INF->weblogic.xml is,
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j.*</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
</wls:weblogic-web-app>

i'm getting this error.
.
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000
.
CLASSPATH=C:\PROGRA~1\Java\JDK18~1.0_1\lib\tools.jar;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\lib\weblogic.jar;C:\Oracle\MIDDLE~1\ORACLE~1\oracle_common\modules\net.sf.antcontrib_1.1.0.0_1-0b3\lib\ant-contrib.jar;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\modules\features\oracle.wls.common.nodemanager.jar;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\common\derby\lib\derbynet.jar;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\common\derby\lib\derbyclient.jar;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\common\derby\lib\derby.jar
.
PATH=C:\Oracle\MIDDLE~1\ORACLE~1\USER_P~1\domains\BASE_D~1\bin;;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\native\win\x64;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\bin;C:\Oracle\MIDDLE~1\ORACLE~1\oracle_common\modules\org.apache.ant_1.9.2\bin;C:\PROGRA~1\Java\JDK18~1.0_1\jre\bin;C:\PROGRA~1\Java\JDK18~1.0_1\bin;C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\native\win\x64\oci920_8;C:\PROGRA~1\Java\JRE18~1.0_1\bin\server;C:\PROGRA~1\Java\JRE18~1.0_1\bin;C:\PROGRA~1\Java\JRE18~1.0_1\lib\amd64;C:\PROGRA~3\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WINDOW~1\v1.0\;C:\PROGRA~1\TORTOI~1\bin;C:\PROGRA~1\Intel\WiFi\bin\;C:\PROGRA~1\COMMON~1\Intel\WIRELE~1\;C:\PROGRA~1\nodejs\;C:\PROGRA~1\Java\JDK18~1.0_1\bin;D:\softwares\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin;C:\Users\Adarsha\AppData\Local\MICROS~1\WINDOW~1;C:\Users\Adarsha\AppData\Roaming\npm;C:\PROGRA~1\Java\JDK18~1.0_1\bin;D:\softwares\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin;C:\PROGRA~1\MICROS~2\bin;D:\softwares\eclipse
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http:\\hostname:port\console        *
***************************************************
Starting WLS with line:
C:\PROGRA~1\Java\JDK18~1.0_1\bin\java -server   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -Dweblogic.Name=AdminServer -Djava.security.policy=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\lib\weblogic.policy -Xverify:none  -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader  -javaagent:C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server\lib\debugpatch-agent.jar -da -Dwls.home=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server -Dweblogic.home=C:\Oracle\MIDDLE~1\ORACLE~1\wlserver\server      weblogic.Server
<16 Jan, 2018 5:18:57 PM SGT> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>
<16 Jan, 2018 5:18:58 PM SGT> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.>
<16 Jan, 2018 5:18:58 PM SGT> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.152-b16 from Oracle Corporation.>
<16 Jan, 2018 5:18:58 PM SGT> <Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.>
<16 Jan, 2018 5:18:59 PM SGT> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.2.1.2.0 Mon Oct  3 04:35:36 PDT 2016 1827450>
<16 Jan, 2018 5:19:00 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<16 Jan, 2018 5:19:00 PM SGT> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.>
<16 Jan, 2018 5:19:00 PM SGT> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.>
<16 Jan, 2018, 5:19:01,707 PM SGT> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=1211306809
Current log file=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\servers\AdminServer\logs\AdminServer.log
Rotation dir=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\servers\AdminServer\logs
 is opened. All server side log events will be written to this file.>
<16 Jan, 2018, 5:19:01,927 PM SGT> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm>
<16 Jan, 2018, 5:19:02,215 PM SGT> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm>
<16 Jan, 2018, 5:19:02,729 PM SGT> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm>
<16 Jan, 2018, 5:19:03,304 PM SGT> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://192.168.0.221:7001/jndi/weblogic.management.mbeanservers.runtime.>
<16 Jan, 2018, 5:19:03,850 PM SGT> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://192.168.0.221:7001/jndi/weblogic.management.mbeanservers.domainruntime.>
<16 Jan, 2018, 5:19:04,93 PM SGT> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://192.168.0.221:7001/jndi/weblogic.management.mbeanservers.edit.>
<16 Jan, 2018, 5:19:04,842 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.>
<16 Jan, 2018, 5:19:04,843 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<16 Jan, 2018, 5:19:04,886 PM SGT> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.>
<16 Jan, 2018, 5:19:08,402 PM SGT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: weblogic.websocket.tyrus.TyrusServletFilter.
java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to org.glassfish.tyrus.server.TyrusServerContainer
    at weblogic.websocket.tyrus.TyrusServletFilter.init(TyrusServletFilter.java:80)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:400)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    Truncated. see log file for complete stacktrace
>
<16 Jan, 2018, 5:19:08,425 PM SGT> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
<16 Jan, 2018, 5:19:08,472 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.>
<16 Jan, 2018, 5:19:08,678 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.>
<16 Jan, 2018, 5:19:08,738 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,143 PM SGT> <Warning> <Server> <BEA-002611> <The hostname "Adarsha", maps to multiple IP addresses: 192.168.0.221, fe80:0:0:0:20a3:a0e4:2ddb:1b94%20, fe80:0:0:0:3c28:330d:88b4:e09d%7, 2001:0:9d38:6abd:3c28:330d:88b4:e09d.>
<16 Jan, 2018, 5:19:10,145 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 2001:0:9d38:6abd:3c28:330d:88b4:e09d:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,149 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,157 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.0.221:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,158 PM SGT> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "AdminServer" for domain "base_domain" running in development mode.>
<16 Jan, 2018, 5:19:10,158 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,159 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 2001:0:9d38:6abd:3c28:330d:88b4:e09d:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,160 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,161 PM SGT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.0.221:7001 for protocols iiop, t3, ldap, snmp, http.>
<16 Jan, 2018, 5:19:10,165 PM SGT> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
<16 Jan, 2018, 5:19:10,178 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
<16 Jan, 2018, 5:19:15,339 PM SGT> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Initializing callbacks>
<16 Jan, 2018, 5:19:15,341 PM SGT> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Added MBeanServerConnection in DomainRuntimeServiceMBean >
<16 Jan, 2018, 5:19:15,342 PM SGT> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Callback is done>
<16 Jan, 2018, 5:19:15,344 PM SGT> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=AdminServer : Connection already exists for the server. Did not attempt to connect to the server>
<16 Jan, 2018, 5:19:15,470 PM SGT> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=All Servers : Resolving connection list DomainRuntimeServiceMBean>
<16 Jan, 2018, 5:19:36,553 PM SGT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "142248479790392" for task "2" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.apache.tomcat.websocket.pojo.PojoEndpointBase"
weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.apache.tomcat.websocket.pojo.PojoEndpointBase
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.apache.tomcat.websocket.pojo.PojoEndpointBase
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1026)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:987)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83)
    at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:608)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:540)
    Truncated. see log file for complete stacktrace
>
<16 Jan, 2018, 5:19:36,568 PM SGT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 7 task for the application "_auto_generated_ear_" on [partition-name: DOMAIN].>
<16 Jan, 2018, 5:19:36,575 PM SGT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating start task for application "_auto_generated_ear_".>
<16 Jan, 2018, 5:19:36,575 PM SGT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.apache.tomcat.websocket.pojo.PojoEndpointBase
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.apache.tomcat.websocket.pojo.PojoEndpointBase
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1026)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:987)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83)
    at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:608)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:540)
    Truncated. see log file for complete stacktrace

Please help me resolve this.


text:
Q: Why are the Robospice response listener methods not being called? I'm using Retrofit with RoboSpice. I'm making REST calls ok in places, but one call is a problem as the response listener is never called - neither onRequestFailure() nor onRequestSuccess()
Activity
...after a user selects a UI option
CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest("1001", "John", "Smith");
this.getSpiceManager().execute(createCustomerRequest, new CreateCustomerRequestListener());

private class CreateCustomerRequestListener implements com.octo.android.robospice.request.listener.RequestListener<ErrorResponse> {

    @Override
    public void onRequestFailure(SpiceException spiceException) {
        // Never called
    }

    @Override
    public void onRequestSuccess(ErrorResponse errorResponse) {
        // Never called
    }
}

Request
public class CreateCustomerRequest extends RetrofitSpiceRequest<ErrorResponse, EmbarApi> {

private String id;
private String firstName;
private String lastName;

public CreateCustomerRequest(String id, String firstName, String lastName) {
    super(ErrorResponse.class, EmbarApi.class);
    this.id = id;
    this.firstName = firstName;
    this.lastName= lastName;
}

@Override
public ErrorResponse loadDataFromNetwork() throws Exception {
    return getService().createCustomer(id, firstName, lastName);
}

I'm baffled as to why the listeners are not being called. I'm seeing very little logging from RS (just "main adding request to request queue")which seems strange, but as far as I can see RoboSpice is failing completely, but entirely silently. It's particularly confusing as I am making other REST calls within the app without issue.

A: I hope yout didn't forget to call spiceManager.start and spiceManager.shouldStop functions.
They should be called at onStart and onStop functions at that context respectively.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cakephp Website URL input validation I tried some regular expressions for website URL validation that only accept URLs starting with www. (not http:// or https://), but none fit my needs.
I tried : (?<!:\/\/)www\..+\.[a-z]{2,3}  but that accepts URLs with other characters before www., like adswww.website.com.  I only want to accept URLs that start with www..
cakephp v : 2.6

A: You can try for example with:
(?<!:\/\/)www\..+\.[a-z]{2,3}

A: You can resolve your problem by using
/^www\..+\.[a-z]{2,3}/


text:
Q: Looking for alternative ways to solve $3^{2^x}=2^{3^x}$
If $\log2=m$ and $ \log3=n$, What is the answer of
$\large3^{2^x}=\large2^{3^x}$? $1)\log
 mn\quad\quad\quad\quad\quad\quad2)\frac{m-n}{\log m-\log
 n}\quad\quad\quad\quad\quad\quad3)\frac{\log \frac
 mn}{m-n}\quad\quad\quad\quad\quad\quad4)\frac{m+n}{\log mn}$

Here is my approach:
To solve the equation I took logarithm in base $3$ of both sides of the equation:
$$2^x=\log_32^{3^x}=3^x\log_32=3^x\times\frac{m}{n}$$
So we have $(\frac23)^x=\frac mn$. by taking logarithm in base $\frac23$ we have:
$$x=\log_{\large\frac23}(\frac mn)=\frac{\log(\frac mn)}{\log(\frac23)}=\frac{\log \frac mn}{m-n}$$

My questin: Is there other approach to solve this problem?

A: You could take natural log. It will reduce the change of base steps
$\Rightarrow 2^x\log 3 = 3^x\log 2 \\\Rightarrow (\frac23)^x =\frac mn \\\Rightarrow x\log(\frac23) = x(m -n) = \log(\frac mn)\\
\Rightarrow \boxed{x = \frac{\log \frac mn}{m-n}}  $

A: Start  with $\large3^{2^x}=\large2^{3^x}$,
Take logarithm 1st time:
\begin{align}2^x\ln 3=3^x\ln2,  \frac{\ln 3}{\ln 2}= (\frac{3}{2})^x \end{align}
Take logarithm 2nd  time:
\begin{align}\ln (\frac{\ln 3}{\ln 2})=x(\ln 3-\ln 2),x=\frac{\ln (\frac{\ln 3}{\ln 2})}{\ln 3-\ln 2}\end{align}
Replace $\ln 3$  and $\ln 2$ with m and n:
\begin{align} x=\frac{\ln (\frac{m}{n})}{m-n}\end{align}

A: Semi-alternative approach : defer taking logarithms to the end.
$\log 2 = m, ~\log 3 = n \implies e^m = 2,
~e^n = 3 \implies $
$\displaystyle 2^x = (e^m)^x = e^{mx}, ~3^x = (e^n)^x = e^{nx}.$
Therefore,
$\displaystyle 3^\left({2^x}\right) = 3^{\left(e^{mx}\right)}
= \left(e^{nx}\right)^{\left(e^{mx}\right)}
= e^{(nx) \times \left(e^{mx}\right)}.$
Similarly,
$\displaystyle 2^\left({3^x}\right) = 2^{\left(e^{nx}\right)}
= \left(e^{mx}\right)^{\left(e^{nx}\right)}
= e^{(mx) \times \left(e^{nx}\right)}.$
Therefore,
$$ e^{(nx) \times \left(e^{mx}\right)}
= e^{(mx) \times \left(e^{nx}\right)}.$$
Now, you can take logarithms of each side:
$\displaystyle (nx) \times \left(e^{mx}\right)
= (mx) \times \left(e^{nx}\right) \implies $
$\displaystyle \frac{m}{n} = \frac{mx}{nx}
 = \frac{e^{mx}}{e^{nx}}.$
Taking logarithms again,
$\displaystyle \log{\frac{m}{n}} = mx - nx = (m-n)x \implies
\frac{\log{\frac{m}{n}}}{m - n} = x.$


text:
Q: Cannot get option from select if position is set to absolute? It appears than when I attempt to set my phonebook's CSS position to absolute, I simply lock the select element. Relevant HTML/CSS below. When I remove the position: absolute; from the code, it runs perfectly fun; however, my HTML gets pushed down which is what I'm trying to avoid.
HTML

  <select id="catalog">
    <option value="u_none">None</option>
    <option value="u_1">John Doe (555-555-1254)</option>
    <option value="u_2">Jane Doe (555-555-2894)</option>
  </select>

      Role or Title

      Full Name

      Contact:

      Telephone: 555-555-5555

      Email: name.lastname@domain.com

      Room: A-5555

      Mail Stop: A-555

CSS
#phonebook {
  position: absolute;
  width: 320px;
  z-index: -1;
}

#employee-info {
  border: 1px solid #aaa;
  border-top: 0 none;
}

#employee-content {
  padding: 10px;
}

#catalog {
  position: relative;
  border: 1px solid #aaa;
  width: 100%;
  z-index: 1;
}

I've tried to play around with z-index -- at the suggestion of a somewhat unrelated post -- but it still seems to do me no good. I need this element in a specific portion and it relies heavily on using this dropdown select element.
Is there anyway to overcome this issue? I'm not exactly sure what is preventing my access to the select dropdown. An explanation would also be awesome.
Thanks ahead. Any help is appreciated.

A: There must be more to it, because when I put your exact code into a snippet, it works fine. I see no difference with and without the position: absolute;
Please edit your question to put the code in a snippet (or jsfiddle) that shows the problem.

#phonebook {
  position: absolute;
  width: 320px;
  z-index: -1;
}
#employee-info {
  border: 1px solid #aaa;
  border-top: 0 none;
}
#employee-content {
  padding: 10px;
}
#catalog {
  position: relative;
  border: 1px solid #aaa;
  width: 100%;
  z-index: 1;
}

  <select id="catalog">
    <option value="u_none">None</option>
    <option value="u_1">John Doe (555-555-1254)</option>
    <option value="u_2">Jane Doe (555-555-2894)</option>
  </select>

      Role or Title

Full Name

Contact:

Telephone: 555-555-5555

Email: name.lastname@domain.com

Room: A-5555

Mail Stop: A-555


text:
Q: sqoop won't connect to mysql I am trying to connect Sqoop with Mysql. Before I asked this question I have tried all of the solutions I searched for, but nothing worked for me.
This is what I'm typing

/usr/local/hadoop/sqoop/lib$ sqoop list-databases --connect  jdbc:mysql://localhost:3306/testDb --username Amel --password
> Amel@-1998;

I do have a SQLConnector installed in /usr/local/hadoop/Sqoop/lib/ directory.
It's called: mysql-connector-java_8.0.25-1ubuntu20.04_all.deb
I had installed the .deb file
this is the error that comes up everytime.
Warning: /usr/local/hadoop/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/hadoop/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/hadoop/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/hadoop/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
21/07/09 20:48:11 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
21/07/09 20:48:11 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
21/07/09 20:48:11 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
21/07/09 20:48:11 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
    at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:875)
    at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
    at org.apache.sqoop.manager.CatalogQueryManager.listDatabases(CatalogQueryManager.java:57)
    at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:49)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:252)


text:
Q: What is the best way to do incremental backups in MySQL? We are using MySQL version 5.0 and most of the tables are InnoDB. We run replication to a slave server. We are thinking of backing up the MySQL log files on a daily basis.
Questions

*

*Is there any other way of doing an incremental backup without using the log files?

*What are the best practices when doing incremental backups?

A: AFAIK the only way of doing incremental backups is by using the binary-log. You have other options if you want to do full backups (InnoDB hotcopy), but incremental means that you need to log all transactions made.
You need to ask yourself why you're backing up data. Since you have a slave for replication, I assume the backup is primarly for reverting data in case of accidental deletion?
I would probably rotate the logs every 1 hour and take a backup of it. Meaning, restoring would leave the data at most 1 hour old, and you can restore to any point in time since the last full snapshot.

A: You can dump your schemas regularly with mysqldump, using always the same file name and path for each schema (i.e. replacing the latest one)
Then combine that with any backup tool that supports incremental/delta backup, for example rdiff-backup, duplicity, Duplicati or Areca Backup. An example from duplicity docs:

Because duplicity uses librsync, the incremental archives are space
  efficient and only record the parts of files that have changed since
  the last backup

That way your first backup would be the compressed copy of the 1st full dump, and the second would contain the compressed differences from the 1st and 2nd dump and so on. You can restore the mysqldump file of any point in time and then restore that file into MySQL.

A: A lot of time has passed since the last answer, and during this time several solutions and tools have appeared for implementing incremental backups.
Two main ones:

*

*Percona XtraBackup - is an open-source hot backup utility for MySQL -
based servers that doesn't lock your database during the backup. It
also allows you to create incremental backups.  More details here.
It's pretty simple and looks something like this:
xtrabackup --backup --target-dir=/data/backups/inc1 --incremental-basedir=/data/backups/base

*mysqlbackup is an utility, that is included in the mysql enterprise
edition. It is a lot like percona xtrabackup. A detailed comparison
can be found here
It has the parameter --incremental which allows you to make incremental backups. More details here
mysqlbackup --defaults-file=/home/dbadmin/my.cnf --incremental --incremental-base=history:last_backup --backup-dir=/home/dbadmin/temp_dir --backup-image=incremental_image1.bi backup-to-image

These two utilities make physical backups (copy database files), but you can still make logical backups of binlog files.
You can either write a script by yourself or use a ready-made script from github:
macournoyer/mysql_s3_backup
Abhishek-S-Patil/mysql-backup-incremental
There are also paid solutions that are, in fact, beautiful wrappers for these tools:
SqlBak
databasethink
What are the best practices when doing incremental backups?
It all depends on your architecture, the amount of data, the maximum allowable downtime interval that is acceptable for you. The maximum allowable data loss interval. Consider these things before setting up backups.
I would like to mention only one good practice, but very important, and which is very often forgotten. Test and run the recovery script regularly on another unrelated server.


text:
Q: How to implement jQuery direct upload to Cloudinary on node.js I'm trying to implement direct uploads to Cloudinary via their jQuery plugin to a Node.js application, and am wondering if anyone can help me close some gaps in their examples.
Here's the blog post that explains how to do it:
http://cloudinary.com/blog/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery
In the "Other development frameworks and advanced usage" section, the part I'm stuck on is:

*

*"Set data-form-data to be JSON representation of the upload API params. The mandatory fields are api_key, timestamp, signature and callback.",

and more specifically:

*

*"The signature needs to be generated on the server-side for correct authentication."

There doesn't seem to be any example of exactly how to achieve this.
The examples are:
<input name="file" type="file"
       class="cloudinary-fileupload" data-cloudinary-field="image_upload"
       data-form-data=" ... html-escaped JSON data ... " ></input>

and the unescaped JSON content of data-form-data is:
{ "timestamp":  1345719094,
  "callback": "https://www.example.com/cloudinary_cors.html",
  "signature": "7ac8c757e940d95f95495aa0f1cba89ef1a8aa7a",
  "api_key": "1234567890" }

How do you go about generating the signature? I understand I need to do this in node.js, and it seems like it needs to happen when the form is generated, although from what I can tell the signature needs to include the timestamp - which would surely be outdated by the time the user has filled out the form?
The documentation for request authentication is here: http://cloudinary.com/documentation/upload_images#request_authentication
In the cloudinary_npm module, which I am using, there is a method in uploader.coffee called direct_upload which seems like a helper to make this happen, but I'm not clear on how to actually bind it all together.
The two frameworks with real examples in the blog post, Rails and Django, abstract this complexity through their own helpers, e.g. in Django you add {{ form.image }} to your form, which outputs the result from image = cloudinary.forms.CloudinaryJsFileField() - unfortunately how to replicate this in any other server-side environment is not covered.
If anyone can shed any light on this, or share a gist or example on how to make it work end-to-end, I'd greatly appreciate it.

A: Please take a look at the uploader.image_upload_tag at https://github.com/cloudinary/cloudinary_npm/blob/67b7096c7fac2c2bed06603912966495d59dfa34/lib/uploader.coffee#L220
It returns the html for an input tag that can be used together with jquery.cloudinary.js to upload images directly to cloudinary.
It will be part of the next release of the npm (expected sometime next week).
As for the timestamp - the signature is valid for 1 hour, so there should be plenty of time for the user to upload the image.

A: if you are using nodejs, this may help
var querystring = require('querystring');

var toHash = querystring.stringify(req.query) + secret;

var signature = sha1(toHash);

function sha1(data) {
var generator = crypto.createHash('sha1');
generator.update(data)
return generator.digest('hex')
}


text:
Q: javascript add style remove style i have a simple javascript that add style to a slider when is turn to show, but i want to remove the style when the next slider come and also on mouse over remove the both style.
This is my javascript function that add style="width: 200px" to new slider and add style="width: 200px" to old.
function test(){
    var read = document.getElementById("slide-0") // how can i add here to read the incremented slide-0, slide-1, slide-2
        .removeAttribute("style",0);
}

    function noEffect(pOld,pNew){

        if (pOld){
            pOld.style.width='10px';
        }

        if (pNew){
            pNew.style.width='200px'; //this style become on active slider.
        }
    }

Slider html

Exactly what i want is to remove the style on both on mouseover.
Any help is appreciated.

A: specify 0px
pOld.style.width='0px';

A: A very nice solution would be to uses classes. Instead of adding a style, add and remove classes. The following code adds a class to the component that will be styled.
var d = document.getElementById("div1");
d.className = d.className + " widthAlteration";

And in your CSS have:
.widthAlteration
{
    //width alteration
}

And if you would want to revert the effect, just do the same:
var d = document.getElementById("div1");
d.className = "";

Or for convenience there is integrated command for that:
var ele = document.getElementById("div1");
addClass(ele, "widthAlteration");
// or
removeClass(ele, "widthALteration");

Seeing as the previous part was not working, I will suggest jQuery
Implement the .js file in your project and use jQuery. It is one of the most commonly used libraries. It is rare to see JS done in raw (maybe if you only need to perform a simple operation), but in general cases, jQuery is the way to go.
After implementing, add this to your project:


text:
Q: "Ban transitive dependencies" causes build to fail even though it apparently worked before I'm trying to build WildFly 10.1.0.Final from source.
The build causes a "ban transitive dependencies" rule to be violated:
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BanTransitiveDependencies failed with message:
org.wildfly:wildfly-feature-pack:pom:10.1.0.Final
   org.apache.cxf:cxf-rt-features-clustering:jar:3.1.6:compile has transitive dependencies:
      xalan:xalan:jar:2.7.1.jbossorg-2:compile
         xalan:serializer:jar:2.7.1.jbossorg-2:compile

This causes the build to fail:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18:46 min
[INFO] Finished at: 2018-02-21T22:22:47Z
[INFO] Final Memory: 213M/512M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (ban-transitive-deps) on project wildfly-feature-pack: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]

I am sure that it must have worked at some point - WildFly is a pretty active open source project and can't imagine a release would have reached Final if it was not even able to build.
I might be missing something (as I have never used Ban Transitive Dependencies before) but I can't understand what has changed between then and now.
First of all, as expected, wildfly-feature-pack does depend on cxf-rt-features-clustering. Furthermore, we can note that it has a parent of wildfly-parent. Finally, the "ban-transitive-deps" rule is specified in this project itself. These things can all be seen in its POM.
The version of cxf-rt-features-clustering is fixed in the parent POM at the value ${version.org.apache.cxf} which is defined in the same POM as "3.1.6".
Looking at the POM for that artifact, it doesn't even depend on xalan:xalan. However, it does depend on a whole load of other things. Wouldn't these cause the "ban transitive dependencies" rule to fail? And why does the Maven enforcer plugin "think" that it does depend on xalan:xalan?
Furthermore, why does the enforcer output even show that xalan:xalan depends on another artifact? Surely it's enough to violate the rule that wildfly-feature-pack depends on cxf-rt-features-clustering and cxf-rt-features-clustering depends on xalan? Doesn't that alone mean that wildfly-feature-pack has a transitive dependency?
I think I may be misunderstanding the whole "ban transitive dependencies" rule itself. The official documentation is not really very helpful, it just says that this "rule bans all transitive dependencies", which is pretty obvious.

A: That means that you configured enforcer plugin with that rule that does not allow to have not explicitly defined dependencies.
In this case you have to explicitly add to the POM these section:
<!-- https://mvnrepository.com/artifact/xalan/xalan -->
<dependency>
    <groupId>xalan</groupId>
    <artifactId>xalan</artifactId>
    <version>2.7.1.jbossorg-2</version>
</dependency>

UPD: Based on my research Maven version is the reason here. Must be higher then 3.3.1.


text:
Q: My schtasks don't schedule anything. :( I'm trying to make a scheduled task, and its just not working for me.
This is the command I type in CMD:
schtasks /create /sc minute /mo 1 /tn test /tr calc.exe /st 19:17:00 /sd 12/14/2009
I'm trying to tell the computer to run calculator every minute starting at 7:09 PM. Although I get a success message after I type this in and hit enter, nothing happens at 7:09. What gives?
Thanks in advance.

A: Thank you popester, for the first time I get run a task using command line parameters. Waffles, my task has been created however, it also didn't run. So I added some parametters and now it works. Try:
schtasks /create /th test2 /tr "c:\temp\run.bat" /sc daily /st 18:10:00 /ru SRVIMG\Administrator /rp XXXXXXX

Where XXXXXXX is my administrator password

A: /st wants HH:mm, not HH:mm:ss.  The following works for me on Windows 7:
schtasks /create /sc minute /mo 1 /tn test /tr calc.exe /st 14:43 /sd 12/15/2009

Doc:
/ST   starttime    Specifies the start time to run the task. The time
                   format is HH:mm (24 hour time) for example, 14:30 for
                   2:30 PM. Defaults to current time if /ST is not
                   specified.  This option is required with /SC ONCE.

A: make sure that your task scheduler service is running as well. check in your "control panel" under "services"


text:
Q: Enviar e-mail para caixa de entrada através do botão enviar com dados de formulários preenchidos Eu tenho o seguinte código, em que quando acabo de preencher o formulário quero receber um e-mail com a confirmação dos dados e posteriormente abrir uma página em que irei redirecionar:
Contudo, após o código que apresento estou com algumas dificuldades em acabar;
Conseguem ajudar?

 Formulario

<form action="http://www.teste.com/" id="ContactUsCaptchaWebForm"    method="post" onsubmit="return ValidateForm(this);" target="_top">
     <input name="skip_WhereToSend" type="hidden" value="teste@teste.com"/>
     <input name="skip_SnapHostID" type="hidden" value="D2YEXZTGA4Q2" />
     <input name="skip_WhereToReturn" type="hidden" value="http://www.torangis.com/" />
     <input name="skip_Subject" type="hidden" value="Contact Us Form" />
     <input name="skip_ShowUsersIp" type="hidden" value="1" />
     <input name="skip_SendCopyToUser" type="hidden" value="1" />

             Nome *
            <input name="Name" type="text" maxlength="60" style="width:350px;" />

             E-mail *
            <input name="Email" type="text" maxlength="60" style="width:350px;" />

            Empresa / Loja (Se aplicável)
           <input name="Empresa" type="text" maxlength="43" style="width:350px;" />

            Concelho
           <input name="Concelho" type="text" maxlength="60" style="width:350px;" />

            Telemóvel *
           <input name="Telemovel" type="text" maxlength="43" style="width:350px;" />

            Mensagem opcional
           <textarea name="Comentario" rows="4" cols="50" style="width:350px;"></textarea>

 Inserir letras *
              <input name="skip_CaptchaCode" type="text" style="width:80px;" maxlength="6" />

                  Renovar imagem

        * Campos obrigatórios
        <form enctype="text/plain" method="get" action="mailto:teste@teste.com">
             <input type="submit" value="Enviar">
        </form>

</form>

        <?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ;
        $empresa = $_REQUEST['empresa'] ; $telefone = $_REQUEST['telefone'] ;
        $concelho = $_REQUEST['concelho'] ; $message = $_REQUEST['message'] ;
        mail( "teste@teste.com",
        "Quero fazer activações através do teste da teste",
        "#REVENDEDOR         ################################################################
        EMPRESA/LOJA:$empresa NOME:$name EMAIL: $email TELEFONE: $telefone
        CONCELHO:$concelho MENSAGEM: $message ", "from: teste@teste.com");
        header( "Location: http://teste.teste.com/resposta2.php" ); ?>

Muito Obrigado

A: Para facilitar, cria um arquivo separado para o envio, do jeito que está ele tentaria enviar sempre que o html for executado.
enviar_email.php
<?php
    $name = $_REQUEST['name'] ;
    $email = $_REQUEST['email'] ;
    $empresa = $_REQUEST['empresa'] ;
    $telefone = $_REQUEST['telefone'] ;
    $concelho = $_REQUEST['concelho'] ;
    $message = $_REQUEST['message'] ;

    @mail( "teste@teste.com",
    "Quero fazer activações através do teste da teste",
    "#REVENDEDOR         ################################################################
    EMPRESA/LOJA:$empresa NOME:$name EMAIL: $email TELEFONE: $telefone     CONCELHO:
    $concelho MENSAGEM: $message ", "from: teste@teste.com");

    header("Location: http://teste.teste.com/resposta2.php");
?>

no seu arquivo .html
substitua seu action do formulário por: <form action="http://www.teste.com/enviar_email.php" [...]>

Lembrando que, para testar localmente você precisa de um servidor smtp configurado; quando você utiliza From: ..., e o e-mail não for válido ou não fizer parte do seu domínio bem certo que receberá como span, ou nem chegará a receber dependendo do servidor que recebe o e-mail.


text:
Q: Jasper Reports NoClassDefFoundError I'm getting a NoClassDefFoundError error when trying to compile or run a Jasper report.
2012-06-13 14:46:26,710 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jahtest].[jahtest]] Servlet.service() for servlet jahtest threw exception
java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.xml.JRXmlDigesterFactory
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)

I have a set of java classes wrapped up in a war file and deployed in JBoss default/deploy folder.
I have the jasperreports-4.1.2.jar file in the JBoss default/lib folder so I can't see how there can be a classpath problem because all other jars in the lib folder can be seen.
My front-end app calls a HTTPServlet class which then uses reflection to call the class containing the Jasper code. Everything works fine up until the point where this line is called -
JasperDesign jasperDesign = JRXmlLoader.load(strCompiledReportFile);

The strCompiledReportFile is correct and exists. This all works when I run it through Eclipse, just not when called from my HTTPServlet class.
I'm at the point where I want to ditch Jasper because I've had so many issues with it so this is the last chance saloon.
Cheers for any help you might be able to offer.

A: I think you are missing few jars that jasper depends on at runtime.  Check this thread and make sure you have those jars in your classpath as well.

A: I'm not sure if it would also apply to your case, but I had a similar problem recently, where after failing to load a font ("problem reading font data"), Jasper Reports would start giving spurious java.lang.NoClassDefFoundError for many of its classes; this problem was caused because java.awt.Font.createFont(int fontFormat, InputStream fontStream) tried and failed to create a temporary file. The error happened inside Tomcat, but not inside Eclipse; what was happening was that Tomcat automatically configures its JVM to point to its temp folder instead of the default one, and Tomcat's temp folder had been deleted.

A: If you are trying to integrate jasper with springboot application check whether the .jrxml is in the resources folder.


text:
Q: Kerberos Ticket Hand-off No Good on Chrome on macOS X I am implementing Okta as a single-sign on provider in an enterprise environment of about 90 users. One of Okta's features is Desktop Single Sign On - the ability for users to be authenticated with Okta simply by virtue of having logged into their machine and thereby authenticating with the domain. The user simply opens a browser, goes to the company's Okta tenant URL, and they are logged in.
Without this feature, the user would be prompted for their credentials when loading up the Okta tenant URL.
DSSO is accomplished by the browser picking up a Kerberos ticket from the OS that itself is generated when the user authenticates with the Active Directory domain. The browser then hands this ticket back to the server, and the server communicates with the Okta cloud to authenticate the user.
The authentication flow in our environment goes like this:

*

*User logs into their machine. A kerberos ticket is generated upon login and authentication with the domain.

*User opens their browser, and either tries to access an Okta-protected/integrated app, or goes directly to their Okta portal.

*User is redirected by Okta to our load balancer, which terminates the request at the IWA web app on the web server

*IWA web app challenges the browser for authentication

*Browser grabs the Kerberos ticket from the OS and hands it to the load balancer, which passes it to the IWA web app

*IWA app validates the ticket and fetches user profile from AD

*IWA app generates and digitally signs an SSO token and sends it to the browser

*Browser returns the tokent to Okta via HTML form POST

*Okta completes the sign-in request and returns the user to the app with an SSO token

The process is failing on step 5, and I know this is the case because:

*

*Chrome prompts the user for NTLM credentials when the Okta tenant URL is requested

*This prompt happens before the IWA web app and the browser is configured properly for DSSO (per the documentation I linked at the beginning)

*The prompt does not happen on Chrome, Firefox, and Internet Explorer on Windows (DSSO works on Windows with Chrome, Firefox, and IE)

*This prompt does not happen in Safari on macOS X, but does happen with Chrome and Firefox in OS X

What I cannot figure out is why Chrome and Firefox are not picking up the Kerberos ticket from the OS in macOS X, but the same browsers in Windows are picking up the ticket without a hitch.
Steps I've tried:

*

*Setting Chrome's whitelist settings with the following terminal
commands (recommended by Okta's documentation):
$ defaults write com.google.Chrome AuthServerWhitelist
"*.example.com"
$ defaults write com.google.Chrome AuthNegotiateDelegateWhitelist
"*.example.com"

*Setting Chrome's whitelist settings with SimpleMDM configuration push (this method actually succeeded in pushing the settings to Chrome - proven by going to chrome://policy and seeing the settings)

*Uninstalling anti-virus

*Adding every possible FQDN to the list of servers whitelisted in step 2 - first just the servers we have whitelisted in Windows (because Windows actually works), and then a list of Okta servers recommended by Okta support

I still cannot get this feature to work and I am now trying to figure out if there's a way to troubleshoot the process Chrome uses to pickup the Kerberos ticket from the OS. Some kind of debugger for Chrome's Kerberos ticket pickup mechanism would be great, but I imagine no such thing is available.

A: It should work with :
$ defaults write com.google.Chrome AuthServerWhitelist '*.example.com'
$ defaults write com.google.Chrome AuthNegotiateDelegateWhitelist '*.example.com'

Please take note that i have replaced " with '


text:
Q: Mechanize submit We have a form which has a few separate submit buttons which do different actions.  The problem is I have a couple of buttons which have the following HTML:
<input type="submit" name="submit" value="Submit" class="submitLink" title="Submit" />
<input type="submit" name="submit" value="Delete" class="submitLink" title="Delete" />

Now you can't locate an element by value with the standard find_control function.  So I wrote a predicate function which would find my element, which I was then hoping to click in the following manner:
submit_button = self.br.form.find_control(predicate=submit_button_finder)
self.br.submit(submit_button)

However both submit and click internally call find element, and neither method allows you to add in the predicate keyword, so a call like this doesn't work either:
self.br.submit(predicate=submit_button_finder)

Is there anything I'm missing?!?
Update:
Added a helper function to retrieve all elements which meet the criteria as such:
def find_controls(self, name=None, type=None, kind=None, id=None, predicate=None, label=None):

  i = 0
  results = []

  try :
    while(True):
      results.append(self.browswer.find_control(name, type, kind, id, predicate, label, nr=i))
      i += 1
  except Exception as e: #Exception tossed if control not found
    pass
  return results

Then replaced the following lines:
submit_button = self.br.form.find_control(predicate=submit_button_finder)
self.br.submit(submit_button)

With:
submit_button = self.br.form.find_control(predicate=submit_button_finder)
submit_buttons = self.find_controls(type="submit")
for button in submit_buttons[:]:
  if (button != submit_button) : self.br.form.controls.remove(button)
self.br.submit()

A: A fairly ghetto workaround is to manually iterate through all the controls in the form in question and then remove the controls from the form that you do not want based on criteria. For instance:
for each in form.controls[:]:
  if each not "some criteria":
    form.controls.remove(each)

The best idea here is to limit the controls that you're iterating through to SubmitControl objects ONLY. This way, you'll limit the form to one submit button, and the browser.submit() method will have no choice of what to click.


text:
Q: Handle C assertions from python I used the following python code to compress a dicom file using GDCM:
    import gdcm

    reader = gdcm.PixmapReader()
    reader.SetFileName(str(source))
    if not reader.Read():
        raise BaseException("Could not read (pixmap) %s" % source)
    image = reader.GetPixmap()
    change = gdcm.ImageChangeTransferSyntax()
    change.SetForce(False)
    change.SetCompressIconImage(False)
    transfer_syntax = gdcm.TransferSyntax(gdcm.TransferSyntax.JPEG2000Lossless)
    change.SetTransferSyntax(transfer_syntax)
    change.SetInput(image)
    if not change.Change():
        raise BaseException("Could not change the Transfer Syntax: ")
    ....

In the line change.Change(), there's an assertion in GDCM source which may faile:
Assertion `((fragment_size + 1)/2 ) * 2 == ((image_height * image_width * numcomps * (bitsallocated/8) + 1)/ 2 )* 2' failed.

Unfortunately python process would be killed in the case of assertion failure at GDCM. Is there a way to handle such assertions (without having checked the conditions at python before calling change.Change())?

A: A way to handle this is to start a child process to call the C library, then raise an exception if the child process dies because of a C assert statement.

A: Reluctantly I checked the Dicom integrity using pydicom before compressing Dicom:
def check_dicom(dicom_file):
    p = dicom.read_file(dicom_file)
    assert p.SamplesPerPixel in (1, 3)
    if p.BitsAllocated % 8 != 0:
        return False

    # assert( ((fragment_size + 1)/2 ) * 2 == ((image_height * image_width * numcomps * (bitsallocated/8) + 1)/ 2 )* 2 );
    left = ((len(p.PixelData) + 1)/2 ) * 2
    right = ((p.Rows * p.Columns * p.SamplesPerPixel * (p.BitsAllocated/8) + 1)/ 2 )* 2
    if left != right:
        raise BaseException("DICOM attributes are in conflict with pixel data size")
    return True


text:
Q: JAVA: Empty values when passing to another class I am working on a program in which passing arrays to another class. However, when I try load the Class in which I passed a set of array values, there are no values in it. See my code:
Menu.java
public class Menu extends javax.swing.JFrame {

        private String[] menu;
        private Globals vars = new Globals();
        private DefaultTableModel grill;
        private DefaultTableModel seafoods;
        private DefaultTableModel rice;
        private DefaultTableModel drinks;
        private int menuCount;

        public Menu() {
            initComponents();
            this.setLocationRelativeTo(null);
            menuCount = vars.countMenu();
            menu = new String[menuCount];
            menu = vars.setMenu();
            grill = (DefaultTableModel) jTable1.getModel();
            seafoods = (DefaultTableModel) jTable2.getModel();
            rice = (DefaultTableModel) jTable3.getModel();
            drinks = (DefaultTableModel) jTable4.getModel();

            /*** SOME CODES HERE ***/

            /*** item_name, item_code, item_qty, item_price are arrays ***/
            /*** I have already tested them and they have values ***/

            if (noValue > 0) {
                JOptionPane.showMessageDialog(null, "Please input quantity");
                return;
            }

            if (count == 0) {
                JOptionPane.showMessageDialog(null, "Plese select some items");
                return;
            } else {
                Transaction trns = new Transaction();
                //JOptionPane.showMessageDialog(null, count);
                trns.setSelectedItems(item_name, item_code, item_qty, item_price, count);
                trns.setVisible(true);
                //this.setVisible(false);
            }
        }

        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Menu().setVisible(true);
                }
            });
        }

Transaction.java
public class Transaction extends javax.swing.JFrame {

    private String[] itemcode;
    private double[] qty;
    private double[] price;
    private String[] items;
    private String[] info;
    private static Scanner iRead;
    private int count;

    public Transaction() {
        initComponents();
        this.setLocationRelativeTo(null);

        itemcode = new String[count];

        DefaultListModel listModel = new DefaultListModel();
        String header = "| Item Code | Item Name | Price | Quantity";
        listModel.addElement(header);
        JOptionPane.showMessageDialog(null, count);

        lsItems.setModel(listModel);
    }
    public void setSelectedItems(String[] itm, String[] cd, double[] qnty, double[] prc, int itemCnt) {
        this.items = itm;
        this.itemcode = cd;
        this.qty = qnty;
        this.price = prc;
        this.count = itemCnt;
    }
}

I am trying to pass an array of values [setSelectedItems()] from Menu Class to Transaction class. However, When I load Transaction Class, no values received.


text:
Q: Dictionary manipulation in Python I have a piece of text and I have created a dictionary in python. It has words as keys, and the number of times the words has occurred in the text as values. This dictionary is sorted in decreasing value of the values field. Here is a snippet of my list:
[('the\n', 1644), ('and\n', 872), ('to\n', 729), ('a\n', 632), ('she\n', 541),
('it\n', 530), ('of\n', 514), ('said\n', 462), ('i\n', 410), ('alice\n', 386),
('in\n', 369), ('you\n', 365), ('was\n', 357), ('that\n', 280), ('as\n', 263),
('her\n', 248), ('at\n', 212), ('on\n', 193), ('all\n', 182), ('with\n', 181),
('had\n', 178), ('but\n', 170), ('for\n', 153), ('so\n', 151), ('be\n', 148),
('not\n', 145), ('very\n', 144), ('what\n', 136), ('this\n', 134),
('they\n', 130), ('little\n', 128), ('he\n', 120), ('out\n', 117),
('is\n', 108), ... ]

I want to print the 25 most frequent words. that is fairly simple and I have done it. The next part is to print the 25 most frequent words starting with the letter "f". How do I find this and append it to the list of 25 most frequent words?
Also, I have to add a rank of all the words. For example, in my dictionary, "the" will be ranked 1, "and" 2 and so on. How do I add a rank to the list of words?

A: One option is to use itertools.ifilter() and itertools.islice():
f_words = islice(ifilter(lambda x: x[0].startswith("f"), words), 25)
for word, count in f_words:
    print word.rstrip()

Instead of ifilter(), you can also use a generator expression:
f_words = islice((w for w, c in words if w.startswith("f")), 25)
for word in f_words:
    print word.rstrip()

Both these approaches have the advantage that you don't need to filter the whole list first -- the loop will stop after 25 words.

A: Just filter using a list comprehension:
f_words = [(word, freq) for (word, freq) in the_list if word.startswith('f')]

Since the original list is sorted, so will this one be. You can then just slice it to get the top 25: f_words[:25]


text:
Q: Can I have an horizontal panel using bootstrap? I currently use jquery mobile horizontal panel:
http://demos.jquerymobile.com/1.3.2/widgets/panels/
Is it possible to have the same using bootstrap?

A: You can absolutely do the above panels using Bootstrap.
Check the following Third Party Libraries.
http://rosskevin.github.io/bootstrap-material-design/material-design/drawers/
http://carolineamaba.com/bootstrap-drawer/
Easy tutorials are available in w3schools.com
https://www.w3schools.com/howto/howto_js_sidenav.asp


text:
Q: Browser hangs when I try to upload files to S3 I have a code which upload user's image to s3 when user login to my application. This is deployed on my staging environment and works perfectly. When I deployed this code to my production environment and tried to login to my application, my browser hangs when user's image is tried to uploaded to s3 and image is also not uploaded to s3. The same happens even when I try to list all my buckets using s3 object. I enabled access logs it also doesn't show anything.
My staging environment and production environment are different aws instances and both have different sub domain names. Will I have to use different AWS keys for different instances or I am missing something ?
    $s3 = new S3($this->AWSAccessKey,$this->AWSSecretKey);
    $bucketName = $this->s3BucketName;
    $s3->getBuckets();  // List all my buckets
    $s3->putFile($data['profilePicture'], $bucketName.'/'.$filename,
                    array(S3::S3_ACL_HEADER =>
                            S3::S3_ACL_PUBLIC_READ,
                            S3::S3_CONTENT_TYPE_HEADER => $contentType)
            );  // Upload file to s3

I am using zendservice/amazon package to upload images to s3


text:
Q: Winforms DataRepeater Catch Data Changed
I have a WinForm with a Visual Basic Power Packs - DataRepeater control and on this control I have a check box that is Data Bound to a Boolean Field in my Database.  The Database is just XML with XSD.
Me.AutoDownloadCheckBox.DataBindings.Add(New System.Windows.Forms.Binding("CheckState", Me.TVSeriesBindingSource, "AutoDownload", True))

I tried to catch the click event of the check box and it throws the event when the check box is checked.  But the changes are not saved.
Imports TvSeriesData
Imports System.IO

Public Class Repeater

    Private LocalDS As New TVSeriesDB

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        Dim TempFile As FileInfo
        TempFile = New FileInfo(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "TvLinks" & "\TVSeriesDB.xml")
        If TempFile.Exists Then
            LocalDS.ReadXml(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "TvLinks" & "\TVSeriesDB.xml")
        End If

        DataRepeater1.DataSource = LocalDS.TVSeries

    End Sub

    Private Sub AutoDownloadCheckBox_Click(sender As Object, e As EventArgs) Handles AutoDownloadCheckBox.Click
        If LocalDS.HasChanges() Then LocalDS.AcceptChanges()
    End Sub

End Class

A: Since I am reading the Database from XML when you AcceptChanges all it does is updates in memory but not the actual XML file.
LocalDS.WriteXml(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "TvLinks" & "\TVSeriesDB.xml")

So I needed to write back to the XML file to actually save the changes made in memory.  This can be a time consuming process if the Database is big so use a Async function to save.


text:
Q: Enough to stack overflow? Java.
Is it normal that i get stack overflow error after 10 000 recursive void function calls with a reference and two integers as arguments?
Got 6gb ram memory, tried running through IDE and command line. I'm pretty sure the code is correct and recursion should finish.
It's about a Fill tool for a tile map editor. It start's at a certain tile and goes up, down, right and left if the coincident tile is of the same type and doesn't come back.
Tried different approaches, here is the one with additional boolean table indicating whether [x][y] tile was visited and replacing marked tiles after recursion is done:
public void fillRec(Tile t, int column, int row) {
    if (affected[column][row] || t.getName() != pattern)
        return;

    /*t.replaceMe(editor.currentTileButton.spawnTile(column, row,
            editor.tileMap));*/
    affected[column][row] = true;

    if (column < editor.tileMap.tilesX - 1) {
        fillRec(editor.tileMap.tiles[column + 1][row], column + 1, row);
    }
    if (column > 0) {
        fillRec(editor.tileMap.tiles[column - 1][row], column - 1, row);
    }
    if (row < editor.tileMap.tilesY - 1) {
        fillRec(editor.tileMap.tiles[column][row + 1], column, row + 1);
    }
    if (row > 0) {
        fillRec(editor.tileMap.tiles[column][row - 1], column, row - 1);
    }
}

This works fine with ~75x75 map, so did functions replacing tile and doing other heavy stuff in their bodies.

A: Yes, each method call uses up a Stack frame. If you want to use large scale recursion in Java, you'll need to use a Trampoline - which can swap stack space for heap space. A trampoline typically has two states

*

*completed

*more work to do

The completed state holds the final result, and the more work to do can be implemented with a Supplier (in Java 8) or similar construct, that makes the next recursive call. The Trampoline implementation should manages the calls to your method, and iterates rather than recurses.
Here is a simple looping example with a Trampoline.
 Trampoline<Integer> loop(int times,int sum){

    if(times==0)
        return Trampoline.done(sum);
    else
        return Trampoline.more(()->loop(times-1,sum+times));
 }

To make the call to loop
 loop(100,10).result();

Note the method returns a lazy Trampoline Object immediately (i.e. it doesn't perform the summing), and the Trampoline runs through the simple summing algorithm when result is called - in an iterative, rather than recursive fashion.
There is a Trampoline implementation in a library I wrote called cyclops-trampoline that you can use. Or if you prefer here is how to roll your own (this implementation makes use of a nice technique by Mario Fusco of managing the trampoline iteration in a Java 8 Stream).
 public interface Trampoline<T> {

default Trampoline<T> bounce(){
    return this;
}

T result();

default boolean complete() {
    return true;
}

public static <T> Trampoline<T> done(T result) {
    return () -> result;
}

public static <T> Trampoline<T> more(Trampoline<Trampoline<T>> trampoline) {
    return new Trampoline<T>() {

        @Override
        public boolean complete() {
            return false;
        }

        @Override
        public Trampoline<T> bounce() {
            return trampoline.result();
        }

        public T result() {
            return trampoline(this);
        }

        T trampoline(Trampoline<T> trampoline) {

            return Stream.iterate(trampoline,Trampoline::bounce)
                        .filter(Trampoline::complete)
                        .findFirst()
                        .get()
                        .result();

         }
      };
  }
 }

A: It depends on how much data these functions place on the stack in relation to the configured (or default) stack size, so it's not only the stack size used by the arguments to the function call.
So yes, it does not sound unnormal. You should play with the stack size or implement it differently.

A: That sounds normal.  If you don't specify otherwise, the default Java stack size is 1Mb or less, depending on your JVM and execution platform.  A stack overflow at ~10,000 recursive calls sounds quite plausible for a stack with the default size.

*

*You can change the JVM's default stack size with the -Xss option; e.g. -Xss10m sets the default size to 10MB.

*You can also specify a thread stack size directly via the Thread constructor.

However, this does illustrate a point that is not obvious to new Java programmers.  Unlike typical functional programming languages (and many others) the standard Java implementations do not do "tail call optimization".  This means that a recursive call sequence always needs stack space that is proportional to the maximum recursion depth.
This is a potential problem for programmers who prefer to use recursion rather than iteration.  Unfortunately, if your data is such that deep recursion is a possibility, you really need to convert to an iterative solution.  (Or find some other way to move the "recursion state" off the stack.)


text:
Q: how to call ajax success and error function from controller? I have ajax function
$.ajax({
    ....
    type: "POST",
    url: "",
    data: "",
    success: function(){
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
    }
});

& controller code is
public @ResponseBody
GenericResponse abc() {
    try {
        ....
    } catch (Exception ex) {
        ex.printStackTrace();
        return new GenericResponse("Failed", ex.getMessage(), 500);
    }
    return new GenericResponse("Success", "", 200);
}

where GenericResponse is
public class GenericResponse
{

    private String status;

    private String error;

    private int code;

    public GenericResponse(String s, String e, int c)
    {
        this.status = s;
        this.error = e;
        this.code = c;
    }
....
}

So for success & failure I am sending genericresponse with status but for both it goes inside success callback function.
I understand that it is gennericResponse so ajax would consider it as success only . If exception comes
I want it to go to error callback function. How to do that?

A: Instead of returning a GenericResponse, try returning a ResponseEntity instead.
You would do:
return new ResponseEntity<GenericResponse>(successGenericResponse, HttpStatus.OK);

or
return new ResponseEntity<GenericResponse>(failGenericResponse, HttpStatus.INTERNAL_SERVER_ERROR);


text:
Q: Is this $3 \times 3$ matrix diagonalizable? Is the following matrix diagonalizable?
$$\begin{pmatrix}
    2 & 1 & 0 \\
    0 & 0 & 2 \\
    0 & 3 & -1 \\
    \end{pmatrix}$$
I think it is. I found the eigenvalues that are $2, 2, -3$. Can I say that the matrix is diagonalizable because it is a square matrix $3 \times 3$ and it has $3$ eigenvalues?

A:
I found the eigenvalues that are $2, 2, -3$.
Can I say that the matrix is diagonalizable because it is a square matrix $3x3$ and it has $3$ eigenvalues?

Based only on these observations: no, you cannot conclude that (yet).
Because it is a 3x3-matrix, you'll need 3 linearly independent eigenvectors for the matrix to be diagonalizable. Since eigenvectors corresponding to different eigenvalues are known to be linearly independent, you know you'll find at least two of those.
The key is the eigenvalue 2, which is a double root of the characteristic polynomial. If you find:

*

*only 1 eigenvector corresponding to this eigenvalue, the matrix will not be diagonalizable;

*2 (linearly independent) eigenvectors corrsponding to this eigenvalue, the matrix will be diagonalizable.

 You should find only one eigenvector for this eigenvalue and conclude that the matrix is not diagonalizable.

The number of linearly independent eigenvectors corresponding to an eigenvalue is also called the geometric multiplicity of that eigenvalue. This allows the following rephrasing of the criterion: a matrix is diagonalizable if the algebraic multiplicity is equal to the geometric multiplicity for each eigenvalue.
See also Algebraic multiplicity for a related question about the same matrix.

A: You need to check if the polynomial is simply scinded or not, here the eigenvalue $2$ is double however here
$$
\chi_{A}\left(X\right)=\left(X-2\right)^2\left(X+3\right)
$$
The matrix $$A-2I_3$$ is not of rank $1$, so $A$ is not diagonalizable.

A: >>> from sympy import *
>>> A = Matrix([[ 2, 1, 0],
                [ 0, 0, 2],
                [ 0, 3,-1]])
>>> P, J = A.jordan_form()
>>> J
Matrix([
[-3, 0, 0],
[ 0, 2, 1],
[ 0, 0, 2]])

Are all the Jordan blocks $1 \times 1$? If not, what can you conclude with regards to diagonalizability?

A: A matrix is "diagonalizable" if and only if there exist a complete set of eigenvectors.  That is, if and only if there is a basis consisting of eigenvectorsl.  If an n by n matrix has n distinct eigenvalues then it has  n independent eigenvectors so is diagonalizable.  Here, two of the eigenvalues are the same, 2, so we need to see if there are two independent eigenvectors having eigenvalue 2.  If $(x_1, x_2, x_3)$ is an eigenvector with eigenvalue 2 then we must have $2x_1+ x_2= 2x_1$, $2x_3= 2x_2$, and $3x_2- x_3= 2x_3$. Those reduce to $x_2= 0$, $x_3= x_2= 0$, and $0= 0$.  That leaves $x_1$ undetermined.  An eigenvector of this matrix with eigenvalue 2 is of the form $(x_1, 0, 0)$ where $x_1$ can be any number.  But there are not two independent eigenvectors so this matrix is NOT diagonalizable.


text:
Q: Calculate Expectation and variance of variable that is average of $n$ random variables Suppose $Y_1, Y_2, \ldots , Y_n$ are all independent random variables with mean $a$ and variance $b$.
Define Tn to be their average, i.e.
$$T_n = \frac{Y_1 + Y_2 + \cdots + Y_n} n$$
Calculate $\operatorname{E}(T_n)$ and $\operatorname{Var}(T_n)$, in terms of $a$ and $b$.
Find the smallest integer value of $n$ such that $T_n$ is "close enough" to $\operatorname{E}(T_n)$, in the sense that
$$|T_n − \operatorname{E}(T_n)| ≥ \sqrt2 \, b$$
occurs with probability at most $4\%.$

A: For the first part we have
$$E(T_n)=\frac{E(Y_1)+\dots+ E(Y_n)}{n}=\frac{an}{n}=a$$
For the second part we have:
$Var(T_n)=E(T_n-E(T_n))^2=E((\frac{Y_1+Y_2+\dots+Y_n}{n})^2-2a^2+a^2)=\frac{n-1}{n}E(Y_1Y_2)+\frac{1}{n}E(Y_1)^2 -a^2=\frac{n-1}{n}a^2+\frac{1}{n}(b+a^2)-a=\frac{b}{n}$


text:
Q: Cascade Delete in Gorm does not remove Associated Tables Im new to Gorm. Im trying to do a cascade delete whereby if I delete a User, the Role (Belongs To), Profile (Has One) and Books (One-to-Many) which are associated with the User will be deleted as well.
I set up my model below but cascading can't seem to work. When I delete my User, the Role, Profile and Books still remain in the database rather than being deleted / soft deleted.
Can someone point me to where I did wrong? Thanks
User Model
type User struct {
    gorm.Model
    Name string `json:"name"`
    Age uint    `json:"age"`
    Profile Profile `gorm:"constraint:OnDelete:CASCADE;"`
    RoleID int `json:"role_id"`
    Role Role `gorm:"constraint:OnDelete:CASCADE;"`
    Books []Book `gorm:"constraint:OnDelete:CASCADE;"`
}

type Book struct {
    gorm.Model
    Title string `json:"title"`
    UserID uint `json:"user_id"`
}

type Profile struct {
    gorm.Model
    Country string `json:"country"`
    UserID uint `json:"user_id"`
}

type Role struct {
    ID int
    Name string `json:"name"`
}

A: When using gorm.Model, or more specifically when your model has a field of type gorm.DeletedAt, GORM uses soft delete. That is, records do not actually get deleted, only the aforementioned field gets updated, and the records are normally excluded from query results. Consequently, cascade delete will not trigger.
You can find, and then actually delete, soft-deleted objects using the Unscoped method. Alternatively, change your models so that they are not affected by soft-deletion.


text:
Q: PHP clearing memory for an array of objects I have a class, which (among other things) contains a simple array of objects instanced from another class.  (This array is small - containing only 1 to perhaps 4 objects.)
In the __destruct method of the first class I want to clear the contents (free the memory) of this array of objects.  In order to do this, do I:

*

*iterate through the array, setting each index = null, then finally setting the array = null?

*simply set the array = null?

A: As already mentioned by @splash58 you can use unset to delete a variable.
unset($array); // can be used on multiple as well: unset($var1, $var2, ...);

Unset will simply destroy the variable.

A: Re: rjdown link.  Thanks.  I had previously read that question/answers.
From that post I concluded (perhaps incorrectly) that there appeared to be 2 (possible?) differences between unset($var) and $var = null.

*

*the speed at which the memory is actually released.  ($var = null appeared to be faster.)

*the processing load of the method.  (unset($var) appeared to present less of a load.)
For reasons, I decided on speed of memory release, and thus went with the use of the null assignment.
However, the question remained - the array would be null, but would the objects previously contained by the array be non-null and thus have to wait around for GC?
Since a test was actually easy to do, I did it.
I created about 1,000 child records for a parent class.  Then I instanced a new parent class and loaded the 1,000 child objects into the array.
I used memory_get_usage() in a test file, and ran a number of trials where:

*

*the parent class' __destruct method simply unset the array of child objects.

*the parent class' __destruct method iterated through the array, setting each instance = null, then unset the array.
Data as follows:

*

*using parent __destruct unset array

Start memory - 620288
memory after parent instanced and child array loaded - 1316952
memory after parent set to null - 620864
mem diff = 576

*

*using parent __destruct iterate array = null

Start memory - 620952
memory after parent instanced and child array loaded - 1317616
memory after parent set to null - 621528
mem diff = 576
(I also put a microtime interval across parent object creation, child array load, parent object destruction.  Tests for each of the 2 __destruct methods were essentially equivalent at around 10 ms.)
From this I conclude - there really isn't much of a difference.  Unset or null, whatever floats your boat.
(Perhaps I should have simply run my own tests prior to bothering the forum with a question.)
Again, thanks.


text:
Q: php smtp not sending email     while (! file_exists('php') )
        chdir('..');

include_once "php/Mail.php";

    $from = "<me@gmail.com>";
    $to = "<you@gmail.com>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "ssl://smtp.gmail.com";
    $port = "465";
    $username = "foo@gmail.com";  //<> give errors
    $password = "xx";

    $headers = array ('From' => $from,
      'To' => $to,
      'Subject' => $subject);
    $smtp = Mail::factory('smtp',
      array ('host' => $host,
        'port' => $port,
        'auth' => true,
        'username' => $username,
        'password' => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
      echo("
" . $mail->getMessage() . "
");
     } else {
      echo("
Message successfully sent!
");
     }

hello; i am using the answer that was given on s.o for smtp mailing; (believe its the first result if search)
yet i still do not receive the mail; can anyone help to spot any error or provide alt solutions? I have used the built in mailer but it is not being authenticated see -> signing gmail with php imap

A: Is SSL enabled in your PHP ini file?
extension=php_openssl.dll


text:
Q: Plot multiple surfaces I'm trying and plot multiple surfaces on the same chart with Plotly package but I just can't get it done. A few days ago I could do this with no problem using the same code, but now it seems that after an update on Plotly it's not possible anymore. Here is an example of what I'm trying to do:
#Volcano surface
plot_ly(z = volcano,
        type = 'surface') %>%

#First rectangle
add_trace(x = c(10, 60),
          y = c(10, 50),
          z = matrix(160, nrow = 2, ncol = 2),
          type = 'surface', showscale = FALSE) %>%

#Second rectangle
add_trace(x = c(10, 60),
          y = c(10, 50),
          z = matrix(180, nrow = 2, ncol = 2),
          type = 'surface',
          showscale = FALSE)

When I run the code above, I get the following output:
Error in p$x$data[[idx]]$marker :
  $ operator is invalid for atomic vectors

If I assign the Plotly object to some variable instead of using the '%>%' operator, like this:
#Volcano surface
p <- plot_ly(z = volcano,
             type = 'surface')

#First rectangle
p <- add_trace(p,
               x = c(10, 60),
               y = c(10, 50),
               z = matrix(160, nrow = 2, ncol = 2),
               type = 'surface', showscale = FALSE)

#Second rectangle
p <- add_trace(p,
               x = c(10, 60),
               y = c(10, 50),
               z = matrix(180, nrow = 2, ncol = 2),
               type = 'surface',
               showscale = FALSE)

#Plot object
p

... then I get the same output as before.
If I plot the volcano and just one of the rectangles, it works just fine. Furthermore, I've tried to plot different surfaces than the rectangles and, still, I get the same error.
Here is some information that might help:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
[1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C               LC_TIME=pt_BR.UTF-8        LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=pt_BR.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] plotly_4.5.2                  ggplot2_2.1.0                 shiny_0.14.1                  doMC_1.3.4
[5] iterators_1.0.8               quantstrat_0.9.1739           foreach_1.4.3                 blotter_0.9.1741
[9] PerformanceAnalytics_1.4.4000 FinancialInstrument_1.2.0     quantmod_0.4-6                TTR_0.23-1
[13] xts_0.9-7                     zoo_1.7-13

loaded via a namespace (and not attached):
[1] Rcpp_0.12.7       compiler_3.3.1    plyr_1.8.4        base64enc_0.1-3   tools_3.3.1       digest_0.6.10     viridisLite_0.1.3
[8] jsonlite_1.1      tibble_1.2        gtable_0.2.0      lattice_0.20-34   DBI_0.5-1         yaml_2.1.13       dplyr_0.5.0
[15] httr_1.2.1        htmlwidgets_0.7   grid_3.3.1        R6_2.1.3          purrr_0.2.2       tidyr_0.6.0       magrittr_1.5
[22] scales_0.4.0      codetools_0.2-14  htmltools_0.3.5   assertthat_0.1    mime_0.5          xtable_1.8-2      colorspace_1.2-6
[29] httpuv_1.3.3      lazyeval_0.2.0    munsell_0.4.3

Any thoughts about that issue?

A: Solved. Re-wrote code to:
#Create Plotly object
plot_ly(showscale = FALSE) %>%

#Volcano surface
add_surface(z = volcano) %>%

#First rectangle
add_surface(x = c(10, 60),
            y = c(10, 50),
            z = matrix(160, nrow = 2, ncol = 2)) %>%

#Second rectangle
add_surface(x = c(10, 60),
            y = c(10, 50),
            z = matrix(180, nrow = 2, ncol = 2))

Works like a charm. Did it based on this multiple surfaces plot example.


text:
Q: How can I hide all errors from an Eclipse project? I have taken a huge project from one of my friends and I just want to view the files just to understand some coding architectures they have implemented. On my system I don't have those jars and complete code so my Eclipse is showing almost 10,000 errors. Now I am still able to go through the code but the red errors are not allowing me to concentrate well. How can I hide all the errors in this particular project?

A: I don't know if you can hide all the errors but you can

*

*limit the number of reported problems in Preferences -> Java -> Compiler -> Building, or

*exlude all the files from your build path folder (Java Build Path -> Souce -> Select source folder and Edit... -> Enter folder name and press Next -> Add '**' as Exclusion pattern)

A: Just disable JavaBuilder in Properties -> Builders. Sometimes after disabling JavaBuilder error status is not updated (they are still visible). In that case do the following:

*

*In Properties -> Java Build Path -> Source remove source folder(s)

*Clear project using Build -> Clear...

*Disable JavaBuilder as described above

*Add source folder(s) again

That way you should not be irritated with error messages any longer, but retaining all the possibilities to navigate by ctrl+click, search references etc.

A: This is not the right way , just a workaround if you just want to browse the source code and not worried about compile and building it.
You just need to remove the source folder in the java build path , this will help you to get rid of those red errors that clutter your source.
Right click on Project->Properties->Java Build Path->in Source tab select your source folder and click remove.
Restart your eclipse.

A: In eclipse, go on any class. Right click on the red marks shown on the vertical ruler and disable the 3 options. See below.