API Gateway Admin Failure in WSO2 API Publisher 2.0.0

Question: Currently I integrated identity server 5.2.0 and API Manager 2.0.0 using key manager. Both of it run in same server.
I follow below guide to setup both of WSO2 Products.
https://docs.wso2.com/display/CLUSTER44x/Configuring+the+Identity+Server+5.2.0+as+a+Key+Manager+with+API+Manager+2.0.0
Error happen when want to publish an API via Gateway Environment. It prompt an error message which is
"Failed to Publish Environments
Production and Sandbox
Error while contacting the authentication admin services".
<code>2017-04-25 17:51:17,225 [-] [localhost-startStop-1]  WARN QpidServiceComponent MQTT Transport is disabled as per configuration.
2017-04-25 17:52:23,505 [-] [http-nio-9443-exec-43] ERROR APIGatewayManager Error occurred when publish to gateway Production and Sandbox
org.apache.axis2.AxisFault: Error while contacting the authentication admin services
    at org.wso2.carbon.apimgt.impl.utils.AbstractAPIGatewayAdminClient.login(AbstractAPIGatewayAdminClient.java:92)
    at org.wso2.carbon.apimgt.impl.utils.AbstractAPIGatewayAdminClient.setup(AbstractAPIGatewayAdminClient.java:50)
    at org.wso2.carbon.apimgt.impl.utils.APIGatewayAdminClient.<init>(APIGatewayAdminClient.java:37)
    at org.wso2.carbon.apimgt.impl.APIGatewayManager.publishToGateway(APIGatewayManager.java:86)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.publishToGateway(APIProviderImpl.java:1481)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.propergateAPIStatusChangeToGateways(APIProviderImpl.java:1292)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.propergateAPIStatusChangeToGateways(UserAwareAPIProvider.java:36)
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.execute(APIExecutor.java:136)
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.runCustomExecutorsCode(DefaultLifeCycle.java:712)
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.invoke(DefaultLifeCycle.java:450)
    at org.wso2.carbon.governance.registry.eventing.handlers.GovernanceEventingHandler.invokeAspect(GovernanceEventingHandler.java:338)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.invokeAspect(HandlerManager.java:2792)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.invokeAspect(HandlerLifecycleManager.java:518)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.invokeAspect(EmbeddedRegistry.java:2591)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.invokeAspect(CacheBackedRegistry.java:510)
    at org.wso2.carbon.registry.core.session.UserRegistry.invokeAspect(UserRegistry.java:1952)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:829)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:808)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:3640)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c4._c_anonymous_1(/publisher/modules/api/life-cycles.jag:13)
    at org.jaggeryjs.rhino.publisher.modules.api.c4.call(/publisher/modules/api/life-cycles.jag)
    at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
    at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
    at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c0._c_anonymous_13(/publisher/modules/api/module.jag:47)
    at org.jaggeryjs.rhino.publisher.modules.api.c0.call(/publisher/modules/api/module.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_anonymous_1(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:64)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_script_0(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:5)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.exec(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
    at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
    at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1749)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1708)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axis2.AxisFault: hostname in certificate didn't match: <localhost> != </eae.resolvtech.net>
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.wso2.carbon.authenticator.stub.AuthenticationAdminStub.login(AuthenticationAdminStub.java:659)
    at org.wso2.carbon.apimgt.impl.utils.AbstractAPIGatewayAdminClient.login(AbstractAPIGatewayAdminClient.java:87)
    ... 87 more
Caused by: javax.net.ssl.SSLException: hostname in certificate didn't match: <localhost> != </eae.resolvtech.net>
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:341)
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:277)
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:260)
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:169)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:659)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:195)
    ... 96 more
2017-04-25 17:52:24,284 [-] [http-nio-9443-exec-43] ERROR APIExecutor Failed to publish service gateway while executing APIExecutor.
org.wso2.carbon.apimgt.api.FaultGatewaysException
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.updateAPIforStateChange(APIProviderImpl.java:1403)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.updateAPIforStateChange(UserAwareAPIProvider.java:36)
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.execute(APIExecutor.java:146)
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.runCustomExecutorsCode(DefaultLifeCycle.java:712)
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.invoke(DefaultLifeCycle.java:450)
    at org.wso2.carbon.governance.registry.eventing.handlers.GovernanceEventingHandler.invokeAspect(GovernanceEventingHandler.java:338)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.invokeAspect(HandlerManager.java:2792)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.invokeAspect(HandlerLifecycleManager.java:518)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.invokeAspect(EmbeddedRegistry.java:2591)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.invokeAspect(CacheBackedRegistry.java:510)
    at org.wso2.carbon.registry.core.session.UserRegistry.invokeAspect(UserRegistry.java:1952)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:829)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:808)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:3640)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c4._c_anonymous_1(/publisher/modules/api/life-cycles.jag:13)
    at org.jaggeryjs.rhino.publisher.modules.api.c4.call(/publisher/modules/api/life-cycles.jag)
    at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
    at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
    at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c0._c_anonymous_13(/publisher/modules/api/module.jag:47)
    at org.jaggeryjs.rhino.publisher.modules.api.c0.call(/publisher/modules/api/module.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_anonymous_1(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:64)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_script_0(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:5)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.exec(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
    at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
    at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1749)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1708)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
2017-04-25 17:52:24,290 [-] [http-nio-9443-exec-43] ERROR DefaultLifeCycle org.wso2.carbon.registry.core.exceptions.RegistryException: Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while contacting the authentication admin services"},"UNPUBLISHED":{}}
2017-04-25 17:52:24,294 [-] [http-nio-9443-exec-43] ERROR GovernanceArtifactImpl Invoking lifecycle action "Publish" failed. Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while contacting the authentication admin services"},"UNPUBLISHED":{}}
org.wso2.carbon.registry.core.exceptions.RegistryException: Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while contacting the authentication admin services"},"UNPUBLISHED":{}}
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.invoke(DefaultLifeCycle.java:482)
    at org.wso2.carbon.governance.registry.eventing.handlers.GovernanceEventingHandler.invokeAspect(GovernanceEventingHandler.java:338)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.invokeAspect(HandlerManager.java:2792)
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.invokeAspect(HandlerLifecycleManager.java:518)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.invokeAspect(EmbeddedRegistry.java:2591)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.invokeAspect(CacheBackedRegistry.java:510)
    at org.wso2.carbon.registry.core.session.UserRegistry.invokeAspect(UserRegistry.java:1952)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:829)
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:808)
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:3640)
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c4._c_anonymous_1(/publisher/modules/api/life-cycles.jag:13)
    at org.jaggeryjs.rhino.publisher.modules.api.c4.call(/publisher/modules/api/life-cycles.jag)
    at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
    at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
    at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
    at org.jaggeryjs.rhino.publisher.modules.api.c0._c_anonymous_13(/publisher/modules/api/module.jag:47)
    at org.jaggeryjs.rhino.publisher.modules.api.c0.call(/publisher/modules/api/module.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_anonymous_1(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:64)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0._c_script_0(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag:5)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.call(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.rhino.publisher.site.blocks.life_cycles.ajax.c0.exec(/publisher/site/blocks/life-cycles/ajax/life-cycles.jag)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
    at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
    at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1749)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1708)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
</code>
Is there any configure issue that I missed?
Comment: This is already answered in here. http://stackoverflow.com/a/43043075/1008424
Comment: I already setup the HostnameVerifier parameter.. still have this issues..
Answer: I've already had the exact same problem. The cause was the incorrect change of the admin user password. Take a look at the documentation
Comment: I've already manage to configure this part. But then still have this problem. Is anything else that need to be configure?
Comment: Whenever I face odd errors in the API Manager, usually I start with a clean installation and apply my configurations to try to identify the point where a specific error shows up. API Manager does not require a lot of configurations that makes this process infeasible. In my opinion, to do this is less time consuming.

About the problem you are tackling, it may be the case of a deleted role which is used by any API scopes. It happened with me once.
Comment: Same as me, I start clean installation and try to apply my old configuration. But when want to integrate Identity Server and API Manager it will come with the same error.
May I know, is there any other way to integrate IS and API Manager in same server?
May I know if you have other suggestion that could help in this case?
Comment: Well... I'd check the ports. You certainly already have configured the ports offset, but double check the specific server ports in the [documentation](https://docs.wso2.com/display/IS530/Default+Ports+of+WSO2+Products#DefaultPortsofWSO2Products-Product-specificports).
Have you tested the setup using two different servers?
Comment: Hi Rodrigo, I already setup and tested two different server and still this problem happen.


addToBackStack() is not working with getChildFragmentManager()

Question: The new fragment which is displayed on a button click is not closing after pressing the back button,instead it is closing the whole application. The button is present inside one of the three tabs. The code of the mainActivity.java, HeroesFragment(the fragment having the three tabs),StrengthHeroesFragment(one of the three tab having the button) is mentioned below.
MainActivity.java
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout drawer;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar=findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    drawer=findViewById(R.id.draw_layout);
    NavigationView navigationView=findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    ActionBarDrawerToggle toggle=new ActionBarDrawerToggle(this,drawer,toolbar,
            R.string.navigation_drawer_open,R.string.navigation_drawer_close);

    drawer.addDrawerListener(toggle);
    toggle.syncState();

    if (savedInstanceState==null){
    getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new HeroesFragment()).commit();

    navigationView.setCheckedItem(R.id.nav_heroes);}

}

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()){
        case R.id.nav_heroes:
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new HeroesFragment()).commit();
            break;
        case R.id.nav_items:
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new ItemsFragment()).commit();
            break;
        case R.id.nav_counterpicker:
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new CounterPickerFragment()).commit();
            break;
        case R.id.nav_news:
            getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new NewsFragment()).commit();
            break;

    }

    drawer.closeDrawer(GravityCompat.START);
    return true;
}

@Override
public void onBackPressed() {
    if (drawer.isDrawerOpen(GravityCompat.START)){
        drawer.closeDrawer(GravityCompat.START);
    }
    else{
    super.onBackPressed();
    }

}

}

HeroesFragment.java (The fragment containing the three tabs)
public class HeroesFragment extends Fragment {

private TabLayout tabLayout;
private AppBarLayout appBarLayout;
private ViewPager viewPager;
View view;
RelativeLayout relativeLayout;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view= inflater.inflate(R.layout.fragment_heroes,container,false);

    relativeLayout=(RelativeLayout)view.findViewById(R.id.hero_layout);
    tabLayout=(TabLayout)view.findViewById(R.id.heroes_tablayout);
    appBarLayout=(AppBarLayout)view.findViewById(R.id.hero_appbar);
    viewPager=(ViewPager)view.findViewById(R.id.heroes_viewpager);
    ViewPageAdapter adapter=new ViewPageAdapter(getChildFragmentManager(),1);
    adapter.AddFragment(new StrengthHeroesFragment(),"Strength" );
    adapter.AddFragment(new AgilityHeroesFragment(),"Agility");
    adapter.AddFragment(new IntelligenceHeroesFragment(),"Intelligence");
    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));

    tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            switch (tab.getPosition()){
                case 0:
                    Toast.makeText(getContext(),"Tab 1",Toast.LENGTH_SHORT).show();
                    break;

                case 1:
                    Toast.makeText(getContext(),"Tab 2",Toast.LENGTH_SHORT).show();
                    break;
                case 2:
                    Toast.makeText(getContext(),"tab 3",Toast.LENGTH_SHORT).show();
                    break;
                default:
                    break;
            }

        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {

        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {

        }
    });

    viewPager.setAdapter(adapter);
    tabLayout.setupWithViewPager(viewPager);

    return view;

}

}

StrengthHeroesFragment.java (the fragment contaning the button )
public class StrengthHeroesFragment extends Fragment {

View view;
ImageButton ib1,ib2,ib3,ib4,ib5,ib6;
TextView t1,t2,t3,t4,t5,t6;

public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable
Bundle savedInstanceState) {

    view=inflater.inflate(R.layout.fragment_strength_heroes,container,false);

    ib1=(ImageButton)view.findViewById(R.id.abaddon_icon);

   ib1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            HeroDetailsFragment heroDetailsFragment=new HeroDetailsFragment();

            Bundle data=new Bundle();
            data.putString("heroname","Abaddon");
            heroDetailsFragment.setArguments(data);
            FragmentTransaction transaction=getChildFragmentManager().beginTransaction();
            transaction.replace(R.id.strength_hero_layout,heroDetailsFragment).addToBackStack(null);
            transaction.commit();
        }
    });
return view;
}

}

When i use getFragmentManager() instead of getChildFragmentManager() in the StrengthHeroes Fragment it actually works but when i switch to another fragments in the navigation drawer, the content in the tab layout fragments is gone.
I also tried using setPrimaryNavigationFragment() it still didn't worked.
Please help me with it.....
Thanks in Advance.
Answer: use below code instead of super.onBackpress()
@Override
public void onBackPressed() {
    if (drawer.isDrawerOpen(GravityCompat.START)){
        drawer.closeDrawer(GravityCompat.START);
    }
    else{
     getSupportFragmentManager().popBackStack();

    }
}

Comment: Sir after trying that code it doesn't do anything. Neither it closes the fragment nor the app as it was doing it before.


figuring out 3rd of a note

Question: I am having a hard time just to figure out 3rd of a given note, in fact in backward.
For example, G's 3rd in backward is E and F's is D.
It does not come out as naturally as I wish it to.
Is there a certain exercise on this problem other than just tons of scale exercise?
Comment: "It does not come out as naturally as I wish it to": why?  What's your expectation?  From my perspective, and I daresay that of other users of this site, it is elementary that D is a third below F, and E a third below G, and I can't remember thinking anything inconsistent with this when I was a beginner, so it's not clear to me how to formulate an answer that you would find useful.  "Is there a certain exercise on this problem other than just tons of scale exercise?: Are you asking about theory or about playing an instrument?  Which instrument?
Comment: I'm with @phoog on this. On its face, your question seems to be about how to do a rote memorization exercise: C-A, D-B, E-C, F-D, G-E, A-F, B-G. Is there something beyond that that you have as a goal? Answers to the questions phoog poses would be very helpful.
Comment: Is going a sixth up easier?
Comment: Do you need this knowledge for singing or guitarplaying? What instrument are you playing? Are you able to read sheet music? Mind there are different qualities of thireds: minor thirds and major thirds, e.g.
Comment: For what concrete situation do you need this? Why do you need to spell out the letter names? Or do you need to write music or play an instrument? For writing staff notation, you don't need to think of the letter names, a third is always at a certain distance. For playing instruments you don't need letter names either, because what you want to locate is how to play the note on your instrument, and that's largely a spatial task, not textual. Maybe for reading chord symbols, it might be good to quickly know when a chord symbol specifies a certain inversion, and for that you'd need the letters.
Answer: Reciting a series backwards can be tricky. Just think of the alphabet. You probably cannot recite it backwards anywhere near as easily as forward! Keep that in mind and realize you need to spend some time reciting pitch letter series backwards before it will become easy.
I think there are three basic pitch letter series to know:

stepwise: A B C D E F G A, A G F E D C B A
by thirds A C E G B D F A, A F D B G E C A
by fifths A E B F C G D A, A D G C F B E A

Probably the two most practical times to work on those series are during practice drill of scales and arpeggios, and while doing harmonic analysis of chords where you identify pitch letters.
Comment: 1st is dead easy! 3rd is the circle of 5ths. But the 2nd version is the worst! Unless you consider the notes used in each chord of its 11th. Which I doubt OP will cope with.
Comment: My example of reciting by thirds is not meant to be literally starting with `A` as a root. I don't mean to memorize an `A` thirteenth chord. You could start with any letter. The point is to be able to recite by thirds ascending and descending, which is very useful.
Answer: The question's not as clear as it could be, but guessing what it's asking -
Take any note, call that the major chord. Instead of going down a third, learn what the relative minor chord in relation to that will be. That's easily found by counting up to ^6.
As in:

G(maj) -> E(min)
C(maj) -> A(min)
F(maj) -> D(min)

Of course, sharps or flats will come into the equation, depending on the key signature, as in A(maj)>F♯(min).
Most people will know the common chord sequence 1-6-4-5, and the 6 part is the one you call 'three down'. And, yes, usage of these chord sequences will embed the relationships between the two.
Answer: Let's suppose you need this knowledge for a music test:
In this case the easiest way is to go back 2 letters in the alphabet:
a b c d e f g a b c d e f g
you need to imagine the scale-names like a ladder, you have to write it down 10 times and then you also must write 2 scales:
A B C D E F G A B C D E F G A B  ....
Then you write another scale above or below the one you have  on your sheet, beginning with 2 letters before or later:
C D E F G A B C D E F G A B C D E F ....
A B C D E F G A B C D E F G A B C D ....
C D E F G A B C D E F G A B C D E F ....
you have to make a "photocopy" in your mind (vizualisation!)
this is a very important trick of learning.
if you play piano or a keyboard then you must draw the keys and names on a sheet of paper (you can do this every time before you start playing an instrument or singing) The third is always two white keys from the given tone, so you have to skip one white key)
If your goal is to recognize a third in a notated sheet (staff) the way is also very easy: if a note is on a line, its third (up or down) is on the next line, the same rule is when the note is in a space between 2 lines:
the thirds are in the next space.
https://en.wikipedia.org/wiki/Staff_(music)
https://en.wikipedia.org/wiki/Interval_(music)
So you need to know and understand the terms STAFF and INTERVAL
Comment: I used to do similar with students - a 'Blue Peter' approach (UK tv prog.) using two concentric circles, one bigger than the other, like clock faces. Easier to rotate and read off.

figuring out 3rd of a note


Axios demora para consumir a API?

Question: Olá, galera! tudo bom?
Estou iniciando meus estudos em Vanilla Javascript para futuramente estudar frameworks que utilizem js.
Fiz um pequeno projeto web no qual o usuário digita o CEP da residencia e a aplicação utiliza o Axios para consumir uma api que retorna os dados do cep(bairro,rua,cidade...)
Porém, percebi que no primeiro clique no botão de busca, o retorno é "undefined" e, após clicar novamente, o resultado correto é apresentado na tela. Penso eu que possa ser uma "demora" para o retorno dos dados.
Segue o meu código:
(OBS: Modelo MVC)
Classe CEP:
 class Cep {

   constructor(){

        this.cidade;
        this.bairro;
        this.rua;
   }

   getRua(){

        return this.rua;
   }

   getBairro(){

        return this.bairro;
   }

   getCidade(){

        return this.cidade;
   }

   setEndereco(cidade,bairro,rua){

    this.cidade = cidade;
    this.bairro = bairro;
    this.rua = rua;
   }

}

Classe VIEW (renderiza o html na tela)
class View{

constructor(dom){

    this.dom = dom;
}

template(modelo){

    return `

            Cidade
            Bairro
            Rua

            ${modelo.getCidade()}
            ${modelo.getBairro()}
            ${modelo.getRua()}

    `
}

update(modelo){

    this.dom.innerHTML = this.template(modelo);
}

}
Por fim, a classe Controller
 class CepController{

    constructor(){

        this.dom = document.querySelector('#cep');
        this.tabela = document.querySelector('#enderecos');
        this.url = 'http://api.postmon.com.br/v1/cep/';
        this.objCep = new Cep();
        this.view = new View(this.tabela);
    }

    render(){

        axios.get(this.api_url(this.dom.value)).then((resposta)=>{

            this.objCep.setEndereco(resposta.data.cidade,resposta.data.bairro,resposta.data.logradouro);
        });

        console.log(this.objCep);

        this.view.update(this.objCep);

        console.log(this.objCep);

        event.preventDefault();
    }

    api_url(cep){

        let retorno = this.url + cep;
        return retorno;
    }

}

OBS: peço desculpas se minha dúvida é muito trivial. Procurei bastante e realmente não encontrei respostas para meu problema :(
Answer: Você não está esperando a resposta da requisição chegar antes de tentar mostrar os dados. Tente assim:
axios.get(this.api_url(this.dom.value)).then((resposta)=>{
    this.objCep.setEndereco(resposta.data.cidade, resposta.data.bairro, resposta.data.logradouro)
    this.view.update(this.objCep);
});

Axios demora para consumir a API?


Ajax upload in Ctools Modal Window

Question: I have node creation form in a popup dialog box. I decided to give it a try using ctools modal window. But I seem to be getting errors when I upload an image into a image field after using browse to select it.
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in drupal_retrieve_form() (line 795 of /var/www/html/test/includes/form.inc).
Notice: Undefined index: #node in comment_form_node_form_alter() (line 1193 of /var/www/html/test/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_form_node_form_alter() (line 1210 of /var/www/html/test/modules/comment/comment.module).
Notice: Undefined index: #node in menu_form_node_form_alter() (line 629 of /var/www/html/test/modules/menu/menu.module).
Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 629 of /var/www/html/test/modules/menu/menu.module).
Notice: Undefined index: #node in menu_form_node_form_alter() (line 630 of /var/www/html/test/modules/menu/menu.module).
Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 630 of /var/www/html/test/modules/menu/menu.module).
Notice: Undefined index: field_artwork_image in file_ajax_upload() (line 271 of /var/www/html/test/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /var/www/html/test/modules/file/file.module)

Below is my code
function portfolio_cust_node_add_modal_callback($js = FALSE) {
  global $user;

  //If people are not using JS. I just tell them "sorry" it is '2012'
  if (!$js) return "Javascript required";
  ctools_include('node.pages', 'node', '');
  ctools_include('modal');
  ctools_include('ajax');

 // Create a blank node object here.
  $node = (object) array(
    'uid' => $user->uid,
    'name' => (isset($user->name) ? $user->name : ''),
    'type' => 'psuedo_portfolio',
    'language' => LANGUAGE_NONE,
    );

  $form_state = array(
    'title' => t('Add Portfolio'),
    'ajax' => TRUE,
  );
  $form_state['build_info']['args'] = array($node);
  drupal_add_library('system', 'ui.dialog');
  // change this to your type node form
  $output = ctools_modal_form_wrapper('psuedo_portfolio_node_form', $form_state);

  // This means the form has been exectued
  if (!empty($form_state['executed'])) {
    $output = array();
    // Close the modal
    $output[] = ctools_modal_command_dismiss();
  }

  print ajax_render($output);
  exit;

}

I am planning to use colorbox module or some other method which uses a iframe instead of how ctools implements the modal dialog.
Any help will be greatly appreciated.
Answer: I faced the same problem, and I managed to solve it using merlinofchaos's suggestion. I used form_load_include() just after form_state initialization:
  $form_state = array(
    'title' => t('Add new deal'),
    'ajax' => TRUE,
    'node' => $node,
  );

  $form_state['build_info']['args'] = isset($form_state['build_info']['args']) ? $form_state['build_info']['args'] : array($node);
  form_load_include($form_state, 'inc', 'node', 'node.pages');

Comment: I used overlay paths which uses iframe. However this is also working thanks!! will use it the next time.
Answer: this fixed for me:
http://drupal.org/node/1336212#comment-6049694
Add the following lines to a hook_menu_alter() implementation:
$items['file/ajax']['file'] = 'node.pages.inc';
$items['file/ajax']['file path'] = drupal_get_path('module', 'node');

Ajax upload in Ctools Modal Window


What do -u, -m parameters do?

Question: What do parameters -u, -m mean and what do they do?
for example:
python -u my_script.py

or
python -m my_script.py

Where can I read about them?
Comment: If you're on OSX or Linux try `man python` in your terminal window.
Answer: -u is used to force stdin,  stdout  and  stderr to be totally unbuffered, which otherwise is line buffered on the terminal
-m searches  sys.path for the named module and runs the corresponding .py file as a script. An example would be timeit module. The command python -m timeit "python script" would return the time taken for the script to execute.
Quoting from the docs

-u
Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary
  mode.
-m <module-name>
Search sys.path for the named module and execute its contents as the __main__ module.

You can read more about them and other options here

What do -u, -m parameters do?


Laravel FormRequest: client sends attribute with dots inside

Question: Client sends something like this:
foo.1.bar=hello

in my FormRequest class I have tried:
public function rules()
    {
        return [
            'foo.1.bar' => 'string|nullable' // does not work

            'foo' => 'array|nullable' // does not work

            'foo' => [ // does not work
              '1' => [
                'bar' => 'string|nullable'
              ]
            ]

Any idea how to handle this?
Comment: hm, how would you do that?
Comment: @mwager tried this `'foo.*.bar' => 'string|nullable'`
Comment: Please can you show how you're sending the data i.e. is it a straightforward form or are you using javascript?
Comment: When the validation *should* fail what the output for `dd($this->all())` ?
Comment: $request->all() returns: array:36 [
  "foo.1.bar" => "hello" ... but $request->validated() does not contain "foo.1.bar" anymore
Answer: Try getting the value of the parameter manually and then validating it:
class YourRequest extends FormRequest
{
    public function rules(): array
    {
        return [...];
    }

    public function withValidator(Validator $validator): void
    {
        $value = $this->get('foo.1.bar') ?: $this->get('foo_1_bar');

        $validator->after(function (Validator $validator) use ($value) {
            if ($value == null) {
                $validator->errors()->add('foo.1.bar', 'Error Message.');
                $validator->errors()->add('foo_1_bar', 'Error Message.');
            }
        });
    }
}

Comment: @ClémentBaconnier it does for `$request->get()` on the 5.8.36 version that I tried.
Comment: Does Laravel replace the dots in key with underscore?
Comment: $value is "hello" - but in my controller $request->validated() still does not contain key "foo.1.bar" with value "hello" - did I miss something?
Comment: Does Laravel replace the dots in key with underscore? does not seem to happen: $request->all() returns: array:36 [ "foo.1.bar" => "hello"
Comment: @mwager for `$request->get()` I was able to validate this with underscores, but it looks like it works differently in the `rules()` array.


Using JOIN, or Sub-query (SELECT within SELECT) to roll 3 rows in to 1

Question: I have an Oracle SQL view with an ID, TIME_STAMP, LOCATION and a "COMMAND" variable which is used to describe "Time IN", "Time Requested" and "Time Out" as an integer 1, 2, 3, respectively, such as:

ID
Time
Command
Location

1
00:20:00
1
51

2
00:22:00
1
52

1
00:30:00
2
51

1
00:32:00
3
51

2
00:40:00
2
52

2
00:43:00
3
52

1
00:50:00
1
52

1
00:52:00
2
52

3
01:10:00
1
53

1
01:22:00
3
52

3
01:40:00
2
53

3
01:52:00
3
53

I would like to group the IDs of Time IN, REQ, and OUT into one row, for each ID visit to each location, to get the result:

ID
Time IN
Time REQ
Time OUT
Location

1
00:20:00
00:30:00
00:32:00
51

2
00:22:00
00:40:00
00:43:00
52

1
00:50:00
00:52:00
01:22:00
53

3
01:10:00
01:40:00
01:52:00
52

I achieved this by searching where command = 1 (all IN instances) and then using a SELECT in the SELECT statement
SELECT
O.ID AS "ID",
O.TIME AS "TIMEIN",

(SELECT
    MIN(TIME)
    FROM VIEW I
    WHERE O.LOCATION = I.LOCATION AND COMMAND = ('2') AND O.ID = I.ID AND O.TIME < I.TIME)
AS "TIMEREQ",

(SELECT
    MIN(TIME)
    FROM VIEW I
    WHERE O.LOCATION = I.LOCATION AND COMMAND = ('3') AND O.ID = I.ID AND O.TIME < I.TIME)
AS "TIMEOUT",

O.LOCATION AS "LOCATION"

FROM VIEW O
WHERE
LOCATION IN ('52','53','54') AND COMMAND IN ('1')
ORDER BY TIME DESC

The results of this takes ~11s for 12,000 rows.
When I then tried to JOIN a table to this, which just contains:

ID
Comment

1
Hello, World!

2
Test comment

The view never loads, tried up to ~50s, but either way this is too slow and I'm expecting incorrect.
I've tried to use a different approach by using a SELECT statement within the JOIN statement to see if the performance was any better but I'm struggling to get it to work:
SELECT
P.ID AS "ID",
P.TIME AS "TIMEIN",
TIMECOM2 AS "TIMEREQ",
P.LOCATION AS "LOCATION",
P.COMMAND AS "COMMAND"

FROM VIEW P
LEFT JOIN
(SELECT
MAX(C.ID) AS "REQID",
MIN(C.TIME) AS "TIMECOM2"
FROM VIEW C
WHERE C.COMMAND = 2 AND C.LOCATION IN (52, 53, 54) AND C.ID = '2253')
ON (P.ID = REQID) AND TIMECOM2 > P.TIME

WHERE
P.ID = '2253' AND
P.LOCATION IN (52, 53, 54) AND
P.COMMAND = 1
ORDER BY P.TIME, TIMECOM2

I tried many different approaches in the above, but that was the last attempt, and note I only tried with TIMEREQ and picked a specific ID to try to get it to work in the first instance. I think my issue lies in not being able to use VIEW P in the SELECT statement, such as P.TIME > C.TIME in the WHERE statement. I am getting such results:

ID
TIMEIN
TIMEREQ

2253
31-OCT-22 22:20:15
31-OCT-22 22:40:11

2253
01-NOV-22 09:40:19
(null)

2253
01-NOV-22 11:04:59
(null)

2253
01-NOV-22 18:21:19
(null)

2253
01-NOV-22 19:20:38
(null)

Which I don't understand - I can get it to show the MIN or MAX date in each row, or the MIN or MAX in the first row, or all others..
Also, could anyone explain why SELECT statements within SELECT statements are slow, or am I missing something? Obviously I don't know if JOIN is any faster as I failed to get it to work.
Answer: Instead of using multiple correlated subqueries, we can try and address this as a gaps-and-islands problem.
An island starts with a command 1 at a given location and id : we can compute this
with a cumulative sum ; the rest is conditional aggregation:
select id, location,
    min(time) time_in,
    max(case when command = 2 then time end) time_req,
    max(case when command = 3 then time end) time_out
from (
    select v.*,
        sum(case when command = 1 then 1 else 0 end) over(partition by id, location order by time) grp
    from myview v
) t
group by id, location, grp

Note that this properly manages incomplete islands (ie that do not have all 3 commands) ; in that event, dates of missing commands will appear as null.
Comment: Thank you for your answer, it worked and is getting responses so much quicker, although some of the results aren't working.. some are showing the same IN and OUT time and no REQ time. I'll look into why this could be and respond.
Comment: @FuzzUK: *the same IN and OUT time and no REQ time* : seems like you have duplicates in your data.`select id, location, time, count(*) from myview group by id, location, time having count(*) > 1`
Comment: Yes you are right - I have a few issues in the original table. Command 2 is sometimes missing, but there is another Command '5' which could be used as a CASE? If so could you advise where it could go? FYI, there may be 2 between Com 1 and 3, so a MIN/MAX? Also sometimes there is an anomaly where a 'fake' entry gets put in, can you explain how I can exclude these if 'USER_COMMAND' = 80. I solved this by inserting 'WHERE USER_COMMAND <> 80' prior to the 'GROUP BY ID, LOCATION, GRP' in your answer. Do you have any explanation/further reading on how your answer works so I can understand it?
Answer: select  *
from    t
pivot  (min(time) for command in(1 as time_in,2 as time_req,3 as time_out)) p left join t2 using(ID)

ID
LOCATION
TIME_IN
TIME_REQ
TIME_OUT
Comment

1
51
00:20:00
00:30:00
00:32:00
Hello, World!

1
52
00:50:00
00:52:00
01:22:00
Hello, World!

2
52
00:22:00
00:40:00
00:43:00
Test comment

3
53
01:10:00
01:40:00
01:52:00
null

Fiddle


Accordion bass volume too loud

Question: I am playing a piano accordion. Seems the bass is very/too loud than the treble even I only pressed the basses quickly and lightly. I googled and saw someone said that Open the box and put a tape across the holes or reeds on the bass side... Is it a proper way to reduce the bass volume, Or have other ways to do it?
Answer: You don't mention at all what kind of accordion you play and what registers there are in treble and bass.  You also don't mention whether your concern is with the actual bass notes or with the chords on the bass side.
Different instruments have different disposition and registration possibilities and accordingly different ways of addressing imbalances.  An instrument designed to be useful for Folk music tends to have a comparatively strong bass side exactly because the normal manner of play would combine a comparatively full registration on the treble side with poignant staccato play on the left.
How much leeway there is for held notes on the bass side and/or comparatively light registration on the treble side depends on the size, design and purpose of an instrument.  For some, this can become tricky.
Comment: Thanks. My accordion is Horner-1305 with 72 basses and 34 trebles, and 4 registers.
Answer: I'd first check to see if there is a register switch. Sometimes one balance bass vs treble using switches. (More reed banks can be switched in or out.) Most accordions are pretty well balanced from the factory.
Comment: My accordion is Horner-1305 which has 4 treble switches (and 72 basses and 34 trebles). Thanks

Accordion bass volume too loud


How does addition work in Computers?

Question: I was watching a video on computer architecture and a question came to my mind. How does addition and basic operations work on computers? I mean, i know that 2+2 = 4 but i don't know why? i just know that if i add 2 apples to another 2 then i see 4, but is there a possible demonstration of this?
My question being is, how does a computer know that 2 + 2 = 4 at the most basic level? i know there are functions that add numbers, but at a basic level how is that addition performed?
I just want to know this to understand better how computers work as the most basic and used operation performed by a computer is the sum ( i believe )
Answer: At the "very bottom" numbers are just binary, and physical electronic hardware is used to perform the addition operation itself1 (where each bit in the number is represented by an on/off of the physical circuit line) - this is done by some variation of an an Adder circuit.
For "how" the math works see Two's complement: Aritmetic, which is the most commonly used integer encoding. Conceptually such arithmetic is similar to that of other bases, such as base-10/decimal taught in school.

1 Modern/conventional computers: there have been mechanical computers (at least insofar as 'calculating machines'), analog computers, and takes on quantum computers, etc.
Answer: there are different adders and sub tractors which are which are connected thro' circuit.
.full adder ,half adder is for different no range. all these adders are arranged such as in the form of o' and 1' for each digit there is binary bit code . its too easy .u will get it if u read it once

How does addition work in Computers?


How can one project a matrix so that its components are within the range of [0,1]

Question: I came across a text that mentions obtaining a matrix $S$ from a matrix $B \in \mathbb{R}^{n\times d}$ in the following manner:

$S = Proj_{[0,1]}(B)$,

where $Proj_{[0,1]}(.)$ is a function that projects a real matrix into the range of $[0,1]$.

The matrix B here is to be transformed so that each element of the matrix S is in the range of [0,1].
I have been finding it difficult to figure out, what is such a possible projection function?
Source: https://doi.org/10.1109/TNNLS.2021.3093426 (eqn. 12)
Comment: The provided link is not free-to-read, so I can't access the source for more details. Does it mean transforming a matrix so each element is in the range of $[0, 1]$, or mapping a matrix to a single real number in $[0, 1]$?
Comment: The matrix is transformed so that each element of the matrix is in the range [0,1].
Comment: I'm wondering whether it could be a simple $S = \frac{B - \min\{B\}}{\max\{B\}-\min\{B\}}$, however I'm not confident whether this operation can be called a projection.
Answer: It is specified in equation 11 just before
\begin{equation}
S^* = \text{argmin}_{S,0\leq S\leq 1} \left\| S-B \right\|_F
\end{equation}
So
\begin{equation}
S^*_{i,j}
=
\begin{cases}
B_{i,j},& 0\leq B_{i,j} \leq 1\\
0, & B_{i,j} <0\\
1, & B_{i,j} >1
\end{cases}
\end{equation}
Comment: Oh I see, thank you.


Is there a way to know if my user has finished a download?

Question: For a project, I'll need to know if my user has finished to download a file to delete it on my remote server. Is there a way to do that ?
Comment: Is this for S3 or EC2?
Comment: Both. A file stored in my EC2 server or on S3.
Answer: There are a couple ways of doing this, some more efficient than others, but here is what I've come up with.
Download through your application
If your application is downloading/passing the file through to the user you can trigger a function at the end of the stream to delete the file.
S3 Bucket Access Logging
S3 has access server logs (http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html) that log information for each request. Depending on how your application is structured, you may be able to process these to see what's been accessed.
There may be up to a 30-60 minute delay in log availability
Other Options
There are some other options, though perhaps not ideal (without knowing the specifics of your application I don't know whether these are acceptable).

Use Object Expiration (http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectExpiration.html)
Related SO question (PHP instead of ROR, but the concepts should apply) Resumable downloads when using PHP to send the file?


What does the expression 'a closed subset of a set' imply?

Question: This question is about the terms: a closed or open subset of some set.
If we say that $A$ is an open subset of the topological space $(X, \tau)$, then, it is apparent that $A$ is open in $X$, that is, $A \in \tau$.
On the other hand, consider any subset $B $ of $ X$, and say $C$ is a closed subset of $B$. Now, I guess there are two possible interpretations:

$ C $ is a subset of $B$ that is closed in $X$;
$C$ is a subset of $B$, and $ C $ is relatively closed in $B$, i.e., $C$ is closed in the subspace $B$ of $X$.

In the second case, $C$ is not necessarily closed in $X$.
I came up with this question when reading the article The Theorems of Bony and Brezis on Flow-Invariant Sets. On the first page, the author says $F$ is a closed subset of $\Omega$, where $\Omega$ is a subset of the Euclidean space $\mathbb{R}^n$. If I accept the first interpretation, I would say the condition on $F$ is too restrictive, especially when $\Omega$ is open in $\mathbb{R}^n$, which is quite likely for dynamical systems.
In the original paper,

Throughout this note $\Omega$ is a domain in real Euclidean space $E_n$, $X(x)$ is a function on $\Omega$ to $E_n$, and $F$ is a closed subset of $\Omega$.

But the source from which I encounter this confusion is not restricted to the referenced paper. I want to know what is the usually accepted interpretation in the literature.
If there is any possibility that it depends on the context, I would like to have comments about which one is correct from someone familiar with the theory about the invariance of a set with respect to dynamical systems.
Update: It turned out from a paper the author cited that the second one was what he meant. Refer to On a characterization of flow-invariant sets, where the author states that

Let $E$ be a finite-dimensional Euclidean space. Let $\Omega$ be an open set in $E$ and let $F \subseteq \Omega$ be relatively closed in $\Omega$.

After all, this is satisfying because the second interpretation looked much more reasonable to me. But I am still not sure what is naturally accepted.
Comment: I claim the answer is definitely your second interpretation. The sentence "A is closed in B" usually means that A is a subset of the topological space B. It is common to treat subsets of topological spaces as synonymous with the subspace they define. So "B" would be understood to be the subspace of X defined by (the actual subset) B, and A would be taken to be closed relative to it. This is just my gut feeling - I don't have references to back it up (or I'd post an answer). But I'd put money on it.
Answer: Let $X$ be a topological space and let $C\subset B\subset X$ be subsets.

If $C$ is closed in $X$ then $C=X\setminus C_o$ for some open $C_o\in\tau_X$. The open sets in the subspace topology $\tau_B$ of $B$ are of the form $S_B=S_o\cap B$ for some $S_o\in\tau_X$. Since $C\subset B$ we have
$$
C=
X\setminus C_o=
(X\setminus C_o)\cap B=
(X\cap B)\setminus (C_o\cap B)=
B\setminus (C_o\cap B),
$$
i.e. $C$ is a complement of an open set in the subspace topology, so $C\subset B$ is closed for the subspace topology on $B$.

Let $C\subset B$ be closed in $B$ for the induced subspace topology, i.e. $C=B\setminus(C_o\cap B)$ for some open $C_o\in\tau_X$. If $B$ is closed then $B=X\setminus B_o$ for some $B_o\in\tau_X$. Thus:
$$
C=
B\setminus(C_o\cap B)=
B\setminus C_o=
(X\setminus B_o)\setminus C_o=
X\setminus (B_o \cup C_o).
$$
Since $B_o \cup C_o\in\tau_X$ this shows, that in this case indeed $C$ is closed for the topology on $X$.
As you already stated, if $B$ is not closed, there is nothing to say in general. $C$ may or may not be closed for the topology on $X$.

From this you see: in any of the two cases $C$ is closed for the subspace topology on $B$. The reverse is however not given. In particular for your application when $F$ is a "domain" usually one has $F$ being open in $X$. This does not exclude closedness per se, but in many cases open domains are not closed.
Comment: So which of OP's two possible interpretations is correct?
Comment: I think this misses the point of the question. OP says "In the second case, $C$ is not necessarily closed in $X$..." so I think they essentially understand the point you have made.
Comment: Maybe I missed the point of the question. I assumed the question was in the title: "Does the expression 'a closed subset of a set' always imply the subset is closed in the subspace topology?" I think I answered that question. I did not find another question in the body of the text, only background explanation. So, if the title question was not the one to be answered I ask for clarification about the question.
Comment: I admit the title was not representing correctly. Thank you.
Comment: OK. In that case my answer and I will not be of much help. I am not familiar with the conventions such papers and the associated community use. Apologies.


$(a_n)$ is covergent. $(k_n)\in\mathbb{N}$, $(k_n)\to\infty$. Decide if $(a_{k_n})$ is covergent.

Question: $(a_n)$ is covergent sequence. $(k_n)$ is natural sequence such that $(k_n)\to+\infty$.  Is it true that $(a_{k_n})$ is covergent ?
Being honestly, I have no idea how to solve this problem. Can you help me ?
Comment: @Happy man: Using the definition of "$(k_n)\to +\infty$" and the definition of "$(a_n)$ is convergent" should not be that difficult. Can you write them down?
Comment: This looks like a homework problem, can you write down what you have tried so far? What are your thoughts about this?
Answer: Fix $\varepsilon>0$. By the convergence of $a_n$, $\exists N$ such that for all $n>N$, $|a_n-l|<\varepsilon$.
Now, since $n_k \rightarrow \infty$, $\exists K$ such that for all $k>K$, $n_k>N$.
Thus, for all $k>K$, $n_k>N$ so $|a_{n_k} - l|< \varepsilon$.
Answer: Of course it converge !
Let $\varepsilon>0$. By definition of the convergence of $(a_n)$ (we denote $\ell$ it's limit), there is $N\in\mathbb N$ s.t. $$|a_k-\ell|<\varepsilon$$
when $k\geq N$. Since $n_k\geq k$, when $k\geq N$, you also have $n_k\geq N$, and thus $$|a_{n_k}-\ell|<\varepsilon$$ when $k\geq N$. The claim is proved !
Comment: I think you need to be careful here. The question wasn't asking about subsequences of a_n but any n_k tending to infinity.
Comment: What would be $(a_{n_k})$ if it's not a subsequence of $(a_n)$ ? Anyway, even if $n_k$ is not increasing or not injective (what would be weird...), the proof is very easely adaptable since by definition of $k_n$, there is a $M$ s.t. $k_n\geq N$ for all $n\geq M$. @Chessanator
Comment: Sorry: I wasn't clear. The definition of subsequence requires that n_k be increasing. Thus you do have to throw in that adaptation to get the required proof.
Comment: The notation $a_{n_k}$ is never used when $(a_{n_k})$ is not a subsequence of $(a_n)$. @Chessanator


What is an efficient way to show two spaces are homeomorphic?

Question: Okay here is the setup to a problem I have. We have $\mathbb{R}^3$ along with the standard topology and then two subspaces that are given the subspace topology. I forget the explicit definitions of the two subspaces $A,B$ but it is essentially a 3d parabola and a kind of cone shape. I can see looking at them that they would be homeomorphic I think but I don't know how to prove it.
So right now I have $A=\{(x,y,z) \in \mathbb{R^3}: \text{Something}\}$ and $B=\{(x,y,z) \in \mathbb{R^3}: \text{Something}\}$ and I want to show they are homeomorphic so what is a good way to do this?
Also I don't really see the significance of $A,B$ be given the subspace topology what difference does that make?
In general is it better to explicitly give such a homeomorphism or is there something else I can do?
Comment: There is no efficient way to show that two spaces are homeomorphic. This task is extremely difficult and in most cases you just construct a homeomorphism directly or indirectly as a composition of homeomorphisms. It is alot easier to show that two spaces are not homeomorphic by looking at topological invariants.
Comment: do not vandalise your posts... You may edit your question to clarify it but not delete it.
Comment: Giving $A$ and $B$ the subspace topology is just the normal way to turn them into topological spaces. If you don't give them a topology, then they're just sets. Also, if you give $A$ two different topologies, then the two copies are no longer homeomorphic, at least not via the identity map. So it makes a difference as to what $A$ will be homeomorphic to.
Comment: As for how to show that $A$ and $B$ are homeomorphic, depending on their specific characteristics, you may be able to either write down a specific homeomorphism between them, or give a more abstract argument along these lines: http://math.stackexchange.com/questions/165629/proof-that-convex-open-sets-in-mathbbrn-are-homeomorphic  That specific result may not be useful to you, though.
Answer: Every subset of $\mathbb R^3$ is its own special snowflake, and there is no algorithm for deciding when two of them are homeomorphic. It's not simply that no algorithm is known; no algorithm for solving this can possibly exist because there are too many subspaces.
When you are given these problems you can collect tools that will help you solve new ones, but it's possible that none of your known tools will work on a new problem you're presented with and you'll have to come up with a new idea. This is typical for advanced math problems. There are very few patterns, and solving new problems means coming up with new ideas.


Getting the URL for every language

Question: I have a route of a page, and I want get the link for it on every language of my site.
On my site the contact page is: en/contact for English, and es/contactenos for Spanish.
I am trying using the following code, but I am getting just the URL for the current language set for the site.
<code>$route = 'contact.site_page';
$url = new Url($route);
$uri = $url->toString();
</code>
How do I get it for every language available for the site?
Answer: I found the solution myself, with the following code.
<code>// Get all languages of the site
$languages = \Drupal::languageManager()->getLanguages();

// Route of contact for example:
$route = 'contact.site_page';
foreach ($languages as $language) {
  $url = new Url($route, [], ['language' => $language]);
  $uri = $url->toString();
}
</code>

Getting the URL for every language


Use GET instead of POST for AJAX call

Question: I was wondering if anyone had any tips for use a GET call with ajax forms instead of POST?
One of our ajax calls is returning some JSON that we want to be cached in the browser.  If we can switch the call to GET then that caching will happen for us.
Comment: can you tell us what's your purpose?
Comment: what if you add `$.ajaxSetup({ cache:true });`? Be aware that this will affect all subsequent AJAX requests.
Answer: It is easy to use GET instead of POST, but Drupal sends a lot of information about dom-elements and loaded css/js, so that it is often too long for a GET request..
<code>var ax = new Drupal.ajax("element-name", this, element_settings);
ax.options.type = "GET";
</code>
If you do not use these, you can strip them:
<code>//Override parameters for Get Requests
var backup = Drupal.ajax.prototype.beforeSerialize;
Drupal.ajax.prototype.beforeSerialize = function(element, options) {
  if(options.type != "GET") backup.call(this, element, options);
}
</code>
Answer: Use the Views Ajax Get module to convert post request to get

This module will make your ajax-enabled Views, use GET instead of POST.

Use GET instead of POST for AJAX call


Alguém sabe resolver esse problema: cannot load such file -- rubygems.rb (LoadError)

Question: Já removi o ruby e tudo mais e atualizei o sistema, mas isso passou a acontecer depois da atualização do Jekyll
:1:in require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in'
Não consigo rodar nenhum comando relacionado.
Comment: cade o código pra analisar onde pode estar o erro?
Comment: Olha este link http://stackoverflow.com/questions/2896485/no-such-file-to-load-rubygems-loaderror tem um bom número de respostas.
Answer: Caso você esteja usando RVM tente:
rvm fix-permissions
rvm reinstall VERSÃO_DO_SEU_RUBY

Caso não tente:
gem install rubygems-update
update_rubygems


MSSQL 2000 installation error: Setup failed to configure the server. Refer to the server error logs

Question: I'm trying to install MSSQL 2000 on a virtual Windows 2003 instance. However, every time I run the install program, it fails to start the service. This is the error log:
21:46:50 C:\Program Files\Microsoft SQL Server\80\Tools\Binn\cnfgsvr.exe  -F "C:\WINDOWS\sqlstp.log" -I MSSQLSERVER -V 1 -M 0 -Q "SQL_Latin1_General_CP1_CI_AS" -H 131408 -U sa -P
###############################################################################

Starting Service ...

SQL_Latin1_General_CP1_CI_AS

-m -Q -T4022 -T3659

Connecting to Server ...

driver={sql server};server=xxxxxxxxxx;UID=sa;PWD=;database=master

[Microsoft][ODBC SQL Server Driver]Timeout expired

driver={sql server};server=xxxxxxxxxx;UID=sa;PWD=;database=master

[Microsoft][ODBC SQL Server Driver]Timeout expired

driver={sql server};server=xxxxxxxxxx;UID=sa;PWD=;database=master

[Microsoft][ODBC SQL Server Driver]Timeout expired

SQL Server configuration failed.

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

21:49:34 Process Exit Code: (-1)
22:19:04 Setup failed to configure the server.   Refer to the server error logs and C:\WINDOWS\sqlstp.log for more information.
22:19:04 Action CleanUpInstall:
22:19:04 C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\SqlSetup\Bin\scm.exe  -Silent 1 -Action 4 -Service SQLSERVERAGENT
22:19:05 Process Exit Code: (1060) The specified service does not exist as an installed service.

22:19:05 C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\SqlSetup\Bin\scm.exe  -Silent 1 -Action 4 -Service MSSQLSERVER
22:19:05 Process Exit Code: (0)
22:19:05 StatsGenerate returned: 2
22:19:05 StatsGenerate (0x0,0x1,0xf00000,0x200,1033,303,0x0,0x1,0,0,0
22:19:05 StatsGenerate -1,Administrator)
22:19:05 Installation Failed.

Has anyone had this problem? Any ideas about how to fix it?
Thanks very much,
Michael
Answer: these errors are from the configuration portion of the setup, which doesn't say much other then not being able to connect to sql server & that the service doesn't appear to be installed.  As the log suggests, you should look at C:\WINDOWS\sqlstp.log may be more helpful in determining why the services failed to install.
Comment: Thanks, Nick. That *is* the C:\WINDOWS\sqlstp.log that I posted.
Comment: oh. bugger.  Anything more meaningful in C:\windows\setup.log or in the errorlog under the sql server path
Answer: The error indicates that it is not able to login to the SQL server. See if the service is running under start -> control panel -> Administrative Tools -> Services. You should see an entry for MSSQL Server or SQL Server and it should be running. If it is not running then try to start it and then connect from a command prompt using
osql -E

If it won't start, try uninstalling and reinstalling SQL.
Answer: I would suggest that SQL Server simply isn't installing: there are no services to start or connect to...
However, the clue here might be "virtual": KB 327270
And you need at least SP3 to run on Windows 2003: what edition are you installing?
Comment: I think the "virtual" was the problem. I just got a dedicated server and it worked fine. Thanks, gbn...


SQL Server - View name in definition is different from actual view name

Question: I ran into a weird issue in SQL server. I have a view in db named "SPH_F2V_VEB_FIN-04-GLA-07 - Reversed and Cancelled GL Postings", But when ran the following query, I got a definition with the name changed.
SELECT object_definition (OBJECT_ID(N'dbo.SPH_F2V_VEB_FIN-04-GLA-07 - Reversed and Cancelled GL Postings'))

Output:
CREATE VIEW [dbo].[SPH_F2V_VEB_FIN-04-GLA-07 - Reversed & Cancelled GL Postings] AS

SELECT
    --GL1.[Business Unit],
    GL1.[Company Code],
    GL1.Description,
....

If you notice, the name changed to "SPH_F2V_VEB_FIN-04-GLA-07 - Reversed & Cancelled GL Postings", changing "and" to "&". At first It seemed like a sql conversion issue or something related to "and", but I tried several views with "and" and "&", they seemed to be working as expected.
So, any chance how this could happen ? I am even quite skeptical of how DB allows this. Any idea would be deeply appreciated !!
Comment: @GordonLinoff - I checked the db, the view with '&' is not there. So it's just one view.
Answer: This can happen if you use sp_rename to rename the view.
It is best to drop and create it to rename it.

Renaming a stored procedure, function, view, or trigger will not
  change the name of the corresponding object name in the definition
  column of the sys.sql_modules catalog view. Therefore, we recommend
  that sp_rename not be used to rename these object types. Instead, drop
  and re-create the object with its new name.
Comment: You are right. So, they say, **The warning comes after the spells**


Login custom route being rejected by Auth

Question: Router::scope('/:club_slug', function ($routes) {
    $routes->connect('/login', ['controller' => 'Users', 'action' => 'login']);
});

So when I'm trying access http://example.com/club-name/login, I'm being redirected to http://example.com/users/login with the flash message You have to login to access this area.
Auth loginAction is [controller => 'Users', 'action' => 'login'], since the custom route that I mentioned at beginning of the question is pointing to the path that is specified at loginAction I thought the route will know that I'm talking about the same thing but is not what is happening.
Comment: First question, is `User` just a mistake in this code example, or does the login action really use the singular name as opposed to the plural one in your route?
Comment: just a mistake, I will edit the question
Answer: Dynamic route elements are not being added/recognized automatically, you'll either have to persist them using either the persist option (applies only to that specific route):
Router::scope('/:club_slug', function ($routes) {
    $routes->connect(
        '/login',
        ['controller' => 'Users', 'action' => 'login'],
        ['persist' => ['club_slug']]
    );
});

or URL filters (affects all routes that are using a club_slug element):
Router::addUrlFilter(function ($params, $request) {
    if (isset($request->params['club_slug']) && !isset($params['club_slug'])) {
        $params['club_slug'] = $request->params['club_slug'];
    }
    return $params;
});

or you have to pass the element to your login action manually (this would match the club_slug route regardless of the current URL):
'loginAction' => [
    'controller' => 'Users',
    'action' => 'login',
    'club_slug' => 'club-slug' // wherever it may have come from
]

See also

Cookbook > Routing > Creating Persistent URL Parameters
API > Cake\Routing\RouteBuilder::connect()
Comment: In my case the second one was better


Trigger Powershell Command to Copy SQL Backups to Network Drive

Question: I've got two servers on a workgroup and I need to transfer my SQL Server 2008 Backups from the local drive of one to a network drive on another. Ideally, I'd like to have SQL call the Powershell script after it does the backup. Anyone have a script that does this? Is there a better way?
I tried to have SQL Backup straight to the network drive but it doesn't seem I can do that without them being on the same domain.
Answer: Powershell can certainly do that, but I find ROBOCOPY easier, just use the /MIR option to automatically purge older ones after creating a Maintenance cleanup plan on the SQL server to keep get rid of backups more than X days, and you'll always have copies on the netowrk drive;
You can set up the copy as a Windows Scheduled Task, or as a SQL Agent task via an Operating System command.
Answer: I wrote this script for myself. It creates backup right into network share with my own comfortable file name formatting. It executes from windows scheduler.
<code>function Backup-Database {
    [CmdletBinding()]
    param(
        $Server,
        [String[]]$Database,
        [String]$Path,
        [Switch]$CreateSubfolder,
        [Switch]$Check,
        [Switch]$CopyOnly,
        [Switch]$BackupDatabase = $true,
        [Switch]$BackupTransactionLog,
        [Switch]$NoInnerVerbose,
        [Switch]$Differential
    )

    begin {
        $AllDatabases = @()
    }
    process {
        #All database names into 1 list
        $AllDatabases += $Database
    }
    end {
        $DefaultProgressPreference = $ProgressPreference
        if (-not $Path.EndsWith('\')) {
            $Path = $Path + '\'
        }
        #$Differential = $false
        $RetainDays = 0
        if ($Differential) {
            $RetainDays = 31
        }
        if ($NoInnerVerbose) {
            $Verbose = $false
        }
        else {
            $Verbose = ($VerbosePreference -eq 'Continue')
        }

        Import-Module SQLPS -Verbose:$false -WarningAction SilentlyContinue
        $Activity = "Backing up databases"

        # Some cmdlets cannot specify timeouts, this is workout
        Write-Verbose "Connecting to $Server"
        Write-Progress -Activity $Activity -CurrentOperation "Connecting to $Server"
        $ServerInstance = New-Object Microsoft.SqlServer.Management.Smo.Server $Server
        $ServerInstance.ConnectionContext.StatementTimeout = 0

        for ($index = 0; $index -lt $AllDatabases.Count; $index++) {
            $TotalProgress = $index / $AllDatabases.Count * 100
            $DB = $AllDatabases[$index]
            $DBTitle = [Char]::ToUpperInvariant($DB[0]) + $DB.Substring(1)
            $Operation = "Backing up $DBTitle database"
            #Write-Verbose $Operation

            if ($Check) {
                Write-Progress -Activity $Activity -CurrentOperation $Operation -Status 'Checking database integrity' -PercentComplete $TotalProgress
                Write-Verbose "Checking $DB database integrity"
                Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $DB -Query 'DBCC CHECKDB($(dbname))' -Variable "dbname='$DB'" -Verbose:$Verbose -QueryTimeout 65535
            }

            if ($BackupTransactionLog) {
                Write-Progress -Activity $Activity -CurrentOperation $Operation -Status 'Backing up transaction log' -PercentComplete $TotalProgress
                $FileName = $Path
                if ($CreateSubfolder) {
                    $FileName = Join-Path $FileName $DBTitle
                    if (-not (Test-Path $FileName)) {
                        Push-Location
                        New-Item $FileName -ItemType Container -Force | Out-Null
                        Pop-Location
                    }
                }
                $FileName = Join-Path $FileName "$($DBTitle)_$(Get-Date -format 'yyyy-MM-dd_HH-mm')_log.trn"

                Write-Verbose "Backing up transaction log to $FileName"
                $ProgressPreference = 'SilentlyContinue'
                Backup-SqlDatabase -Database $DB -BackupFile $FileName -InputObject $ServerInstance -BackupAction Log -Checksum:$Check -CompressionOption On -CopyOnly:$CopyOnly -RetainDays $RetainDays -LogTruncationType Truncate -Verbose:$Verbose
                $ProgressPreference = $DefaultProgressPreference

                if ($Check) {
                    Write-Progress -Activity $Activity -CurrentOperation $Operation -Status 'Checking transaction log backup integrity' -PercentComplete $TotalProgress
                    $FileNumber = Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'select position from msdb..backupset where database_name=$(dbname) and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=$(dbname))' -Variable "dbname='$DB'" -Verbose:$Verbose | select -ExpandProperty position
                    $Position = Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'RESTORE HEADERONLY FROM DISK=$(filename)' -Variable "filename='$FileName'" -Verbose:$Verbose | select -Last 1 -ExpandProperty Position
                    if ($FileNumber -ne $null -and $FileNumber -eq $Position) {
                        Write-Verbose "Verifying backup file '$FileName', position $FileNumber"
                        Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'RESTORE VERIFYONLY FROM DISK=$(filename) WITH FILE=$(position)' -Variable "filename='$FileName'","position=$FileNumber" -QueryTimeout 65535 -Verbose:$Verbose
                    }
                    else {
                        Write-Error "Transaction log verify failed. Backup information for database $DB not found or incorrect (query position $FileNumber, file position $Position)" -Category InvalidResult
                    }
                }
            }

            if ($BackupDatabase) {
                Write-Progress -Activity $Activity -CurrentOperation $Operation -Status 'Backing up database' -PercentComplete $TotalProgress
                $FileName = $Path
                if ($CreateSubfolder) {
                    $FileName = Join-Path $FileName $DBTitle
                    if (-not (Test-Path $FileName)) {
                        Push-Location
                        New-Item $FileName -ItemType Container -Force | Out-Null
                        Pop-Location
                    }
                }
                if ($Differential) {
                    $part = 'diff'
                }
                else {
                    $part = 'full'
                }
                $FileName = Join-Path $FileName "$($DBTitle)_$(Get-Date -format 'yyyy-MM-dd_HH-mm')_$part.bak"

                Write-Verbose "Backing up $DB database to $FileName"
                $ProgressPreference = 'SilentlyContinue'
                Backup-SqlDatabase -Database $DB -BackupFile $FileName -InputObject $ServerInstance -BackupAction Database -Checksum:$Check -CompressionOption On -Incremental:$Differential -CopyOnly:$CopyOnly -RetainDays $RetainDays -Verbose:$Verbose
                $ProgressPreference = $DefaultProgressPreference
                #Backing up (Database: 'accounting' ; Server: 'Serv1C' ; Action = 'Database') .

                if ($Check) {
                    Write-Progress -Activity $Activity -CurrentOperation $Operation -Status 'Checking database backup integrity' -PercentComplete $TotalProgress
                    $FileNumber = Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'select position from msdb..backupset where database_name=$(dbname) and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=$(dbname))' -Variable "dbname='$DB'" -Verbose:$Verbose | select -ExpandProperty position
                    $Position = Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'RESTORE HEADERONLY FROM DISK=$(filename)' -Variable "filename='$FileName'" -Verbose:$Verbose | select -Last 1 -ExpandProperty Position
                    if ($FileNumber -ne $null -and $FileNumber -eq $Position) {
                        Write-Verbose "Verifying backup file '$FileName', position $FileNumber"
                        Invoke-Sqlcmd -ServerInstance $ServerInstance -Query 'RESTORE VERIFYONLY FROM DISK=$(filename) WITH FILE=$(position)' -Variable "filename='$FileName'","position=$FileNumber" -QueryTimeout 65535 -Verbose:$Verbose
                    }
                    else {
                        Write-Error "Database backup verify failed. Backup information for database $DB not found or incorrect (query position $FileNumber, file position $Position)" -Category InvalidResult
                    }
                }
            }
        }
        Write-Progress -Activity $Activity -Completed
    }
}

$Server = 'Serv1C'
$Databases = 'accounting3','zup','accounting','pult','accounting_ip','accounting_u','accounting_u2'
$Differential = $true
$TransactionLog = $true
$Check = $false
$BackupPath = '\\MAIN\Backup\SQL'
Backup-Database -Server $Server -Database $Databases -Path $BackupPath -CreateSubfolder -Verbose -NoInnerVerbose -Differential:$Differential -BackupTransactionLog:$TransactionLog -Check:$Check
</code>
Answer: I use Powershell to invoke RichCopy. If you break your big files up into multiple chunks with a RAR utility, RichCopy can really haul bits.
Another approach is to use the PowerShell v2 BITS module, although I've not tried it yet.  Start with "import-module filetransfer" and "get-help add-filetransfer –example"
As for SQL calling the script, try having it call everything explicitly:
%windir%\system32\windowspowershell\v1.0\powershell.exe -nologo -command "&{C:\path\to\Script.ps1}"


Should I use Drush or Drupal Console with a new site?

Question: Between Drush and Drupal Console, which seems to have similar functionalities, which one should I install?
Comment: That may be, but does not negate the fact that you can no longer install Console on newer versions of Drupal.
Comment: Drush, definitely. AFAIK Drupal Console is not compatible with Drupal 8.7-9, there are various issues in its issue queue, with the last commit being Nov 2019. https://github.com/hechoendrupal/drupal-console/issues
Comment: https://www.drush.org/commands/10.x/generate/
Comment: One great thing about Drupal Console, that you can't do on drush command, is easily generating a custom module or a new block in a custom module. Here's a video on youtube, showing how easy it is to generate your own module: https://www.youtube.com/watch?v=VXi6g1-pLXk
Comment: That's wrong. Drupal Console requires https://github.com/Chi-teck/drupal-code-generator as does Drush. Try [`drush generate controller`](https://github.com/drush-ops/drush/blob/10.x/src/Commands/generate/GenerateCommands.php#L38) or try `drush generate theme --answers '{"Theme name": "test", "Theme machine name": "test", "Base theme": "Classy"}'` or try `drush generate block` etc. Have fun
Answer: You should use Drush.
Drush is about to be added to the drupal/recommended-project, see #3159647, while Drupal Console seems to be abandoned and currently is incompatible with Drupal 9 due to mismatched dependencies, see #4251.
Maybe Drupal Console finally accomplished its mission by triggering the modernisation of Drush. And there's no need for two CLIs. Now forces can be joined again.


Content exists in Drupal but unseen in PHPMYadmin?

Question: I have a content type which I enter data to by means of a csv file. Everything works fine as I have multiple content-types set up like this.
However, I'm trying to clean-up the database and remove data that is from 2012 and before.
Within Drupal at the /admin/content/filter url, I set the parameters for the content-type and such as:
<code>node type is Print Data
and is created before 2013-01-01
and node status is published
</code>
(note, I just used the code indicator to set-off the options for this post)
Upon return, I have pages of content with each page showing 500+ results. I can delete them from within Drupal, but only at 500 at a time so I went to phpMyadmin but in there, I can only see/find data that is from 2013.
So where is Drupal storing all that other data if not in the database?
Answer: First of all allow me to say that you should not delete from db directly unless you are really aware of drupal's architecture and how the db tables are organized. (basically have in mind drupal store information for an entity in multiple tables not only one.)
Secondly have in mind in case you are looking through node table for a node created prior 2013-01-01 m the actual date is saved as unix timestamp (1357020000)
Thirdly allow me to recommend you VBO (View Bulk Operation) module for the exact scenario you are looking for , it will let you bulk delete, unpublish, publish (even has an API for custom bulk operations). I would create a simple view accesible for admins only, exposed filters for node creation date and some basic bulk operation. Please consider using this
Comment: yes, on our live sites I use VBO but on this particular site that's not installed and there are issues with adding modules to this particular install due to shared server issues. However, I will try using a view to see if I can restrict somehow there and get around this 500 limit. Thanks.
Answer: As you cannot go with VBO(View bulk operation), I would suggest you to create a custom script for deleting the code rather than deleting manually from the database:

Can take the reference from devel_generate_content_kill(), this function is called by the devel generate module to delete the multiple nodes.
As the function provides a way to create the script, you need to modify only field condition as per you need.
It would be wise to keep the backup of the existing database(so in case anything goes wrong you can rollback easily).
function custom_node_delete_op() {
  // Define the time value , Example of 10 mins.
  $time_since = time() - 600;
// This will provide the node ids of nodes older than 10 min.
  $results = db_select('node', 'n')
    ->fields('n', array('nid'))
    ->condition('type', 'CONTENT_TYPE', 'IN')
    ->condition('created', $time_since, '<')
    ->execute();
  foreach ($results as $result) {
    $nids[] = $result->nid;
  }
// Execute the code to delete the nodes.
  if (!empty($nids)) {
    node_delete_multiple($nids);
    drupal_set_message(t('Deleted %count nodes.', array('%count' => count($nids))));
  }
}


Chi-square test on a sample from population having an unequal distribution

Question: I got a sample with an unequal gender distribution ($30$ males to $200$ female). This distribution is quite "representative" for the population the sample is taken from.
Nevertheless, in a paper, does it make any sense to report chi-square for gender (with the purpose to show this inequality beyond descriptives)?
Intuitively, I would say no, because the assumption of equality is already not met in population. Hence, it would be some kind of circular reasoning.
Am I right?
Comment: I think this means you're comparing 30/200 with a hypothesis of equal frequencies. That chi-square test makes perfect sense, but doesn't sound interesting or useful. My calculations give $P$-value of the order of $10^{-29}$. There is no circularity in reporting that your sample data echo what is broadly known about the population; it's no more circular than reporting that most of the people attending a girls' school are female, there being some male staff.
Comment: @Jens: Well there has to be a null hypothesis to carry out a test. It could be that the population frequencies of male and female are equal, or in any other proportion. As Nick implies, don't bother testing hypotheses that aren't interesting or useful - would a confidence interval for the proportion be?
Comment: What's "$\chi^2$ for gender" mean? - what null hypothesis are you testing?
Comment: @Scortchi Its not a hypothesis itself, I wanted to use it for showing the inequality of male and female in sample description in an exporative manner. I wonder, if this is even a permissible strategy?
Comment: @NickCox, yes, that's a good point. Reporting $Chi^2$ does not offer a plus of information in this case then. Feel free to write an answer, I will accept it.
Answer: I think this means you're comparing $30/200$ with a hypothesis of equal frequencies implying expected frequencies $115/115$.
My calculations give Pearson chi-square of $125.7$ and a $P$-value of about $4 \times 10^{-29}$: if that's not strong enough to convince the most sceptical of chance sceptics (someone asserting that you could have got this breakdown just by chance by sampling a population with equal frequencies), then your case is hopeless.
That chi-square test makes perfect sense, but doesn't sound interesting or useful. Sometimes, indeed often, descriptive statistics stand and speak for themselves and do not need elaborate tests of the obvious in support. There is no need to test ridiculous hypotheses, or hypotheses you don't entertain seriously.
There is no circularity in reporting that your sample data echo what is broadly known about the population; it's no more circular than reporting that most of the people attending a ballet school are female.
As @Scortchi underlines, a better way of quantifying uncertainty here is using a confidence interval. The proportion of females is $0.87$ and $95$% confidence intervals run from about $0.82$ to $0.91$, regardless of how you calculate them. That interval is clearly a long way from $0.5$.
These calculations are standard, but for the record I used chitesti and cii in Stata. The Stata manual entry on these confidence interval calculations is accessible to all and gives literature references on different methods for binomial confidence intervals. For probabilities very near $0$ or $1$, it matters what method you use, but that does not bite for this example.