Search Results

Search found 2649 results on 106 pages for 'signal slot'.

Page 8/106 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • emit signal from thread

    - by Umesha MS
    Hi, I am writing a sample which uses thread to do some background processing. In the thread I am trying to emitting a signal. But it is not coming to slot. While connecting I checked the value of “connect()” function value , it is returning value as true. One thing to notice is in the run method I am not using “exec() “ . Please help me to solve this problem.

    Read the article

  • Measuring "real" phone signal strength on a mobile phone

    - by Serafeim
    I want to programmatically measure the phone signal strength in a mobile phone. I don't actually care about the mobile phone or the programming environment: It can be based on android or windows mobile or even J2ME and can be from any manufacturer (please no iPhone). However, it needs to be a real, commercial mobile phone and not a special measurement device. This problem is not as easy as it seems with a first look. I am aware that there already exist a number of methods that claim to return the phone signal strength. Some of these are: SystemState.PhoneSignalStrength for WM6 RIL_GetCellTowerInfo for WinCe (dwRxLevel member of returned RILCELLTOWERINFO struct) android.telephony.NeighboringCellInfo.getRssi() for android The problem with the above is that they only return a few (under 10) discrete values, meaning that, for instance, the return values of SystemState.PhoneSignalStrength can only be translated to (for instance) -100 dbm, -90 dbm, -80 dbm, -70 dbm and -60 dbm, something that is not useful for my application, since I'd like to have as much precision as possible. It doesn't matter if there is an undocumented solution that only works on only one phone, if you can tell me a way I'd be grateful. Thanks in advance

    Read the article

  • Binding a member signal to a function

    - by the_drow
    This line of code compiles correctly without a problem: boost::bind(boost::ref(connected_), boost::dynamic_pointer_cast<session<version> >(shared_from_this()), boost::asio::placeholders::error); However when assigning it to a boost::function or as a callback like this: socket_->async_connect(connection_->remote_endpoint(), boost::bind(boost::ref(connected_), boost::dynamic_pointer_cast<session<version> >(shared_from_this()), boost::asio::placeholders::error)); I'm getting a whole bunch of incomprehensible errors (linked since it's too long to fit here). On the other hand I have succeeded binding a free signal to a boost::function like this: void print(const boost::system::error_code& error) { cout << "session connected"; } int main() { boost::signal<void(const boost::system::error_code &)> connected_; connected_.connect(boost::bind(&print, boost::asio::placeholders::error)); client<>::connection_t::socket_ptr socket_(new client<>::connection_t::socket_t(conn->service())); // shared_ptr of a tcp socket socket_->async_connect(conn->remote_endpoint(), boost::bind(boost::ref(connected_), boost::asio::placeholders::error)); conn->service().run(); // io_service.run() return 0; } This works and prints session connected correctly. What am I doing wrong here?

    Read the article

  • Django's post_save signal behaves weirdly with models using multi-table inheritance

    - by hekevintran
    Django's post_save signal behaves weirdly with models using multi-table inheritance I am noticing an odd behavior in the way Django's post_save signal works when using a model that has multi-table inheritance. I have these two models: class Animal(models.Model): category = models.CharField(max_length=20) class Dog(Animal): color = models.CharField(max_length=10) I have a post save callback called echo_category: def echo_category(sender, **kwargs): print "category: '%s'" % kwargs['instance'].category post_save.connect(echo_category, sender=Dog) I have this fixture: [ { "pk": 1, "model": "animal.animal", "fields": { "category": "omnivore" } }, { "pk": 1, "model": "animal.dog", "fields": { "color": "brown" } } ] In every part of the program except for in the post_save callback the following is true: from animal.models import Dog Dog.objects.get(pk=1).category == u'omnivore' # True When I run syncdb and the fixture is installed, the echo_category function is run. The output from syncdb is: $ python manage.py syncdb --noinput Installing json fixture 'initial_data' from '~/my_proj/animal/fixtures'. category: '' Installed 2 object(s) from 1 fixture(s) The weird thing here is that the dog object's category attribute is an empty string. Why is it not 'omnivore' like it is everywhere else? As a temporary (hopefully) workaround I reload the object from the database in the post_save callback: def echo_category(sender, **kwargs): instance = kwargs['instance'] instance = sender.objects.get(pk=instance.pk) print "category: '%s'" % instance.category post_save.connect(echo_category, sender=Dog) This works but it is not something I like because I must remember to do it when the model inherits from another model and it must hit the database again. The other weird thing is that I must do instance.pk to get the primary key. The normal 'id' attribute does not work (I cannot use instance.id). I do not know why this is. Maybe this is related to the reason why the category attribute is not doing the right thing?

    Read the article

  • Android Signal 11 (SIGSEGV)

    - by Naturjoghurt
    I read many posts here and on other sites, but can not find the problem creating my Error: I use an AsyncTask because I want to easily manipulate the UI Thread before and after Execution. In doInBackground I create a ThreadPoolExecutor and execute Runnables. If I only execute 1 Runnable with the Executor, there is no Problem, but if I execute another Runnable I get following Error: 06-26 18:00:42.288: A/libc(25073): Fatal signal 11 (SIGSEGV) at 0x7f486162 (code=1), thread 25106 (pool-1-thread-2) 06-26 18:00:42.304: D/dalvikvm(25073): GC_CONCURRENT freed 119K, 2% free 8908K/9056K, paused 4ms+4ms, total 45ms 06-26 18:00:42.327: I/System.out(25073): In Check All with Prefix: a and Length: 4 06-26 18:00:42.390: I/DEBUG(126): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-26 18:00:42.390: I/DEBUG(126): Build fingerprint: 'google/yakju/maguro:4.2.2/JDQ39/573038:user/release-keys' 06-26 18:00:42.390: I/DEBUG(126): Revision: '9' 06-26 18:00:42.390: I/DEBUG(126): pid: 25073, tid: 25106, name: pool-1-thread-2 >>> de.uni_duesseldorf.cn.distributed_computing2 <<< 06-26 18:00:42.390: I/DEBUG(126): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 7f486162 ... 06-26 18:00:42.538: I/DEBUG(126): memory map around fault addr 7f486162: 06-26 18:00:42.538: I/DEBUG(126): 60292000-60391000 06-26 18:00:42.538: I/DEBUG(126): (no map for address) 06-26 18:00:42.538: I/DEBUG(126): bed14000-bed35000 [stack] I set up the ThreadPoolExecutor like this: // numberOfPackages: Number of Runnables to be executed public void initializeThreadPoolExecutor (int numberOfPackages) { int corePoolSize = Runtime.getRuntime().availableProcessors(); int maxPoolSize = numberOfPackages; long keepAliveTime = 60; final BlockingQueue workingQueue = new LinkedBlockingQueue(); executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS, workingQueue); } I have no clue, why it fails when starting the second Thread. Maybe Memory Leaks? Any Help appreciated. Thanks in Advance

    Read the article

  • pthread_join from a signal handler

    - by liv2hak
    I have a capture program which in addition do capturing data and writing it into a file also prints some statistics.The function that prints the statistics static void* report(void) { /*Print statistics*/ } is called roughly every second using an ALARM that expires every second.So The program is like void capture_program() { pthread_t report_thread while(!exit_now) { if(pthread_create(&report_thread,NULL,report,NULL)){ fprintf(stderr,"Error creating reporting thread! \n"); } /* Capturing code -------------- -------------- */ if(doreport) usleep(5); } } void *report(void *param) { while(true) { if(doreport) { doreport = 0 //access some register from hardware usleep(5) } } } The expiry of the timer sets the doreport flag.If this flag is set report() is called which clears the flag.I am using usleep to alternate between two threads in the program.This seems to work fine. I also have a signal handler to handle SIGINT (i.e CTRL+C) static void anysig(int sig) { if (sig != SIGINT) dagutil_set_signal_handler(SIG_DFL); /* Tell the main loop to exit */ exit_now = 1; return; } My question: 1) Is it safe to call pthread_join from inside the signal handler? 2) Should I use exit_now flag for the report thread as well?

    Read the article

  • Why my linux signal handler run only once

    - by Henry Fané
    #include <iostream> #include <signal.h> #include <fenv.h> #include <string.h> void signal_handler(int sig, siginfo_t *siginfo, void* context) { std::cout << " signal_handler " << fetestexcept(FE_ALL_EXCEPT) << std::endl; throw "exception"; } void divide() { float a = 1000., b = 0., c, f = 1e-300; c = a / b; std::cout << c << " and f = " << f << std::endl; } void init_sig_hanlder() { feenableexcept(FE_ALL_EXCEPT); struct sigaction sa, initial_sa; sa.sa_sigaction = &signal_handler ; sigemptyset( &sa.sa_mask ) ; sa.sa_flags = SA_SIGINFO; // man sigaction(3) // allows for void(*)(int,siginfo_t*,void*) handler sigaction(SIGFPE, &sa, &initial_sa); } int main(int argc, char** argv) { init_sig_hanlder(); while(true) { try { sleep(1); divide(); } catch(const char * a) { std::cout << "Exception in catch: " << a << std::endl; } catch(...) { std::cout << "Exception in ..." << std::endl; } } return 0; } Produce the following results on Linux/g++4.2: signal_handler 0 Exception in catch: exception inf and f = 0 inf and f = 0 inf and f = 0 inf and f = 0 So, signal handler is executed the first time but the next fp exception does not trigger the handler again. Where am I wrong ?

    Read the article

  • Computer speakers receive radio station signal

    - by squircle
    I have a set of Logitech 5.1 speakers where each speaker and the source plug into the subwoofer. I'm using a Griffin Firewave with output from my MacBook Pro, and output from my custom-built desktop with a switch in the middle (built it myself out of an old Belkin A/B parallel switch). Recently, I've noticed that I can hear a local Punjabi radio station being picked up by my speakers, and the volume of this interference increases as I increase the volume of the speakers. I'm fairly sure that this radio station is at the low-end of the FM spectrum, below 90MHz (or it may be at the high end, above 105MHz, my memory isn't infallible). It gets quite annoying as I can't put my audio very loud without the interference. I've tried to put a ferrite core on the input cable just before the 3.5mm jacks plug into the subwoofer. I don't know if putting the same core around all three of the cables (green, black, orange) would negate the effects, but I'm assuming not. There has been no change. Is there any reason why this would be happening? I'm assuming the interference is coming somewhere between the FireWave and the subwoofer, because the noise gets amplified with volume increases. If anybody has any suggestions, I'd be grateful!

    Read the article

  • Reload signal for UWSGI when using Supervisord?

    - by Kerem Ulutas
    I have been using UWSGI behind Nginx and I've set supervisord to restart the Nginx and UWSGI instances in case of a server reboot. I am debugging my application and sometimes need to reload the application. According to this page I should be sending SIGHUP in order to do a graceful reload. I could find a stopsignal config setting on this page, but I couldn't find any entry related to something like "reloadsignal" or "restartsignal". Any ideas?

    Read the article

  • How to extend Wi-Fi signal across rooms?

    - by Sriram Krishnan
    I moved into a new place and my old Wi-Fi router just doesn't have the range to get into all the rooms. I've been investigating a lot of options and I'm wondering what other folks have done here. Moving the current location of my primary Wi-Fi router is not an option thanks to our cable provider and our landlord. Buy a bigger, beefier router (seems expensive). If so, should I go for one of those draft 802.11n ones to avoid microwave/other Wi-Fi router interference? Set up a router with DD-WRT as a repeater Leech the neighbors' open Wi-Fi access point. Alright, I was kidding about the last one but I'm genuinely curious as to what my best option is.

    Read the article

  • Django "comment_was_flagged" signal

    - by tsoporan
    Hello, This is my first time working with django signals and I would like to hook the "comment_was_flagged" signal provided by the comments app to notify me when a comment is flagged. This is my code, but it doesn't seem to work, am I missing something? from django.contrib.comments.signals import comment_was_flagged from django.core.mail import send_mail def comment_flagged_notification(sender, **kwargs): send_mail('testing moderation', 'testing', 'test@localhost', ['[email protected]',]) comment_was_flagged.connect(comment_flagged_notification) (I am just testing the email for now, but I have assured the email is sending properly.) Thanks!

    Read the article

  • Signal Handling in C

    - by Dave
    How can I implement signal Handling for Ctrl-C and Ctrl-D in C....So If Ctrl-C is pressed then the program will ignore and try to get the input from the user again...If Ctrl-D is pressed then the program will terminate... My program follows: int main(){ char msg[400]; while(1){ printf("Enter: "); fgets(msg,400,stdin); printf("%s\n",msg); } } Thanks, Dave

    Read the article

  • Signal processing or algorithmic programming for a PLC

    - by james singen smythe
    I have an application that takes voltages and temperatures as analog inputs and does some processing using an algorithm which involves signal processing such as low-pass filtering, exponential smoothing, and other steps which might typically be done in a high-level programming language such as C or C++. I'm curious how I could perform these same steps using a PLC, and in particular, the Allen-Bradley Control-Logix system? It seems to me that the instruction set with ladder logic is too limited for this. Could I perform this using structured text?

    Read the article

  • Agilent E4426B signal generator locks up during multiple GPIB *SAV operations

    - by aspiehler
    I have a test fixture with an Agilent E4426B RF signal generator connected to a PC via a National Instrument Ethernet-to-GPIB bridge. My software is attempting to sanitize the instrument by presetting it and then saving the current state to all of the memory locations writable via the standard SCPI command "*SAV x,y". The loop works to a point, but eventually the instrument responds with an error and continuously displays the "L" icon on the front display and a "Remote preset" message at the bottom. At that point it won't respond to any more remote commands and I have to either cycle power or press LOCAL, then PRESET at which point it takes about 3 minutes to finish presetting. At that point the "L" icon is still present and and the next GPIB command sent to the instrument causes it to report a -113 error (undefined header) in the instrument error queue. I fired up NI spy to see what was happening, and found that the error was happening at the same point in the loop - "*SAV 6,2" in this case. From NI Spy: Send (0, 0x0017, "*SAV 6,2", 8 (0x8), NLend (0,0x01)) Process ID: 0x00000520 Thread ID: 0x00000518 ibsta:0xc168 iberr: 6 ibcntl: 2(0x2) And here's the code from the instrument driver: int CHP_E4426b::Erase() { if ((m_StatusCode = Initialize()) != GPIB_SUCCESS) // basically just sends "*RST" return m_StatusCode; m_SaveState = "*SAV %d, %d"; for (int i=0; i < 10; i++) for (int j=0; j < 100; j++) { sprintf(m_CmdString, m_SaveState, j, i); if ((m_StatusCode = Send(m_CmdString, strlen(m_CmdString))) != GPIB_SUCCESS) return m_StatusCode; } return GPIB_SUCCESS; } I tried putting a small Sleep() delay (10-20 ms) at the end of the inner loop, and to my surprise it caused the error to show up earlier rather than later. 10 ms caused the loop to error out at 44,1 and 20 ms was even sooner. I've already eliminated faulty cabling or the instrument as the culprit. This same type of sequence works without any error on a higher end signal generator, so I'm tempted to chalk this up to a bug in the instrument's firmware.

    Read the article

  • Clean up upon the kill signal

    - by Begui
    How do you handle clean up when the program receives a kill signal? For instance, there is an application I connect to that wants any third party app (my app) to send a finish command. What is the best say to send that finish command when my app has been destroyed with a kill -9?

    Read the article

  • sigsetjmp and siglongjmp inside signal handler

    - by EpsilonVector
    How do I: sigsetjmp inside the handler and then return from the handler such that the signal will be unmasked once I siglongjmp back to this point? In pseudo code this is sort of the function that I have: signal_handler(){ if(sigsetjmp(env[i++])) return; else siglongjmp(env[i]); } It's supposed to be the context switch code for user threads in Linux.

    Read the article

  • Tracing UNIX signal origins?

    - by jdizzle
    If I have a process that receives signals from other processes, is there a way for me to somehow tell which process (if any) sent a signal? strace lets me trace which signals a process has received, but doesn't allow me to trace who issued them.

    Read the article

  • How to gracefully handle the SIGKILL signal in Java

    - by Begui
    How do you handle clean up when the program receives a kill signal? For instance, there is an application I connect to that wants any third party app (my app) to send a finish command. What is the best say to send that finish command when my app has been destroyed with a kill -9?

    Read the article

  • add new records using signal in django admin

    - by ganesh
    I've a model called broadcastinfo, It has fields viz.. info,userid...userid is excluded. when i add an new info, my broadcastinfo table should get the records of all userid from user table and the given message. Im trying this via signal.Any idea is highly appreciated. Thanks

    Read the article

  • Qt request never trigger the finished() signal

    - by user63898
    i have something realy strange i have this code : m_url.setUrl("www.cnn.com"); QNetworkRequest request; request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); request.setRawHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); request.setRawHeader("Accept-Language", "en-us,en;q=0.5"); request.setRawHeader("Connection", "Keep-Alive"); request.setUrl(m_url); reply = qnam.get(request); //QNetworkAccessManager qnam member of the class; connect(reply, SIGNAL(finished()), this, SLOT(httpFinished())); the httpFinished() function that is under private slots: never triggered , why ?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >