signals

ContentType matching query does not exist on post_syncdb

三世轮回 提交于 2020-01-21 08:40:07
问题 I am trying to add add some data to the database as soon as tables are created, using the post_syncdb signal. signals.post_syncdb.connect(init) Then in the init function, I want to set permission, so I use ct = ContentType.objects.get(app_label='news', model='Article') Permission(name='Approve articles', codename='can_approve_article', content_type=ct) But if I drop all the tables and run syncdb , I get ... File "...\base\functions\init.py", line 11, in init ct = ContentType.objects.get(app

SIGKILL init process (PID 1)

两盒软妹~` 提交于 2020-01-21 04:51:09
问题 I'm facing a weird issue regarding sending signal 9 (SIGKILL) to the init process (PID 1). As you may know, SIGKILL can't be ignored via signal handlers. As I tried sending SIGKILL to init, I noticed that nothing was happening; init would not get terminated. Trying to figure out this behaviour, I decided to attach myself to the init process with strace too see more clearly what was happening. Now comes the weird part. If I'm "looking" at the init process with strace and send it SIGKILL, the

PyQt signal with arguments of arbitrary type / PyQt_PyObject equivalent for new-style signals

[亡魂溺海] 提交于 2020-01-20 05:50:08
问题 I have an object that should signal that a value has changed by emitting a signal with the new value as an argument. The type of the value can change, and so I'm unsure of how to write the signal type. I know that I can acconmplish this using old-style signals like this: self.emit(SIGNAL("valueChanged(PyQt_PyObject)"), newvalue) but how would I write this using new-style signals? I am aware of a previous question related to this but no "real" answer was given there. 回答1: First, the object you

How do I trap EXIT in a solaris 11 shell script?

佐手、 提交于 2020-01-17 13:15:00
问题 man signal.h indicates there's no SIGEXIT in Solaris 11. How can I trap it in my shell scripts? Or how can I simulate the old behavior of traping SIGEXT? 回答1: Why are you looking to the C API manual for a shell feature ? You definitely can trap the SIGEXIT signal under Solaris 11 shells (at least ksh93, bash and sh). $ cat /etc/release Oracle Solaris 11.1 X86 Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved. Assembled 19 September 2012 $ cat /tmp/z #!/bin/ksh trap

Getting the period from irregularly-spaced time series using OCTAVE

自古美人都是妖i 提交于 2020-01-17 04:14:10
问题 I have a two column array of data. First column is time (date in decimal years) and second column is the signal strength. The plot is a triangle wave or should be ideally because the sampling is irregularly timed. I've tried numerous methods to get the period of the wave, including fitting a sine wave to the data via lsqcurvefit, but it doesn't always return the right period. Using OCTAVE how do I get the period (my main aim) of this/any irregularly-spaced time series?See plot 回答1: Found

MATLAB uicontrol callback return matrix

青春壹個敷衍的年華 提交于 2020-01-16 18:16:28
问题 Original post: MATLAB scrolling plot I got a second part in my problem now. As before, I have a 19*1000*134 matrix that I'm plotting thanks to the nicely answer from Aero Engy on the last post. I would like to create in my workspace a vector called clean that will have a 134 length. By default, the value for clean(i) (with i between 1 and 134) will be 1 -- but, if I press a button on the UI interface, the value must get to 0. My code bellow, just don't give me any ouput. The button seems to

Exception not caught after signal

痴心易碎 提交于 2020-01-16 08:20:30
问题 I try to catch a termination signal to my code to write a restart file before exiting. My solution is based on this answer. #include <exception> #include <csignal> #include <iostream> class InterruptException : public std::exception { public: InterruptException(int _s) : signal_(_s) { } int signal() const noexcept { return this->signal_; } private: int signal_; }; /// method to throw exception at signal interrupt void sig_to_exception(int s) { throw InterruptException(s); } int main() { //

Signal handler not working on process opened via pipe

你离开我真会死。 提交于 2020-01-16 08:16:29
问题 Note: this is a general question (not limited to wolfram command, and you don't have to know about wolfram ). I consider wrapping wolfram (CUI calculator like python interpreter). Without any wrapper, SIGINT causes the program to suspend the calculation. $ /usr/bin/wolfram -noinit In[1] := While[True, 1] #start infinite loop #execute `kill -SIGINT` from another shell to send SIGINT Interrupt> #calculation now interrupted (you can cancel or resume it) However, with a wrapper, SIGINT causes

How can I add signal handlers to a shell written in Py3k/Python?

坚强是说给别人听的谎言 提交于 2020-01-16 00:48:08
问题 I am working on writing a shell, but I want to have stubbed signal handlers when the user hits i.e. control-C or control-Z. My code is as follows; as I have investigated it, I can get it to not stop on a control-Z, but still suspend on a control-Z. The most recent published version of the code is at http://JonathansCorner.com/cjsh/download.cgi. The code I am working on is: def handle_signal(signal_number, frame): print (''' CJSH does not support the traditional and rather archaic methods of

Are signals generated by OS kernels or processes?

隐身守侯 提交于 2020-01-15 16:47:49
问题 https://en.wikipedia.org/wiki/Unix_signal says Signals are a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-compliant operating systems. A signal is an asynchronous notification sent to a process or to a specific thread within the same process in order to notify it of an event that occurred. ... The kernel can generate signals to notify processes of events. For example, SIGPIPE will be generated when a process writes to a pipe which has been closed by the