草庐IT

line-drawing

全部标签

c++ - 将调用者 __FILE__ __LINE__ 传递给函数而不使用宏

我已经习惯了:classDb{_Commit(char*file,intline){Log("Commitcalledfrom%s:%d",file,line);}};#defineCommit()_Commit(__FILE__,__LINE__)但最大的问题是我在全局范围内重新定义了Commit这个词,而在400k行的应用程序框架中这是一个问题。而且我不想使用像DbCommit这样的特定词:我不喜欢像db->DbCommit()这样的冗余,或者在任何地方手动传递值:db->Commit(__FILE__,__LINE__)最差。那么,有什么建议吗? 最佳

c++ - 来自 addr2line 的错误行号

我尝试在C++程序的回溯中找到调用的确切行。现在我正在使用这些行(来自backtrace的手册页)来获取跟踪:void*bt_buffer[1000];char**bt_strings;intbt_nptrs=backtrace(bt_buffer,1000);bt_strings=backtrace_symbols(bt_buffer,bt_nptrs);在bt_strings中,我找到格式为的行./prog()[0x402e42]现在我获取地址(十六进制字符串)并将其提供给addr2line。这有时会导致明显错误的行号。互联网搜索让我找到了这个post,其中表明readelf-wl

node.js - node.js 是否有像 c++ 预处理器宏这样的 __file__ 和 __line__ 之类的东西?

我正在努力增强某些node.js应用程序的日志记录。过去曾使用C++的__file__和__line__预处理器宏来帮助我们在记录事件时跟踪问题。我在node.js世界中没有发现任何类似的东西。有没有人有建议或知道如何在node.js中获取行号和文件名以用于日志记录?我正在寻找类似的东西:console.log(__FILE__+"."+__LINE__+"\t"+newDate().toISOString()+"Message"); 最佳答案 见globalobject:__filename对于lineNumber,请参阅此帖子:

Node.js https pem 错误 : routines:PEM_read_bio:no start line

我现在正在使用node.js处理登录表单,我尝试使用创建pemkey和csropensslreq-newkeyrsa:2048-new-nodes-keyoutkey.pem-outcsr.pem但是我在运行nodeserver.js时遇到错误这是我的server.jsvarhttp=require('http'),express=require('express'),UserServer=require('./lib/user-server');varhttps=require('https');varfs=require('fs');varoptions={key:fs.readF

python - 警告 : The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build

已结束。这个问题是off-topic.它目前不接受答案。想要改进这个问题?Updatethequestion所以它是on-topic堆栈溢出。关闭9年前。Improvethisquestion我试图在我的新Mac上实际安装biopython。Python2.7已经安装在其中。要安装biopython,我发现用macports安装很好。现在要安装macports,我需要xcode,但是在运行Xcode之后,我安装了成功安装的macports。然后尝试使用以下命令安装biopython:sudo端口安装py27-biopython但最终收到这样的警告:警告:Xcode的命令行工具似乎没有安

python - 编译pygraphviz : Unrecognized command line option '-mno-cygwin'

在Windows7上,尝试编译pygraphviz时,我运行pythonsetup.pybuild-cmingw32我明白了C:\MinGW\bin\gcc.exe-mno-cygwin-mdll-O-Wall"-IC:\ProgramFiles(x86)\Graphviz2.28\include\graphviz"-Ic:\Python27\include-Ic:\Python27\PC-cpygraphviz/graphviz_wrap.c-obuild\temp.win-amd64-2.7\Release\pygraphviz\graphviz_wrap.occ1.exe:err

Python C 程序子进程在 "for line in iter"处挂起

好的,我正在尝试从python脚本运行C程序。目前我正在使用一个测试C程序:#includeintmain(){while(1){printf("2000\n");sleep(1);}return0;}模拟我将使用的程序,该程序不断地从传感器获取读数。然后我试图用python中的子进程从C程序中读取输出(在本例中为“2000”):#!usr/bin/pythonimportsubprocessprocess=subprocess.Popen("./main",stdout=subprocess.PIPE)whileTrue:forlineiniter(process.stdout.re

python - 如何使用 line_profiler(来自 Robert Kern)?

我尝试使用line_profiler模块来获取Python文件的逐行配置文件。这是我到目前为止所做的:1)从pypi安装line_profiler通过使用.exe文件(我在WinXP和Win7上)。只需点击安装向导即可。2)编写一小段代码(类似于在另一个已回答的问题here中提出的问题)。fromline_profilerimportLineProfilerdefdo_stuff(numbers):printnumbersnumbers=2profile=LineProfiler(do_stuff(numbers))profile.print_stats()3)从IDLE/PyScri

python - PEP8 : continuation line over-indented for visual indent

我有这行代码,在测试pep8错误时我得到:线太长。因此,为了尝试解决此问题,我使用了slash('\')但随后我将延续行过度缩进以进行视觉缩进。我该怎么做才能解决这个问题?我尝试过的事情:iffirst_index\self._number_of_plates-1:raiseValueErrorcontinuationlineover-indentedforvisualindentiffirst_index\self._number_of_plates-1:raiseValueErrorcontinuationlineover-indentedforvisualindentiffirs

python - Eclipse Pydev : Run selected lines of code

EclipsePydev中是否有一个命令允许我在较大的脚本中只运行几行选定(突出显示)的代码?如果没有,是否可以在PyDev控制台中同时运行多行代码? 最佳答案 按CTRL+ALT+ENTER将选定的行发送到交互式控制台 关于python-EclipsePydev:Runselectedlinesofcode,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/12335424/