Questions tagged [signals]

1

votes
0

answer
182

Views

Python : spectrogram speech recognition

I am trying to reproduce a preprocessing seen in a youtube video https://www.youtube.com/watch?v=g-sndkf7mCs where they create a spectrogram taking a windows of 20 ms and then apply an FFT on it. Finally they feed a neural network with the spectrogram obtained. I am using the scipy package but I am...
Shiro
1

votes
1

answer
97

Views

SIGIO isn't POSIX and SIGPOLL is marked “Obsolescent”. What do I use?

I'm learning about signals in C. I'm trying to write a program that complies with POSIX and ANSI standards. I want my program to be signaled when something happens but SIGIO isn't POSIX and SIGPOLL is marked as 'Obsolescent' in POSIX 7. What signal do I use in my program?
1

votes
1

answer
107

Views

Overriding virtual protected slot of QListView at runtime

I am using PyQt 5.9.1, and I want to connect QListView.currentChanged to a function at runtime. But for some reason, I can do it only before calling setModel(). If I call setModel() (even with a None argument) beforehand, then my currentChanged function is never called. # https://www.pythoncentral.i...
Winand
1

votes
1

answer
259

Views

Can non-blocking system calls be interrupted?

I am reading The Linux Programming Interface which describes (in section 21.5) how a blocking system call can be interrupted by a signal. This seems to imply that a non-blocking system call cannot be interrupted. Is this true?
dippynark
1

votes
0

answer
83

Views

Signal handler triggers on first time signal is raised, but not subsequent times

I'm fairly new to signals. It's an AF_INET socket, handling SIGIO. The first connection and packet are received and handled (displayed) properly, as far as I can tell. Subsequent sends are not, however. A breakpoint on the signal handler in GDB (as well as the atomic state flag) shows that the signa...
1

votes
1

answer
1.1k

Views

Changing WAV format from 32-bit floating point to 16 bit PCM

I'm trying to convert my 32-bit floating point sampled WAVE file to 16-bit integer WAVE file. I want to generate 16-bit integer WAV file from ultrasonic sine wave which range from -1.414 to 1.414. In SciPy.io.wavfile, the output format is fixed according to type array which I generated. But I chang...
JayHeo
1

votes
0

answer
42

Views

Django Conditional User Profiles

I am trying to implement multiple user roles in my Django app using a profile-like model linked to the User model. The intent is to enable/disable functionality based on the class of the linked profile. I have read examples of using the post_save signal to create a user profile linked back to the Us...
merrickks
1

votes
0

answer
118

Views

setitimer - SIGALRM not emitted

I'm running the code below in 2 different environnements : alone and with other binaries. My problem is that my timer set with setitimer works properly alone (with a main and no class) but in the second environnement it reaches 0 and nothing happens at all. No SIGALRM emitted and no reset to interva...
Saeïdryl
1

votes
1

answer
290

Views

Reaping zombie processes via handler

The code written below is to handle the received signals and reap the zombies by the parent process 'from System Programming course of CMU'. Q1. what is the rule of -1 'the first arg of the waitpid function'? should not we pass the pid of the zombie we are reaping instead? Q2. For the loop here,...
White159
1

votes
0

answer
40

Views

python timer for multi-thread

Currently I meet this trouble: I used a single thread script before, which is used to execute SQL one by one and for each SQL there is a time limitation -- 5400s. Therefore, if one of the SQL has run a long time more than 5400 sec, this SQL will be stopped and signed as 'time out'. The code of timer...
Li Tang
1

votes
1

answer
33

Views

python timing out of a function if takes a long time

Let's say I have a function def may_take_a_long_time(): while 1: # do something if met_condition(): break timeout_dur = 600 may_take_a_long_time() do_something_else() What can I do so that if may_take_a_long_time() takes longer than timeout_dur, to abort whatever its doing, and proceed w/ do_somethi...
ealeon
1

votes
1

answer
259

Views

Capture Ctrl-C Signal And Wait For Subprocess

I have a bit of python code in which I call a subprocess, and within the python script I want to capture the SIGINT signal, and wait for the subprocess to finish. Currently what I have kills the process when I ctrl-c. Any way to tell python to wait for the process to finish? Although I want to wait...
user2774695
1

votes
0

answer
216

Views

Django pre_save signal and ModelAdmin custom error message

I have a model whose pre_save() signal is connected to a remove service (json, REST, etc.) in the following way: before saving locally, query the remote service, asking for remote insertion remote service does its things, the main being checking that a relevant entry does not already exist. On succe...
Hal
1

votes
1

answer
127

Views

Why SIGPIPE doesn't occur when the read end of a pipe is closed?

I'm trying to write a program with two processes: One process generates some a + b problems and print it to its stdout (like printf('%d %d\n', a, b)), and gets the answer from another process through stdin, and log the answer to log.txt. When all the problems are asked, the process will print out '-...
TsReaper
1

votes
1

answer
687

Views

Interrupting an infinite loop in Golang with signals

I'm trying to make a program that uses signals to interrupt an infinite counter loop. I've managed to interrupt the program with SIGINT (ctrl + C), but I'm unable to interrupt it otherwise. I'm wondering if I can make other ways of interrupting the loop, for example by pressing the Q key while it is...
Kstulen
1

votes
1

answer
69

Views

Is there any way to send signal after focus on timeout in input field

I have got a similar situation, when I use 'autofocus' on any input field then with the below signal I'm able to bring up the keyboard : connect(view, SIGNAL(loadFinished(bool)), SLOT(popupKeyboardOnAutoFocus(bool))); where popupKeyboardOnAutoFocus is a function to bring up the keyboard. Now, I'm tr...
SirKappe
1

votes
0

answer
131

Views

Signal handling difference “shutdown -r” and “reboot” in Linux

I am using Ubuntu 16.10 LTS Linux Desktop. I found there is a difference in the signal handling during shutdown -r and reboot. I built an a.out, which will capture the SIGTERM, and post some messages. With shutdown -r, a.out can get the SIGTERM, and post the messages. But with reboot (and reboot -f)...
wangt13
1

votes
0

answer
36

Views

How does .send() find connected receivers? Django

I have been learning about signals, and am now trying to understand the basic, inner mechanics of how a signal is sent - and received. This post concerns the provided signal-objects(pre_save, post_save...etc), not writing custom ones. Looking within the Django code for the model class, .send() is ca...
William Karlsson
1

votes
0

answer
135

Views

Linux setrlimit() doesn't kill process

From man page of setrlimit, when RLIMIT_CPU limit is set, process should receive SIGXCPU every second once the soft limit is reached, and SIGKILL when the hard limit is reached. I have the following code where the child process is created using clone() call. Then RLIMIT_CPU is set followed by long l...
nikola12345
1

votes
1

answer
56

Views

How can I use SIGALRM to abort my server connection?

I am using fork() to implement a TFTP server right now. If my server does not hear from another party for 20s, how can I use SIGALRM to abort the connection? Here is a part of my code: while (1) { pid = fork(); if ( pid == -1 ) { return EXIT_FAILURE; } if ( pid > 0 ) { wait(NULL); close(server_socke...
Haotian Song
1

votes
1

answer
102

Views

What is the functional difference between these two qt signal-slot connections?

I'm using Qt 5.9.2 with Visual Studio 2015 and QtDesigner for programming a Windows GUI application. I tried connecting one of my actions via the following call: connect(ui.myAction, &QAction::triggered, memberPtrToObjX_, &ClassX::Run); However ClassX::Run is not always triggered after clicking on m...
Don-Umbro
1

votes
0

answer
74

Views

Why Qt signal will not work after use class as property in qml page?

I have a c++ class like below and i used this class after registering that in an qml page and that signals works well in qml page class1.cpp QString Class1::message(){ return m_Message; } void Class1::setMessage(QString m){ m_Message=m ; emit messageChanged(); } void Class1::invokeEvent(){ setMessag...
mohsen
1

votes
0

answer
36

Views

How to get values of m2m fields before saving in database?

I want to get values of m2m fields when I changi this fields in my model. I tried to use m2m_changed signal, but I get None values in action, pk_set,instance. What am I doing wrong? @receiver(m2m_changed, sender=UserProfile) def m_2_m_changed(sender, **kwargs): action = kwargs.pop('action', None) pk...
1

votes
1

answer
179

Views

known class method for React Native OneSignal

I am trying set up One Signal for Push Notification on React Native. But when I build in I receive No known class method for selector 'didReceiveRemoteNotification:' error. #import 'AppDelegate.h' #import #import #import 'RCTOneSignal.h' @implementation AppDelegate @synthesize oneSignal = _oneSign...
1

votes
0

answer
88

Views

Django-polymorphic pre-save signal

I'm trying to switch to django-polymorphic models in my ecommerce project, but found problem with pre-save signals. When creating new product via Admin I need to fill 'Slug' field of my object with unique value. In non polymorphic version it was implemented by pre save signal from all subclasses of...
Marek Biczysko
1

votes
1

answer
143

Views

How to register a SIGINT handler that will run as soon as Ctrl+C is pressed?

I am writing a Python script that uses the PyObjC bindings for AppKit. The script registers an observer with the shared NSWorkspace's notificationCenter and then calls AppKit.CFRunLoopRun() in order for the notifications to be processed: from __future__ import print_function from AppKit import * imp...
Daniel Trebbien
1

votes
1

answer
102

Views

signal for windows and linux IPC

In order for code compatible among Windows and Linux/Unix. I want to use MingW’s tool sets and CodeBlocks for development so the code can be compiled and run on both Linux and Windows. The system I try to design is a very busy, heavy data exchange system like server and clients, all running in t...
chans
1

votes
0

answer
96

Views

Field Test using Swift on iOS

Apple just removed the possibility to show the signal strength in dBm on the iPhone. Does anyone know a possibility to get the signal strength programmatically via Swift for iOS 11? I really need this for an app which I am programming on. This will be just an internal app and nothing to publish in t...
FranzFerdinand
1

votes
1

answer
45

Views

How should I terminate long run scripts without any data generated, I tried pressing Ctrl+C in a windows console via paramiko module

This is really interesting. I have following scripts on my linux machine: sleep.py import time from datetime import datetime print(datetime.now()) time.sleep(20) print('Over!') print(datetime.now()) loop.py import time for i in range(20): time.sleep(1) print(i) I can terminate them directly by ctrl+...
Wayne
1

votes
1

answer
61

Views

Block all signals in OCaml

I want to block all signals in OCaml using Unix.sigprocmask. In C, I would do this using the function sigfillset, which is not available in the Unix module. So how do I get a list of all signals in OCaml, that I can then pass to sigprocmask?
user4759923
1

votes
1

answer
171

Views

increment another model field using django signals

I have two models, A and B. I want to increment the value in one field of model A whenever i insert another value in model B. I am using post_save signals but i keep getting this error ''update_fields' is an invalid keyword argument for this function' below is my code thank you for your help. class...
1

votes
1

answer
124

Views

QSerialPort read string

So far my application works just fine. But there is one problem. We need to read the data from the serialport. This data may contain only bytes so reading with the readLine() function could give us false or no data. Here is the code now so you can understand my problem. void MainWindow::readData() {...
uvan
1

votes
0

answer
79

Views

Django signals not working on worker

I have django (1.9) application which is implemented with websocket. To implement websocket I use Django channel (1.1.8). My models are under ACL which are managed by Django-guardian (1.4.4). I send message through websocket every time a model named 'My_model' is created, changed or deleted. But my...
Antonio Rak
1

votes
0

answer
24

Views

Comunication between two Node.js express requests

I have two clients. A client sends an HTTP request to node.js express server and this writes in the DB then waits that value changes. It changes when the other client sends an HTTP request to node.js express and it UPDATE the record in the DB. Then the first request sends a response JSON to the firs...
Heichou
1

votes
1

answer
59

Views

Signal Handler Behavior

I have just some questions about the system calls signal, kill and the signal handler. I have this code: int figlio=-1; int main(int argc,char* argv[]) int pid1,pid2,dormi,numero; float reciproco; signal(SIGUSR1,gestore); signal(SIGUSR2,gestore); numero=atoi(argv[1]); printf('Numero %d\n\n',numero);...
FurioShow
1

votes
0

answer
65

Views

Many-to-Many update, Django signals

I have these models (simplified): class Product(TimeStampedModel): product_id = models.AutoField(primary_key=True, ) shop = models.ForeignKey('Shop', related_name='products', to_field='shop_name', on_delete=models.CASCADE) category = models.ForeignKey('Category', related_name='products', to_field='c...
Chiefir
1

votes
0

answer
78

Views

How to handle signal in MPI

I am currently implementing a MPI program that will run in an infinite loop, the goal is when one of those processes receive the signal, all those processes will exit the infinite loop, there is a global variable flag that will indicate whether the signal is received, how can I use MPI_Allreduce to...
Haotian Song
1

votes
0

answer
32

Views

About signal filter and composition

I have got three signals, acc_x, acc_y, acc_z. I need to compose them in order to compute the magnitude of the acc. I would like to ask the following question: what is better opt1 or opt2? or opt3?: opt1: first apply a filter (sp.signal.savgol_filter) to reduce the noise to each single signal and th...
Carlo Allocca
1

votes
0

answer
68

Views

Signal handlers and atexit of coverage.py for sub-process

To successfully write a coverage data file, the Python sub-process under analysis must shut down cleanly and have a chance for coverage.py to run the atexit handler it registers. For example if you send SIGTERM to end the sub-process, but your sub-process has never registered any SIGTERM handler, th...
SangminKim
1

votes
0

answer
79

Views

Cancel multiprocessing.Pool with SIGINT

My goal is to compute several data points in parallel and write them to an IO device asynchronously. The data points cannot be written just by themselves but need to be wrapped; more precisely, I am writing a JSON array and the [] symbols around the structs are required. My current approach is to us...
Andreas T

View additional questions