Search Results

Search found 506 results on 21 pages for 'signals'.

Page 14/21 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • AS3 - Event listener that only fires once

    - by Zed-K
    I'm looking for a way to add an EventListener which will automatically removes itself after the first time it fires, but I can't figure a way of doing this the way I want to. I found this function (here) : public class EventUtil { public static function addOnceEventListener(dispatcher:IEventDispatcher,eventType:String,listener:Function):void { var f:Function = function(e:Event):void { dispatcher.removeEventListener(eventType,f); listener(e); } dispatcher.addEventListener(eventType,f); } } But instead of having to write : EventUtil.addOnceEventListener( dispatcher, eventType, listener ); I would like to use it the usual way : dispatcher.addOnceEventListener( eventType, listener ); Has anybody got an idea of how this could be done? Any help would be greatly apprecitated. (I know that Robert Penner's Signals can do this, but I can't use them since it would mean a lot of code rewriting that I can't afford for my current project)

    Read the article

  • Developing a GPS car tracking system

    - by Click Ok
    I'm in the brainstorming phase to develop a GPS car tracking system requested by a customer. I myself know the directions to build some GPS system to mobile phones and etc. But sincerely I don't know how to start in that project. That is the scenario: 1) The cars will get a device with a SIM CARD that will emit GPS signals. 2) My customer will in any place (home, work, etc) with a web connection will see in the map where the car is located. For me, I have not problems at get the GPS data, convert to usable info and show the position in some map system (like Google Maps or MS Bing Maps, by example). My problem is, how I do to retrieve that "GPS Signal" from device in the car? I will need some kind of "Receiver Device" connected to a web server machine in order to my application to consume that data? Or "automagically" my sodtware will receive the info from a third-party web-service? Or what?

    Read the article

  • USB interface barcode scanners

    - by Nimbuz
    Not exactly a programming question, but close. I'll try my luck anyway. The keyboard wedge barcode scanner inserts the translation device between the reader and the keyboard. Data sent through a wedge appears as if it was typed into the computer, while the keyboard itself remains fully functional. Because a computer using a keyboard wedge can't tell the difference between data that is entered by a scanning device, or data that is entered by keyboard typing, a wedge can be used to easily add barcode reading capability to an existing computer without modifying software applications. I'd like to know if all USB interface barcode scanners automatically translate digital signals from a barcode reader into keyboard strokes for a applications just like wedge or is USB different from wedge? Many thanks

    Read the article

  • QWidget keyPressEvent override

    - by eaigner
    Hi there, I'm trying for half an eternity now overriding QWidgets keyPressEvent function in QT but it just won't work. I've to say i am new to CPP, but I know ObjC and standard C. My problem looks like this: class QSGameBoard : public QWidget { Q_OBJECT public: QSGameBoard(QWidget *p, int w, int h, QGraphicsScene *s); signals: void keyCaught(QKeyEvent *e); protected: virtual void keyPressEvent(QKeyEvent *event); }; QSGameBoard is my QWidget subclass and i need to override the keyPressEvent and fire a SIGNAL on each event to notify some registered objects. My overridden keyPressEvent in QSGameBoard.cpp looks like this: void QSGameBoard::keyPressEvent(QKeyEvent *event) { printf("\nkey event in board: %i", event->key()); //emit keyCaught(event); } When i change QSGameBoard:: to QWidget:: it receives the events, but i cant emit the signal because the compiler complains about the scope. And if i write it like this the function doesn't get called at all. What's the problem here?

    Read the article

  • How to handle a C# console application terminating?

    - by Nick R
    If I have a console application, is there any way I can handle the following: Ctrl-C (I know the answer to this. Using Console.TreatControlCAsInput and Console.CancelKeyPress) Session termination, such as when someone logs off Process exit, such as when someone uses the task manager to close the application. I know that if I was writing a unix application, I would handle various signals to catch the request to close (SIGTERM from memory), but I also know I need to handle these messages pretty quickly and exit before the system does a kill -9 (SIGKILL). But for a C# console application, I'm not sure how to do this.

    Read the article

  • built-in schema datatype for html / xhtml

    - by John Clements
    Is there a built-in schema datatype for xhtml data? Suppose I want to specify a "boozle" element that contains two "woozles", each of which is arbitrary xhtml. I want to write something like this, using the relax NG compact syntax: namespace nifty = "http://brinckerhoff.org/nifty/" start = element nifty:boozle {woozle, woozle} woozle = element nifty:woozle {xhtml} Unfortunately, xmllint then signals this error: ./lab.rng:43: element ref: Relax-NG parser error : Reference xhtml has no matching definition ./lab.rng:43: element ref: Relax-NG parser error : Internal found no define for ref xhtml So my question is this: is there something sensible that I should put in place of "xhtml" above?

    Read the article

  • django authentication .htaccess static

    - by Uszy Wieloryba
    In my app users can upload files for other users. To make the uploaded files accesible only for the addresse I need some kind of static files authentication system. My idea, is to create the apache hosted directory for each user and to limit access to this derectory using .htaccess. This means that each time new django user is created, I need to create a directory and the appropriate .htaccess file in it. I know I should do it using post_save signals on User model but I don't know how to create the .htaccess in the user's directory from python level. Can you help me with that? Or perhaps you have better solution to my problem?

    Read the article

  • integrating django-paypal

    - by ramdaz
    Hi I am trying to integrate Django-Paypal onto a site, where once the customer makes a payment I need to send a dynamic URL from which the user can download some specific information. I am registering all users to a URL which allows them to buy the document. The URL which can only be accessed by a registered user with a verified email ids using django-registration, allows the user to connect to paypal and make payment. How do I capture the signal and verify which user has made the payment for which product he/she is purchased, based on this information 1) I need to know two information, which user made the payment, and for which product did he or she make the payment? 2) Only if I have these information can I send the right UR:L by email. Any help appreciated. I am not very sure how django-signals work. What all details does payment_was_successful signal return? I am using IPN

    Read the article

  • Creating a QLineEdit search field for items displayed in a QListView

    - by krunk
    I want to create a search field that filters the items shown in a QListView. Basically the user could type in "foo" and only items with "foo" in the DisplayRole are shown. I already have a few ideas on how to do this, but thought I'd ask those more experienced than I. My idea would be to use some signals and slots to set a filter in the QAbstractItem model and trigger an update() in the QListView. Are there any helper methods in QListView for filtering I may have missed? Is there a canonical way of handling this I haven't run across?

    Read the article

  • Accurate Timings with Oscilloscopes on PC

    - by Paul Bullough
    In the world of embedded software (firmware) it is fairly common to observe the order of events, take timings and optimise a program by getting it to waggle PIO lines and capturing their behavior on an oscilloscope. In days gone by it was possible to toggle pins on the serial and parallel ports to achieve much the same thing on PC-based software. This made it possible to capture host PC-based software events and firmware events on the same trace and examine host software/firmware interactions. Now, my new laptop ... no serial or parallel ports! This is increasingly the case. So, does anyone have any suggestions as to go about emitting accurate timing signals off a "modern" PC? It strikes me that we don't have any immediately programmable, lag-free output pins left. The solution needs to run off a laptop, so using add-on cards that only plug into desktops are not permitted.

    Read the article

  • MIDI on Android: Java and/or AIR libraries

    - by yar
    I've been contemplating (re)building an app on iPad for some time, where I would use objective-C and DSMI to send MIDI signals to a host computer. This is not bad (I mean, except for actually writing the app). Now I'm contemplating perhaps developing the app for Android tablets (TBA). In Java, what options are available for MIDI message communication? I'm quite familiar with javax.sound.midi, but then I would need a virtual MIDI port to send messages to the host. On the other hand, if the app were done in Adobe AIR, what options would I have available for communicating with MIDI? Obviously another option is to send/receive messages over a TCP/IP socket to a Java host, and talk that way, but it sounds a tad cumbersome... or perhaps not? DSMI does use a host program, after all.

    Read the article

  • MIDI on Android: Libs and So Forth

    - by yar
    I've been contemplating (re)building an app on iPad for some time, where I would use objective-C and DSMI to send MIDI signals to a host computer. This is not bad (I mean, except for actually writing the app). Now I'm contemplating perhaps developing the app for Android tablets (TBA). In Java, what options are available for MIDI message communication? I'm quite familiar with javax.sound.midi, but then I would need a virtual MIDI port to send messages to the host. On the other hand, if the app were done in Adobe AIR, what options would I have available for communicating with MIDI? Obviously another option is to send/receive messages over a TCP/IP socket to a Java host, and talk that way, but it sounds a tad cumbersome... or perhaps not? DSMI does use a host program, after all.

    Read the article

  • Java: Best practices for turning foreign horror-code into clean API...?

    - by java.is.for.desktop
    Hello, everyone! I have a project (related to graph algorithms). It is written by someone else. The code is horrible: public fields, no getters/setters huge methods, all public some classes have over 20 fields some classes have over 5 constructors (which are also huge) some of those constructors just left many fields null (so I can't make some fields final, because then every second constructor signals errors) methods and classes rely on each other in both directions I have to rewrite this into a clean and understandable API. Problem is: I myself don't understand anything in this code. Please give me hints on analyzing and understanding such code. I was thinking, perhaps, there are tools which perform static code analysis and give me call graphs and things like this.

    Read the article

  • How-to dispose a waithandle correctly

    - by TomTom
    Hello, I'm doing some multi-threading and use AutoResetEvents and ManualResetEvents do control my main - loop. When "destryoing" the threads I also have to dispose these signals, that's clear. But I saw different ways how to dispose Waithandles, and I'm not sure which one is correct: Version 1 if (disposing) { this.threadExitEvent.SafeWaitHandle.Dispose(); this.threadExitEvent.Close(); this.threadExitEvent = null; .... } Version 2 if (disposing) { this.threadExitEvent.Close(); this.threadExitEvent = null; .... } Version 3 if (disposing) { this.threadExitEvent.Close(); .... }

    Read the article

  • Why can't I reclaim my dynamically allocated memory using the "delete" keyword?

    - by synaptik
    I have the following class: class Patient { public: Patient(int x); ~Patient(); private: int* RP; }; Patient::Patient(int x) { RP = new int [x]; } Patient::~Patient() { delete [] RP; } I create an instance of this class on the stack as follows: void f() { Patient p(10); } Now, when f() returns, I get a "double free or corruption" error, which signals to me that something is attempted to be deleted more than once. But I don't understand why that would be so. The space for the array is created on the heap, and just because the function from inside which the space was allocated returns, I wouldn't expect the space to be reclaimed. I thought that if I allocate space on the heap (using the new keyword), then the only way to reclaim that space is to use the delete keyword. Help! :)

    Read the article

  • How to use QMetaMethod with QObject::connect

    - by VestniK
    I have two instances of QObject subclasses and two QMetaMethod instances of signal in one of objects and slot in another object. I want to connect this signal and slot with each other. I've looked through the qobject.h file and find that SIGNAL() and SLOT() macro are just add "1" or "2" character to the beginning of method signature so it looks like it should be possible to add the same character to the beginning of string returned by QMetaMethod::signature() but this approach depends on some undocumented internals of toolkit and may be broken at any time by a new version of Qt. Does anybody know reliable way to connect signals and slots through their QMetaMethod reflection representation?

    Read the article

  • Implementing Qt File Dialog with a Different File System Library (boost)

    - by knight
    Hi, I am writing an application which requires me to use another file system and file engine handlers and not the qt's default ones. Basically what I want to be able to do is to use qt's file dialog but have an underlying file system handler (for example built using boost file system library) of mine handling all the operations with regards to file and directory operations within that dialog. I have already written a custom file engine which handles some of the operations but I am now stuck with Qt's file system model and the file system watcher engine, as I need to have the signals transmitted for this custom file engine. Seems like I have a daunting task ahead. Am I heading in the right direction? Is there any other simpler way that I could implement this? Can anyone give me any idea on how to proceed. I was thinking of looking into proxy models but not sure if that would work. Thanks in advance for any help.

    Read the article

  • Cannot save model due to bad transaction? Django

    - by Kenneth Love
    Trying to save a model in Django admin and I keep getting the error: Transaction managed block ended with pending COMMIT/ROLLBACK I tried restarting both the Django (1.2) and PostgreSQL (8.4) processes but nothing changed. I added "autocommit": True to my database settings but that didn't change anything either. Everything that Google has turned up has either not been answered or the answer involved not having records in the users table, which I definitely have. The model does not have a custom save method and there are no pre/post save signals tied to it. Any ideas or anything else I can provide to make answering this easier?

    Read the article

  • Replacing objects, handling clones, dealing with write logs

    - by Alix
    Hi everyone, I'm dealing with a problem I can't figure out how to solve, and I'd love to hear some suggestions. [NOTE: I realise I'm asking several questions; however, answers need to take into account all of the issues, so I cannot split this into several questions] Here's the deal: I'm implementing a system that underlies user applications and that protect shared objects from concurrent accesses. The application programmer (whose application will run on top of my system) defines such shared objects like this: public class MyAtomicObject { // These are just examples of fields you may want to have in your class. public virtual int x { get; set; } public virtual List<int> list { get; set; } public virtual MyClassA objA { get; set; } public virtual MyClassB objB { get; set; } } As you can see they declare the fields of their class as auto-generated properties (auto-generated means they don't need to implement get and set). This is so that I can go in and extend their class and implement each get and set myself in order to handle possible concurrent accesses, etc. This is all well and good, but now it starts to get ugly: the application threads run transactions, like this: The thread signals it's starting a transaction. This means we now need to monitor its accesses to the fields of the atomic objects. The thread runs its code, possibly accessing fields for reading or writing. If there are accesses for writing, we'll hide them from the other transactions (other threads), and only make them visible in step 3. This is because the transaction may fail and have to roll back (undo) its updates, and in that case we don't want other threads to see its "dirty" data. The thread signals it wants to commit the transaction. If the commit is successful, the updates it made will now become visible to everyone else. Otherwise, the transaction will abort, the updates will remain invisible, and no one will ever know the transaction was there. So basically the concept of transaction is a series of accesses that appear to have happened atomically, that is, all at the same time, in the same instant, which would be the moment of successful commit. (This is as opposed to its updates becoming visible as it makes them) In order to hide the write accesses in step 2, I clone the accessed field (let's say it's the field list) and put it in the transaction's write log. After that, any time the transaction accesses list, it will actually be accessing the clone in its write log, and not the global copy everyone else sees. Like this, any changes it makes will be done to the (invisible) clone, not to the global copy. If in step 3 the commit is successful, the transaction should replace the global copy with the updated list it has in its write log, and then the changes become visible for everyone else at once. It would be something like this: myAtomicObject.list = updatedCloneOfListInTheWriteLog; Problem #1: possible references to the list. Let's say someone puts a reference to the global list in a dictionary. When I do... myAtomicObject.list = updatedCloneOfListInTheWriteLog; ...I'm just replacing the reference in the field list, but not the real object (I'm not overwriting the data), so in the dictionary we'll still have a reference to the old version of the list. A possible solution would be to overwrite the data (in the case of a list, empty the global list and add all the elements of the clone). More generically, I would need to copy the fields of one list to the other. I can do this with reflection, but that's not very pretty. Is there any other way to do it? Problem #2: even if problem #1 is solved, I still have a similar problem with the clone: the application programmer doesn't know I'm giving him a clone and not the global copy. What if he puts the clone in a dictionary? Then at commit there will be some references to the global copy and some to the clone, when in truth they should all point to the same object. I thought about providing a wrapper object that contains both the cloned list and a pointer to the global copy, but the programmer doesn't know about this wrapper, so they're not going to use the pointer at all. The wrapper would be like this: public class Wrapper<T> : T { // This would be the pointer to the global copy. The local data is contained in whatever fields the wrapper inherits from T. private T thisPtr; } I do need this wrapper for comparisons: if I have a dictionary that has an entry with the global copy as key, if I look it up with the clone, like this: dictionary[updatedCloneOfListInTheWriteLog] I need it to return the entry, that is, to think that updatedCloneOfListInTheWriteLog and the global copy are the same thing. For this, I can just override Equals, GetHashCode, operator== and operator!=, no problem. However I still don't know how to solve the case in which the programmer unknowingly inserts a reference to the clone in a dictionary. Problem #3: the wrapper must extend the class of the object it wraps (if it's wrapping MyClassA, it must extend MyClassA) so that it's accepted wherever an object of that class (MyClass) would be accepted. However, that class (MyClassA) may be final. This is pretty horrible :$. Any suggestions? I don't need to use a wrapper, anything you can think of is fine. What I cannot change is the write log (I need to have a write log) and the fact that the programmer doesn't know about the clone. I hope I've made some sense. Feel free to ask for more info if something needs some clearing up. Thanks so much!

    Read the article

  • [Seamless Handover of WiFi] Can we program to automatically join the WiFi with the most strongest si

    - by Dobby
    Hi all, I am making a iphone program, I wish that: it can sense and display the current signals of wifi, with strength, - as I checked, this cannot be done by official SDK, but there were some private library that can handle. 2. i wish it can always automatically join the best wifi with the most highest strength ( assume that all wifi APs have no password, and all are not remembered into the used-list inside iphone), which is something like "seamless handover"... I just guess that, there should be some APIs to let the system join one designated wifi signal from the list, and wish someone could help me. I would like to appreciate a lot : ) Thanks a lot!

    Read the article

  • Need help understanding .net ThreadPool

    - by Meredith
    I am trying to understand what ThreadPool does, I have this .NET example: class Program { static void Main() { int c = 2; // Use AutoResetEvent for thread management AutoResetEvent[] arr = new AutoResetEvent[50]; for (int i = 0; i < arr.Length; ++i) { arr[i] = new AutoResetEvent(false); } // Set the number of minimum threads ThreadPool.SetMinThreads(c, 4); // Enqueue 50 work items that run the code in this delegate function for (int i = 0; i < arr.Length; i++) { ThreadPool.QueueUserWorkItem(delegate(object o) { Thread.Sleep(100); arr[(int)o].Set(); // Signals completion }, i); } // Wait for all tasks to complete WaitHandle.WaitAll(arr); } } Does this run 50 "tasks", in groups of 2 (int c) until they all finish? Or I am not understanding what it really does.

    Read the article

  • Mean of Sampleset and powered Sampleset

    - by Milla Well
    I am working on an ICA implementation wich is based on the assumption, that all source signals are independent. So I checked on the basic concepts of Dependence vs. Correlation and tried to show this example on sample data from numpy import * from numpy.random import * k = 1000 s = 10000 mn = 0 mnPow = 0 for i in arange(1,k): a = randn(s) a = a-mean(a) mn = mn + mean(a) mnPow = mnPow + mean(a**3) print "Mean X: ", mn/k print "Mean X^3: ", mnPow/k But I couldn't produce the last step of this example E(X^3) = 0: >> Mean X: -1.11174580826e-18 >> Mean X^3: -0.00125229267144 First value I would consider to be zero, but second value is too large, isn't it? Since I subtract the mean of a, I expected the mean of a^3 to be zero as well. Does the problem lie in the random number generator, the precision of the numerical values in my misunderstanding of the concepts of mean and expected value?

    Read the article

  • Good code visualization / refactoring tools for C++?

    - by Paul D.
    I've found myself coming across a lot of reasonably large, complicated codebases at work recently which I've been asked to either review or refactor or both. This can be extremely time consuming when the code is highly concurrent, makes heavy use of templates (particularly static polymorphism) and has logic that depends on callbacks/signals/condition variables/etc. Are there any good visualization tools for C++ period, and of those are there any that actually play well with "advanced" C++ features? Anything would probably be better than my approach now, which is basically pen+paper or stepping through the debugger. The debugger method can be good for following a particular code path, but isn't great for seeing the big picture you really need when doing serious refactoring. EDIT: I should mention that Visual Studio plugins aren't going to be a lot of help to me, since our stuff is mostly Linux-only.

    Read the article

  • check whether fgets would block

    - by lv
    Hi, I was just wondering whether in C is it possible to peek in the input buffer or perform similar trickery to know whether a call to fgets would block at a later time. Java allows to do something like that by calling BufferedReader.ready(), this way I can implement console input something like this: while (on && in.ready()) { line = in.readLine(); /* do something with line */ if (!in.ready()) Thread.sleep(100); } this allows an external thread to gracefully shutdown the input loop by setting on to false; I'd like to perform a similar implementation in C without resorting to non portable tricks, I already know I can make a "timed out fgets" under unix by resorting to signals or (better, even though requering to take care of buffering) reimplement it on top of recv/select, but I'd prefer something that would work on windows too. TIA

    Read the article

  • How to make flyspell bypass some words by context?

    - by manu
    Hi, I use Emacs for writing most of my writings. I write using reStructuredText, and then transform them to LaTeX after some preprocessing since I write my citations á-la LaTeX. This is an excerpt of one of my texts (in Spanish): En \cite[pp.~XXVIII--XXIX]{Crnkovic2002} se brindan algunos riesgos que se pueden asumir con el desarrollo basado en componentes, los This text is processed by some custom scripts that deals with the \cite part so rst2latex can do its job. When I activate flyspell-mode it signals most of the citation keys as spelling errors. How can I tell flyspell not to spellcheck things within \cite commands. Furthermore, how can I combine rst-mode and flyspell, so that rst-mode would keep flyspell from spellchecking the following? reST comments reST code literal reST directive parameters and arguments reST raw directive contents Any ideas?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >