All:
I wonder if anyone could give me some clue that how to track the bug in D3.
For example, I draw a linechart, and I got some error from D3:
Error: Invalid value for <line> attribute y2="NaN" d3.js:7571
And this error is most possibly caused by some illegal(no value or NaN or etc) data binding in my code, but how can I trace back to locate where this error happen in my code rather in D3?
Thanks
I find that using the console in the Google Chrome browser is useful.
This can be enabled by pressing F12 when on the offending page and a separate window will open at the bottom.
The console tab on this window will present with information on errors found in the page.
As an example I inserted a 'random' semicolon in my d3.js code here;
(this is in the 'Geany' editor)
And in the console tab the error is identified as follows;
This shows you a description of the error and an indication of the area. In this case the console errored on the following line because it regards the semi-colon as valid, but that makes the following code invalid, but you get the idea.
In Firefox there is a plug-in called firebug I believe that will allow the same thing.
From my experience, there's isn't a really good way to debug this kind of error, but there's a workaround.
The error is thrown when an attribute value is set to NaN. Actually, that by itself would be easy to debug, because you could expand the error in the console and look through the stack trace to find in which file and on which line within call the stack the NaN value is set.
But that becomes impossible when you also have a transition. That's because the attr() call that's ultimately responsible for setting a NaN value runs asynchronously (i.e. via setTimeout at a later time). So you no longer get a stack trace that lets you see where in your code the NaN came from.
So, as a workaround, you can temporarily comment out all the transitions in your code, reload the page and you'll get an error that'll point you towards the line with the bug.
If you don't want to do that, then the only other option you have is to look at your code. You can narrow things down to the places in the code where you set attributes on a <line> node (since the error is about a <line>). Then you can insert a debugger statement in that general area and step through your code to find what causes your it to output NaN.
Related
We are using the TaskDialogIndirect function to report all type of messages in our application. The problem I see with TaskDialog is that it automatically truncates unbreakable text with ellipsis on both sides and there seems to be no way to avoid this behavior. So for example I am unable to display a file error with the full path of the file because the path gets truncated. I even tried the TDF_SIZE_TO_CONTENT flag which should auto resize the dialog based on the content but it only works for slightly longer paths and truncates again.
Anyone got any ideas on this? Any workarounds?
I have been using Xcode recently a lot, however, every so often I'll inexplicably receive error messages about perfectly innocuous components of my code. I'd like to know how one diagnose these because as you can see in the buttom right of the screenshot, there's no log entry to go off of. Thanks.
Here's my screen shot:
It looks as if you have accidentally set a "breakpoint" in your code. You set a breakpoint by clicking on the left margin. A breakpoint stops your code automatically when it reaches that point.
Since you commented out the inside of the goBack() function, it stops at the first line of uncommented code.
The breakpoint you set is the little blue line to the left of the line self.scoreLabel.removeFromSuperview(). To get rid of it, click it and drag it into the main area of your code.
I have a method which loads some data and this can take a while, the problem is that you can still click on things and this might crash the program. So I am looking for a specific implementation of a loading-circle when you click on a button and the method starts.
What I would recommend is setting the cursor to "Cursor.Wait" on the objects that are still loading
Here is the code for that:
node.setCursor(Cursor.WAIT);
If it still gives you trouble you can try temporarily disabling the nodes.
Here is the code for that:
node.setDisable(true);
i get this kind of error in cappuccino
TypeError: Result of expression '_2b' [undefined] is not an object.
TypeError: Result of expression '_40' [undefined] is not an object.
I can't think of what they could be for as they don't specify a line number.
any ideas?
Like you mentioned, you should load your application using index-debug.html while testing. Furthermore you can use Safari's developer tools to break on errors by clicking on the stop sign shaped "pause" button at the bottom of the Javascript debugger. This is helpful if the error message shows up inside of an Objective-J main file and you need to look at the full stack trace to figure it out.
i didn't realise the index-debug.html which will give me better errors.
A simple 10.6 Cocoa app I wrote that basically draws a regular window with some buttons and text has been spewing hundreds of console log messages:
<Error>: CGContextSetCompositeOperation: invalid context 0x0
I do not directly call drawRect: and always use setNeedsDisplay:YES when I need to refresh.
Interestingly, this error does not happen on all machines, I'd say about 50% get the error. However, the program works fine in either case!
Anyone got any clue as to what this error means, where it's stemming from, and more importantly, how can I suppress/get rid of it?
Thanks
Try setting a breakpoint on CGPostError. If you can break on the logging, you can hopefully figure out what's going on.
You shouldn't be looking to just suppress it. It means context creation is failing (thus NULL gets passed for some context parameter), and that's not good.