我正在尝试将日志记录添加到使用Windows Mobile 6.1在移动设备上运行的应用程序. .NETCompact框架3.5.使用NLog.
我安装了适当版本的NLog发行版.
但是,没有创建日志文件.
这是我的NLog.config档案:
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName=".\Neolant.ASRM.Terminal.log" layout="${longdate}|${level}|${message}|${exception}" autoFlush="true"/>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
Run Code Online (Sandbox Code Playgroud)
这是我使用的测试代码:
public static void Main()
{
try
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
var logger = NLog.LogManager.GetLogger("UpperLevel");
logger.Info("test test test.");
try
{
throw new Exception("Unexpected!");
}
catch (Exception e)
{
var logger = NLog.LogManager.GetLogger("UpperLevel");
logger.WarnException("An exception occured.", e);
}
throw new Exception("Suddenly!");
}
finally
{
NLog.LogManager.Flush();
}
}
private static void …Run Code Online (Sandbox Code Playgroud) 我在这里问这个问题,因为文档没有帮助我.
在跑步者的设置过程中,有两件事要问:gitlab CI协调员和注册令牌的url.我不知道他们应该是什么.
至于url,它可以是gitlab CI web界面的url(例如:)http://localhost:80/与build相关的url,这在build的高级属性中有描述.
注册令牌可能来自文档 - 但是它的链接已经死亡(请参阅:http: //gitlab-ci-domain.com/admin/runners)或来自build的高级属性的注册令牌.
但是,当我尝试从构建属性提供跑步者的设置URL和注册令牌时,我得到访问错误,通知我注册失败.由于缺乏理解这些参数应该是什么,我无法确定是什么问题.
创建单个对象到接口的绑定的哪种方式更可取,何时以及为什么:
Kernel.Bind<IFoo>().ToConstant(new Foo());
Run Code Online (Sandbox Code Playgroud)
要么
Kernel.Bind<IFoo>().To(typeof(Foo)).InSingletonScope();
Run Code Online (Sandbox Code Playgroud)
或者,如果两种方式都不正确并且更好地避免,应该使用什么呢?
我正在处理批量文件,这些文件在其生命的不同时间包含有关同一对象的信息,并且订购它们的唯一方法是创建日期.我在用这个:
//char* buffer has the name of file
struct stat buf;
FILE *tf;
tf = fopen(buffer,"r");
//check handle
fstat(tf, &buf);
fclose(tf);
pMyObj->lastchanged=buf.st_mtime;
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.我究竟做错了什么?是否还有其他更可靠/简单的方法可以在Linux下获取文件创建日期?
我使用emacs和elpy作为模式来处理python代码.我还安装了Jedi,主要是两件事:转到它提供的定义功能和自动完成.
但是,我在此设置中遇到了以下问题:
C-M-i.有没有办法设置东西,以便我将从jedi后端的单一来源自动完成和jedi的定义?
这就是我目前在我的设置jedi的方式init.el:
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
Run Code Online (Sandbox Code Playgroud) 我正在使用Windows窗体,并且很多时候碰到(据我所知)必须围绕UI组件的属性编写包装函数,以便可以通过调用其包装程序从另一个线程设置它们(这些属性)。
但是,一件事并没有让我休息。属性的设置者不是在实际发挥作用吗?如果是这样,是否可以在不使用编写包装器的情况下在它们周围形成一个委托,然后从另一个线程调用该委托?
我正在尝试使用 ffmpeg 在视频中以毫秒为单位进行搜索。我一直在尝试使用此问题中的代码,该代码使用avformat_seek_file(我将其与 -1 一起用于流编号和 AVSEEK_FLAG_ANY 标志)。
调用之后,我尝试读取下一帧,即:
if (av_read_frame(fmt_ctx, &pkt) >= 0)
{
int ret = 0;
if (pkt.stream_index == video_stream_idx) {
/* decode video frame */
ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
if (ret < 0) {
fprintf(stderr, "Error decoding video frame\n");
return ret;
}
//do something with frame
}
Run Code Online (Sandbox Code Playgroud)
然而,frame->pts检索到的帧的时间始终保存紧接在查找之前读取的最后一帧之后的帧的时间。
编辑:尽管帧->点形成不间断的序列,但确实会发生查找。由于某种奇怪的原因,我读到的下一帧是第一帧。事实上,在我跑步之后:
int got_frame = 0;
do
if (av_read_frame(fmt_ctx, &pkt) >= 0) {
decode_packet_ro(&got_frame, 0);
av_free_packet(&pkt);
}
else
{
read_cache = true; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ffmpeg读取视频文件.我的工作代码与它的旧版本相对应,并开始尝试升级到最新的构建版本,将所有这些已弃用的函数交换为它们的实际类似物.
但是我遇到了一个问题.似乎没有检索到流,视频的负载在轨道中停止.
这是我正在使用的代码:
// Open video file
if(avformat_open_input(&pFormatCtx, filename.toStdString().c_str(), NULL, NULL)!=0)
return FILE_NOT_OPENED; // Couldn't open file
// Retrieve stream information
if(avformat_find_stream_info(pFormatCtx,NULL)<0)
return NO_STREAM_INFO; // Couldn't find stream information
// Dump information about file onto standard error
av_dump_format(pFormatCtx, 0, filename.toStdString().c_str(), false);
// Find the first video stream
videoStream=-1;
for(unsigned i=0; i<pFormatCtx->nb_streams; i++)
if(pFormatCtx->streams[i]->codec->codec_type==ffmpeg::AVMEDIA_TYPE_VIDEO)
{
videoStream=i;
break;
}
if(videoStream==-1)
return OTHER; // Didn't find a video stream
// Get a pointer to the codec context for the video stream
pCodecCtx=pFormatCtx->streams[videoStream]->codec;
// …Run Code Online (Sandbox Code Playgroud) 我正在尝试对本机代码使用 microsoft 单元测试,但是在编写基本测试后我遇到了一个问题:我找不到如何使用参数创建测试方法。
在搜索主题时,我找到了一些添加此类方法的方法,即编写数据驱动的测试(例如,http://msdn.microsoft.com/en-us/library/ms182527.aspx)。但是,我不知道如何将它与本机 C++ 测试一起使用。
据我所知,不TEST_METHOD存在带有参数的函数的宏,不存在“DataSource”属性的宏等。
是否有使用 MsTest 设置本机 C++ 代码的数据驱动测试的示例?
我在GitLab中有一个与Gitlab CI集成的项目。竭尽全力推动项目的发展。
但是,当创建新分支并将其推入存储库时,gitlab CI中不会保留构建。启用其他分支构建的设置是什么-交替出现,我如何确定出了什么问题?