我指的是关于C#SMTP邮件的本指南.
这是我的代码:
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("dave.stockinger@gmail.com");
mail.To.Add("dave.stockinger@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("MyUserNameInGmail", "MyGmailPassWord");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Run Code Online (Sandbox Code Playgroud)
不幸的是,有一个关于SSL的例外,我无法修复它:
未处理的异常:System.Net.Mail.SmtpException:无法发送消息.---> System.IO.IOException:身份验证或解密失败.---> System.InvalidOperationException:SSL身份验证错误:RemoteCertificateNotAvailable,System.Net.Mail.SmtpClient.m__4上的RemoteCertificateChainErrors(System.Object sender,System.Security.Cryptography.X509Certificates.X509Certificate证书,System.Security.Cryptography.X509Certificates. X509链接,SslPolicyErrors sslPolicyErrors)[0x00000] in:0在System.Net.Security.SslStream + c__AnonStorey7.<> m__A(System.Security.Cryptography.X509Certificates.X509Certificate cert,System.Int32 [] certErrors)[0x00000] in: 0
在Mono.Security.Protocol.Tls.SslClientStream.OnRemoteCertificateValidation(System.Security.Cryptography.X509Certificates.X509Certificate证书,System.Int32 []错误)[0x00000] in:0
at Mono.Security.Protocol.Tls.SslStreamBase.RaiseRemoteCertificateValidation( System.Security.Cryptography.X509Certificates.X509Certificate证书,System.Int32 []错误)[0x00000] in:0
在Mono.Security.Protocol.Tls.SslClientStream.RaiseServerCertificateValidation(System.Security.Cryptography.X509Certificates.X509Certificate证书,System.Int32 [] certificateErrors)[0x00000] in:0 at Mono.Security.Protocol.Tls.Handshake.Client. TlsServerCertificate.validateCertificates(Mono.Security.X509.X509CertificateCollection证书)[0x00000] in:0,Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1()[0x00000] in:0 …
我一直在设计网站一段时间,但有一件事我在使用PHP和HTML时从未确定过.用PHP和echoHTML这样的整个文档更好吗:
<?php
doSomething();
echo "<div id=\"some_div\">Content</div>";
?>
Run Code Online (Sandbox Code Playgroud)
或者像这样的HTML文件,只需添加PHP:
<html>
<body>
<?php doSomething(); ?>
<div id="some_div">Content</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
echoHTML 似乎更整洁,特别是如果在整个页面中使用大量PHP,但这样做会丢失HTML的所有格式,即IDE中的颜色等.
这是我的C++函数,它使用一种按位:
int genkey(const unsigned char a,const char b,const char c )
{
int val=0;
unsigned char *p= reinterpret_cast <unsigned char *>(&val);
p[0]=a;
char *q= reinterpret_cast <char *>(&val);
q[1]=b;
q[2]=c;
return val;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用它来生成密钥(对象的唯一值).
可以传递给函数的值的范围是:对于参数=> [0..255],对于b参数=> [0..127]和对于c参数=> [0..127].
假设只能使用相同的三个参数值调用该函数一次.例如,只有一个调用值(10,0,0).
函数是否返回重复值?
谢谢.
我有一个onLongClickListener,在调用时重置一些值.我想发一个alertDialog来检查用户是否确实要重置所有值.然而,我没有任何快乐使它工作.
重置部分工作正常,但如果我尝试添加AlertDialog,我会收到以下错误:
此行的多个标记 - 构造函数AlertDialog.Builder(new View.OnLongClickListener(){})未定义 - 行断点:SatFinder [行:174] - onLongClick(查看)
这究竟是什么意思,我该如何解决?非常感谢.
下面是代码部分.请注意,此示例中的警报没有任何用处.在我超越上述错误后,我会改变它.
resetAll = new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
// set the message to display
alertbox.setMessage("This is the alertbox!");
// set a positive/yes button and create a listener
alertbox.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
// do something when the button is clicked
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(getApplicationContext(), "'Yes' button clicked", Toast.LENGTH_SHORT).show();
}
});
// set a negative/no button and …Run Code Online (Sandbox Code Playgroud) 我的iPhone应用程序使用"AVAudioRecorder"进行录音.它还使用"UIImagePickerController"来录制电影,使用"MPMoviePlayerController"来播放电影.
一切正常,直到我连续做三件事:
当我在步骤3中调用AVAudioRecorder的"记录"方法时,它返回NO表示失败,但没有提示为什么(来到Apple!)AVAudioRecorder的audioRecorderEncodeErrorDidOccur委托方法永远不会被调用,我在设置录像机时没有收到任何其他错误.
我的第一个猜测是,电影录制/播放正在以一种阻止录音机工作的方式修改"AVAudioSession"的共享实例.但是,我手动将AVAudioSession的类别属性设置为"AVAudioSessionCategoryRecord",并且在尝试录制之前使音频会话处于活动状态.
这是我创建录音机的方法:
- (void)createAudioRecorder
{
NSError *error = nil;
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryRecord error:&error];
if (error)
...
[audioSession setActive:YES error:&error];
if (error)
...
NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
// General Audio Format Settings
[settings setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
[settings setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[settings setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
// Encoder Settings
[settings setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVEncoderAudioQualityKey];
[settings setValue:[NSNumber numberWithInt:96] forKey:AVEncoderBitRateKey];
[settings setValue:[NSNumber numberWithInt:16] forKey:AVEncoderBitDepthHintKey];
// Write the audio to a temporary file
NSURL *tempURL …Run Code Online (Sandbox Code Playgroud) iphone mpmovieplayercontroller uiimagepickercontroller avaudiorecorder
从手册:
在下一次加载可以看到cookie的页面之前,Cookie不会显示
这意味着在下一页加载之前setcookie无法访问创建的cookie $_COOKIE.有没有解决这个问题?有没有办法检测setcookiePHP中创建的cookie 而无需重新加载?
我无法修改setcookie当前代码库中调用附近的代码.所以这样的解决方案不起作用:
setcookie('test', 'my test value');
$_COOKIE['test'] = 'my test value';
Run Code Online (Sandbox Code Playgroud) 我正在使用带有登录凭据的Devise:电子邮件/密码 - 没有用户名
我刚刚注意到登录过程对电子邮件区分大小写.因此,如果您注册bob@apPle.com,然后尝试使用Bob@apple.com登录,则会收到错误消息.很混乱.
如何使用他们的电子邮件/密码来设计日志,并且电子邮件不区分大小写?
我正试图从iPhone上的jpeg读取XMP信息.
我可以使用ImageIO轻松地从IPTC,TIFF或EXIF获取标签,但不能使用XMP.我对评级标签特别感兴趣.
有谁知道这是怎么做到的吗?
我的log4j.properties文件 -
log4j.rootLogger=INFO, stdout
# =============== console output appender =====================
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: [%c{1}] %m%n
# =================== common logging =========================
# The log level for all classes that are not configured below.
log4j.logger.petascope=INFO
log4j.logger.petascope.wcps=DEBUG
log4j.logger.petascope.wcst=DEBUG
log4j.logger.petascope.wcs=DEBUG
log4j.logger.petascope.wcs2=TRACE
Run Code Online (Sandbox Code Playgroud)
我想在stdout上显示甚至DEBUG和TRACE消息,所以我更改了以下行
log4j.rootLogger=TRACE, stdout
Run Code Online (Sandbox Code Playgroud)
但是当我在Tomcat控制台上查看日志回显时,我没有看到任何变化,我仍然只看到INFO,WARN ...消息.
我有一个复杂串联的查询.如果结果不为空,那么就像连接几个子选择的结果一样.它在我们的运行MySQL 5.1的开发服务器上工作正常(虽然复杂性让我有点不舒服)但我们的生产服务器运行5.0报告
FUNCTION database.concat does not exist
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会这样?不幸的是,升级不是一个选择,所以除非有人有一个好主意,否则我几乎不会重写这份报告.
查询如下(是的,我意识到我可怕地滥用mysql.让我们暂时把它放在一边.如果有人知道如何通过别名引用子选择方法,这将是方便的,但我从来没有能够做到它,因此重复的subselect.NULL如果有任何参数NULL,concat返回,因此if语句.)
select (concat(if((select
concat(if(b.foo is not null, b.foo, ""),
" ",
if(f.bar is not null, f.bar, ""))
from `foo_table` as f
left join `bar_table` as b
on b.SOME_ID = f.SOME_ID
where f.STUDENT_ID = t.STUDENT_ID
and bar.NewID = t.OldID order by bar.id limit 1) is not null,
(select
concat(if(b.foo is not null, b.foo, ""),
" ",
if(f.bar is not null, f.bar, ""))
from `foo_table` as f
left join `bar_table` …Run Code Online (Sandbox Code Playgroud)