问:
Autofocus on editable gridview field
How can I add the autofocus and select on the editable gridview field?

I want to make editacle field autofocus and autoselect.
Here's my gridview code :

```<code><?php Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'showPageSummary'=>true,
        'pjax'=>true,
        'striped'=>true,
        'hover'=>true,
        'responsiveWrap' => false,
        'panel'=>['type'=>'primary', 'heading'=>$partner_name],
        'columns'=>[
            [
                'attribute' => 'city_code',
                'label' => 'City Code',
            ],
            [
                'class'=>'kartik\grid\EditableColumn',
                'editableOptions'=>[
                   'asPopover' => false,
                   'inputType'=>\kartik\editable\Editable::INPUT_TEXT,
                ],

                'attribute'=>'amount',
                'label'=>'Amount',

            ],
        ],
    ]);

    ?>
<?php Pjax::end() ; ?>
</code>```

答:
Try with this JS code:</p>

```<code>$("form input:text, form textarea").first().focus();
</code>```

Title: Autofocus on editable gridview field

Body:
How can I add the autofocus and select on the editable gridview field?

I want to make editacle field autofocus and autoselect.
Here's my gridview code :

<?php Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'showPageSummary'=>true,
        'pjax'=>true,
        'striped'=>true,
        'hover'=>true,
        'responsiveWrap' => false,
        'panel'=>['type'=>'primary', 'heading'=>$partner_name],
        'columns'=>[
            [
                'attribute' => 'city_code',
                'label' => 'City Code',
            ],
            [
                'class'=>'kartik\grid\EditableColumn',
                'editableOptions'=>[
                   'asPopover' => false,
                   'inputType'=>\kartik\editable\Editable::INPUT_TEXT,
                ],

                'attribute'=>'amount',
                'label'=>'Amount',

            ],
        ],
    ]);

    ?>
<?php Pjax::end() ; ?>

Body:
Try with this JS code:

$("form input:text, form textarea").first().focus();


来源: stackexchange

问:
Android Multi language Application
Please See this Image

An android application with 2 languages ENGLISH and ARABIC, there is also a registration activity which includes Password and Email . So when application is in Arabic Language I want to keep password and Email in English language.
  Is there any solution for it?

I Just want to make EMAIL and PAssword in ENGLISH if locale is Arabic .

答:
You can use translatable property in strings.xml

```<code><string name="email" translatable="false">Email</string>
</code>```

ContentLicense: CC BY-SA 3.0

Title: Android Multi language Application

Body:
You can use translatable property in strings.xml

<string name="email" translatable="false">Email</string>


问:
Dropzone error on crossdomain file upload
I want to upload file from on server to other server with dropzone. But I keep geting error Server responded with 0 code. Dropzone only send Option request to target server. Request And response headers are here. After that i get the error('0 code');
I Also set Headers to my php script. Which are these.

```<code>header('Access-Control-Allow-Origin: '.$pathToOrigin);
header('Access-Control-Allow-Credentials:false');
header('Access-Control-Max-Age:1000');
header('Access-Control-Allow-Methods:PUT, POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: X-Requested-With, cache-control, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers');
</code>```

requuest headers

答:
I tried put methode too.still Same response.  browser only send (Option) request. Here is the image of browser response.
Image of Response</p>

Body:
I want to upload file from on server to other server with dropzone. But I keep geting error Server responded with 0 code. Dropzone only send Option request to target server. Request And response headers are here. After that i get the error('0 code');
I Also set Headers to my php script. Which are these.

header('Access-Control-Allow-Origin: '.$pathToOrigin);
header('Access-Control-Allow-Credentials:false');
header('Access-Control-Max-Age:1000');
header('Access-Control-Allow-Methods:PUT, POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: X-Requested-With, cache-control, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers');

requuest headers


问:
what is the output of join
I have two tables a and b having column a and b respectively

```<code>A      B
1
1      1
       1
1      1
</code>```

what is the output when i join a to b.

答:
```<code>select *
from a join b #join is same as inner join
on a.a_id=b.a_id
</code>```

i guess you have an id in both of your table , now lets say a_id is primary key in your a table and its a foreign key in your b table. Then if you use a join you will get the common records in both tables.

Title: what is the output of join

Body:
I have two tables a and b having column a and b respectively

A      B
1
1      1
       1
1      1

what is the output when i join a to b.

Body:
select *
from a join b #join is same as inner join
on a.a_id=b.a_id

i guess you have an id in both of your table , now lets say a_id is primary key in your a table and its a foreign key in your b table. Then if you use a join you will get the common records in both tables.


问:
Amazon EC2 instance through public ip is not working
The instance is running fine. I am using linux os and apache-tomcat-8.0.33 server. I can access from private ip using putty  But when i am trying to access the same through the public ip, it is not accessible. I have seen the security configurations all ports are enabled.

Can anyone help me how to reslove this issue

 inbound image

答:
You opened your amazon web console

You go to Amazon EC2 Security Groups

You should have a default group for inbound rules (see below)

You click on Modify inbound rules (modifier les règles entrantes in French here)

Once done, you add your public ip with the subnet you want

I've added my IP public address and you should be good.


问:
Sorting locations by distance from a given point and filtering the results by a maximal distance in mongoid
I have a collection in which each document has a location. I need to sort the documents by their distance to a given starting point. Moreover, I would like to have only the documents whose distance from the starting point doesn't exceed a certain limit.

I have tried the following:

```<code>Store.geo_near([32,32]).where(:geo_near_distance.lt => 2)
# all docs whose location are at most 2 from [32, 32]
</code>```

The above results in the following error:

```<code>NoMethodError: undefined method `where' for #<Mongoid::Contextual::GeoNear:0x438fb70>
</code>```

答:
I got it working by: Mongoid6</p>

```<code>  Store.unscoped.where(
     :coordinates => {
       '$nearSphere' => your_store.coordinates,
       '$maxDistance' => distance_in_km.fdiv(111.12)})
</code>```

Body:
I have a collection in which each document has a location. I need to sort the documents by their distance to a given starting point. Moreover, I would like to have only the documents whose distance from the starting point doesn't exceed a certain limit.

I have tried the following:

Store.geo_near([32,32]).where(:geo_near_distance.lt => 2)
# all docs whose location are at most 2 from [32, 32]

The above results in the following error:

NoMethodError: undefined method `where' for #<Mongoid::Contextual::GeoNear:0x438fb70>

Body:
I got it working by: Mongoid6

  Store.unscoped.where(
     :coordinates => {
       '$nearSphere' => your_store.coordinates,
       '$maxDistance' => distance_in_km.fdiv(111.12)})


问:
Why '$' can be omitted within let construct
The $ sign can be omitted within the let and (( ... )) constructs.

Why is that so, given that $ is mandatory when using if or while?

答:
```<code>((i++)) or let i++
</code>```

just increments the i. It is an operation performed on a value.
It returns nothing but an exit code.

```<code>var=$((i+2))
</code>```

expands $((i+2)) to its sum.

It returns a result.

Body:
((i++)) or let i++

just increments the i. It is an operation performed on a value.
It returns nothing but an exit code.

var=$((i+2))

expands $((i+2)) to its sum.

It returns a result.


问:
Way to disable sqlalchemy event listeners
I use sqlalchemy 1.0.
My project has several models, some of them have event listeners, like
event.listen(Model, 'after_update', Model._after_update).

In case of unit-testing I need to disable all event listeners on model/session/etc.

When particular test finished I need to enable all listeners.

Is there any ways to achieve this?

答:
You can get all event listeners for model from event.registry._key_to_collection. It's a dict with keys (id(target), identifier, id(function)). Then remove them with event.remove.

```<code>import ctypes
from sqlalchemy import event

def clear_event_listeners(model):
    keys = [k for k in event.registry._key_to_collection if k[0] == id(model)]
    for key in keys:
        target = model
        identifier = key[1]
        fn = ctypes.cast(key[2], ctypes.py_object).value  # get function by id
        event.remove(target, identifier, fn)
</code>```

Body:
You can get all event listeners for model from event.registry._key_to_collection. It's a dict with keys (id(target), identifier, id(function)). Then remove them with event.remove.

import ctypes
from sqlalchemy import event

def clear_event_listeners(model):
    keys = [k for k in event.registry._key_to_collection if k[0] == id(model)]
    for key in keys:
        target = model
        identifier = key[1]
        fn = ctypes.cast(key[2], ctypes.py_object).value  # get function by id
        event.remove(target, identifier, fn)


问:
AppEngine: Step-by-Step Debugging
While working with AppEngine locally (i.e. using dev_appserver.py), is there anyway to do a step-by-step debugging? It is a too old fashion to use logging.info() or similar functions to show the values of all the variables in the code and decide where the error is.</p>

答:
Eclipse PyDev supports debugging and AppEngine.

http://code.google.com/appengine/articles/eclipse.html

ContentLicense: CC BY-SA 2.5

Title: AppEngine: Step-by-Step Debugging


问:
take more time filter from 230 million records in hive table compare to mysql
I am working with hive table to execute one of sql to fetch some records from 230 million records but it is taking 300 seconds to execute with map reduce process and mysql fetches this information in less 1 seconds. Why hive take more time?

I am using Ambari Cluster with Tez engine. I am confused for moving database on hadoop.

答:
There are numerous reasons why MySQL might perform better than Hive on a particular query.  In that sense, your query is too broad.

The most likely cause are indexes in MySQL.  If you have a lot of data, MySQL can optimize queries using indexes.  Hive reads all the data and processes it.  MySQL can optimize the data being processed.

There are other causes as well.  If the data is stored in partitions, perhaps MySQL does a better job of partition pruning based on the where clause.

Without knowing the data and the query, there is no generalization.  For a single query, this is not too surprising.  In general, Hive is going to be faster on queries that need to process large amounts of data.


问:
Pass errors through sessionStorage variable on HTML form reload
I am currently working with a form which takes user data and passes to to mySQL  on submission. It has an opening paragraph which I want to change on failed submission to display whatever errors apply. I want to pass my errors to the refreshed form on failure to show the user what went wrong.  Here is my Opening div.

```<code><div id="formExplained">
     <h1>Title Here</h1>
     <p>Content Here</p>
</div>
</code>```

On submission my script sets my $error variable to false, so form submission will can proceed when $errors == false. I checks for various errors in php and appends them one by one to $errors. At the end I

```<code>if($_POST['submit']){
  //variable to hold relavent error messages.  Set to false
          $error = false;
  //check each form field for errors
        if(!$title){
          $error .= $missingTitle;
        }else{
          $title = filter_var($title, FILTER_SANITIZE_STRING);
          $title = mysqli_real_escape_string($link, $title);
        }//Check for Grocoordinates
        if(!$lat || !$lng){
          $error .= $missingGeo;
        }//etc
</code>```

Before I set up my mySQL query I do a check for errors and kill my code if they are present. Here I also pass my errors into sessionStorage, and echo a div containing my errors.

```<code>if($error){
          //pass errors from php to session Storage to display on reload
          echo "<script>sessionStorage.setItem('error', '$error');</script>";
          echo "<div id='error' class='error'>$error;</div>";
          echo "<p>Here Is Proof that this is Executing</p>";
          die();
        }
</code>```

The div containing errors and the paragraph both execute perfectly on page reload. They are displayed at the bottom of my map.

In a seperate piece of javascript which I run above all the php submission code, I pull the sessionStorage variable and attempt to change my innerHTML from my opening div to reflect the errors.

```<code><script>
  var error = sessionStorage.getItem('error');
    if(error){
        document.getElementById('formExplained').innerHTML = "<div class='error'><p>" + error + "</p></div>";
        }
</script>
</code>```

This code will not execute correctly on my first submission, however on a second submission my errors are displayed at the top of my form as I desire. It seems that whatever I change as far as errors go, are displayed only after a delay of 2 refreshes.

Check out the page Im working with (http://www.sumoftruth.com/map/map.php).  The form is under "Offer Shelter"

Any guidance to get me out of this quagmire will be appreciated.

答:
To resolve this question.  </p>

<p>As suggested by Shahaf,  I needed to move my session storage checking to the end of my script.  </p>

```<code>  if($error){
      //pass errors from php to session Storage to display on reload
          echo "<script type='text/javascript'>sessionStorage.setItem('error', '$error');</script>";
        //Here is a script to pass the sessionStorage error variable to javascript variable
          echo "<script>";
          echo   "var error = sessionStorage.getItem('error');";
        //if any errors stored in sessionStorage, place them in main div
          echo  "if(error){";
        //write the error message into the main div in offerShelterForm
          echo    "document.getElementById('formExplained').innerHTML = \"<div class='error'><p>\" + error + \"</p></div>\";";
          echo  "}";
          echo "</script>";
        //kill the rest of the php code
          die();
        }
</code>```

Body:
I am currently working with a form which takes user data and passes to to mySQL  on submission. It has an opening paragraph which I want to change on failed submission to display whatever errors apply. I want to pass my errors to the refreshed form on failure to show the user what went wrong.  Here is my Opening div.

Title Here

Content Here

On submission my script sets my $error variable to false, so form submission will can proceed when $errors == false. I checks for various errors in php and appends them one by one to $errors. At the end I

if($_POST['submit']){
  //variable to hold relavent error messages.  Set to false
          $error = false;
  //check each form field for errors
        if(!$title){
          $error .= $missingTitle;
        }else{
          $title = filter_var($title, FILTER_SANITIZE_STRING);
          $title = mysqli_real_escape_string($link, $title);
        }//Check for Grocoordinates
        if(!$lat || !$lng){
          $error .= $missingGeo;
        }//etc

Before I set up my mySQL query I do a check for errors and kill my code if they are present. Here I also pass my errors into sessionStorage, and echo a div containing my errors.

if($error){
          //pass errors from php to session Storage to display on reload
          echo "";
          echo "
$error;
";
          echo "
Here Is Proof that this is Executing
";
          die();
        }

The div containing errors and the paragraph both execute perfectly on page reload. They are displayed at the bottom of my map.

In a seperate piece of javascript which I run above all the php submission code, I pull the sessionStorage variable and attempt to change my innerHTML from my opening div to reflect the errors.

This code will not execute correctly on my first submission, however on a second submission my errors are displayed at the top of my form as I desire. It seems that whatever I change as far as errors go, are displayed only after a delay of 2 refreshes.

Check out the page Im working with (http://www.sumoftruth.com/map/map.php).  The form is under "Offer Shelter"

Any guidance to get me out of this quagmire will be appreciated.

Body:
To resolve this question.

As suggested by Shahaf,  I needed to move my session storage checking to the end of my script.

  if($error){
      //pass errors from php to session Storage to display on reload
          echo "<script type='text/javascript'>sessionStorage.setItem('error', '$error');</script>";
        //Here is a script to pass the sessionStorage error variable to javascript variable
          echo "<script>";
          echo   "var error = sessionStorage.getItem('error');";
        //if any errors stored in sessionStorage, place them in main div
          echo  "if(error){";
        //write the error message into the main div in offerShelterForm
          echo    "document.getElementById('formExplained').innerHTML = \"<div class='error'><p>\" + error + \"</p></div>\";";
          echo  "}";
          echo "</script>";
        //kill the rest of the php code
          die();
        }


问:
Android Fragment and RecyclerView , ViewHolder , Adapter
how to add a RecyclerView to a Fragment together with its Adapter and ViewHolder ?

答: The same way as you would for an activity. Create the adapter object and pass the necessary data to it's constructor and then pass this adapter object to the recyclerview with setAdapter(adapter).</p>


问:
How to request all permission needed when the time user install the app in Google Play?
I have an Android app,but when user click "Install" button,the app install directly and it didn't prompt up to ask for permission for user to accept directly.So,I need to request permission during runtime.

But what I need to do,when user click "Install" button,request all the permission needed before the app start downloading from Google Play just like the image below:

So far my manifest is look like this

```<code><uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</code>```

So what I need to add in order to achieve this?

答:
The runtime permissions was introduced since 5.0 Android.
The reason that most of users don't read permissions while installation.
So, all up-to-date API have to use runtime permissions.
Even default apps such as Google maps require runtime permissions.

https://developer.android.com/training/permissions/requesting.html

If you don't want to use runtime permissions you have to use old API version. but you have to check. Your app may crash.

Body:
I have an Android app,but when user click "Install" button,the app install directly and it didn't prompt up to ask for permission for user to accept directly.So,I need to request permission during runtime.

But what I need to do,when user click "Install" button,request all the permission needed before the app start downloading from Google Play just like the image below:

So far my manifest is look like this

<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

So what I need to add in order to achieve this?


答:
For devices with android < 6.0 permissions are request at installation.
For devices with android > 6.0 permissions are request at runtime.

So if you want your app compatible with devices below and above 6.0, you need to declare permission in your Manifest.xml and request permission at runtime too.

The official guide

Title: How to request all permission needed when the time user install the app in Google Play?


问:
iOS - Programmatically Set A UIContainerView's Embedded UIViewController
I have a UIViewController with a UIContainerView inside. Based on whether a certain condition is true, I'd like to programmatically set the container view's embedded view to a different UIViewController. I noticed that you can have only one embed segue to set one UIViewController, so is there a way to get this done?

I tried setting my container view as an outlet, but I could not find any methods that set an embedded UIViewController. Any advice on how to get started with this would be appreciated.

答:
Inspired by Vive's answer:</p>

```<code>extension UIViewController {

    func showContentController(_ controller: UIViewController, containerView: UIView? = nil) {
        controller.willMove(toParentViewController: self)
        self.addChildViewController(controller)
        controller.view.frame = (containerView ?? self.view).frame
        (containerView ?? self.view).addSubview(controller.view)
        controller.view.autoPinEdgesToSuperviewEdges()
        controller.didMove(toParentViewController: self)
    }

    func hideContentController(_ controller: UIViewController) {
        controller.willMove(toParentViewController: nil)
        controller.removeFromParentViewController()
        controller.view.removeFromSuperview()
        controller.didMove(toParentViewController: nil)
    }
}
</code>```

Body:
Inspired by Vive's answer:

extension UIViewController {

    func showContentController(_ controller: UIViewController, containerView: UIView? = nil) {
        controller.willMove(toParentViewController: self)
        self.addChildViewController(controller)
        controller.view.frame = (containerView ?? self.view).frame
        (containerView ?? self.view).addSubview(controller.view)
        controller.view.autoPinEdgesToSuperviewEdges()
        controller.didMove(toParentViewController: self)
    }

    func hideContentController(_ controller: UIViewController) {
        controller.willMove(toParentViewController: nil)
        controller.removeFromParentViewController()
        controller.view.removeFromSuperview()
        controller.didMove(toParentViewController: nil)
    }
}


问:
Unity : UI Elements out of Camera .. (all images & Code inside)
I finished my first simple 2D game finally .. but now i hit a wall .. i'm trying to adjust the game for multiple screens (Android ) . I build the game on 1080 x 1920 resolution.. And now to make it adapt with different screens resolutions i used this Code and its working for me ..

```<code>public class ControllingCameraAspectScript : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {
        // set the desired aspect ratio (the values in this example are
        // hard-coded for 16:9, but you could make them into public
        // variables instead so you can set them at design time)
        float targetaspect = 1080.0f / 1920.0f;

        // determine the game window's current aspect ratio
        float windowaspect = (float)Screen.width / (float)Screen.height;

        // current viewport height should be scaled by this amount
        float scaleheight = windowaspect / targetaspect;

        // obtain camera component so we can modify its viewport
        Camera camera = GetComponent<Camera>();

        // if scaled height is less than current height, add letterbox
        if (scaleheight < 1.0f)
        {
            Rect rect = camera.rect;

            rect.width = 1.0f;
            rect.height = scaleheight;
            rect.x = 0;
            rect.y = (1.0f - scaleheight) / 2.0f;

            camera.rect = rect;
        }
        else // add pillarbox
        {
            float scalewidth = 1.0f / scaleheight;

            Rect rect = camera.rect;

            rect.width = scalewidth;
            rect.height = 1.0f;
            rect.x = (1.0f - scalewidth) / 2.0f;
            rect.y = 0;

            camera.rect = rect;
        }
    }

}
</code>```

thank god the Game Objects in place .. but the UI Elements out of the Camera .. please look to the images ..

This is 1080 x 1920 .. my original work .

and this is on another device 1536 x 2048 ..

And i'm already using Canvas Scaler and Anchors with UI elements ..

答:
In Canvas Scaler component, you can set its UI Scale Mode to Scale With Screen Size.

more information

Body:
I finished my first simple 2D game finally .. but now i hit a wall .. i'm trying to adjust the game for multiple screens (Android ) . I build the game on 1080 x 1920 resolution.. And now to make it adapt with different screens resolutions i used this Code and its working for me ..

public class ControllingCameraAspectScript : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {
        // set the desired aspect ratio (the values in this example are
        // hard-coded for 16:9, but you could make them into public
        // variables instead so you can set them at design time)
        float targetaspect = 1080.0f / 1920.0f;

        // determine the game window's current aspect ratio
        float windowaspect = (float)Screen.width / (float)Screen.height;

        // current viewport height should be scaled by this amount
        float scaleheight = windowaspect / targetaspect;

        // obtain camera component so we can modify its viewport
        Camera camera = GetComponent<Camera>();

        // if scaled height is less than current height, add letterbox
        if (scaleheight < 1.0f)
        {
            Rect rect = camera.rect;

            rect.width = 1.0f;
            rect.height = scaleheight;
            rect.x = 0;
            rect.y = (1.0f - scaleheight) / 2.0f;

            camera.rect = rect;
        }
        else // add pillarbox
        {
            float scalewidth = 1.0f / scaleheight;

            Rect rect = camera.rect;

            rect.width = scalewidth;
            rect.height = 1.0f;
            rect.x = (1.0f - scalewidth) / 2.0f;
            rect.y = 0;

            camera.rect = rect;
        }
    }

}

thank god the Game Objects in place .. but the UI Elements out of the Camera .. please look to the images ..

This is 1080 x 1920 .. my original work .

and this is on another device 1536 x 2048 ..

And i'm already using Canvas Scaler and Anchors with UI elements ..


问:
Stereo ARSCNview to make VR and AR mix
I want to make a mix of virtual reality and augmented reality.
The goal is I have a stereo camera (for each eyes).

I tried to put two ARSCNView in a viewCotnroller but it seems ARKit enable only one ARWorldTrackingSessionConfiguration at the same time. How can I do that?

I researched to copy the graphic representation of a view to past this to an other view but impossible to find. Please help me to find the solution.

I found this link, maybe can it illumine us:
ARKit with multiple users

Here's a sample of my issue:

https://www.youtube.com/watch?v=d6LOqNnYm5s

PS: before unlike my post, comment why!

答:
The following code is basically what Hal said. I previously wrote a few lines on github that might be able to help you get started. (Simple code, no barrel distortion, no adjustment for the narrow FOV - yet).

Essentially, we connect the same scene to the second ARSCNView (so both ARSCNViews are seeing the same scene). No need to get ARWorldTrackingSessionConfiguration working with 2 ARSCNViews. Then, we offset its pointOfView so it's positioned as the 2nd eye.

https://github.com/hanleyweng/iOS-Stereoscopic-ARKit-Template

ContentLicense: CC BY-SA 4.0

Title: Stereo ARSCNview to make VR and AR mix


问:
Concatenate Sparse Vectors in Spark?
Say you have two Sparse Vectors.  As an example:

```<code>val vec1 = Vectors.sparse(2, List(0), List(1)) // [1, 0]
val vec2 = Vectors.sparse(2, List(1), List(1)) // [0, 1]
</code>```

I want to concatenate these two vectors so that the result is equivalent to:

```<code>val vec3 = Vectors.sparse(4, List(0, 2), List(1, 1)) // [1, 0, 0, 1]
</code>```

Does Spark have any such convenience method to do this?

Title: Concatenate Sparse Vectors in Spark?

Body:
Say you have two Sparse Vectors.  As an example:

val vec1 = Vectors.sparse(2, List(0), List(1)) // [1, 0]
val vec2 = Vectors.sparse(2, List(1), List(1)) // [0, 1]

I want to concatenate these two vectors so that the result is equivalent to:

val vec3 = Vectors.sparse(4, List(0, 2), List(1, 1)) // [1, 0, 0, 1]

Does Spark have any such convenience method to do this?

Body:
If you have the data in a DataFrame, then VectorAssembler would be the right thing to use. For example:

from pyspark.ml.feature import VectorAssembler

dataset = spark.createDataFrame(
    [(0, Vectors.sparse(10, {0: 0.6931, 5: 0.0, 7: 0.5754, 9: 0.2877}), Vectors.sparse(10, {3: 0.2877, 4: 0.6931, 5: 0.0, 6: 0.6931, 8: 0.6931}))],
["label", "userFeatures1", "userFeatures2"])

assembler = VectorAssembler(
    inputCols=["userFeatures1", "userFeatures2"],
    outputCol="features")

output = assembler.transform(dataset)
output.select("features", "label").show(truncate=False)

You would get the following output for this:

+---------------------------------------------------------------------------+-----+
|features                                                                   |label|
+---------------------------------------------------------------------------+-----+
|(20,[0,7,9,13,14,16,18],    [0.6931,0.5754,0.2877,0.2877,0.6931,0.6931,0.6931])|0|
+---------------------------------------------------------------------------+-----+


问:
How can I get the active screen dimensions?
What I am looking for is the equivalent of System.Windows.SystemParameters.WorkArea for the monitor that the window is currently on.

Clarification:  The window in question is WPF, not WinForm.

答:
in C# winforms I have got start point (for case when we have several monitor/diplay and one form is calling another one) with help of the following method:</p>

```<code>private Point get_start_point()
    {
        return
            new Point(Screen.GetBounds(parent_class_with_form.ActiveForm).X,
                      Screen.GetBounds(parent_class_with_form.ActiveForm).Y
                      );
    }
</code>```

OwnerDisplayName: chilltemp

LastEditorDisplayName: chilltemp

Body:
in C# winforms I have got start point (for case when we have several monitor/diplay and one form is calling another one) with help of the following method:

private Point get_start_point()
    {
        return
            new Point(Screen.GetBounds(parent_class_with_form.ActiveForm).X,
                      Screen.GetBounds(parent_class_with_form.ActiveForm).Y
                      );
    }


问:
Disable click propagation for href
This code snippet explains my case:

$("#b").click(function(e) {
  e.stopPropagation();
});

$("#b").click(function() {
  alert("trigger div");
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>a {
  display: block;
  position: relative;
  width: 100px;
  height: 100px;
  background-color: gray;
}

div {
  position: absolute;
  width: 50px;
  height: 50px;
  top: 0;
  left: 0;
  background-color: red;
}</code>```

Test

```

The problem is that I only want to trigger the click function from the div and not the href from the a tag. In a similar question I found event.stopPropagation(), but that does not work in this case.

答:
You need to prevent the default click event action using event.preventDefault() method.

$("#b").click(function(e) {
  e.preventDefault();
  alert("trigger div");
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>a {
  display: block;
  position: relative;
  width: 100px;
  height: 100px;
  background-color: gray;
}

div {
  position: absolute;
  width: 50px;
  height: 50px;
  top: 0;
  left: 0;
  background-color: red;
}</code>```

Test

```

Title: Disable click propagation for href

Body:
This code snippet explains my case:

$("#b").click(function(e) {
  e.stopPropagation();
});

$("#b").click(function() {
  alert("trigger div");
});

a {
  display: block;
  position: relative;
  width: 100px;
  height: 100px;
  background-color: gray;
}

div {
  position: absolute;
  width: 50px;
  height: 50px;
  top: 0;
  left: 0;
  background-color: red;
}

Test

The problem is that I only want to trigger the click function from the div and not the href from the a tag. In a similar question I found event.stopPropagation(), but that does not work in this case.

Body:
You need to prevent the default click event action using event.preventDefault() method.

$("#b").click(function(e) {
  e.preventDefault();
  alert("trigger div");
});

a {
  display: block;
  position: relative;
  width: 100px;
  height: 100px;
  background-color: gray;
}

div {
  position: absolute;
  width: 50px;
  height: 50px;
  top: 0;
  left: 0;
  background-color: red;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<a href="stackoverflow.com" id="a">
  <div id="b">Test</div>
</a>


问:
html/php forms with survey database
I hope someone can help me! I try to make a form with input from mysql. I want a statement to come from a database. Following this I want a user to be able to give a value 1-7(strongly disagree - strongly agree). I want the number of questions be based on my MySQL query. The main reason for this is that I can reuse the code for different types of surveys.

The problem is: I can't get the questions into a single form with separated values, linked to the question. I'm guessing it has something to do with the name= part. I think the name should be related to the database query somehow but I can't find out what the solution is.

If someone could help me I would be very thankful. Also if someone knows a good book or online course/video explaining how to make a online survey tool it would be very helpful.

This is what I have so far:

```<code>    <?php
    echo '<form action="results.php" method="post">';
    global $connection;

    $sql = "SELECT * FROM questions";
    $result = mysqli_query($connection, $sql);

    if (mysqli_num_rows($result) > 0) {
        // output data of each row

        while($row = mysqli_fetch_assoc($result)) {
        echo $row["question"];
        echo "<br>";
        echo '  <input type="radio" name="likkert" value=1>
                <input type="radio" name="likkert" value=2>
                <input type="radio" name="likkert" value=3>
                <input type="radio" name="likkert" value=4>
                <input type="radio" name="likkert" value=5>
                <input type="radio" name="likkert" value=6>
                <input type="radio" name="likkert" value=7>
                <br>';
        }
    } else {
        echo "0 results";
    }
    echo '<input type="submit"></form>';
    ?>
</code>```

答:
Assuming the fact that you have an id column, associated with each question, in questions table, you have to include this id column value (which should be unique) with each question's rating options, like this:

```<code>// your code
if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo $row["question"];
        echo "<br />";
        ?>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=1>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=2>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=3>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=4>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=5>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=6>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=7>
        <br />
        <?php
    }
} else {
    echo "0 results";
}
// your code
</code>```

And after form submission, process the questions and their corresponding ratings like this:

```<code>foreach($_POST['likkert'] as $questionId => $rating){
    // your code
}
</code>```

Title: html/php forms with survey database

Body:
I hope someone can help me! I try to make a form with input from mysql. I want a statement to come from a database. Following this I want a user to be able to give a value 1-7(strongly disagree - strongly agree). I want the number of questions be based on my MySQL query. The main reason for this is that I can reuse the code for different types of surveys.

The problem is: I can't get the questions into a single form with separated values, linked to the question. I'm guessing it has something to do with the name= part. I think the name should be related to the database query somehow but I can't find out what the solution is.

If someone could help me I would be very thankful. Also if someone knows a good book or online course/video explaining how to make a online survey tool it would be very helpful.

This is what I have so far:

    <?php
    echo '<form action="results.php" method="post">';
    global $connection;

    $sql = "SELECT * FROM questions";
    $result = mysqli_query($connection, $sql);

    if (mysqli_num_rows($result) > 0) {
        // output data of each row

        while($row = mysqli_fetch_assoc($result)) {
        echo $row["question"];
        echo "
";
        echo '  <input type="radio" name="likkert" value=1>
                <input type="radio" name="likkert" value=2>
                <input type="radio" name="likkert" value=3>
                <input type="radio" name="likkert" value=4>
                <input type="radio" name="likkert" value=5>
                <input type="radio" name="likkert" value=6>
                <input type="radio" name="likkert" value=7>

';
        }
    } else {
        echo "0 results";
    }
    echo '<input type="submit"></form>';
    ?>

Body:
Assuming the fact that you have an id column, associated with each question, in questions table, you have to include this id column value (which should be unique) with each question's rating options, like this:

// your code
if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo $row["question"];
        echo "<br />";
        ?>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=1>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=2>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=3>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=4>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=5>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=6>
        <input type="radio" name="likkert[<?php echo $row["id"]; ?>]" value=7>
        <br />
        <?php
    }
} else {
    echo "0 results";
}
// your code

And after form submission, process the questions and their corresponding ratings like this:

foreach($_POST['likkert'] as $questionId => $rating){
    // your code
}


问:
Using multiple speech to text APIs to improve accuracy
Has anyone ever tried to transcribe audio using two or more speech to text APIs? You could match up the words using time stamps, and pick the word with the highest confidence. If anyone has done this, did it significantly improve the accuracy of the transcription? Is it worth it?</p>

答:
This is a standard practice for many speech competitions when you do not care about speed of decoding but you need a good accuracy. System combination usually gives you a significant improvements, about 10% more, so it is often beneficial

You do not need timestamps to combine hypothesis properly, you can just compare the outputs statistically. For reference on the subject read

A PAIRED TEST FOR RECOGNIZER SELECTION WITH UNTRANSCRIBED DATA
Bhiksha Raj, Rita Singh and James Baker

iCNC and iROVER:The Limits of Improving System Combination with Classiﬁcation?
Bjorn Hoffmeister, Ralf Schluter, and Hermann Ney

See the implementation of ROVER in SCTK.


问:
How to run a method from a class of another package in java
I am new to java ! I am sorry if the question is dumb ! Package is like this

myapp (folder)

print (folder)

printer.java

main.java

manifest.txt

So myapp is a package that contains another package (subpackage) print.

Code in main.java

```<code>package myapp;
import myapp.print;
class app{
    public static void main(String[] args) {
        printer po = new printer();
        po.printthis("Worked");
    }
}
</code>```

Code in printer.java

```<code>package myapp.print;
public class printer{
    public void printthis(String text){
        System.out.println(text);
    }
}
</code>```

Now I cannot make it to run , the error says what is printer word in main.java.
What I do is first compile the printer.java and then compile main.java but while compiling main.java the error comes up and it cannot be compiled.I am using CLI, Please help.

答:
You have to use the code like this

```<code>import myapp.print.printer;
</code>```

in your main.java class. Or you can import all files from print package like this:

```<code>import myapp.print.*;
</code>```

I also recommend you to read about Java Code Conventions.

Body:
I am new to java ! I am sorry if the question is dumb ! Package is like this

myapp (folder)

print (folder)

printer.java

main.java

manifest.txt

So myapp is a package that contains another package (subpackage) print.

Code in main.java

package myapp;
import myapp.print;
class app{
    public static void main(String[] args) {
        printer po = new printer();
        po.printthis("Worked");
    }
}

Code in printer.java

package myapp.print;
public class printer{
    public void printthis(String text){
        System.out.println(text);
    }
}

Now I cannot make it to run , the error says what is printer word in main.java.
What I do is first compile the printer.java and then compile main.java but while compiling main.java the error comes up and it cannot be compiled.I am using CLI, Please help.

Body:
You have to use the code like this

import myapp.print.printer;

in your main.java class. Or you can import all files from print package like this:

import myapp.print.*;

I also recommend you to read about Java Code Conventions.


问:
Windows Identity Framework on ASP.NET MVC - how to authorize user per action basis?
Windows Identity Framework on ASP.NET MVC - how to authorize user per action basis?

Like:

```<code>    [Authorize]
    public ActionResult About()
    {
        return View();
    }
</code>```

Instead of the whole site level security as is the default WIF site integration behaviour?

UPDATE:
Maybe should the question goes like, how to allow anonymous users to access the site too?

答:
You are able to configure site authentication model in Web.config

http://msdn.microsoft.com/en-us/library/aa291347(v=vs.71).aspx

Body:
Windows Identity Framework on ASP.NET MVC - how to authorize user per action basis?

Like:

    [Authorize]
    public ActionResult About()
    {
        return View();
    }

Instead of the whole site level security as is the default WIF site integration behaviour?

UPDATE:
Maybe should the question goes like, how to allow anonymous users to access the site too?


问:
Getting path of an R script
Is there a way to programmatically find the path of an R script inside the script itself?

I am asking this because I have several scripts that use RGtk2 and load a GUI from a .glade file.

In these scripts I am obliged to put a setwd("path/to/the/script") instruction at the beginning, otherwise the .glade file (which is in the same directory) will not be found.

This is fine, but if I move the script in a different directory or to another computer I have to change the path. I know, it's not a big deal, but it would be nice to have something like:

setwd(getScriptPath())

So, does a similar function exist?

答:
How about using system and shell commands? With the windows one, I think when you open the script in RStudio it sets the current shell directory to the directory of the script. You might have to add cd C:\ e.g  or whatever drive you want to search  (e.g. shell('dir C:\\*file_name /s', intern = TRUE) - \\ to escape escape character). Will only work for uniquely named files unless you further specify subdirectories (for Linux I started searching from /). In any case, if you know how to find something in the shell, this provides a layout to find it within R and return the directory. Should work whether you are sourcing or running the script but I haven't fully explored the potential bugs.</p>

```<code>#Get operating system
OS<-Sys.info()
win<-length(grep("Windows",OS))
lin<-length(grep("Linux",OS))

#Find path of data directory
#Linux Bash Commands
if(lin==1){
  file_path<-system("find / -name 'file_name'", intern = TRUE)
  data_directory<-gsub('/file_name',"",file_path)
}
#Windows Command Prompt Commands
if(win==1){
  file_path<-shell('dir file_name /s', intern = TRUE)
  file_path<-file_path[4]
  file_path<-gsub(" Directory of ","",file_path)
  filepath<-gsub("\\\\","/",file_path)
  data_directory<-file_path
}

#Change working directory to location of data and sources
setwd(data_directory)
</code>```

Title: Getting path of an R script

Body:
How about using system and shell commands? With the windows one, I think when you open the script in RStudio it sets the current shell directory to the directory of the script. You might have to add cd C:\ e.g  or whatever drive you want to search  (e.g. shell('dir C:\\*file_name /s', intern = TRUE) - \\ to escape escape character). Will only work for uniquely named files unless you further specify subdirectories (for Linux I started searching from /). In any case, if you know how to find something in the shell, this provides a layout to find it within R and return the directory. Should work whether you are sourcing or running the script but I haven't fully explored the potential bugs.

#Get operating system
OS<-Sys.info()
win<-length(grep("Windows",OS))
lin<-length(grep("Linux",OS))

#Find path of data directory
#Linux Bash Commands
if(lin==1){
  file_path<-system("find / -name 'file_name'", intern = TRUE)
  data_directory<-gsub('/file_name',"",file_path)
}
#Windows Command Prompt Commands
if(win==1){
  file_path<-shell('dir file_name /s', intern = TRUE)
  file_path<-file_path[4]
  file_path<-gsub(" Directory of ","",file_path)
  filepath<-gsub("\\\\","/",file_path)
  data_directory<-file_path
}

#Change working directory to location of data and sources
setwd(data_directory)


问:
how to make border-right's height according to vertical-middle
i'm an Asian person. I'm sorry because i'm not good at English writing and grammar.

I am designing a bulletin board's view page using HTML, JSP, CSS, and I'm implementing it using  tag.

I want to implement distinguished right line between  and  tag,  a written information such as writer, viewed number, title, etc,.   like bottom image.the line looks like applied vertical-middle line of height value.
I want to implement this using CSS Attribute related border-right.

How can I design this using CSS ? pls T.T;;

please refer to the bottom exam's image that i want to make.

Regards,

答:
Please see if this is what you need

.overview { border-top: medium solid darkgray; }
.row {
  width: 100%;
  padding: 0.2em 0;
  border-bottom: thin solid darkgray;
}

span {
  display: inline-block;
  min-width: 6em;
  padding: 0 1em;
}

.h6 {
  font-weight: 600;
  text-align: center;
}

.b-r {
  border-right: thin solid darkgray;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="overview">
  <div class="row">
    <span class="h6 b-r">title</span>
    <span>today's calendar</span>
  </div>
  <div class="row">
    <span class="h6 b-r">writer</span>
    <span class="b-r">administrator</span>
    <span class="h6 b-r">date</span>
    <span class="b-r">2017-06-15</span>
  </div>
  <div class="row">
    <span class="h6 b-r">appended file</span>
    <span>TimeTable.pdf</span>
  </div>
</div></code>```

Body:
Please see if this is what you need

.overview { border-top: medium solid darkgray; }
.row {
  width: 100%;
  padding: 0.2em 0;
  border-bottom: thin solid darkgray;
}

span {
  display: inline-block;
  min-width: 6em;
  padding: 0 1em;
}

.h6 {
  font-weight: 600;
  text-align: center;
}

.b-r {
  border-right: thin solid darkgray;
}

<div class="overview">
  <div class="row">
    <span class="h6 b-r">title</span>
    <span>today's calendar</span>
  </div>
  <div class="row">
    <span class="h6 b-r">writer</span>
    <span class="b-r">administrator</span>
    <span class="h6 b-r">date</span>
    <span class="b-r">2017-06-15</span>
  </div>
  <div class="row">
    <span class="h6 b-r">appended file</span>
    <span>TimeTable.pdf</span>
  </div>
</div>


答:
This is not a valid statement:

```<code>import myapp.print;
</code>```

You need to import either the specific class or the whole package with the .* wildcard:

```<code>import myapp.print.printer; // just imports the printer class
import myapp.print.*;       // imports everything under the myapp.print package
</code>```

Title: How to run a method from a class of another package in java

Body:
This is not a valid statement:

import myapp.print;

You need to import either the specific class or the whole package with the .* wildcard:

import myapp.print.printer; // just imports the printer class
import myapp.print.*;       // imports everything under the myapp.print package


问:
Android Multiple Screen
i have a problem with multiple screen in android.

after i read this web pages :

https://developer.android.com/guide/practices/screens_support.html
developer.android.com/training/multiscreen/screensizes.html

i tried to change my activity to a multiple screen layout with adding the smallest screen width layout directories :

layout-sw320dp

layout-sw320dp-land

layout-sw480dp

layout-sw480dp-land

layout-sw600dp

layout-sw600dp-land

layout-sw720dp

layout-sw720dp-land

my activity :

activity_main.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/activity_main"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/background"
          tools:context="com.example.aref.calculator.MainActivity"
          android:orientation="vertical">

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

    <EditText
        android:id="@+id/etInput"
        android:layout_height="163dp"
        android:background="@android:color/transparent"
        android:cursorVisible="false"
        android:gravity="end|center"
        android:hint="@string/zero"
        android:inputType="numberSigned"
        android:padding="16dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:textColor="@android:color/black"
        android:textColorHint="@android:color/darker_gray"
        android:textCursorDrawable="@null"
        android:textSize="50sp"
        android:layout_width="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="2dp"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMc"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:background="@drawable/btn_selector"
                android:text="@string/mc" />

            <Button
                android:id="@+id/btnMemory"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector"
                android:text="@string/nullMemory" />

            <Button
                android:id="@+id/btnSeven"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/seven" />

            <Button
                android:id="@+id/btnFour"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/four" />

            <Button
                android:id="@+id/btnOne"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/one" />

            <Button
                android:id="@+id/btnZero"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/zero" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMPlus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mPlus" />

            <Button
                android:id="@+id/btnClear"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/clear" />

            <Button
                android:id="@+id/btnEight"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/eight" />

            <Button
                android:id="@+id/btnFive"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/five" />

            <Button
                android:id="@+id/btnTwo"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/two" />

            <Button
                android:id="@+id/btnPoint"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/point" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMMinus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mMinus" />

            <Button
                android:id="@+id/btnAllClear"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/AllClear" />

            <Button
                android:id="@+id/btnNine"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/nine" />

            <Button
                android:id="@+id/btnSix"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/six" />

            <Button
                android:id="@+id/btnThree"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/three" />

            <Button
                android:id="@+id/btnEqual"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/equal" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMr"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mr" />

            <Button
                android:id="@+id/btnMod"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/mod" />

            <Button
                android:id="@+id/btnDiv"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/div" />

            <Button
                android:id="@+id/btnMul"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/mul" />

            <Button
                android:id="@+id/btnPlus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/plus" />

            <Button
                android:id="@+id/btnMin"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/minus" />

        </LinearLayout>

    </LinearLayout>

</LinearLayout>
</code>```

for example my problem is in "layout-sw320dp" i design the layout for the nexus 5x when i change device for example to nexus 4 or nexus s layout becomes unfit

I M A G E :
http://s8.picofile.com/file/8299930926/564684.png

答: You create Linear layout and use weightsum .so you can use in multiple screen</p>

Title: Android Multiple Screen

Body:
i have a problem with multiple screen in android.

after i read this web pages :

https://developer.android.com/guide/practices/screens_support.html
developer.android.com/training/multiscreen/screensizes.html

i tried to change my activity to a multiple screen layout with adding the smallest screen width layout directories :

layout-sw320dp

layout-sw320dp-land

layout-sw480dp

layout-sw480dp-land

layout-sw600dp

layout-sw600dp-land

layout-sw720dp

layout-sw720dp-land

my activity :

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/activity_main"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/background"
          tools:context="com.example.aref.calculator.MainActivity"
          android:orientation="vertical">

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

    <EditText
        android:id="@+id/etInput"
        android:layout_height="163dp"
        android:background="@android:color/transparent"
        android:cursorVisible="false"
        android:gravity="end|center"
        android:hint="@string/zero"
        android:inputType="numberSigned"
        android:padding="16dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:textColor="@android:color/black"
        android:textColorHint="@android:color/darker_gray"
        android:textCursorDrawable="@null"
        android:textSize="50sp"
        android:layout_width="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="2dp"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMc"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:background="@drawable/btn_selector"
                android:text="@string/mc" />

            <Button
                android:id="@+id/btnMemory"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector"
                android:text="@string/nullMemory" />

            <Button
                android:id="@+id/btnSeven"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/seven" />

            <Button
                android:id="@+id/btnFour"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/four" />

            <Button
                android:id="@+id/btnOne"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/one" />

            <Button
                android:id="@+id/btnZero"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/zero" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMPlus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mPlus" />

            <Button
                android:id="@+id/btnClear"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/clear" />

            <Button
                android:id="@+id/btnEight"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/eight" />

            <Button
                android:id="@+id/btnFive"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/five" />

            <Button
                android:id="@+id/btnTwo"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/two" />

            <Button
                android:id="@+id/btnPoint"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/point" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMMinus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mMinus" />

            <Button
                android:id="@+id/btnAllClear"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/AllClear" />

            <Button
                android:id="@+id/btnNine"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/nine" />

            <Button
                android:id="@+id/btnSix"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/six" />

            <Button
                android:id="@+id/btnThree"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector2"
                android:text="@string/three" />

            <Button
                android:id="@+id/btnEqual"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector1"
                android:text="@string/equal" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btnMr"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:background="@drawable/btn_selector"
                android:text="@string/mr" />

            <Button
                android:id="@+id/btnMod"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/mod" />

            <Button
                android:id="@+id/btnDiv"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/div" />

            <Button
                android:id="@+id/btnMul"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/mul" />

            <Button
                android:id="@+id/btnPlus"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/plus" />

            <Button
                android:id="@+id/btnMin"
                android:layout_width="@dimen/btn_width_small"
                android:layout_height="@dimen/btn_height_small"
                android:layout_marginLeft="@dimen/btn_marginLeft_marginStart"
                android:layout_marginStart="@dimen/btn_marginLeft_marginStart"
                android:layout_marginTop="@dimen/btn_margin_top"
                android:background="@drawable/btn_selector3"
                android:text="@string/minus" />

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

for example my problem is in "layout-sw320dp" i design the layout for the nexus 5x when i change device for example to nexus 4 or nexus s layout becomes unfit

I M A G E :
http://s8.picofile.com/file/8299930926/564684.png


问:
titanium backup - Stuck on seaching application data
I saved a backup with titanium, installed a different rom (clean install) and then now I am ready to restore my backup. The problem is:

When I open Titanium, it's stuck at "Searching Application Data" message and it won't let me do anything.

I already tried:

uninstall and reinstall Titanium

tried with a older version

tried removing SU permission (no message but I can't do anything)

tried typing in the terminal as suggested on XDA developers the following

```<code>su
restorecon -FR /data/media/0
</code>```

with no luck

I don't know what else to try. My backup folder has stuff in it, I just need to be able to launch the app...

Any idea? Sorry I can't be more precise but I don't really know any more details than that, apart that I am on android 7.1.1.

thanks

答: I fix this issue by manually moving the back up files (needed only) to another folder (will be set as back up location in the preference).. i guess some back up file cause the issue</p>

Body:
I saved a backup with titanium, installed a different rom (clean install) and then now I am ready to restore my backup. The problem is:

When I open Titanium, it's stuck at "Searching Application Data" message and it won't let me do anything.

I already tried:

uninstall and reinstall Titanium

tried with a older version

tried removing SU permission (no message but I can't do anything)

tried typing in the terminal as suggested on XDA developers the following

su
restorecon -FR /data/media/0

with no luck

I don't know what else to try. My backup folder has stuff in it, I just need to be able to launch the app...

Any idea? Sorry I can't be more precise but I don't really know any more details than that, apart that I am on android 7.1.1.

thanks


问:
Apache Solr Unable to Store Nested JSON data
i am trying to load the following data into an existing SOLR(6.6) core using the document upload section

```<code>   {
    "id": "1234",
    "nationality":"India",
    "phonenumber":"232323",
    "personname":"babu rao",
    "paid":"credi card",
    "status":"success",
    "access" :[
      {"port":"port1","gate":"Gate1"}
    ],
    "approved_by":[
      {"name":"appr1","date":"2006-11-30"},
      {"name":"appr2","date":"2006-11-30"}
    ]
  }
</code>```

My Schema for this item is

```<code> <field name="created_date" type="tdate" indexed="true" stored="true" />
 <field name="passType" type="string" indexed="true" stored="true" />
 <field name="duration" type="int" indexed="true" stored="true" />
 <field name="nationality" type="string" indexed="true" stored="true" />
 <field name="phonenumber" type="string" indexed="true" stored="true" />
 <field name="personname" type="string" indexed="true" stored="true" />
 <field name="paid" type="string" indexed="true" stored="true" />
 <field name="passamount" type="float" indexed="true" stored="true" />
 <field name="status" type="string" indexed="true" stored="true" />
 <field name="approved_by" type="string" indexed="true" stored="true" multiValued="true"/>
 <field name="approved_by.name" type="string" indexed="true" stored="true" />
 <field name="approved_by.date" type="tdate" indexed="true" stored="true" />
 <field name="access" type="string" indexed="true" stored="true" multiValued="true"/>
 <field name="access.port" type="string" indexed="true" stored="true" />
 <field name="access.gate" type="string" indexed="true" stored="true" />
</code>```

I get the following error

```<code>Error parsing JSON field value. Unexpected OBJECT_START at [177],
field=access
</code>```

Request your help to resolve it.

答:
_childDocuments_ key need to indicate the nested documents in JSON. I have updated the document now it will be Indexed.

```<code>{
    "id": "1234",
    "nationality":"India",
    "phonenumber":"232323",
    "personname":"babu rao",
    "paid":"credi card",
    "status":"success",
    "_childDocuments_" :[
      {"id":456,"port":"port1","gate":"Gate1"},
      {"id":786,"name":"appr1","date":"2006-11-30"},
      {"id":232,"name":"appr2","date":"2006-11-30"}
    ]
  }
</code>```

Also You need to change the schema.xml.

[Schema.xml]

```<code><field name="created_date" type="tdate" indexed="true" stored="true" />
 <field name="passType" type="string" indexed="true" stored="true" />
 <field name="duration" type="int" indexed="true" stored="true" />
 <field name="nationality" type="string" indexed="true" stored="true" />
 <field name="phonenumber" type="string" indexed="true" stored="true" />
 <field name="personname" type="string" indexed="true" stored="true" />
 <field name="paid" type="string" indexed="true" stored="true" />
 <field name="passamount" type="float" indexed="true" stored="true" />
 <field name="status" type="string" indexed="true" stored="true" />
 <field name="name" type="string" indexed="true" stored="true" />
 <field name="date" type="tdate" indexed="true" stored="true" />
 <field name="port" type="string" indexed="true" stored="true" />
 <field name="gate" type="string" indexed="true" stored="true" />
</code>```

For More Information you can check this article by Yonik :-
http://yonik.com/solr-nested-objects/

Body:
i am trying to load the following data into an existing SOLR(6.6) core using the document upload section

   {
    "id": "1234",
    "nationality":"India",
    "phonenumber":"232323",
    "personname":"babu rao",
    "paid":"credi card",
    "status":"success",
    "access" :[
      {"port":"port1","gate":"Gate1"}
    ],
    "approved_by":[
      {"name":"appr1","date":"2006-11-30"},
      {"name":"appr2","date":"2006-11-30"}
    ]
  }

My Schema for this item is

 <field name="created_date" type="tdate" indexed="true" stored="true" />
 <field name="passType" type="string" indexed="true" stored="true" />
 <field name="duration" type="int" indexed="true" stored="true" />
 <field name="nationality" type="string" indexed="true" stored="true" />
 <field name="phonenumber" type="string" indexed="true" stored="true" />
 <field name="personname" type="string" indexed="true" stored="true" />
 <field name="paid" type="string" indexed="true" stored="true" />
 <field name="passamount" type="float" indexed="true" stored="true" />
 <field name="status" type="string" indexed="true" stored="true" />
 <field name="approved_by" type="string" indexed="true" stored="true" multiValued="true"/>
 <field name="approved_by.name" type="string" indexed="true" stored="true" />
 <field name="approved_by.date" type="tdate" indexed="true" stored="true" />
 <field name="access" type="string" indexed="true" stored="true" multiValued="true"/>
 <field name="access.port" type="string" indexed="true" stored="true" />
 <field name="access.gate" type="string" indexed="true" stored="true" />

I get the following error

Error parsing JSON field value. Unexpected OBJECT_START at [177],
field=access

Request your help to resolve it.

Body:
_childDocuments_ key need to indicate the nested documents in JSON. I have updated the document now it will be Indexed.

{
    "id": "1234",
    "nationality":"India",
    "phonenumber":"232323",
    "personname":"babu rao",
    "paid":"credi card",
    "status":"success",
    "_childDocuments_" :[
      {"id":456,"port":"port1","gate":"Gate1"},
      {"id":786,"name":"appr1","date":"2006-11-30"},
      {"id":232,"name":"appr2","date":"2006-11-30"}
    ]
  }

Also You need to change the schema.xml.

[Schema.xml]

<field name="created_date" type="tdate" indexed="true" stored="true" />
 <field name="passType" type="string" indexed="true" stored="true" />
 <field name="duration" type="int" indexed="true" stored="true" />
 <field name="nationality" type="string" indexed="true" stored="true" />
 <field name="phonenumber" type="string" indexed="true" stored="true" />
 <field name="personname" type="string" indexed="true" stored="true" />
 <field name="paid" type="string" indexed="true" stored="true" />
 <field name="passamount" type="float" indexed="true" stored="true" />
 <field name="status" type="string" indexed="true" stored="true" />
 <field name="name" type="string" indexed="true" stored="true" />
 <field name="date" type="tdate" indexed="true" stored="true" />
 <field name="port" type="string" indexed="true" stored="true" />
 <field name="gate" type="string" indexed="true" stored="true" />

For More Information you can check this article by Yonik :-
http://yonik.com/solr-nested-objects/


问:
I'm Unable to set value of textbox using php variable
I'm trying to set value of html input type text textboxes to empty when user clicks Search button and empID is not matched, but its giving error:

mysqli_num_rows() expects parameter 1 to be mysqli_result

Here is code:

```<code><html>
<body>
<form action="" method="post">
<h2>Employee Form</h2>

<input type="text" name="empID">
<input type="submit" name="searchRec" value="Search" />
<hr>

  Employee ID: <input type="text" name="empIDC" value="<?php echo htmlentities($employeeID); ?>">
  <br><br>

  Name: <input type="text" name="name" value="<?php echo htmlentities($Name); ?>">
  <br><br>

  Address: <input type="text" name="address" value="<?php echo htmlentities($Address); ?>">
  <br><br>
</form>
<?php
if( isset( $_REQUEST['searchRec'] ))
{
$employeeID = ($_POST["empID"]);

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "bc140_DB";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT empID, Name, Address, Dateofbirth, Salary, Timein from Employee where empID == $employeeID";
$result = mysqli_query($conn, $sql);

if(mysqli_num_rows($result > 0)){   while($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {   $employeeID = $row['empID'];   $Name = $row['Name'];   $Address = $row['Address'];   $Dateofbirth = $row['Dateofbirth'];   $Salary = $row['Salary'];   $timestamp = $row['timeIn']; } }else{     $employeeID = "";   $Name = ""; $Address = "";   $Dateofbirth = "";   $Salary = "";   $timestamp = ""; }

}
?>
</body>
</html>
</code>```

答: you have forgotten ';'   value="<?php echo htmlentities($employeeID); ?>"

Body:
I'm trying to set value of html input type text textboxes to empty when user clicks Search button and empID is not matched, but its giving error:

mysqli_num_rows() expects parameter 1 to be mysqli_result

Here is code:

<form action="" method="post">

Employee Form

<input type="text" name="empID">
<input type="submit" name="searchRec" value="Search" />

  Employee ID: <input type="text" name="empIDC" value="<?php echo htmlentities($employeeID); ?>">

  Name: <input type="text" name="name" value="<?php echo htmlentities($Name); ?>">

  Address: <input type="text" name="address" value="<?php echo htmlentities($Address); ?>">

</form>
<?php
if( isset( $_REQUEST['searchRec'] ))
{
$employeeID = ($_POST["empID"]);

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "bc140_DB";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT empID, Name, Address, Dateofbirth, Salary, Timein from Employee where empID == $employeeID";
$result = mysqli_query($conn, $sql);

if(mysqli_num_rows($result > 0)){   while($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {   $employeeID = $row['empID'];   $Name = $row['Name'];   $Address = $row['Address'];   $Dateofbirth = $row['Dateofbirth'];   $Salary = $row['Salary'];   $timestamp = $row['timeIn']; } }else{     $employeeID = "";   $Name = ""; $Address = "";   $Dateofbirth = "";   $Salary = "";   $timestamp = ""; }

}
?>


问:
Bootstrap 4: Vertical align image in a circle button
I have a circle button that needs to have a plus image in the center of it. The thing is, I can't seem to vertical align that image without resorting to messing with margins.

Is there an easier, Bootstrap-y way of doing this?

Here's my code:

.btn-circle {
  background-color: blue;
  height: 60px;
  width: 60px;
  border-radius: 50%;
}

/* the button is supposed to be a circle, but for some reason it's not showing up like that in this snippet */```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<img src="https://res.cloudinary.com/dt9b7pad3/image/upload/v1499509391/58a2031e6af142ce619ba2a2_plus-symbol_y6vqca.svg" height="20"></code>```

答:
Is this what you're trying to achieve? I vertically centered the  containing the  with

```<code>position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%)
</code>```

Bootstrap's border-radius seemed to override yours, so I added !important to it.

.btn-circle {
  background-color: blue;
  height: 60px;
  width: 60px;
  border-radius: 50% !important;
}
.btn-circle a{
  display: block;
  width: 20px;
  height: 20px;
  position: relative;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}
.btn-circle img{
  width: 100%;
  height: 100%;
}

/* the button is supposed to be a circle, but for some reason it's not showing up like that in this snippet */```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<img src="https://res.cloudinary.com/dt9b7pad3/image/upload/v1499509391/58a2031e6af142ce619ba2a2_plus-symbol_y6vqca.svg"></code>```

Body:
I have a circle button that needs to have a plus image in the center of it. The thing is, I can't seem to vertical align that image without resorting to messing with margins.

Is there an easier, Bootstrap-y way of doing this?

Here's my code:

.btn-circle {
  background-color: blue;
  height: 60px;
  width: 60px;
  border-radius: 50%;
}

/* the button is supposed to be a circle, but for some reason it's not showing up like that in this snippet */

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">

Body:
Is this what you're trying to achieve? I vertically centered the <a> containing the <img> with

position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%)

Bootstrap's border-radius seemed to override yours, so I added !important to it.

.btn-circle {
  background-color: blue;
  height: 60px;
  width: 60px;
  border-radius: 50% !important;
}
.btn-circle a{
  display: block;
  width: 20px;
  height: 20px;
  position: relative;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}
.btn-circle img{
  width: 100%;
  height: 100%;
}

/* the button is supposed to be a circle, but for some reason it's not showing up like that in this snippet */

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<a class="btn btn-circle mr-3" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample"><img src="https://res.cloudinary.com/dt9b7pad3/image/upload/v1499509391/58a2031e6af142ce619ba2a2_plus-symbol_y6vqca.svg"></a>


问:
How to set vertical text on PHPExcel
How can I set vertical align to the text on PHPExcel

I tried with

```<code>$phpExcelObject->getActiveSheet()->getStyle('B2:B5')->getAlignment()->setReadorder(
            PHPExcel_Style_Alignment::READORDER_RTL
        );
</code>```

But it didn't work.

I actually have:

```<code>THE TEXT
</code>```

But I want

```<code>T
H
E

T
E
X
T
</code>```

Like the image.

答:
It's not vertical alignment that you want to look at: vertical alignment is whether the content should be at the top/centre/bottom of a cell; nor RTL, which is Right-to-Left. You could perhaps look at text rotation, but that rotates the orientation of the text.

You'll always need to set the row height to automatic and enable wrapping.

```<code>$objPHPExcel->getActiveSheet()
    ->getRowDimension(12)
    ->setRowHeight(-1);
$objPHPExcel->getActiveSheet()
    ->getStyle('A1')
    ->getAlignment()->setWrapText(true);
</code>```

so that it will expand to the actual size of your text.

Then an option would be to add a new line character after every character in your string before setting the cell value:

```<code>$value = "THE TEXT";
$objPHPExcel->getActiveSheet()
    ->setCellValue('A1', implode("\n", str_split($value)));
</code>```

Title: How to set vertical text on PHPExcel

Body:
How can I set vertical align to the text on PHPExcel

I tried with

$phpExcelObject->getActiveSheet()->getStyle('B2:B5')->getAlignment()->setReadorder(
            PHPExcel_Style_Alignment::READORDER_RTL
        );

But it didn't work.

I actually have:

THE TEXT

But I want

T
H
E

T
E
X
T

Like the image.

Body:
It's not vertical alignment that you want to look at: vertical alignment is whether the content should be at the top/centre/bottom of a cell; nor RTL, which is Right-to-Left. You could perhaps look at text rotation, but that rotates the orientation of the text.

You'll always need to set the row height to automatic and enable wrapping.

$objPHPExcel->getActiveSheet()
    ->getRowDimension(12)
    ->setRowHeight(-1);
$objPHPExcel->getActiveSheet()
    ->getStyle('A1')
    ->getAlignment()->setWrapText(true);

so that it will expand to the actual size of your text.

Then an option would be to add a new line character after every character in your string before setting the cell value:

$value = "THE TEXT";
$objPHPExcel->getActiveSheet()
    ->setCellValue('A1', implode("\n", str_split($value)));