小编Luk*_*ard的帖子

com.sun.mail.smtp.SMTPAddressFailedException:收件人地址被拒绝:需要身份验证

我正在使用以下代码但是gettting错误消息:

javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
        com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.0 : Recipient address rejected: Authentication Required

        at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1607)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:887)
        at javax.mail.Transport.send0(Transport.java:191)
        at javax.mail.Transport.send(Transport.java:120)
        at MailClient.sendMail(MailClient.java:55)
        at MailClient.main(MailClient.java:94)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.0 : Recipient address rejected: Authentication Required

        at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1505)
        ... 5 more

/**
 *
 * @author sachin
 */
import javax.mail.*;
 import javax.mail.internet.*;
 import javax.activation.*;
 import java.io.*;
 import java.util.Properties;

 public class MailClient
 {


     public void sendMail(String mailServer, String from, String to,
                             String subject, String messageBody
                             ) throws MessagingException, AddressException …
Run Code Online (Sandbox Code Playgroud)

java

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

什么是Java中的'系统默认包'?


虽然研究的URLConnection类我偶然在一个参考系统默认包中的API文档URL在这里.

谁知道那是什么?
谢谢.

java

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

String ... <varname>什么是String ...意思是

我想弄清楚一些java代码.我在方法标题中遇到了一些我以前没见过的东西

private static object [] methodName(NodeList nodes, String... Names)
Run Code Online (Sandbox Code Playgroud)

什么是运营商...

谢谢,抱歉,有些搜索在其他地方找不到

java

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

读取其他进程控制台输出

我在"wave"中返回控制台输出时遇到问题.例如,控制台每秒输出一些东西,例如事件每分钟触发60次(同时所有事件).

我的代码:

Process Proc = new Process();
Proc.StartInfo.FileName = SSMS.BinaryDir + "HldsUpdateTool.exe";
Proc.StartInfo.Arguments = "-command update -game tf -dir " + SSMS.RootDir + Key;
Proc.StartInfo.UseShellExecute = false;
Proc.StartInfo.RedirectStandardOutput = true;
Proc.StartInfo.RedirectStandardError = true;

Proc.EnableRaisingEvents = true;
Proc.StartInfo.CreateNoWindow = false;

Proc.ErrorDataReceived += new DataReceivedEventHandler(Proc_ErrorDataReceived);
Proc.OutputDataReceived += new DataReceivedEventHandler(Proc_OutputDataReceived);
Proc.Exited += new EventHandler(Proc_Exited);

Proc.Start();
Proc.BeginErrorReadLine();
Proc.BeginOutputReadLine();
Run Code Online (Sandbox Code Playgroud)

我可能怀疑更新工具有问题.其他带控制台输出的程序运行正常.

触发事件时的时间线:( =什么都没发生; |事件被触发)

Should be: ==|==|==|==|==|==|==  
Is: ========|||||||=========||||||=====
Run Code Online (Sandbox Code Playgroud)

c# console process

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

C#捕获主窗体键盘事件

如何捕获WinForm主窗体的键盘事件,其他控件是.所以我想抓住一个事件Ctrl+ S并且无关紧要.但是没有Pinvoke(钩子等......)只有.NET管理内部电源.

c# winforms

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

不一致的Silverlight 4 ComboBox下拉显示

我有一个Silverlight 4应用程序,在表单底部附近有一个ComboBox.Dropdown中可以有大约30到100个项目.

当我第一次打开ComboBox时,没有SelectedItem,Dropdown向上打开,它可以看到大约23个条目; 只要我没有选择项目,每次重新打开Dropdown时它都会继续这种行为.一旦我选择了一个项目,每次我打开ComboBox后,它总是向下打开Dropdown,并且只显示3个条目.

我猜Dropdown仅限于3项,因为这是我在屏幕上最大化时窗口的下限.

即使先前已选择某个项目,如何让它显示更多项目?

下面是一个示例Silverlight应用程序,它演示了浏览器内外的行为.

MainPage.xaml中:

<UserControl x:Class="ComboBox_Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="650" d:DesignWidth="1024">

    <Grid x:Name="LayoutRoot" Background="LightSteelBlue" Loaded="MainPage_OnLoaded">
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" MinHeight="25" MaxHeight="25" />
            <RowDefinition Height="35*" MinHeight="200" />
            <RowDefinition Height="10*" MinHeight="70" MaxHeight="70" />
            <RowDefinition Height="30*" MinHeight="230" MaxHeight="230" />
            <RowDefinition Height="*" MinHeight="10" MaxHeight="30" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="12" />
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="12" />
        </Grid.ColumnDefinitions>
        <TextBlock Name="lblData" Text="Data:" Grid.Row="1" Grid.Column="1" />
        <TextBox x:Name="txtData" Grid.Row="1" Grid.Column="2" VerticalScrollBarVisibility="Auto"
                HorizontalScrollBarVisibility="Auto" />
        <StackPanel x:Name="AccessPanel" Orientation="Vertical" HorizontalAlignment="Left" Margin="5"
                Grid.Row="3" …
Run Code Online (Sandbox Code Playgroud)

c# silverlight combobox silverlight-4.0

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

在WPF中对数据绑定进行单元测试

我正在尝试使用NUnit对自定义WPF控件进行单元测试.该控件是按钮的ListView,绑定到列表(DataContext在控件的构造函数中设置).

我想编写测试(例如)将项目添加到列表中并检查是否有新按钮添加到视图中等等.但是,当我在NUnit测试中将项目添加到列表时,它仍会报告ListView为空.但是,当我运行我的应用程序时,一切正常.

我在下面列出了相关代码.我需要做些什么来测试这个?

XAML:

<ListView x:Class="SoundBlock"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          ItemsSource="{Binding Path=Sounds}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <Button Content="{Binding Title}" />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)

类定义

public partial class SoundBlock : ListView
{
    public SoundBlock(Board xiBoard)
    {
        // Initialize.
        InitializeComponent();

        // Set the data context for this block.
        DataContext = xiBoard; // Board has an ObservableCollection<Sound> 
                               // property called Sounds.
    }
}
Run Code Online (Sandbox Code Playgroud)

测试用例

[Test]
public void TestAddSound()
{
    board = new Board();
    block = new SoundBlock(board);
    Assert.AreEqual(0, block.Items.Count);

    sound = new Sound("sound.mp3");
    board.Sounds.Add(sound);
    Assert.AreEqual(1, …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf nunit

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

更改wpf静态资源的值

如何在运行时更改WPF静态资源的值?

我有以下资源

<UserControl.Resources>
    <sys:String x:Key="LengthFormat">#.# mm</sys:String>
    <sys:String x:Key="AreaFormat">#.# mm²</sys:String>
    <sys:String x:Key="InertiaFormat">#.# mm?</sys:String>
</UserControl.Resources>
Run Code Online (Sandbox Code Playgroud)

一些文字块参考

<TextBlock Grid.Row="2" Grid.Column="1" 
 Text="{Binding Path=Breadth, StringFormat={StaticResource ResourceKey=LengthFormat}}" />
Run Code Online (Sandbox Code Playgroud)

然后根据要绑定到控件的对象,我想改变格式.我在控件中设置了如下属性:

public string LengthFormat
{
    set
    {
        this.Resources["LengthFormat"] = value;
    }
}
public string AreaFormat
{
    set
    {
        this.Resources["AreaFormat"] = value;
    }
}
public string InertiaFormat
{
    set
    {
        this.Resources["InertiaFormat"] = value;
    }
}
Run Code Online (Sandbox Code Playgroud)

然后在绑定之前我设置每个字符串.

但它不起作用,有人建议whynot?

干杯

c# wpf resourcedictionary

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

什么suds意味着"<faultcode />没有映射到消息部分"?

我第一次使用suds并尝试与外部公司托管的服务器通信.当我在服务器上调用一个方法时,我得到了这个XML.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>

      <faultstring>Can't use string ("") as an ARRAY ref while "strict refs" in use at /vindicia/site_perl/Vindicia/Soap/DocLitUtils.pm line 130.
</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

抛出的异常是这样的:


  File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 538, in __call__
    return client.invoke(args, kwargs)
  File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 602, in invoke
    result = self.send(msg)
  File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 634, in send
    result = self.succeeded(binding, reply.message)
  File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 669, in succeeded
    r, p = binding.get_reply(self.method, reply)
  File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\bindings\binding.py", line 157, in get_reply …

python soap suds

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

包括JS在头部或打开身体标签后立即

包含Javascript <head>与OPENING <body>标签之后的相反有什么区别?

Facebook Like小部件就是一个例子,他们建议在开始<body>标记之后立即放置代码.SiteCatalyst还建议使用它们的分析代码.

虽然在<head>元素中包含代码而不是在结束</body>标记之前存在明显的区别,但我不确定<head>开始<body>标记之后和之后的区别.

javascript

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