text:
Q: Using Spring with App Engine I am struggeling using the basic crud methods with app engine:
My code looks like that:
My CustomerController:
@Controller
public class CustomerController {

@RequestMapping(value = "/add", method = RequestMethod.GET)
public String getAddCustomerPage(ModelMap model) {
   return "command";
}

@RequestMapping(value = "/list", method = RequestMethod.POST)
public ModelAndView add(HttpServletRequest request, ModelMap model) {

    String email = request.getParameter("email");
    String password = request.getParameter("password");

    Customer c = new Customer();
    c.setEmail(email);
    c.setPassword(password);
    c.setDate(new Date());

    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
        pm.makePersistent(c);
    } finally {
        pm.close();
    }

    return new ModelAndView("redirect:command");

}

// get all customers
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String listCustomer(ModelMap model) {

    PersistenceManager pm = PMF.get().getPersistenceManager();
    Query q = pm.newQuery(Customer.class);
    q.setOrdering("date desc");

    List<Customer> results = null;

    try {
        results = (List<Customer>) q.execute();

        if (results.isEmpty()) {
            model.addAttribute("customerList", null);
        } else {
            model.addAttribute("customerList", results);
        }

    } finally {
        q.closeAll();
        pm.close();
    }

    return "list";

}

my mvc-dispatcher-servlet:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<context:component-scan base-package="com.Trium.controller" />
<mvc:annotation-driven />

<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

and the form I want to proceede in command.jsp:
<form id="myForm" class="form-horizontal" action="add"
                                    method="post">
                                    <fieldset>

                                            Email:

                                                <input name="email" placeholder="email"
                                                    class="input-xlarge" type="text"
                                                    value="<%=request.getParameter("email")%>">

                                            Password:

                                                <input name="password" placeholder="password"
                                                    class="input-xlarge" type="text"
                                                    value="<%=request.getParameter("password")%>">

                                    </fieldset>
                                </form>

When I want to proceede the form from http://127.0.0.1:8888/command.jsp. I get:
http://127.0.0.1:8888/add
Error 404
In GAE I get:

WARNING: No mapping found for HTTP request with URI [/add] in
  DispatcherServlet with name 'mvc-dispatcher'

Please help me to find what is wrongly mapped in my application.
UPDATE
<?xml version="1.0" encoding="UTF-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee                http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>SystemServiceServlet</servlet-name>
        <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
        <init-param>
            <param-name>services</param-name>
            <param-value/>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>SystemServiceServlet</servlet-name>
        <url-pattern>/_ah/spi/*</url-pattern>
    </servlet-mapping>

</web-app>

UPDATE - 2
    Mär 26, 2013 4:59:11 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
Mär 26, 2013 4:59:11 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Mär 26, 2013 4:59:17 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Mar 26 16:59:17 UTC 2013]; root of context hierarchy
Mär 26, 2013 4:59:19 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]
Mär 26, 2013 4:59:21 PM org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerDefaultFilters
INFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanning
Mär 26, 2013 4:59:25 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Mär 26, 2013 4:59:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7f5fde46: defining beans [customerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/list],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.add(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/delete/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.delete(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.update(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/add],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getAddCustomerPage(org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/update/{name}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getUpdateCustomerPage(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/list],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.listCustomer(org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/login],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.login(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:30 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 18804 ms
Mär 26, 2013 4:59:37 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
INFO: javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'mvc-dispatcher'
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization started
Mär 26, 2013 4:59:37 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Tue Mar 26 16:59:37 UTC 2013]; parent: Root WebApplicationContext
Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]
Mär 26, 2013 4:59:37 PM org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerDefaultFilters
INFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanning
Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3c050a95: defining beans [customerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@7f5fde46
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/list],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.add(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/delete/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.delete(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.update(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/add],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getAddCustomerPage(org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/update/{name}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getUpdateCustomerPage(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/list],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.listCustomer(org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/login],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.login(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)
Mär 26, 2013 4:59:38 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization completed in 657 ms
Mär 26, 2013 4:59:38 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@0.0.0.0:8888
Mär 26, 2013 4:59:38 PM com.google.appengine.tools.development.AbstractServer startup
INFO: Server default is running at http://localhost:8888/
Mär 26, 2013 4:59:38 PM com.google.appengine.tools.development.AbstractServer startup
INFO: The admin console is running at http://localhost:8888/_ah/admin
Mär 26, 2013 5:59:38 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: Dev App Server is now running
Mär 26, 2013 6:00:11 PM org.springframework.web.servlet.PageNotFound handleHttpRequestMethodNotSupported
WARNING: Request method 'POST' not supported

Now i am getting a different exception. However, I changed nothing from before;P
**WARNING: Request method 'POST' not supported**

A: Can you also add the server log when you startup your AppEngine app in your IDE please?
Spring logs all the URL mappings on startup.
Also in your context:component-scan config, your base package has an uppercase character in it ?
com.Trium.controller

I'm trying to guess here since I don't know CustomerController's package.

A: I feel you are not returning the login page when localhost is actually called. You need to add the following controller mapping to load homepage.
@RequestMapping(value = "/", method = RequestMethod.GET)
public String indexPage(ModelMap map) {
   return "login";
}

Now access your localhost:8888 as your login page.
Try returning the name of the page instead of returning the URL.
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String getAddCustomerPage(ModelMap model) {
  return "command";
}

A: You have this:
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String getAddCustomerPage(ModelMap model) {
   return "command";
}

which handles GET requests. But your command.jsp form does a POST to add
<form id="myForm" class="form-horizontal" action="add" method="post">

So you need another handler method to handle that action. It appears to me you already have that in the other handler method
@RequestMapping(value = "/list", method = RequestMethod.POST)
public ModelAndView add(HttpServletRequest request, ModelMap model) {

    String email = request.getParameter("email");
    String password = request.getParameter("password");

    Customer c = new Customer();
    c.setEmail(email);
    c.setPassword(password);
    c.setDate(new Date());

    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
        pm.makePersistent(c);
    } finally {
        pm.close();
    }

    return new ModelAndView("redirect:command");

}

Change your form to POST to /list
<form id="myForm" class="form-horizontal" action="list" method="post">

Also, you shouldn't do redirect:command. That basically makes a new request to localhost:8888/command which doesn't exist. Do it to redirect:add which will call the handler method above and render command.jsp.


text:
Q: Same Python command works on one computer but doesn't on another in Maya I have an issue with running this command in Maya 2020.4:
import maya.cmds as cmds

cmds.lookThru('CAMERA:sh*_Vcam')

I'm trying to look through a camera, and Maya gives me this error when I try to run it:
# Error: RuntimeError: file <maya console> line 3: Too few arguments given.

I asked a friend, who ran it for me on a different PC with the same Maya version, and it worked.
What am I missing?

A: That error seems to appear when it can't find a camera.
Do a cmds.ls('CAMERA:sh*_Vcam') and see if it finds anything, if not then that's your issue.
mc.lookThru('persp') # works

mc.lookThru('invalid') # RuntimeError

# Quick function if you'd like to avoid the error
def lookThru(cam):
    try:
        mc.lookThru(cam)
    except RuntimeError:
        mc.warning('No camera found matching {!r}.'.format(cam))

redpajama_set_name: RedPajamaStackExchange


text:
Q: Animation in GIF not working when processing is going on I am displaying a GIF animation using the following code:
    ImageIcon ii = new ImageIcon(getClass().getResource("resources/wait_animated.gif"));
            JLabel l2 = new JLabel("Please Wait...",ii, SwingConstants.CENTER);
        ii.setImageObserver(l2);
        d.setIconImage(null);
        JDesktopPane dp=new JDesktopPane();
        dp.setPreferredSize(new Dimension(300,50));

        l2.setLocation(dp.getX(),dp.getY());
        l2.setPreferredSize(new Dimension(300,50));

        d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        d.setTitle("Wait dialog");

        d.add(l2);
        JDialog.setDefaultLookAndFeelDecorated(true);
        d.pack();
        d.setPreferredSize(new Dimension(50,50));
        d.setLocation(300,300);
        d.setAlwaysOnTop(true);
        d.setVisible(true);

The animation in GIF is displayed quite well. However, when there is some processing to be done after this ( i am using the wait dialog when database updation is going on ) ; the animation hangs. Can someone suggest a simple & effective way of achieving this?
The simpler the better for me.
Thanks in advance

A: The animation of GIF is done by Swing Event Thread. I suppose you are not spawning any threads on your own, so when you are updating database it is done by the event thread as well. Thus, the event thread is busy working with the database and cannot update the animation at the same time.
Move database processing (and other heavy tasks) into separate thread(s). Generally, all processing that can take considerable time should be done in separate threads.


text:
Q: How to import a data from an excel column to a data grid view column winform I am trying to import data from an excel file to a data grid view.
My goal is to get all the records from Column 'A' in the excel file ,
to the desired column in my grid view.
I have tried to find a sample code or anything to help me acomplish my task,
but all I found was the other way around. ( datagridview ==> Excel ).
Need your help to get this done .
Thanks.

A: I don't know if this can be done directly but you could try to import your Excel into database table(MSSQL) and then retrieve data to your Grid View.


text:
Q: What does ASAX stand for? There is a Global.asax file in the root of asp.net applications.

*

*What is the reason behind the extension naming?

*Can I create other files to use this extension? For what purpose?

A: Global.asax extension stands for:

Active Server Application Extended

..and it has only one purpose, as stated in docs:

.. is an optional file that contains code for responding to
  application-level events raised by ASP.NET or by HttpModules


text:
Q: Javascript function on keypress? I've been searching SO and the remaining internet, and I can't find a straight answer anywhere. How might someone execute javascript function aFunction when key m is pressed and released while no element (text box, etc) is focused?

A: With jQuery
$('body').keypress(function(e){
  if(e.which == 109)
    aFunction();
})

Here is a demo on jsFiddle
Edit: lowercase m is 109


text:
Q: Writing PHP functions that has many parameters/modifiers Please be patient and read the question carefully. So this is the demonstration what I do: PHP doesn't have ability to make overlapping functions. That are function that has same name but have different number of parameters. For example this is not possible in php but can be done in Java:
public class Testing() {

   public function doSometing() {
     // some useful code
   }

   public function doSometing(string $name) {
     // some useful code
   }

   public function doSometing(string $name, int type, string $connectedNews ) {
     // some useful code
   }
}

Now in order to make a flexible function I saw there is a way to do this by using one function with the unique name that has a few necessary params and all other parameters are optional. If we have a lot of optional characters than we put them in the array called options:
public function getCateogries( $lang = null, $options = array() ) {

    }

If we have a lot of options that we are sending in array than the function becomes to ugly and very hard to read and use. I know for the php function "func_get_arg but" but I think it is not the best approach.
The question is:
Is there better approach to do this? Is there any pattern that solve this kind of problem?

A: Here's a guess at a post without a real question. Maybe you can work with dynamic checking of arguments:
function GuessWhoByHowManyMaybe () {
    $NumberOfArguments = func_num_args();

    # get each one
    $ArrayOfArguments = func_get_args();
    for ($i = 0; $i < $NumberOfArguments; $i++) {
        echo "Argument " . $i . " is: " . $ArrayOfArguments[$i] . "\n";
    }

    # or grab one, in particular, right away
    if ($NumberOfArguments >= 2) {
        echo "Second argument is: " . func_get_arg(1) . "\n";
    }

    # example explained below this function
    if ($NumberOfArguments == 0) {
        // some useful code for when there are 0 arguments
    } elseif ($NumberOfArguments == 1) {
        // some useful code for when there is 1 argument
    }
}

You can make it act how you want by adding some code to check the number of parameters and then perform an action assuming that when a certain number of arguments are passed, then that means you can do a certain action. Err.. if you get what I mean...

A: You mean you want to make a method with overloads. That is possible. There are two possible ways to do this easily.
The first is to set default values for your parameters as such:
<?php
    public function foo($value1, $value2 = "", $value3 = false, $value4 = 2) { ... }
?>

Now $value1 is mandatory while the others are optional. The second method involves an arrey where you check if certain keys are present. For instance:
<?php
    public function foo($params) {
        if (array_key_exists('value1', $params) { ... do something ... }
        if (array_key_exists('value2', $params) { ... do something ... }
    }
?>

Both are generally accepted solutions and could also be used in combination.

A: class StupidJavaEnvySample {
    private function getMethodSignatureString($args) {
        return join('_', array_map('gettype', $args));
    }

    public function sayHi() {
        $args = func_get_args();
        $callable = array($this, 'sayHi__' . $this->getMethodSignatureString($args));
        return call_user_func_array($callable, $args);
    }

    //use naming convention for the overloaded methods.
    private function sayHi__string_object($str, $obj) {
        echo 'so';
    }
    private function sayHi__array_array($arr1, $arr2) {
        echo 'aa';
    }
}

$o = new StupidJavaEnvySample();
$o->sayHi(array(), array());

my sample doesn't differentiate between different types of objects, but im sure you could pull that off with reflection. Anyway, php has little use for this because its a dynamic language.


text:
Q: Glassfish 3 stand-alone client hangs during ejb lookup Per this guide http://docs.oracle.com/cd/E18930_01/html/821-2418/gkusn.html#gkusp I am trying to access an ejb component from a remote stand-alone client.  When executing my remote client, I have the gf-client.jar on the classpath, and included the jvm properties
-Dorg.omg.CORBA.ORBInitialHost=<remoteHost>
-Dorg.omg.CORBA.ORBInitialPort=3700

However, when my code does the lookup of the bean, it hangs, no exceptions thrown.  On the remote machine running Glassfish, I can do a netstat and see an established connection from my client machine to port 3700.  Any ideas on how to fix this?
EDIT:
Not sure where the exception was being swallowed, but I was able to run it in my IDE and I get this exception thrown on the lookup, after which the client hangs.
org.jvnet.hk2.component.ComponentException: injection failed on org.glassfish.api.invocation.InvocationManagerImpl.invHandlers with class [Lorg.glassfish.api.invocation.ComponentInvocationHandler;
    at org.jvnet.hk2.component.InjectionManager.error_injectionException(InjectionManager.java:284)
    at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:161)
    at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:93)
    at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
    at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
    at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
    at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:1050)
    at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:779)
    at com.sun.enterprise.iiop.security.SecurityMechanismSelector.postConstruct(SecurityMechanismSelector.java:166)
    at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
    at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
    at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
    at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1056)
    at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1037)
    at com.sun.hk2.component.InjectInjectionResolver.getComponentInjectValue(InjectInjectionResolver.java:159)
    at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:90)
    at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:143)
    at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:93)
    at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
    at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
    at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
    at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1056)
    at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1037)
    at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:781)
    at com.sun.enterprise.iiop.security.Lookups._getSecurityContextUtil(Lookups.java:97)
    at com.sun.enterprise.iiop.security.Lookups.getSecurityContextUtil(Lookups.java:92)
    at com.sun.enterprise.iiop.security.SecClientRequestInterceptor.<init>(SecClientRequestInterceptor.java:119)
    at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.getClientInterceptorInstance(AppclientIIOPInterceptorFactory.java:127)
    at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.createClientRequestInterceptor(AppclientIIOPInterceptorFactory.java:96)
    at org.glassfish.enterprise.iiop.impl.GlassFishORBInitializer.post_init(GlassFishORBInitializer.java:132)
    at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.postInitORBInitializers(PIHandlerImpl.java:915)
    at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.initialize(PIHandlerImpl.java:265)
    at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:643)
    at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:704)
    at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:691)
    at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107)
    at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:581)
    at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:263)
    at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
    at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:152)
    at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:364)
    at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:371)
    at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:401)
    at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:346)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
    at com.sun.enterprise.naming.impl.SerialContext.listBindings(SerialContext.java:866)
    at javax.naming.InitialContext.listBindings(InitialContext.java:466)
    at com.apihotels.docrepo.test.DocUploaderTest.setup(DocUploaderTest.java:68)
    at com.apihotels.docrepo.test.DocUploaderTest.junitTestSetup(DocUploaderTest.java:54)
    at com.apihotels.docrepo.test.DocUploaderTest.main(DocUploaderTest.java:43)
Caused by: org.jvnet.hk2.component.ComponentException: Failed to create class com.sun.enterprise.resource.pool.PoolManagerImpl
    at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:71)
    at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:80)
    at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
    at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
    at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
    at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:703)
    at java.util.AbstractList$Itr.next(AbstractList.java:358)
    at java.util.AbstractCollection.toArray(AbstractCollection.java:188)
    at com.sun.hk2.component.InjectInjectionResolver.getArrayInjectValue(InjectInjectionResolver.java:113)
    at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:81)
    at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:143)
    ... 58 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/resource/ResourceException
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.newInstance0(Class.java:343)
    at java.lang.Class.newInstance(Class.java:325)
    at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:65)
    ... 68 more

EDIT 2:
The remote interface I'm trying to access.
@Remote
public interface TheRemoteInterface {
   public void method1();
}

@Stateless
public class TheImpl implements TheRemoteInterface {
   // no members
   @Override
   public void method1() {
   }
}


text:
Q: Anytime I run php artisan serve, I get an error saying a requirement is missing I have been trying to add some dependencies to my project of recent using composer. After adding adding some into the
require
array in composer.json, i got a fatal error.
Fatal error: require(): Failed opening required 'C:\Users\uddy\3d-api\vendor\composer/../laravel/framework/src/Illuminate/Foundation/helpers.php' (include_path='C:\xampp\php\PEAR') in C:\Users\uddy\3d-api\vendor\composer\autoload_real.php on line 66

Please, what could cause this?
I've tried composer install and composer update

A: Just run this command:
composer dump-autoload
This command will clean up all compiled files and their paths.


text:
Q: I want to loop setTimeout() function after every 22 seconds I have a JAVASCRIPT code I want to loop this code after every 22 seconds. Can you help me with this, please?
It is the code.
setTimeout(function() {
  $('#hideMe01').fadeOut('fast');
}, 8000);

setTimeout(function() {
  $('#hideMe02').fadeOut('fast');
}, 8000);

setTimeout(function() {
  $('#hideMe03').fadeOut('fast');
}, 14000);

setTimeout(function() {
  $('#hideMe04').fadeOut('fast');
}, 14000);

A: You could just wrap the whole thing in an interval...
function doFade(){
    setTimeout(function() {
      $('#hideMe01').fadeOut('fast');
    }, 8000);

    setTimeout(function() {
      $('#hideMe02').fadeOut('fast');
    }, 8000);

    setTimeout(function() {
      $('#hideMe03').fadeOut('fast');
    }, 14000);

    setTimeout(function() {
      $('#hideMe04').fadeOut('fast');
    }, 14000);

    setTimeout(doFade,22000);
}
doFade();


text:
Q: Facebook API passing access token I'm trying to get some user info like first name and last name using the Facebook JavaScript SDK. I have an access token but users are not logged in in my app. Is it possible to get the user info using the access token?

A: This would be the proper way to use the API:
FB.api('/me', {fields: 'first_name,last_name', access_token: 'xxx'}, (response) => {
    console.log(response);
});


text:
Q: python numpy float64. Transformation of the "exact" values to float64() gives a "garbage" after the 16th significant digit (decimal places) Transformation of the "exact" values to float64() gives a "garbage" after the 16th significant digit (decimal places)
For example, the calculation "1/3"
import mpmath as mpm

import numpy as np

ma = mpm.mpf('1.')

mb = mpm.mpf('3.')

me = ma/mb

'{0:.33e} {1:.33e} {2:.33e}'.format(np.float64(ma),np.float64(mb),np.float64(me))

'1.000000000000000000000000000000000e+00  3.000000000000000000000000000000000e+00  3.333333333333333148296162562473910e-01'

How to set the number of actually calculated decimal places in numpy
Thank you


text:
Q: Como RETORNAR um UPDATE from SELECT em PostgreSQL dentro de uma Function? Tenho uma FUNCTION RETURNS TABLE() em PostgreSQL, onde eu faço um select from select, porém preciso aplicar um update from select, mas não consigo retornar na table.
Tentei da seguinte maneira e não tive sucesso:
CREATE OR REPLACE FUNCTION schema.funcão()
RETURNS TABLE(valor1 TIMESTAMP, valor2 BIGINT, valor3 NUMERIC, valor4 INT) AS $$
BEGIN
    RETURN QUERY sub2
    UPDATE schema.table
    SET valorBOLEANO = true
    FROM (
    SELECT
            date_trunc(sub1.valor1),
            count(1),
            valor3,
            sub1.valor4,
        FROM(SELECT ... ) AS sub1
    GROUP BY 1,sub1.valor4) AS sub2
END $$
LANGUAGE plpgsql;


text:
Q: Leaflet-Draw: Get polygon latLng in 'draw:editvertex' event When a draw:editvertex event fires, how can I get information about the polygon which triggered it?
this.map.on('draw:editvertex', function (e) { debugger;
    var layers = e.layers;
    // I want to get current polygon latLng here
}.bind(this));

A: This approach works for me (but doesn't feel like best practice) –
In my draw:editvertex handler I loop through the target._layers and look for the edited property:
map.on('draw:editvertex', function(e) {
    for (thisLayer in e.target._layers) {
        if (e.target._layers.hasOwnProperty(thisLayer)) {
            if (e.target._layers[thisLayer].hasOwnProperty("edited")) {
                console.log("we think we found the polygon?");
                console.log(e.target._layers[thisLayer]);

                // the updated Polygon array points are here:
                newPolyLatLngArray = e.target._layers[thisLayer].editing.latlngs[0];
            }
        }
    };
});

...like I said, this doesn't feel Awesome, but it is working for me so far.

A: There are not only layers in e, but also the target layer poly can be approached easily.
map.on('draw:editvertex', function (e) {
  var poly = e.poly;
  var latlngs = poly.getLatLngs(); // here the polygon latlngs
});


text:
Q: Interpreting table 1 in clinical research papers Am new to clinical research and starting off by reading some clinical papers.
In the paper, I came across a table like as shown below

Am I right to understand that the value of HbA1c can range from 6.2 to 9.2
Is that the meaning of (1.5)? Similarly for other measurements as well we have items in the bracket
Can help me understand this?

A: No, your table means that the mean of HbA1c is 7.7 (in %), and that the standard deviation (SD) is 1.5 (again in %). The range will usually be much wider than 6.2-9.2%.
To be honest, the table is a little confusing. If they write "mean $\pm$ SD" in the caption, they should also write "$7.7 \pm 1.5$" in the table. Or conversely, they should write "mean (SD)" in the caption.
Note that sometimes people do include the range, but from what I have seen, the mean and SD is more common.

A: The first line in your picture says "mean +/- SD" so it seems reasonable to assume, that the mean HbA1c was 7.7% with a standard deviation of 1.5% and the mean Cholesterol was 4.9mmol/L with a standard deviation of 1.0mmol/L
The standard deviation is the square root of the variance an thus a measure of the amount of variation or dispersion around the mean. A small value implies that most values were close to the mean, a large value means that the spread around the mean was large.
First you compute the difference of each value from the mean and then you square that. Then you compute the mean of the squared differences and take the square root from that. Voilà, that is your standard deviation or SD.
If those values were normally distributed you could draw more conclusions from that but biomarkers are usually not normally distributed. So take it as no more or less then a way to give you an idea, whether values were generally close to the mean or not.


text:
Q: Lots of small files or a couple huge ones? In terms of performance and efficiency, is it better to use lots of small files (by lots I mean as much as a few million) or a couple (ten or so) huge (several gigabyte) files? Let's just say I'm building a database (not entirely true, but all that matters is that it's going to be accessed a LOT).
I'm mainly concerned with read performance. My filesystem is currently ext3 on Linux (Ubuntu Server Edition if it matters), although I'm in a position where I can still switch, so comparisons between different filesystems would be fabulous. For technical reasons I can't use an actual DBMS for this (hence the question), so "just use MySQL" is not a good answer.
Thanks in advance, and let me know if I need to be more specific.

EDIT: I'm going to be storing lots of relatively small pieces of data, which is why using lots of small files would be easier for me. So if I went with using a few large files, I'd only be retrieving a few KB out of them at a time. I'd also be using an index, so that's not really a problem. Also, some of the data points to other pieces of data (it would point to the file in the lots-of-small-files case, and point to the data's location within the file in the large-files case).

A: There are a lot of assumptions here but, for all intents and purposes, searching through a large file will much be quicker than searching through a bunch of small files.
Let's say you are looking for a string of text contained in a text file. Searching a 1TB file will be much faster than opening 1,000,000 MB files and searching through those.
Each file-open operation takes time. A large file only has to be opened once.
And, in considering disk performance, a single file is much more likely to be stored contiguously than a large series of files.
...Again, these are generalizations without knowing more about your specific application.

A: The main issue here TMO is about indexing. If you're going to search information in a huge file without a good index, you'll have to scan the whole file for the correct information which can be long. If you think you can build strong indexing mechanisms then fine, you should go with the huge file.
I'd prefer to delegate this task to ext3 which should be rather good at it.
edit :
A thing to consider according to this wikipedia article on ext3 is that fragmentation does happen over time. So if you have a huge number of small files which take a significant percentage of the file system then you will lose performances over time.
The article also validate the claim about 32k files per directory limit (assuming a wikipedia article can validate anything)

A: It depends. really. Different filesystems are optimized in a different way, but in general, small files are packed efficiently. The advantage of having large files is that you don't have to open and close a lot of stuff. open and close are operations that take time. If you have a large file, you normally open and close only once and you use seek operations
If you go for the lots-of-files solution, I suggest you a structure like
b/a/bar
b/a/baz
f/o/foo

because you have limits on the number of files in a directory.

A: I believe Ext3 has a limit of about 32000 files/subdirectories per directory.  If you're going the millions of files route, you'll need to spread them throughout many directories.  I don't know what that would do to performance.
My preference would be for the several large files.  In fact, why have several at all, unless they're some kind of logically-separate units?  If you're still splitting it up just for the sake of splitting it, I say don't do that.  Ext3 can handle very large files just fine.

A: I work with a system that stores up to about 5 million files on an XFS file system under Linux and haven't had any performance problems. We only use the files for storing the data, we never full scan them, we have a database for searching and one of the fields in a table contains a guid which we use to retrieve. We use exactly two levels of directories as above with the filenames being the guid, though more could be used if the number of files got even larger. We chose this approach to avoid storing a few extra terabytes in the database that only needed to be stored/returned and never searched through and it has worked well for us. Our files range from 1k to about 500k.
We have also run the system on ext3, and it functioned fine, though I'm not sure if we ever pushed it past about a million files. We'd probably need to go to a 3 directory system due to maximum files per directory limitations.


text:
Q: Dynamically add URL Scheme in IOS I implemented the Login With Instagram in my app. I made a app on Instagram & Get the Client ID & secret Key for Calling the API.
But as per the Instagram Document, it has only limited API request per hour.
So, How can I solve this?
My idea: One my solution is that. the user will create his own Client ID & Secret Key and after that he will paste in the app to call the API.
But my problem is that how can I add the this dynamic keys as a URL Schemes into the plist?
I get the idea from one of the app which flows the same for Twitter API.
Any help/Solution/reference will be greatly appreciated.
Thanks in advance.

A: Try this but not tested..
NSDictionary *infoList = [[NSBundle mainBundle]infoDictionary];

    NSDictionary *urlScheme=[[infoList valueForKey:@"CFBundleURLTypes"] objectAtIndex:0];

    NSLog(@"url scheme before:%@",urlScheme);

    [urlScheme setValue:[NSArray arrayWithObject:@"New Scheme Name"] forKey:@"CFBundleURLSchemes"];

    NSLog(@"url scheme after:%@",urlScheme);


text:
Q: Activity inside library module starts but doesn't display layout My code
My main project
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    //         --------- 0 way
               View v = new com.sohaeb.mylibrary.test(this);
    setContentView(v);

   //         --------- 1 way

    startActivity(new Intent(this, com.sohaeb.mylibrary.MainActivity.class));

   //         --------- 2nd way

    Intent intent = new Intent();
    startActivity(intent.setClass(getApplicationContext(), com.sohaeb.mylibrary.MainActivity.class));

  //         --------- 3rd way
    Intent intent = new Intent();
    try {
        intent = new Intent(this, Class.forName("com.sohaeb.mylibrary.MainActivity"));
        startActivity(intent);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    }
 }

My module
public class MainActivity extends AppCompatActivity {

    private static final String TAG = "test";

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

        Log.d(TAG, "onCreate: hellow ");
}
}

Update #2
I have also followed this**tutorial here** which uses different approach:
inflate(context, R.layout.my_view, this);

But still ended with the same problem. Class launch but no layout

A: The solution was because I have 2 xml layouts with the same name.
i.e:

*

*Main project has main_activity.xml

*Library Module also has main_activity.xml.

Android will ignore the second one.
Hope this helps anyone.


text:
Q: HashMap cannot be cast to ArrayList I upload an ArrayList of objects on firebase database, and when I download that ArrayList and put in ArrayList value, I get message "HashMap cannot be cast to java.util.ArrayList". But I upload ArrayList, download ArrayList, put in ArrayList value, so why does the error say HashMap?
public class TileContentFragment extends Fragment {

    ArrayList<Item> mItems=new ArrayList<>();

    private FirebaseAuth mFirebaseAuth;
    private FirebaseUser mFirebaseUser;
    private DatabaseReference mDatabase;

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

        // Initialize Firebase Auth and Database Reference
        mFirebaseAuth = FirebaseAuth.getInstance();
        mFirebaseUser = mFirebaseAuth.getCurrentUser();
        mDatabase = FirebaseDatabase.getInstance().getReference();

        RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.recycler_view, container, false);
        ContentAdapter adapter = new ContentAdapter(recyclerView.getContext(),mItems);
        recyclerView.setAdapter(adapter);
        recyclerView.setHasFixedSize(true);
        // Set padding for Tiles
        int tilePadding = getResources().getDimensionPixelSize(R.dimen.tile_padding);
        recyclerView.setPadding(tilePadding, tilePadding, tilePadding, tilePadding);
        recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
        return recyclerView;
    }
    @Override
    public void onStart() {
        super.onStart();

        mDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot snapshot) {
                if (snapshot.hasChild("ItemsArray")) {

                    final ValueEventListener userListener = new ValueEventListener() {
                        @Override
                        public void onDataChange(DataSnapshot dataSnapshot) {
                            mItems = new ArrayList<>((ArrayList) dataSnapshot.getValue());

                        }

                        @Override
                        public void onCancelled(DatabaseError databaseError) {
                            Log.w("AppInfo", "onCancelled: ",databaseError.toException());

                        }
                    };
                    mDatabase.child("ItemsArray").addValueEventListener(userListener);
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        public ImageView picture;
        public TextView name;

        public ViewHolder(LayoutInflater inflater, ViewGroup parent) {
            super(inflater.inflate(R.layout.item_tile, parent, false));
            picture = (ImageView) itemView.findViewById(R.id.tile_picture);
            name = (TextView) itemView.findViewById(R.id.tile_title);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Context context = v.getContext();
                    Intent intent = new Intent(context, DetailActivity.class);
                    intent.putExtra(DetailActivity.EXTRA_POSITION, getAdapterPosition());
                    context.startActivity(intent);
                }
            });
        }
    }

    /**
     * Adapter to display recycler view.
     */
    public static class ContentAdapter extends RecyclerView.Adapter<ViewHolder> {
        // Set numbers of Tiles in RecyclerView.
        private static final int LENGTH = 18;

        private final String[] mPlaces;
        private ArrayList<Item> mPlacePictures;

        public ContentAdapter(Context context,ArrayList<Item> mPlacePictures) {
            Resources resources = context.getResources();
            mPlaces = resources.getStringArray(R.array.places);
            this.mPlacePictures=mPlacePictures;
        }

        @Override
        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            return new ViewHolder(LayoutInflater.from(parent.getContext()), parent);
        }

        @Override
        public void onBindViewHolder(ViewHolder holder, int position) {
            Picasso.with(holder.picture.getContext()).load(mPlacePictures.get(position).getProfilePic()).into(holder.picture);
           // holder.picture.setImageDrawable(mPlacePictures[position % mPlacePictures.length]);
            holder.name.setText(mPlaces[position % mPlaces.length]);
        }

        @Override
        public int getItemCount() {
            return mPlacePictures.size();
        }
    }
}

public class Item {

    private String user;
    private String name;
    private String desription;
    private int price;
    private ArrayList<String> url;
    private String profilePic;

    public Item(){}
    public Item(String user,String name, String desription, int price, ArrayList<String> url){
        this.user=user;
        this.name=name;
        this.desription=desription;
        this.price=price;
        this.url=url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesription() {
        return desription;
    }

    public void setDesription(String desription) {
        this.desription = desription;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public ArrayList<String> getUrl() {

        return url;
    }

    public void setUrl(ArrayList<String> url) {

        this.url = url;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getProfilePic() {
        return profilePic;
    }

    public void setProfilePic(String profilePic) {
        this.profilePic = profilePic;
    }
}

    E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.packtpub.materialdesign4, PID: 713
              java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
                  at com.packtpub.materialdesign4.TileContentFragment$1$1.onDataChange(TileContentFragment.java:82)
                  at com.google.android.gms.internal.zzakg.zza(Unknown Source)
                  at com.google.android.gms.internal.zzalg.zzcxk(Unknown Source)
                  at com.google.android.gms.internal.zzalj$1.run(Unknown Source)
                  at android.os.Handler.handleCallback(Handler.java:739)
                  at android.os.Handler.dispatchMessage(Handler.java:95)
                  at android.os.Looper.loop(Looper.java:148)
                  at android.app.ActivityThread.main(ActivityThread.java:5527)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.

A: Have a look at the documentation for DataSnapshot here :https://www.firebase.com/docs/java-api/javadoc/com/firebase/client/DataSnapshot.html#getValue--

getValue() returns the data contained in this snapshot as native types. The possible types returned are:

*

*Boolean

*Long

*Double

*Map <String, Object>

*List<Object>

The method dataSnapshot.getValue() is returning a Map<String, Object> instead of the List<Object> you were expecting.
Casting to a Map first, then creating an ArrayList from the result should fix your problem
mItems = new ArrayList(((Map<String, Item>) dataSnapshot.getValue()).values());


text:
Q: Creating a custom homepage template in Magento2.1.5 i know this question is already here.But i have tried all things. And nothing works for me.i need help, i am new to magento i have created a custom theme as default theme. Now i am trying to create a custom page template like app\design\frontend\accu\accu-theme\magento_theme and create the layout like
app\design\frontend\sample\sample-theme\magento_theme\page_layout\custom_home.xml

<?xml version="1.0"?>
  <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
      <update handle="empty"/>
      <referenceContainer name="page.wrapper">
          <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>
          <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
          <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />
      </referenceContainer>
  </layout>

app\design\frontend\accu\accu-theme\magento_theme\layouts.xml

<?xml version="1.0" encoding="UTF-8"?>
  <page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
      <layout id="custom_home">
          <label translate="true">Custom Home</label>
      </layout>
  </page_layouts>

this is my code. In my admin panel Content->Pages in Home-Page not showing the custom-home page. Any one help me.

A: move
app\design\frontend\sample\sample-theme\magento_theme\page_layout\custom_home.xml
to
app\design\frontend\accu\accu-theme\Magento_Theme\page_layout\custom_home.xml
in below, rename magento_theme to Magento_Theme
app\design\frontend\accu\accu-theme\magento_theme\layouts.xml
to
app\design\frontend\accu\accu-theme\Magento_Theme\layouts.xml
Else everything looks perfect.
Feel free for any query
======EDIT ============
update app\design\frontend\accu\accu-theme\Magento_Theme\page_layout\custom_home.xml
<?xml version="1.0"?>
  <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
      <update handle="empty"/>
      <referenceContainer name="page.wrapper">
          <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>
          <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>

          <referenceContainer name="content"> <block class="Magento\Framework\View\Element\Template" name="test" output="toHtml" template="homepage.phtml"/> </referenceContainer>

          <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />
      </referenceContainer>
  </layout>

A: Pleaser refer to this link: https://www.mageplaza.com/kb/how-to-add-a-new-cms-page-magento-2.html
You can create a custom homepage using cms page. In that link has the same idea on how to set it as your default homepage.
I hope this will help you. Thanks

A: For that you should create page layout folder in the directory of your Magento theme where you copy a file with custom template. In that file you assign the appearance of the page. As a base file you can use any of predefined (for example app/code/Magento/Theme/view/frontend/page_layout/1column.xml).The next step is going to be layouts.xml file creation in Magento Theme directory of your theme. Id attribute of layout tag should correspond to name of the page template file you previously created, and the content of label tag defines the template name in admin panel of the website. It's better to create a new CMS page for the custom homepage. In order to do that just navigate to Content> Elements> Pages and click Add New Page button. Further it's necessary to assign previously created template to this page. Just navigate to Design tab and choose the template in the Layout drop-down. So after you created a new CMS page and assigned the required template to it, you should assign this page as a Homepage for a certain store. Just navigate to Stores> Settings> Configuration, then in the left sidebar choose General Web and open the Default Pages tab. And the next step you should do is to select the webstore where you want the homepage to be changed. Next in the CMS Home Page drop-down list select the page you want to make Home Page for the certain store. Don't forget to save all changes and flush the website cache.
here you can find the description of this process: https://belvg.com/blog/creating-a-custom-homepage-template-in-magento-2-1-5.html


text:
Q: Is 0 divided by a non-zero indeterminate equal to 0. Consider the following solution:
$$ \lim\limits_{(x, y) \to (0, 0)} \dfrac{xy^4}{x^4+y^4}$$
Divide both numerator and denominator by $y^4$
$$ =  \lim\limits_{(x, y) \to (0, 0)} \dfrac{x}{\left(\dfrac{x}{y}\right)^4+1}$$
$$ =  \dfrac{ \lim\limits_{(x, y) \to (0, 0)}x}{ \lim\limits_{(x, y) \to (0, 0)}\left(\dfrac{x}{y}\right)^4+1}$$
The numerator is 0 and the denominator is non-zero, hence the limit is 0
=============================
Are you satisfied with this solution, if not, why?
Edit: Thank You for the help guys.
My mistake was looking at the final limit and not paying attention to how I got to that stage, "by dividing both numerator and denominator by y^4", that step itself is not allowed because y can be 0.
The above solution will be complete if I include another case where $y=0$, because when you divide by $y^4$, you are implicitly stating that y is not 0.

A: What you have shown is that assuming $y\neq 0$ the limit is zero but it doesn't suffice.
What matter is that for $y\neq 0$
$$ \dfrac{|x|}{\left(\dfrac{x}{y}\right)^4+1} \le |x| \to 0$$
and since for $y=0 \implies \dfrac{xy^4}{x^4+y^4}=0$ the proof is complete.

A: There is an easy way:
\begin{align*}
\left|\dfrac{xy^{4}}{x^{4}+y^{4}}\right|&=|x|\dfrac{y^{4}}{x^{4}+y^{4}}\\
&\leq|x|\\
&\rightarrow 0.
\end{align*}

A: One thing that has not been adressed by the existing answers is that even if you restrict your reasoning to the cases where $y\neq 0$, it's still wrong. To write something like
$$\lim_{(x,y)\to (0,0)}\frac{f(x,y)}{g(x,y)}=\frac{\lim_{(x,y)\to (0,0)} f(x,y)}{\lim_{(x,y)\to (0,0)}g(x,y)}$$
you have to make sure that $g$ is non-zero around the identity and that both $\lim_{(x,y)\to (0,0)} f(x,y)$ and $\lim_{(x,y)\to (0,0)} g(x,y)$ exist, and that the latter is not $0$. But here $g(x,y)=\left(\frac{x}{y}\right)^4+1$ does not have a limit when $(x,y)\to (0,0)$, so you can't actually write something like
$$ \lim\limits_{(x, y) \to (0, 0)} \dfrac{x}{\left(\dfrac{x}{y}\right)^4+1}=  \dfrac{ \lim\limits_{(x, y) \to (0, 0)}x}{ \lim\limits_{(x, y) \to (0, 0)}\left(\dfrac{x}{y}\right)^4+1}$$
because the right-hand side does not make sense.


text:
Q: Can a group G generated by $k$ elements act properly discontinuously freely and cocompactly on $\mathbb{R}^n$, for $n > k$ Equivalently: can the fundamental group of a closed manifold with universal cover homeomorphic to $\mathbb{R}^n$ be generated by $k$ elements, with $k < n$?
As a bonus question: same question without the "free" requirement on the action.
(to be sure: closed = compact + without boundary).

A: Many closed hyperbolic 3-manifolds have fundamental group generated by 2 elements. Indeed, if you glue two genus 2 handlebodies by a random map of their boundaries the resulting 3-manifold is highly likely to have a hyperbolic structure.

A: Let $F$ be a free group on 2 generators. Let $N$ be a normal subgroup of index $k-1$ (e.g. the kernel of a homomorphism onto a cyclic group of order $k-1$); then $N$ is free of rank $k$. Then the 2-generated group
$F/[N,N]$ is torsion-free (this is an old not-trivial fact) and virtually $\mathbf{Z}^k$ and thus acts isometrically freely properly cocompactly on the Euclidean $k$-space.


text:
Q: Find the last activity on a conversation with the microsoft bot Is it possible to find the last activity on a conversation, using Microsoft Bot.
https://directline.botframework.com/v3/directline/conversations/esxgfvjbkmkmljbjh-d/activities?watermark=10

I need to send a paginated response to the client for a conversation. Using a watermark, it will allow me to get all the activities after a certain watermark value. But this will not help in finding the activities in a watermark range. And moreover, how to identify, what should be the initial watermark value?

A: As indicated in the documentation about DirectLine here, currently the only way to get the latest activity is by requesting several times by changing the watermark value:

Clients should page through the available activities by advancing the
watermark value until no activities are returned.

A: The temporary cache of messages in the Direct Line channel is not intended to be a persistent store, but only as a connection reliability mechanism.  If you need to retrieve conversation activities at a later time, you should be using a Transcript Store and the SendConversationHistoryAsync api as demonstrated in this sample: https://github.com/Microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/22.conversation-history/


text:
Q: Laravel Validation redirect after ajax call I have a fresh 5.3 installation and want to make api calls with postman. I also tried it with angular2 to make sure it's not a problem with postman.
In my routes/api.php I got a simple route:
Route::post('test', function(\App\Http\Requests\LoginRequest $request) {
    return $request->all();
});

LoginRequest is checking if the fields email and password are there. If so, the output is as excepted. But when it's missing it redirects to /.
Do I have to add some information for form validation for ajax calls? I thought laravel would return a json error object when there is an ajax call.
Update:
I found out that I missed the Accept application/json header in Postman. With it it works finde. But is there a way to say that all api/* calls should be treated as a json call?

A: I created a new parent class for my Requests. It checks if the route belongs to the api group or not. I tried to add a Middleware to the group to add the header, but this trick failed.
class JsonRequest extends FormRequest
{
    public function expectsJson()
    {
        return ($this->route()->getAction()['middleware'] == 'api');
    }
}

A: You can response to ajax call like this
 return response()->json(array('error' => $validator->getMessageBag()->toArray()), 400);

response status 400 indicates error and you will get in error section
error: function(jqXHR, textStatus, errorThrown){
  var errResponse = JSON.parse(jqXHR.responseText);
  if (errResponse.error) {
    $.each(errResponse.error, function(index, value)
    {
       console.log(value);
    });
  }
}


text:
Q: How to handle replacing views android I have a MainActivity class which extends SlidingMenu.
When the user clicks in the sliding menu on an item, I would like to reload the View(different layout and content) of MainActivity.
In most cases the new View would consiste of a ListView with customs cells.
Is it possible to do this when I create a MyListViewActivity inside MainActivity? Or does anyone have an idea how to solve this?

A: The easiest way to do it (it all depends on your implementation) is just to use setContentView(R.layout.new_layout) on button click, which will inflate the other layout inside the same activity, replacing the old layout. BUT then be careful that all menus/action bars still get inflated, and that you don't reference any widgets which exist on the old layout.
If you want to have just a small section appear inside of your main layout, in your xml you could have something like:
<ListView
    android:id="@+id/small_layout_1"
    android:visibility="visible"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

 <LinearLayout
    android:id="@+id/small_layout_2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:visibility="gone" />

then on the button press you find the reference to small_layout_1, make visibility=gone, find small_layout_2 and make visibility=visible, which will achieve the same behaviour I think you're looking for


text:
Q: How to display a screen only for some seconds Android Studio I am new in Android Development. I have been trying to figure out how to display a screen in android studio only for 5 seconds and then get transfered into a new activity.
For example:
Activity A -> Activity B (Shown for 5 seconds) -> Activity C
Also I want to make sure that when a user clicks on the back button while he is in Activity B nothing happens (It doesnt go back to Activity A).
What is the easiest way to do that?
I know I have to use Intent.

A: try this. I have commented it out, but if you have any questions about it feel free to ask.
public class ClassB extends AppCompatActivity {

//Handler allows you to send and process Runnable Objects (Classes in this case)
private Handler mHandler = new Handler();

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

    //postDelayed method, Causes the Runnable r (in this case Class B) to be added to the message queue, to be run
    // after the specified amount of time elapses.
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            //Create a new Intent to go from Class B to Class C and start the new Activity.
            Intent intent = new Intent(ClassB.this, ClassC.class);
            startActivity(intent);
            finish()

        }
        //Here after the comma you specify the amount of time you want the screen to be delayed. 5000 is for 5 seconds.
    }, 5000);
}

//Override onBackPressed method and give it no functionality. This way when the user clicks the back button he will not go back.
public void onBackPressed() {

} }

A: In Kotlin you can do:
 Handler().postDelayed({
  // Start activity
  startActivity(Intent(this, YourTargetActivity::class.java))
  // terminate this activity(optional)
  finish()
}, 5000)


text:
Q: alert in class file of ASP.NET not on Code Behind I am trying to give an alert message in a class file i.e. .cs file, instead of in the Code Behind of page. But any regular ways are not working to achieve the same!
Also tried these Solutions...
ClientScript OR ScriptManager.RegisterStartupScript both asks for
 Control as first parameter, which I don't understand what to
 provide!
Is it really possible? :| If yes then...
What is available way to give Alert from a class file?

A: Works in .net 1.1 so should work in newer .net frameworks
public class MessageBox
{
    private static Hashtable m_executingPages = new Hashtable();
    private MessageBox(){}
    /// <summary>
    /// Show Event for the Messagebox
    /// </summary>
    /// <param name="sMessage">Pass String to Display</param>
    public static void Show( string sMessage )
    {
        // If this is the first time a page has called this method then
        if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
        {
            // Attempt to cast HttpHandler as a Page.
            Page executingPage = HttpContext.Current.Handler as Page;
            if( executingPage != null )
            {
                // Create a Queue to hold one or more messages.
                Queue messageQueue = new Queue();
                // Add our message to the Queue
                messageQueue.Enqueue( sMessage );
                // Add our message queue to the hash table. Use our page reference
                // (IHttpHandler) as the key.
                m_executingPages.Add( HttpContext.Current.Handler, messageQueue );
                // Wire up Unload event so that we can inject
                // some JavaScript for the alerts.
                executingPage.Unload += new EventHandler( ExecutingPage_Unload );
            }
        }
        else
        {
            // If were here then the method has allready been
            // called from the executing Page.
            // We have allready created a message queue and stored a
            // reference to it in our hastable.
            Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
            // Add our message to the Queue
            queue.Enqueue( sMessage );
        }
    }

    // Our page has finished rendering so lets output the
    // JavaScript to produce the alert's
    private static void ExecutingPage_Unload(object sender, EventArgs e)
    {
        // Get our message queue from the hashtable
        Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
        if( queue != null )
        {
            StringBuilder sb = new StringBuilder();
            // How many messages have been registered?
            int iMsgCount = queue.Count;
            // Use StringBuilder to build up our client slide JavaScript.
            sb.Append( "<script language='javascript'>" );
            // Loop round registered messages
            string sMsg;
            while( iMsgCount-- > 0 )
            {
                sMsg = (string) queue.Dequeue();
                sMsg = sMsg.Replace( "\n", "\\n" );
                sMsg = sMsg.Replace( "\"", "'" );
                sb.Append( @"alert( """ + sMsg + @""" );" );
            }
            // Close our JS
            sb.Append( @"</script>" );
            // Were done, so remove our page reference from the hashtable
            m_executingPages.Remove( HttpContext.Current.Handler );
            // Write the JavaScript to the end of the response stream.
            HttpContext.Current.Response.Write( sb.ToString() );
        }
    }
}


text:
Q: OpenMP call parallelized function from a parallel for loop I am trying to have a parallel region which inside it has first a parallel for, then a function call with a parallel for inside and lastly another parallel for.
A simplified example could be this
#pragma parallel
{
  #pragma omp for
  for(int i=0;i<1000;i++)
    position[i]+=velocity[i];

  calculateAccelerationForAll();

  #pragma omp for
  for(int i=0;i<1000;i++)
    velocity[i]+=acceleration[i];
}

calculateAccelerationForAll()
{
  #pragma parallel omp for
  for(int i=0;i<1000;i++)
    for(int j=0;j<1000;j++)
      acceleration[i]=docalculation
}

The issue here being that I would want the existing threads to jump over into calculateAccelerationForAll and execute the for loop there, rather than having three separated parallel regions. I could ensure that only the first thread actually calls the function, and have a barrier after the function call, but then only that thread executes the for loop inside the function.
The question is really if my assumption, that putting the first and last loop in their own paralle region and making the function call have its own region as well, is inefficient, is false... or if it is correct, how I can then make one regions thread go through it all the way.
Might add, that if I just took the contents of the function and put it inside the main paralle region, between the two existing loops, then it would not be an issue. The problem (for me at least) is that I have to use a function call and make then run in parallel as well.

A: It helped typing out the problem, it seems.
The obvious answer is to change the pragma in the function
from #pragma parallel for to #pragma for
That makes that for loop use the existing threads from the existing calling parallel section, and it works perfectly.


text:
Q: Jquery issues with .live, .click and preventDefault I have some problem with my form.
i want to use jquery ajax to validate a form against a database and i encounter different problems.
1.
$('#formsubmit').click(function(e) {
    e.preventDefault(); // this is not working, the page reloads
});

2.
$('#formsubmit').live('click', function(e) {
    e.preventDefault(); //works, but...
    var firstname = $('#firstname').val(); // returns an empty string and ...
    firstname = document.getElementById('firstname'); //does not return anything either
    alert("$('#firstname')"); // returns [object][object] ... should'nt it be [object][html inputelement]
});

so far i havent been able to trigger an ajax load on click on the submit button of my form because i cannot get the values of my input fields.
am i missing something here?
Is it possible to use another method for:
1. prevent page reload on submit-click and
2. get all values of the form and send them via ajax to my php script
3. wait for the answer and display it in the according html elements.

A: The problem is you're preventing the click event, not the submit event, which is what you want to catch here, like this:
$("#formid").live("submit", function(e) {
  e.preventDefault();
  $.post("myPage.php", $(this).serialize(), function(result) {
    $("#resultContainer").html(result);
  });
});

In the above, we're using .serialize() on the <form> itself to get all the data to submit (from all successful inputs), just like a normal submission would do (with no JavaScript).

Also, I ca't tell from your question, but be sure your id attributes are unique, e.g. there is only one id="firstname", you'll have many issues if that's not the case.


text:
Q: mount.cifs error(2): No such file or directory when using a prefixpath I tried this command:
mount -t cifs //server/share/directory /mnt/directory -o credentials=/path/to/cifs.credentials --verbose

Response is:
mount.cifs kernel mount options: ip=<IP of server>,unc=\\server \share,user=<username>,prefixpath=directory,pass=********
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

However, if I try the same command without the prefix path:
mount -t cifs //server/share /mnt/directory -o credentials=/path/to/cifs.credentials --verbose

It works, and I can access /mnt/directory/directory.
I get the same error if I specify the prefixpath explicitely in the options, i.e.:
mount -t cifs //server/share /mnt/directory -o credentials=/path/to/cifs.credentials,prefixpath=directory --verbose

Additional info:

*

*I am able to connect to the desired path using smbclient //server/share -U username -W domain -D directory

*mount.cifs version: 5.5

*Debian kernel 3.2.0-4-amd64

*I am able to connect on another machine using mount.cifs version 4.5 on Debian kernel 2.6.32-5-amd64

Any ideas why the prefixpath seems to cause a problem? This same path had been working recently; I suspect an update to a package on the Linux side or a Windows update is behind the new behavior.

A: Finally found a workaround for this issue that works with our NetApp.  If you don't need DFS try mounting with the nodfs option.
mount -t cifs //server/share/directory /mnt/directory -ocredentials=/path/to/cifs.credentials,nodfs

A: I also had this error mount error(2): No such file or directory while mounting (also a NetApp SAN).
Adding the nodfs mount option worked. However, I was missing the keyutils package. Once installed, mounting worked as expected without nodfs.
On Ubuntu :
sudo apt install keyutils


text:
Q: How can I use functions like NUMBERVALUE() across a whole column/range in Excel? I have a column of data that I want to get the average of. (F column below, GREEN)
Unfortunetely, each cell has the unit in it, thus I cannot simply use AVERAGE().
Before I continue, please note that I'm not asking for a better way of removing the units (That's a different question.)
Also note that in my included image, just below each formula is the formula in text.
My first attempt at getting the average was to make another column next to it using =LEFT(F,3) (Column L, RED) however trying to take the average of that failed (Column N, PINK), presumably because the result was a text string.
So I then tried using wrapping LEFT() in NUMBERVALUE(), giving me =AVERAGE(NUMBERVALUE(L17:L36)) but that just returns the that row's value (Column N, PURPLE)
Next I tried using doing the whole thing at once using =AVERAGE(NUMBERVALUE(LEFT(G17:G36,3))) (Column N, GREY) but that obviously wasn't going to work either.
Finally, I made a column using =NUMBERVALUE(LEFT(F36,3)) (Column G, BLUE) and then taking the AVERAGE() of that (Column I, GOLD).
That worked, but how can I use NUMBERVALUE() and LEFT() for a whole column?
I want something like =AVERAGE(NUMBERVALUE(LEFT(G17:G36,3))) to work.

A: Your formula of =AVERAGE(NUMBERVALUE(LEFT(G17:G36,3))) is actually correct.  However you are missing one step, you need to convert it to an array formula.  After entering in the formula you need to make sure you hit Ctrl+Shift+Enter to tell excel you want to do an array formula or Command+Enter on a Mac.
That should do it for you.

A: The formula you suggested, entered as an Array Formula will work
=AVERAGE(NUMBERVALUE(LEFT(G17:G36,3)))

completed with Ctrl-Shift-Enter.


text:
Q: GraphViz: How can i add image to html label i need to add image to html label, any sugestions how can i do that?
 St1_U41 [
   shape=plaintext

   label=<

        //i need image right here

St1, U41

Huawei

34	36	38	37	40	39	47	48	49	51

  >];

A: added a <TD and <IMG (see http://www.graphviz.org/doc/info/shapes.html#images-example)
graph 1 {

St1_U41 [
   shape=plaintext

   label=<

St1, U41

Huawei

34	36	38	37	40	39	47	48	49	51

     >];
}

Giving:


text:
Q: Correspondence between elements of $\mathfrak{g}$ and Killing vector fields. Let $I_0(M)$ be the connected component of the identity of the isometry group $I(M)$. If $M$ is a compact globally symmetric space, then $M \cong I_0(M)/K$ where $K$ is the isotropy group of a point $p$.
Then, we have that $\mathfrak{g}=\mathfrak{k} \oplus \mathfrak{p}$, where $\mathfrak{g}$ is the lie algebra of $I_0(M)$, $\mathfrak{k}$ is the lie algebra of $K$ and $\mathfrak{p} \cong T_pM$.
There exists a way to visualize elements of $\mathfrak{g}$ as killing vector fields, but I cannot understand how this is done. I don't even understand how to transform elements of $\mathfrak{g}$ into vector fields. How is this done?

A: "The answer to this is essentially my answer here" - Mike Miller, in comments.


text:
Q: Can not run Angular APP through docker container I am facing one issue. I have deployed my simple angular APP inside docker container and after successfully running when I am ruing the URL on browser its not working. I am giving the command below.
I run the docker using below command
-sudo docker run -d -it -p 90:90/tcp --name parent subhrajyoti/parent:latest
bcf00b41f1df8d1f9bf539613543d4a32e52cd01ffd1c2c7cf2d4070839b461e

After running successfully when I run the following command on browser
http://localhost:90/

The angular page is not coming its showing below error.
This site can't be reachedThe web page at http://localhost:90/ might be temporarily down or it may have moved permanently to a new web address.
ERR_SOCKET_NOT_CONNECTED

I need to resolve that issue and run my angular APP deployed on docker container.

A: Are you sure that Angular runs on port 90 in docker because if you use Nginx it uses port 80 by default.
Would it work if you changed your docker command to the following?
-sudo docker run -d -it -p 90:80/tcp --name parent subhrajyoti/parent:latest
bcf00b41f1df8d1f9bf539613543d4a32e52cd01ffd1c2c7cf2d4070839b461e


text:
Q: If $Y$ is not independent of $X$, does it necessarily imply that $X$ and $Y$ are dependent? If $X,Y$ are random variables and it is found that $X$ is NOT independent of $Y$, is it true that $(X,Y)$ are then dependent, i.e., $P(X,Y) \neq P(X)P(Y)$? Is there a counterexample to this statement? Thanks.

A: Independence does not depend on "order." The following are equivalent ways of saying the same thing.

*

*$X$ and $Y$ are independent

*$X$ is independent of $Y$

*$Y$ is independent of $X$

If any of the above is false (which means all three statements are false) then we say $X$ and $Y$ are dependent.


text:
Q: Close WinForm Application from different Form This may seem like a silly question, but I just want to make sure I have it right. My main form is not visible most of the time. To open it I have a NotifyIcon. One of the menu options is Exit Application. I also have a few static global variables that need to be disposed of before the application closes. so in program.cs i have this.
    [STAThread]
    static void Main()
    {
        InitializeApplication();
        InitializeMainForm();
        Application.Run(main);
    }
    private static void InitializeApplication()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.ApplicationExit += Application_ApplicationExit;
    }
    private static void InitializeMainForm()
    {
        main = new AssignButtonForm();
        main.FormClosing += main_FormClosing;
        Globals.StartNotify();
    }

    static void main_FormClosing(object sender, FormClosingEventArgs e)
    {
        var dlg = MessageBox.Show("Turn off Application?", "Exit?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
        if (dlg == DialogResult.OK)
        {
            Globals.notifyIcon1.Dispose();
            Application.Exit();
        }
        else
        {
            e.Cancel = true;
        }
    }

So what i'm hoping is that this is the correct way to call that.
    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
        this.Hide();
        Application.OpenForms[0].Close();
    }

is that correct? or is there a better way?
EDIT
ok so one of my classes that has its own Dispose method
public class KeymonNotifyIcon : IDisposable
{
    public KeymonNotifyIcon()
    {
        InitializeComponent();
        keymonMenuStrip.SetupKeysSelected += OnSetupKeysSelected;
    }
    ~KeymonNotifyIcon()
    {
        Dispose();
    }
    public void Dispose()
    {
        if (notifyIcon1 != null)
            notifyIcon1.Dispose();

        if (keymonMenuStrip != null)
            keymonMenuStrip.Dispose();
    }
}

The global class
public static class Globals
{
    public static TraceSource trace = new TraceSource("Keymon");
    public static KeymonNotifyIcon notifyIcon1;
    public static void StartNotify()
    {
        notifyIcon1 = new KeymonNotifyIcon();
    }
}

A: Actually, I am fairly certain that Application.Exit will call all of your Dispose methods for you (as long as you have implemented IDisposable
See this question, which references this question

A: If your program just shuts down, objects that have not been garbage collected will have their finalizers run.  It is the recommended pattern that objects implementing IDisposable have a finalizer to ensure that IDisposable is run.  To the best of my knowledge, .NET BCL classes always follow that pattern.  However, your own or third-party/open source components might not follow that pattern.
Note: The linked pattern on MSDN does not call GC.SuppressFinalize.  Check out how to use it to reduce the GC overhead.
Implementing IDisposable alone isn't sufficient to ensure that the object is properly disposed.
If you have statically referenced objects that implement IDisposable, it is a more solid solution to explicitly call IDisposable.Dispose() on them from an application shut down event.
EDIT
Your Dispose implementation will cause Dispose() to be called twice on the owned objects because:
if (notifyIcon1 != null)
        notifyIcon1.Dispose();

does not set notifyIcon1 to null, and the finalizer unconditionally calls Dispose() again.
Additionally, you will always cause the finalizer to run (which makes GC more expensive for that class) because you do not call GC.SuppressFinalize() in Dispose().