问:
How to convert a kivy file with windows
how can I convert python and kivy file (.kv) into android app, using windows?
I've tried(*) but it converted only the python script, how can I convert also the kv file with the main python file?

--> I tried to convert to .exe my scripts because I didn't understood how to convert to apk,
I used:

python -m PyInstaller --name touchtracer Desktop\touchtracer\main.py

(adding to the touchtracer.spec the following:)
from kivy.deps import sdl2, glew

and a code in
https://kivy.org/docs/guide/packaging-windows.html
that I can't write here because it make an error

then:
python -m PyInstaller touchtracer.spec

and it worked, but it converted only the main python script with part of the program and not also the kivy file with graphic and other things.

Now what can I do to convert it to .apk or .exe?

-Thanks

答:
I think buildozer VM is the best way to build apk.

Buildozer VM:
https://kivy.org/docs/guide/packaging-android-vm.html

To build apk package:
https://kivy.org/docs/guide/packaging-android.html

well if you are not looking for above mentioned, then you may try your luck integrating KV code into python by using, not sure if apk can be built from windows.

you may use below format inside .py file

```<code>from kivy.lang.builder import Builder

Builder.load_string('''
##kv code here
''')
</code>```

Title: How to convert a kivy file with windows

Body:
I think buildozer VM is the best way to build apk.

Buildozer VM:
https://kivy.org/docs/guide/packaging-android-vm.html

To build apk package:
https://kivy.org/docs/guide/packaging-android.html

well if you are not looking for above mentioned, then you may try your luck integrating KV code into python by using, not sure if apk can be built from windows.

you may use below format inside .py file

from kivy.lang.builder import Builder

Builder.load_string('''
##kv code here
''')


来源: stackexchange

问:
How to display the dropdown & checkbox selected value in redirected page for confirmation IN PHP?
```<code><form action="action.php" method="POST"  target="_self">
<table class="main"  border="1"  height="100%" align="center">
<h3>
<p id="id1" style="background-color: #9FF" >Registration form</p></h3>

 <tr><td> First Name:<span style="color:red">*</span> </td>
<td> <input type="text"  name="fname" value="" placeholder="firstname"    required="required" maxlength="25"></td></tr>
 <tr><td> SurName:<span style="color:red">*</span></td>
 <td><input type="text"  name="sname" value=""  placeholder="lastname" required="required" maxlength="20"/> </td></tr>
 <tr><td>Age:<span style="color:red">*</span></td>
 <td> <input type="text" name="age" value="" required/></td></tr>
 <tr><td>Date of Birth:<span style="color:red">*</span></td>
 <td><input type="date" name="DOB" value="" required/></td></tr>
 <tr><td> Gender:<span style="color:red">*</span></td>
  <td><input type="radio" name="gender" value="male" required/>Male
   <input type="radio" name="gender" value="Female" />Female</td></tr>
  <tr><td>Qualification:<span style="color:red">*</span></td>
   <td> <select name="study" required>
   <option value="">---Select---</option>
  <option value="btech">B.Tech</option>
  <option value="BSc">BSc</option>
  <option value="BCom">BCom</option>
 </select></td></tr>
  <tr><td> State:<span style="color:red">*</span></td>
<td><Select name="state" required >
<option value="">---Select---</option>
<option valuie="AndhraPradesh">AndhraPradesh</option>
<option value="Telangana">Telangana</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Kerala">Kerala</option>
<option vgalue="Maharastra">Maharastra</option>
</Select></td></tr>

<tr><td>Profile:<span style="color:red">*</span></td><td><input type="checkbox" name="profile" value="Java" />Java
                            <input type="checkbox" name="profile" value="PHP" />PHP
                            <input type="checkbox" name="profile" val

    ue="Android" />Android</td> </tr>
    <tr><td> Address for Communication:</td><td><textarea name="adr" rows="5" cols="30" ></textarea></td></tr>
            <tr><td colspan="2" align="center"><input type="submit" value="submit" /></td></tr>
    </table></form>
</code>```

** this is my register form and now i want to display all the selected values in next page i.e in action.php and its code is as follows********

```<code>    <form action="store.php" method="post" align="center" target="_self">
    <label>Name of the person:</label>
   <input type="hidden" name="person" value="<?= $_POST['fname'];?>"></input><?=$_POST['fname'];?>  <br />
    <label>Name of the Surname:</label>
    <input type="hidden" name="surname" value="<?= $_POST['sname'];?>"></input><?=$_POST['sname'];?>  <br />
    <label>His Age:</label>
     <input type="hidden" name="age" value="<?= $_POST['age'];?>"></input><?=$_POST['age'];?> <br />
     <label>Date of Birth:</label>
     <input type="hidden" name="dob" value="<$_POST['DOB'];?>"></input><?=$_POST['DOB'];?>  <br />
      <label>Gender:</label>
     <input type="hidden" name="gender" value="<?= $_POST['gender'];?>"></input><?=$_POST['gender'];?> <br />
      <label>Education:</label>
     <input type="hidden" name="edu" value="<?php if(isset($_POST['submit']))echo $_POST['study']?>"></input><?php if(isset($_POST['submit'])) echo $_POST['study']?>;?>
      <br />
      <label>State:</label>
      <input type="hidden" name="state" value="<?if(isset($_POST['submit']))echo $_POST['state']?>"></input><?php if(isset($_POST['submit'])) echo $_POST['state']?>;?>
      <br />
      <label>Good At:</label>
     <input type="hidden" name="profile" value="<?= $_POST['profile'];?>"></input><?=$_POST['profile'];?>  <br />
      <label>Address:</label>
      <input type="hidden" name="adr" value="<?= $_POST['adr'];?>"></input><?=$_POST['adr'];?>  <br /><br /><br />
      <input type="submit" value="confirm" name="submit"></input>
</code>```

****the dropdown is not displaying and also please suggest if after click on confirm then the values that are confirmed has to be stored in database.For that shall I get the values from names of input hidden fields in action.php or  registration input field names?

答:
```<code>    <SELECT name="abc">
<option value="option1" selected> This is option 1 </option>
<option value="option2"> This is option 2 </option>
</SELECT>
</code>```

and php get the value of $_POST['abc'] is option1 when submitted the post

ContentLicense: CC BY-SA 3.0

Body:
<form action="action.php" method="POST"  target="_self">

Registration form

 First Name:*
 <input type="text"  name="fname" value="" placeholder="firstname"    required="required" maxlength="25">

 SurName:*
 <input type="text"  name="sname" value=""  placeholder="lastname" required="required" maxlength="20"/>

Age:*
  <input type="text" name="age" value="" required/>

Date of Birth:*
 <input type="date" name="DOB" value="" required/>

 Gender:*
  <input type="radio" name="gender" value="male" required/>Male
   <input type="radio" name="gender" value="Female" />Female

Qualification:*
    <select name="study" required>
   <option value="">---Select---</option>
  <option value="btech">B.Tech</option>
  <option value="BSc">BSc</option>
  <option value="BCom">BCom</option>
 </select>

 State:*
<Select name="state" required >
<option value="">---Select---</option>
<option valuie="AndhraPradesh">AndhraPradesh</option>
<option value="Telangana">Telangana</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Kerala">Kerala</option>
<option vgalue="Maharastra">Maharastra</option>
</Select>

Profile:*	<input type="checkbox" name="profile" value="Java" />Java
                            <input type="checkbox" name="profile" value="PHP" />PHP
                            <input type="checkbox" name="profile" val

    ue="Android" />Android

 Address for Communication:	<textarea name="adr" rows="5" cols="30" ></textarea>

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

</form>

** this is my register form and now i want to display all the selected values in next page i.e in action.php and its code is as follows********

    <form action="store.php" method="post" align="center" target="_self">
    Name of the person:
   <input type="hidden" name="person" value="<?= $_POST['fname'];?>"></input><?=$_POST['fname'];?>

    Name of the Surname:
    <input type="hidden" name="surname" value="<?= $_POST['sname'];?>"></input><?=$_POST['sname'];?>

    His Age:
     <input type="hidden" name="age" value="<?= $_POST['age'];?>"></input><?=$_POST['age'];?>

     Date of Birth:
     <input type="hidden" name="dob" value="<$_POST['DOB'];?>"></input><?=$_POST['DOB'];?>

      Gender:
     <input type="hidden" name="gender" value="<?= $_POST['gender'];?>"></input><?=$_POST['gender'];?>

      Education:
     <input type="hidden" name="edu" value="<?php if(isset($_POST['submit']))echo $_POST['study']?>"></input><?php if(isset($_POST['submit'])) echo $_POST['study']?>;?>

      State:
      <input type="hidden" name="state" value="<?if(isset($_POST['submit']))echo $_POST['state']?>"></input><?php if(isset($_POST['submit'])) echo $_POST['state']?>;?>

      Good At:
     <input type="hidden" name="profile" value="<?= $_POST['profile'];?>"></input><?=$_POST['profile'];?>

      Address:
      <input type="hidden" name="adr" value="<?= $_POST['adr'];?>"></input><?=$_POST['adr'];?>

      <input type="submit" value="confirm" name="submit"></input>

****the dropdown is not displaying and also please suggest if after click on confirm then the values that are confirmed has to be stored in database.For that shall I get the values from names of input hidden fields in action.php or  registration input field names?

Body:
    <SELECT name="abc">
<option value="option1" selected> This is option 1 </option>
<option value="option2"> This is option 2 </option>
</SELECT>

and php get the value of $_POST['abc'] is option1 when submitted the post


问:
How do you set a string data member from a base class, with a derived classed?
I have figured out most of the code/assignment, here is part of the "To-Do" I can't figure out:

The derived classes set the m_type, but note, there is no setType function to do
so (and you can't add one).

Here is my code (nothing in main can be changed):

```<code>#include <iostream>
#include <vector>
#include <stdlib.h>
#include <string>
const double PI = 3.14159265359;

class Geometry
 {
 public:
     Geometry(std::string name)
        :m_name(name)
    {

    }
    virtual double computeVolume() = 0;
    virtual double computeSurfaceArea() = 0;

    std::string getName() { return m_name; }
    std::string getType() { return m_type; }

protected:
    std::string m_name;
    std::string m_type;

 };

class Box : public Geometry
{
 public:

    Box(std::string name, double length, double width, double height)
        : Geometry(name), m_length(length), m_width(width), m_height(height)
    {

    }

    virtual double computeSurfaceArea()
    {
        return (2 * (m_height * m_width)) + (2 * (m_height * m_length)) + (2
        * (m_length * m_width));
    }

     virtual double computeVolume()
    {
        return m_length * m_width * m_height;
    }
 protected:
     double m_length;
     double m_width;
     double m_height;
};

class Sphere : public Geometry
{
public:
    Sphere(std::string name, double radius)
        :Geometry(name), m_radius(radius)
    {

    }

    virtual double computeVolume()
    {
        return  (4.0/3.0) * PI * (m_radius * m_radius * m_radius);
    }

    virtual double computeSurfaceArea()
    {
        return 4 * PI * (m_radius * m_radius);
    }

 protected:
     double m_radius;

 };

void report(Geometry* obj)
{

     std::cout << "----- Geometry Report -----" << std::endl << std::endl
        << "Type: " << obj->getType() << std::endl
        << "Name: " << obj->getName() << std::endl
        << "Volume " << obj->computeVolume() << std::endl
        << "Surface Area " << obj->computeSurfaceArea() << std::endl <<
std::endl;
}

int main()
{
    std::vector<Geometry*> items;

    items.push_back(new Box("Box 1", 1, 2, 3));
    items.push_back(new Box("Box 2", 2, 3, 4));
    items.push_back(new Sphere("Sphere 1", 5));
    items.push_back(new Sphere("Sphere 2", 6));

    for (int i = 0; i < items.size(); i++)
    {
        report(items[i]);
    }

    system("PAUSE");
    return 0;
}
</code>```

Thanks

答:
A protected member variable or function is very similar to a private member but it provided one additional benefit that they can be accessed in child classes which are called derived classes.

So you can directly set m_type from derived class.

Example::

```<code>class Box {
          protected:
               double width;
          };

     class SmallBox:Box { // SmallBox is the derived class.
          public:
   void setSmallWidth( double wid );
   double getSmallWidth( void );
   };

    // Member functions of child class
          double SmallBox::getSmallWidth(void) {
        return width ;
       }

 void SmallBox::setSmallWidth( double wid ) {
     width = wid;
  }

     // Main function for the program
     int main() {
         SmallBox box;

     // set box width using member function
         box.setSmallWidth(5.0);
         cout << "Width of box : "<< box.getSmallWidth() << endl;

            return 0;
        }
</code>```

In your case It may be used like this

```<code> Box(std::string name, double length, double width, double height)
    : Geometry(name), m_length(length), m_width(width), m_height(height)
{
   m_type="abc";
}
</code>```

Body:
I have figured out most of the code/assignment, here is part of the "To-Do" I can't figure out:

The derived classes set the m_type, but note, there is no setType function to do
so (and you can't add one).

Here is my code (nothing in main can be changed):

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <string>
const double PI = 3.14159265359;

class Geometry
 {
 public:
     Geometry(std::string name)
        :m_name(name)
    {

    }
    virtual double computeVolume() = 0;
    virtual double computeSurfaceArea() = 0;

    std::string getName() { return m_name; }
    std::string getType() { return m_type; }

protected:
    std::string m_name;
    std::string m_type;

 };

class Box : public Geometry
{
 public:

    Box(std::string name, double length, double width, double height)
        : Geometry(name), m_length(length), m_width(width), m_height(height)
    {

    }

    virtual double computeSurfaceArea()
    {
        return (2 * (m_height * m_width)) + (2 * (m_height * m_length)) + (2
        * (m_length * m_width));
    }

     virtual double computeVolume()
    {
        return m_length * m_width * m_height;
    }
 protected:
     double m_length;
     double m_width;
     double m_height;
};

class Sphere : public Geometry
{
public:
    Sphere(std::string name, double radius)
        :Geometry(name), m_radius(radius)
    {

    }

    virtual double computeVolume()
    {
        return  (4.0/3.0) * PI * (m_radius * m_radius * m_radius);
    }

    virtual double computeSurfaceArea()
    {
        return 4 * PI * (m_radius * m_radius);
    }

 protected:
     double m_radius;

 };

void report(Geometry* obj)
{

     std::cout << "----- Geometry Report -----" << std::endl << std::endl
        << "Type: " << obj->getType() << std::endl
        << "Name: " << obj->getName() << std::endl
        << "Volume " << obj->computeVolume() << std::endl
        << "Surface Area " << obj->computeSurfaceArea() << std::endl <<
std::endl;
}

int main()
{
    std::vector<Geometry*> items;

    items.push_back(new Box("Box 1", 1, 2, 3));
    items.push_back(new Box("Box 2", 2, 3, 4));
    items.push_back(new Sphere("Sphere 1", 5));
    items.push_back(new Sphere("Sphere 2", 6));

    for (int i = 0; i < items.size(); i++)
    {
        report(items[i]);
    }

    system("PAUSE");
    return 0;
}

Thanks

Body:
A protected member variable or function is very similar to a private member but it provided one additional benefit that they can be accessed in child classes which are called derived classes.

So you can directly set m_type from derived class.

Example::

class Box {
          protected:
               double width;
          };

     class SmallBox:Box { // SmallBox is the derived class.
          public:
   void setSmallWidth( double wid );
   double getSmallWidth( void );
   };

    // Member functions of child class
          double SmallBox::getSmallWidth(void) {
        return width ;
       }

 void SmallBox::setSmallWidth( double wid ) {
     width = wid;
  }

     // Main function for the program
     int main() {
         SmallBox box;

     // set box width using member function
         box.setSmallWidth(5.0);
         cout << "Width of box : "<< box.getSmallWidth() << endl;

            return 0;
        }

In your case It may be used like this

 Box(std::string name, double length, double width, double height)
    : Geometry(name), m_length(length), m_width(width), m_height(height)
{
   m_type="abc";
}


问:
Laravel: How to get custom sorted eloquent collection using whereIn method
I have an array of product ids against which I need to retrieve the model collection. The array is something like this:

```<code>$ids = array(9, 2, 16, 11, 8, 1, 18);
</code>```

Right now, I'm using the following line of code to get the collection.

```<code>$products = Product::whereIn('id', $ids)->get();
</code>```

But it sorts the products against their ids. such as: 1, 2, 8, 9, 11, 16, 18. What I need is the same order as in the $ids array i.e 9, 2, 16, 11, 8, 1, 18.

What should I do to get the same order as in the array?

答:
Here's another way to do that.</p>

```<code>$ids = array(9, 2, 16, 11, 8, 1, 18);
$products = User::whereIn('id', $ids)->orderByRaw('FIELD(id, '.implode(',', $ids).')')->get();
</code>```

Body:
I have an array of product ids against which I need to retrieve the model collection. The array is something like this:

$ids = array(9, 2, 16, 11, 8, 1, 18);

Right now, I'm using the following line of code to get the collection.

$products = Product::whereIn('id', $ids)->get();

But it sorts the products against their ids. such as: 1, 2, 8, 9, 11, 16, 18. What I need is the same order as in the $ids array i.e 9, 2, 16, 11, 8, 1, 18.

What should I do to get the same order as in the array?

Body:
Here's another way to do that.

$ids = array(9, 2, 16, 11, 8, 1, 18);
$products = User::whereIn('id', $ids)->orderByRaw('FIELD(id, '.implode(',', $ids).')')->get();


问:
Xamarin Forms UWP Capture Screenshot Include Signature Pad
I have a Xamarin Forms page using Signature Pad (https://github.com/xamarin/SignaturePad). I'm attempting to capture a screenshot of the entire view. It should include the signature as well.

However, using the following code I'm noticing the signature does not show up.

What is the best way to capture the full Page including the signature? (not just the signature)

```<code>public class ScreenshotService : IScreenshotService
{
    public async Task<byte[]> CaptureAsync()
    {
    var rtb = new RenderTargetBitmap();
    await rtb.RenderAsync(Window.Current.Content);

    var pixelBuffer = await rtb.GetPixelsAsync();
    var pixels = pixelBuffer.ToArray();

    // Useful for rendering in the correct DPI
    var displayInformation = DisplayInformation.GetForCurrentView();

    var stream = new InMemoryRandomAccessStream();
    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
    encoder.SetPixelData(BitmapPixelFormat.Bgra8,
    BitmapAlphaMode.Premultiplied,
    (uint)rtb.PixelWidth,
    (uint)rtb.PixelHeight,
    displayInformation.RawDpiX,
    displayInformation.RawDpiY,
    pixels);

    await encoder.FlushAsync();
    stream.Seek(0);

    var readStram = stream.AsStreamForRead();
    var bytes = new byte[readStram.Length];
    readStram.Read(bytes, 0, bytes.Length);

    return bytes;
}
}
</code>```

答:
According to the "XAML visuals and RenderTargetBitmap capture capabilities" of RenderTargetBitmap class:

Content that can't be captured will appear as blank in the captured image, but other content in the same visual tree can still be captured and will render (the presence of content that can't be captured won't invalidate the entire capture of that XAML composition).

So it could be that the content of InkCanvas is not captureable. However, you can use Win2D. For more you could refer the following code.

```<code>public async Task<Stream> CaptureAsync(Stream Tem)
{
    var rtb = new RenderTargetBitmap();
    await rtb.RenderAsync(Window.Current.Content);

    var pixelBuffer = await rtb.GetPixelsAsync();
    var pixels = pixelBuffer.ToArray();

    var displayInformation = DisplayInformation.GetForCurrentView();
    var stream = new InMemoryRandomAccessStream();
    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
    encoder.SetPixelData(BitmapPixelFormat.Bgra8,
    BitmapAlphaMode.Premultiplied,
    (uint)rtb.PixelWidth,
    (uint)rtb.PixelHeight,
    displayInformation.RawDpiX,
    displayInformation.RawDpiY,
    pixels);
    await encoder.FlushAsync();
    stream.Seek(0);
    var readStram = stream.AsStreamForRead();

    var pagebitmap = await GetSoftwareBitmap(readStram);
    var softwareBitmap = await GetSoftwareBitmap(Tem);

    CanvasDevice device = CanvasDevice.GetSharedDevice();
    CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, rtb.PixelWidth, rtb.PixelHeight, 96);

    using (var ds = renderTarget.CreateDrawingSession())
    {
        ds.Clear(Colors.White);
        var page = CanvasBitmap.CreateFromSoftwareBitmap(device, pagebitmap);
        var image = CanvasBitmap.CreateFromSoftwareBitmap(device, softwareBitmap);
        ds.DrawImage(page);
        ds.DrawImage(image);
    }

    InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();
    await renderTarget.SaveAsync(randomAccessStream, CanvasBitmapFileFormat.Jpeg, 1f);
    return randomAccessStream.AsStream();
}

 private async Task<SoftwareBitmap> GetSoftwareBitmap(Stream data)
 {
   BitmapDecoder pagedecoder = await BitmapDecoder.CreateAsync(data.AsRandomAccessStream());
   return await pagedecoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);
 }
</code>```

IScreenshotServicecs interface

```<code>public interface IScreenshotServicecs
{
    Task<Stream> CaptureAsync(Stream stream);
}
</code>```

Usage

```<code>var stream = await SignatureView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Png);
var data = await DependencyService.Get<IScreenshotServicecs>().CaptureAsync(stream);
MyImage.Source = ImageSource.FromStream(() => data);
</code>```

Body:
I have a Xamarin Forms page using Signature Pad (https://github.com/xamarin/SignaturePad). I'm attempting to capture a screenshot of the entire view. It should include the signature as well.

However, using the following code I'm noticing the signature does not show up.

What is the best way to capture the full Page including the signature? (not just the signature)

public class ScreenshotService : IScreenshotService
{
    public async Task<byte[]> CaptureAsync()
    {
    var rtb = new RenderTargetBitmap();
    await rtb.RenderAsync(Window.Current.Content);

    var pixelBuffer = await rtb.GetPixelsAsync();
    var pixels = pixelBuffer.ToArray();

    // Useful for rendering in the correct DPI
    var displayInformation = DisplayInformation.GetForCurrentView();

    var stream = new InMemoryRandomAccessStream();
    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
    encoder.SetPixelData(BitmapPixelFormat.Bgra8,
    BitmapAlphaMode.Premultiplied,
    (uint)rtb.PixelWidth,
    (uint)rtb.PixelHeight,
    displayInformation.RawDpiX,
    displayInformation.RawDpiY,
    pixels);

    await encoder.FlushAsync();
    stream.Seek(0);

    var readStram = stream.AsStreamForRead();
    var bytes = new byte[readStram.Length];
    readStram.Read(bytes, 0, bytes.Length);

    return bytes;
}
}

Body:
According to the "XAML visuals and RenderTargetBitmap capture capabilities" of RenderTargetBitmap class:

Content that can't be captured will appear as blank in the captured image, but other content in the same visual tree can still be captured and will render (the presence of content that can't be captured won't invalidate the entire capture of that XAML composition).

So it could be that the content of InkCanvas is not captureable. However, you can use Win2D. For more you could refer the following code.

public async Task<Stream> CaptureAsync(Stream Tem)
{
    var rtb = new RenderTargetBitmap();
    await rtb.RenderAsync(Window.Current.Content);

    var pixelBuffer = await rtb.GetPixelsAsync();
    var pixels = pixelBuffer.ToArray();

    var displayInformation = DisplayInformation.GetForCurrentView();
    var stream = new InMemoryRandomAccessStream();
    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
    encoder.SetPixelData(BitmapPixelFormat.Bgra8,
    BitmapAlphaMode.Premultiplied,
    (uint)rtb.PixelWidth,
    (uint)rtb.PixelHeight,
    displayInformation.RawDpiX,
    displayInformation.RawDpiY,
    pixels);
    await encoder.FlushAsync();
    stream.Seek(0);
    var readStram = stream.AsStreamForRead();

    var pagebitmap = await GetSoftwareBitmap(readStram);
    var softwareBitmap = await GetSoftwareBitmap(Tem);

    CanvasDevice device = CanvasDevice.GetSharedDevice();
    CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, rtb.PixelWidth, rtb.PixelHeight, 96);

    using (var ds = renderTarget.CreateDrawingSession())
    {
        ds.Clear(Colors.White);
        var page = CanvasBitmap.CreateFromSoftwareBitmap(device, pagebitmap);
        var image = CanvasBitmap.CreateFromSoftwareBitmap(device, softwareBitmap);
        ds.DrawImage(page);
        ds.DrawImage(image);
    }

    InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();
    await renderTarget.SaveAsync(randomAccessStream, CanvasBitmapFileFormat.Jpeg, 1f);
    return randomAccessStream.AsStream();
}

 private async Task<SoftwareBitmap> GetSoftwareBitmap(Stream data)
 {
   BitmapDecoder pagedecoder = await BitmapDecoder.CreateAsync(data.AsRandomAccessStream());
   return await pagedecoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);
 }

IScreenshotServicecs interface

public interface IScreenshotServicecs
{
    Task<Stream> CaptureAsync(Stream stream);
}

Usage

var stream = await SignatureView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Png);
var data = await DependencyService.Get<IScreenshotServicecs>().CaptureAsync(stream);
MyImage.Source = ImageSource.FromStream(() => data);


问:
uuidgen alternative
I'm running Windows XP. I don't have Microsoft Visual Studio installed and I don't want to install it.

I need a couple of UUIDs but uuidgen doesn't seem to be on my system.

Is there a single executable out there from a reputable source, that I can download and use to generate UUIDs?

答:
aha, I already have python on my machine:</p>
```<code>C:\WINDOWS>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48::26) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "licen
>>> import uuid
>>> uuid.uuid4()
UUID('640628d4-4e4d-4a7a-8f9e-24aa6106b56a')
</code>```

ContentLicense: CC BY-SA 2.5

Title: uuidgen alternative

Body:
aha, I already have python on my machine:

C:\WINDOWS>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48::26) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "licen
>>> import uuid
>>> uuid.uuid4()
UUID('640628d4-4e4d-4a7a-8f9e-24aa6106b56a')


问:
Fail to read information from a web site using Google Apps Script
I have tried to use "UrlFetchApp.Fetch" in google apps script to retrieve data from https://metoc.ndbc.noaa.gov/web/guest/jtwc".

However, the information highlighted in  red as shown here "web capture" cannot be captured in the file I downloaded. Please help, thanks.

```<code>var FILE_NAME = 'data.txt'
var Google_DRive_ID = 'your google drive folder id'
var RESOURCE_URL = 'https://metoc.ndbc.noaa.gov/web/guest/jtwc'
var folder = DriveApp.getFolderById(Google_DRive_ID);
var exportUrl = RESOURCE_URL
var data = UrlFetchApp.fetch(exportUrl)
folder.createFile(FILE_NAME, data)
</code>```

答:
When I saw the source of https://metoc.ndbc.noaa.gov/web/guest/jtwc, it was found that the source you want is included in iframe with the id="_48_INSTANCE_0SiamlX2KcM6_iframe". The source URL is src="/ProductFeeds-portlet/img/jtwc/html/coop.jsp?". When your script is modified using the URL, it is as follows.

Modified script :

```<code>var root = "https://metoc.ndbc.noaa.gov";
var src = "/ProductFeeds-portlet/img/jtwc/html/coop.jsp?"; // You can also use "/ProductFeeds-portlet/img/jtwc/html/coop.jsp"

var FILE_NAME = 'data.txt'
var Google_DRive_ID = 'your google drive folder id'
var RESOURCE_URL = root + src;
var folder = DriveApp.getFolderById(Google_DRive_ID);
var exportUrl = RESOURCE_URL
var data = UrlFetchApp.fetch(exportUrl)
folder.createFile(FILE_NAME, data)
</code>```

If I misunderstand your question, I'm sorry.

Body:
I have tried to use "UrlFetchApp.Fetch" in google apps script to retrieve data from https://metoc.ndbc.noaa.gov/web/guest/jtwc".

However, the information highlighted in  red as shown here "web capture" cannot be captured in the file I downloaded. Please help, thanks.

var FILE_NAME = 'data.txt'
var Google_DRive_ID = 'your google drive folder id'
var RESOURCE_URL = 'https://metoc.ndbc.noaa.gov/web/guest/jtwc'
var folder = DriveApp.getFolderById(Google_DRive_ID);
var exportUrl = RESOURCE_URL
var data = UrlFetchApp.fetch(exportUrl)
folder.createFile(FILE_NAME, data)

Body:
When I saw the source of https://metoc.ndbc.noaa.gov/web/guest/jtwc, it was found that the source you want is included in iframe with the id="_48_INSTANCE_0SiamlX2KcM6_iframe". The source URL is src="/ProductFeeds-portlet/img/jtwc/html/coop.jsp?". When your script is modified using the URL, it is as follows.

Modified script :

var root = "https://metoc.ndbc.noaa.gov";
var src = "/ProductFeeds-portlet/img/jtwc/html/coop.jsp?"; // You can also use "/ProductFeeds-portlet/img/jtwc/html/coop.jsp"

var FILE_NAME = 'data.txt'
var Google_DRive_ID = 'your google drive folder id'
var RESOURCE_URL = root + src;
var folder = DriveApp.getFolderById(Google_DRive_ID);
var exportUrl = RESOURCE_URL
var data = UrlFetchApp.fetch(exportUrl)
folder.createFile(FILE_NAME, data)

If I misunderstand your question, I'm sorry.


问:
Pip Upgrade/Update Functonality
I have uploaded a package to PyPI that has file1 and file2 that users can edit for their specific configurations.

Now when I make changes to this package and the users decide to update their installation using pip install - U package, Is there a way for that file1 and file2 to be left as is, since if it does get upgraded users will have to redo their configs.
Some code I can introduce in setup.py that can have the desired effect? Below is my setup.py

```<code># Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

pwd = path.abspath(path.dirname(__file__))

with open(path.join(pwd, 'LICENSE.txt'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='mypackage',

    # Using version number from git tag
    # use_scm_version={"root": "..", "relative_to": __file__},
    use_scm_version=True,
    setup_requires=['setuptools_scm'],

    description='XYZ',
    long_description=long_description,

    # The project's main homepage.
    url='https://www.google.com/',

    # Author details
    author='XYZ',
    author_email='xyz@xyz.com',

    # Choose your license
    license='See package description',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Keep updating supported frameworks here

        'Framework :: Django',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Information Technology',

        # Pick your license as you wish (should match "license" above)
        'License :: Other/Proprietary License',

        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        'Programming Language :: Python :: 2.7',
    ],

    # Project associated keywords - space separated
    keywords='ca_apm_agent performance-monitoring development APM',

    # You can just specify the packages manually here if your project is
    # simple. Or you can use find_packages().
    packages=find_packages(exclude=['docs', 'tests']),

    # Alternatively, if you want to distribute just a my_module.py, uncomment
    # this:
    #   py_modules=["my_module"],

    # List run-time dependencies here.  These will be installed by pip when
    # your project is installed. For an analysis of "install_requires" vs pip's
    # requirements files see:
    # https://packaging.python.org/en/latest/requirements.html
    install_requires=[],

    # List additional groups of dependencies here (e.g. development
    # dependencies). You can install these using the following syntax,
    # for example:
    # $ pip install -e .[dev,test]
    extras_require={
        'dev': ['check-manifest'],
        'test': ['coverage'],
    },

    # If there are data files included in your packages that need to be
    # installed, specify them here.  If using Python 2.6 or less, then these
    # have to be included in MANIFEST.in as well.
    include_package_data=True,
    package_data={
        'mypackage': ['directives/file1, directives/file2'],
    },

    # Although 'package_data' is the preferred approach, in some case you may
    # need to place data files outside of your packages. See:
    # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
    # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
    # data_files=[('my_data', ['data/data_file'])],
    data_files=[],

    # To provide executable scripts, use entry points in preference to the
    # "scripts" keyword. Entry points provide cross-platform support and allow
    # pip to create the appropriate form of executable for the target platform.
    entry_points={
        'console_scripts': [
            'mypackage-run=mypackage:main',
        ],
    },
)
</code>```

答:
Users should not edit a file that is included in your distribution, and neither should they create any new files in the directory where your distribution gets installed.

A common pattern is to use a file in the homedir, e.g. ~/.myapp.cfg for any customizations, and then just distribute some sensible default configuration with your app.

Your app will check for the presence of the user configuration, but the app should not require the presence of a custom config in order to run.  You can make the decision about whether you want to "layer" the user config on top of the default config, or simply use it in preference to the default config.

Make sure the file format and expected location of the user configuration is clearly documented.

Title: Pip Upgrade/Update Functonality

Body:
I have uploaded a package to PyPI that has file1 and file2 that users can edit for their specific configurations.

Now when I make changes to this package and the users decide to update their installation using pip install - U package, Is there a way for that file1 and file2 to be left as is, since if it does get upgraded users will have to redo their configs.
Some code I can introduce in setup.py that can have the desired effect? Below is my setup.py

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

pwd = path.abspath(path.dirname(__file__))

with open(path.join(pwd, 'LICENSE.txt'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='mypackage',

    # Using version number from git tag
    # use_scm_version={"root": "..", "relative_to": __file__},
    use_scm_version=True,
    setup_requires=['setuptools_scm'],

    description='XYZ',
    long_description=long_description,

    # The project's main homepage.
    url='https://www.google.com/',

    # Author details
    author='XYZ',
    author_email='xyz@xyz.com',

    # Choose your license
    license='See package description',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Keep updating supported frameworks here

        'Framework :: Django',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Information Technology',

        # Pick your license as you wish (should match "license" above)
        'License :: Other/Proprietary License',

        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        'Programming Language :: Python :: 2.7',
    ],

    # Project associated keywords - space separated
    keywords='ca_apm_agent performance-monitoring development APM',

    # You can just specify the packages manually here if your project is
    # simple. Or you can use find_packages().
    packages=find_packages(exclude=['docs', 'tests']),

    # Alternatively, if you want to distribute just a my_module.py, uncomment
    # this:
    #   py_modules=["my_module"],

    # List run-time dependencies here.  These will be installed by pip when
    # your project is installed. For an analysis of "install_requires" vs pip's
    # requirements files see:
    # https://packaging.python.org/en/latest/requirements.html
    install_requires=[],

    # List additional groups of dependencies here (e.g. development
    # dependencies). You can install these using the following syntax,
    # for example:
    # $ pip install -e .[dev,test]
    extras_require={
        'dev': ['check-manifest'],
        'test': ['coverage'],
    },

    # If there are data files included in your packages that need to be
    # installed, specify them here.  If using Python 2.6 or less, then these
    # have to be included in MANIFEST.in as well.
    include_package_data=True,
    package_data={
        'mypackage': ['directives/file1, directives/file2'],
    },

    # Although 'package_data' is the preferred approach, in some case you may
    # need to place data files outside of your packages. See:
    # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
    # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
    # data_files=[('my_data', ['data/data_file'])],
    data_files=[],

    # To provide executable scripts, use entry points in preference to the
    # "scripts" keyword. Entry points provide cross-platform support and allow
    # pip to create the appropriate form of executable for the target platform.
    entry_points={
        'console_scripts': [
            'mypackage-run=mypackage:main',
        ],
    },
)


问:
Filtering table with multiple filters
I've got the following javascript which takes the input of a form element, and hides table rows that do not qualify with the search term.

```<code><script>
    function wo_search(filter, column) {
        // Declare variables
        var input, table, tr, td, i;
        input = document.getElementById("wo_search_type");
        table = document.getElementById("work_order");
        tr = table.getElementsByTagName("tr");

        for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[column];
            if (td) {
                if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                    tr[i].style.display = "";
                } else {
                    tr[i].style.display = "none";
                }
            }
        }
    }
</script>
</code>```

The problem is, my table has 7 search terms, not just one. With my current code, only 1 filter works at a time. When one filter is selected, it will hide the correct elements in the table. As soon as a user selects a 2nd filter, the first filter is nullified, basically all of the data that was hidden by that filter is shown again before applying the filter from the 2nd term selected.

How can I make it so that all of the filters are applied together?

P.S

This is how the filter function is called based on what type of input it is, there are regular text inputs and select boxes.

Select boxes use onchange="wo_search(this.value.toUpperCase(), 0)", the 2nd parameter being the table column id.

Input text uses onkeyup="wo_search(this.value.toUpperCase(), 0)", the 2nd parameter being the table column id.

EDIT:
I don't think I was clear in my initial post, and I apologize for that, but there are 7 different inputs that I am trying to make the table filter for.

Basically, on the table, there is a row at the very top (Above the headers), that just contain an input box (Select or text input) that need to filter that specific column of the table.

Every column has it's own filter. Here is a screenshot:

I'm thinking this may be easier to do with jquery, so jquery answers are also welcome.

答:
After talking in the comments of my original answer, here is what I got. Please check to see if this is what you need.

Edit

I had forgotten to lower-case the text that was being tested against the filter, which caused some funky results.

document.addEventListener('DOMContentLoaded', function() {
  var filters = [];
  //the array of current filters;
  var table_data = document.querySelectorAll('#filter-me tbody tr');
  //Gets all table rows in the filter me table

  //Adds an event listener to the filters list element
  document.querySelector('#filter-list').addEventListener('click', function(e) {

    if (!e.target.classList.contains('filter-item')) return false;
    var index = parseInt(e.target.getAttribute('data-index'));
    filters.splice(index, 1);
    update_filters();
    run_filters();
  })

  function value_change(column, e) {
    var action = false;
    //No action has been run

    if (e.type == 'keypress') {
      //if the action type is keypress, check to see if we have hit enter AND the value is not empty
      if (e.keyCode == 13 && this.value != '') {
        filters.push({
          column: column,
          filter: this.value.toLowerCase()
        });
        //reset the value
        this.value = '';
        //we have done something through this event, therefore we have action
        action = true;
      }
    } else if (e.type = 'change') {
      //If the event is change, simply push the column index + this select's value
      filters.push({
        column: column,
        filter: this.value.toLowerCase()
      });
      //Again, action is true
      action = true;
    }
    if (action) {
      //Since we have action, we need to update the filters list and run the filters against the table.
      update_filters();
      run_filters();
    }
  }

  //This line is sort of a mess:
  //create an empty array, call the slice method on it, binding it to the document.querySelectorAll('.column-filter') NodeList object
  //loop through each with the actual DOM node itself + it's index
  [].slice.call(document.querySelectorAll('.column-filter')).forEach((filter, i) => {
    filter.addEventListener(filter.tagName.toLowerCase() == 'input' ? 'keypress' : 'change', value_change.bind(filter, i));
    //add the event listener to the correct type -- you may want to be more exact depending on your circumstances on this one to determine which event is added
    //Bind the value_change function to the element, but passing the first element as the index from the element of the nodelist.
  });

  function update_filters() {
    document.querySelector('#filter-list').innerHTML = "";
    //remove all elements;
    var els = filters.map((filter, i) => '' + filter.filter + '');
    //creates a fake span item here
    document.querySelector('#filter-list').innerHTML = els.join('');
    //joins everything with an empty space and sets the innerHTML to the result
  } // end update_filters

  function run_filters() {
    for (var i = 0, row, tds; row = table_data[i]; i++) {
      //get only the TD elements
      tds = row.querySelectorAll('td');
      //in order for a row to run, every filter must match.
      var pass = filters.every(filter => {
        return tds[filter.column].innerText.toLowerCase().indexOf(filter.filter) != -1;
        //for the filter to match, the TD element in the corresponding column must contain the text
      });
      row.style.display = pass ? '' : 'none'; //if pass, no display styles are added; otherwise, hide them.
    }

  } //end run_filters

});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#filter-list {
  display: inline-block;
}

#filter-list span.filter-item {
  display: inline-block;
  background-color: aqua;
  padding: 3px 6px;
  cursor: pointer;
}

#filter-list span.filter-item+span.filter-item {
  margin-left: 5px;
}

#filter-list span.filter-item::after {
  content: 'x';
  margin-left: 4px;
  padding-left: 4px;
  border-left: 1px solid grey;
}</code>```

        <select class="column-filter">
          <option value=""> </option>
          <option value="lorem">Lorem</option>
          <option value="illum">Illum</option>
        </select>

      <input type="search" placeholder="Filter" class="column-filter">
      <input type="search" placeholder="Filter" class="column-filter">
      <input type="search" placeholder="Filter" class="column-filter">
      <input type="search" placeholder="Filter" class="column-filter">

      Lorem, ipsum.
      Dolores, tempora?
      Tempore, soluta?
      Commodi, illum!
      Laudantium, debitis!

      Lorem ipsum dolor sit amet.
      Magni aspernatur eveniet amet. Eos.
      Doloribus numquam at nisi fuga.
      Exercitationem libero saepe iusto labore!
      Quod, debitis. Hic, eius voluptates?

      Excepturi aspernatur quia sequi labore.
      Ad tempore laudantium sed temporibus.
      Officia accusamus architecto perferendis quod?
      Laudantium facilis numquam quas iusto!
      Doloribus tenetur deleniti voluptatum alias.

      Ratione suscipit quis repudiandae ipsam!
      Repellendus blanditiis iure vel delectus.
      Sunt debitis voluptatum consectetur aliquam!
      Libero expedita odio maiores optio!
      Nam molestias delectus quam porro.

      Earum delectus sint ab error?
      Dicta ipsam facilis optio aliquam?
      Blanditiis eligendi sit ad accusamus?
      Sequi laborum illo eos incidunt?
      Necessitatibus iure sequi eaque quam!

      Illum aspernatur fuga laborum ratione!
      Maiores, excepturi! Dolorum, aspernatur mollitia.
      Labore corrupti itaque provident adipisci.
      Ipsum ducimus earum minus fuga.
      Necessitatibus rerum molestias autem libero.

      Nemo omnis similique labore minima!
      Dolore dolores saepe ea adipisci.
      Voluptate iusto in unde quas.
      Quod aperiam sit ut iusto.
      Quidem quisquam cupiditate dolor officiis.

      Officia numquam aliquam qui nulla.
      Laboriosam repellendus soluta aliquid similique.
      Veritatis, neque porro? Quae, quia?
      Magnam vel autem ad blanditiis!
      Laboriosam, a. Sunt, suscipit deserunt!

      Aspernatur iste saepe beatae nam.
      Ducimus quisquam corrupti quam inventore?
      Sit ullam minus possimus quidem!
      Officiis laborum laudantium veritatis et!
      Impedit dignissimos dolores maxime sequi.

      Neque similique cum sequi unde!
      Voluptatibus, ad? Ullam, facilis cumque.
      Enim in magnam id illo!
      Ex nobis quidem voluptatem voluptate.
      Eligendi esse ipsa ipsam omnis!

      Neque, fugit. Tempora, voluptates vel.
      Officia cupiditate dolores magni sunt?
      Eveniet tempore illo ipsa? Non.
      Possimus repellendus eligendi ipsam necessitatibus!
      Quisquam natus eos omnis ea.

      Aliquam voluptas recusandae et animi?
      Quis distinctio officiis quisquam dolores.
      Repellendus suscipit vero delectus hic.
      Quae asperiores temporibus impedit quis.
      Temporibus ipsa quidem magnam odio.

      Voluptatem optio quas nesciunt debitis!
      Hic mollitia alias laborum accusantium?
      Obcaecati eaque corrupti aperiam culpa!
      Voluptatum sequi sed numquam eos!
      Laborum exercitationem deleniti quaerat dolorem.

      Modi nam asperiores totam excepturi.
      Quod ipsa dolorem magni labore.
      Qui quidem quod eum quasi!
      Explicabo, ut eveniet. Quos, nam?
      Harum fugit sequi blanditiis accusamus.

      Ullam dolores vel natus in?
      Dolor velit dolorum quos error!
      Obcaecati blanditiis natus aperiam esse.
      Consequatur quasi qui minima laboriosam.
      Voluptatum, et atque. Iste, earum?

      Voluptate esse placeat doloribus hic?
      Dolorum velit ab incidunt quam.
      Laboriosam facere sed quia nisi.
      Saepe ex officia libero beatae?
      Ipsam ab distinctio assumenda itaque!

      Perferendis facere natus accusantium ut.
      Ipsam possimus dolores corporis totam!
      Ab officia rerum tempora ipsum.
      Id, soluta neque! Voluptatibus, id.
      Eaque enim fugiat corporis velit!

      Voluptatum cum atque eos quod.
      Esse corporis mollitia voluptatem ipsum.
      Corrupti unde inventore similique ad?
      Blanditiis dolorum molestiae minus tempore.
      Temporibus nihil doloremque quibusdam! Voluptatem!

      Iste voluptates iusto facilis cum?
      At est necessitatibus architecto repellendus?
      Officia qui soluta veniam nemo.
      Nobis cupiditate officiis reiciendis possimus.
      Voluptatibus quidem assumenda adipisci quis.

      Illum voluptatibus reprehenderit repellendus nostrum?
      Distinctio natus harum est nulla?
      Temporibus sit consequatur delectus ducimus.
      Veniam possimus qui fugiat temporibus.
      Delectus tenetur asperiores quasi perspiciatis.

      Quod atque ut doloribus libero?
      Animi assumenda praesentium alias accusantium!
      Labore ex optio eveniet architecto.
      Eaque delectus nemo fugiat dolorum.
      Atque, delectus. Obcaecati, saepe veritatis.

```

Title: Filtering table with multiple filters

Body:
I've got the following javascript which takes the input of a form element, and hides table rows that do not qualify with the search term.

The problem is, my table has 7 search terms, not just one. With my current code, only 1 filter works at a time. When one filter is selected, it will hide the correct elements in the table. As soon as a user selects a 2nd filter, the first filter is nullified, basically all of the data that was hidden by that filter is shown again before applying the filter from the 2nd term selected.

How can I make it so that all of the filters are applied together?

P.S

This is how the filter function is called based on what type of input it is, there are regular text inputs and select boxes.

Select boxes use onchange="wo_search(this.value.toUpperCase(), 0)", the 2nd parameter being the table column id.

Input text uses onkeyup="wo_search(this.value.toUpperCase(), 0)", the 2nd parameter being the table column id.

EDIT:
I don't think I was clear in my initial post, and I apologize for that, but there are 7 different inputs that I am trying to make the table filter for.

Basically, on the table, there is a row at the very top (Above the headers), that just contain an input box (Select or text input) that need to filter that specific column of the table.

Every column has it's own filter. Here is a screenshot:

I'm thinking this may be easier to do with jquery, so jquery answers are also welcome.

Body:
After talking in the comments of my original answer, here is what I got. Please check to see if this is what you need.

Edit

I had forgotten to lower-case the text that was being tested against the filter, which caused some funky results.

document.addEventListener('DOMContentLoaded', function() {
  var filters = [];
  //the array of current filters;
  var table_data = document.querySelectorAll('#filter-me tbody tr');
  //Gets all table rows in the filter me table

  //Adds an event listener to the filters list element
  document.querySelector('#filter-list').addEventListener('click', function(e) {

    if (!e.target.classList.contains('filter-item')) return false;
    var index = parseInt(e.target.getAttribute('data-index'));
    filters.splice(index, 1);
    update_filters();
    run_filters();
  })

  function value_change(column, e) {
    var action = false;
    //No action has been run

    if (e.type == 'keypress') {
      //if the action type is keypress, check to see if we have hit enter AND the value is not empty
      if (e.keyCode == 13 && this.value != '') {
        filters.push({
          column: column,
          filter: this.value.toLowerCase()
        });
        //reset the value
        this.value = '';
        //we have done something through this event, therefore we have action
        action = true;
      }
    } else if (e.type = 'change') {
      //If the event is change, simply push the column index + this select's value
      filters.push({
        column: column,
        filter: this.value.toLowerCase()
      });
      //Again, action is true
      action = true;
    }
    if (action) {
      //Since we have action, we need to update the filters list and run the filters against the table.
      update_filters();
      run_filters();
    }
  }

  //This line is sort of a mess:
  //create an empty array, call the slice method on it, binding it to the document.querySelectorAll('.column-filter') NodeList object
  //loop through each with the actual DOM node itself + it's index
  [].slice.call(document.querySelectorAll('.column-filter')).forEach((filter, i) => {
    filter.addEventListener(filter.tagName.toLowerCase() == 'input' ? 'keypress' : 'change', value_change.bind(filter, i));
    //add the event listener to the correct type -- you may want to be more exact depending on your circumstances on this one to determine which event is added
    //Bind the value_change function to the element, but passing the first element as the index from the element of the nodelist.
  });

  function update_filters() {
    document.querySelector('#filter-list').innerHTML = "";
    //remove all elements;
    var els = filters.map((filter, i) => '<span class="filter-item" data-index="' + i + '">' + filter.filter + '</span>');
    //creates a fake span item here
    document.querySelector('#filter-list').innerHTML = els.join('');
    //joins everything with an empty space and sets the innerHTML to the result
  } // end update_filters

  function run_filters() {
    for (var i = 0, row, tds; row = table_data[i]; i++) {
      //get only the TD elements
      tds = row.querySelectorAll('td');
      //in order for a row to run, every filter must match.
      var pass = filters.every(filter => {
        return tds[filter.column].innerText.toLowerCase().indexOf(filter.filter) != -1;
        //for the filter to match, the TD element in the corresponding column must contain the text
      });
      row.style.display = pass ? '' : 'none'; //if pass, no display styles are added; otherwise, hide them.
    }

  } //end run_filters

});

#filter-list {
  display: inline-block;
}

#filter-list span.filter-item {
  display: inline-block;
  background-color: aqua;
  padding: 3px 6px;
  cursor: pointer;
}

#filter-list span.filter-item+span.filter-item {
  margin-left: 5px;
}

#filter-list span.filter-item::after {
  content: 'x';
  margin-left: 4px;
  padding-left: 4px;
  border-left: 1px solid grey;
}

<table id="filter-me" class="table">
  <caption id="filter-list"></caption>
  <thead>
    <tr>
      <th>
        <select class="column-filter">
          <option value="">&nbsp;</option>
          <option value="lorem">Lorem</option>
          <option value="illum">Illum</option>
        </select>
      </th>
      <th><input type="search" placeholder="Filter" class="column-filter"></th>
      <th><input type="search" placeholder="Filter" class="column-filter"></th>
      <th><input type="search" placeholder="Filter" class="column-filter"></th>
      <th><input type="search" placeholder="Filter" class="column-filter"></th>
    </tr>
    <tr>
      <th>Lorem, ipsum. <span class="arrow-up">&nbsp;</span></th>
      <th>Dolores, tempora?</th>
      <th>Tempore, soluta?</th>
      <th>Commodi, illum!</th>
      <th>Laudantium, debitis!</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Lorem ipsum dolor sit amet.</td>
      <td>Magni aspernatur eveniet amet. Eos.</td>
      <td>Doloribus numquam at nisi fuga.</td>
      <td>Exercitationem libero saepe iusto labore!</td>
      <td>Quod, debitis. Hic, eius voluptates?</td>
    </tr>
    <tr>
      <td>Excepturi aspernatur quia sequi labore.</td>
      <td>Ad tempore laudantium sed temporibus.</td>
      <td>Officia accusamus architecto perferendis quod?</td>
      <td>Laudantium facilis numquam quas iusto!</td>
      <td>Doloribus tenetur deleniti voluptatum alias.</td>
    </tr>
    <tr>
      <td>Ratione suscipit quis repudiandae ipsam!</td>
      <td>Repellendus blanditiis iure vel delectus.</td>
      <td>Sunt debitis voluptatum consectetur aliquam!</td>
      <td>Libero expedita odio maiores optio!</td>
      <td>Nam molestias delectus quam porro.</td>
    </tr>
    <tr>
      <td>Earum delectus sint ab error?</td>
      <td>Dicta ipsam facilis optio aliquam?</td>
      <td>Blanditiis eligendi sit ad accusamus?</td>
      <td>Sequi laborum illo eos incidunt?</td>
      <td>Necessitatibus iure sequi eaque quam!</td>
    </tr>
    <tr>
      <td>Illum aspernatur fuga laborum ratione!</td>
      <td>Maiores, excepturi! Dolorum, aspernatur mollitia.</td>
      <td>Labore corrupti itaque provident adipisci.</td>
      <td>Ipsum ducimus earum minus fuga.</td>
      <td>Necessitatibus rerum molestias autem libero.</td>
    </tr>
    <tr>
      <td>Nemo omnis similique labore minima!</td>
      <td>Dolore dolores saepe ea adipisci.</td>
      <td>Voluptate iusto in unde quas.</td>
      <td>Quod aperiam sit ut iusto.</td>
      <td>Quidem quisquam cupiditate dolor officiis.</td>
    </tr>
    <tr>
      <td>Officia numquam aliquam qui nulla.</td>
      <td>Laboriosam repellendus soluta aliquid similique.</td>
      <td>Veritatis, neque porro? Quae, quia?</td>
      <td>Magnam vel autem ad blanditiis!</td>
      <td>Laboriosam, a. Sunt, suscipit deserunt!</td>
    </tr>
    <tr>
      <td>Aspernatur iste saepe beatae nam.</td>
      <td>Ducimus quisquam corrupti quam inventore?</td>
      <td>Sit ullam minus possimus quidem!</td>
      <td>Officiis laborum laudantium veritatis et!</td>
      <td>Impedit dignissimos dolores maxime sequi.</td>
    </tr>
    <tr>
      <td>Neque similique cum sequi unde!</td>
      <td>Voluptatibus, ad? Ullam, facilis cumque.</td>
      <td>Enim in magnam id illo!</td>
      <td>Ex nobis quidem voluptatem voluptate.</td>
      <td>Eligendi esse ipsa ipsam omnis!</td>
    </tr>
    <tr>
      <td>Neque, fugit. Tempora, voluptates vel.</td>
      <td>Officia cupiditate dolores magni sunt?</td>
      <td>Eveniet tempore illo ipsa? Non.</td>
      <td>Possimus repellendus eligendi ipsam necessitatibus!</td>
      <td>Quisquam natus eos omnis ea.</td>
    </tr>
    <tr>
      <td>Aliquam voluptas recusandae et animi?</td>
      <td>Quis distinctio officiis quisquam dolores.</td>
      <td>Repellendus suscipit vero delectus hic.</td>
      <td>Quae asperiores temporibus impedit quis.</td>
      <td>Temporibus ipsa quidem magnam odio.</td>
    </tr>
    <tr>
      <td>Voluptatem optio quas nesciunt debitis!</td>
      <td>Hic mollitia alias laborum accusantium?</td>
      <td>Obcaecati eaque corrupti aperiam culpa!</td>
      <td>Voluptatum sequi sed numquam eos!</td>
      <td>Laborum exercitationem deleniti quaerat dolorem.</td>
    </tr>
    <tr>
      <td>Modi nam asperiores totam excepturi.</td>
      <td>Quod ipsa dolorem magni labore.</td>
      <td>Qui quidem quod eum quasi!</td>
      <td>Explicabo, ut eveniet. Quos, nam?</td>
      <td>Harum fugit sequi blanditiis accusamus.</td>
    </tr>
    <tr>
      <td>Ullam dolores vel natus in?</td>
      <td>Dolor velit dolorum quos error!</td>
      <td>Obcaecati blanditiis natus aperiam esse.</td>
      <td>Consequatur quasi qui minima laboriosam.</td>
      <td>Voluptatum, et atque. Iste, earum?</td>
    </tr>
    <tr>
      <td>Voluptate esse placeat doloribus hic?</td>
      <td>Dolorum velit ab incidunt quam.</td>
      <td>Laboriosam facere sed quia nisi.</td>
      <td>Saepe ex officia libero beatae?</td>
      <td>Ipsam ab distinctio assumenda itaque!</td>
    </tr>
    <tr>
      <td>Perferendis facere natus accusantium ut.</td>
      <td>Ipsam possimus dolores corporis totam!</td>
      <td>Ab officia rerum tempora ipsum.</td>
      <td>Id, soluta neque! Voluptatibus, id.</td>
      <td>Eaque enim fugiat corporis velit!</td>
    </tr>
    <tr>
      <td>Voluptatum cum atque eos quod.</td>
      <td>Esse corporis mollitia voluptatem ipsum.</td>
      <td>Corrupti unde inventore similique ad?</td>
      <td>Blanditiis dolorum molestiae minus tempore.</td>
      <td>Temporibus nihil doloremque quibusdam! Voluptatem!</td>
    </tr>
    <tr>
      <td>Iste voluptates iusto facilis cum?</td>
      <td>At est necessitatibus architecto repellendus?</td>
      <td>Officia qui soluta veniam nemo.</td>
      <td>Nobis cupiditate officiis reiciendis possimus.</td>
      <td>Voluptatibus quidem assumenda adipisci quis.</td>
    </tr>
    <tr>
      <td>Illum voluptatibus reprehenderit repellendus nostrum?</td>
      <td>Distinctio natus harum est nulla?</td>
      <td>Temporibus sit consequatur delectus ducimus.</td>
      <td>Veniam possimus qui fugiat temporibus.</td>
      <td>Delectus tenetur asperiores quasi perspiciatis.</td>
    </tr>
    <tr>
      <td>Quod atque ut doloribus libero?</td>
      <td>Animi assumenda praesentium alias accusantium!</td>
      <td>Labore ex optio eveniet architecto.</td>
      <td>Eaque delectus nemo fugiat dolorum.</td>
      <td>Atque, delectus. Obcaecati, saepe veritatis.</td>
    </tr>
  </tbody>
</table>


问:
Splitting string on commas when data can contain commas
I have a CSV file (which I didn't design and I can't change now nor will I ever be able to change it) that contains lines like the following:

"Surname, Firstname", yes, no, somestring, whatever, etc

As you can see here, the first , is not a comma on which I'd want to split the string. Notice that this particular comma is enclosed within the quotation marks.

Because of this, a simple string.split(',') obviously won't work, as it would give me an array of length 7 for the above string instead of 6.

Is there a way to get around this? I was thinking of using regex to split the string instead but I'm not competent enough in regex to think of a pattern that would only split on commas that are not enclosed inside quotation marks.

I can think of ugly, hacky ways to do it by reading each string char by char but this would have to be a last resort as I'm sure there's a better way to do it!

答:
I know there's a lot of people here who think character-by-character comparisons should never be used and will strongly disagree with me but I'm not convinced companies like Microsoft aren't the only ones who should be doing that sort of programming.

Afterall, Split does character-by-character comparisons so why is it any less ugly when you call existing code that doesn't quite do exactly what you want?

At any rate, my approach was to write my own code. And I've posted the code online at http://www.blackbeltcoder.com/Articles/files/reading-and-writing-csv-files-in-c.


问:
six 1.4.1 is installed but six>=1.5.2 is required by set(['OpenSSL']) in mac OS sierra
I am trying to install Twilio using sudo pip install twilio but it fails with below error logs:

```<code>Processing dependencies for twilio
error: six 1.4.1 is installed but six>=1.5.2 is required by set(['pyOpenSSL'])
</code>```

I also tried sudo easy_install twilio.

Is it OS restriction?
I am first time using python.

答:
I tried below command and it works.</p>

```<code>sudo pip install twilio --ignore-installed six
</code>```

Body:
I am trying to install Twilio using sudo pip install twilio but it fails with below error logs:

Processing dependencies for twilio
error: six 1.4.1 is installed but six>=1.5.2 is required by set(['pyOpenSSL'])

I also tried sudo easy_install twilio.

Is it OS restriction?
I am first time using python.

Body:
I tried below command and it works.

sudo pip install twilio --ignore-installed six


问:
How to add Onclick listener to recycler view
I am developing a simple notepad app first i used listView to show all the notes.But now I am using RecyclerView. While i am using listview i used OnItemClickListener to pass the Data to another activity for editing the note
now i am confuse what to do in Recylerview

For listView i am using this

```<code> listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            name = filenames.get(position).getName();
            note = filenames.get(position).getShorttext();
            Alert(); // this method is in main activity

        }
    });*/

  public void Alert()
   {
    final AlertDialog dialog;
    View mview = getLayoutInflater().inflate(R.layout.dialog_pass,null);
    final EditText mEdittext = (EditText) mview.findViewById(R.id.Epass);
    AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
    mBuilder.setView(mview);
    mBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String col = mEdittext.getText().toString();
            String password = dBhelper.searchpass(col);
            if (col.equals(password)) {
                Intent intent =  new Intent(MainActivity.this,Note2.class);
                intent.putExtra("Name",name);
                intent.putExtra("Note",note);
                startActivity(intent);
            } else {
                Toast temp = Toast.makeText(MainActivity.this, "Password does not match", Toast.LENGTH_SHORT);
                temp.show();
            }

        }
    });
    mBuilder.setNegativeButton("Cancel",null);
    mBuilder.setCancelable(false);
    dialog = mBuilder.create();
    dialog.show();

     }
</code>```

Now What Should i Do for Recycle View Please Help

```<code>  public class RecycleViewAdapter extends
  RecyclerView.Adapter<RecycleViewHolder> {// Recyclerview will extend to
  private List<FileName> fileNames;
  private Context context;

  public RecycleViewAdapter(Context context,List<FileName> fileNames) {
    this.context = context;
    this.fileNames = fileNames;
</code>```

}

```<code>@Override
public RecycleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LayoutInflater mInflater = LayoutInflater.from(parent.getContext());

    ViewGroup mainGroup = (ViewGroup) mInflater.inflate(
            R.layout.grid_item, parent, false);
    RecycleViewHolder listHolder = new RecycleViewHolder(mainGroup);
    return listHolder;

}

@Override
public void onBindViewHolder(RecycleViewHolder holder, final int position) {
    final FileName model = fileNames.get(position);
    RecycleViewHolder mainHolder = (RecycleViewHolder) holder;// holder
    mainHolder.title.setText(model.getName());
    mainHolder.note.setText(model.getShorttext());

}

@Override
public int getItemCount() {
    return (null != fileNames ? fileNames.size() : 0);
  }
</code>```

答:
First add this class to your package

```<code>public class MyTouchListener implements RecyclerView.OnItemTouchListener {

/*Change these as per your need*/
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private static final int SWIPE_MAX_OFF_PATH = 250;

private OnTouchActionListener mOnTouchActionListener;
private GestureDetectorCompat mGestureDetector;

public static interface OnTouchActionListener {
    public void onLeftSwipe(View view, int position);
    public void onRightSwipe(View view, int position);
    public void onClick(View view, int position);
}

public MyTouchListener(Context context, final RecyclerView recyclerView,
                             OnTouchActionListener onTouchActionListener){

    mOnTouchActionListener = onTouchActionListener;
    mGestureDetector = new GestureDetectorCompat(context,new GestureDetector.SimpleOnGestureListener(){

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            // Find the item view that was swiped based on the coordinates
            View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
            int childPosition = recyclerView.getChildPosition(child);
            mOnTouchActionListener.onClick(child, childPosition);
            return false;
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2,
                               float velocityX, float velocityY) {

            try {
                if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) {
                    return false;
                }

                // Find the item view that was swiped based on the coordinates
                View child = recyclerView.findChildViewUnder(e1.getX(), e1.getY());
                int childPosition = recyclerView.getChildPosition(child);

                // right to left swipe
                if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

                    if (mOnTouchActionListener != null && child != null) {
                        mOnTouchActionListener.onLeftSwipe(child, childPosition);
                    }

                } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                    if (mOnTouchActionListener != null && child != null) {
                        mOnTouchActionListener.onRightSwipe(child, childPosition);
                    }
                }
            } catch (Exception e) {
                // nothing
            }

            return false;
        }
    });
}

@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    mGestureDetector.onTouchEvent(e);
    return false;
}

@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}

@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
    // do nothing
}}
</code>```

Then addOnItemTouchListener like this:

```<code>myRecyclerView.addOnItemTouchListener(new MyTouchListener(mContext,
            myRecyclerView,
            new MyTouchListener.OnTouchActionListener() {
                @Override
                public void onLeftSwipe(View view, int position) {//code as per your need
                }

                @Override
                public void onRightSwipe(View view, int position) {//code as per your need
                }

                @Override
                public void onClick(View view, int position) {//code as per your need
                }
            }));
</code>```

Body:
I am developing a simple notepad app first i used listView to show all the notes.But now I am using RecyclerView. While i am using listview i used OnItemClickListener to pass the Data to another activity for editing the note
now i am confuse what to do in Recylerview

For listView i am using this

 listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            name = filenames.get(position).getName();
            note = filenames.get(position).getShorttext();
            Alert(); // this method is in main activity

        }
    });*/

  public void Alert()
   {
    final AlertDialog dialog;
    View mview = getLayoutInflater().inflate(R.layout.dialog_pass,null);
    final EditText mEdittext = (EditText) mview.findViewById(R.id.Epass);
    AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
    mBuilder.setView(mview);
    mBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String col = mEdittext.getText().toString();
            String password = dBhelper.searchpass(col);
            if (col.equals(password)) {
                Intent intent =  new Intent(MainActivity.this,Note2.class);
                intent.putExtra("Name",name);
                intent.putExtra("Note",note);
                startActivity(intent);
            } else {
                Toast temp = Toast.makeText(MainActivity.this, "Password does not match", Toast.LENGTH_SHORT);
                temp.show();
            }

        }
    });
    mBuilder.setNegativeButton("Cancel",null);
    mBuilder.setCancelable(false);
    dialog = mBuilder.create();
    dialog.show();

     }

Now What Should i Do for Recycle View Please Help

  public class RecycleViewAdapter extends
  RecyclerView.Adapter<RecycleViewHolder> {// Recyclerview will extend to
  private List<FileName> fileNames;
  private Context context;

  public RecycleViewAdapter(Context context,List<FileName> fileNames) {
    this.context = context;
    this.fileNames = fileNames;

}

@Override
public RecycleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LayoutInflater mInflater = LayoutInflater.from(parent.getContext());

    ViewGroup mainGroup = (ViewGroup) mInflater.inflate(
            R.layout.grid_item, parent, false);
    RecycleViewHolder listHolder = new RecycleViewHolder(mainGroup);
    return listHolder;

}

@Override
public void onBindViewHolder(RecycleViewHolder holder, final int position) {
    final FileName model = fileNames.get(position);
    RecycleViewHolder mainHolder = (RecycleViewHolder) holder;// holder
    mainHolder.title.setText(model.getName());
    mainHolder.note.setText(model.getShorttext());

}

@Override
public int getItemCount() {
    return (null != fileNames ? fileNames.size() : 0);
  }

Body:
First add this class to your package

public class MyTouchListener implements RecyclerView.OnItemTouchListener {

/*Change these as per your need*/
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private static final int SWIPE_MAX_OFF_PATH = 250;

private OnTouchActionListener mOnTouchActionListener;
private GestureDetectorCompat mGestureDetector;

public static interface OnTouchActionListener {
    public void onLeftSwipe(View view, int position);
    public void onRightSwipe(View view, int position);
    public void onClick(View view, int position);
}

public MyTouchListener(Context context, final RecyclerView recyclerView,
                             OnTouchActionListener onTouchActionListener){

    mOnTouchActionListener = onTouchActionListener;
    mGestureDetector = new GestureDetectorCompat(context,new GestureDetector.SimpleOnGestureListener(){

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            // Find the item view that was swiped based on the coordinates
            View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
            int childPosition = recyclerView.getChildPosition(child);
            mOnTouchActionListener.onClick(child, childPosition);
            return false;
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2,
                               float velocityX, float velocityY) {

            try {
                if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) {
                    return false;
                }

                // Find the item view that was swiped based on the coordinates
                View child = recyclerView.findChildViewUnder(e1.getX(), e1.getY());
                int childPosition = recyclerView.getChildPosition(child);

                // right to left swipe
                if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

                    if (mOnTouchActionListener != null && child != null) {
                        mOnTouchActionListener.onLeftSwipe(child, childPosition);
                    }

                } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                    if (mOnTouchActionListener != null && child != null) {
                        mOnTouchActionListener.onRightSwipe(child, childPosition);
                    }
                }
            } catch (Exception e) {
                // nothing
            }

            return false;
        }
    });
}

@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    mGestureDetector.onTouchEvent(e);
    return false;
}

@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}

@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
    // do nothing
}}

Then addOnItemTouchListener like this:

myRecyclerView.addOnItemTouchListener(new MyTouchListener(mContext,
            myRecyclerView,
            new MyTouchListener.OnTouchActionListener() {
                @Override
                public void onLeftSwipe(View view, int position) {//code as per your need
                }

                @Override
                public void onRightSwipe(View view, int position) {//code as per your need
                }

                @Override
                public void onClick(View view, int position) {//code as per your need
                }
            }));


问:
Aspnet Boilerplate / Aspnet Zero slow (IoC)
I use the aspnetboilerplate/aspnetzero template for my Multi-Tenant SaaS application with Multi-Database.
This uses CastleWindsor as DI Framework.

I experience very bad performance and I tracked it down with dotTrace - it says that Castle.MicroKernel is the most active code.

My requests take about 5-6 seconds and most of the time passes before it even hits the controller. (while debugging)
I think that resolving all services/controllers is slow. I changed some dependencies (App-Services) from Transient to PerWebRequestLifetime but it didn't affect performance.

Does anyone know, how I can get better performance?

In my Views (_Layout file) I call several different Childactions, that are on Layoutcontroller, this Controller gets following Services injected:

```<code>     public LayoutController(
        IPerSessionCache sessionCache,
        IUserNavigationManager userNavigationManager,
        IMultiTenancyConfig multiTenancyConfig,
        ILanguageManager languageManager,
        ITenancyNameFinder tenancyNameFinder,
        TenantManager tenantManager,
        IUserLinkAppService userLinkAppService,
        UserManager userManager)
</code>```

Actions are

```<code>[ChildActionOnly]
    public PartialViewResult AppHeader()
    {
        var headerModel = new Areas.Mpa.Models.Layout.HeaderViewModel
        {
            LoginInformations = AsyncHelper.RunSync(_sessionCache.GetCurrentLoginInformationsAsync),
            Languages = _languageManager.GetLanguages(),
            CurrentLanguage = _languageManager.CurrentLanguage,
            IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled,
            IsImpersonatedLogin = AbpSession.ImpersonatorUserId.HasValue,
            HasLinkedAccounts = AsyncHelper.RunSync(_userLinkAppService.HasLinkedAccounts)
        };

        return PartialView("~/Views/Layout/_AppHeader.cshtml", headerModel);
    }

[ChildActionOnly]
    public PartialViewResult AppNavbar(string currentPageName = "")
    {
        var sidebarModel = new Areas.Mpa.Models.Layout.NavbarViewModel
        {
            Menu = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync(MeNavigationProvider.MenuName, AbpSession.ToUserIdentifier())),
            CurrentPageName = currentPageName
        };

        return PartialView("_AppNavbar", sidebarModel);
    }
</code>```

and similar ones...But I checked the performance with an empty Layout File but my requests still take way too long

答:
ASP.NET Boilerplate performance benchmark results

We created 2 identical simple application: One with ABP (https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/TestProjects/AbpPerformanceTestApp)

and other without ABP (https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/TestProjects/StandartTestApp)

Used Frameworks

ASP.NET Core 1.x

EF Core 1.x

Test Tool

We used jMeter for tests.

Test Results

Without ABP

With ABP

As seen in the statistics, ABP has added average 5ms overhead on top of a default asp.net code. Since this overhead is CPU usage, throughput is average 5% different.

We disabled Logging and Transaction of ABP for a better comparison (Logging especially effects performance since it uses I/O). Other aspects, filters and features are enabled as by default.

Body:
I use the aspnetboilerplate/aspnetzero template for my Multi-Tenant SaaS application with Multi-Database.
This uses CastleWindsor as DI Framework.

I experience very bad performance and I tracked it down with dotTrace - it says that Castle.MicroKernel is the most active code.

My requests take about 5-6 seconds and most of the time passes before it even hits the controller. (while debugging)
I think that resolving all services/controllers is slow. I changed some dependencies (App-Services) from Transient to PerWebRequestLifetime but it didn't affect performance.

Does anyone know, how I can get better performance?

In my Views (_Layout file) I call several different Childactions, that are on Layoutcontroller, this Controller gets following Services injected:

     public LayoutController(
        IPerSessionCache sessionCache,
        IUserNavigationManager userNavigationManager,
        IMultiTenancyConfig multiTenancyConfig,
        ILanguageManager languageManager,
        ITenancyNameFinder tenancyNameFinder,
        TenantManager tenantManager,
        IUserLinkAppService userLinkAppService,
        UserManager userManager)

Actions are

[ChildActionOnly]
    public PartialViewResult AppHeader()
    {
        var headerModel = new Areas.Mpa.Models.Layout.HeaderViewModel
        {
            LoginInformations = AsyncHelper.RunSync(_sessionCache.GetCurrentLoginInformationsAsync),
            Languages = _languageManager.GetLanguages(),
            CurrentLanguage = _languageManager.CurrentLanguage,
            IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled,
            IsImpersonatedLogin = AbpSession.ImpersonatorUserId.HasValue,
            HasLinkedAccounts = AsyncHelper.RunSync(_userLinkAppService.HasLinkedAccounts)
        };

        return PartialView("~/Views/Layout/_AppHeader.cshtml", headerModel);
    }

[ChildActionOnly]
    public PartialViewResult AppNavbar(string currentPageName = "")
    {
        var sidebarModel = new Areas.Mpa.Models.Layout.NavbarViewModel
        {
            Menu = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync(MeNavigationProvider.MenuName, AbpSession.ToUserIdentifier())),
            CurrentPageName = currentPageName
        };

        return PartialView("_AppNavbar", sidebarModel);
    }

and similar ones...But I checked the performance with an empty Layout File but my requests still take way too long


问:
How can I get android View kind programmatically?
I want to get View object programmatically.
But, not fixed View kind, like.. RadioButton..Button..
I only want to know View kind for View's properties.
Is it possible?

Please see this :

```<code>String idString = "view_from_xml_id";
int id = getResources().getIdentifier(idString, "id", getPackageName());
View iDontKnowWhat = findViewById(id);
</code>```

The [iDontKnowWhat] view object is Just View.
But, I want to cast this [iDontKnowWhat] view object to RadioButton, Button, EditText...Case by Case.

I want like this :

```<code>String idString = "view_from_xml_id";
int id = getResources().getIdentifier(idString, "id", getPackageName());
View iDontKnowWhat = findViewById(id);

if(iDontKnowWhat == RadioButton)
  // @Do something..
else if(iDontKnowWhat == EditText)
  // @Do Something..
</code>```

Can I implement it?
Please help me sir :)

答:
use like this ......

```<code>  if (iDontKnowWhat instanceof RadioButton)
               //do somethings
      else if (iDontKnowWhat instanceof EditText)
               //do somethings
      else if (iDontKnowWhat instanceof TextView)
               //do somethings
</code>```

may be this help you ...

Body:
I want to get View object programmatically.
But, not fixed View kind, like.. RadioButton..Button..
I only want to know View kind for View's properties.
Is it possible?

Please see this :

String idString = "view_from_xml_id";
int id = getResources().getIdentifier(idString, "id", getPackageName());
View iDontKnowWhat = findViewById(id);

The [iDontKnowWhat] view object is Just View.
But, I want to cast this [iDontKnowWhat] view object to RadioButton, Button, EditText...Case by Case.

I want like this :

String idString = "view_from_xml_id";
int id = getResources().getIdentifier(idString, "id", getPackageName());
View iDontKnowWhat = findViewById(id);

if(iDontKnowWhat == RadioButton)
  // @Do something..
else if(iDontKnowWhat == EditText)
  // @Do Something..

Can I implement it?
Please help me sir :)

Body:
use like this ......

  if (iDontKnowWhat instanceof RadioButton)
               //do somethings
      else if (iDontKnowWhat instanceof EditText)
               //do somethings
      else if (iDontKnowWhat instanceof TextView)
               //do somethings

may be this help you ...