Search Results

Search found 2053 results on 83 pages for 'signal'.

Page 52/83 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Algorithm to calculate a page importance based on its views / comments

    - by stacker
    I need an algorithm that allows me to determine an appropriate <priority> field for my website's sitemap based on the page's views and comments count. For those of you unfamiliar with sitemaps, the priority field is used to signal the importance of a page relative to the others on the same website. It must be a decimal number between 0 and 1. The algorithm will accept two parameters, viewCount and commentCount, and will return the priority value. For example: GetPriority(100000, 100000); // Damn, a lot of views/comments! The returned value will be very close to 1, for example 0.995 GetPriority(3, 2); // Ok not many users are interested in this page, so for example it will return 0.082

    Read the article

  • How to troubleshoot deallocation of object in uitableview?

    - by 4thSpace
    I have a table view with tall cells. About 300 in height. The cells are custom and have an associated nib. In cellForRowAtIndexPath, I access an object in an array using indexPath.row. The object has properties, which I assign to labels on the custom cell. This works fine for the first two cells. Once I scroll enough for the third cell to get created, the app crashes. I have NSZombieEnabled set and here is the output: 2010-04-19 21:48:13.360 MyApp[54463:207] *** -[CALayer release]: message sent to deallocated instance 0xfc4e50 (gdb) continue 2010-04-19 21:48:18.382 MyApp[54463:207] *** NSInvocation: warning: object 0xfc4e50 of class '_NSZombie_CALayer' does not implement methodSignatureForSelector: -- trouble ahead 2010-04-19 21:48:18.383 MyApp[54463:207] *** NSInvocation: warning: object 0xfc4e50 of class '_NSZombie_CALayer' does not implement doesNotRecognizeSelector: -- abort (gdb) continue Program received signal: “EXC_BAD_ACCESS”. (gdb) I'm not sure what is deallocated. How can I trace this to the source?

    Read the article

  • What does msvc 6 throw when an integer divide by zero occurs?

    - by EvilTeach
    I have been doing a bit of experimenting, and have discovered that an exception is being thrown, when an integer divide by zero occurs. #include <iostream> #include <stdexcept> using namespace std; int main ( void ) { try { int x = 3; int y = 0; int z = x / y; cout << "Didn't throw or signal" << endl; } catch (std::exception &e) { cout << "Caught exception " << e.what() << endl; } return 0; } Clearly it is not throwing a std::exception. What else might it be throwing?

    Read the article

  • Qtestlib: QNetworkRequest not executed

    - by dzen
    I would like to test an asynchronous request to a webserver. For that purpose I'm creating a simple unittest to quickly try a few lines of code: void AsynchronousCall::testGet() { QNetworkAccessManager *nam = new QNetworkAccessManager(this); QUrl url("http://myownhttpserver.org"); QNetworkRequest req(url); this->connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(reqFinished(QNetworkReply *))); QNetworkReply *rep = nam->get(req); } void AsynchronousCall::reqFinished(QNetworkReply *rep) { qDebug() << rep->readAll(); qDebug() << "finshed"; } The problem is that reqFinished() is never reached. If I had a simple QEventLoop and and a loop.exec() just after the nam-get(req); the request is executed. Any hint ? Do I have to use a loop.exec() in my every unittests ?

    Read the article

  • capture any error in VBScript?

    - by JoelFan
    I have a batch file that calls a VBScript (.vbs) program. After calling it, my batch script checks errorlevel to see if the .vbs program failed. I can signal failure with an exit code in the .vbs program with WScript.Quit(1). However, I can only do that explicitly. If some unexpected run-time error happens, the .vbs quits with an error dialog box, however the exit code is zero so my batch file thinks it suceeded! How can I change that behavior? And if you are thinking of saying, use on error goto, don't bother... that syntax is available in regular VB, but not in VBScript.

    Read the article

  • Get Taskbar's Battery and PhoneSignal indicators icons and draw into a picturebox (C#/WindowsMobile)

    - by Christian Almeida
    Hi, Is there any way to get taskbar's battery and phonesignal indicators icons and then draw into a picturebox or something? Why do I need this? I need all screen space available, so all forms are maximized and they cover up the windowsmobile taskbar. But, I have to display information about battery e phone signal strength in just a couple of forms. I know how to get their values (like systeminformation.phonesignalstrength), but what I want is the "current icon", so I don't need to worry about their values. It's just a visual information for the user. In last case, if this is not possible, how to get those icons from windowsmobile shell, so I'll draw them by my self, treating each differente status/values that they assume. (This is what I don't want to do!) Thanks in advance and sorry for my poor english.

    Read the article

  • QNetworkAccessManager and QHttp doesn't sends anything

    - by serge
    Hi everyone, i wrote some app and trying with a help of QNetworkAccessManager send some data to server using POST request, however nothing happen at all. I tried to use QHttp and the same result. I have checked it with WireShark - none requests in the list from my program. I tried to send GET request and the same - none requests. I created project with Network libs, got example from help: manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requesReply(QNetworkReply*))); QNetworkRequest req; req.setUrl(QUrl("http://server.net/upload")); manager->get(req); Please help me to find what i'm missing. Thanks in advance

    Read the article

  • How to deal with OpenMP thread pool contention

    - by dpe82
    I'm working on an application that uses both coarse and fine grained multi-threading. That is, we manage scheduling of large work units on a pool of threads manually, and then within those work units certain functions utilize OpenMP for finer grain multithreading. We have realized gains by selectively using OpenMP in our costliest loops, but are concerned about creating contention for the OpenMP worker pool as we add OpenMP blocks to cheaper loops. Is there a way to signal to OpenMP that a block of code should use the pool if it is available, and if not it should process the loop serially?

    Read the article

  • Python/X11: find out if user switches virtual desktops

    - by Philip
    Hello everyone, I'm looking for a way to determine if the user switches virtual desktops under X11. I'm using Python with X11 libraries and PyGTK. I found some working examples in C, but I lack the expertise to translate them into Python, and I read the source code of several X11 pager applications (fbpanel, pypanel), but I can't seem to find what I'm looking for. Do I have to register for a signal? Using X11 or GTK? Do I have to busy-wait? I'm completely new to both X11 and GTK, so any hints/help would be greatly appreciated. Greets, Philip PS: My current efforts can be found here.

    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

  • Right clicking on QHeaderView inside of QTreeView

    - by taynaron
    I've written a descendant of QTreeView with multiple columns. I want to create a popup menu that appears whe nthe user right-clicks over the column headers. I have tried catching signals from QTreeView for this, but QTreeView doesn't seem to emit signals on the headers. QTreeView.header() does. I therefore believe I must either: 1: connect one of QHeaderView's signals to a popup function - I have been unable to find a signal that is triggered on a single right click - I have tried sectionClicked, sectionHandleDoubleClicked, sectionDoubleClicked, sectionPressed (not surprised the double click functions didn't catch a single right click - but they do catch a double right click) self.header().sectionClicked.connect(self.headerMenu) self.header().sectionHandleDoubleClicked.connect(self.headerMenu) self.header().sectionDoubleClicked.connect(self.headerMenu) self.header().sectionPressed.connect(self.headerMenu) or, 2: write a descendant of QHeaderView with my own MousePressEvent function, and use that for my headers. I have so far been unsuccessful in connecting the new header class to the QTreeView descendant. I keep getting a Segmentation Fault on runtime, with no more explanation. #in DiceView's init, where DiceHeaders is the QHeaderView descendant self.setHeader(DiceHeaders()) Any ideas?

    Read the article

  • OSX: Why is GetProcessInformation() causing a segfault?

    - by anthony
    Here's my C method to get the pid of the Finder process. GetProcessInformation() is causing a segfault. Why? Here's the function: static OSStatus GetFinderPID(pid_t *pid) { ProcessSerialNumber psn = {kNoProcess, kNoProcess}; ProcessInfoRec info; OSStatus status = noErr; info.processInfoLength = sizeof(ProcessInfoRec); info.processName = nil; while (!status) { status = GetNextProcess(&psn); if (!status) { status = GetProcessInformation(&psn, &info); } if (!status && info.processType == 'FNDR' && info.processSignature == 'MACS') { return GetProcessPID(&psn, pid); } } return status; } Here's the backtrace: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000032aaaba7 0x00007fffffe00623 in __bzero () (gdb) bt #0 0x00007fffffe00623 in __bzero () #1 0x00007fff833adaed in CreateFSRef () #2 0x00007fff833ab53b in FSPathMakeRefInternal () #3 0x00007fff852fc32d in _CFGetFSRefFromURL () #4 0x00007fff852fbfe0 in CFURLGetFSRef () #5 0x00007fff85dd273f in GetProcessInformation () #6 0x0000000100000bef in GetFinderPID [inlined] () at /path/to/main.c:21

    Read the article

  • Signals and threads - good or bad design decision?

    - by Jens
    I have to write a program that performs highly computationally intensive calculations. The program might run for several days. The calculation can be separated easily in different threads without the need of shared data. I want a GUI or a web service that informs me of the current status. My current design uses BOOST::signals2 and BOOST::thread. It compiles and so far works as expected. If a thread finished one iteration and new data is available it calls a signal which is connected to a slot in the GUI class. My question(s): Is this combination of signals and threads a wise idea? I another forum somebody advised someone else not to "go down this road". Are there potential deadly pitfalls nearby that I failed to see? Is my expectation realistic that it will be "easy" to use my GUI class to provide a web interface or a QT, a VTK or a whatever window? Is there a more clever alternative (like other boost libs) that I overlooked? following code compiles with g++ -Wall -o main -lboost_thread-mt <filename>.cpp code follows: #include <boost/signals2.hpp> #include <boost/thread.hpp> #include <boost/bind.hpp> #include <iostream> #include <iterator> #include <string> using std::cout; using std::cerr; using std::string; /** * Called when a CalcThread finished a new bunch of data. */ boost::signals2::signal<void(string)> signal_new_data; /** * The whole data will be stored here. */ class DataCollector { typedef boost::mutex::scoped_lock scoped_lock; boost::mutex mutex; public: /** * Called by CalcThreads call the to store their data. */ void push(const string &s, const string &caller_name) { scoped_lock lock(mutex); _data.push_back(s); signal_new_data(caller_name); } /** * Output everything collected so far to std::out. */ void out() { typedef std::vector<string>::const_iterator iter; for (iter i = _data.begin(); i != _data.end(); ++i) cout << " " << *i << "\n"; } private: std::vector<string> _data; }; /** * Several of those can calculate stuff. * No data sharing needed. */ struct CalcThread { CalcThread(string name, DataCollector &datcol) : _name(name), _datcol(datcol) { } /** * Expensive algorithms will be implemented here. * @param num_results how many data sets are to be calculated by this thread. */ void operator()(int num_results) { for (int i = 1; i <= num_results; ++i) { std::stringstream s; s << "["; if (i == num_results) s << "LAST "; s << "DATA " << i << " from thread " << _name << "]"; _datcol.push(s.str(), _name); } } private: string _name; DataCollector &_datcol; }; /** * Maybe some VTK or QT or both will be used someday. */ class GuiClass { public: GuiClass(DataCollector &datcol) : _datcol(datcol) { } /** * If the GUI wants to present or at least count the data collected so far. * @param caller_name is the name of the thread whose data is new. */ void slot_data_changed(string caller_name) const { cout << "GuiClass knows: new data from " << caller_name << std::endl; } private: DataCollector & _datcol; }; int main() { DataCollector datcol; GuiClass mc(datcol); signal_new_data.connect(boost::bind(&GuiClass::slot_data_changed, &mc, _1)); CalcThread r1("A", datcol), r2("B", datcol), r3("C", datcol), r4("D", datcol), r5("E", datcol); boost::thread t1(r1, 3); boost::thread t2(r2, 1); boost::thread t3(r3, 2); boost::thread t4(r4, 2); boost::thread t5(r5, 3); t1.join(); t2.join(); t3.join(); t4.join(); t5.join(); datcol.out(); cout << "\nDone" << std::endl; return 0; }

    Read the article

  • Textarea to paragraphs

    - by zaf
    When I have to render textarea content to the front end I usually pass it thru a function that converts newlines to <br/> tags and double newlines signal paragraph tags so blocks of text get surrounded by <p> and </p> tags. To save time I usually use a ready made PHP function from the wordpress codebase. You can get the link from the man himself: http://ma.tt/scripts/autop/ If you check it out you'll see it does some heavy lifting with about 20 regular expressions. I know I could use a wysiwyg editor (like TinyMCE or CKEditor) that can format the data on the client and then send it to the server (most of them add <p>..</p> tags by default) but I want to know the experience of others in handling raw textarea input and then displaying it on the front end.

    Read the article

  • Help on QStackedWidget

    - by Surjya Narayana Padhi
    Hi Geeks, I am using a QStackedWidget on my mainWindow. The firstPageWidget on stackedWidget contains 3 buttons. Now If I will press the first button on firstPage, I want the stackedWidget show the 2nd Page widget. Following are the details I tried to connect like this in my mainwindow connect(firstPageWidget->button1,SIGNAL(clicked()),stackWidget,SLOT(setCurrentIndex(int))); Now I want to know how to pass the value of index number to stackWidget to set currentIndex? If my question is not much clear please tell me I will explain more.

    Read the article

  • in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped) gprof

    - by Mayank
    I am trying to profile my application. For this I compiled my code with -pg and -lc_p option, it compiled successfully During run time I am getting the following error. in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped) Doing GDB gives error as. (gdb) b main Breakpoint 1 at 0x5124d4: (gdb) r warning: Unable to get location for thread creation breakpoint: generic error [New LWP 100085] cacheIp in free(): error: junk pointer, too high to make sense Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 100085] 0x00000000006c3a1f in pthread_sigmask () My application is multi threaded and is a combination of C and C++ code. uname -a FreeBSD 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008 [email protected]:/usr/obj/usr/src/sys/SMP amd64 Why is the code crashing. Am I missing something.

    Read the article

  • Qt4: QMenuBar/QMenu doesn't show up on Mac OS X

    - by Erick
    Hello, I'm having difficulties to make a QMenuBar display a QMenu with a QAction under Mac OS X (Snow Leopard). Here is the code I'm using for creating the menu: void ClientWindow::setUpMenu () { QMenu * file = menuBar()->addMenu("&File"); QAction * quit = new QAction("&Quit", this); file->addAction(quit); connect(quit, SIGNAL(triggered()), this, SLOT(quit())); } Here is the ClientWindow class interface: class ClientWindow : public QMainWindow { public: ClientWindow (QWidget * parent = 0); void setUpMenu (); }; And here is my main() method: int main (int argc, char * argv[]) { QApplication app(argc, argv); ClientWindow window; window.setUpMenu(); window.show(); return app.exec(); } Any ideas why it wouldn't show up on the menu bar? Thank you all.

    Read the article

  • PyQt4, QThread and opening big files without freezing the GUI

    - by jmrbcu
    Hi, I would like to ask how to read a big file from disk and maintain the PyQt4 UI responsive (not blocked). I had moved the load of the file to a QThread subclass but my GUI thread get freezed. Any suggestions? I think it must be something with the GIL but I don't know how to sort it? EDIT: I am using vtkGDCMImageReader from the GDCM project to read a multiframe DICOM image and display it with vtk and pyqt4. I do this load in a different thread (QThread) but my app freeze until the image is loaded. here is an example code: class ReadThread(QThread): def __init__(self, file_name): super(ReadThread, self).__init__(self) self.file_name = file_name self.reader.vtkgdcm.vtkGDCMImageReader() def run(self): self.reader.SetFileName(self.file_name) self.reader.Update() self.emit(QtCore.SIGNAL('image_loaded'), self.reader.GetOutput())

    Read the article

  • error: ‘struct mcontext_t’ has no member named ‘eip’

    - by user353573
    original is struct sigcontext *sc; after changing to struct mcontext_t, error occur. How to fix it? error: ‘struct mcontext_t’ has no member named ‘eip’ #include <stdio.h> #include <signal.h> #include <asm/ucontext.h> static unsigned long target; void handler(int signum, siginfo_t *siginfo, void *uc0){ struct ucontext *uc; mcontext_t *sc; uc = (struct ucontext *)uc0; sc = &uc->uc_mcontext; sc->eip = target; }

    Read the article

  • emacs23 pops up debugger way too frequently

    - by werner r.
    Since I've upgraded to Ubuntu lucid and emacs23, Emacs pops up the debugger in situations, where emacs22 does not. For example, when hitting C-c C-c in org-mode, emacs22 simply states can do nothing useful at this location, whereas in emacs23 the debugger shows up. Debugger entered--Lisp error: (error "C-c C-c can do nothing useful at this location") signal(error ("C-c C-c can do nothing useful at this location")) error("C-c C-c can do nothing useful at this location") org-ctrl-c-ctrl-c(nil) call-interactively(org-ctrl-c-ctrl-c nil nil) That only illustrates the pattern -- the behavior is not limited to org-mode. Occurring every 3 minutes, it really annoys me. How can I prevent it? I've already tried to stop this using debug-on-error and stack-trace-on-error: it didn't work.

    Read the article

  • How to design this class hierarchy?

    - by devoured elysium
    I have defined an Event class: Event and all the following classes inherit from Event: AEvent BEvent CEvent DEvent Now, with the info I gather from all these Event classes, I will make a chart. With AEvent and BEvent, I will generate points for that chart, while with CEvent and DEvent I will paint certain regions of the chart. Now, how should I signal this in my class hierarchy? Should I make AEvent and BEvent inherit from PointEvent while CEvent and DEvent inherit from RegionEvent, being that both RegionEvent and PointEvent inherit from Event? Should I add a field with an Enum to Event with 2 values, Point and Region, and each of the child classes set their value to it? Should I use some kind of pattern here? Which one? Thanks.

    Read the article

  • How do I memoize expensive calculations on Django model objects?

    - by David Eyk
    I have several TextField columns on my UserProfile object which contain JSON objects. I've also defined a setter/getter property for each column which encapsulates the logic for serializing and deserializing the JSON into python datastructures. The nature of this data ensures that it will be accessed many times by view and template logic within a single Request. To save on deserialization costs, I would like to memoize the python datastructures on read, invalidating on direct write to the property or save signal from the model object. Where/How do I store the memo? I'm nervous about using instance variables, as I don't understand the magic behind how any particular UserProfile is instantiated by a query. Is __init__ safe to use, or do I need to check the existence of the memo attribute via hasattr() at each read? Here's an example of my current implementation: class UserProfile(Model): text_json = models.TextField(default=text_defaults) @property def text(self): if not hasattr(self, "text_memo"): self.text_memo = None self.text_memo = self.text_memo or simplejson.loads(self.text_json) return self.text_memo @text.setter def text(self, value=None): self.text_memo = None self.text_json = simplejson.dumps(value)

    Read the article

  • using performSelector

    - by zebra
    Hi all, i've my method that implement a reverseGeocoder - (void)reversing { geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:locManager.location.coordinate]; geoCoder.delegate=self; [geoCoder start]; } i recall reversing in another method with this: [self performSelector:@selector(reversing) withObject:nil afterDelay:10]; and i receive 2010-04-30 17:44:17.616 high[1167:207] Retrive City Milano 2010-04-30 17:44:17.628 high[1167:207] geocoder released 2010-04-30 17:44:18.723 high[1167:207] Error Domain=MKErrorDomain Code=4 "Operation could not be completed. (MKErrorDomain error 4.)" Program received signal: “EXC_BAD_ACCESS”. Can someone help me? :D

    Read the article

  • svn commit is hung at start of commit

    - by jwhitlock
    I'm commiting a large changeset, including a large binary file (180 MB) over a slow VPN connection. It looks for all the world like it is stalled. How can I diagnose where it is stuck? The output is: $ svn commit -m "My commit message" Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)` Local subversion is 1.6.9 on Linux, KDE 4.3, and svn status shows ML . L ws M ws/manage.py L ws/locales L ws/locales/ja_JP L ws/locales/ja_JP/LC_MESSAGES The process isn't using much of any resources. The server is Linux, served by Apache and mod_dav_svn, same subversion 1.6.9. I can't see any process that is handling the commit.

    Read the article

  • Django: How to create a model dynamically just for testing

    - by muhuk
    I have a Django app that requires a settings attribute in the form of: RELATED_MODELS = ('appname1.modelname1.attribute1', 'appname1.modelname2.attribute2', 'appname2.modelname3.attribute3', ...) Then hooks their post_save signal to update some other fixed model depending on the attributeN defined. I would like to test this behaviour and tests should work even if this app is the only one in the project (except for its own dependencies, no other wrapper app need to be installed). How can I create and attach/register/activate mock models just for the test database? (or is it possible at all?) Solutions that allow me to use test fixtures would be great.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >