问:
Sending message to Play Controller from Child Actors
I am not clear on how to pass a message to an actor which has a constructor taking actorRef as argument.

I am trying to implement a simple websocket server using Play Framework.

I am receiving the client request in Controller and I can able to pass the request to Parent Actor(which takes actorRef as constructor argument) which in turn passes the request to child actor.

Once the child actor processed the request, I am not able to send back the response to controller.

```<code>@Singleton
class RequestController @Inject()(cc: ControllerComponents)(implicit system: ActorSystem, mat: Materializer) extends AbstractController(cc) {
    def ws = WebSocket.accept[String, String] {req =>
    ActorFlow.actorRef { out =>
      ParentActor.props(out)
    }
  }
}
=======
object ParentActor {
  def props(out: ActorRef) = Props(new ParentActor(out))
}

class ParentActor(out : ActorRef) extends Actor {
implicit val actorSystem = ActorSystem("ab")
    override def receive: Receive = {
         case msg: String =>
            val childActor: ActorRef = actorSystem.actorOf(Props[ChildActor])
            childActor ! msg
         case msg: Response => out ! msg
    }
}
==================
case class Response(name:String, msg:String)
class ChildActor extends Actor{
implicit val actorSystem = ActorSystem("cd")
    override def receive: Receive = {
        case msg : String =>
        // Below statement is not working. I tried with sender() instead of self
        // which is also not working
        val parentActor = actorSystem.actorOf(Props(new ParentActor(self)))
        parentActor ! Response("ABC",msg)
    }
}
</code>```

答:
Right now you are creating a new actor with the line

```<code>val parentActor = actorSystem.actorOf(Props(new ParentActor(self)))
</code>```

If you are sure that the message always comes from the appropriate ParentActor, you do not need to create a new actor and should be able to send the message to it with

```<code>sender() ! Response("ABC", message)
</code>```

Body:
I am not clear on how to pass a message to an actor which has a constructor taking actorRef as argument.

I am trying to implement a simple websocket server using Play Framework.

I am receiving the client request in Controller and I can able to pass the request to Parent Actor(which takes actorRef as constructor argument) which in turn passes the request to child actor.

Once the child actor processed the request, I am not able to send back the response to controller.

@Singleton
class RequestController @Inject()(cc: ControllerComponents)(implicit system: ActorSystem, mat: Materializer) extends AbstractController(cc) {
    def ws = WebSocket.accept[String, String] {req =>
    ActorFlow.actorRef { out =>
      ParentActor.props(out)
    }
  }
}
=======
object ParentActor {
  def props(out: ActorRef) = Props(new ParentActor(out))
}

class ParentActor(out : ActorRef) extends Actor {
implicit val actorSystem = ActorSystem("ab")
    override def receive: Receive = {
         case msg: String =>
            val childActor: ActorRef = actorSystem.actorOf(Props[ChildActor])
            childActor ! msg
         case msg: Response => out ! msg
    }
}
==================
case class Response(name:String, msg:String)
class ChildActor extends Actor{
implicit val actorSystem = ActorSystem("cd")
    override def receive: Receive = {
        case msg : String =>
        // Below statement is not working. I tried with sender() instead of self
        // which is also not working
        val parentActor = actorSystem.actorOf(Props(new ParentActor(self)))
        parentActor ! Response("ABC",msg)
    }
}

Body:
Right now you are creating a new actor with the line

val parentActor = actorSystem.actorOf(Props(new ParentActor(self)))

If you are sure that the message always comes from the appropriate ParentActor, you do not need to create a new actor and should be able to send the message to it with

sender() ! Response("ABC", message)


来源: stackexchange

问:
How to reconstruct type and data structure in disassembled C/C++ program?
I have made a binary executable file disassembled using disassembler like IDA Pro. Now, I plan to recognize type and data structure information as much as possible. Is there any resource reference or ideas to help me finish the task?

Thank you!~

EDIT:

Thanks very much for tips below. Besides type and data structure information, any ideas about class object recognition?

答:
There have been some recent research papers on this topic, they are probably open-source and might even have web interfaces by which you can submit your binary for analysis, though they probably handle Elf binaries only. They have achieved fairly impressive results:

Digging for Data Structures
by Anthony Cozzie, Frank Stratton, Hui Xue, and Samuel T. King

Automatic Reverse Engineering of Data STructures from Binary Execution
by Zhiqiang Lin, Xiangyu Zhang, and Dongyan Xu

ContentLicense: CC BY-SA 3.0


问:
Deprecation warning in scikit-learn
Hello everyone i am learning machine learning , at first the code was working fine but the next day when i again execute the code it start giving me warning on taking care of missing data from a data set,  i don't know whats the problem but is any one there out who knows the solution

THE SOURCE CODE:

```<code>import numpy as np

import matplotlib.pyplot as plt

import pandas as pd

dataset = pd.read_csv('Data.csv')

x = dataset.iloc[:, :-1]

y = dataset.iloc[:, 3]

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values = 'NaN', strategy = 'mean', axis = 0)

imputer = imputer.fit(x[:, 1:3])

x[:, 1:3] = imputer.transform(x[:, 1:3])
</code>```

AND HERE IS THE WARNING:

```<code>DeprecationWarning: Class Imputer is deprecated; Imputer was deprecated in version 0.20 and will be removed in 0.22. Import impute.SimpleImputer from sklearn instead.
</code>```

答:
```<code>from sklearn.impute import SimpleImputer

imputer = SimpleImputer(missing_values = np.nan, strategy = 'mean',verbose=0)

imputer = imputer.fit(X[:, 1:3])

X[:, 1:3] = imputer.transform(X[:, 1:3])
</code>```

ContentLicense: CC BY-SA 4.0

Title: Deprecation warning in scikit-learn

Body:
Hello everyone i am learning machine learning , at first the code was working fine but the next day when i again execute the code it start giving me warning on taking care of missing data from a data set,  i don't know whats the problem but is any one there out who knows the solution

THE SOURCE CODE:

import numpy as np

import matplotlib.pyplot as plt

import pandas as pd

dataset = pd.read_csv('Data.csv')

x = dataset.iloc[:, :-1]

y = dataset.iloc[:, 3]

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values = 'NaN', strategy = 'mean', axis = 0)

imputer = imputer.fit(x[:, 1:3])

x[:, 1:3] = imputer.transform(x[:, 1:3])

AND HERE IS THE WARNING:

DeprecationWarning: Class Imputer is deprecated; Imputer was deprecated in version 0.20 and will be removed in 0.22. Import impute.SimpleImputer from sklearn instead.


问:
Text size in dropdown list of suggestions differs from its AutoCompleteTextView
I set a smaller text size than the default in my AutoCompleteTextView, expecting the dropdown list of suggestions to have identical text size and font. However, clearly it is different. The suggestions list text size stayed the same while the EditBox (AutoCompleteTextView) text size was changed when I set it in the activity_main.xml with android:textSize="15dp". Here is the result.

I searched for a property that might control suggestions' text size but could not find it. What is the way to ensure that all text is the same size, suggestion and editbox.

Here is the code in case it is needed.

```<code>public class MainActivity extends AppCompatActivity {
    private static String [] countries = new String[] {"Vatican", "Brazil",
            "Switzerland", "Angola", "Haiti", "Puerto Rico", "Germany", "Mexico",
            "France", "Ireland", "India", "Australia", "Zimbabwe", "South Africa",
            "Canada", "Thailand", "Japan", "Chile", "Botswana", "El Salvador", "Cuba",
            "Vietnam", "Mongolia", "Morocco", "Italy", "Portugal", "Ukrain"
    };

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

        // Set up autocomplete widget
        AutoCompleteTextView countryTV = (AutoCompleteTextView) findViewById(R.id.autoCompleteQuery);

        ArrayAdapter<String> countriesList = new ArrayAdapter<>(this,
                android.R.layout.simple_list_item_1, countries);
        countryTV.setAdapter(countriesList);
}
</code>```

XML

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eeeeee"
    tools:context=".MainActivity">

    <AutoCompleteTextView
        android:id="@+id/autoCompleteQuery"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="375dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:background="@android:color/white"
        android:hint="Select Country"
        android:padding="10dp"
        android:textSize="15dp"
        android:singleLine="true"
        android:textColor="@android:color/black"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>
</code>```

Thanks

答:
android.R.layout.simple_list_item_1 uses textAppearance and not textSize. it uses below value.

```<code>android:textAppearance="?android:attr/textAppearanceListItemSmall"
</code>```

You either need to set this textAppearance value to your AutocompleteTextView or create separate layout with TextView values you want and use it as custom resource in place of android.R.layout.simple_list_item_1 while setting adapter.

Body:
I set a smaller text size than the default in my AutoCompleteTextView, expecting the dropdown list of suggestions to have identical text size and font. However, clearly it is different. The suggestions list text size stayed the same while the EditBox (AutoCompleteTextView) text size was changed when I set it in the activity_main.xml with android:textSize="15dp". Here is the result.

I searched for a property that might control suggestions' text size but could not find it. What is the way to ensure that all text is the same size, suggestion and editbox.

Here is the code in case it is needed.

public class MainActivity extends AppCompatActivity {
    private static String [] countries = new String[] {"Vatican", "Brazil",
            "Switzerland", "Angola", "Haiti", "Puerto Rico", "Germany", "Mexico",
            "France", "Ireland", "India", "Australia", "Zimbabwe", "South Africa",
            "Canada", "Thailand", "Japan", "Chile", "Botswana", "El Salvador", "Cuba",
            "Vietnam", "Mongolia", "Morocco", "Italy", "Portugal", "Ukrain"
    };

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

        // Set up autocomplete widget
        AutoCompleteTextView countryTV = (AutoCompleteTextView) findViewById(R.id.autoCompleteQuery);

        ArrayAdapter<String> countriesList = new ArrayAdapter<>(this,
                android.R.layout.simple_list_item_1, countries);
        countryTV.setAdapter(countriesList);
}

XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eeeeee"
    tools:context=".MainActivity">

    <AutoCompleteTextView
        android:id="@+id/autoCompleteQuery"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="375dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:background="@android:color/white"
        android:hint="Select Country"
        android:padding="10dp"
        android:textSize="15dp"
        android:singleLine="true"
        android:textColor="@android:color/black"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

Thanks

Body:
android.R.layout.simple_list_item_1 uses textAppearance and not textSize. it uses below value.

android:textAppearance="?android:attr/textAppearanceListItemSmall"

You either need to set this textAppearance value to your AutocompleteTextView or create separate layout with TextView values you want and use it as custom resource in place of android.R.layout.simple_list_item_1 while setting adapter.


问:
DropDownList with Populate from
I am trying to get a DropDownList to pull users and then allow me to filter them. I am on a project with many other people using the same controllers and views.  I need to somehow work my code in with theirs. I have this so far

```<code>**Controller**

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Index(string Person)
 {
      var User = db.Users.Where(u => u.Id == Person).First();
      IEnumerable<Job> MyJob from job in db.Jobswhere job.Schedules.Count > 0 &&
      job.Schedules.Person == User select job;

  }

**ViewIndex**

    <div class="form-group">
        <div class="col-md-10">
            @Html.DropDownList("Person", ViewBag.Person as SelectList, "--Select Person--", new { style = "height:40px; width:450px; margin-bottom:10px" })
            <input type="submit" value="Filter" class="btn btn-default" />
            <div class="form-group">
                <div class="col-md-offset-5 col-md-12">
</code>```

I can get the Dropdown and Filter button to show up on the page,
but I cannot get the functionality working.
Any help is appreciated, I have been coding for 3 months only. I am very new.

答:
you're not assigning anything to ViewBag.Person in your controller:

```<code>  ViewBag.Person= new SelectList( db.Users.Where(u => u.Id == Person), "idPerson", "LibellePerson");
</code>```

your view:

```<code> @Html.DropDownList("Person", null, string.Empty, new { id = "Person", @class = "form-control" })
</code>```

Title: DropDownList with Populate from

Body:
I am trying to get a DropDownList to pull users and then allow me to filter them. I am on a project with many other people using the same controllers and views.  I need to somehow work my code in with theirs. I have this so far

**Controller**

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Index(string Person)
 {
      var User = db.Users.Where(u => u.Id == Person).First();
      IEnumerable<Job> MyJob from job in db.Jobswhere job.Schedules.Count > 0 &&
      job.Schedules.Person == User select job;

  }

**ViewIndex**

            @Html.DropDownList("Person", ViewBag.Person as SelectList, "--Select Person--", new { style = "height:40px; width:450px; margin-bottom:10px" })
            <input type="submit" value="Filter" class="btn btn-default" />

I can get the Dropdown and Filter button to show up on the page,
but I cannot get the functionality working.
Any help is appreciated, I have been coding for 3 months only. I am very new.

Body:
you're not assigning anything to ViewBag.Person in your controller:

  ViewBag.Person= new SelectList( db.Users.Where(u => u.Id == Person), "idPerson", "LibellePerson");

your view:

 @Html.DropDownList("Person", null, string.Empty, new { id = "Person", @class = "form-control" })


问:
Split string based on the first occurrence of the character
How can I split a C# string based on the first occurrence of the specified character?
Suppose I have a string with value:

```<code>101,a,b,c,d
</code>```

I want to split it as

```<code>101
</code>```

```<code>a,b,c,d
</code>```

That is by the first occurrence of comma character.

答:
In .net Core you can use the following;

```<code>var pieces = myString.Split(',', 2);
</code>```

Returns:

```<code>101
a,b,c,d
</code>```

Body:
How can I split a C# string based on the first occurrence of the specified character?
Suppose I have a string with value:

101,a,b,c,d

I want to split it as

101

a,b,c,d

That is by the first occurrence of comma character.

Body:
In .net Core you can use the following;

var pieces = myString.Split(',', 2);

Returns:

101
a,b,c,d


问:
How to click item in a listview using a custom Adapter
I want to use a switch case statement on the clicked item in a custom listview but I'm unable to store that data value I click on and I can't store the item position to use it for my case statement.</p>

答:
```<code>public class MainActivity extends Activity {

 ListView listItemView;

 // Define string array.
 String[] listItemsValue = new String[] {"Android","PHP","Web Development","Blogger","SEO","Photoshop"};

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

 listItemView = (ListView)findViewById(R.id.listView1);
 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_2, android.R.id.text1, listItemsValue);

 listItemView.setAdapter(adapter);

 // ListView setOnItemClickListener function apply here.

 listItemView.setOnItemClickListener(new OnItemClickListener()
 {
 @Override
 public void onItemClick(AdapterView<?> parent, View view,
 int position, long id) {
 // TODO Auto-generated method stub
 Toast.makeText(MainActivity.this, listItemsValue[position], Toast.LENGTH_SHORT).show();
 }
 });

 }

}
</code>```


问:
Convert String into Expression SQL for each Row
Hello I Searched a lot for this and I couldnt find a good solution for this.

Lets imagine a have a following query

```<code>Select width, height, depth, formula from myTable
</code>```

I want to do a replace in the formula to convert
w into width values
h into height values
d into depth values

and then I want to convert this result string ex:
'(1+2)*3' into a expression, so it gets calculated.

I came across some answers using

```<code>exec ('select '+@expression)
</code>```

But that does not work for each row. I simply cant use a exec inside a select.
Like this

```<code>select 1 as col1, exec ('select '+@expression) as col2
</code>```

Or even convert string into expression
something like

```<code>Cast('1+1' as expression)
</code>```

The final result that i need is simple. follows bellow.

```<code>+-------+--------+-------+---------+--------+
| width | height | depth | formula | result |
+-------+--------+-------+---------+--------+
| 1     | 2      | 3     | (w+h)*d | 12     |
+-------+--------+-------+---------+--------+
| 2     | 1      | 3     | d+d*h   | 6      |
+-------+--------+-------+---------+--------+
| 3     | 3      | 1     | (d/4)*d | 0.25   |
+-------+--------+-------+---------+--------+
</code>```

答:
You cannot do this in a simple query, because the formula changes on each row.  One method to get the results is to iterate through the table and execute each row separately.  Something like this:

declare @sql nvarchar(max);

declare @id int = 0;
declare @maxid int;

select @maxid = max(id) from mytable;

```<code>while @id < @maxid
begin
    select @sql = concat('select ', width, ' as width, ', height, ' as height, ', depth, ' as depth, ', formula, ' as value, ''', formula + ''' as formula',
                  ' from (select ', width, ' as w, ', height, ' as h, ', depth, 'as d) x')
    from mytable t
    order by id
    offset @id rows fetch next 1 row only;

    exec sp_executesql @sql;

    set @id = @id + 1;
end;
</code>```

Here is a db<>fiddle.

Body:
Hello I Searched a lot for this and I couldnt find a good solution for this.

Lets imagine a have a following query

Select width, height, depth, formula from myTable

I want to do a replace in the formula to convert
w into width values
h into height values
d into depth values

and then I want to convert this result string ex:
'(1+2)*3' into a expression, so it gets calculated.

I came across some answers using

exec ('select '+@expression)

But that does not work for each row. I simply cant use a exec inside a select.
Like this

select 1 as col1, exec ('select '+@expression) as col2

Or even convert string into expression
something like

Cast('1+1' as expression)

The final result that i need is simple. follows bellow.

+-------+--------+-------+---------+--------+
| width | height | depth | formula | result |
+-------+--------+-------+---------+--------+
| 1     | 2      | 3     | (w+h)*d | 12     |
+-------+--------+-------+---------+--------+
| 2     | 1      | 3     | d+d*h   | 6      |
+-------+--------+-------+---------+--------+
| 3     | 3      | 1     | (d/4)*d | 0.25   |
+-------+--------+-------+---------+--------+

Body:
You cannot do this in a simple query, because the formula changes on each row.  One method to get the results is to iterate through the table and execute each row separately.  Something like this:

declare @sql nvarchar(max);

declare @id int = 0;
declare @maxid int;

select @maxid = max(id) from mytable;

while @id < @maxid
begin
    select @sql = concat('select ', width, ' as width, ', height, ' as height, ', depth, ' as depth, ', formula, ' as value, ''', formula + ''' as formula',
                  ' from (select ', width, ' as w, ', height, ' as h, ', depth, 'as d) x')
    from mytable t
    order by id
    offset @id rows fetch next 1 row only;

    exec sp_executesql @sql;

    set @id = @id + 1;
end;

Here is a db<>fiddle.


问:
having issue to make a filter for json content?
could you anyone please help me i am new with json and ajax, i am working on a small project with json and ajax. my issue is when i write something inside searh it shows all the related results in the result div. but i want when i click on any result it show the related on same city showroom in #stage div. could anybody tell me how to make this filter?

```<code>```

JSON Live Data Search using Ajax JQuery

Employee Data

            <input type="text" name="search" id="search" placeholder="Search Employee Details" class="form-control working" />

        <button id="empname" name="empname_li">Name</button>

```
</code>```

here is my ajax code.

```<code>$(document).ready(function(){
    $.ajaxSetup({ cache: false });
    $('#search').keyup(function(){
        var searchField= $('#search').val();
        if(searchField == ""){
            $('#result').html('');
        }
        else{
            $('#result').html('');
            $('#state').val('');
            var expression = new RegExp(searchField, "i");
            $.getJSON('json_data.json', function(data) {
                $.each(data, function(key, value){
                    if (value.showroomname.search(expression) != -1 || value.statename.search(expression) != -1 ){
                        $('#result').append('<li class="list-group-item link-class"><span>'+value.showroomname+
                            '</span> <span class="statement">'+value.statename+'</span></li>');
                    }
                });
            });
        }
    });
    $('#result').on('click', 'li', function() {
        $('#stage .list-group-item').remove();
        $(this).clone().appendTo('#stage');
        $(this).siblings().clone().appendTo('#stage');
        var click_text = $(this).text().split('|');
        $('#search').val($.trim(click_text));
        $("#result").html('');
    });

});
</code>```

this is my json code

```<code>    [
      {
        "showroomname": "karama",
        "showroomphone" : "920023345",
        "showroomdistance" : "4m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "financial center",
        "showroomphone" : "920023345",
        "showroomdistance" : "44.3 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "downtown",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "jumierah",
        "showroomphone" : "920023345",
        "showroomdistance" : "100 m",
        "showroomservices": ["Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Qouz",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Barsha",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Masaood Automobiles - Nissan, Infiniti Showroom",
        "showroomphone" : "920023345",
        "showroomdistance" : "44.3 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "FLEET SHOWROOM",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "INFINITI",
        "showroomphone" : "920023345",
        "showroomdistance" : "100 m",
        "showroomservices": ["Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "Ford Showroom",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "Al Habtoor Motors Royal Car",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      }

    ]
</code>```

答:
Basically your code is working fine in my VS. I cant identify your problem. The code that worked in my desktop. All code in one page(index.html). jquery - 3.4.0</p>

```<code><html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
</head>
<body>
    <div class="container" style="width:900px;">
        <h2 align="center">JSON Live Data Search using Ajax JQuery</h2>
        <h3 align="center">Employee Data</h3>
        <br /><br />
        <div align="center">
            <input type="text" name="search" id="search" placeholder="Search Employee Details" class="form-control working" />
        </div>
        <button id="empname" name="empname_li">Name</button>
        <ul class="list-group" id="result"></ul>
        <br />
    </div>
    <div id="stage"></div>
    <script>
        $(document).ready(function () {
            $.ajaxSetup({ cache: false });
            $('#search').keyup(function () {
                var searchField = $('#search').val();
                if (searchField == "") {
                    $('#result').html('');
                }
                else {
                    $('#result').html('');
                    $('#state').val('');
                    var expression = new RegExp(searchField, "i");
                    $.getJSON('json_data.json', function (data) {
                        $.each(data, function (key, value) {
                            if (value.showroomname.search(expression) != -1 || value.statename.search(expression) != -1) {
                                $('#result').append('<li class="list-group-item link-class"><span>' + value.showroomname +
                                    '</span> <span class="statement">' + value.statename + '</span></li>');
                            }
                        });
                    });
                }
            });
            $('#result').on('click', 'li', function () {
                $('#stage .list-group-item').remove();
                $(this).clone().appendTo('#stage');
                $(this).siblings().clone().appendTo('#stage');
                var click_text = $(this).text().split('|');
                $('#search').val($.trim(click_text));
                $("#result").html('');
            });

        });
    </script>
</body>
</html>
</code>```

Body:
could you anyone please help me i am new with json and ajax, i am working on a small project with json and ajax. my issue is when i write something inside searh it shows all the related results in the result div. but i want when i click on any result it show the related on same city showroom in #stage div. could anybody tell me how to make this filter?

JSON Live Data Search using Ajax JQuery

Employee Data

            <input type="text" name="search" id="search" placeholder="Search Employee Details" class="form-control working" />

        <button id="empname" name="empname_li">Name</button>

here is my ajax code.

$(document).ready(function(){
    $.ajaxSetup({ cache: false });
    $('#search').keyup(function(){
        var searchField= $('#search').val();
        if(searchField == ""){
            $('#result').html('');
        }
        else{
            $('#result').html('');
            $('#state').val('');
            var expression = new RegExp(searchField, "i");
            $.getJSON('json_data.json', function(data) {
                $.each(data, function(key, value){
                    if (value.showroomname.search(expression) != -1 || value.statename.search(expression) != -1 ){
                        $('#result').append('
'+value.showroomname+
                            ' '+value.statename+'
');
                    }
                });
            });
        }
    });
    $('#result').on('click', 'li', function() {
        $('#stage .list-group-item').remove();
        $(this).clone().appendTo('#stage');
        $(this).siblings().clone().appendTo('#stage');
        var click_text = $(this).text().split('|');
        $('#search').val($.trim(click_text));
        $("#result").html('');
    });

});

this is my json code

    [
      {
        "showroomname": "karama",
        "showroomphone" : "920023345",
        "showroomdistance" : "4m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "financial center",
        "showroomphone" : "920023345",
        "showroomdistance" : "44.3 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "downtown",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "jumierah",
        "showroomphone" : "920023345",
        "showroomdistance" : "100 m",
        "showroomservices": ["Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Qouz",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Barsha",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Dubai"
      },
      {
        "showroomname": "Al Masaood Automobiles - Nissan, Infiniti Showroom",
        "showroomphone" : "920023345",
        "showroomdistance" : "44.3 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "FLEET SHOWROOM",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "INFINITI",
        "showroomphone" : "920023345",
        "showroomdistance" : "100 m",
        "showroomservices": ["Service Centre", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "Ford Showroom",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Service Centre", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      },
      {
        "showroomname": "Al Habtoor Motors Royal Car",
        "showroomphone" : "920023345",
        "showroomdistance" : "213.6 m",
        "showroomservices": ["Showroom Sales", "Spare Parts", "Quick Service" ],
        "showroomemail" : "info@hafiz.com",
        "showroomdirection" : "https://www.google.com/maps/dir//21.368971,39.801534",
        "statename" : "Abu Dhabi"
      }

    ]

Body:
Basically your code is working fine in my VS. I cant identify your problem. The code that worked in my desktop. All code in one page(index.html). jquery - 3.4.0

<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
</head>
<body>
    <div class="container" style="width:900px;">
        <h2 align="center">JSON Live Data Search using Ajax JQuery</h2>
        <h3 align="center">Employee Data</h3>
        <br /><br />
        <div align="center">
            <input type="text" name="search" id="search" placeholder="Search Employee Details" class="form-control working" />
        </div>
        <button id="empname" name="empname_li">Name</button>
        <ul class="list-group" id="result"></ul>
        <br />
    </div>
    <div id="stage"></div>
    <script>
        $(document).ready(function () {
            $.ajaxSetup({ cache: false });
            $('#search').keyup(function () {
                var searchField = $('#search').val();
                if (searchField == "") {
                    $('#result').html('');
                }
                else {
                    $('#result').html('');
                    $('#state').val('');
                    var expression = new RegExp(searchField, "i");
                    $.getJSON('json_data.json', function (data) {
                        $.each(data, function (key, value) {
                            if (value.showroomname.search(expression) != -1 || value.statename.search(expression) != -1) {
                                $('#result').append('<li class="list-group-item link-class"><span>' + value.showroomname +
                                    '</span> <span class="statement">' + value.statename + '</span></li>');
                            }
                        });
                    });
                }
            });
            $('#result').on('click', 'li', function () {
                $('#stage .list-group-item').remove();
                $(this).clone().appendTo('#stage');
                $(this).siblings().clone().appendTo('#stage');
                var click_text = $(this).text().split('|');
                $('#search').val($.trim(click_text));
                $("#result").html('');
            });

        });
    </script>
</body>
</html>


问:
How to count everything but letters at end of a string
I have a random string and need to know the number of non-letter / non-number characters at the end of it.

For example:

"Some text." should result in 1

"More text 123 !.?" should result in 4 (blanks included)

"Even more text 123" should result in 0

How can I do that?

答:
The problem with using Linq is that Enumerable.Reverse() makes a copy of the string as a char array and iterates backwards through it, which is not efficient. That might not matter at all to you, but a much more efficient approach is to just loop backwards over the string's characters like so:

```<code>string test = "the string to test !*&*& ";

int i;

for (i = test.Length - 1; i >= 0 && !char.IsLetterOrDigit(test[i]); --i)
    ;

int n = test.Length - i - 1; // n is the count of non-letter/non-digit chars
</code>```

If you wanted it as a method to call:

```<code>public static int CountNonLetterDigitCharsAtEnd(string input)
{
    int i;

    for (i = input.Length - 1; i >= 0 && !char.IsLetterOrDigit(input[i]); --i)
        ;

    return input.Length - i - 1;
}
</code>```

Body:
The problem with using Linq is that Enumerable.Reverse() makes a copy of the string as a char array and iterates backwards through it, which is not efficient. That might not matter at all to you, but a much more efficient approach is to just loop backwards over the string's characters like so:

string test = "the string to test !*&*& ";

int i;

for (i = test.Length - 1; i >= 0 && !char.IsLetterOrDigit(test[i]); --i)
    ;

int n = test.Length - i - 1; // n is the count of non-letter/non-digit chars

If you wanted it as a method to call:

public static int CountNonLetterDigitCharsAtEnd(string input)
{
    int i;

    for (i = input.Length - 1; i >= 0 && !char.IsLetterOrDigit(input[i]); --i)
        ;

    return input.Length - i - 1;
}


问:
"NOT IN" sql command in dplyr using result from a different query
I've been using dplyr with dbplyr to generate queries for my sql server and pull the data, but I couldn't find a way to execute the NOT IN sql command.

I'm trying to generate something like this

SELECT * FROM EMPLOYEE WHERE ID NOT IN id_list
```

<p>where id_list is obtained from another query in dplyr</p>

<pre class="lang-r prettyprint-override"><code>id_list <- mutate(uid = distinct(id)) %>% select(uid) %>% collect()
</code>```

id_list is a tbl_Microsoft SQL Server object.

What is the dplyr code to generate the SQL query?

答:
Ronak Shah's code is the correct idea, but is not negating properly. Right now it is just negating the ID instead of negating the results of the comparison.

```<code>EMPLOYEE %>%
filter(!(ID %in% id_list)) %>%
collect()
</code>```

If you put the comparison in parentheses and then negate the results of the comparison your query will work nicely (I tested it on a DB connection I have).

Body:
I've been using dplyr with dbplyr to generate queries for my sql server and pull the data, but I couldn't find a way to execute the NOT IN sql command.

I'm trying to generate something like this

SELECT * FROM EMPLOYEE WHERE ID NOT IN id_list

where id_list is obtained from another query in dplyr

id_list <- mutate(uid = distinct(id)) %>% select(uid) %>% collect()

id_list is a tbl_Microsoft SQL Server object.

What is the dplyr code to generate the SQL query?

Body:
Ronak Shah's code is the correct idea, but is not negating properly. Right now it is just negating the ID instead of negating the results of the comparison.

EMPLOYEE %>%
filter(!(ID %in% id_list)) %>%
collect()

If you put the comparison in parentheses and then negate the results of the comparison your query will work nicely (I tested it on a DB connection I have).


问:
Scrollview not working inside linearlayout
I want to use scrollview inside linearlayout and want to scroll particular this layout but it is not working.this is my code

```<code>  <?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:scrollbars="vertical">

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

    <include layout="@layout/activity_custom_action_bar" />

    <LinearLayout
        android:id="@+id/ll_client_main"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/dp15"
        android:background="@drawable/rounded_layout_white"
        android:orientation="horizontal"
        android:padding="@dimen/dp5"
        android:weightSum="1">

        <ImageView
            android:layout_width="@dimen/dp0"
            android:layout_height="match_parent"
            android:layout_weight="0.1"
            android:src="@drawable/img_user_icon" />

        <TextView
            android:id="@+id/tv_client_name"
            android:layout_width="@dimen/dp0"
            android:layout_height="match_parent"
            android:layout_weight="0.9"
            android:gravity="left|center"
            android:padding="@dimen/dp10"
            android:text=""
            android:textColor="@color/colorLightBlue"
            android:textSize="@dimen/dp12"
            android:textStyle="bold"

            />
    </LinearLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp50"
        android:theme="@style/AppTheme.WhiteAccent"
        android:visibility="visible" />

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

            <ListView
                android:id="@+id/lst_client_scheme"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp10"
                android:layout_marginTop="@dimen/dp20"
                android:layout_marginRight="@dimen/dp10"
                android:background="@color/colorGray"
                android:dividerHeight="0sp"
                android:scrollbars="vertical"
                android:visibility="visible"></ListView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/dp300"
                android:layout_marginLeft="@dimen/dp10"
                android:layout_marginTop="@dimen/dp10"
                android:layout_marginRight="@dimen/dp10"
                android:background="@android:color/darker_gray"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tv_summary_date"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp25"
                    android:layout_marginTop="@dimen/dp20"
                    android:background="@android:color/darker_gray"
                    android:gravity="center"
                    android:text=""
                    android:textColor="@color/colorWhite"
                    android:textSize="@dimen/dp12" />

                <View
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp2"
                    android:background="@color/colorWhite" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:weightSum="1">

                    <LinearLayout
                        android:layout_width="@dimen/dp0"
                        android:layout_height="match_parent"
                        android:layout_weight="0.5"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:weightSum="1">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp30"
                                android:gravity="right"
                                android:text="Total Amount Invested"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_invst_amt"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/dp40"
                                android:layout_marginTop="@dimen/dp5"

                              android:background="@drawable/corner_border"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text="9,857.51"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/dp5"
                            android:gravity="right"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp30"
                                android:gravity="right"
                                android:text="Total Current Amount"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_Curr_val"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/dp40"
                                android:layout_marginTop="@dimen/dp5"

                              android:background="@drawable/corner_border"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text="9,857.51"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />
                        </LinearLayout>

                    </LinearLayout>

                    <View
                        android:layout_width="@dimen/dp2"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="@dimen/dp3"
                        android:background="@color/colorWhite" />

                    <LinearLayout
                        android:layout_width="@dimen/dp0"
                        android:layout_height="match_parent"
                        android:layout_weight="0.5"
                        android:gravity="top"
                        android:orientation="vertical"
                        android:weightSum="5">

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Gain/Loss ST"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_gl_St"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Gain/Loss LT"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_gl_lt"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Dividend Reinvest"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_div_amt"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Ret ABS"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_ret_abs"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Weg. CAGR"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_weg_cagr"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                        </LinearLayout>
                    </LinearLayout>

                </LinearLayout>
            </LinearLayout>

        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
  </LinearLayout>
 </ScrollView>
</code>```

How I modify this code to scroll layout? I want to scroll particular layout inside the main linear layout.is it fine? guide me over this.is this code is ok?
How I use scroll view inside the linear layout.

答: You can put your nested scroll view in parent.</p>

Body:
I want to use scrollview inside linearlayout and want to scroll particular this layout but it is not working.this is my code

  <?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:scrollbars="vertical">

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

    <include layout="@layout/activity_custom_action_bar" />

    <LinearLayout
        android:id="@+id/ll_client_main"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/dp15"
        android:background="@drawable/rounded_layout_white"
        android:orientation="horizontal"
        android:padding="@dimen/dp5"
        android:weightSum="1">

        <ImageView
            android:layout_width="@dimen/dp0"
            android:layout_height="match_parent"
            android:layout_weight="0.1"
            android:src="@drawable/img_user_icon" />

        <TextView
            android:id="@+id/tv_client_name"
            android:layout_width="@dimen/dp0"
            android:layout_height="match_parent"
            android:layout_weight="0.9"
            android:gravity="left|center"
            android:padding="@dimen/dp10"
            android:text=""
            android:textColor="@color/colorLightBlue"
            android:textSize="@dimen/dp12"
            android:textStyle="bold"

            />
    </LinearLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp50"
        android:theme="@style/AppTheme.WhiteAccent"
        android:visibility="visible" />

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

            <ListView
                android:id="@+id/lst_client_scheme"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp10"
                android:layout_marginTop="@dimen/dp20"
                android:layout_marginRight="@dimen/dp10"
                android:background="@color/colorGray"
                android:dividerHeight="0sp"
                android:scrollbars="vertical"
                android:visibility="visible"></ListView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/dp300"
                android:layout_marginLeft="@dimen/dp10"
                android:layout_marginTop="@dimen/dp10"
                android:layout_marginRight="@dimen/dp10"
                android:background="@android:color/darker_gray"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tv_summary_date"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp25"
                    android:layout_marginTop="@dimen/dp20"
                    android:background="@android:color/darker_gray"
                    android:gravity="center"
                    android:text=""
                    android:textColor="@color/colorWhite"
                    android:textSize="@dimen/dp12" />

                <View
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp2"
                    android:background="@color/colorWhite" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:weightSum="1">

                    <LinearLayout
                        android:layout_width="@dimen/dp0"
                        android:layout_height="match_parent"
                        android:layout_weight="0.5"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:weightSum="1">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp30"
                                android:gravity="right"
                                android:text="Total Amount Invested"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_invst_amt"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/dp40"
                                android:layout_marginTop="@dimen/dp5"

                              android:background="@drawable/corner_border"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text="9,857.51"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/dp5"
                            android:gravity="right"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp30"
                                android:gravity="right"
                                android:text="Total Current Amount"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_Curr_val"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/dp40"
                                android:layout_marginTop="@dimen/dp5"

                              android:background="@drawable/corner_border"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text="9,857.51"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />
                        </LinearLayout>

                    </LinearLayout>

                    <View
                        android:layout_width="@dimen/dp2"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="@dimen/dp3"
                        android:background="@color/colorWhite" />

                    <LinearLayout
                        android:layout_width="@dimen/dp0"
                        android:layout_height="match_parent"
                        android:layout_weight="0.5"
                        android:gravity="top"
                        android:orientation="vertical"
                        android:weightSum="5">

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Gain/Loss ST"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_gl_St"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Gain/Loss LT"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_gl_lt"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Dividend Reinvest"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_total_div_amt"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Ret ABS"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_ret_abs"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp2"
                                android:background="@color/colorWhite" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp0"
                            android:layout_weight="1"
                            android:orientation="vertical"
                            android:weightSum="1">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="right|center"
                                android:padding="@dimen/dp5"
                                android:text="Total Weg. CAGR"
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                            <TextView
                                android:id="@+id/tv_weg_cagr"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/dp0"
                                android:layout_weight="0.5"
                                android:gravity="center|right"
                                android:padding="@dimen/dp5"
                                android:text=""
                                android:textColor="@color/colorWhite"
                                android:textSize="@dimen/dp12"
                                android:textStyle="bold" />

                        </LinearLayout>
                    </LinearLayout>

                </LinearLayout>
            </LinearLayout>

        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
  </LinearLayout>
 </ScrollView>

How I modify this code to scroll layout? I want to scroll particular layout inside the main linear layout.is it fine? guide me over this.is this code is ok?
How I use scroll view inside the linear layout.


问:
Prepared statements: MySQLi or PDO?
I'm using mySQL database and found out that using Prepared statements offer lots of benefits. However by browsing Stackoverflow I noticed that every expert encourages to use PDO, but no one talks about MySQLi. As far I have understood, PDO supports multiple databases, if thats not the concern, why PDO is preferred over mySQLi?
Thanks</p>

答:
PDO is interface for accessing databases, so you can use various drivers.
This mechanism gives you abstraction, so it's preferrable.</p>

Title: Prepared statements: MySQLi or PDO?


问:
How to use javascript or jquery to get keyboard input when html drop down menu is show?
I want to get the input using javascript or jquery when user press the keyboard. It is possible when the drop down menu is not show. When the drop down menu is show, onkeypress will not be fired.</p>

```<code><html>
<body>
<select id="test" onkeypress="sayHello()">
<option value="1">1234</option>
<option value="5">5678</option>
</select>
</body>

<script>
function sayHello(){
    alert("Hello");
}
</script>
</html>
</code>```

答:
I think this is not possible with the default select-dropdown, because the opened dropdown-menu is created on top of the browser window and not actually part of the document.

You could use/build some kind of replacement that renders a custom dropdown menu with html-elements inside the document and then capture all the events you want.

For example take a look at Select2. But there are also plenty other libraries.

Here is an example that uses select2 and only alerts if a keydown-event happens and the dropdown is open:

$(document).ready(function() {
  $('#example').select2({
    minimumResultsForSearch: 99
  });

  let isDropdownOpen = false;
  $('#example').on('select2:open', function(event) {
    isDropdownOpen = true;
  });
  $('#example').on('select2:close', function(event) {
    isDropdownOpen = false;
  });

  $(document).on('keydown', function(event) {
    if (isDropdownOpen) {
      event.preventDefault();
      alert('Hello!');
    }
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script>

<select id="example" name="example">
  <option value="1234">1234</option>
  <option value="5678">5678</option>
</select></code>```

Body:
I want to get the input using javascript or jquery when user press the keyboard. It is possible when the drop down menu is not show. When the drop down menu is show, onkeypress will not be fired.

<select id="test" onkeypress="sayHello()">
<option value="1">1234</option>
<option value="5">5678</option>
</select>

Body:
I think this is not possible with the default select-dropdown, because the opened dropdown-menu is created on top of the browser window and not actually part of the document.

You could use/build some kind of replacement that renders a custom dropdown menu with html-elements inside the document and then capture all the events you want.

For example take a look at Select2. But there are also plenty other libraries.

Here is an example that uses select2 and only alerts if a keydown-event happens and the dropdown is open:

$(document).ready(function() {
  $('#example').select2({
    minimumResultsForSearch: 99
  });

  let isDropdownOpen = false;
  $('#example').on('select2:open', function(event) {
    isDropdownOpen = true;
  });
  $('#example').on('select2:close', function(event) {
    isDropdownOpen = false;
  });

  $(document).on('keydown', function(event) {
    if (isDropdownOpen) {
      event.preventDefault();
      alert('Hello!');
    }
  });
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script>

<select id="example" name="example">
  <option value="1234">1234</option>
  <option value="5678">5678</option>
</select>


问:
how to get woe (weight of evidence) values of all variables and how to apply logistic regression model in r?
I have categorical variables:

Y = 0 or 1
X = X1; X2
Z = Z1; Z2; Z3; Z4
V = V1; V2; V3; V4

How I can get woe for all variables and how to apply logistic regression?

First of all, I don't understand how to get woe vector which will be used for logistic regression model.
For example, I use woe()

woe(Data=MyData,"X",FALSE,"Y",10,Bad=1,Good=0)

I get

BIN   BAD GOOD TOTAL  BAD% GOOD% TOTAL%   WOE    IV BAD_SPLIT
X1   0 33117 3867 36984 0.798  0.38  0.716 -74.2 0.310     0.895
X2   1  8370 6300 14670 0.202  0.62  0.284 112.1 0.469     0.571
  GOOD_SPLIT
X1      0.105
X2      0.429

But woe is only given to one variable.

答:
To get weight of evidence for all the variables you have to replace the "X" in the below code to that variable for which you want to find weight of evidence.

woe(Data=MyData,"X",FALSE,"Y",10,Bad=1,Good=0)

To learn to use woe in logistic regression you can use this link


问:
How to replace a character in a string using index in clojure
I want to replace a character in a string using index. How to do that? Or is there any other way of accessing it?</p>

答:
Like almost everything commonly used in Clojure, strings are immutable, so you need to create a new string with the new character in place of the old at the desired location:</p>

```<code>(defn replace-at [s idx replacement]
  (str (subs s 0 idx) replacement (subs s (inc idx))))

> (replace-at "012345" 2 "x")
01x345
</code>```

Body:
Like almost everything commonly used in Clojure, strings are immutable, so you need to create a new string with the new character in place of the old at the desired location:

(defn replace-at [s idx replacement]
  (str (subs s 0 idx) replacement (subs s (inc idx))))

> (replace-at "012345" 2 "x")
01x345


问:
ArgumentError in Posts#index after upgrading Rails
Everything was working fine until i switched from Rails 5.1.6 to 5.2.0. Now i'm getting this error when trying to load post images using the link_thumbnailer gem on the index page.</p>

```<code> ArgumentError in Posts#index Can't resolve image into URL: undefined method `to_model' for #<LinkThumbnailer::Models::Image:0x00007fd96d873ec8>
    Did you mean?  to_yaml

  <div class="image"><%= link_to (image_tag LinkThumbnailer.generate(post.url).images.first, image_stats: false), post_path(post), class: "ui tiny circular centered image"  %></div>
</code>```

答: you should use LinkThumbnailer.generate(post.url).images.first.src.to_s instead of LinkThumbnailer.generate(post.url).images.first

Body:
Everything was working fine until i switched from Rails 5.1.6 to 5.2.0. Now i'm getting this error when trying to load post images using the link_thumbnailer gem on the index page.

 ArgumentError in Posts#index Can't resolve image into URL: undefined method `to_model' for #<LinkThumbnailer::Models::Image:0x00007fd96d873ec8>
    Did you mean?  to_yaml

<%= link_to (image_tag LinkThumbnailer.generate(post.url).images.first, image_stats: false), post_path(post), class: "ui tiny circular centered image"  %>


问:
WebDAV and WebAPI together cause Error: Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list
I have both WebDAV installed and running on my site, as a virtual sub site i have a MVC WebAPI site, the API works great, until I try to send a PUT request to it, then i get the below error:

HTTP Error 500.21 - Internal Server Error

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

If I disable WebDAV, then everything works fine and I get no errors. This only happens when WebDAV is enabled.

I have all of the following code in my web.config:

```<code><system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <modules runAllManagedModulesForAllRequests="false">
    <remove name="WebDAVModule" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>
</code>```

I've tried messing with various app pools.

I've also tired all of the things mentioned in all of these questions:

How to get rid of this error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

How to fix: Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

None of this has solved my issue, is there anything else out there that I have not tried?

答:
Found an alternate for this issue.
When the patches of the server were pushed,The default framework were set back to 2.0.
Re register .Net framework by going to framework 4.0 folder C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Executing the command aspnet_regiis -I

Check the web.config to match the .Net framework version

Go to IIS -> Application pool, set the .Net framework values to 4.0
Restart the IIS.

Body:
I have both WebDAV installed and running on my site, as a virtual sub site i have a MVC WebAPI site, the API works great, until I try to send a PUT request to it, then i get the below error:

HTTP Error 500.21 - Internal Server Error

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

If I disable WebDAV, then everything works fine and I get no errors. This only happens when WebDAV is enabled.

I have all of the following code in my web.config:

<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <modules runAllManagedModulesForAllRequests="false">
    <remove name="WebDAVModule" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

I've tried messing with various app pools.

I've also tired all of the things mentioned in all of these questions:

How to get rid of this error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

How to fix: Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

None of this has solved my issue, is there anything else out there that I have not tried?


问:
How to use protractor to check if an element is visible?
I'm trying to test if an element is visible using protractor. Here's what the element looks like:

```<code><i class="icon-spinner icon-spin ng-hide" ng-show="saving"></i>
</code>```

When in the chrome console, I can use this jQuery selector to test if the element is visible:

```<code>$('[ng-show=saving].icon-spin')
[
<i class="icon-spinner icon-spin ng-hide" ng-show="saving"></i>
]
> $('[ng-show=saving].icon-spin:visible')
[]
</code>```

However, when I try to do the same in protractor, I get this error at runtime:

```<code>InvalidElementStateError:
invalid element state: Failed to execute 'querySelectorAll' on 'Document':
'[ng-show=saving].icon-spin:visible' is not a valid selector.
</code>```

Why is this not valid? How can I check for visibility using protractor?

答:
Here are the few code snippet which can be used for framework which use Typescript, protractor, jasmine

```<code>browser.wait(until.visibilityOf(OversightAutomationOR.lblContentModal), 3000, "Modal text is present");
</code>```

// Asserting a text

```<code>OversightAutomationOR.lblContentModal.getText().then(text => {
                    this.assertEquals(text.toString().trim(), AdminPanelData.lblContentModal);
                });
</code>```

// Asserting an element

```<code>expect(OnboardingFormsOR.masterFormActionCloneBtn.isDisplayed()).to.eventually.equal(true

    );

OnboardingFormsOR.customFormActionViewBtn.isDisplayed().then((isDisplayed) => {
                        expect(isDisplayed).to.equal(true);
                });
</code>```

// Asserting a form

```<code>formInfoSection.getText().then((text) => {
                        const vendorInformationCount = text[0].split("\n");
                        let found = false;
                        for (let i = 0; i < vendorInformationCount.length; i++) {
                            if (vendorInformationCount[i] === customLabel) {
                                found = true;
                            };
                        };
                        expect(found).to.equal(true);
                    });
</code>```

Body:
I'm trying to test if an element is visible using protractor. Here's what the element looks like:

When in the chrome console, I can use this jQuery selector to test if the element is visible:

$('[ng-show=saving].icon-spin')
[

]
> $('[ng-show=saving].icon-spin:visible')
[]

However, when I try to do the same in protractor, I get this error at runtime:

InvalidElementStateError:
invalid element state: Failed to execute 'querySelectorAll' on 'Document':
'[ng-show=saving].icon-spin:visible' is not a valid selector.

Why is this not valid? How can I check for visibility using protractor?

Body:
Here are the few code snippet which can be used for framework which use Typescript, protractor, jasmine

browser.wait(until.visibilityOf(OversightAutomationOR.lblContentModal), 3000, "Modal text is present");

// Asserting a text

OversightAutomationOR.lblContentModal.getText().then(text => {
                    this.assertEquals(text.toString().trim(), AdminPanelData.lblContentModal);
                });

// Asserting an element

expect(OnboardingFormsOR.masterFormActionCloneBtn.isDisplayed()).to.eventually.equal(true

    );

OnboardingFormsOR.customFormActionViewBtn.isDisplayed().then((isDisplayed) => {
                        expect(isDisplayed).to.equal(true);
                });

// Asserting a form

formInfoSection.getText().then((text) => {
                        const vendorInformationCount = text[0].split("\n");
                        let found = false;
                        for (let i = 0; i < vendorInformationCount.length; i++) {
                            if (vendorInformationCount[i] === customLabel) {
                                found = true;
                            };
                        };
                        expect(found).to.equal(true);
                    });


问:
VBA: cannot work with PivotTable (error 1004)
Okay, I really am frustrated right now. For the past hour or so I have been trying to get data from a simple Pivot. I cannot get it to work.

My really simple code:

```<code>Sub getXXFromPivot()

     Dim test As PivotTable

     Set Sheet1 = ActiveWorkbook.Sheets("Sheet5")
     Set test = Sheet1.PivotTables("PivotTable1")
     Set test2 = test.ClearAllFilters

     MsgBox test2

End Sub
</code>```

I am trying to use the "GetPivotData" method to get data, but no matter what I use after test. (ClearAllFilters was just a test) I always end up with error 1004. What is my mistake here? I cannot figure it out.
"PivotTable1" definitely exists. I can MsgBox test and get "PivotTable1" back.

答:
You may decide to use TableRange1 or TableRange2properties of the PivotTable and loop through them. This is the main difference:

TableRange1 - Returns a Range object that represents the range containing the entire PivotTable report, but doesn't include page fields. Read-only.

TableRange2 - Returns a Range object that represents the range containing the entire PivotTable report, including page fields. Read-only.

```<code>Sub GetXXFromPivot()

     Dim pt As PivotTable
     Dim wks As Worksheet

     Set wks = Worksheets(1)
     Set pt = wks.PivotTables("PivotTable1")

     Dim myResult As Range
     Set myResult = pt.TableRange2

     Dim myCell As Range
     For Each myCell In pt.TableRange2.Cells
        Debug.Print myCell
     Next myCell

End Sub
</code>```

Body:
Okay, I really am frustrated right now. For the past hour or so I have been trying to get data from a simple Pivot. I cannot get it to work.

My really simple code:

Sub getXXFromPivot()

     Dim test As PivotTable

     Set Sheet1 = ActiveWorkbook.Sheets("Sheet5")
     Set test = Sheet1.PivotTables("PivotTable1")
     Set test2 = test.ClearAllFilters

     MsgBox test2

End Sub

I am trying to use the "GetPivotData" method to get data, but no matter what I use after test. (ClearAllFilters was just a test) I always end up with error 1004. What is my mistake here? I cannot figure it out.
"PivotTable1" definitely exists. I can MsgBox test and get "PivotTable1" back.

Body:
You may decide to use TableRange1 or TableRange2properties of the PivotTable and loop through them. This is the main difference:

TableRange1 - Returns a Range object that represents the range containing the entire PivotTable report, but doesn't include page fields. Read-only.

TableRange2 - Returns a Range object that represents the range containing the entire PivotTable report, including page fields. Read-only.

Sub GetXXFromPivot()

     Dim pt As PivotTable
     Dim wks As Worksheet

     Set wks = Worksheets(1)
     Set pt = wks.PivotTables("PivotTable1")

     Dim myResult As Range
     Set myResult = pt.TableRange2

     Dim myCell As Range
     For Each myCell In pt.TableRange2.Cells
        Debug.Print myCell
     Next myCell

End Sub