我正在尝试使用 PHPMailer 库从我的网站发送电子邮件。我这样做的目的是:
我从这个链接下载了 PHPMailer 5.2-stable 。
我在我的主机上上传了以下文件:class.phpmailer.php、class.smtp.php和PHPMailerAutoload.php
然后我创建了一个文件名 contact.php 并在其中编写了以下代码:
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Username = "*****************"; //My Email Address
$mail->Password = "*****************"; //My Email's Address
$mail->SMTPSecure = "tls";
$mail->Port = 578;
$mail->AddAddress('*****************');
$mail->From = "*****************";
$mail->FromName = "Website Contact Form - " . "Website Name";
$mail->Subject = "New Message from Contact Form";
$mail->Body = 'This is the HTML message …Run Code Online (Sandbox Code Playgroud)我是C#多线程的新手.我已经定义了一个简单的for循环,当我按下一个按钮时,它从0开始计数到10000并使用秒表我捕获了完成这个循环所需的时间.
private void button2_Click(object sender, EventArgs e)
{
Stopwatch sw = new Stopwatch();
sw.Start();
for (double i = 0; i < 5000; i++)
{
Console.WriteLine(i.ToString() + ", ");
}
sw.Stop();
TimeSpan ts = sw.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds / 10);
MessageBox.Show(elapsedTime);
}
Run Code Online (Sandbox Code Playgroud)
在我的笔记本电脑上需要:15':28''
另一方面,我尝试多线程以了解我是否可以缩短这个时间.我做的是:
1)定义5个函数(Func1,Func2,....,Func5)
2)在每个函数内部,我定义了一个for循环,它计算main for循环的五分之一:
Func1:0 - 1000
Func2:1000 - 2000
Func3:2000 - 3000
Func4:3000 - 4000
Func5:4000 - 4000
3)最后,我定义了五个不同的线程,并在每个线程中调用每个函数.
从逻辑上讲,我希望在更短的时间内得到结果,但运行时间与没有线程的时间相同.
private void …Run Code Online (Sandbox Code Playgroud) 如何向电报机器人添加图标?
示例命令:
/统计数据
响应代码:
var response = '';
response += '*Pool*\n';
response += 'Hashrate: ' + poolHashrate + '\n';
response += 'Connected Miners: ' + poolMiners + '\n';
response += 'Active Workers: ' + poolWorkers + '\n';
response += 'Blocks Found: ' + poolBlocks + '\n';
response += 'Last Block: ' + poolLastBlock + '\n';
response += 'Current Effort: ' + currentEffort + '\n';
response += '\n';
response += '*Network*\n';
response += 'Hashrate: ' + networkHashrate + '\n';
response += …Run Code Online (Sandbox Code Playgroud) 我的C#Windows窗体应用程序中有一段代码如下所示:
List<string> RESULT_LIST = new List<string>();
int[] arr = My_LIST.ToArray();
string s = "";
Stopwatch sw = new Stopwatch();
sw.Start();
for (int i = 0; i < arr.Length; i++)
{
int counter = i;
for (int j = 1; j <= arr.Length; j++)
{
counter++;
if (counter == arr.Length)
{
counter = 0;
}
s += arr[counter].ToString();
RESULT_LIST.Add(s);
}
s = "";
}
sw.Stop();
TimeSpan ts = sw.Elapsed;
string elapsedTime = String.Format("{0:00}", ts.TotalMilliseconds * 1000);
MessageBox.Show(elapsedTime);
Run Code Online (Sandbox Code Playgroud)
我使用此代码获取我的列表的数字的任意组合.我表现得像My_LIST一样递归.下图非常清楚地表明了我的目的:
我需要做的就是: …
我正在使用Zen Barcode Rendering Framework在 C# Windows 窗体应用程序中创建条形码。我有两个文本框(一个用于条形码本身,另一个用于我希望打印在条形码标签上的相关文本)。同样,我将生成的条形码图像加载到图片框中并尝试打印该图像,但每次按下打印按钮时,结果都不合适(有时打印机打印白色的空标签,有时条形码打印不完整。有趣的是,我不得不说,为了让条形码出现在标签上,即使它看起来不完整,我必须选择非常大的纸张尺寸)。这是我的代码:
我的生成条形码按钮的点击事件的代码:
private void Button1_Click(object sender, EventArgs e)
{
string barcode = textBox1.Text;
Zen.Barcode.Code128BarcodeDraw brcd = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
var barcodeImage = brcd.Draw(barcode, 50);
int resultImageWidth;
if(barcodeImage.Width >= textBox2.Text.Length*8)
{
resultImageWidth = barcodeImage.Width;
}
else
{
resultImageWidth = textBox2.Text.Length*8;
}
var resultImage = new Bitmap(resultImageWidth, barcodeImage.Height + 60); // 20 is bottom padding, adjust to your text
using (var graphics = Graphics.FromImage(resultImage))
using (var font = new Font("IranYekan", 10))
using (var brush = new …Run Code Online (Sandbox Code Playgroud) 最近我安装了Microsoft Sql Server 2016,无论如何我找不到管理工作室文件,我想知道它位于何处?谢谢
c# ×3
barcode ×1
contact-form ×1
email ×1
for-loop ×1
javascript ×1
loops ×1
php ×1
phpmailer ×1
picturebox ×1
sql-server ×1
telegram-bot ×1
time ×1
winforms ×1