signal

emit std::string with qt signal

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to emit standard string with qt signal. The signal will be delivered as queued. I registered the type with qRegisterMetaType , like it says in the qt documentation, but no luck. I am registering it like this qRegisterMetaType<:string>("std::string") 回答1: You should also do: Q_DECLARE_METATYPE ( std :: string ) Quoting Qt Doc Adding a Q_DECLARE_METATYPE() makes the type known to all template based functions, including QVariant. Note that if you intend to use the type in queued signal and slot connections or in QObject's

How to catch signals in Rust

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to write some code that will catch a signal like SIGTERM. I found this and I also found How to handle blocking i/o in Rust, or long running external function calls in general . But in the current Rust version (0.12 nightly) it seems like that std::io::signal::Listener was removed. Did it get put somewhere else? If so can someone point me to how to catch a signal? 回答1: I believe that std::io::signal module was removed in this pull request. It is claimed that proper signals handling was never implemented properly for native runtime,

How to get more detailed backtrace [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: How to make backtrace()/backtrace_symbols() print the function names? 4 answers I am trying to print a backtrace when my C++ program terminated. Function printing backtrace is like below; void print_backtrace(void){ void *tracePtrs[10]; size_t count; count = backtrace(tracePtrs, 10); char** funcNames = backtrace_symbols(tracePtrs, count); for (int i = 0; i It gives an output like ; desktop program: Received SIGSEGV signal, last error is : Success desktop program: ./program() [0x422225] desktop

POSIX threads and signals

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been trying to understand the intricacies of how POSIX threads and POSIX signals interact. In particular, I'm interested in: What's the best way to control which thread a signal is delivered to (assuming it isn't fatal in the first place)? What is the best way to tell another thread (that might actually be busy) that the signal has arrived? (I already know that it's a bad idea to be using pthread condition variables from a signal handler.) How can I safely handle passing the information that a signal has occurred to other threads? Does

Throw an error in a MySQL trigger

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table? 回答1: Here is one hack that may work. It isn't clean, but it looks like it might work: Essentially, you just try to update a column that doesn't exist. 回答2: As of MySQL 5.5, you can use the SIGNAL syntax to throw an exception : signal sqlstate '45000' set message_text = 'My Error Message'; State 45000 is a generic state representing "unhandled user-defined exception". Here is a more complete example of the approach: delimiter //

PyQt4.QtCore.pyqtSignal object has no attribute &#039;connect&#039;

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having issues with a custom signal in a class I made. Relevant code: self.parse_triggered = QtCore.pyqtSignal() def parseFile(self): self.emit(self.parse_triggered) Both of those belong to the class: RefreshWidget. In its parent class I have: self.refreshWidget.parse_triggered.connect(self.tabWidget.giveTabsData()) When I try to run the program, I get the error: AttributeError: 'PyQt4.QtCore.pyqtSignal' object has no attribute 'connect' Help? Thanks in advance. 回答1: I had the same exact problem as you. Try moving self.parse_triggered =

Gtk.Scale value-changed signal vs drag-end?

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Question in brief: Does the Gtk.Scale widget have a drag-end signal as opposed to value-changed ? I'm using a gtk scale widget (a slider) and according to the docs I should use the value-changed signal to detect when the user changes the slider. Now the user grabs the slider and drags it to their desired value. When they have finished choosing their desired value (i.e. finished dragging), I want to do some stuff. However, the value-changed signal gets emitted each time the value changes including while the user is still in the process of

Problem with perl signal INT

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following perl code on windows activestate perl 5.8 $SIG{INT}=\&clean; ... sub clean { print 'cleaning...'; ... ... exit 0; } but when i try to close my program by Ctrl^c it didn't enter the sub clean at all could someone help why did i miss something ? 回答1: It seems that Windows doesn't provide signals as in Unix. From man perlwin32 : Signal handling may not behave as on Unix platforms (where it doesn't exactly "behave", either :). For instance, calling "die()" or "exit()" from signal handlers will cause an exception, since most

How to infer block RAM in Verilog

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got one very specific problem with a project that has been haunting me for days now. I have the following Verilog code for a RAM module: module RAM_param(clk, addr, read_write, clear, data_in, data_out); parameter n = 4; parameter w = 8; input clk, read_write, clear; input [n-1:0] addr; input [w-1:0] data_in; output reg [w-1:0] data_out; reg [w-1:0] reg_array [2**n-1:0]; integer i; initial begin for( i = 0; i < 2**n; i = i + 1 ) begin reg_array[i] <= 0; end end always @(negedge(clk)) begin if( read_write == 1 ) reg_array[addr] <= data

Android Lollipop 5.1: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) / when using lot of nine patch graphics

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using quite a large amount of NinePatchDrawables in the app views. The underlying Bitmaps are cached, so there is no memory issue. While preparing/drawing the screen, the app crashes with the following log entry: 04-03 19:37:42.651: A/libc(4064): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) The issue just popped up with the latest Android 5.1 builds (LMY47D, LMY47E, LMY47I). The same views with the same graphics worked well on earlier Android Versions up to 5.0.2 (LRX22C). I'm getting the issue on