问:
unit testing an async method tests assertions before method has completed
```<code>[TestMethod]
public void TestMethod1()
{
    TestClass testClass = new TestClass();
    testClass.Method();
    Assert.AreEqual(testClass.x, true);
}
</code>```

And test class:

```<code>public async void Method()
{
    if(cond)
        await InnerMethod();
}

private async Task InnerMethod()
{
    var data = await client.FetchData();
    x = data.res;
}
</code>```

I am testing an sync method which is of this format. But when i run the test, it runs through the line
 var data = await client.FetchData();

and then instead of continuing the method execution, goes into the assert statement in the test method first (fails because obviously it didnt finish the method). and THEN carries on with the rest of the method.

I am really confused why its doing this but am guessing its soemthing to do with threading. any clues as to why this behavior would be really helpful! thanks

答:
Make your test method asynchronous as well public async Task TestMethod1() and await inside the test await testClass.Method();. I'm not sure about MSTest but it works OK with xUnit.

Also as written in the comment below you should use public async Task Method1(). Read Async/Await - Best Practices in Asynchronous Programming.

Body:
[TestMethod]
public void TestMethod1()
{
    TestClass testClass = new TestClass();
    testClass.Method();
    Assert.AreEqual(testClass.x, true);
}

And test class:

public async void Method()
{
    if(cond)
        await InnerMethod();
}

private async Task InnerMethod()
{
    var data = await client.FetchData();
    x = data.res;
}

I am testing an sync method which is of this format. But when i run the test, it runs through the line
 var data = await client.FetchData();

and then instead of continuing the method execution, goes into the assert statement in the test method first (fails because obviously it didnt finish the method). and THEN carries on with the rest of the method.

I am really confused why its doing this but am guessing its soemthing to do with threading. any clues as to why this behavior would be really helpful! thanks


来源: stackexchange

问:
hibernate could not get next sequence value
i have gwt application connect to postgres DB at the backend, and a java class 'Judgement' mapping the table 'judgements' in DB, when i tried to persistent a judgement into db, it threw the following errors:

```<code>Caused by: org.hibernate.exception.SQLGrammarException: could not get next sequence value
...
Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist
</code>```

my Judgement class looks like this

```<code>@Entity
@Table(name = "JUDGEMENTS")
public class Judgement implements Serializable, Cloneable {

    private static final long serialVersionUID = -7049957706738879274L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "JUD_ID")
    private Long _judId;
...
</code>```

and my table judgements is:

```<code>   Column    |            Type             |                        Modifiers
-------------+-----------------------------+---------------------------------------------------------
 jud_id      | bigint                      | not null default nextval('judgements_id_seq'::regclass)
 rating      | character varying(255)      |
 last_update | timestamp without time zone |
 user_id     | character varying(255)      |
 id          | integer                     |
Indexes:
    "judgements_pkey" PRIMARY KEY, btree (jud_id)
Foreign-key constraints:
    "judgements_id_fkey" FOREIGN KEY (id) REFERENCES recommendations(id)
    "judgements_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(user_id)
</code>```

and i have a SEQUENCE name 'judgements_id_seq' in DB

can anyone tell me what's wrong??? thanks.

答: If using Postgres, create sequence manually with name 'hibernate_sequence'. It will work.</p>

ContentLicense: CC BY-SA 3.0

Body:
i have gwt application connect to postgres DB at the backend, and a java class 'Judgement' mapping the table 'judgements' in DB, when i tried to persistent a judgement into db, it threw the following errors:

Caused by: org.hibernate.exception.SQLGrammarException: could not get next sequence value
...
Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist

my Judgement class looks like this

@Entity
@Table(name = "JUDGEMENTS")
public class Judgement implements Serializable, Cloneable {

    private static final long serialVersionUID = -7049957706738879274L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "JUD_ID")
    private Long _judId;
...

and my table judgements is:

   Column    |            Type             |                        Modifiers
-------------+-----------------------------+---------------------------------------------------------
 jud_id      | bigint                      | not null default nextval('judgements_id_seq'::regclass)
 rating      | character varying(255)      |
 last_update | timestamp without time zone |
 user_id     | character varying(255)      |
 id          | integer                     |
Indexes:
    "judgements_pkey" PRIMARY KEY, btree (jud_id)
Foreign-key constraints:
    "judgements_id_fkey" FOREIGN KEY (id) REFERENCES recommendations(id)
    "judgements_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(user_id)

and i have a SEQUENCE name 'judgements_id_seq' in DB

can anyone tell me what's wrong??? thanks.

ContentLicense: CC BY-SA 4.0


问:
Selenium+PHPunit: foreach element in collection
I am looking for a way to work with collections of elements in Selenium with PHPunit. Let's say I have the below code:

```<code><div class="test">aaa</div>
<div class="test">bbb</div>
<div class="test">ccc</div>
</code>```

I would like to be able to work on all the
 elements inside an each loop, let's say by selecting the elements based on their class with //div[@class='test']

```<code>$divs = ...  //
foreach ($divs as $div) {
 // do something
}
</code>```

答:
In PHP, if you want to work with some HTML data, a great solution is using the DOMDocument class -- which means being able to work with DOM methods -- via its DOMDocument::loadHTML() method.

Loading your HTML with DOMDocument :

```<code>$dom = new DOMDocument();
$dom->loadHTML('HERE YOUR HTML STRING');
</code>```

You can then instanciate a DOMXpath object :

```<code>$xpath = new DOMXPath($dom);
</code>```

Which will allow you to extract data from the HTML, using XPath Queries, with DOMXPath::query() :

```<code>$entries = $xpath->query('//div[@class="test"]'); // notice quotes
if ($entries->length > 0) {
    foreach ($entries as $entry) {
        // Work on the $entry -- which is a DOM node/element
    }
}
</code>```

Body:
I am looking for a way to work with collections of elements in Selenium with PHPunit. Let's say I have the below code:

aaa

bbb

ccc

I would like to be able to work on all the
 elements inside an each loop, let's say by selecting the elements based on their class with //div[@class='test']

$divs = ...  //
foreach ($divs as $div) {
 // do something
}

Body:
In PHP, if you want to work with some HTML data, a great solution is using the DOMDocument class -- which means being able to work with DOM methods -- via its DOMDocument::loadHTML() method.

Loading your HTML with DOMDocument :

$dom = new DOMDocument();
$dom->loadHTML('HERE YOUR HTML STRING');

You can then instanciate a DOMXpath object :

$xpath = new DOMXPath($dom);

Which will allow you to extract data from the HTML, using XPath Queries, with DOMXPath::query() :

$entries = $xpath->query('//div[@class="test"]'); // notice quotes
if ($entries->length > 0) {
    foreach ($entries as $entry) {
        // Work on the $entry -- which is a DOM node/element
    }
}


问:
Is it possible to install a ".app" build file to an iPad from within Xcode, without loading the actual project file?
Without actually loading my .xcodeproj into Xcode, is it possible, from the Xcode app, to start an app install to my iPad using the .app file only, which was generated in an earlier build?

This is my last line of inquiry... I'm just looking at potential options because I don't have a paid developer account (yet) and might try to use Teamviewer to log into the remote client Mac to install via Xcode, but do not wish to reveal my project file/code on the remote machine. Installing from within Xcode purely using the .app file would solve my problem, if possible.

答:
I managed to work out a way to do it using this, this, and this. You will need the XCode command line tools, which come as part of the App Store XCode install, or you can get the command line tools only from here.

First up, download and install npm. Then install ios-deploy from the terminal,

```<code>sudo npm install -g ios-deploy --unsafe-perm --allow-root
</code>```

If you need to build from the command line, make sure you have a working XCode project which builds as you want, open a terminal and go to the directory with your .xcodeproj inside, then type:

```<code>xcodebuild -list -project <NAME>.xcodeproj/
xcodebuild -scheme <SCHEME NAME> build
</code>```

Then, or if you've already built in XCode and just want to deploy your .app file to the iOS device, type:

```<code>ios-deploy debug --bundle <APP PATH>
</code>```

You can change debug to release, or either way it will use whatever you set your XCode build configuration to be I think. The <APP PATH> location depends on your XCode install, but the most recent location (I think) is

```<code>~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/Deployment/
</code>```

This will install your .app onto the iOS device from the command line, and you don't need to load XCode up, or expose your source files. Just requires the .app file. For me, this is a potentially useful way to install an app remotely on a client's device without the need for a paid developer account.

Body:
I managed to work out a way to do it using this, this, and this. You will need the XCode command line tools, which come as part of the App Store XCode install, or you can get the command line tools only from here.

First up, download and install npm. Then install ios-deploy from the terminal,

sudo npm install -g ios-deploy --unsafe-perm --allow-root

If you need to build from the command line, make sure you have a working XCode project which builds as you want, open a terminal and go to the directory with your .xcodeproj inside, then type:

xcodebuild -list -project <NAME>.xcodeproj/
xcodebuild -scheme <SCHEME NAME> build

Then, or if you've already built in XCode and just want to deploy your .app file to the iOS device, type:

ios-deploy debug --bundle <APP PATH>

You can change debug to release, or either way it will use whatever you set your XCode build configuration to be I think. The <APP PATH> location depends on your XCode install, but the most recent location (I think) is

~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/Deployment/

This will install your .app onto the iOS device from the command line, and you don't need to load XCode up, or expose your source files. Just requires the .app file. For me, this is a potentially useful way to install an app remotely on a client's device without the need for a paid developer account.


问:
how I can count the total number of nodes List Structures in java
I'm trying to write a function to return the number of nodes in the list in java.

I have a class name waypoint, it define the point and other class named TourElement. TourElement is used to create nodes which are contain a point.

//Waypoint

```<code>public class Waypoint {
    int x  ;
    int y  ;
    public int getX()
    {
        return this.x;
    }
    public int getY()
    {
        return this.y;
    }
    public void setXY(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
</code>```

//Tour Element

```<code>public class TourElement {
 private Waypoint points;
 private TourElement next;
  public void setWaypoint( Waypoint points)
 {
   this.points = points;
 }
  public void setTourElement(TourElement next)
  {
      this.next = next;
  }
 Waypoint getWaypoint()
 {
     return this.points;
 }

 TourElement getNext()
 {
     return this.next;
 }
</code>```

// I have some trouble with getNoOfWaypoints() method, what is wrong with my code?. my method does not pass the test case :

```<code>int getNoOfWaypoints()
{
    int count = 1;
    TourElement current = getNext();
    while(current.next != null)
    {
        count++;
        System.out.println(count);
    }
    return count;
}
</code>```

//test cases are provided by my teacher

```<code>  private Waypoint createWaypoint(int x, int y) {
        Waypoint wp = new Waypoint();
        wp.setXY(x, y);
        return wp;
    }

    private TourElement createElementList(int[][] waypoints){
        assert waypoints.length > 0;
        TourElement elem = new TourElement();
        int lastIndex = waypoints.length-1;
        Waypoint wp = createWaypoint(waypoints[lastIndex][0], waypoints[lastIndex][1]);
        elem.setWaypoint(wp);
        for (int i = lastIndex-1; i >= 0 ; i--) {
            wp = createWaypoint(waypoints[i][0], waypoints[i][1]);
            elem = elem.addStart(wp);
        }
        return elem;
    }

public void testGetNoOfWaypoints_NotChangingList() {
        TourElement elem = createElementList(new int[][] {{0, 0}, {1, 1}, {2, 2}});
        int unused = elem.getNoOfWaypoints();

        assertArrayEquals(new int[] {0, 0}, elem.getWaypoint().toArray());
        assertArrayEquals(new int[] {1, 1}, elem.getNext().getWaypoint().toArray());
        assertArrayEquals(new int[] {2, 2}, elem.getNext().getNext().getWaypoint().toArray());
        assertNull(elem.getNext().getNext().getNext());
    }
</code>```

I dont know what is problem with my out put. and I really want to know how to pass the testcase. Please help me figure it out. thank u so much in advance!!

答:
Considering this is a homework, I will give you some hint as to how you can fix the problem. In the getNoOfWaypoints(), the current is checked every time but it's never updated.</p>

```<code>int getNoOfWaypoints()
{
    int count = 1;
    TourElement current = getNext();
    while(current.next != null)
    {
        count++;
        System.out.println(count);
    }
    return count;
}
</code>```

Body:
I'm trying to write a function to return the number of nodes in the list in java.

I have a class name waypoint, it define the point and other class named TourElement. TourElement is used to create nodes which are contain a point.

//Waypoint

public class Waypoint {
    int x  ;
    int y  ;
    public int getX()
    {
        return this.x;
    }
    public int getY()
    {
        return this.y;
    }
    public void setXY(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

//Tour Element

public class TourElement {
 private Waypoint points;
 private TourElement next;
  public void setWaypoint( Waypoint points)
 {
   this.points = points;
 }
  public void setTourElement(TourElement next)
  {
      this.next = next;
  }
 Waypoint getWaypoint()
 {
     return this.points;
 }

 TourElement getNext()
 {
     return this.next;
 }

// I have some trouble with getNoOfWaypoints() method, what is wrong with my code?. my method does not pass the test case :

int getNoOfWaypoints()
{
    int count = 1;
    TourElement current = getNext();
    while(current.next != null)
    {
        count++;
        System.out.println(count);
    }
    return count;
}

//test cases are provided by my teacher

  private Waypoint createWaypoint(int x, int y) {
        Waypoint wp = new Waypoint();
        wp.setXY(x, y);
        return wp;
    }

    private TourElement createElementList(int[][] waypoints){
        assert waypoints.length > 0;
        TourElement elem = new TourElement();
        int lastIndex = waypoints.length-1;
        Waypoint wp = createWaypoint(waypoints[lastIndex][0], waypoints[lastIndex][1]);
        elem.setWaypoint(wp);
        for (int i = lastIndex-1; i >= 0 ; i--) {
            wp = createWaypoint(waypoints[i][0], waypoints[i][1]);
            elem = elem.addStart(wp);
        }
        return elem;
    }

public void testGetNoOfWaypoints_NotChangingList() {
        TourElement elem = createElementList(new int[][] {{0, 0}, {1, 1}, {2, 2}});
        int unused = elem.getNoOfWaypoints();

        assertArrayEquals(new int[] {0, 0}, elem.getWaypoint().toArray());
        assertArrayEquals(new int[] {1, 1}, elem.getNext().getWaypoint().toArray());
        assertArrayEquals(new int[] {2, 2}, elem.getNext().getNext().getWaypoint().toArray());
        assertNull(elem.getNext().getNext().getNext());
    }

I dont know what is problem with my out put. and I really want to know how to pass the testcase. Please help me figure it out. thank u so much in advance!!

Body:
Considering this is a homework, I will give you some hint as to how you can fix the problem. In the getNoOfWaypoints(), the current is checked every time but it's never updated.

int getNoOfWaypoints()
{
    int count = 1;
    TourElement current = getNext();
    while(current.next != null)
    {
        count++;
        System.out.println(count);
    }
    return count;
}


问:
Last character LineEdit
I've two list of value. the first is list of integer and second is a list of strings. i want to display these different lists based on the last content of lineEdit. For Example when the user enter A => QCompleter show me list of strings. If the user enter A1 => QCompleter show me list of integer because the last character of input is 1.

I try like this :

```<code> void QtGuiApplication1::maFonction(QString text)

{

    QString lastCaractor = text.mid(text.length() - 1, 1);
    if (is_number(lastCaractor.toStdString()) == true)
    {
        QStringList list = { "1","2","7" };
        StringCompleter->setModel(new QStringListModel(list, StringCompleter));
        StringCompleter->setCompletionPrefix(lastCaractor);
    }

    else
    {
        QStringList list = { "AAAA","AA","BB","AC" };
        StringCompleter->setModel(new QStringListModel(list, StringCompleter));
        StringCompleter->setCompletionPrefix(lastCaractor);
    }
}

bool QtGuiApplication1::is_number(const std::string& s)
{

    std::string::const_iterator it = s.begin();
    while (it != s.end() && std::isdigit(*it)) ++it;
    return !s.empty() && it == s.end();
}
</code>```

If The last character is number => QCompleter show me list = { "1","2","7" };

Else => list = { "AAAA","AA","BB","AC" };

答:
Subclass your QLineEdit with 2 customs QCompleter

ExtendedLineEdit.h

```<code>class ExtendedLineEdit : public QLineEdit
{
    Q_OBJECT
public:
    explicit ExtendedLineEdit(QWidget *parent = nullptr);

    void setWordCompleter(QCompleter* c);
    void setNumberCompleter(QCompleter* c);

protected:
    void keyPressEvent(QKeyEvent *e);

private slots:
    void insertCompletionWord(const QString& txtComp);
    void insertCompletionNumber(const QString& txtComp);

private:
    QCompleter* m_completerWord;
    QCompleter* m_completerNumber;

    void showCustomCompleter(QCompleter* completer);
};
</code>```

ExtendedLineEdit.cpp

```<code>ExtendedLineEdit::ExtendedLineEdit(QWidget *parent) :
    QLineEdit(parent)
{

}

void ExtendedLineEdit::setWordCompleter(QCompleter *c)
{
    m_completerWord = c;
    m_completerWord->setWidget(this);
    connect(m_completerWord, SIGNAL(activated(QString)),
            this, SLOT(insertCompletionWord(QString)));
}

void ExtendedLineEdit::setNumberCompleter(QCompleter *c)
{
    m_completerNumber = c;
    m_completerNumber->setWidget(this);
    connect(m_completerNumber, SIGNAL(activated(QString)),
            this, SLOT(insertCompletionNumber(QString)));
}

void ExtendedLineEdit::keyPressEvent(QKeyEvent *e)
{
    QLineEdit::keyPressEvent(e);
    if (!m_completerWord || !m_completerNumber)
        return;

    QString lastCaractor = text().mid(text().length() - 1, 1);
    bool okConvertion = false;
    lastCaractor.toInt(&okConvertion);
    if (okConvertion)
    {
        //show number completer
        m_completerWord->popup()->hide();

        m_completerNumber->setCompletionPrefix(lastCaractor);

        showCustomCompleter(m_completerNumber);
    }
    else
    {
        //show word completer
        m_completerNumber->popup()->hide();

        m_completerWord->setCompletionPrefix(this->text());

        showCustomCompleter(m_completerWord);
    }

}

void ExtendedLineEdit::insertCompletionWord(const QString &txtComp)
{
    setText(txtComp);
}

void ExtendedLineEdit::insertCompletionNumber(const QString &txtComp)
{
    setText(text().mid(0, text().length() - 1) + txtComp);
}

void ExtendedLineEdit::showCustomCompleter(QCompleter *completer)
{
    if (completer->completionPrefix().length() < 1)
    {
        completer->popup()->hide();
        return;
    }
    QRect cr = cursorRect();
    cr.setWidth(completer->popup()->sizeHintForColumn(0) + completer->popup()->verticalScrollBar()->sizeHint().width());
    completer->complete(cr);
}
</code>```

And using

```<code>QStringList list = { "AAAA","AA","BB","AC" };
m_wordCompleter = new QCompleter(list, this);
QStringList numbers = { "1","2","7", "15" };
m_numberCompleter = new QCompleter(numbers, this);

ui->lineEdit->setWordCompleter(m_wordCompleter);
ui->lineEdit->setNumberCompleter(m_numberCompleter);
</code>```

Title: Last character LineEdit

Body:
I've two list of value. the first is list of integer and second is a list of strings. i want to display these different lists based on the last content of lineEdit. For Example when the user enter A => QCompleter show me list of strings. If the user enter A1 => QCompleter show me list of integer because the last character of input is 1.

I try like this :

 void QtGuiApplication1::maFonction(QString text)

{

    QString lastCaractor = text.mid(text.length() - 1, 1);
    if (is_number(lastCaractor.toStdString()) == true)
    {
        QStringList list = { "1","2","7" };
        StringCompleter->setModel(new QStringListModel(list, StringCompleter));
        StringCompleter->setCompletionPrefix(lastCaractor);
    }

    else
    {
        QStringList list = { "AAAA","AA","BB","AC" };
        StringCompleter->setModel(new QStringListModel(list, StringCompleter));
        StringCompleter->setCompletionPrefix(lastCaractor);
    }
}

bool QtGuiApplication1::is_number(const std::string& s)
{

    std::string::const_iterator it = s.begin();
    while (it != s.end() && std::isdigit(*it)) ++it;
    return !s.empty() && it == s.end();
}

If The last character is number => QCompleter show me list = { "1","2","7" };

Else => list = { "AAAA","AA","BB","AC" };

Body:
Subclass your QLineEdit with 2 customs QCompleter

ExtendedLineEdit.h

class ExtendedLineEdit : public QLineEdit
{
    Q_OBJECT
public:
    explicit ExtendedLineEdit(QWidget *parent = nullptr);

    void setWordCompleter(QCompleter* c);
    void setNumberCompleter(QCompleter* c);

protected:
    void keyPressEvent(QKeyEvent *e);

private slots:
    void insertCompletionWord(const QString& txtComp);
    void insertCompletionNumber(const QString& txtComp);

private:
    QCompleter* m_completerWord;
    QCompleter* m_completerNumber;

    void showCustomCompleter(QCompleter* completer);
};

ExtendedLineEdit.cpp

ExtendedLineEdit::ExtendedLineEdit(QWidget *parent) :
    QLineEdit(parent)
{

}

void ExtendedLineEdit::setWordCompleter(QCompleter *c)
{
    m_completerWord = c;
    m_completerWord->setWidget(this);
    connect(m_completerWord, SIGNAL(activated(QString)),
            this, SLOT(insertCompletionWord(QString)));
}

void ExtendedLineEdit::setNumberCompleter(QCompleter *c)
{
    m_completerNumber = c;
    m_completerNumber->setWidget(this);
    connect(m_completerNumber, SIGNAL(activated(QString)),
            this, SLOT(insertCompletionNumber(QString)));
}

void ExtendedLineEdit::keyPressEvent(QKeyEvent *e)
{
    QLineEdit::keyPressEvent(e);
    if (!m_completerWord || !m_completerNumber)
        return;

    QString lastCaractor = text().mid(text().length() - 1, 1);
    bool okConvertion = false;
    lastCaractor.toInt(&okConvertion);
    if (okConvertion)
    {
        //show number completer
        m_completerWord->popup()->hide();

        m_completerNumber->setCompletionPrefix(lastCaractor);

        showCustomCompleter(m_completerNumber);
    }
    else
    {
        //show word completer
        m_completerNumber->popup()->hide();

        m_completerWord->setCompletionPrefix(this->text());

        showCustomCompleter(m_completerWord);
    }

}

void ExtendedLineEdit::insertCompletionWord(const QString &txtComp)
{
    setText(txtComp);
}

void ExtendedLineEdit::insertCompletionNumber(const QString &txtComp)
{
    setText(text().mid(0, text().length() - 1) + txtComp);
}

void ExtendedLineEdit::showCustomCompleter(QCompleter *completer)
{
    if (completer->completionPrefix().length() < 1)
    {
        completer->popup()->hide();
        return;
    }
    QRect cr = cursorRect();
    cr.setWidth(completer->popup()->sizeHintForColumn(0) + completer->popup()->verticalScrollBar()->sizeHint().width());
    completer->complete(cr);
}

And using

QStringList list = { "AAAA","AA","BB","AC" };
m_wordCompleter = new QCompleter(list, this);
QStringList numbers = { "1","2","7", "15" };
m_numberCompleter = new QCompleter(numbers, this);

ui->lineEdit->setWordCompleter(m_wordCompleter);
ui->lineEdit->setNumberCompleter(m_numberCompleter);


问:
xpath - find multiple sequencial occurences of an element
I have an xhtml node that I need to clean, with the following innerText:

Image text goes here

I can't figure out by myself the xpath expressions that returns / finds multiple occurrences of the
 element. do I need to do recursion in the nodes and check against the last match ?

UPDATE: I'm using HtmlAgilityPack to navigate through the doc.

Thanks in advance!

Regards,
byte_slave

答:
Not really sure what you want to do with this. I have asked what you want it transformed to as a comment of the question…

Guessing what you might want to do though…

To find out the total number of
 elements, you just use XPath count(//descendant-or-self::br)

Or if you want to do something with all the
 elements that are next to another
 you could use XPath //descendant-or-self::br[following-sibling::br or preceding-sibling::br] to return just that long list of
s

Body:
Not really sure what you want to do with this. I have asked what you want it transformed to as a comment of the question…

Guessing what you might want to do though…

To find out the total number of <br/> elements, you just use XPath count(//descendant-or-self::br)

Or if you want to do something with all the <br/> elements that are next to another <br/> you could use XPath //descendant-or-self::br[following-sibling::br or preceding-sibling::br] to return just that long list of <br/>s


问:
HTML5 template not working on Internet Explorer, how to solve it?
I made a template in HTML5 which is working with Chrome and Firefox but not working with Internet Explorer (tested on IE 8).

How can I solve this problem?

答:
You can hide the element using CSS: template { display:none !important; }

And if you need to access/clone the content like natively possible in other browsers, use this polyfill: https://github.com/jeffcarp/template-polyfill

But keep in mind the content of the <template> can still be found in the DOM and is executed - preventing exactly that is the main goal of the tag. No polyfill can stop that from happening, IE is once again slowing down modern web development.


问:
How to fix this issue with JSP?
I am try to deploy a web app using apache tomcat and facing issue with exception.I am completely new to java so help me clearly.
Message org.apache.jasper.JasperException: Unable to compile class for JSP.

Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Looking into my login page java code is below

```<code><%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<%@ page import ="javax.swing.JOptionPane;" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Login</title>
    </head>
<body>

<%
    //connection to database

    Connection conn = null;
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","***");
    Statement st= conn.createStatement();
    String username=request.getParameter("username");
    String password=request.getParameter("userpass");

    //Check if username or password is empty

    if(username!="" && password!="")
    {
        session.setAttribute("username",username);
        //session.setAttribute("refreshCount","0");
        ResultSet rs=st.executeQuery("select * from login where userId='"+username+"'");
        if(rs.next())
        {
            //Check if user password matches with database password

            if(rs.getString(2).equals(password))
            {
                //retrieving the role of user form the database 1-Manager and 0 - student

                int role=rs.getInt(4);

                if(role==1)
                {
                    response.sendRedirect("managerHome.jsp");
                }
                else
                {

                    response.sendRedirect("studentHome.jsp");
                }

            }
            else
            {
                JOptionPane.showMessageDialog(null, "Invalid username or password.");
                String redirectURL= "index.jsp";
                    response.sendRedirect(redirectURL);

            }
        }
        else
        {
            JOptionPane.showMessageDialog(null, "Invalid username or password.");
            String redirectURL= "index.jsp";
                response.sendRedirect(redirectURL);

        }

    }
    else
    {
        JOptionPane.showMessageDialog(null, "Username or password should not be empty");
                String redirectURL= "index.jsp";
                    response.sendRedirect(redirectURL);
    }
%>

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

Exception:

```<code>org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:604)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
</code>```

Root Cause:

```<code>org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:619)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

java.lang.IllegalArgumentException: Page directive: invalid value for import
org.apache.jasper.compiler.Node$PageDirective.validateImport(Node.java:619)
org.apache.jasper.compiler.Node$PageDirective.addImport(Node.java:599)
org.apache.jasper.compiler.Parser.parsePageDirective(Parser.java:366)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:478)
org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1797)
org.apache.jasper.compiler.Parser.parse(Parser.java:141)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:127)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:202)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
</code>```

Coming to my xml file it is below
Web.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" metadata-complete="true" version="3.0">
  <display-name>SEProject</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>ManagerTimesheetsServlet</display-name>
    <servlet-name>ManagerTimesheetsServlet</servlet-name>
    <servlet-class>timesheet.ManagerTimesheetsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ManagerTimesheetsServlet</servlet-name>
    <url-pattern>/ManagerTimesheetsServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>StudentTimesheetServlet</display-name>
    <servlet-name>StudentTimesheetServlet</servlet-name>
    <servlet-class>timesheet.StudentTimesheetServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>StudentTimesheetServlet</servlet-name>
    <url-pattern>/StudentTimesheetServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>StudentUpdateServlet</display-name>
    <servlet-name>StudentUpdateServlet</servlet-name>
    <servlet-class>timesheet.StudentUpdateServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>StudentUpdateServlet</servlet-name>
    <url-pattern>/StudentUpdateServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>CreateTimesheetServlet</display-name>
    <servlet-name>CreateTimesheetServlet</servlet-name>
    <servlet-class>timesheet.CreateTimesheetsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>CreateTimesheetServlet</servlet-name>
    <url-pattern>/CreateTimesheetsServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>ApplyLeaveHandler</display-name>
    <servlet-name>ApplyLeaveHandler</servlet-name>
    <servlet-class>timesheet.ApplyLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ApplyLeaveHandler</servlet-name>
    <url-pattern>/ApplyLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>EditLeaveHandler</display-name>
    <servlet-name>EditLeaveHandler</servlet-name>
    <servlet-class>timesheet.EditLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>EditLeaveHandler</servlet-name>
    <url-pattern>/EditLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>SubmitUpdatedLeaveHandler</display-name>
    <servlet-name>SubmitUpdatedLeaveHandler</servlet-name>
    <servlet-class>timesheet.SubmitUpdatedLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SubmitUpdatedLeaveHandler</servlet-name>
    <url-pattern>/SubmitUpdatedLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>UpdateLeaveHandler</display-name>
    <servlet-name>UpdateLeaveHandler</servlet-name>
    <servlet-class>timesheet.UpdateLeaveHandler</servlet-class>
  </servlet>
  <servlet>
    <display-name>ViewLeaveHandler</display-name>
    <servlet-name>ViewLeaveHandler</servlet-name>
    <servlet-class>timesheet.ViewLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UpdateLeaveHandler</servlet-name>
    <url-pattern>/UpdateLeaveHandler</url-pattern>
  </servlet-mapping>
</web-app>
</code>```

答: The error java.lang.IllegalArgumentException: Page directive: invalid value for import itself says you have import class which doesn't exist .  i.e <%@ page import ="javax.swing.JOptionPane;" %> <-here you have ; at end of your import remove that it should work .

Title: How to fix this issue with JSP?

Body:
I am try to deploy a web app using apache tomcat and facing issue with exception.I am completely new to java so help me clearly.
Message org.apache.jasper.JasperException: Unable to compile class for JSP.

Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Looking into my login page java code is below

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<%@ page import ="javax.swing.JOptionPane;" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Login</title>

<%
    //connection to database

    Connection conn = null;
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","***");
    Statement st= conn.createStatement();
    String username=request.getParameter("username");
    String password=request.getParameter("userpass");

    //Check if username or password is empty

    if(username!="" && password!="")
    {
        session.setAttribute("username",username);
        //session.setAttribute("refreshCount","0");
        ResultSet rs=st.executeQuery("select * from login where userId='"+username+"'");
        if(rs.next())
        {
            //Check if user password matches with database password

            if(rs.getString(2).equals(password))
            {
                //retrieving the role of user form the database 1-Manager and 0 - student

                int role=rs.getInt(4);

                if(role==1)
                {
                    response.sendRedirect("managerHome.jsp");
                }
                else
                {

                    response.sendRedirect("studentHome.jsp");
                }

            }
            else
            {
                JOptionPane.showMessageDialog(null, "Invalid username or password.");
                String redirectURL= "index.jsp";
                    response.sendRedirect(redirectURL);

            }
        }
        else
        {
            JOptionPane.showMessageDialog(null, "Invalid username or password.");
            String redirectURL= "index.jsp";
                response.sendRedirect(redirectURL);

        }

    }
    else
    {
        JOptionPane.showMessageDialog(null, "Username or password should not be empty");
                String redirectURL= "index.jsp";
                    response.sendRedirect(redirectURL);
    }
%>

Exception:

org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:604)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause:

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:619)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

java.lang.IllegalArgumentException: Page directive: invalid value for import
org.apache.jasper.compiler.Node$PageDirective.validateImport(Node.java:619)
org.apache.jasper.compiler.Node$PageDirective.addImport(Node.java:599)
org.apache.jasper.compiler.Parser.parsePageDirective(Parser.java:366)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:478)
org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1797)
org.apache.jasper.compiler.Parser.parse(Parser.java:141)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:127)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:202)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Coming to my xml file it is below
Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" metadata-complete="true" version="3.0">
  <display-name>SEProject</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>ManagerTimesheetsServlet</display-name>
    <servlet-name>ManagerTimesheetsServlet</servlet-name>
    <servlet-class>timesheet.ManagerTimesheetsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ManagerTimesheetsServlet</servlet-name>
    <url-pattern>/ManagerTimesheetsServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>StudentTimesheetServlet</display-name>
    <servlet-name>StudentTimesheetServlet</servlet-name>
    <servlet-class>timesheet.StudentTimesheetServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>StudentTimesheetServlet</servlet-name>
    <url-pattern>/StudentTimesheetServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>StudentUpdateServlet</display-name>
    <servlet-name>StudentUpdateServlet</servlet-name>
    <servlet-class>timesheet.StudentUpdateServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>StudentUpdateServlet</servlet-name>
    <url-pattern>/StudentUpdateServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>CreateTimesheetServlet</display-name>
    <servlet-name>CreateTimesheetServlet</servlet-name>
    <servlet-class>timesheet.CreateTimesheetsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>CreateTimesheetServlet</servlet-name>
    <url-pattern>/CreateTimesheetsServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>ApplyLeaveHandler</display-name>
    <servlet-name>ApplyLeaveHandler</servlet-name>
    <servlet-class>timesheet.ApplyLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ApplyLeaveHandler</servlet-name>
    <url-pattern>/ApplyLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>EditLeaveHandler</display-name>
    <servlet-name>EditLeaveHandler</servlet-name>
    <servlet-class>timesheet.EditLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>EditLeaveHandler</servlet-name>
    <url-pattern>/EditLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>SubmitUpdatedLeaveHandler</display-name>
    <servlet-name>SubmitUpdatedLeaveHandler</servlet-name>
    <servlet-class>timesheet.SubmitUpdatedLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SubmitUpdatedLeaveHandler</servlet-name>
    <url-pattern>/SubmitUpdatedLeaveHandler</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>UpdateLeaveHandler</display-name>
    <servlet-name>UpdateLeaveHandler</servlet-name>
    <servlet-class>timesheet.UpdateLeaveHandler</servlet-class>
  </servlet>
  <servlet>
    <display-name>ViewLeaveHandler</display-name>
    <servlet-name>ViewLeaveHandler</servlet-name>
    <servlet-class>timesheet.ViewLeaveHandler</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UpdateLeaveHandler</servlet-name>
    <url-pattern>/UpdateLeaveHandler</url-pattern>
  </servlet-mapping>
</web-app>


问:
How to use multiple tmLanguage files in vscode extension
I am creating a language extension in vscode for myself. Because it will associate with different file types, I plan to make different tmlanguge files for specific rules. According to this, I could extend the scopeName to achieve that.

So I created in my ./package.json files something like this:

{
    "name": "tst",
    "displayName": "Test Language",
    "description": "A test for language extension",
    "version": "0.0.1",
    "engines": {
        "vscode": "^1.34.0"
    },
    "contributes": {
        "languages": [{
            "id": "tst",
            "aliases": ["Test", "tst"],
            "extensions": [".tst",".type1",".type2"],
            "configuration": "./language-configuration.json"
        }],
        "grammars": [{
            "language": "tst",
            "scopeName": "source.tst",
            "path": "./syntaxes/tst.tmLanguage.json"
        },
        {
            "scopeName": "source.tst.type1",
            "path": "./syntaxes/type1.tmLanguage.json"
        },
        {
            "scopeName": "source.tst.type2",
            "path": "./syntaxes/type2.tmLanguage.json"
        }]
    }
}
```

<p>Then I create the base rules in <code>./syntaxes/tst.tmLanguage.json</code> and both <code>.type1</code> and <code>.type2</code> have been applied with my grammars.</p>

<pre class="lang-json prettyprint-override"><code>{
    "name": "Test",
    "patterns": [
        {
            "match": "test",
            "name": "constant.character"
        }
    ],
    "scopeName": "source.tst"
}
</code>```

Afterwards I also make ./syntaxes/type1.tmLanguage.json something like this:

{
    "name": "type1",
    "patterns": [
        {
            "match": "type1",
            "name": "constant.language"
        }
    ],
    "scopeName": "source.tst.type1"
}
```

Nothing works for any rules in .type1.

I hope both file in the picture can recognize test and type1.
I checked the vscode pre-installed cpp language extension.
They also use scopeName for source.c and source.c.platform.
I guess it is for the similar purpose?

Did I overlook something?
Thanks for the help.

答:
If you want to use these scopes from different tmLanguage files in the main grammar, you have to explicitly include them:

{
    "name": "Test",
    "patterns": [
        {
            "match": "test",
            "name": "constant.character"
        },
        {
            "include": "source.tst.type1"
        },
        {
            "include": "source.tst.type2"
        }
    ],
    "scopeName": "source.tst"
}
```

<p><img src="https://i.imgur.com/Pqlj1f0.png" alt=""></p>

<hr>

<p>Regarding the built-in cpp extension and <code>platform.tmLanguage.json</code> - as far as I can tell, it's not actively being used by the c and cpp grammars. There's this comment in <code>cpp/build/update-grammars.js</code>:</p>

<pre class="lang-js prettyprint-override"><code>// `source.c.platform` which is still included by other grammars
</code>```

So that sounds more like a backwards-compatibility measure in case any third-party grammars still use it.

Body:
I am creating a language extension in vscode for myself. Because it will associate with different file types, I plan to make different tmlanguge files for specific rules. According to this, I could extend the scopeName to achieve that.

So I created in my ./package.json files something like this:

{
    "name": "tst",
    "displayName": "Test Language",
    "description": "A test for language extension",
    "version": "0.0.1",
    "engines": {
        "vscode": "^1.34.0"
    },
    "contributes": {
        "languages": [{
            "id": "tst",
            "aliases": ["Test", "tst"],
            "extensions": [".tst",".type1",".type2"],
            "configuration": "./language-configuration.json"
        }],
        "grammars": [{
            "language": "tst",
            "scopeName": "source.tst",
            "path": "./syntaxes/tst.tmLanguage.json"
        },
        {
            "scopeName": "source.tst.type1",
            "path": "./syntaxes/type1.tmLanguage.json"
        },
        {
            "scopeName": "source.tst.type2",
            "path": "./syntaxes/type2.tmLanguage.json"
        }]
    }
}

Then I create the base rules in ./syntaxes/tst.tmLanguage.json and both .type1 and .type2 have been applied with my grammars.

{
    "name": "Test",
    "patterns": [
        {
            "match": "test",
            "name": "constant.character"
        }
    ],
    "scopeName": "source.tst"
}

Afterwards I also make ./syntaxes/type1.tmLanguage.json something like this:

{
    "name": "type1",
    "patterns": [
        {
            "match": "type1",
            "name": "constant.language"
        }
    ],
    "scopeName": "source.tst.type1"
}

Nothing works for any rules in .type1.

I hope both file in the picture can recognize test and type1.
I checked the vscode pre-installed cpp language extension.
They also use scopeName for source.c and source.c.platform.
I guess it is for the similar purpose?

Did I overlook something?
Thanks for the help.

Body:
If you want to use these scopes from different tmLanguage files in the main grammar, you have to explicitly include them:

{
    "name": "Test",
    "patterns": [
        {
            "match": "test",
            "name": "constant.character"
        },
        {
            "include": "source.tst.type1"
        },
        {
            "include": "source.tst.type2"
        }
    ],
    "scopeName": "source.tst"
}

Regarding the built-in cpp extension and platform.tmLanguage.json - as far as I can tell, it's not actively being used by the c and cpp grammars. There's this comment in cpp/build/update-grammars.js:

// `source.c.platform` which is still included by other grammars

So that sounds more like a backwards-compatibility measure in case any third-party grammars still use it.


问:
How to diff two keyword lists?
I have two files of version information of the following shape:

```<code>$ cat file1
cabal 2.2.0.1
http 4000.3.12
hunit 1.6.0.0
only 0.1
...
</code>```

I'm looking for (preferably simple) ways to compare these using command line tools, allowing me to generate things such as
1. all lines in file1 where the name doesn't show up in file2 at all
2. lines of the form name <v1> <v2> for names that show up in both files

I thought I had the right ingredient when I discovered diff -y, but that sometimes puts different names on the same line.

答:
Here is a deficient solution I came up with, using python:</p>

```<code>> a = open('file1').read().splitlines()
> a = [l.split() for l in a]
> a = {k: v for (k, v) in a}
# same for b
> diff = {k: v for (k, v) in a.items() if k not in b}
> open('diff','w').write('\n'.join('{} {}'.format(k, v) for (k, v) in diff.items())
</code>```

Title: How to diff two keyword lists?

Body:
I have two files of version information of the following shape:

$ cat file1
cabal 2.2.0.1
http 4000.3.12
hunit 1.6.0.0
only 0.1
...

I'm looking for (preferably simple) ways to compare these using command line tools, allowing me to generate things such as
1. all lines in file1 where the name doesn't show up in file2 at all
2. lines of the form name <v1> <v2> for names that show up in both files

I thought I had the right ingredient when I discovered diff -y, but that sometimes puts different names on the same line.

Body:
Here is a deficient solution I came up with, using python:

> a = open('file1').read().splitlines()
> a = [l.split() for l in a]
> a = {k: v for (k, v) in a}
# same for b
> diff = {k: v for (k, v) in a.items() if k not in b}
> open('diff','w').write('\n'.join('{} {}'.format(k, v) for (k, v) in diff.items())


问:
Add Custom Paging to SQL Query
I have Stored Procedure that fetch a table records.
I am new to Write Stored Procedures.
how can I add paging to this Stored Procedure ?
I'm using Sql Server 2005.
I want to add two more arguments to Stored Procedure.
PageIndex and PageSize.
Please Help.</p>

```<code>USE [tadarokatbase]
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[aspnet_Membership_Find]
(
    @SearchUsingOR bit   = null ,

    @ApplicationId uniqueidentifier   = null ,

    @UserId uniqueidentifier   = null ,

    @Password nvarchar (128)  = null ,

    @PasswordFormat int   = null ,

    @PasswordSalt nvarchar (128)  = null ,

    @MobilePin nvarchar (16)  = null ,

    @Email nvarchar (256)  = null ,

    @LoweredEmail nvarchar (256)  = null ,

    @PasswordQuestion nvarchar (256)  = null ,

    @PasswordAnswer nvarchar (128)  = null ,

    @IsApproved bit   = null ,

    @IsLockedOut bit   = null ,

    @CreateDate datetime   = null ,

    @LastLoginDate datetime   = null ,

    @LastPasswordChangedDate datetime   = null ,

    @LastLockoutDate datetime   = null ,

    @FailedPasswordAttemptCount int   = null ,

    @FailedPasswordAttemptWindowStart datetime   = null ,

    @FailedPasswordAnswerAttemptCount int   = null ,

    @FailedPasswordAnswerAttemptWindowStart datetime   = null ,

    @Comment ntext   = null
)
AS

  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]
    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId OR @ApplicationId IS NULL)
    AND ([UserId] = @UserId OR @UserId IS NULL)
    AND ([Password] = @Password OR @Password IS NULL)
    AND ([PasswordFormat] = @PasswordFormat OR @PasswordFormat IS NULL)
    AND ([PasswordSalt] = @PasswordSalt OR @PasswordSalt IS NULL)
    AND ([MobilePIN] = @MobilePin OR @MobilePin IS NULL)
    AND ([Email] = @Email OR @Email IS NULL)
    AND ([LoweredEmail] = @LoweredEmail OR @LoweredEmail IS NULL)
    AND ([PasswordQuestion] = @PasswordQuestion OR @PasswordQuestion IS NULL)
    AND ([PasswordAnswer] = @PasswordAnswer OR @PasswordAnswer IS NULL)
    AND ([IsApproved] = @IsApproved OR @IsApproved IS NULL)
    AND ([IsLockedOut] = @IsLockedOut OR @IsLockedOut IS NULL)
    AND ([CreateDate] = @CreateDate OR @CreateDate IS NULL)
    AND ([LastLoginDate] = @LastLoginDate OR @LastLoginDate IS NULL)
    AND ([LastPasswordChangedDate] = @LastPasswordChangedDate OR @LastPasswordChangedDate IS NULL)
    AND ([LastLockoutDate] = @LastLockoutDate OR @LastLockoutDate IS NULL)
    AND ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount OR @FailedPasswordAttemptCount IS NULL)
    AND ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart OR @FailedPasswordAttemptWindowStart IS NULL)
    AND ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount OR @FailedPasswordAnswerAttemptCount IS NULL)
    AND ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart OR @FailedPasswordAnswerAttemptWindowStart IS NULL)

  END
  ELSE
  BEGIN
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]
    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId AND @ApplicationId is not null)
    OR ([UserId] = @UserId AND @UserId is not null)
    OR ([Password] = @Password AND @Password is not null)
    OR ([PasswordFormat] = @PasswordFormat AND @PasswordFormat is not null)
    OR ([PasswordSalt] = @PasswordSalt AND @PasswordSalt is not null)
    OR ([MobilePIN] = @MobilePin AND @MobilePin is not null)
    OR ([Email] = @Email AND @Email is not null)
    OR ([LoweredEmail] = @LoweredEmail AND @LoweredEmail is not null)
    OR ([PasswordQuestion] = @PasswordQuestion AND @PasswordQuestion is not null)
    OR ([PasswordAnswer] = @PasswordAnswer AND @PasswordAnswer is not null)
    OR ([IsApproved] = @IsApproved AND @IsApproved is not null)
    OR ([IsLockedOut] = @IsLockedOut AND @IsLockedOut is not null)
    OR ([CreateDate] = @CreateDate AND @CreateDate is not null)
    OR ([LastLoginDate] = @LastLoginDate AND @LastLoginDate is not null)
    OR ([LastPasswordChangedDate] = @LastPasswordChangedDate AND @LastPasswordChangedDate is not null)
    OR ([LastLockoutDate] = @LastLockoutDate AND @LastLockoutDate is not null)
    OR ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount AND @FailedPasswordAttemptCount is not null)
    OR ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart AND @FailedPasswordAttemptWindowStart is not null)
    OR ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount AND @FailedPasswordAnswerAttemptCount is not null)
    OR ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart AND @FailedPasswordAnswerAttemptWindowStart is not null)
    SELECT @@ROWCOUNT
  END
</code>```

答:
This may help: </p>

```<code>USE [tadarokatbase]
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[aspnet_Membership_Find]
(
    @SearchUsingOR bit   = null ,
    @ApplicationId uniqueidentifier   = null ,
    @UserId uniqueidentifier   = null ,
    @Password nvarchar (128)  = null ,
    @PasswordFormat int   = null ,
    @PasswordSalt nvarchar (128)  = null ,
    @MobilePin nvarchar (16)  = null ,
    @Email nvarchar (256)  = null ,
    @LoweredEmail nvarchar (256)  = null ,
    @PasswordQuestion nvarchar (256)  = null ,
    @PasswordAnswer nvarchar (128)  = null ,
    @IsApproved bit   = null ,
    @IsLockedOut bit   = null ,
    @CreateDate datetime   = null ,
    @LastLoginDate datetime   = null ,
    @LastPasswordChangedDate datetime   = null ,
    @LastLockoutDate datetime   = null ,
    @FailedPasswordAttemptCount int   = null ,
    @FailedPasswordAttemptWindowStart datetime   = null ,
    @FailedPasswordAnswerAttemptCount int   = null ,
    @FailedPasswordAnswerAttemptWindowStart datetime   = null ,
    @Comment ntext   = null ,

    @StartRowIndex      int = null,
    @PageSize           int = null

)

AS

    Declare @UpperBand int
    Declare @LowerBand int

  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN

  SET @LowerBand  = @startRowIndex
  SET @UpperBand  = @startRowIndex + @pageSize

    WITH tempPagedEntities AS
            (
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]

    ,ROW_NUMBER() OVER (ORDER BY UserId asc ) as RowNumber

    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId OR @ApplicationId IS NULL)
    AND ([UserId] = @UserId OR @UserId IS NULL)
    AND ([Password] = @Password OR @Password IS NULL)
    AND ([PasswordFormat] = @PasswordFormat OR @PasswordFormat IS NULL)
    AND ([PasswordSalt] = @PasswordSalt OR @PasswordSalt IS NULL)
    AND ([MobilePIN] = @MobilePin OR @MobilePin IS NULL)
    AND ([Email] = @Email OR @Email IS NULL)
    AND ([LoweredEmail] = @LoweredEmail OR @LoweredEmail IS NULL)
    AND ([PasswordQuestion] = @PasswordQuestion OR @PasswordQuestion IS NULL)
    AND ([PasswordAnswer] = @PasswordAnswer OR @PasswordAnswer IS NULL)
    AND ([IsApproved] = @IsApproved OR @IsApproved IS NULL)
    AND ([IsLockedOut] = @IsLockedOut OR @IsLockedOut IS NULL)
    AND ([CreateDate] = @CreateDate OR @CreateDate IS NULL)
    AND ([LastLoginDate] = @LastLoginDate OR @LastLoginDate IS NULL)
    AND ([LastPasswordChangedDate] = @LastPasswordChangedDate OR @LastPasswordChangedDate IS NULL)
    AND ([LastLockoutDate] = @LastLockoutDate OR @LastLockoutDate IS NULL)
    AND ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount OR @FailedPasswordAttemptCount IS NULL)
    AND ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart OR @FailedPasswordAttemptWindowStart IS NULL)
    AND ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount OR @FailedPasswordAnswerAttemptCount IS NULL)
    AND ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart OR @FailedPasswordAnswerAttemptWindowStart IS NULL)

    )
            SELECT
                *
            FROM
                tempPagedEntities
            WHERE
                RowNumber > @LowerBand AND RowNumber <= @UpperBand

  END
  ELSE
  BEGIN

  BEGIN
            WITH tempPagedEntities AS
            (
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]

    ,ROW_NUMBER() OVER (ORDER BY UserId asc ) as RowNumber

    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId AND @ApplicationId is not null)
    OR ([UserId] = @UserId AND @UserId is not null)
    OR ([Password] = @Password AND @Password is not null)
    OR ([PasswordFormat] = @PasswordFormat AND @PasswordFormat is not null)
    OR ([PasswordSalt] = @PasswordSalt AND @PasswordSalt is not null)
    OR ([MobilePIN] = @MobilePin AND @MobilePin is not null)
    OR ([Email] = @Email AND @Email is not null)
    OR ([LoweredEmail] = @LoweredEmail AND @LoweredEmail is not null)
    OR ([PasswordQuestion] = @PasswordQuestion AND @PasswordQuestion is not null)
    OR ([PasswordAnswer] = @PasswordAnswer AND @PasswordAnswer is not null)
    OR ([IsApproved] = @IsApproved AND @IsApproved is not null)
    OR ([IsLockedOut] = @IsLockedOut AND @IsLockedOut is not null)
    OR ([CreateDate] = @CreateDate AND @CreateDate is not null)
    OR ([LastLoginDate] = @LastLoginDate AND @LastLoginDate is not null)
    OR ([LastPasswordChangedDate] = @LastPasswordChangedDate AND @LastPasswordChangedDate is not null)
    OR ([LastLockoutDate] = @LastLockoutDate AND @LastLockoutDate is not null)
    OR ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount AND @FailedPasswordAttemptCount is not null)
    OR ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart AND @FailedPasswordAttemptWindowStart is not null)
    OR ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount AND @FailedPasswordAnswerAttemptCount is not null)
    OR ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart AND @FailedPasswordAnswerAttemptWindowStart is not null)

    )
            SELECT
                *
            FROM
                tempPagedEntities
            WHERE
                RowNumber > @LowerBand AND RowNumber <= @UpperBand

    SELECT @@ROWCOUNT
  END

  END
</code>```

Title: Add Custom Paging to SQL Query

Body:
I have Stored Procedure that fetch a table records.
I am new to Write Stored Procedures.
how can I add paging to this Stored Procedure ?
I'm using Sql Server 2005.
I want to add two more arguments to Stored Procedure.
PageIndex and PageSize.
Please Help.

USE [tadarokatbase]
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[aspnet_Membership_Find]
(
    @SearchUsingOR bit   = null ,

    @ApplicationId uniqueidentifier   = null ,

    @UserId uniqueidentifier   = null ,

    @Password nvarchar (128)  = null ,

    @PasswordFormat int   = null ,

    @PasswordSalt nvarchar (128)  = null ,

    @MobilePin nvarchar (16)  = null ,

    @Email nvarchar (256)  = null ,

    @LoweredEmail nvarchar (256)  = null ,

    @PasswordQuestion nvarchar (256)  = null ,

    @PasswordAnswer nvarchar (128)  = null ,

    @IsApproved bit   = null ,

    @IsLockedOut bit   = null ,

    @CreateDate datetime   = null ,

    @LastLoginDate datetime   = null ,

    @LastPasswordChangedDate datetime   = null ,

    @LastLockoutDate datetime   = null ,

    @FailedPasswordAttemptCount int   = null ,

    @FailedPasswordAttemptWindowStart datetime   = null ,

    @FailedPasswordAnswerAttemptCount int   = null ,

    @FailedPasswordAnswerAttemptWindowStart datetime   = null ,

    @Comment ntext   = null
)
AS

  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]
    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId OR @ApplicationId IS NULL)
    AND ([UserId] = @UserId OR @UserId IS NULL)
    AND ([Password] = @Password OR @Password IS NULL)
    AND ([PasswordFormat] = @PasswordFormat OR @PasswordFormat IS NULL)
    AND ([PasswordSalt] = @PasswordSalt OR @PasswordSalt IS NULL)
    AND ([MobilePIN] = @MobilePin OR @MobilePin IS NULL)
    AND ([Email] = @Email OR @Email IS NULL)
    AND ([LoweredEmail] = @LoweredEmail OR @LoweredEmail IS NULL)
    AND ([PasswordQuestion] = @PasswordQuestion OR @PasswordQuestion IS NULL)
    AND ([PasswordAnswer] = @PasswordAnswer OR @PasswordAnswer IS NULL)
    AND ([IsApproved] = @IsApproved OR @IsApproved IS NULL)
    AND ([IsLockedOut] = @IsLockedOut OR @IsLockedOut IS NULL)
    AND ([CreateDate] = @CreateDate OR @CreateDate IS NULL)
    AND ([LastLoginDate] = @LastLoginDate OR @LastLoginDate IS NULL)
    AND ([LastPasswordChangedDate] = @LastPasswordChangedDate OR @LastPasswordChangedDate IS NULL)
    AND ([LastLockoutDate] = @LastLockoutDate OR @LastLockoutDate IS NULL)
    AND ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount OR @FailedPasswordAttemptCount IS NULL)
    AND ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart OR @FailedPasswordAttemptWindowStart IS NULL)
    AND ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount OR @FailedPasswordAnswerAttemptCount IS NULL)
    AND ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart OR @FailedPasswordAnswerAttemptWindowStart IS NULL)

  END
  ELSE
  BEGIN
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]
    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId AND @ApplicationId is not null)
    OR ([UserId] = @UserId AND @UserId is not null)
    OR ([Password] = @Password AND @Password is not null)
    OR ([PasswordFormat] = @PasswordFormat AND @PasswordFormat is not null)
    OR ([PasswordSalt] = @PasswordSalt AND @PasswordSalt is not null)
    OR ([MobilePIN] = @MobilePin AND @MobilePin is not null)
    OR ([Email] = @Email AND @Email is not null)
    OR ([LoweredEmail] = @LoweredEmail AND @LoweredEmail is not null)
    OR ([PasswordQuestion] = @PasswordQuestion AND @PasswordQuestion is not null)
    OR ([PasswordAnswer] = @PasswordAnswer AND @PasswordAnswer is not null)
    OR ([IsApproved] = @IsApproved AND @IsApproved is not null)
    OR ([IsLockedOut] = @IsLockedOut AND @IsLockedOut is not null)
    OR ([CreateDate] = @CreateDate AND @CreateDate is not null)
    OR ([LastLoginDate] = @LastLoginDate AND @LastLoginDate is not null)
    OR ([LastPasswordChangedDate] = @LastPasswordChangedDate AND @LastPasswordChangedDate is not null)
    OR ([LastLockoutDate] = @LastLockoutDate AND @LastLockoutDate is not null)
    OR ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount AND @FailedPasswordAttemptCount is not null)
    OR ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart AND @FailedPasswordAttemptWindowStart is not null)
    OR ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount AND @FailedPasswordAnswerAttemptCount is not null)
    OR ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart AND @FailedPasswordAnswerAttemptWindowStart is not null)
    SELECT @@ROWCOUNT
  END

Body:
This may help:

USE [tadarokatbase]
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[aspnet_Membership_Find]
(
    @SearchUsingOR bit   = null ,
    @ApplicationId uniqueidentifier   = null ,
    @UserId uniqueidentifier   = null ,
    @Password nvarchar (128)  = null ,
    @PasswordFormat int   = null ,
    @PasswordSalt nvarchar (128)  = null ,
    @MobilePin nvarchar (16)  = null ,
    @Email nvarchar (256)  = null ,
    @LoweredEmail nvarchar (256)  = null ,
    @PasswordQuestion nvarchar (256)  = null ,
    @PasswordAnswer nvarchar (128)  = null ,
    @IsApproved bit   = null ,
    @IsLockedOut bit   = null ,
    @CreateDate datetime   = null ,
    @LastLoginDate datetime   = null ,
    @LastPasswordChangedDate datetime   = null ,
    @LastLockoutDate datetime   = null ,
    @FailedPasswordAttemptCount int   = null ,
    @FailedPasswordAttemptWindowStart datetime   = null ,
    @FailedPasswordAnswerAttemptCount int   = null ,
    @FailedPasswordAnswerAttemptWindowStart datetime   = null ,
    @Comment ntext   = null ,

    @StartRowIndex      int = null,
    @PageSize           int = null

)

AS

    Declare @UpperBand int
    Declare @LowerBand int

  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN

  SET @LowerBand  = @startRowIndex
  SET @UpperBand  = @startRowIndex + @pageSize

    WITH tempPagedEntities AS
            (
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]

    ,ROW_NUMBER() OVER (ORDER BY UserId asc ) as RowNumber

    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId OR @ApplicationId IS NULL)
    AND ([UserId] = @UserId OR @UserId IS NULL)
    AND ([Password] = @Password OR @Password IS NULL)
    AND ([PasswordFormat] = @PasswordFormat OR @PasswordFormat IS NULL)
    AND ([PasswordSalt] = @PasswordSalt OR @PasswordSalt IS NULL)
    AND ([MobilePIN] = @MobilePin OR @MobilePin IS NULL)
    AND ([Email] = @Email OR @Email IS NULL)
    AND ([LoweredEmail] = @LoweredEmail OR @LoweredEmail IS NULL)
    AND ([PasswordQuestion] = @PasswordQuestion OR @PasswordQuestion IS NULL)
    AND ([PasswordAnswer] = @PasswordAnswer OR @PasswordAnswer IS NULL)
    AND ([IsApproved] = @IsApproved OR @IsApproved IS NULL)
    AND ([IsLockedOut] = @IsLockedOut OR @IsLockedOut IS NULL)
    AND ([CreateDate] = @CreateDate OR @CreateDate IS NULL)
    AND ([LastLoginDate] = @LastLoginDate OR @LastLoginDate IS NULL)
    AND ([LastPasswordChangedDate] = @LastPasswordChangedDate OR @LastPasswordChangedDate IS NULL)
    AND ([LastLockoutDate] = @LastLockoutDate OR @LastLockoutDate IS NULL)
    AND ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount OR @FailedPasswordAttemptCount IS NULL)
    AND ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart OR @FailedPasswordAttemptWindowStart IS NULL)
    AND ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount OR @FailedPasswordAnswerAttemptCount IS NULL)
    AND ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart OR @FailedPasswordAnswerAttemptWindowStart IS NULL)

    )
            SELECT
                *
            FROM
                tempPagedEntities
            WHERE
                RowNumber > @LowerBand AND RowNumber <= @UpperBand

  END
  ELSE
  BEGIN

  BEGIN
            WITH tempPagedEntities AS
            (
    SELECT
      [ApplicationId]
    , [UserId]
    , [Password]
    , [PasswordFormat]
    , [PasswordSalt]
    , [MobilePIN]
    , [Email]
    , [LoweredEmail]
    , [PasswordQuestion]
    , [PasswordAnswer]
    , [IsApproved]
    , [IsLockedOut]
    , [CreateDate]
    , [LastLoginDate]
    , [LastPasswordChangedDate]
    , [LastLockoutDate]
    , [FailedPasswordAttemptCount]
    , [FailedPasswordAttemptWindowStart]
    , [FailedPasswordAnswerAttemptCount]
    , [FailedPasswordAnswerAttemptWindowStart]
    , [Comment]

    ,ROW_NUMBER() OVER (ORDER BY UserId asc ) as RowNumber

    FROM
    [dbo].[aspnet_Membership]
    WHERE
     ([ApplicationId] = @ApplicationId AND @ApplicationId is not null)
    OR ([UserId] = @UserId AND @UserId is not null)
    OR ([Password] = @Password AND @Password is not null)
    OR ([PasswordFormat] = @PasswordFormat AND @PasswordFormat is not null)
    OR ([PasswordSalt] = @PasswordSalt AND @PasswordSalt is not null)
    OR ([MobilePIN] = @MobilePin AND @MobilePin is not null)
    OR ([Email] = @Email AND @Email is not null)
    OR ([LoweredEmail] = @LoweredEmail AND @LoweredEmail is not null)
    OR ([PasswordQuestion] = @PasswordQuestion AND @PasswordQuestion is not null)
    OR ([PasswordAnswer] = @PasswordAnswer AND @PasswordAnswer is not null)
    OR ([IsApproved] = @IsApproved AND @IsApproved is not null)
    OR ([IsLockedOut] = @IsLockedOut AND @IsLockedOut is not null)
    OR ([CreateDate] = @CreateDate AND @CreateDate is not null)
    OR ([LastLoginDate] = @LastLoginDate AND @LastLoginDate is not null)
    OR ([LastPasswordChangedDate] = @LastPasswordChangedDate AND @LastPasswordChangedDate is not null)
    OR ([LastLockoutDate] = @LastLockoutDate AND @LastLockoutDate is not null)
    OR ([FailedPasswordAttemptCount] = @FailedPasswordAttemptCount AND @FailedPasswordAttemptCount is not null)
    OR ([FailedPasswordAttemptWindowStart] = @FailedPasswordAttemptWindowStart AND @FailedPasswordAttemptWindowStart is not null)
    OR ([FailedPasswordAnswerAttemptCount] = @FailedPasswordAnswerAttemptCount AND @FailedPasswordAnswerAttemptCount is not null)
    OR ([FailedPasswordAnswerAttemptWindowStart] = @FailedPasswordAnswerAttemptWindowStart AND @FailedPasswordAnswerAttemptWindowStart is not null)

    )
            SELECT
                *
            FROM
                tempPagedEntities
            WHERE
                RowNumber > @LowerBand AND RowNumber <= @UpperBand

    SELECT @@ROWCOUNT
  END

  END


问:
xstream is not parsing root element
I am using 'com.thoughtworks.xstream:xstream:1.4.10' library and trying to parse xml files.

Broker is the root element and there are other tags inside

```<code><broker>
   <othertags/>
</broker>
</code>```

The problem is when I am generating an xml file it is generating properly but it is not able read a file.

```<code>@XStreamAlias("broker")
public static class Broker {
</code>```

While file generation it is able to convert Broker class to  but not the other way around. All other classes and list are getting correctly mapped but the root @XStreamAlias is not working while reading.

Any pointers as to why will be very helpful.

The exception I am getting:
com.thoughtworks.xstream.mapper.CannotResolveClassException: broker

One more question: while calling xStream.fromXML(responseString) how does xStream know which class to use? Say I have two classes with same alias

答:
XStream does not process annotations by default.
Add the following before the deserialization of your xml content.</p>

```<code>XStream xstream = new XStream();
xstream.processAnnotations(Broker.class);
</code>```

Title: xstream is not parsing root element

Body:
I am using 'com.thoughtworks.xstream:xstream:1.4.10' library and trying to parse xml files.

Broker is the root element and there are other tags inside

<broker>
   <othertags/>
</broker>

The problem is when I am generating an xml file it is generating properly but it is not able read a file.

@XStreamAlias("broker")
public static class Broker {

While file generation it is able to convert Broker class to  but not the other way around. All other classes and list are getting correctly mapped but the root @XStreamAlias is not working while reading.

Any pointers as to why will be very helpful.

The exception I am getting:
com.thoughtworks.xstream.mapper.CannotResolveClassException: broker

One more question: while calling xStream.fromXML(responseString) how does xStream know which class to use? Say I have two classes with same alias

Body:
XStream does not process annotations by default.
Add the following before the deserialization of your xml content.

XStream xstream = new XStream();
xstream.processAnnotations(Broker.class);


问:
Karate testing clean up after each scenario/feature
This is a practical scenario we are facing in using karate for testing -

We have a graph API which we test using karate.

Imagine this -
each karate feature creates a parent and child nodes in graph to validate certain business logic.

Then imagine that there's a suite of 100 tests which means 100 small graphs are created (database records).

We want to cleanup all of these 100 small graphs to avoid polluting the system with stale test data.

Could anyone suggest a cleanup strategy here? AfterFeature which is supposed to help in cleanup is of no use because there's no state/variable sharing between any 2 features i.e. we would never know the IDs of the parents/children who were created in previous feature

Assigning values to a global variable(defined in Background section) in each Scenario also gets reset and can not maintain IDs to be cleaned up.

答:
Facing same issue. Is there a way to pass parameter to AfterScenario?

Because, In afterscenario whatever ID we set in config variable or background variable is being reset.

If I clean all the graphs in afterScenario or afterFeature, then I can not do parallelization.

Also, In your example above , this statement written in karate-config.js gives error.  "config.SuiteUtils = Java.type('com.myco.SuiteUtils') "


问:
How does renaming a table in a Database work?
```<code>ALTER TABLE table_name
RENAME TO new_table_name;
</code>```

Does it delete the table named table_name and create a new table called new_table_name, or does it rename it right away?

答:
No, all renaming an object in PostgreSQL does is to change a single entry in a catalog table.

In the case of tables, this is the relname column in pg_class.

All internal references to the table are done via its “object ID”.

The exception here are functions. Function bodies are strings, and if you refer to a table by name in a function, that is not updated.

Body:
ALTER TABLE table_name
RENAME TO new_table_name;

Does it delete the table named table_name and create a new table called new_table_name, or does it rename it right away?


问:
List View \ Database \ ComboBox , c#
On my form there is 6 Combo-Boxes. I have stored their values in a table "TableauCombo" to use again. I set a "for" to browse the table and for each step, the program has to write in the variable "query" all the values that are in the table. ( To create the SQL query). Next, I launch the SQL Request and have to write the values in the list view. I have some errors, but I'm unable to resolve them. Can you help me?

I put the code and the errors underneath

```<code> string[] TableauCombo = new string[7];
                {
                    TableauCombo[0] = "ID_Rad=@" + CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[1] = "Code_Etat=@" + CodeEtatFS_ComboBox_Home.SelectedIndex.ToString(); ;
                    TableauCombo[2] = "Code_Producteur=@" + Producteur_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[3] = "Code_Centre=@" + Centre_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[4] = "Code_StationdeDestination=@" + StationDestination_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[5] = "Code_Conditionnement=@" + Conditionnement_ComboBox_Home.SelectedIndex.ToString();
                };

                string requery = "";
                for (int i = 0; i < TableauCombo.Length; i++)
                {
                    requery = requery + TableauCombo[i];
                }
                LW_FS_Home.Items.Clear();
                MySqlCommand cmd = new MySqlCommand("SELECT FS FROM cdh.fiche WHERE " + requery + " ", connection);            // Requète SQL SELECT
                MessageBox.Show("Requery" + requery + "");
                cmd.Parameters.AddWithValue("@ID_Rad", CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString());          //Récupération du ID_Rad souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Etat", CodeEtatFS_ComboBox_Home.ToString());                                //Récupération du Code_Etat souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Producteur", Producteur_ComboBox_Home.ToString());                          //Récupération du Code_Producteur souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Centre", Centre_ComboBox_Home.ToString());                                  //Récupération du Code_Centre souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_StationdeDestination", StationDestination_ComboBox_Home.ToString());        //Récupération du Code_StationdeDestination souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Conditionnement", Conditionnement_ComboBox_Home.Text);                      //Récupération du Code_Conditionnement souhaité par l'utilisateur

                if (Connecté)
                {
                    using (MySqlDataReader Lire = cmd.ExecuteReader())
                    {
                        while (Lire.Read())  // Boucle While qui regarde toutes les infos que l'on souhaite voir avec la méthode "lire"
                        {
                            string FS = Lire["@FS"].ToString();                                                               // Declaration des colonnes et leurs équivalents (remplacants)
                            string ID_Rad = Lire["@ID_Rad"].ToString();
                            string Code_Etat = Lire["@Code_Etat"].ToString();
                            string Code_Producteur = Lire["@Code_Producteur"].ToString();
                            string Code_Centre = Lire["@Code_Centre"].ToString();
                            string Code_StationdeDestination = Lire["@Code_StationdeDestination"].ToString();
                            string Code_Conditionnement = Lire["@Code_Conditionnement"].ToString();

                            LW_FS_Home.Items.Add(new ListViewItem(new[] { FS, ID_Rad, Code_Etat, Code_Producteur, Code_Centre, Code_StationdeDestination, Code_Conditionnement }));// Ajout des nouvelles valeurs dans la list view
                        }
                    }
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Erreur de connexion");
                }
}
</code>```

The error :

"MySqlException : Parameter '@1' must be defined."

But the program can run itself. (Comment : test for the end) The value who is returned is : "RequeryID_Rad=@1+..........". (Picture) ERROR

Just to be explicit, all combobox has declared like that :

```<code>try //Début Try/Catch pour le ComboBox des catégorie Radiologiqque
{
    connection.Open();
    CatégorieRadiologique_ComboBox_Home.DropDownStyle = ComboBoxStyle.DropDownList; //ReadOnly sur la comboBox
    string selectQuery = "SELECT ID_Rad , Radiologique FROM cdh.ctg_rad";
    MySqlCommand command = new MySqlCommand(selectQuery, connection);
    MySqlDataReader reader = command.ExecuteReader();

    while (reader.Read()) {
        CatégorieRadiologique_ComboBox_Home.Items.Add(reader.GetString("Radiologique"));
        string[, ] TableauRad = new string[1, 2] {
            {
                "ID_Rad", "Radiologique"
            },

        };
    }
    connection.Close();
} catch (MySqlException cn)

{
    MessageBox.Show(cn.Message);
    connection.Close();
}
</code>```

I think my "for" it's wrong or the link with the listview idk..

答:
You passed the parameter wrongly, you should pass just parameter name in query and set parameter with command.Parameters.Add like below:

```<code>string[] TableauCombo = new string[6];
TableauCombo[0] = "ID_Rad=@ID_Rad";
TableauCombo[1] = "Code_Etat=@Code_Etat";
TableauCombo[2] = "Code_Producteur=@Code_Producteur";
TableauCombo[3] = "Code_Centre=@Code_Centre";
TableauCombo[4] = "Code_StationdeDestination=@Code_StationdeDestination";
TableauCombo[5] = "Code_Conditionnement=@Code_Conditionnement";

string requery = string.Join(" AND ", TableauCombo);
LW_FS_Home.Items.Clear();
MySqlCommand cmd = new MySqlCommand("SELECT FS FROM cdh.fiche WHERE " + requery + " ", connection);

cmd.Parameters.AddWithValue("@ID_Rad", CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString());          //Récupération du ID_Rad souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Etat", CodeEtatFS_ComboBox_Home.SelectedIndex.ToString());                                //Récupération du Code_Etat souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Producteur", Producteur_ComboBox_Home.SelectedIndex.ToString());                          //Récupération du Code_Producteur souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Centre", Centre_ComboBox_Home.SelectedIndex.ToString());                                  //Récupération du Code_Centre souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_StationdeDestination", StationDestination_ComboBox_Home.SelectedIndex.ToString());        //Récupération du Code_StationdeDestination souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Conditionnement", Conditionnement_ComboBox_Home.SelectedIndex.ToString());                      //Récupération du Code_Conditionnement souhaité par l'utilisateur
</code>```

but I'm not sure about combo box selected indices that as the same as column values in cdh.fiche table

Title: List View \ Database \ ComboBox , c#

Body:
On my form there is 6 Combo-Boxes. I have stored their values in a table "TableauCombo" to use again. I set a "for" to browse the table and for each step, the program has to write in the variable "query" all the values that are in the table. ( To create the SQL query). Next, I launch the SQL Request and have to write the values in the list view. I have some errors, but I'm unable to resolve them. Can you help me?

I put the code and the errors underneath

 string[] TableauCombo = new string[7];
                {
                    TableauCombo[0] = "ID_Rad=@" + CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[1] = "Code_Etat=@" + CodeEtatFS_ComboBox_Home.SelectedIndex.ToString(); ;
                    TableauCombo[2] = "Code_Producteur=@" + Producteur_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[3] = "Code_Centre=@" + Centre_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[4] = "Code_StationdeDestination=@" + StationDestination_ComboBox_Home.SelectedIndex.ToString();
                    TableauCombo[5] = "Code_Conditionnement=@" + Conditionnement_ComboBox_Home.SelectedIndex.ToString();
                };

                string requery = "";
                for (int i = 0; i < TableauCombo.Length; i++)
                {
                    requery = requery + TableauCombo[i];
                }
                LW_FS_Home.Items.Clear();
                MySqlCommand cmd = new MySqlCommand("SELECT FS FROM cdh.fiche WHERE " + requery + " ", connection);            // Requète SQL SELECT
                MessageBox.Show("Requery" + requery + "");
                cmd.Parameters.AddWithValue("@ID_Rad", CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString());          //Récupération du ID_Rad souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Etat", CodeEtatFS_ComboBox_Home.ToString());                                //Récupération du Code_Etat souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Producteur", Producteur_ComboBox_Home.ToString());                          //Récupération du Code_Producteur souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Centre", Centre_ComboBox_Home.ToString());                                  //Récupération du Code_Centre souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_StationdeDestination", StationDestination_ComboBox_Home.ToString());        //Récupération du Code_StationdeDestination souhaité par l'utilisateur
                cmd.Parameters.AddWithValue("@Code_Conditionnement", Conditionnement_ComboBox_Home.Text);                      //Récupération du Code_Conditionnement souhaité par l'utilisateur

                if (Connecté)
                {
                    using (MySqlDataReader Lire = cmd.ExecuteReader())
                    {
                        while (Lire.Read())  // Boucle While qui regarde toutes les infos que l'on souhaite voir avec la méthode "lire"
                        {
                            string FS = Lire["@FS"].ToString();                                                               // Declaration des colonnes et leurs équivalents (remplacants)
                            string ID_Rad = Lire["@ID_Rad"].ToString();
                            string Code_Etat = Lire["@Code_Etat"].ToString();
                            string Code_Producteur = Lire["@Code_Producteur"].ToString();
                            string Code_Centre = Lire["@Code_Centre"].ToString();
                            string Code_StationdeDestination = Lire["@Code_StationdeDestination"].ToString();
                            string Code_Conditionnement = Lire["@Code_Conditionnement"].ToString();

                            LW_FS_Home.Items.Add(new ListViewItem(new[] { FS, ID_Rad, Code_Etat, Code_Producteur, Code_Centre, Code_StationdeDestination, Code_Conditionnement }));// Ajout des nouvelles valeurs dans la list view
                        }
                    }
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Erreur de connexion");
                }
}

The error :

"MySqlException : Parameter '@1' must be defined."

But the program can run itself. (Comment : test for the end) The value who is returned is : "RequeryID_Rad=@1+..........". (Picture) ERROR

Just to be explicit, all combobox has declared like that :

try //Début Try/Catch pour le ComboBox des catégorie Radiologiqque
{
    connection.Open();
    CatégorieRadiologique_ComboBox_Home.DropDownStyle = ComboBoxStyle.DropDownList; //ReadOnly sur la comboBox
    string selectQuery = "SELECT ID_Rad , Radiologique FROM cdh.ctg_rad";
    MySqlCommand command = new MySqlCommand(selectQuery, connection);
    MySqlDataReader reader = command.ExecuteReader();

    while (reader.Read()) {
        CatégorieRadiologique_ComboBox_Home.Items.Add(reader.GetString("Radiologique"));
        string[, ] TableauRad = new string[1, 2] {
            {
                "ID_Rad", "Radiologique"
            },

        };
    }
    connection.Close();
} catch (MySqlException cn)

{
    MessageBox.Show(cn.Message);
    connection.Close();
}

I think my "for" it's wrong or the link with the listview idk..

Body:
You passed the parameter wrongly, you should pass just parameter name in query and set parameter with command.Parameters.Add like below:

string[] TableauCombo = new string[6];
TableauCombo[0] = "ID_Rad=@ID_Rad";
TableauCombo[1] = "Code_Etat=@Code_Etat";
TableauCombo[2] = "Code_Producteur=@Code_Producteur";
TableauCombo[3] = "Code_Centre=@Code_Centre";
TableauCombo[4] = "Code_StationdeDestination=@Code_StationdeDestination";
TableauCombo[5] = "Code_Conditionnement=@Code_Conditionnement";

string requery = string.Join(" AND ", TableauCombo);
LW_FS_Home.Items.Clear();
MySqlCommand cmd = new MySqlCommand("SELECT FS FROM cdh.fiche WHERE " + requery + " ", connection);

cmd.Parameters.AddWithValue("@ID_Rad", CatégorieRadiologique_ComboBox_Home.SelectedIndex.ToString());          //Récupération du ID_Rad souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Etat", CodeEtatFS_ComboBox_Home.SelectedIndex.ToString());                                //Récupération du Code_Etat souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Producteur", Producteur_ComboBox_Home.SelectedIndex.ToString());                          //Récupération du Code_Producteur souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Centre", Centre_ComboBox_Home.SelectedIndex.ToString());                                  //Récupération du Code_Centre souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_StationdeDestination", StationDestination_ComboBox_Home.SelectedIndex.ToString());        //Récupération du Code_StationdeDestination souhaité par l'utilisateur
cmd.Parameters.AddWithValue("@Code_Conditionnement", Conditionnement_ComboBox_Home.SelectedIndex.ToString());                      //Récupération du Code_Conditionnement souhaité par l'utilisateur

but I'm not sure about combo box selected indices that as the same as column values in cdh.fiche table