问题列表 - 第14485页

如何键入此反射警告?

(set! *warn-on-reflection* true)
(proxy [javax.swing.JPanel] []
  (paintComponent [#^java.awt.Graphics g]
    (proxy-super paintComponent g)
    (.fillRect g 100 100 10 10)))
Run Code Online (Sandbox Code Playgroud)

"反射警告,调用paintComponent无法解决"

reflection clojure

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

没有递归

我写了一个递归函数.出于某种原因,它在第一次运行后才会自行调用.它只需要循环中的下一个项目而不会更深入.我正在使用Visual Studio 10,而且我睡不着觉.

public IEnumerable<string> GeneratePath(int depth)
{
    int presentDepth = depth;
    char currentPosition = this.workingPath[presentDepth];
    presentDepth++;

    foreach (char nextPosition in this.moveTable.GetPossibleNextPositions(currentPosition))
    {
        this.workingPath[presentDepth] = nextPosition;

        if (presentDepth < (ChessPiece.targetDepth - 1))
        {
            Console.WriteLine("At least this wasn't ignored:{0}", new string(this.workingPath));
            this.GeneratePath(presentDepth);
        }
        else
            yield return new string(this.workingPath);
    }
}
Run Code Online (Sandbox Code Playgroud)

c# algorithm recursion visual-studio

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

如何在iframe中下载文件时触发onload事件?

假设我们有以下HTML文件:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test iframe download</title>
<script type="text/javascript">

var init = 0;

function download() {
  document.getElementById("dload_frame").src = "http://example.com/dload.py";
}

function alert() {
  if (init == 0) {
    init = 1;
  }
  else {
    document.getElementById("alert_span").innerHTML = "Got it!";
  }
}

</script>
</head>
<body>

  <span id="alert_span">Main content.</span><br/>
  <input type="button" value="Download" id="btn" onclick="download()" />
  <iframe id="dload_frame" src="http://404.com/404" onload="alert()"> </iframe>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

现在,如果iframe的src被重写到的URL(在这种情况下 - " http://example.com/dload.py ")返回HTML,没问题:onload事件触发,span的内容被替换,每个人的快乐.

但是,如果URL返回的文件的内容类型设置为强制浏览器打开保存文件对话框的内容,则iframe的onload事件永远不会触发.

有没有解决方法?不需要使用iframe,所需的行为是在浏览器开始下载提供的文件后启动回调.

iframe download onload

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

Javascript不会影响使用javascript添加的html代码

我正在使用jquery和uploadify将照片上传到服务器.上传照片后,使用ajax将它们添加到div容器中.一切都很好,除了DELETE按钮.所有删除按钮都适用于页面加载,但通过ajax添加的按钮不起作用.我想这是因为我定义了能够删除图像的功能,并且没有使用"经典"删除方式(表单删除):

// Delete photo              
    $(".blog_slike .delete_slika").click(function() {
        var commentContainer = $(this).parent().parent();
        var id = $(this).attr("id");
        var string = 'id='+ id ;

        $.ajax({
           type: "POST",
           url: "./include/ajax-edit/delete.php?polje=blog_slika",
           data: string,
           cache: false,
           success: function(){
            commentContainer.fadeOut("slow");
            $('#load').fadeOut();
           }       
        });

        return false;
    });
Run Code Online (Sandbox Code Playgroud)

知道如何使用append()函数将按钮添加到html代码后使按钮工作吗?

还有一件事......将照片添加到tinymce编辑器中我使用此功能:

<a href=\"javascript:;\" onmousedown=\"tinyMCE.execCommand('mceInsertContent',false,'$slike_u_sadrzaj');\">Ubaci sve slike u blog</a>
Run Code Online (Sandbox Code Playgroud)

...也是在页面加载时添加的.如何将内容添加到所在$slike_u_sadrzaj位置以及如何删除它?

谢谢,Ile

javascript ajax jquery append

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

如何让Intellisense只显示属性或仅显示事件等

我敢肯定,我不是唯一一个在Intellisense中扫描说事件并且不得不涉及所有属性等时发现它有点恼人的人.有没有方法/插件或东西只允许选择事件,只有属性等?

这真的是一大优点!

intellisense visual-studio-2010 visual-studio-2008

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

Asp.Net MVC /实体框架.避免标签汤?

好,

我有一个新的MVC项目,它使用实体框架.我正在吐出消息(这是一个公告板样式部分),现在根据一些条件因素,表输出中的行必须具有不同的类样式.

从控制器传递到页面的模型是实体模型(称为消息并包含与数据库相同的字段)

现在为了得到行样式我做了以下,

<%
               int i = 0;
               foreach (var message in ViewData.Model.MessageList)
               {
                   string className = "rowEven";

                   if (i % 2 == 0) { className = "rowOdd"; }
                   if (message.Deleted) { className = "deleted"; }
                   if (message.AuthorisedBy == null) { className = "notAuth"; }
                   if (message.Deleted) { className = "deleted"; }

           %>
                    <tr class="<%=className%>">
                        <td><%= Html.CheckBox("mc1")%></td>
                        <td>
                            <%= Html.ActionLink(message.Title, "Details", new { id = message.MessageID })%>
                        </td>
                        <td>User Name Here</td>
                        <td><%= Html.Encode(message.PublishDateTime.ToString())%></td>
                    </tr>                 
           <%
                   i++;
               } 
           %>
Run Code Online (Sandbox Code Playgroud)

哪个非常难看,必须有更好的方法来做这个,有什么建议吗?

asp.net-mvc tag-soup entity-framework

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

使用太多JavaScript有什么缺点?

我想知道在网页中使用过多JavaScript代码会有什么缺点吗?

例如,我将为我的下拉菜单,选项卡和手风琴使用jQuery框架.和我的日历的其他JavaScripts(即使有可用的日历,使用jQuery)和其他JavaScript的其他东西?有什么影响?(我认为JavaScript与重载相矛盾)

我知道很多开发人员掌握了2个以上的JavaScript框架.我的问题是:在开发项目时,如何为该项目选择JavaScript框架?为什么要为该项目使用MooTools或jQuery?(我知道这是一个选择问题),但还有其他原因吗?就像mootools对此有好处......或者jQuery对此有好处......

我想听听你的意见.

javascript jquery mootools javascript-framework prototypejs

6
推荐指数
2
解决办法
4145
查看次数

适用于Java的最佳CLI解析器

哪种Java解析器易于使用且比其他解析器更具可扩展性?

java command-line picocli

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

修复错误:为"Microsoft.VisualStudio.TestTools.TypesAndSymbols.Assembly"创建私有访问器失败

我正在为Windows窗体应用程序创建单元测试.我的一个方法是表单的事件处理程序(我不知道这是否是我的问题的来源):

private void ImportButton_Click(object sender, System.EventArgs e)
{
    // blah blah
}
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试通过右键单击源 - >"创建单元测试"来创建此方法的单元测试时,一切似乎都正常工作,直到我打开生成的单元测试代码:

/// <summary>
///A test for ImportButton_Click
///</summary>
[TestMethod()]
[DeploymentItem("FooBar.exe")]
public void ImportButton_ClickTest()
{
    // Creation of the private accessor for 'Microsoft.VisualStudio.TestTools.TypesAndSymbols.Assembly' failed
    Assert.Inconclusive("Creation of the private accessor for \'Microsoft.VisualStudio.TestTools.TypesAndSy" +
            "mbols.Assembly\' failed");
}
Run Code Online (Sandbox Code Playgroud)

任何想法如何解决这一问题?我发现这个MSDN论坛帖子详细说明了一个我认为不适用于我的问题的类似问题.

c# unit-testing winforms

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

rails - :加入消毒/替代

是否可以指定参数:连接类似于:条件的方式?

这是一个例子(sql代码无关紧要)

named_scope :threads, {
  :joins => [" LEFT JOIN groups_messages gm ON messages.id=gm.message_id AND gm.group_id IN (?) ",@group_ids_array], 
  :conditions => ["creator_id=? AND messages.id IN (?)", current_user_id, @message_ids_array]
}
Run Code Online (Sandbox Code Playgroud)

在这个示例参数:条件将正确插入,但对于:连接我会得到一个错误

 Association named '  LEFT JOIN groups_messages gm ON messages.id=gm.message_id and gm.group_id IN (?) ' was not found; perhaps you misspelled it?
Run Code Online (Sandbox Code Playgroud)

什么函数替换参数:条件?

join ruby-on-rails substitution

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