半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-11-26 07:54:03

我认为您无法编辑此对话框选项,但您可以在用户选择文件后验证该文件。

要编辑对话框,我记得您可以通过 Flash 或 Silverlight 上传器(例如 swfUpload)来完成此操作。

I don't think you can edit this dialog options, but you can validate the file after the user select it.

tO edit the dialog, I remember that you can do that by a flash or Silverlight uploaders, such as swfUpload.

在 HTML 文件打开对话框中过滤文件

半城柳色半声笛 2024-11-26 07:47:59

日食与Netbeans 和其他 IDE 可能有一个“生成 getter 和 setter”的快捷方式。

Eclipse & Netbeans and perhaps other IDE's have a "generate getters and setters"-shortcut.

任何可以基于javabean规则生成部分代码的工具(setter和getter方法)

半城柳色半声笛 2024-11-26 03:37:03

好吧,看起来 Sinon.JS 就是您要找的。我以前从未使用过它,但我确实回答过你的问题。

您可以将全局函数alert(实际上是window.alert)替换为一个临时函数,该函数将记录本来要显示的消息。

在 javascript (window.alert = function(msg) { savingMsg = msg; }) 中很容易做到。所以你可以在测试中做到这一点。

复杂性仅来自于运行测试后的清理工作。这就是你需要 Sinon.JS 的地方,它可以 与 QUnit 集成。您将需要此集成脚本

<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
<script type="text/javascript" src="sinon-1.1.1.js"></script>
<script type="text/javascript" src="sinon-qunit-0.8.0.js"></script>

<script>

    function to_test() {
      window.alert("I'm displaying an alert");
      return 42;
    }

    $(document).ready(function(){

      module("Module A");

      test("first skip alert test ", function() {

      var stub = this.stub(window, "alert", function(msg) { return false; } );

      equals(42, to_test(), "to_test() should return 42" );  
      equals(1, stub.callCount, "to_test() should have invoked alert one time");
      equals("I'm displaying an alert",stub.getCall(0).args[0], "to_test() should have displayed an alert" ); 

    });

  });
</script>

</head>
<body>
  <h1 id="qunit-header">QUnit example</h1>
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>

Alright, looks like Sinon.JS is what you are looking for. I've never used it before, but I did to answer your question.

You can replace the global function alert (which is actually window.alert) with a temporary function that will record the message that would have been displayed.

It's easy to do in javascript (window.alert = function(msg) { savedMsg = msg; }). So you could do that within your test.

The complexity comes only from cleaning up after you've run your test. That's where you need Sinon.JS which can integrate with QUnit. You'll need this integration script.

<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
<script type="text/javascript" src="sinon-1.1.1.js"></script>
<script type="text/javascript" src="sinon-qunit-0.8.0.js"></script>

<script>

    function to_test() {
      window.alert("I'm displaying an alert");
      return 42;
    }

    $(document).ready(function(){

      module("Module A");

      test("first skip alert test ", function() {

      var stub = this.stub(window, "alert", function(msg) { return false; } );

      equals(42, to_test(), "to_test() should return 42" );  
      equals(1, stub.callCount, "to_test() should have invoked alert one time");
      equals("I'm displaying an alert",stub.getCall(0).args[0], "to_test() should have displayed an alert" ); 

    });

  });
</script>

</head>
<body>
  <h1 id="qunit-header">QUnit example</h1>
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>

在测试使用 qunit 显示警报的方法时避免/捕获/验证 Javascript 警报

半城柳色半声笛 2024-11-26 01:28:06

与其他答案一样,这取决于服务器端代码实际提供的内容

您也许能够输出一些 javascript 来定位有问题的控件,并重置其内容,可能使用类似这样的内容...

document.getElementById('myTagId').innerHTML = 'Downloads';

但是,在不知道 HTML 是什么的情况下,我无法为您提供更多帮助。

As with other answers, this will depend on what the server side code is actually providing.

You might be able to output some javascript to locate the control in question, and reset its contents, possibly with something like this...

document.getElementById('myTagId').innerHTML = 'Downloads';

Without seeing what the HTML is, though, I can't help you much more than that.

有没有办法使用 C# 脚本来更改标签的内部 html?

半城柳色半声笛 2024-11-25 23:29:12

不是直接答案,但是...

我认为最好调用 .bat 文件,而不是使用许多命令行选项直接调用 java。这样您就不需要更改 Python 程序来添加一些其他选项(例如 -Xms2048m-Dfile.encoding=utf8)。

这样的 .bat 文件也更容易调试。

Not a direct answer but ...

I think it is better to call .bat file instead of direct call to java with many command line option. This way you will not need to change Python program to add some other options (like -Xms2048m or -Dfile.encoding=utf8).

Such .bat file is also much easier to debug.

通过命令行从python调用java程序时出现奇怪的错误

半城柳色半声笛 2024-11-25 22:08:19

这是我使用的方式:

$float = 4.3;    

$dec = ltrim(($float - floor($float)),"0."); // result .3

This is the way which I use:

$float = 4.3;    

$dec = ltrim(($float - floor($float)),"0."); // result .3

如何获取一个数的整数部分和小数部分?

半城柳色半声笛 2024-11-25 20:26:57

尝试使用匿名类型。检查以下代码:

var v = new { Property1 = "someValue", Property2 = "someOtherValue" };

匿名类型提供了一种将一组只读属性封装到单个对象中的便捷方法,而无需首先显式定义类型。

try to use anonymous type. check following code:

var v = new { Property1 = "someValue", Property2 = "someOtherValue" };

Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first.

如何动态创建类

半城柳色半声笛 2024-11-25 19:34:11
Imports Microsoft.Office.Interop

'On the Project menu, click Add Reference.
'On the COM tab, Double click ->  Microsoft Outlook xx.0 Object Library

Module Module1

    Sub Main()
        ' Create an Outlook application.
        Dim oApp As Outlook._Application
        oApp = New Outlook.Application()

        ' Create a new MailItem.
        Dim oMsg As Outlook._MailItem
        oMsg = CType(oApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook._MailItem)
        oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET"
        oMsg.Body = "Hello World" & vbCr & vbCr

        ' TODO: Replace with a valid e-mail address.
        oMsg.To = "[email protected]"

        ' Add an attachment
        ' TODO: Replace with a valid attachment path.
        Dim sSource As String = "C:\Temp\Hello.txt"
        ' TODO: Replace with attachment name
        Dim sDisplayName As String = "Hello.txt"

        Dim sBodyLen As Integer = oMsg.Body.Length
        Dim oAttachs As Outlook.Attachments = oMsg.Attachments
        Dim oAttach As Outlook.Attachment
        oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)

        ' Send
        oMsg.Send()

        ' Clean up
        oApp = Nothing
        oMsg = Nothing
        oAttach = Nothing
        oAttachs = Nothing
    End Sub

End Module
Imports Microsoft.Office.Interop

'On the Project menu, click Add Reference.
'On the COM tab, Double click ->  Microsoft Outlook xx.0 Object Library

Module Module1

    Sub Main()
        ' Create an Outlook application.
        Dim oApp As Outlook._Application
        oApp = New Outlook.Application()

        ' Create a new MailItem.
        Dim oMsg As Outlook._MailItem
        oMsg = CType(oApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook._MailItem)
        oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET"
        oMsg.Body = "Hello World" & vbCr & vbCr

        ' TODO: Replace with a valid e-mail address.
        oMsg.To = "[email protected]"

        ' Add an attachment
        ' TODO: Replace with a valid attachment path.
        Dim sSource As String = "C:\Temp\Hello.txt"
        ' TODO: Replace with attachment name
        Dim sDisplayName As String = "Hello.txt"

        Dim sBodyLen As Integer = oMsg.Body.Length
        Dim oAttachs As Outlook.Attachments = oMsg.Attachments
        Dim oAttach As Outlook.Attachment
        oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)

        ' Send
        oMsg.Send()

        ' Clean up
        oApp = Nothing
        oMsg = Nothing
        oAttach = Nothing
        oAttachs = Nothing
    End Sub

End Module

Microsoft Visual Studio 中的引用不起作用

半城柳色半声笛 2024-11-25 19:24:55

我在这里可以看到一些问题。

  • 在绘制图像时,您应该使用 printAll 而不是 Paint。

  • 表格的高度是在调用 pack 方法时设置的,但这是在填充表格之前。如果您在生成表后立即创建图像,则可能无法设置大小。您应该在打包框架之前填充表格 - 这应该确保在需要时可以使用尺寸。

编辑:在代码更改之后,我建议删除滚动窗格(如 kleopatra 建议的那样),然后使用 printAll。 Paint 不应用于图像,因为它可以使用双缓冲。要查看标题,您需要使用 kleopatra 提供的代码设置其大小。标头的大小与表无关,因此在表上调用 setSize 不会更改标头。

There are a few issues I can see here.

  • You should use printAll rather than paint when drawing to the image.

  • The height of the table is set when the pack method is called, but this is before the table is populated. If you are creating the image immediately after generating the table then the size may not be set. You should populate the table before you pack the frame - that should ensure the size is available when you need it.

EDIT: Following your code change I would suggest removing the scroll pane (as kleopatra suggested) and then using printAll. paint should not be used for images as it can use double buffering. To see the header you will need to set its size using the code provided by kleopatra. The header's size is independent of the table so calling setSize on the table does not alter the header.

jtable 到图像的转换未正确发生

半城柳色半声笛 2024-11-25 17:00:00

我发现这个框架包含 DTGridView 控件。

DTKit

也许重新实现所有内容会更简单。

I found this framework which contains DTGridView control.

DTKit

Maybe it is simpler that reimplement everything.

如何使用 iPhone 编程创建类似 html 的表格?

半城柳色半声笛 2024-11-25 15:32:13

我认为您可以将User分配给Role,然后根据他们选择的角色返回功能。

希望这有帮助。

在控制器中你可以有类似的东西:

 public ActionResult Register(string role)
 {
     Roles.AddUserToRole(User, "role");

     if (User.IsInRole("Client"))
         return View("ClientRegistration");

     if ( User.IsInRole("Vendor"))
         return View("VendorRegistration");
 }

I think you can assign the User to Role then return functionality based on the role they choose.

Hope this helps.

In the controller you could have something like:

 public ActionResult Register(string role)
 {
     Roles.AddUserToRole(User, "role");

     if (User.IsInRole("Client"))
         return View("ClientRegistration");

     if ( User.IsInRole("Vendor"))
         return View("VendorRegistration");
 }

MVC 3 - 使用用户类型自定义注册

半城柳色半声笛 2024-11-25 14:47:36

我将注释来源,以便您实际上可以学到一些东西:

保存对卡片数组的引用。

var cards = $('#cards div');

第一张翻开的牌将位于我们的数组之外。

var flippedIndex = cards.length;

接下来,我们创建一个数组(与 cards 数组长度相同),其中包含有关翻转哪些卡片的信息。

var flipped = new Array(flippedIndex);

flip 函数可以对卡片进行动画处理并更改卡片的类属性。

var flip = function (card, toggle) {
    card.slideUp(function () {
        card.toggleClass('back', toggle)
            .slideDown();
    });
};

现在我们设置点击监听器。

cards.click(function () {
    var card = $(this),

.index() (http://api.jquery.com/index/) 给出卡片从左到右的位置。

    index = card.index();

查找我们的 flipped 数组以查看卡片是否已翻转,并检查它是否是最后一张翻转的卡片。

if (!flipped[index] && index + 1 === flippedIndex) {
        flippedIndex = index;

在这里我们翻转卡片。

    flip(card, (flipped[index] = true));
} else if (flipped[index] && index === flippedIndex) {
    flippedIndex++;

在这里我们将其展开。

       flip(card, (flipped[index] = false));
    }
});

I'll annotate the source, so that you could actually learn something:

Save the reference to the array of cards.

var cards = $('#cards div');

The first flipped card will be outside our array.

var flippedIndex = cards.length;

Next, we create an array (with the same length as the cards array), containing information on which cards are flipped.

var flipped = new Array(flippedIndex);

The flip function animates and changes the class attribute of a card.

var flip = function (card, toggle) {
    card.slideUp(function () {
        card.toggleClass('back', toggle)
            .slideDown();
    });
};

Now we set the click listener.

cards.click(function () {
    var card = $(this),

.index() (http://api.jquery.com/index/) gives you the position of the card from left to right.

    index = card.index();

Lookup our flipped array to see if the card is flipped and check that it's the last card flipped.

if (!flipped[index] && index + 1 === flippedIndex) {
        flippedIndex = index;

Here we flip the card.

    flip(card, (flipped[index] = true));
} else if (flipped[index] && index === flippedIndex) {
    flippedIndex++;

Here we unflip it.

       flip(card, (flipped[index] = false));
    }
});

在 jQuery.animate 中动态传递 DOM 对象

半城柳色半声笛 2024-11-25 14:36:14

这可能已经晚了,但我刚刚在我的 asp.net 网站上运行了嵌入式 mailchimp 代码。

我删除了表单标签,并将其输入按钮替换为:

<asp:Button runat="server" PostBackUrl="http://[YOUR URL]/subscribe/post?u=64d2cf63fb98f334f406892db&id=f3181fb3be" Text="Subscribe"/>

它非常适合我。 (我应该注意我使用的是嵌入代码的非 JavaScript 版本)。

This may be late, but I just got the embedded mailchimp code working on my asp.net website.

I removed the form tags, and replaced their input button with this:

<asp:Button runat="server" PostBackUrl="http://[YOUR URL]/subscribe/post?u=64d2cf63fb98f334f406892db&id=f3181fb3be" Text="Subscribe"/>

It works perfectly for me. (I should note I was using the non-javascript version of the embedded code).

asp.net 中服务器表单中的简单表单?

半城柳色半声笛 2024-11-25 13:18:53

我知道这是一个迟到的答案,但我刚刚遇到了类似的问题。还有另一个使用 Outlook.Application 的解决方案!

我在寻找解决方案时偶然发现了它,这里完全归功于:
http://www.tek-tips.com/faqs.cfm?fid=第 4334

章 以下:

Sub Mail_workbook_Outlook()
'Working in Excel 2000-2016
    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With OutMail
        .To = "[email protected]"
        .CC = ""
        .BCC = ""
        .Subject = "This is an automated email!"
        .Body = "Howdy there! Here, have an automated mail!"
        .Attachments.Add ActiveWorkbook.FullName
        .Display 'Display instead of .send
        SendKeys "%{s}", True 'send the email without prompts
    End With
    On Error GoTo 0

        Set OutMail = Nothing
        Set OutApp = Nothing
    End
End Sub

I know this is a late answer, but I just ran into a similar problem. There is another solution using Outlook.Application!

I stumble upon it while looking for the solution, full credit here:
http://www.tek-tips.com/faqs.cfm?fid=4334

But what this site's solution simply suggest, instead of using the .send command, use the `.Display" command and then send some keys from the keyboard to send the email, like below:

Sub Mail_workbook_Outlook()
'Working in Excel 2000-2016
    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With OutMail
        .To = "[email protected]"
        .CC = ""
        .BCC = ""
        .Subject = "This is an automated email!"
        .Body = "Howdy there! Here, have an automated mail!"
        .Attachments.Add ActiveWorkbook.FullName
        .Display 'Display instead of .send
        SendKeys "%{s}", True 'send the email without prompts
    End With
    On Error GoTo 0

        Set OutMail = Nothing
        Set OutApp = Nothing
    End
End Sub

使用 VBA 禁用 Outlook 安全设置

半城柳色半声笛 2024-11-25 11:46:00

如果您使用的是 SQL 数据库,您是否考虑过从数据库自动生成数据实体模型 (.edmx)?然后您可以使用那里生成的所有类并避免整个混乱。

If you are using a SQL database, have you considered generating a data entity model (.edmx) from the database automatically? Then you can work with all the classes generated there and avoid this whole mess.

如何将 linq var 数据类型传递给方法?

更多

推荐作者

lee_heart

文章 0 评论 0

huangxaiorui

文章 0 评论 0

ゞ记忆︶ㄣ

文章 0 评论 0

画离情绘悲伤

文章 0 评论 0

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文