Pydev Nodebox: "AttributeError: 'NoneType' object has no attribute 'WIDTH'" - pydev

I am trying to create a graph of the connections between the users in my database using nodebox(ubuntu 12.04, python 2.7, django 1.3), but when I enter the following instructions, I get the error message underneath it:
"""
g.draw(weighted=False, directed=False, highlight=[], traffic=None)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2721, in run_code
exec code_obj in self.user_global_ns, self.user_ns
File "<ipython-input-1-0a219395b690>", line 1, in <module>
g.draw(weighted=False, directed=False, highlight=[], traffic=None)
File "/home/raymond/Documents/exchange/cet/cet/graph/__init__.py", line 453, in draw
self.update()
File "/path/to/myproject//graph/__init__.py", line 416, in update
self.x = _ctx.WIDTH - max.x*self.d - min_.x*self.d
AttributeError: 'NoneType' object has no attribute 'WIDTH'
"""
How can I get nodebox to draw my graph? should I add a try/catch or if statement to graph/init.py in order to prevent object of type none from being written to? I know displaying more code would help solve the problem faster; I am running into formatting problem, but I will add code to the question as soon as I can.

Nodebox has a graph web page which is concise, informative and seemed what I need. As the file to download is on the same page it seemed ideal, BUT it fails to mention it is Nodebox 1 which is for Mac ...only!
Then a further rummage finds NodeBox OpenGL which has a new methodology and is cross platform, BUT it only lists compatibility with python 2.5-2.6 (so with 2.7 should be worth a try?) BUT installing the graphics util Pyglet failed the first time ....so more investigation required.
Sadly Nodebox 3 seems all different and haven't yet seen a comparable graph command
Looking back on the outcome
After achieving an install, I prototyped network viewer with a mouse selectable attribute viewer, low frame rate and a constant data set. A flavour of the interactiveness is demonstrated in this site
http://www.visualthesaurus.com/app/view?word=link
(try a click and drag on the central word)
But problems I needed to solve were how to
show a live data set consistently ie dealing with orphans,
transitions as branches you may be viewing may disappear from the
data
partitioning the viewing of large amounts of data ie view 2 to 20 nodes from several hundred items
displaying data without overlapping/obscuring or going off the display area
displaying differences when not on the current level
portability
...
In my case a periodically updated, structured html table with colours and zoom levels was the best solution

Related

Error handling in Sublime Text Plugin API

I'm creating my first sublime plugin to be used internally and was wondering if there's a way to stop the plugin from executing and display an error message on screen like an alert?
I took a look at view#show_popup() but this didn't render for me. Below is how I attempted to show it:
if "WebContent" in subdirectories:
directory = ROOT_DIR + "/WebContent"
elif "Content" in subdirectories:
directory = ROOT_DIR + "/Content"
else:
self.view.show_popup('Directory not found', location=-1)
Working Principle:
The plugin takes some data from one view and then pastes them in another view. The plugin has two TextCommands. One command takes the data from the first view, opens a new view and then executes the 2nd command on the new view. The above snippet is in the 2nd command.
I was unable to find any resources to help with show_popup() or any other error handling.
Does any one have possible ideas?
view.show_popup() is for showing things like hover popups next to the cursor; it's used for things like the built in functionality for going to references/definitions for functions:
While you could in theory use this for error messages, it may not be the sort of user experience that anyone would expect.
Your code above is technically valid, but since the content is expected to be minihtml it may be hard to see because as just a single string all you're going to see is just the text (i.e. you have no font style, padding, etc):
Perhaps more importantly, when location is -1, the popup appears at the point in the buffer closest to the first cursor position, so depending on your circumstance it may be appearing in a place you don't expect, and then vanishing away before you can scroll to see it, etc.
What you want here is sublime.error_message(); given a string, it will display that string in a dialog for the user to interact with, and it also logs the error into the Sublime console as well so that there's an additional trace.

How do I get the event tags for a Coverity issue?

If I am looking at an issue in the Coverity user interface, how do I get the event tag or tags? I need to know a tag in order to suppress the finding using code annotations, as described in the question "How can I disable coverity checking using code annotation?" but I'm not seeing it or maybe don't know where to look.
The event tag is the first identifier-like word in each line of commentary that makes up the issue report.
For example, on Github, RcppCore/Rcpp issue 760 contains a screenshot that I have reproduced at half-size resolution with some annotations:
Zooming in on the code panel:
There are three events here:
alloc_fn: Storage is returned from allocation function operator new.
noescape: Resource new Rcpp::Rostream<true>::Buffer is not freed or pointed-to in basic_ostream. ...
leaked_storage: Failing to save or free storage allocated by new Rcpp::Rostream<true>::Buffer leaks it.
The event tags are "alloc_fn", "noescape", and "leaked_storage".
In this instance, all of them are associated with the same line of code (line 49), but in general they may appear on different lines and spread across multiple files.
To navigate to all of the events, use the Occurrences panel:
The Occurrences panel shows all of the events, organized into a tree, where child nodes are events in callee functions. The entire list is generally ordered in program execution order, although some events may be chronologically disconnected, for example if the finding involves multiple execution paths.
Each entry in the Occurrences panel has an event number (again, nominally chronological), the event tag, and the file name and line number. Clicking on an entry navigates to that event in the code panel.
Here are a couple related Synopsys support articles:
how to add code annotation? I do not know which name should exist with //coverity[]
Is there a document that lists all defect 'events' with their name and descriptions?

MONAILABEL Slicer plugin | pelvis segmentation in MRI

I want to segment pelvic in MRI from the SMIR dataset using the MONAILABEL plugin. I have read relatively a lot about this plugin. However, I can’t perform the segmentation well enough yet.
These are the steps I take to do so:
connecting the server using the anaconda prompt
enabling the plugin in Slicer and loading one image
labeling the pelvis manually using the paint button in the scribbles part and the updating
click “submit label”
and then repeating the process for some other images while the network is being trained.
After the training process, I actually could not see anything when opening the mask files.
I also encounter these two errors:
" AssertionError: Not a valid Label "
" TypeError: object of type ‘NoneType’ has no len() "
Is it the correct way of using MONAI or am I missing something?
Which aspects should I take into account before starting the process?
I would appreciate your help and suggestions.
Thank you

TTeeGrid is not displaying the data at runtime using data from REST

I created a simple RME for TTeeGrid, a descendant perhaps of TGrid in Firemonkey. As shown below, the data are displayed at design time but not at runtime except the headers.
I've been breaking my head over this for weeks already but not luck.
Let me know if you need more details but what you see in the image are all you get.
I just need help to have the data displayed at runtime as shown in the design time.
UPDATE 1
This issue is not the case with TPrototypeBindSource. The data shown in the design time are displayed at runtime. Something is wrong somewhere.
I've never used the TeeGrid before, but the following worked fine
first time for me in Delphi Tokyo:
Download the TeeGrid trial from Steema.Com & install.
Create new multi-device app and place a TeeGrid and a FDMemTable on the form.
Load FDMemTable1 with the file Parts.Fds from the Delphi samples Data directory. Note, I did not then create any FieldDefs as I mentioned in my comment earlier as what I'm describing works without them.
Set the DataSource property of TeeGrid1 to FDMemTable1. TeeGrid1 immediately
creates columns for each of the Parts fields and populates them with data - see
screenshot below. I don't ordinarily include screenshots but in this case thought
I would as what I got was so clearly at odds with what you've reported.
Your TeeGrid etc are obviously more complicated than mine. so the best I can
suggest is that you backtrack to step 2 and see if you can replicate my result
with your data (either at design time or run time). It might be worth loading
your FDMemTable with some data at design time, as my impression is that live bindings
is less grief-prone when the datasource has some data.
Incidentally, fwiw the results of my own attempts to set up live bindings even with a regular TGrid have been rather patchy, until I discovered that instead of messing with the LB components myself, simply starting with a fresh TGrid, right-clicking on it and leaving the Live Bindings Wizard
to do its stuff consistently works fine.

How can I create in Gehpi directed tree graph instead of sphererical

I want to make a network graph which shows the distribution of our documents in our folder structure.
I have the nodefile, edgefile and gephi graph file in this location:
https://1drv.ms/f/s!AuVfRBdVHkO7hgs5K9r9f7jBBAUH
What I do is:
Run the algorithm ForceAtlas2 with scaling 10-20, dissuade hub marked and prevent overlap marked, all other standard setting.
What I get is a graph with groups radial/spherical distributed. However, what I want is a tree directed network graph.
Anyone know how I can adjust Gephi to make this?
Thanks!
I just found a solution.
I tested the file format as shown on the Yed site "import excel file" page
http://yed.yworks.com/support/manual/import_excel.html
This gave me the Yed import dialog (took a life time to figure out that it's a pop up menu and not selectable through the standard menu)
Anyway, it worked and I've adjusted the test files with the data prepared for the Gehpi. This was pretty easy, I could used the source target ID's etc. Just copy paste.
I load it into Yed and used some directed and radial clustering algorithms on it. Works fine!
Below you can find the excel node/edge file used to import in Yed and the graph file you can open with Yed to see the final radial result.
https://1drv.ms/f/s!AuVfRBdVHkO7hg6DExK_eVkm5_mR
Only thing to figure out is how to combine the weight (which represents the number of documents) with the node size.
Unfortunately, as of version 0.9.0, Gephi no longer supports hierarchical graphs. Maybe try using a previous version?
Other alternatives involve more complex software, such as Graphviz, but you need a .dot file instead of your .csv. I looked all over, but could not find an easy-to-use csv to dot converter.
You could try looking at d3-hierarchy, a node.js program, but then again you need to use the not-so-user-friendly npm. If you look at the link, it looks like it can produce the kind of diagram you're looking for.