问:
When write this code appear localhost redirected and This page isn’t working?
```<code><?php
include("connect.php");
if(isset($_POST['submit']))
{
    $qonax=@$_POST['qonax'];
    $subject=@$_POST['subject'];
    $insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
    mysqli_query($link,$insert) or die(mysql_error($link));
}
header('location:insert_subject.php');
?>
</code>```

appear this:

This error appear when write (if(isset($_POST['submit']){ }
when removed this line code a problem fixed.

答:
move the redirection inside the if block and unsetting the  $_POST['submit'] variable

```<code><?php
include("connect.php");
if(isset($_POST['submit']))
{
    $qonax=@$_POST['qonax'];
    $subject=@$_POST['subject'];
    $insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
    mysqli_query($link,$insert) or die(mysql_error($link));
    unset($_POST['submit'])
    header('location:insert_subject.php');
}
?>
</code>```

Body:
<?php
include("connect.php");
if(isset($_POST['submit']))
{
    $qonax=@$_POST['qonax'];
    $subject=@$_POST['subject'];
    $insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
    mysqli_query($link,$insert) or die(mysql_error($link));
}
header('location:insert_subject.php');
?>

appear this:

This error appear when write (if(isset($_POST['submit']){ }
when removed this line code a problem fixed.

Body:
move the redirection inside the if block and unsetting the  $_POST['submit'] variable

<?php
include("connect.php");
if(isset($_POST['submit']))
{
    $qonax=@$_POST['qonax'];
    $subject=@$_POST['subject'];
    $insert="INSERT INTO subject(ID,Qonax,Subject)VALUES('','$qonax','$subject')";
    mysqli_query($link,$insert) or die(mysql_error($link));
    unset($_POST['submit'])
    header('location:insert_subject.php');
}
?>


来源: stackexchange

问:
Xamarin iOS splash keeps loosing images
This is a weird problem. I created a storyboard to use for our splash screen. It has 2 ImageViews in it. I do a build and everything looks.

Every so often, for some unknown reason, the images will stop displaying. Sometimes it's one of them and sometimes both. What's even stranger is that the images continue to display elsewhere in the app.
What I ended up doing is creating a copy of the images so now there is background.png, background2.png, logo.png and logo2.png.

So when the image stops displaying, I switch to the copy and then it works right.

This has been a work around but is not a solution. I can't seem to figure out what the issue is.

What makes this even worse is, sometimes it happens when I change to an ad-hoc build and then deploy to TestFlight so we don't see the issue until we install it from TestFlight.

答:
Unfortunately I've seen this issue before on a couple of the projects I've worked on in the past. it's a strange situation where resources aren't copied accross to the build folder on the mac, most likely caused by something not working correctly with the Xamarin build process for that specific project.

The solution that I've used in the past is to simply delete the 'mtbs' folder that is situated on the apple Mac that you are building/compiling your project to.

The location can be found below:

~/Library/Caches/Xamarin/mtbs/builds/[Long project Guid]

The long guid can be seen in the output window in visual studio when you build your project, but if this is your first project you may likely only have one folder here.

If you simply delete the folder that relates to your project, and then run 'Rebuild', it should push across any necessary resources that it was missing out before, including images.

ContentLicense: CC BY-SA 3.0

Title: Xamarin iOS splash keeps loosing images


问:
Eliminate duplicates in elasticsearch query
I have the problem that some documents are indexed twice or more so I want to filter out this duplicates when searching. I followed some other threads and built this query:

```<code>{
  "query" : { ... },
  "size" : 10,
  "from" : 0,
  "sort" : { ... },
  "aggs" : {
    "dedup" : {
      "terms" : {
        "field" : "content.keyword"
      },
      "aggs" : {
        "dedup_docs" : {
          "top_hits" : {
            "size" : 1
          }
        }
      }
    }
  }
}
</code>```

But it seems that this aggregation has no effect. I'm still getting duplicate results (documents with the same text in the content field).

Request changed:

```<code>{
  "query" : { ... },
  "size" : 10,
  "from" : 0,
  "sort" : { ... },
  "collapse" : {
    "field" : "content.keyword"
  }
}
</code>```

答: You can also take a look at the recently added field collapsing feature</p>

Body:
I have the problem that some documents are indexed twice or more so I want to filter out this duplicates when searching. I followed some other threads and built this query:

{
  "query" : { ... },
  "size" : 10,
  "from" : 0,
  "sort" : { ... },
  "aggs" : {
    "dedup" : {
      "terms" : {
        "field" : "content.keyword"
      },
      "aggs" : {
        "dedup_docs" : {
          "top_hits" : {
            "size" : 1
          }
        }
      }
    }
  }
}

But it seems that this aggregation has no effect. I'm still getting duplicate results (documents with the same text in the content field).

Request changed:

{
  "query" : { ... },
  "size" : 10,
  "from" : 0,
  "sort" : { ... },
  "collapse" : {
    "field" : "content.keyword"
  }
}


问:
Reversing the letters in words in a String
I have coded the following solution, and it works, except for when there is punctuation. I was wondering if there are O(1) space complexity and O(length of string) time complexity solutions, without using reverse() method, or anything similar that makes this task too easy. Any answer that can also handle punctuation correctly would be great.

Example:

Given string: "I love chocolate"

Return string should be: "I evol etalocohc"

For clarity, when I say handle punctuation correctly, I mean punctuation should not move around.

```<code> // reverse the letters of every word in a sentence (string), and return the result

 public static String reverse(String x)
 {
     String[] str = x.split(" ");

     StringBuilder rev = new StringBuilder("");

     for (int i = 0; i < str.length; i++)
     {
         for (int s = str[i].length()-1; s >= 0; s--)
         {
             rev.append(str[i].charAt(s));
         }
         rev.append(" ");
     }

     return rev.toString();
 }
</code>```

Here is my output for some tests of mine:

```<code>     public static void main(String[] args)
     {
         System.out.println(reverse("I love chocolate"));//this passes
         System.out.println(reverse("Geeks for Geeks"));//this passes
         System.out.println(reverse("You, are awesome"));//not handling puncutation mark correctly, gives me ",uoY era emosewa", instead of "uoY, era emosewa"
         System.out.println(reverse("Geeks! for Geeks."));//not handling puncutation marks correctly, gives me "!skeeG rof .skeeG", instead of "skeeG! rof skeeG."
     }
</code>```

答:
I just have made changes on your code, not additional methods or loops, just some variables and if conditions.</p>

```<code>/* Soner - The methods reverse a string with preserving punctiations */
public static String reverse(String x) {
    String[] str = x.split(" ");
    boolean flag = false;
    int lastCharPosition;
    StringBuilder rev = new StringBuilder("");

    for (int i = 0; i < str.length; i++) {
        flag = false;
        lastCharPosition = str[i].length()-1;
        if (str[i].charAt(lastCharPosition) == '.' || str[i].charAt(lastCharPosition) == '!'
                || str[i].charAt(lastCharPosition) == ',') {  // you can add new punctiations
            flag = true;
            lastCharPosition = str[i].length()-2;
        }
        for (int s = lastCharPosition; s >= 0; s--) {
            rev.append(str[i].charAt(s));
        }
        if (flag) rev.append(str[i].charAt(lastCharPosition + 1));
        rev.append(" ");
    }

    return rev.toString();
}
</code>```

Body:
I have coded the following solution, and it works, except for when there is punctuation. I was wondering if there are O(1) space complexity and O(length of string) time complexity solutions, without using reverse() method, or anything similar that makes this task too easy. Any answer that can also handle punctuation correctly would be great.

Example:

Given string: "I love chocolate"

Return string should be: "I evol etalocohc"

For clarity, when I say handle punctuation correctly, I mean punctuation should not move around.

 // reverse the letters of every word in a sentence (string), and return the result

 public static String reverse(String x)
 {
     String[] str = x.split(" ");

     StringBuilder rev = new StringBuilder("");

     for (int i = 0; i < str.length; i++)
     {
         for (int s = str[i].length()-1; s >= 0; s--)
         {
             rev.append(str[i].charAt(s));
         }
         rev.append(" ");
     }

     return rev.toString();
 }

Here is my output for some tests of mine:

     public static void main(String[] args)
     {
         System.out.println(reverse("I love chocolate"));//this passes
         System.out.println(reverse("Geeks for Geeks"));//this passes
         System.out.println(reverse("You, are awesome"));//not handling puncutation mark correctly, gives me ",uoY era emosewa", instead of "uoY, era emosewa"
         System.out.println(reverse("Geeks! for Geeks."));//not handling puncutation marks correctly, gives me "!skeeG rof .skeeG", instead of "skeeG! rof skeeG."
     }

Body:
I just have made changes on your code, not additional methods or loops, just some variables and if conditions.

/* Soner - The methods reverse a string with preserving punctiations */
public static String reverse(String x) {
    String[] str = x.split(" ");
    boolean flag = false;
    int lastCharPosition;
    StringBuilder rev = new StringBuilder("");

    for (int i = 0; i < str.length; i++) {
        flag = false;
        lastCharPosition = str[i].length()-1;
        if (str[i].charAt(lastCharPosition) == '.' || str[i].charAt(lastCharPosition) == '!'
                || str[i].charAt(lastCharPosition) == ',') {  // you can add new punctiations
            flag = true;
            lastCharPosition = str[i].length()-2;
        }
        for (int s = lastCharPosition; s >= 0; s--) {
            rev.append(str[i].charAt(s));
        }
        if (flag) rev.append(str[i].charAt(lastCharPosition + 1));
        rev.append(" ");
    }

    return rev.toString();
}


问:
Birt inserts an extra space if part of the word is highlighted using an HTML tag

I had the following problem with reports in the Birt. I want to be able to highlight text in a report using HTML tags , , , etc.
If I highlight the whole word, then everything works fine. But if I highlight only a part of the word, then Birt splits such a word with an extra space:

DataSource:

```<code><data>
    <text><b>This</b> is a text. T<b>his</b> is another text.</text>
</data>
</code>```

.rptdesign:

```<code><?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 4.6.0.v201606072122</property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <data-sources>
        <oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="4">
            <property name="FILELIST">data_sources/test_data_source.xml</property>
        </oda-data-source>
    </data-sources>
    <data-sets>
        <oda-data-set extensionID="org.eclipse.datatools.enablement.oda.xml.dataSet" name="testDataSet" id="5">
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">text</property>
                    <text-property name="heading">text</text-property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">text</property>
                        <property name="dataType">string</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">Data Source</property>
            <list-property name="resultSet">
                <structure>
                    <property name="position">1</property>
                    <property name="name">text</property>
                    <property name="nativeName">text</property>
                    <property name="dataType">string</property>
                    <property name="nativeDataType">12</property>
                </structure>
            </list-property>
            <xml-property name="queryText"><![CDATA[table0#-TNAME-#table0#:#[/data/text]#:#{text;STRING;}]]></xml-property>
            <xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
  <Version>2.0</Version>
  <design:ResultSets derivedMetaData="true">
    <design:resultSetDefinitions>
      <design:resultSetColumns>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:identifier>
              <design:name>text</design:name>
              <design:position>1</design:position>
            </design:identifier>
            <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>text</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
      </design:resultSetColumns>
      <design:criteria/>
    </design:resultSetDefinitions>
  </design:ResultSets>
</model:DesignValues>]]></xml-property>
            <list-property name="privateDriverProperties">
                <ex-property>
                    <name>MAX_ROW</name>
                    <value>-1</value>
                </ex-property>
                <ex-property>
                    <name>XML_FILE</name>
                </ex-property>
            </list-property>
        </oda-data-set>
    </data-sets>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2"/>
    </page-setup>
    <body>
        <text-data id="6">
            <property name="fontFamily">"Times New Roman"</property>
            <property name="fontSize">14pt</property>
            <property name="textAlign">justify</property>
            <property name="dataSet">testDataSet</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">text</property>
                    <text-property name="displayName">text</text-property>
                    <expression name="expression" type="javascript">dataSetRow["text"]</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <expression name="valueExpr">row['text']</expression>
            <property name="contentType">html</property>
        </text-data>
    </body>
</report>
</code>```

Result in Word:

This is a text. T his is another text.

How to make so that the extra space didn't appear?

The my test project can be downloaded here.

答:
I tried your file with eclipse-reporting-neon-R-win32-x86_64.zip and it worked fine. Try upgrading your editor or viewer.

This is a text. This is another text. <<- formatting removed but no spaces when run with the latest viewer.

If you are just needing this in Word try exporting as DOC instead of DOCX.

Body:
I had the following problem with reports in the Birt. I want to be able to highlight text in a report using HTML tags , , , etc.
If I highlight the whole word, then everything works fine. But if I highlight only a part of the word, then Birt splits such a word with an extra space:

DataSource:

<data>
    <text>This is a text. This is another text.</text>
</data>

.rptdesign:

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 4.6.0.v201606072122</property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <data-sources>
        <oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="4">
            <property name="FILELIST">data_sources/test_data_source.xml</property>
        </oda-data-source>
    </data-sources>
    <data-sets>
        <oda-data-set extensionID="org.eclipse.datatools.enablement.oda.xml.dataSet" name="testDataSet" id="5">
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">text</property>
                    <text-property name="heading">text</text-property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">text</property>
                        <property name="dataType">string</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">Data Source</property>
            <list-property name="resultSet">
                <structure>
                    <property name="position">1</property>
                    <property name="name">text</property>
                    <property name="nativeName">text</property>
                    <property name="dataType">string</property>
                    <property name="nativeDataType">12</property>
                </structure>
            </list-property>
            <xml-property name="queryText"><![CDATA[table0#-TNAME-#table0#:#[/data/text]#:#{text;STRING;}]]></xml-property>
            <xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
  <Version>2.0</Version>
  <design:ResultSets derivedMetaData="true">
    <design:resultSetDefinitions>
      <design:resultSetColumns>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:identifier>
              <design:name>text</design:name>
              <design:position>1</design:position>
            </design:identifier>
            <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
            <design:precision>-1</design:precision>
            <design:scale>-1</design:scale>
            <design:nullability>Unknown</design:nullability>
          </design:attributes>
          <design:usageHints>
            <design:label>text</design:label>
            <design:formattingHints/>
          </design:usageHints>
        </design:resultColumnDefinitions>
      </design:resultSetColumns>
      <design:criteria/>
    </design:resultSetDefinitions>
  </design:ResultSets>
</model:DesignValues>]]></xml-property>
            <list-property name="privateDriverProperties">
                <ex-property>
                    <name>MAX_ROW</name>
                    <value>-1</value>
                </ex-property>
                <ex-property>
                    <name>XML_FILE</name>
                </ex-property>
            </list-property>
        </oda-data-set>
    </data-sets>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2"/>
    </page-setup>

        <text-data id="6">
            <property name="fontFamily">"Times New Roman"</property>
            <property name="fontSize">14pt</property>
            <property name="textAlign">justify</property>
            <property name="dataSet">testDataSet</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">text</property>
                    <text-property name="displayName">text</text-property>
                    <expression name="expression" type="javascript">dataSetRow["text"]</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <expression name="valueExpr">row['text']</expression>
            <property name="contentType">html</property>
        </text-data>

</report>

Result in Word:

This is a text. T his is another text.

How to make so that the extra space didn't appear?

The my test project can be downloaded here.


问:
Jboss server startup exception
I am seeing the following exception while starting Jboss-4.0.3SP1 on my Windows 7 64 bit machine. I am researching on this to see if there any clash for the ports etc.. Any thoughts from you would be appreciated!</p>

```<code>14:52:13,067 WARN  [ServiceController] Problem starting service jboss:service=invoker,type=pooled
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at org.jboss.invocation.pooled.server.PooledInvoker.startService(PooledInvoker.java:205)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:428)
        at org.jboss.system.ServiceController.start(ServiceController.java:446)
        at org.jboss.system.ServiceController.start(ServiceController.java:446)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy5.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
        at org.jboss.Main.boot(Main.java:187)
        at org.jboss.Main$1.run(Main.java:438)
        at java.lang.Thread.run(Thread.java:595)
</code>```

答:
Yeah! Fixed the issue, one of the port was in use.

```<code><attribute name="ServerBindPort">4445</attribute>
</code>```

4445 was in use, so changed to 4446

File name : jboss-4.0.3SP1\server\default\conf\jboss-service.xml

netstat was useful to identify the port

```<code>netstat -an |find /i "4445"
</code>```

TCP    0.0.0.0:4445           0.0.0.0:0              LISTENING

ContentLicense: CC BY-SA 2.5

Title: Jboss server startup exception

Body:
I am seeing the following exception while starting Jboss-4.0.3SP1 on my Windows 7 64 bit machine. I am researching on this to see if there any clash for the ports etc.. Any thoughts from you would be appreciated!

14:52:13,067 WARN  [ServiceController] Problem starting service jboss:service=invoker,type=pooled
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at org.jboss.invocation.pooled.server.PooledInvoker.startService(PooledInvoker.java:205)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:428)
        at org.jboss.system.ServiceController.start(ServiceController.java:446)
        at org.jboss.system.ServiceController.start(ServiceController.java:446)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:592)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy5.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
        at org.jboss.Main.boot(Main.java:187)
        at org.jboss.Main$1.run(Main.java:438)
        at java.lang.Thread.run(Thread.java:595)

Body:
Yeah! Fixed the issue, one of the port was in use.

<attribute name="ServerBindPort">4445</attribute>

4445 was in use, so changed to 4446

File name : jboss-4.0.3SP1\server\default\conf\jboss-service.xml

netstat was useful to identify the port

netstat -an |find /i "4445"

TCP    0.0.0.0:4445           0.0.0.0:0              LISTENING


问:
Android onSearchRequested() callback to the calling activity
I have a MapActivity that will display the Android Search box when a search button is pressed. The SearchManager manages the dialog, and passes the user's query to a searchable activity, which searches an SQLite DB and displays the results using a custom adapter.

This works fine - and I'm getting the correct results from the DB displayed.

However, what I want to do is display the result in the MapActivity on a map when the user clicks on a search result. Currently, this means starting a new MapActivity, passing the search result in using a Bundle.

I'd have thought the cleaner way was to pass the search result back to the original activity, rather than start a new one. At the moment, my activity stack goes MapAct -> SearchManager -> Search Result -> New MapAct. Which means pressing "back" from the new MapAct will go back to the query results, then to the original MapAct.

It seems that in the Search Result, calling finish() does not cause onActivityResult to be called in the calling MapActivity.

Any ideas how to get this callback and maintain a sensible activity stack?

答:
I finally discovered a solution to this that does not involve singleTop.

First, in your Activity that originates the search, override startActivityForResult:

@Override
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode, @Nullable Bundle options) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        int flags = intent.getFlags();
        // We have to clear this bit (which search automatically sets) otherwise startActivityForResult will never work
        flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
        intent.setFlags(flags);
        // We override the requestCode (which will be -1 initially)
        // with a constant of ours.
        requestCode = AppConstants.ACTION_SEARCH_REQUEST_CODE;
    }
    super.startActivityForResult(intent, requestCode, options);
}
```

Android will always (for some reason) start the ACTION_SEARCH intent with the Intent.FLAG_ACTIVITY_NEW_TASK flag, for some reason, but if that flag is set, onActivityResult will never be (correctly) called in your originating task.

Next, in your searchable Activity, you just call setResult(Intent.RESULT_OK, resultBundle) as normal when the user selects an item.

Finally, you implement onActivityResult(int requestCode, int resultCode, Intent data) in your originating Activity and respond appropriately when the resultCode is Intent.RESULT_OK and the requestCode is your request code constant (AppConstants.ACTION_SEARCH_REQUEST_CODE in this case).

Body:
I finally discovered a solution to this that does not involve singleTop.

First, in your Activity that originates the search, override startActivityForResult:

@Override
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode, @Nullable Bundle options) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        int flags = intent.getFlags();
        // We have to clear this bit (which search automatically sets) otherwise startActivityForResult will never work
        flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
        intent.setFlags(flags);
        // We override the requestCode (which will be -1 initially)
        // with a constant of ours.
        requestCode = AppConstants.ACTION_SEARCH_REQUEST_CODE;
    }
    super.startActivityForResult(intent, requestCode, options);
}

Android will always (for some reason) start the ACTION_SEARCH intent with the Intent.FLAG_ACTIVITY_NEW_TASK flag, for some reason, but if that flag is set, onActivityResult will never be (correctly) called in your originating task.

Next, in your searchable Activity, you just call setResult(Intent.RESULT_OK, resultBundle) as normal when the user selects an item.

Finally, you implement onActivityResult(int requestCode, int resultCode, Intent data) in your originating Activity and respond appropriately when the resultCode is Intent.RESULT_OK and the requestCode is your request code constant (AppConstants.ACTION_SEARCH_REQUEST_CODE in this case).


问:
Using Dynamic Memory Allocation for strings Arrays
I'm just starting to learn C, so if you can, please don't be so hard on me.
I'm trying to learn how to allocate memory for arrays, so i started with someting like this. I just wanna dynamicly allocate memory for array of strings, and then display it.

```<code>int main( )
{
    int number, i;
    scanf ("%d", &number);
    char **table =(char **) malloc(number*sizeof(char*));
    for(i=0; i<number; i++)
    {
        table[i] = (char *)malloc(6);
    }

    for(i=0; i<number; i++)
    {
        scanf("%s", &table[i]);
    }

    for(i=0; i<number; i++)
    {
        printf("Person nr %d : %s ", i+1, &table[i]);
    }

    for(i=0; i<number; i++)
    {
         free(table[i]);
    }
    free(table);
    return 0;
}
</code>```

But program only works when i type words with 3 or less letters. So, I don't know if i have a problem with memory allocation, or maybe i i just can't print with %s for **char? Maybe someone could tell me where I'm doing wrong and explain why?

Thank you for taking the time to read it :)

答:
The problem is this:

```<code>scanf("%s", &table[i]);
</code>```

and this:

```<code>printf("Person nr %d : %s ", i+1, &table[i]);
</code>```

You seem to forget that table[i] is a pointer to char which is what a string basically is. By using &table[i] you get a pointer to the pointer, which is of type char **. You basically treat the pointer itself as a string, not the memory it points to.

Simply drop the address-of operator and you can read strings up to five characters (plus the terminator).

Body:
I'm just starting to learn C, so if you can, please don't be so hard on me.
I'm trying to learn how to allocate memory for arrays, so i started with someting like this. I just wanna dynamicly allocate memory for array of strings, and then display it.

int main( )
{
    int number, i;
    scanf ("%d", &number);
    char **table =(char **) malloc(number*sizeof(char*));
    for(i=0; i<number; i++)
    {
        table[i] = (char *)malloc(6);
    }

    for(i=0; i<number; i++)
    {
        scanf("%s", &table[i]);
    }

    for(i=0; i<number; i++)
    {
        printf("Person nr %d : %s ", i+1, &table[i]);
    }

    for(i=0; i<number; i++)
    {
         free(table[i]);
    }
    free(table);
    return 0;
}

But program only works when i type words with 3 or less letters. So, I don't know if i have a problem with memory allocation, or maybe i i just can't print with %s for **char? Maybe someone could tell me where I'm doing wrong and explain why?

Thank you for taking the time to read it :)

Body:
The problem is this:

scanf("%s", &table[i]);

and this:

printf("Person nr %d : %s ", i+1, &table[i]);

You seem to forget that table[i] is a pointer to char which is what a string basically is. By using &table[i] you get a pointer to the pointer, which is of type char **. You basically treat the pointer itself as a string, not the memory it points to.

Simply drop the address-of operator and you can read strings up to five characters (plus the terminator).


问:
Different locales returned by two different apps on the same simulator
coming from this problem (1) I experience strange behaviors. I have two apps A and B that I run on the same simulator. When I call the following code Bundle.main.preferredLocalizations.first in A "de" is returned, but in B "de_DE" is returned. I wonder how this can be explained... Furthermore the same code coming from (1) works as expected in A but not in B. I am confused.

答:
I think this is because of the language fallback.

"de" means german in general also in Austria for example and "de_DE" means german for region Germany.

Maybe one of the apps has some settings for explicit German language and/or region fallback

Hope this helps.


问:
How can iterate object value from json object in javascript
I tried to implement small google map. I have a json object that is : {"app_title":"whether","users":{"iv001":{"lat":"17.85","lng":"18.45"}}}  . How can i iterate lat and lng values. please help me.

```<code>{ "app_title":"whether",
  "users": {
     "iv001": {
             "lat":"17.85",
             "lng":"18.45"
       }
   }
 }
</code>```

var latitude = ???; //here we need lat value
var longitude = ???; //here we need lng value

答:
```<code>var obj = {"app_title":"whether","users":{"iv001":{"lat":"17.85","lng":"18.45"}}}
var latitude = obj.users.iv001.lat;
var longitude = obj.users.iv001.lng;
</code>```

Body:
I tried to implement small google map. I have a json object that is : {"app_title":"whether","users":{"iv001":{"lat":"17.85","lng":"18.45"}}}  . How can i iterate lat and lng values. please help me.

{ "app_title":"whether",
  "users": {
     "iv001": {
             "lat":"17.85",
             "lng":"18.45"
       }
   }
 }

var latitude = ???; //here we need lat value
var longitude = ???; //here we need lng value


问:
how to implement Restfull api using laravel
now i'm developing android app for the existing web site.so now i want to implement simple Api for the post data (to laravel api from android app) and get data (from laravel api  to android app).so i read lots of articles but no any proper way to satisfy my way. any one have idea about this and what is the flow of the this api. thank you</p>

答:
The easiest way to get started is using Resource Controllers.

That way you can implement a simple CRUD REST API (so much caps).

Then use passport for authenticating the consumer of the API.

Steps to take

Define Models matching your database tables

Create a resource controller with artisan

```<code>php artisan make:controller PhotoController --resource
</code>```

Define the route e.g.:

```<code>Route::resource('photos', 'PhotoController');
</code>```

Implement the resource controllers functions with the behaviour you expect

If the API works as you want it to: it's time to shield it with credentials. I recommend using Passport for this.

Body:
The easiest way to get started is using Resource Controllers.

That way you can implement a simple CRUD REST API (so much caps).

Then use passport for authenticating the consumer of the API.

Steps to take

Define Models matching your database tables

Create a resource controller with artisan

php artisan make:controller PhotoController --resource

Define the route e.g.:

Route::resource('photos', 'PhotoController');

Implement the resource controllers functions with the behaviour you expect

If the API works as you want it to: it's time to shield it with credentials. I recommend using Passport for this.


问:
Jquery - fadeIn - jerky fadein
I've made a simple image switcher that fades different logos in and out. Example and full source code at http://bit.ly/ewrSgp . I fadeout the image, then queue a src attribute change, then fade back in. It seems to work smoothly for a while but after 20 seconds or so it starts to fade the image back in before changing the src, which then changes instantly and  looks ugly. Am I doing this right?

The code that runs the change is:

```<code>// fadeout old image, change to new and fadeback in.
// Call function changeimage again.
$(imToChange).fadeOut(600).queue(function (n) {
    jQuery(this).attr('src', newimageSrc);
    n();
}).fadeIn(1000, function () {
    setTimeout(function () {
        //recall image change function
        changeImage(indexToChange);
    }, o.delay);
});
</code>```

Thanks in advance.

答: Specify width and height for img tag.

Title: Jquery - fadeIn - jerky fadein

Body:
I've made a simple image switcher that fades different logos in and out. Example and full source code at http://bit.ly/ewrSgp . I fadeout the image, then queue a src attribute change, then fade back in. It seems to work smoothly for a while but after 20 seconds or so it starts to fade the image back in before changing the src, which then changes instantly and  looks ugly. Am I doing this right?

The code that runs the change is:

// fadeout old image, change to new and fadeback in.
// Call function changeimage again.
$(imToChange).fadeOut(600).queue(function (n) {
    jQuery(this).attr('src', newimageSrc);
    n();
}).fadeIn(1000, function () {
    setTimeout(function () {
        //recall image change function
        changeImage(indexToChange);
    }, o.delay);
});

Thanks in advance.

Body: Specify width and height for img tag.


问:
How to ping in C++/Qt without to use a QProcess?
I would like ping an ip address in my Qt Application before to launch an external program.

I would like code a ping class without to use ping.exe (and execute a process). The problem is when I "ping 127.0.0.1", it takes 3+ seconds to finish the (ping) process on windows. I need only a fast check (less than 500 ms) before to execute (instantly) my external program.

I would like use QNetwork or something similar.

答:
If you don't mind using platform depended code within your Qt Application you may check:

https://evileg.com/en/post/167/

for an example using ICMP echo API on windows and

https://noping.cc/

for liboping, a Linux C library to generate ICMP echo requests.


问:
InflateException: Binary XML file line #1: Error inflating class <unknown> caused by OutOfMemoryError
Here is my code:

input.xml (layout folder)

```<code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:background="@drawable/background_main" >

    <ImageView
        android:id="@+id/logo_image"
        android:background="@drawable/background_green"
        android:src="@drawable/titleimage"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        />

    <ScrollView
        android:id="@+id/scroller"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/logo_image"
        android:layout_marginTop="10dp"
        >

        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:stretchColumns="*" >

            <TableRow
                android:id="@+id/device_type_row"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:layout_marginRight="5dp" >

                <RadioButton
                    android:id="@+id/device_type_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/device_type" />

                <RadioGroup
                    android:id="@+id/device_type_radio_selection"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <RadioButton
                        android:id="@+id/radioIos"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/iOS"
                        />

                    <RadioButton
                        android:id="@+id/radioAndroid"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/android"
                        />

                </RadioGroup>

            </TableRow>

            <TableRow
                android:id="@+id/days_as_customers_row"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:layout_marginRight="5dp" >

                <RadioButton
                    android:id="@+id/days_as_customers_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/days_as_customers" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/days_as_customer_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/days_as_customer_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="1/210"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/average_sessions_row"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/average_sessions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/average_sessions" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/average_sessions_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/average_sessions_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="240/9000"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>
            </TableRow>

            <TableRow
                android:id="@+id/tableRow4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/conversion_time_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/conversion_title" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/conversion_time_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/conversion_time_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="3/55"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/monthly_spend_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/monthly_spend" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/monthly_spend_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/monthly_spend_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="3/55"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/virality_invites_sent_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/virality_invites_sent" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/virality_invites_sent_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/virality_invites_sent_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="0-50"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/churned_users_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/churned_users" />

                <RadioGroup
                    android:id="@+id/churned_users_radio_selection"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <RadioButton
                        android:id="@+id/radioYes"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/iOS"
                        />

                    <RadioButton
                        android:id="@+id/radioNo"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/android"
                        />

                </RadioGroup>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow8"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/ltv_total_spent_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/ltv_total_spent" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/ltv_total_spent_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/ltv_total_spent_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="0$-80$"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>
        </TableLayout>

    </ScrollView>

    <Button
        android:id="@+id/input_submit_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/submit_button_img" />

</RelativeLayout>
</code>```

InputFragment.java

```<code>import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;

public class InputFragment extends Fragment {

    private Button submit;
    private RadioButton deviceTypeRadio, daysAsCustomerRadio, averageSessionsRadio, conversionTimeRadio;
    private RadioButton monthlySpendRadio,viralityInvitesSentRadio, churnedUsersRadio, LTVTotalSpentRadio;
    private SeekBar daysAsCustomerSeek, averageSessionSeek, conersionTimeSeek, monthlySpendSeek;
    private SeekBar viralityInvitesSeek, ltvTotalSpentSeek;
    private TextView daysasAsCustomerText, averageSessionText, conversionTimeText, monthlySpendText;
    private TextView viralityInvitesText, letvTotalText;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        //Intializing instance variables
        View view = inflater.inflate(R.layout.input, container,false);

        submit = (Button)view.findViewById(R.id.input_submit_button);

        return view;

    }

}
</code>```

I can run this code properly, but when I changed the orientation of the Emulator, it gives the following error.

```<code>12-19 11:17:53.590: E/AndroidRuntime(5644): FATAL EXCEPTION: main
12-19 11:17:53.590: E/AndroidRuntime(5644): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.nFlate.xxx.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3692)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.access$700(ActivityThread.java:141)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.os.Looper.loop(Looper.java:137)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.main(ActivityThread.java:5041)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Method.invokeNative(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Method.invoke(Method.java:511)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at dalvik.system.NativeStart.main(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.nFlate.nflate.InputFragment.onCreateView(InputFragment.java:30)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.Activity.performStart(Activity.java:5114)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 12 more
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: java.lang.reflect.InvocationTargetException
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Constructor.constructNative(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 27 more
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: java.lang.OutOfMemoryError
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.content.res.Resources.loadDrawable(Resources.java:1965)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.View.<init>(View.java:3330)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.View.<init>(View.java:3259)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.ViewGroup.<init>(ViewGroup.java:425)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.widget.RelativeLayout.<init>(RelativeLayout.java:210)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 30 more
</code>```

Basically, the error is targeting to the below place:

```<code>View view = inflater.inflate(R.layout.input, container,false);
</code>```

This only happens in Emulator, not in phone. What is wrong here?

答: My problem was that I had a shape with a <solid> with color ?selectableItemBackground. Yes it is dumb and a specific case, but posting it here for people with the same mistake.

Body:
Here is my code:

input.xml (layout folder)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:background="@drawable/background_main" >

    <ImageView
        android:id="@+id/logo_image"
        android:background="@drawable/background_green"
        android:src="@drawable/titleimage"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        />

    <ScrollView
        android:id="@+id/scroller"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/logo_image"
        android:layout_marginTop="10dp"
        >

        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:stretchColumns="*" >

            <TableRow
                android:id="@+id/device_type_row"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:layout_marginRight="5dp" >

                <RadioButton
                    android:id="@+id/device_type_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/device_type" />

                <RadioGroup
                    android:id="@+id/device_type_radio_selection"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <RadioButton
                        android:id="@+id/radioIos"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/iOS"
                        />

                    <RadioButton
                        android:id="@+id/radioAndroid"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/android"
                        />

                </RadioGroup>

            </TableRow>

            <TableRow
                android:id="@+id/days_as_customers_row"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:layout_marginRight="5dp" >

                <RadioButton
                    android:id="@+id/days_as_customers_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/days_as_customers" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/days_as_customer_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/days_as_customer_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="1/210"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/average_sessions_row"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/average_sessions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/average_sessions" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/average_sessions_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/average_sessions_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="240/9000"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>
            </TableRow>

            <TableRow
                android:id="@+id/tableRow4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/conversion_time_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/conversion_title" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/conversion_time_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/conversion_time_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="3/55"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/monthly_spend_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/monthly_spend" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/monthly_spend_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/monthly_spend_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="3/55"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/virality_invites_sent_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/virality_invites_sent" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/virality_invites_sent_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/virality_invites_sent_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="0-50"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/churned_users_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/churned_users" />

                <RadioGroup
                    android:id="@+id/churned_users_radio_selection"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <RadioButton
                        android:id="@+id/radioYes"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/iOS"
                        />

                    <RadioButton
                        android:id="@+id/radioNo"
                        android:layout_width="wrap_content"
                        android:layout_height = "wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="@string/android"
                        />

                </RadioGroup>

            </TableRow>

            <TableRow
                android:id="@+id/tableRow8"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <RadioButton
                    android:id="@+id/ltv_total_spent_radio"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/ltv_total_spent" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:weightSum="2" >

                    <SeekBar
                        android:id="@+id/ltv_total_spent_seekbar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/ltv_total_spent_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="0$-80$"
                        android:layout_weight="1"
                        android:singleLine="true"
                        android:textAppearance="?android:attr/textAppearanceSmall" />

                </LinearLayout>

            </TableRow>
        </TableLayout>

    </ScrollView>

    <Button
        android:id="@+id/input_submit_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/submit_button_img" />

</RelativeLayout>

InputFragment.java

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;

public class InputFragment extends Fragment {

    private Button submit;
    private RadioButton deviceTypeRadio, daysAsCustomerRadio, averageSessionsRadio, conversionTimeRadio;
    private RadioButton monthlySpendRadio,viralityInvitesSentRadio, churnedUsersRadio, LTVTotalSpentRadio;
    private SeekBar daysAsCustomerSeek, averageSessionSeek, conersionTimeSeek, monthlySpendSeek;
    private SeekBar viralityInvitesSeek, ltvTotalSpentSeek;
    private TextView daysasAsCustomerText, averageSessionText, conversionTimeText, monthlySpendText;
    private TextView viralityInvitesText, letvTotalText;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        //Intializing instance variables
        View view = inflater.inflate(R.layout.input, container,false);

        submit = (Button)view.findViewById(R.id.input_submit_button);

        return view;

    }

}

I can run this code properly, but when I changed the orientation of the Emulator, it gives the following error.

12-19 11:17:53.590: E/AndroidRuntime(5644): FATAL EXCEPTION: main
12-19 11:17:53.590: E/AndroidRuntime(5644): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.nFlate.xxx.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3692)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.access$700(ActivityThread.java:141)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.os.Looper.loop(Looper.java:137)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.main(ActivityThread.java:5041)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Method.invokeNative(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Method.invoke(Method.java:511)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at dalvik.system.NativeStart.main(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at com.nFlate.nflate.InputFragment.onCreateView(InputFragment.java:30)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.Activity.performStart(Activity.java:5114)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 12 more
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: java.lang.reflect.InvocationTargetException
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Constructor.constructNative(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 27 more
12-19 11:17:53.590: E/AndroidRuntime(5644): Caused by: java.lang.OutOfMemoryError
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.content.res.Resources.loadDrawable(Resources.java:1965)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.View.<init>(View.java:3330)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.View.<init>(View.java:3259)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.view.ViewGroup.<init>(ViewGroup.java:425)
12-19 11:17:53.590: E/AndroidRuntime(5644):     at android.widget.RelativeLayout.<init>(RelativeLayout.java:210)
12-19 11:17:53.590: E/AndroidRuntime(5644):     ... 30 more

Basically, the error is targeting to the below place:

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

This only happens in Emulator, not in phone. What is wrong here?


问:
refreshControl gives "undefined is not a function..." in react-native app
I'm trying to add refresh functionality in my ScrollView, but when trying to refresh I get this error:

```<code>undefined is not a function (evaluating '(0,_reactNative.fetchData)()')
</code>```

I have followed the example in the documentation

Here is my code

```<code>class Schedule extends Component {

 constructor(props) {
    super(props);
    this.state = {
      refreshing: false
    };
  }

  _onRefresh() {
    this.setState({refreshing: true});
    fetchData().then(() => {
      this.setState({refreshing: false});
    });
  }
 render() {
  return (
<View>
 <ScrollView
      style={{backgroundColor: "white"}} scrollEnabled={true} horizontal={false}
      refreshControl={
        <RefreshControl
          refreshing={this.state.refreshing}
          onRefresh={this._onRefresh.bind(this)}
        />
      }
    >
   <View>
    //...Content I'm trying to refresh
   </View>

</View>
</ScrollView>
  )
 }
}
</code>```

I can't imagine there being anything wrong with the code itself, as it's taken straight from the example. There shouldn't be any problems with the imports either

```<code>import {View, ScrollView, RefreshControl, fetchData } from 'react-native';
</code>```

答: You must provide the fetchData function it's not in the react-native module.

Body:
I'm trying to add refresh functionality in my ScrollView, but when trying to refresh I get this error:

undefined is not a function (evaluating '(0,_reactNative.fetchData)()')

I have followed the example in the documentation

Here is my code

class Schedule extends Component {

 constructor(props) {
    super(props);
    this.state = {
      refreshing: false
    };
  }

  _onRefresh() {
    this.setState({refreshing: true});
    fetchData().then(() => {
      this.setState({refreshing: false});
    });
  }
 render() {
  return (
<View>
 <ScrollView
      style={{backgroundColor: "white"}} scrollEnabled={true} horizontal={false}
      refreshControl={
        <RefreshControl
          refreshing={this.state.refreshing}
          onRefresh={this._onRefresh.bind(this)}
        />
      }
    >
   <View>
    //...Content I'm trying to refresh
   </View>

</View>
</ScrollView>
  )
 }
}

I can't imagine there being anything wrong with the code itself, as it's taken straight from the example. There shouldn't be any problems with the imports either

import {View, ScrollView, RefreshControl, fetchData } from 'react-native';


问:
Running Metro Apps Minimized from a C# Application
For non-metro apps, the ProcessStartInfo.WindowStyle can be used to run the app minimized:

```<code>ProcessStartInfo processStartInfo = new ProcessStartInfo("notepad.exe");
processStartInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(processStartInfo);
</code>```

It is also possible using Kernel32.CreateProcess.

However, for metro apps, the Window Style approach does not work:

```<code>ProcessStartInfo processStartInfo = new ProcessStartInfo("microsoft-edge://");
processStartInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(processStartInfo);
</code>```

and CreateProcess is only applicable for non-metro apps.

Is there a way to run metro apps minimized? (Note that this is different from running the metro app, getting the window handle, then minimizing the window)

答: Unfortunately, it seems like minimize the UWP app into the system tray currently is not supported. If you do want this feature, you may help that happen by voting UWP System tray support.</p>

Body:
For non-metro apps, the ProcessStartInfo.WindowStyle can be used to run the app minimized:

ProcessStartInfo processStartInfo = new ProcessStartInfo("notepad.exe");
processStartInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(processStartInfo);

It is also possible using Kernel32.CreateProcess.

However, for metro apps, the Window Style approach does not work:

ProcessStartInfo processStartInfo = new ProcessStartInfo("microsoft-edge://");
processStartInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(processStartInfo);

and CreateProcess is only applicable for non-metro apps.

Is there a way to run metro apps minimized? (Note that this is different from running the metro app, getting the window handle, then minimizing the window)


问:
Jemeter test JDBC param
This is ThreadGroup:

This is JDBC Connection Config:
![this is JDBC CONNECTIIN CONFIG][2]

The SQL:

```<code> SELECT siteid FROM tky_tab_bbsdata WHERE name = ?
</code>```

And then it throws exception:

java.sql.SQLException: ORA-01008: 并非所有变量都已绑定
  the request is :SELECT siteid FROM tky_tab_bbsdata where name = ?
  梁段
  VARCHAR

I don't know how to solve this problem, the SQL may be right!

答:
You don't need to use parameter outside SQL statement:

Remove values from: parameter values and parameter type

In SQL statement replace your = ? with a real value, use = '[value]'

Title: Jemeter test JDBC param

Body:
This is ThreadGroup:

This is JDBC Connection Config:
![this is JDBC CONNECTIIN CONFIG][2]

The SQL:

 SELECT siteid FROM tky_tab_bbsdata WHERE name = ?

And then it throws exception:

java.sql.SQLException: ORA-01008: 并非所有变量都已绑定
  the request is :SELECT siteid FROM tky_tab_bbsdata where name = ?
  梁段
  VARCHAR

I don't know how to solve this problem, the SQL may be right!


问:
HTML Web page that Launches a powershell script
I am trying to find a way to host a website on a windows server in my environment. I would like to have a basic web page that can accept an entry value from the web page and then I would take that value and input it into my powershell script. My powershell script would do most the work but I have no idea how to collect data from the user and then make that data appear in my powershell script. The powershell script would run on the server side (not in front of the user) and then email them data that it collects. I would like to have a single webpage if possible. I tried to do that but also couldnt really figure that out. </p>

```<code><!DOCTYPE html>
<html>
<head>
<title> Self Service</title>
</head>
<body>

<h1>Welcome to the Self Service</h1>
<p>Below you can enter your userID .</p>

<form action="ThankYou.html" method="post">
UserID: <input type="text" name="text"><br>
<input type="submit" value="Submit">
</form>

<input type="button" value="Launch Installer" onclick=

</body>
</html>
</code>```

答: Try Presley? A Sinatra-like lightweight web framework written in PowerShell and can run PowerShell on server.</p>

Body:
I am trying to find a way to host a website on a windows server in my environment. I would like to have a basic web page that can accept an entry value from the web page and then I would take that value and input it into my powershell script. My powershell script would do most the work but I have no idea how to collect data from the user and then make that data appear in my powershell script. The powershell script would run on the server side (not in front of the user) and then email them data that it collects. I would like to have a single webpage if possible. I tried to do that but also couldnt really figure that out.

<!DOCTYPE html>

<title> Self Service</title>

Welcome to the Self Service

Below you can enter your userID .

<form action="ThankYou.html" method="post">
UserID: <input type="text" name="text">

<input type="submit" value="Submit">
</form>

<input type="button" value="Launch Installer" onclick=


问:
How to trigger ngModelChange with a button in Angular 2
I use *ngFor to populate my table.

```<code><tr *ngFor= "stu in students">
<td>{{stu.name}}</td>
<td><input type="checkbox" ngModel="isChecked"
(ngModelChange)="addID(stu.id)</td>
</tr>
</code>```

Then I have a button outside the table.

```<code><button (click)="selectAllID()">select all</button>
</code>```

Then I have my component as:

studentID=[];
isChecked=false;

addID(id:number){
this.student.push (id);
//I do other thing with id
}

selectAllID (){
 If (this.isChecked)
     this isChecked = false;
  else this isChecked = true
}
```

The problem is:

if I check individual checkbox, the addID() function is executed. But if I click on the select all button, the checkboxes get selected. But the addID() function is not called.

How can I trigger the ngModelChange function when I use the select all button so I get all selected id's

答:
Thank you everyone. i finally resolved the issue. This is what i did:

I used the selectAll() function to automatically load all id's (this id i get from the source loading my tables) to an array. and
i set the value of isChecked to true or false.

ContentLicense: CC BY-SA 4.0

Body:
I use *ngFor to populate my table.

{{stu.name}}
<input type="checkbox" ngModel="isChecked"
(ngModelChange)="addID(stu.id)

Then I have a button outside the table.

<button (click)="selectAllID()">select all</button>

Then I have my component as:

studentID=[];
isChecked=false;

addID(id:number){
this.student.push (id);
//I do other thing with id
}

selectAllID (){
 If (this.isChecked)
     this isChecked = false;
  else this isChecked = true
}

The problem is:

if I check individual checkbox, the addID() function is executed. But if I click on the select all button, the checkboxes get selected. But the addID() function is not called.

How can I trigger the ngModelChange function when I use the select all button so I get all selected id's


问:
Toggle bootstrap value
How to find toggle value when using toggle in bootstrap.

```<code><input id="toggle-event" type="checkbox" data-toggle="toggle" data-on="Enabled" data-off="Disabled">

$(document).ready(function(){
    $('#toggle-event').change(function() {
        //Enabled means it will enter into if loop, here we sort machine list by green
        if('toggle is Enable'){
           //do something
        }
        //if toggle is disable
       else{
            //do something
        }
    })
  });
</code>```

In the above example, when i toggle to Enable or Disable, how to find the value of toggle checkbox.

答:
value of toggle checkbox ? means you mean whether checkbox is checked or not,
then here is the solution</p>

```<code>$(this).is(":checked")
</code>```

Title: Toggle bootstrap value

Body:
How to find toggle value when using toggle in bootstrap.

<input id="toggle-event" type="checkbox" data-toggle="toggle" data-on="Enabled" data-off="Disabled">

$(document).ready(function(){
    $('#toggle-event').change(function() {
        //Enabled means it will enter into if loop, here we sort machine list by green
        if('toggle is Enable'){
           //do something
        }
        //if toggle is disable
       else{
            //do something
        }
    })
  });

In the above example, when i toggle to Enable or Disable, how to find the value of toggle checkbox.

Body:
value of toggle checkbox ? means you mean whether checkbox is checked or not,
then here is the solution

$(this).is(":checked")