问题列表 - 第48483页

jQuery - 检查元素是否有数组中的类?

我试图检查一个元素是否有一个数组的类,如果是这样,该类的值是什么.目前我正在使用:

if ($(this).hasClass('purple_grad')) {
            $thisFKeyColour = 'purple_grad';
        } else if ($(this).hasClass('red_grad')) {
            $thisFKeyColour = 'red_grad';
        } else if ($(this).hasClass('green_grad')) {
            $thisFKeyColour = 'green_grad';
        } else if ($(this).hasClass('blue_grad')) {
            $thisFKeyColour = 'blue_grad';
        } else if ($(this).hasClass('yellow_grad')) {
            $thisFKeyColour = 'yellow_grad';
        } else if ($(this).hasClass('light_yellow_grad')) {
            $thisFKeyColour = 'light_yellow_grad';
        } else if ($(this).hasClass('lighter_yellow_grad')) {
            $thisFKeyColour = 'lighter_yellow_grad';
        } else if ($(this).hasClass('grey_grad')) {
            $thisFKeyColour = 'grey_grad';
        } else if ($(this).hasClass('light_grey_grad')) {
            $thisFKeyColour = 'light_grey_grad';
        } else if ($(this).hasClass('black_grad')) {
            $thisFKeyColour = 'black_grad';
        } …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery dom class

9
推荐指数
2
解决办法
1万
查看次数

gnumake .RECIPEPREFIX问题

我试图使用特殊变量.RECIPEPREFIX,以避免难以看到标签,但它似乎不起作用.我的简单测试makefile是:

    .RECIPEPREFIX = +

    all:
    + @echo OK

但我收到的消息是:

xxx:4: *** missing separator.  Stop.

gnu-make

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

Kentico中的多对多关系

是否有关于如何构建基于多对多关系的Kentico CMS门户实施的最佳实践(即销售食品并且有大部分食谱的网站 - 每种产品都用于许多食谱,每个食谱可以使用网站上销售的许多产品)?

Kentico是否只是错误的工具,或者Kentico中是否有解决方案来处理这种关系?

c# many-to-many content-management-system kentico

10
推荐指数
1
解决办法
2404
查看次数

错误DownloadStringCompletedEventHandler

我不明白错误在哪里...

using System.Xml.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;


namespace xmldow
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void clickBott(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
            client.DownloadStringAsync(new Uri("http://example.net/ddd/my.xml"));

        }

        void client_DownloadStringCompleted(Object sender, DownloadStringCompletedEventHandler e)
        {
            throw new NotImplementedException();


        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是错误:

错误1'client_DownloadStringCompleted'没有重载匹配委托'System.Net.DownloadStringCompletedEventHandler'

谢谢

c# windows-phone-7

0
推荐指数
1
解决办法
997
查看次数

Spring上的嵌套事务

我在使用嵌套的Spring事务时发现了一些奇怪的行为:当在同一个类中,一个注释为@Transactional调用的方法时,另一个注释为@Transactional第二个注释的方法也没有被使用.

我们考虑以下课程:

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
        final Main main = context.getBean(Main.class);
        // First Op
        System.out.println("Single insert: " + main.singleInsert());
        // Second Op
        main.batchInsert();
        // Third Op
        main.noTransBatchInsert();
    }

    @PersistenceContext
    private EntityManager pm;

    @Transactional(propagation=Propagation.REQUIRED)
    public void batchInsert() {
        System.out.println("batchInsert");
        System.out.println("First insert: " + singleInsert());
        System.out.println("Second insert: " + singleInsert());
    }

    public void noTransBatchInsert() {
        System.out.println("noTransBatchInsert");
        System.out.println("First insert: " + singleInsert());
        System.out.println("Second insert: " + singleInsert());
    } …
Run Code Online (Sandbox Code Playgroud)

spring annotations transactions

15
推荐指数
2
解决办法
1万
查看次数

c#httpwebrequest凭证问题

我正在尝试使用httpwebrequest对象登录www.diary.com.但是,它总是无法登录,并不断给我回登录页面.有人可以告诉我什么是错的?

我的代码如下:

// prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)
    WebRequest.Create(@"http://diary.com/events/agenda");

request.ContentType = "text/html";

request.Credentials = new NetworkCredential(@"user@hotmail.com", "password");

request.AllowAutoRedirect = true;
request.Referer = @"http://diary.com/";

// execute the request
HttpWebResponse response = (HttpWebResponse)
    request.GetResponse();

// we will read data via the response stream
Stream resStream = response.GetResponseStream();

// set the WebBrowser object documentStream to the response stream
myWB.DocumentStream = resStream;

// simply tell me the title of the webpage
MessageBox.Show(myWB.Document.Title);
Run Code Online (Sandbox Code Playgroud)

c# screen-scraping credentials httpwebrequest

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

如何删除其他进程正在使用的文件?

当我尝试删除文件时发生以下异常:

该进程无法访问该文件,因为它正由另一个进程使用.

我的代码看起来像:

string[] files = Directory.GetFiles(@"C:\SEDocumentConverter\SOURCE");
foreach (string file in files)
{               
   File.Delete(file);
}
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

.net c# file-io file file-locking

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

当变量是final时,无法实现try/catch/finally

我有个问题.

我使用的变量必须是final,因为我在匿名内部类中使用它.

try { 
    final IndexSearcher searcher = new IndexSearcher(index.getDirectory(),true);

    searcher.search(query, new HitCollector() {
                public void collect(int doc, float score) {
                    try {
                        resultWorker.add(new ProcessDocument(searcher.doc(doc)));
                    } catch (CorruptIndexException e) {
                        log.error("Corrupt index found during search", e);
                    } catch (IOException e) {
                        log.error("Error during search", e);
                    }
                }
            });
} catch (CorruptIndexException e) {
    log.error("Corrupt index found during search", e);
} catch (IOException e) {
    log.error("Error during search", e);
} finally {
    if(searcher != null) 
        searcher.close();
}
Run Code Online (Sandbox Code Playgroud)

问题是我得到编译器错误说 searcher cannot be …

java lucene compiler-errors

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

Java改写为Clojure

我的公司刚刚要求我在Clojure中重写一个较大的(50,000行单行代码)Java应用程序(使用JSP和servlet的Web应用程序).有没有其他人得到关于我应该注意什么的提示?

请记住,我非常了解Java和Clojure.

更新

我做了重写,然后投入生产.这是非常奇怪的,因为重写最终进展得如此之快,以至于它在大约6周内完成.因为不需要很多功能,它最终更像是3000行的Clojure.

我听说他们对系统感到满意,并且完全按照自己的意愿行事.唯一的缺点是,维护系统的人必须从零开始学习Clojure,并且他被踢进去并且尖叫着.前几天我确实接到了他的电话说他现在喜欢Lisp ..好笑:)

另外,我应该好好提一下Vaadin.使用Vaadin可能占用了Clojure所节省的时间和代码的短缺.Vaadin仍然是我曾经使用的顶级Web框架,尽管现在我正在愤怒地学习ClojureScript!(请注意,Vaadin和ClojureScript都使用了Google的GUI框架.)

java clojure vaadin

96
推荐指数
2
解决办法
5957
查看次数

jquery ui tabs不工作

我有以下脚本不起作用.它应该使用jquery选项卡,但由于某些原因链接没有转换为选项卡:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />

    <script type="text/javascript" language="javascript"> 
        $(document).ready(function(){
            $( "#tabs" ).tabs();
        });
    </script>

</head>
<body>

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Nunc tincidunt</a></li>
        <li><a href="#tabs-2">Proin dolor</a></li>
        <li><a href="#tabs-3">Aenean lacinia</a></li>
    </ul>
    <div id="tabs-1">
        <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, </p>
    </div>
    <div id="tabs-2">
        <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus </p>
    </div>
    <div id="tabs-3">
        <p>Mauris eleifend est …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui jquery-ui-tabs

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