signal

C++ : Catch a divide by zero error

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is a simple piece of code where a division by zero occurs. I'm trying to catch it : #include <iostream> int main(int argc, char *argv[]) { int Dividend = 10; int Divisor = 0; try { std::cout << Dividend / Divisor; } catch(...) { std::cout << "Error."; } return 0; } But the application crashes anyway (even though I put the option -fexceptions of MinGW ). Is it possible to catch such an exception (which I understand is not a C++ exception, but a FPU exception) ? I'm aware that I could check for the divisor before dividing, but I made the

Pyqt5 qthread + signal not working + gui freeze

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to make a mailbox checker with imap lib, it work pretty fine with python, queue and multithread without gui. But when I try to put a gui, every fonction i made, make the gui freeze until finish . I tried many thing from various doc(add qthread, signal, cursorr etcc) and tutorials none worked for me . Can someone help me to understand how to set or append a text to a QtextEdit while running a function coz it work only after finish . Here is my code : class Checker ( QtCore . QThread ): signal = QtCore . pyqtSignal (

Cython, Python and KeyboardInterrupt ignored

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way to interrupt ( Ctrl+C ) a Python script based on a loop that is embedded in a Cython extension? I have the following python script: def main(): # Intantiate simulator sim = PySimulator() sim.Run() if __name__ == "__main__": # Try to deal with Ctrl+C to abort the running simulation in terminal # (Doesn't work...) try: sys.exit(main()) except (KeyboardInterrupt, SystemExit): print '\n! Received keyboard interrupt, quitting threads.\n' This runs a loop that is part of a C++ Cython extension. Then, while pressing Ctrl+C , the

Get signal strength of WIFI and Mobile Data

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my app I need to check the connection speed of both WiFi and Mobile Data and then compare it, then switch to which ever network has the highest speed. So how can I get the speed or best signal strength of wifi and mobile data? how can I switch one off and other on programatically. Please help me out. A sample would be helpful. 回答1: Wifi: WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); int linkSpeed = wifiManager.getConnectionInfo().getRssi(); In case of mobile it should work: TelephonyManager

Django post_save() signal implementation

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a question about django. I have ManyToMany Models here class Product(models.Model): name = models.CharField(max_length=255) price = models.DecimalField(default=0.0, max_digits=9, decimal_places=2) stock = models.IntegerField(default=0) def __unicode__(self): return self.name class Cart(models.Model): customer = models.ForeignKey(Customer) products = models.ManyToManyField(Product, through='TransactionDetail') t_date = models.DateField(default=datetime.now()) t_sum = models.FloatField(default=0.0) def __unicode__(self): return str(self

How to keep the source signal's parameters while using QSignalMapper?

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I ran into a problem that I need to keep the mapped source signal's parameters. So far I only found examples to map signals without any parameter. For example, the clicked() signal: signalMapper = new QSignalMapper ( this ); signalMapper -> setMapping ( taxFileButton , QString ( "taxfile.txt" )); connect ( taxFileButton , SIGNAL ( clicked ()), signalMapper , SLOT ( map ())); connect ( signalMapper , SIGNAL ( mapped ( QString )), this , SLOT ( readFile ( QString ))); However, I would need to map some signal with its own parameters,

Program received signal SIGKILL exception comes up when I quit in the multitasking bar (iPhone)

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I double tap the home button and quit out of my app from the multitasking bar and open the app again, Xcode reads: "Thread 1: program received signal: SIGKILL" and freezes my iPod. The app has 1500+ lines so I can't really put any code up, sorry. What could I be doing wrong? 回答1: Your 1500+ lines of code is really innocent of this crash. It happens when you run the app from Xcode , and terminate it from the iPod , without stopping the execution from Xcode . Closing the app from multitasking bar doesn't stop its execution in Xcode( but,

When does a process get SIGABRT (signal 6)?

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: What are the scenarios where a process gets a SIGABRT in C++? Does this signal always come from within the process or can this signal be sent from one process to another? Is there a way to identify which process is sending this signal? 回答1: abort() sends the calling process the SIGABRT signal, this is how abort() basically works. abort() is usually called by library functions which detect an internal error or some seriously broken constraint. For example malloc() will call abort() if its internal structures are damaged by a heap

Scale Factor in Matlabs `conv()`

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following code which is used to deconvolve a signal. It works very well, within my error limit...as long as I divide my final result by a very large factor (11000). width = 83.66; x = linspace(-400,400,1000); a2 = 1.205e+004 ; al = 1.778e+005 ; b1 = 94.88 ; c1 = 224.3 ; d = 4.077 ; measured = al*exp(-((abs((x-b1)./c1).^d)))+a2; rect = @(x) 0.5*(sign(x+0.5) - sign(x-0.5)); rt = rect(x/83.66); signal = conv(rt,measured,'same'); check = (1/11000)*conv(signal,rt,'same'); Here is what I have. measured represents the signal I was given.

thread 1 program received signal SIGABRT

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: #import int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } When I run it on my device it gives me the following error: Thread 1:Program received signal: "SIGABRT". How do i fix this? 2011-11-10 14:59:43.487 AVMultiPlayer[13554:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter' *** First throw call stack: (0x3102a8bf