Is there any cross-references mechanism in Netbeans? - netbeans

One should think the title of this post self-explanatory: I would like to generate a table of all variable names and references inside a Netbeans project.
Is there a means I can do this?
I am mainly concerned with javascript.
By 'cross-reference' I mean a way to collect all names of variables and display in a list, along with those names, all places where the said variables are used. The term 'variables' also includes names of functions, of course.
Ideally the list generated could be exported in some format for ulterior use.

Related

Copy name of object in variable explorer

I frequently find myself examining deeply nested data in the variable explorer, e.g.:
objectName.structArray1(5).structArray2(3).structArray3(7).doubleArray(4)
In order to be descriptive, the variable names are often long. I often want to use some of the data I'm looking at in Matlab expression, composed at the command line. So I end up typing the lengthy series of variable names and indexes. Autocompletion helps, but not much, especially since my variable names share many substrings.
It would be a lifesaver if I could copy into the clipboard the entire expression corresponding to the data being examined in the variable viewer. I haven't yet found a way to do this (the most obvious way being to right-click the tab for the data being examined). So I'm not sure if this functionality exists. Can anyone confirm or deny (hopefully the former) whether this functionality exists? If it does, how is it done?
As an example, suppose you had a class file myClass.m in the current working directory:
% myClass.m
%----------
classdef myClass
properties
structArray1
end % properties
end % class
Now suppose you issued the following commands:
objectName = myClass
objectName.structArray1(5).structArray2(3).structArray3(7).doubleArray(1:3)=rand(1,3)
openvar('objectName.structArray1(5).structArray2(3).structArray3(7).doubleArray')
You are now examining a slew of data within a deeply nested data structure. Normally, the data would have been the result of computation other than the rand statement above, and I would have browsed to it manually rather than using the openvar statement above. So I would not normally have readily available the text for the expression
objectName.structArray1(5).structArray2(3).structArray3(7).doubleArray
I have to manually type it in at the command line if I want to use it in a Matlab expression for further computation. It'd be so great if I could somehow point to the tab for that data in the variable explorer and somehow have the expression for the data copied to the clipboard. That way, I can paste it to the command line.
AFTERNOTE:
If there's no way to do this, then as an alternative to manually typing in the whole expression above, is there a way to access the corresponding data object (or a copy thereof) programmatically through the variable explorer window object? This assumes, of course, that the variable explorer is itself a data object as well, through which properties can be accessed. If so, maybe it has a property (perhaps deeply nested) that represents the expression for data in the tab that currently has the focus. If so, I can write a function to retrieve the corresponding data object.
I found that if I undock a tab from the Variables editor, I can select the variable name by double-clicking the variable name in the tab.
Sorry for the ambiguity in wording, but "tab" use to mean the protrusion in the data sheet for displaying the name of the data sheet. Nowadays, "tab" means the whole data sheet. In the first sentence above, I mean the protrusion, which unfortunately doesn't have a distinct name these days (at least none of which I'm aware).
After copying and pasting the variable name from the protrusion, the tab can be docked, which seems to put it back into its original place.

Finding out which function, model or script created a variable in a workspace

I'm using a simulationenvironment in matlab that's consisting of multiple scripts, functions and simulink models. Now I want to find out which of These created a specific variable in my Base-Workspace. Is there a way of finding this out?
One cannot trace back how a variable was created, but you may find the possible candidates that might create the variable.
If you know the name of the variable (let's say is 'my_var'), the use the 'Find files...' from the Edit menu (the usual key biding is [Ctrl]+[Shift]+[F]) to look into all files that containing the text my_var. Do not forget to configure the containing folder to include other paths than the current one, if you're calling some package/toolbox-level scripts.

Generating a global include graph in Doxygen

Doxygen can generate graphs showing which files in a project include which others, as a directed graph. This is a nice tool, but it only comes in two flavors, namely showing all the files that include (directly or indirectly) a given file, or all the files that are included (again directly or indirectly) by a given file.
I would like to generate a global include graph, containing all the files that Doxygen knows about, and showing the include structure. Is that possible?
One trick that kind of works but feels extremely dirty: add some dummy.h header somewhere, and include it from every other file, or alternatively (a bit cleaner since it doesn't need to touch the other files) have dummy.h manually include everything else. And then manually remove useless includes (which are implied by others as indirect dependencies). That is not the right way to do it...

Making stable names for doxygen html docs pages

I need to refer to Doxygen documentation pages. The file names however are not stable as they change after every generation. My idea is to create a symlink to each HTML file created by Doxygen , having a stable and human friendly name. Have anyone tried this?
Actually, it might be very easy just to parse the annotated.html file Doxygen produces. Any documented class shows up there as a line like:
`<tr><td class="indexkey"><a class="el" href="dd/de6/a00548.html">
ImportantClass</a></td>`
The hard problem for me is that I would like to have my file names (i.e. the symlinks) be visible on my server like:
http://www.package.com/com.package.my.ImportantClass.html
[Yes, the code is in java]. So the question actually reads: "how to connect a HTML page by Doxygen with the right java class name and its package name.
You seem to have SHORT_NAMES enabled, which will indeed produce volatile names. When you set SHORT_NAMES to NO in the configuration file (the default), you will get longer names, but these are stable over multiple runs (i.e. they are based on the name, and for functions also on (a hash of) the parameters.

Saving a CSV with the following format in iPhone application

In my application I have a simple logbook where the user can save simple posts about an event. The format is like this:
Date, duration(seconds), distance(km), a comment AND categories with a variable number between 0 - 4 AND circumstances/conditions with a variable number between 0 - 4
An example would be:
Header of CSV file
Date,Duration,Distance,Comment
Then multiple rows like this
07.02.11,7800,300,"A comment"
07.02.11,7800,300,"A comment"
07.02.11,7800,300,"A comment"
But how can I add the categories and conditions to this format and how would I know where in the categories/conditions end in the CSV if I at a later point in the application want to import the file again?
(I do not need help with how to save etc this to file, already done that, but I could need guidiance on how to format it, thank you)
(This seems pretty odd)
Header of CSV file
Date,Duration,Distance,Comment, Category, Category, Category, Category, Condition, Condition, Condition, Condition
Then multiple rows like this
07.02.11,7800,300,"A comment", "Categoryname", "Categoryname", "Categoryname","Categoryname", "Condtion", "Condition", "Condtion", "Condition"
(Would this be better)
Header of CSV file
Date,Duration,Distance,Comment, Category, Condition
Then multiple rows like this
07.02.11,7800,300,"A comment", "Multiple category names separted by -", "Multiple condition names separted by -"
I think you last proposal of separating conditions or categories using a special separator symbol (the hyphen in your example) is the right one.
By the way I would suggest two extra things:
use a less common separator, that is something you can forbid the user to use without limiting user choice; probably the hyphen is a character you don't want to forbid, use a different sequence such as three pipes: ||| which is not common.
if possible (but be careful in this case about final destination of the CSV file) you can avoid using the standard "comma separator". The reason for this is that if comma is used inside the fields content, then this content must be separated by double quotes. This is some time problematic if you need to do some custom parsing by other software. Normally when I know that my CSV will not be used as source import from other software (e.g. Numbers or Excel) I prefer to use a different separator, e.g. a sequence of 2 hash (##) or something more "strange". Note that in this case you are no more strict-CSV compliant! but there is some software, like OpenOffice, which is more flexible with this special formats.
The second solution you are proposing will work but practically defeats the idea of using a standard format, since you will need to do the parsing of categories and conditions on your own instead of using a standard CSV parser. Writing your own parser is never good.
I would personally do this differently: not trying to put everything in a single file and have two files, one for events (each event has a unique id) and the other for categories/conditions (each category condition is associated to an event through the event's id, multiple categories/events for a given event would appear on multiple lines associated sharing the same event id). Both files would be standard CSV files.
As an alternative, if you are not tied to CSV for any reason, you might think of using JSON, which allows for a richer set of data types, including arrays, and offers plenty of code that you can reuse. This will not require much change to your code.
Another option, more "canonical" (IMO) but also more expensive in terms of code rewrite, would be using sqlite3.
If I had to choose, I would go for JSON, but I don't know if this is ok for you.