小编Vic*_*tor的帖子

为什么phpmailer类会回显文本?

当我发送电子邮件它回应许多不必要的文本,我不希望打印出这些文本.我该如何禁用这些文字.

例:

SMTP -> FROM SERVER:220 mx.google.com ESMTP p1sm1037082ybn.17
SMTP -> FROM SERVER: 250-mx.google.com at your service, [xxx.xxx.xxx.xxx] 250-SIZE 35651584 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:250 2.1.0 OK p1sm1037082ybn.17
SMTP -> FROM SERVER:250 2.1.5 OK p1sm1037082ybn.17
SMTP -> FROM SERVER:354 Go ahead p1sm1037082ybn.17
SMTP -> FROM SERVER:250 2.0.0 OK 1290167720 p1sm1037082ybn.17
Run Code Online (Sandbox Code Playgroud)

我正在使用class.phpmailer.php文件并使用$ obj.Send()方法发送电子邮件.??

谢谢

php email phpmailer

8
推荐指数
3
解决办法
9855
查看次数

如何规范化 URL?

我正在处理需要用户输入各种 URL(例如:用于他们的个人资料)的情况。但是,用户并不总是以该https://example.com格式插入 URL 。他们可能会插入如下内容:

  • example.com
  • example.com/
  • example.com/somepage
  • 但类似的东西me@example.com或其他东西不应该被接受

如何将 URL 规范化为可能指向 Web 地址的格式?我在网络浏览器中看到了这种行为。我们几乎总是在网络浏览器的栏中输入蹩脚的内容,他们可以区分这是搜索还是可以转换为 URL 的内容。

我尝试在很多地方寻找,但似乎找不到任何方法。

如果可能的话,我更喜欢为 Node 编写的解决方案。非常感谢!

url node.js

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

禁用在TextBox中选择文本

我有一个包含以下(重要)属性的文本框:

this.license.Multiline = true;
this.license.ReadOnly = true;
this.license.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.license.ShortcutsEnabled = false;
Run Code Online (Sandbox Code Playgroud)

它看起来像这样:

带有突出显示文本的文本框

如何禁用用户突出显示此文本框中的文本(我不想完全禁用文本框)?

.net c# textbox winforms

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

通过在控件上单击并拖动来移动窗口

我有一个WinForms项目.我的窗口顶部有一个面板.我希望该面板能够移动窗口,当用户点击它然后拖动时.

我怎样才能做到这一点?

c# windows winforms

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

自定义菜单快捷键

我正在开发一个在其上面有一个菜单的应用程序.我想对快捷键使用不同的方法(就是这个片段):这是用于快捷键:CTRL+ N,1

bool prefixSeen = false;

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    if (prefixSeen)
    {
        switch (keyData)
        {
            case (Keys.Control | Keys.D1):
                MessageBox.Show("New file");
                prefixSeen = false;
                break;
        }
    }
    switch (keyData)
    {
        case (Keys.Control | Keys.n):
            prefixSeen = true;
        break;
    }

    return base.ProcessCmdKey(ref msg, keyData);
}
Run Code Online (Sandbox Code Playgroud)

代码来自这里.

这是我的菜单:

在此输入图像描述

我想在菜单项中显示(在右边对齐)快捷键(我应该将其解释为字符串).我怎样才能达到这个效果?

在此先感谢,祝每一个人新年快乐.

编辑: Visual Studio的内置方法是:

在此输入图像描述

c# string customization keyboard-shortcuts menu

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

- 读取字符串的错误字符

我有以下代码块:

for( CarsPool::CarRecord &record : recs->GetRecords())
{
  LVITEM item;
  item.mask = LVIF_TEXT;
  item.cchTextMax = 6;

  item.iSubItem = 0;
  item.pszText = (LPSTR)(record.getCarName().c_str()); //breakpoint on this line.
  item.iItem = 0;
  ListView_InsertItem(CarsListView, &item);

  item.iSubItem = 1; 
  item.pszText = TEXT("Available");
  ListView_SetItem(CarsListView, &item);

  item.iSubItem = 2;
  item.pszText = (LPSTR)CarsPool::EncodeCarType(record.getCarType());
  ListView_SetItem(CarsListView, &item);
}
Run Code Online (Sandbox Code Playgroud)

Visual Studio Debugger中的信息位于:

在此输入图像描述

为什么程序不能从字符串中读取字符?

测试表明它以这种方式工作:

MessageBox(hWnd, (LPSTR)(record.getCarName().c_str()), "Test", MB_OK);
Run Code Online (Sandbox Code Playgroud)

c++ winapi

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

Windows Phone 8应用程序不包含InitializeComponent的定义

我刚刚下载了14个CTP版本的Visual Studio,并为Windows Phone创建了一个空白应用程序.我试图打开MainPage.xaml,设计师显示以下错误:

在此输入图像描述

对于那些看不到图像的人:

System.Exception
Package failed updates, dependency or conflict validation.

Windows cannot install package App.a5cd6ef3c.a895b.a4508.a96fd.af1634c30bb13 because this package depends on another package that could not be found. This package requires minimum version 0.0.0.0 of framework Microsoft.VCLibs.140.00.Debug published by any publisher to install. Provide the framework along with this package.
   at Microsoft.Expression.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)
   at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, FrameworkName targetFramework, String identifier, String baseDirectory)
   at …
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-phone-8 visual-studio-2015

6
推荐指数
3
解决办法
7517
查看次数

Boost Program_Options抛出"字符转换失败"

我在Ubuntu 14.04,使用CMake和CLion.我正在尝试使用程序选项,以下代码取自其文档中的示例:

#include <iostream>
#include <boost/program_options.hpp>

int main(int ac, char* av[]) {
    namespace po = boost::program_options;
    using namespace std;

    po::options_description desc("Allowed options");
    desc.add_options()
            ("help", "produce help message")
            ("compression", po::value<int>(), "set compression level")
            ;

    po::variables_map vm;
    po::store(po::parse_command_line(ac, av, desc), vm);
    po::notify(vm);

    if (vm.count("help")) {
        cout << desc << "\n";
        return 1;
    }

    if (vm.count("compression")) {
        cout << "Compression level was set to "
        << vm["compression"].as<int>() << ".\n";
    } else {
        cout << "Compression level was not set.\n";
    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我从终端获得以下输出:

$ …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-program-options

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

功能的多重定义在同一个地方

我试图通过为一个matrix类型提供一些预处理器定义来模拟C中的泛型.以下是摘录:

#define __matrix_struct(TYPE) \
  struct { \
    uint32_t sz; \
    TYPE **ptr; \
  }

#define __matrix_t(TYPE) matrix_ ## TYPE
#define __matrix_ptr_t(TYPE) __matrix_t(TYPE) *

#define __matrix_typedef(TYPE) typedef __matrix_struct(TYPE) __matrix_t(TYPE)

#define __matrix_allocator_name(TYPE) TYPE ## _matrix_alloc
#define __matrix_allocator(TYPE) \
  __matrix_ptr_t(TYPE) __matrix_allocator_name(TYPE) (uint32_t sz) { \
    uint32_t i; \
    __matrix_ptr_t(TYPE) m = (__matrix_ptr_t(TYPE)) malloc(sizeof(__matrix_t(TYPE))); \
    m->ptr = (TYPE **) malloc(sz * sizeof(TYPE *)); \
    for (i = 0; i < sz; ++i) { \
      m->ptr[i] = (TYPE *) calloc(sz, sizeof(TYPE)); \
    } …
Run Code Online (Sandbox Code Playgroud)

c c99 generic-programming

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

无法以编程方式关闭格式化文本

我试图以编程方式为我的图形中的每个单元格关闭格式化文本,这样我就可以避免mxgraph编辑中的查看器不支持(类似于Draw.io)

这是我的尝试:

graph.stopEditing();
graph.getModel().beginUpdate();

try
{
    var cells = graph.getChildCells(graph.getDefaultParent());
    cells.forEach(function (cell)
    {
        var state = graph.getView().getState(cell);
        if (state == null)
        {
            return;
        }
        if (state.style['html'] != '1') {
            return;
        }

        var label = graph.convertValueToString(state.cell);
        if (mxUtils.getValue(state.style, 'nl2Br', '1') != '0')
        {
            label = label.replace(/\n/g, '').replace(/<br\s*.?>/g, '\n');
        }

        // Removes HTML tags
        var temp = document.createElement('div');
        temp.innerHTML = label;
        label = mxUtils.extractTextWithWhitespace(temp.childNodes);

        graph.cellLabelChanged(state.cell, label);
        graph.setCellStyles('html', null);
    });

    ui.fireEvent(new mxEventObject('styleChanged', 'keys', ['html'],
        'values', ['0'], 'cells', cells));
} …
Run Code Online (Sandbox Code Playgroud)

javascript mxgraph

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