signals

GTK 3 How to connect one signal to multiple widgets?

痴心易碎 提交于 2019-12-08 13:11:08
问题 I need to create a form with the model created by the code bellow, composed by a window with two text entries and one button. I need to put some text in the entries, and when the button is pressed, put the text gotten in the two entries in an array, (or print them both, or any action with both at the same time) The code used to create the window is the following: #include <iostream> #include <gtk/gtk.h> using namespace std; GtkWidget *wventana; GtkWidget *wgrid; void ventana(string titulo,

C unix sockets. Signals to handle

▼魔方 西西 提交于 2019-12-08 13:01:46
问题 which kind of signal i've to handle in a AF_INET socket, both server and client side? 回答1: Depending on how you're doing what you're doing, you may have to handle SIG_PIPE , which can happen when the connection is arbitrarily broken. You should not have to handle any other signals. If you are using select() or poll() or (personal preference) epoll() you should check for errors (eg, POLLHUP ) before you check for read/write availability. You should also always check the return value of read()

SIGALRM Timeout — How does it affect existing operations?

我的梦境 提交于 2019-12-08 12:46:00
问题 I am currently using select() to act as a timer. I have network receive operations which occur within a loop, and every few seconds a processing operation needs to occur. As a result, the select() statement's timeout constantly changes -- decreasing to zero over time and then restarting at 3. rv = select(selectmonitor+1, &readnet, NULL, NULL, &helper.timeout()); As things come in on the network, the statement is repeated and the value passed to it by helper.timeout() decreases. Eventually,

How can I calculate the rolling mean, skewness, kurtosis, RMS and few other statistical features from an input vector?

随声附和 提交于 2019-12-08 12:20:50
问题 I have a signal collected every second for 3 hours at the rate of 40 Hz and the data length is 432,000. I want to calculate mean, skewness, kurtosis and few other statistical features for every minute. In the sense, I want to calculate the mean of first 40 data points and the second 40 data points and so on. In the end I wish to have a vector of length 180 points. It would be great if someone can share a script for doing this. Thanks in advance. 回答1: function [M, S, A, E] = slideStats( x,

A slot can take less arguments than provided by the signal, HOW? - Qt

谁说胖子不能爱 提交于 2019-12-08 11:56:18
问题 I have a signal which its declaration is: void removed(int sPI, int sWID , int ePI, int eWID); I want to connect it to a slots twice, first needs sPI and sWID arguments and other slot needs ePI and eWID. The slot declaration is: void disconnect(int i, int wID = 0); ( I want when removed() emits, disconnect(sPI, sWID) and also disconnect(ePI, eWID) ) Please help me in writing QObject::connect() statement. Thanks. 回答1: For the first, "disconnect(sPI, sWID)", just do: connect(x, SIGNAL(removed

wrapper for boost::signals2 with lifetime management for generic slots

假如想象 提交于 2019-12-08 11:50:12
问题 I would like to create a wrapper class for boost::signals2 for modules (threads) that emits signals to slots. I.e. a module should gain typical simple signalling capabilities (e.g. a public connect(...) method) by inheriting from my Signal class. I would also like to hide the actual signal-slot implementation that is used. A concrete slot inherits from a generic Slot base class which has a template parameter defining its signature. A slot is just a functor with the suitable signature. This

Passing data between 2 windows. Qt

泪湿孤枕 提交于 2019-12-08 11:26:41
问题 I am new to qt, so I didn't quite get the signal slot mechanism. here is my setup. Dialog class (its a dialog with a lineEdit called "lineEdit") mainwindow class (that has a lineEdit too) I have this : void MainWindow::keyPressEvent(QKeyEvent *event) { int i=event->key(); //char z=(char)i; // connect(ui->lineEdit, SIGNAL(textChanged(QString)), dialog, SLOT(setText(QString))); if(i>=48&&i<=57) { QString s= QString::number(i-'0'); q+=s; ui->lineEdit->setText(q); } I want to set the text of

C++ api for understanding tone signals on a phone line

Deadly 提交于 2019-12-08 09:10:48
问题 Is there any good c++ source codes or api for handling phone lines like understanding tone signals. For example i like to find out if the person enters 3 (it's likely that this is done using it's tone sound). Do i need a special modem for this purpose or it can be done using only standard modems. 回答1: DTMF is the term you are looking for: http://en.wikipedia.org/wiki/Dual-tone_multi-frequency Whether you can process incoming DTMF tones with a particular modem depends on whether the modem

Audio descriptor MFCC in C#

99封情书 提交于 2019-12-08 09:07:15
问题 I'm doing primitive speech recognition and need simple descriptor for my audio signals. Now I have only FFT from my audio signal, but I don't know what should I do after that. When I tried use Hidden Markov Models with only FFT from my training signals, it gives me wrong answers. Could you tell me about any C# libraries, which help me change my FFT signal to MFCC(Mel Frequency Cepstrum Coefficients)? 回答1: I don't know such libraries for C# but I can show you my implementation of extracting 20

How to wait for the children processes to send signals?

痴心易碎 提交于 2019-12-08 08:59:24
问题 #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <sys/types.h> void handler(int signumber) { return; } int main() { int i, pid; int children_count = 5; int arr_childprocesses[5]; int parent_pid = getpid(); for(i=0;i<children_count;i++) { pid = fork(); if(pid == -1) { perror("Err"); exit(EXIT_FAILURE); } if(pid == 0) break; arr_childprocesses[i] = pid; } if (pid == 0) // children { kill(parent_pid,SIGUSR1); printf("Child(%d) sig sent. Waiting 5s...\n",getpid()); sleep(5);