小编r.p*_*ski的帖子

jQuery找到$ .find('selector')与$('selector')的区别

我有一个问题,为什么这两个代码片段不同.

$('#ctl00_DDMenu1_HyperLink1')  
//jQuery(a#ctl00_DDMenu1_HyperLink1 Default.aspx) Console output
$('#ctl00_DDMenu1_HyperLink1').text()
Run Code Online (Sandbox Code Playgroud)

上面的代码返回: Some link text

$.find('#ctl00_DDMenu1_HyperLink1')  
//[a#ctl00_DDMenu1_HyperLink1 Default.aspx] Consolee output
$.find('#ctl00_DDMenu1_HyperLink1').text()
Run Code Online (Sandbox Code Playgroud)

返回

TypeError:$.find("#ctl00_DDMenu1_HyperLink1").text不是函数

这是否意味着无法访问$.find返回Array对象[]和jQuery函数?

//编辑

我使用过jQuery 1.4.2并使用过Firebug控制台.

//通过练习找到答案

此代码将返回jQuery对象引用,并且可以访问所有jQuery函数.

$('any_selector')
//jQuery(item1),jQuery(item2),...,jQuery(item-N) Console output $('any_selector').text()

此代码返回JavaScript Array对象,因此jQuery的任何函数都不能应用于resultset.即使结果集似乎相同.

$.find('any_selector')
//[item1,item2,...,item-N] Consolee output
$.find('any_selector').text()

但是我们可以把把js Array包装成jQuery选择器的技巧(奇怪的技巧):

$($.find('any_selector_as_inner_select')).val()

//谢谢你的帮助!

jquery find css-selectors

16
推荐指数
1
解决办法
4万
查看次数

配置netbeans 8.0 gdb以使用gradle cpp插件

最近我使用Netbeans 8.0(C++)从Windows 7中的Visual Studio切换到Ubuntu.从那时起,我从NetBeans调试我的应用程序时遇到了很大的问题(gdb工作得很好).我用gradle编写了hello world c ++来演示我的问题.我花了很多时间但没有任何重大进展.

Gradle项目

build.gradle:

apply plugin: 'cpp'

executables {
    helloWorld
}
binaries.all {
     cppCompiler.args "-g"
}
Run Code Online (Sandbox Code Playgroud)

main.cpp中:

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int a = 10;
    int b = 12;
    int c = a + b;
    puts("Hello World!!!");
    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)

然后我构建并运行gdb:

robert-Aspire-S3:~/NetBeansProjects/helloWorld$ gradle helloWorldExecutable
robert-Aspire-S3:~/NetBeansProjects/helloWorld$ gdb ./build/binaries/helloWorldExecutable/helloWorld                     
....
Reading symbols from ./build/binaries/helloWorldExecutable/helloWorld...done.
(gdb) b 5
Breakpoint 1, main () at /home/robert/NetBeansProjects/helloWorld/src/helloWorld/cpp/main.cpp:5
5           int a = 10;
(gdb) n                                                                                                                         
6           int …
Run Code Online (Sandbox Code Playgroud)

c++ debugging gdb netbeans gradle

12
推荐指数
1
解决办法
899
查看次数

Lucene.net 2.9.2排序(排序不起作用)

我在.NET中对lucene.net索引进行排序时遇到了问题.我尝试了stackoverflow上的几乎所有解决方案,并寻找谷歌的答案.我正在使用Lucene.NET 2.9.2和ASP.NET 2.0.我想在sql中对字符串进行排序,你可以输入'order by title desc [asc]'

我会告诉你我的代码,我希望有人可以帮助我.

    //Here I create Index with some fields
    doc.Add(new Field("prod_id",row["prod_id"].ToString(),Field.Store.YES,Field.Index.ANALYZED));
            doc.Add(new Field("prod_title", row["prod_title"].ToString(), Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("prod_desc", row["prod_desc"].ToString(), Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("prod_author", row["prod_author"].ToString(), Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("prod_publisher", row["prod_publisher"].ToString(), Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("prod_price", row["prod_price"].ToString(), Field.Store.YES, Field.Index.ANALYZED));

//Then next I try to do search with sort option:

//method for return approciate Sort object
private static Sort SetSortForLucene(string _sort)
    {
        Sort sort;
        switch (_sort)
        {
            case "UnitPriceGorss":
                sort = new Sort(new SortField("prod_price",SortField.DOUBLE,false);
                break;

            case "UnitPriceGorssDESC":
                sort …
Run Code Online (Sandbox Code Playgroud)

sorting lucene.net

6
推荐指数
1
解决办法
5572
查看次数

Playframework - 请求[A]与RequestHeader

我无法理解之间diffrence play.api.mvc.Request[A]play.api.mvc.RequestHeaderplay.api.mvc.Request[play.api.mvc.AnyContent].


在编译课上我有

trait Request[+A] extends scala.AnyRef with play.api.mvc.RequestHeader {
  def $init$() : scala.Unit = { /* compiled code */ }
  def body : A
  def map[B](f : scala.Function1[A, B]) : play.api.mvc.Request[B] = { /* compiled code */ }
}
object Request extends scala.AnyRef {
  def apply[A](rh : play.api.mvc.RequestHeader, a : A) : scala.AnyRef with play.api.mvc.Request[A] {
  val remoteAddress : scala.Predef.String
  def username : scala.None.type
  val body : A
} = { /* compiled code …
Run Code Online (Sandbox Code Playgroud)

scala playframework playframework-2.0

5
推荐指数
1
解决办法
3140
查看次数