Estimation of line length using Skeleton - java

I'm using ImageJ and Skeleton to estimate line length and density, but the problem is that I have an agglomerate of lines that I need that to be considered as different lines, before I can use the Skeleton plug in.
Has anyone have any idea of how to do that?
Thanks!

Hye you may use the plugin strahler that gives you the number of branch between two junction by branch order. Perhaps you could try after to measure them
enter link description here

I'm still new to writing scripts for ImageJ but I've found some of the plugins very helpful. The problem is extracting the skeleton length for individual objects, (I'm still learning how to do that). If your using Fiji.
Plugins -> Skeleton -> Analyze Skeleton

Related

eclipse - restrict method line number

How can I tell eclipse to inform me when the number of lines in my method exceeds a certain number?
I've tried researching but ended up with nothing.
Any help will be appreciated.
Thanks folks!
An eclipse plugin perhaps?
You can use code metrics plugins for Eclipse which analyze your code and calculate statistics.
An example:
http://metrics.sourceforge.net/
The statistics include the average and maximum line numbers of methods.
I found it:
An eclipse plugin - http://metrics.sourceforge.net/
It will show the metrics in a different panel but will not raise a warning in your eclipse though. You need to look at the metrics.
Install CodePro Analytix. Configure the issue detection for method length in CodePro Analytix to your number of lines. Set the issue level to "Error". Then use the dynamic auditing mode of CodePro Analytix. It will always scan the currently opened editor files for violations. So on saving a file containing a long method, you get a violation error immediately.
Maybe you want to consider plugins like PMD or FindBugs to improve the code quality.
CheckStyle can check for style issues in your code, like a method that is too long (confer MethodLength). There is an Eclipse Plugin where you can configure which checks to do, what your limits are (e.g., with how many lines to report a method as "too long"), and how to display that the check failed (e.g., as an error, as a warning,...).

Accessibility of test coverage reports for blind people

I am currently helping a member of my team to get in grip with our new project and the tools we are using. We use Java as a primary language. A particularity of my colleague is that he is blind. He's working primarily with Emacs, and he runs maven targets in a terminal.
After I'm done implementing, I find it very useful to check my test coverage. I'd like my colleague to be able to check coverage as well. I have two ways of getting this information:
Use IntelliJ integrated test coverage (it uses EMMA and shows a green, red or yellow color next to each line). Very convenient, as I can see this information immediatly after having run the tests, with no further interaction
This won't work for my colleague as he can't use IntelliJ, and it would probably not work anyway as there is no textual representation of the coverage info
Use Cobertura reports. They use the same concept of line in green/red They are fine for macro information like overall coverage in a class, but not for checking which line has not been covered.
Actually he could dig into the HTML sources of the report and find out which one has class nbHitsUncovered, but it seems very impractical.
I would really like to show him how to get his coverage data quickly. Does anybody know of a tool that shows coverage without relying on colors? Or do we have to write our own? (by transforming the HTML report, for instance)
I’m a totally blind developer who does my work on Windows with the Jaws for Windows screen reader so this won’t map exactly to the developer you work with. With a little programming it looks like cobertura test results are the easiest to deal with. Based on the following sample XML report it shouldn’t be difficult to throw together a quick Perl script to check for lines with a hit count of 0.
https://raw.github.com/jenkinsci/cobertura-plugin/master/src/test/resources/hudson/plugins/cobertura/coverage-with-data.xml
I was able to find out that line 24 was the only one executed 0 times with a quick find for
Hits="0"
Although I was able to find out what line wasn’t executed I had to scroll up quite a bit to figure out what class and method the line was located in. A quick Perl script could eliminate the need to scroll back and provide the package, class, and method the line is located in more efficiently.
I took a look at a sample Emma HTML report using Google Chrome and it was pretty accessible. I could tell what methods were fully tested and what weren’t. Figuring out what lines were executed and what ones weren’t was more difficult. I could tell a method wasn’t 100% executed and would then navigate to it in the report. I then had to use the keystroke provided by my screen reader to announce color on each line of code. I forget the exact color names but I could tell the lines that were and weren’t executed since my screen reader listed them as having different colors. This worked but was slow since I had to manually check each line of a method; that wasn’t completely executed since my screen reader can’t automatically announce color changes. I’m not sure how your developer would do the equivalent since I don’t know his exact assistive technology setup.
I have had a dig around Antoine as I also use SONAR and Cobertura on my projects and am intrigued by your problem. From what I can see when you tell the ANT task to generate "html" as the output you get all the line information that want, but as you've pointed out it's not an easily parseable format (and possibly subject to change).
With SONAR I tell Cobertura to output "xml" which gives me a file named coverage.xml with the output. Unfortunately it does not include line-by-line data and I cannot see any ANT task parameters to include it from the Cobertura docs.
It makes sense to me that the file named cobertura.ser contains all of the data you require, but only the HTML report displays it for you. I believe the answer to your question may lie in trying to extract the required serialised data from cobertura.ser.
Looking at the source code I can see the following classes
net.sourceforge.cobertura.reporting.html.HTMLReport
net.sourceforge.cobertura.reporting.xml.XMLReport
What I suspect you can try and do is take a copy of the HTMLReport as a base and try writing the same output as XML which you can then parse for your own purposes (or mjust ad the same method calls used by HTMLReport in XMLReport). I can see the string nbHitsUncovered in HTMLReport so hopefully you only have one class to write.
I've googled around and can't see anyone having done this, but it looks like a useful enhancement.
How about using a GreaseMonkey script that searches all the lines having the class nbHitsUncovered and adds some list/table containing the information wanted to the report?

Java converter for CgBI images to RGBA?

I have a need to be able to programmatically convert a PNG file that has been optimized for an iOS application and remove the optimizations. A number of posts reveal the mechanism for doing this, but I was hoping there was some Java code already out there for doing this before I go do this on my own.
Does anyone know of a Java converter for CgBI images to RGBA?
I got interested on the topic and made some research on the area. On one related page on PNG conversions I ended up to a jar package type of converter which may be something that you'd be pleased of. I suppose it to be some sort of Open Source solution, because the source was announced to be found from the same place.
I wrote a command line C program that does the same. In addition to the other converters (I have yet to test the online one), mine can handle multiple IDAT chunks, Adam7 interlacing, and all row filter types -- the latter is necessary to de-multiply color pixels with their alpha. All of this leads to, AFAIK, the very same image that got fried.
See my website for the full C source code.

To find an execution line-counter for Java IDE

Is there any plugin to some IDE that show the number of times a line is run in the code?
Eclipse's ECLemma does not seem to have a setting to show execution times at the left-hand-side bar, like in the service WebCat.
I think the eclipse test and performance tools plateform would be able to help you with this. It includes a profiler which will instrument your code and provide the information you want.
Careful with profiling, it can be a heavy performance hit depending on how many functions/classes you monitor
Have a look at the breakpoint properties in eclipse may be you can configure a variable to capture the hitcount
What's wrong with writing to a log file or to screen or using a counter?
The focus of code coverage is only if a line is executed or not. Nothing more.
To get counters you would have to look at profiler software and not code coverage.
There are plugins for both Eclipse and Netbeans. I am not sure if they show counters per line, but I think that they show counters per method, which might be what you want...
(source: free.fr)
In NetBeans 6.8 there is a nice code coverage tool which does pretty much that what you want but actually only for ruby. (right click project -> code coverage)
But could you use an ant task or maven plugin? Then Take a look at this list

Word Wrap in Net Beans

Netbeans is great but there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well).
You can use word wrap in Netbeans.
Add the following to netbeans.conf (netbeans_installation_path/etc/netbeans.conf, by default /etc/netbeans.conf under linux):
-J-Dorg.netbeans.editor.linewrap=true
to the sixth line so it looks like this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.editor.linewrap=true"
and restart Netbeans.
Set the Line Wrap option in Tools->Options->Editor->Formating.
Works fine for me in Netbeans 6.9 and 7
If you do web development you are going to understand why text wrapping is important.
A programmer who has never gotten their hands dirty with HTML has never seen the real web. You can insist on MVC all you want to but 99.9% of the world wide web since its inception wasn't built that way. Unless you're always developing from a clean slate and can use MVC to separate the HTML out AND assuming you have an on-staff web designer who does html/css/javascript or you have an interface developer who you can fob it off on you WILL have to deal with everything that has been developed/kludged/hacked together with what ever technologies were at hand or popular or affordable at the time and now more or less functions as a 'web application'. And 99.9% of the time what you will have to work with is a mix of some kind of a programming language, most likely an interpreted one, with html and javascript all mixed in the same page.
And this means no nice short lines of neat clean java code that oh so conveniently end before 80 characters.
And when you deal with this -- which, dear hearts, is most of the web -- you magically discover the crying need for text wrapping to keep the long lines from making you scroll waaaay to the right to get to the end of it.
Some people. Sheesh. They think the whole universe of development has always fit on 80 characters per line, and from some of these comments, they seem to think it always will.
Netbeans 7 is out and it supports word wrap out of the box!
There's word-wrap eclipse plugin: see http://ahtik.com/blog/eclipse-word-wrap/
Like Joseph said: why would you need this. Java is not white space sensitive and having very long statements does not make your code easy to read.
It always goes back to Ultraedit.
Why can't we as a human race figure this out? netbeans, eclipse, zend studio (eclipse), etc don't do something very simple for programming, that most programmers -need to have- to keep a sound coding convention. Sure, it's true that coding style contributes to length of lines (erm microsoft programmers, perk your ears), but sometimes one cannot avoid long string literals. This is insanity! And yet I can't be mad or ungrateful because it's open source. And i -am- grateful. Still, one has to wonder wtf programmers who make these editors are actually using themselves.
I want an editor to wrap at column 80 or 120, not at the window's edge like notepad++. The only tool I've found that does hard/soft wrapping is ultraedit, so maybe I should try to see if I can get it to run under wine, since UE is the only 'real' editor that does it's job other than something weird / ugly / takes forever to learn and configure like emacs. And I am not going down that road- it gives me migranes to look at it because it's 2009 and we have cleartext and guis.
Is it really that difficult a problem to solve? If you draw a line down from column x and your word crosses over it, then put the beginning of the word under the indention of the line from which it started and mark the spill over row as a wrap row. Done.
Actually i heard netbeans is going to add word wrap feature in 6.7 release but then they decided to include this feature in 7.0 . hopefully we would see word wrap in the next release, according to few developers this isn't a necessary feature but for web developers this is totally needed.
There is a great solution to this at this website blog.robbychen.com
The jist is to add the following line inside the quotes for netbeans_default_options inside the config file then restart netbeans:
-J-Dorg.netbeans.editor.linewrap=true
Except Eclipse does not support word wrap either, and they even don't have set up a target for this. Just like Netbeans, this has been asked by many users, but was never included. It appears it requires much change, and as well does not seem to be a high priority for devs.
There was once a beginning of a plugin trying to word wrap in a limited way, but of course it does not work on recent versions.
When you get to where you want the line to end, just start a new line without ending the statement. It may underline it in red until you end the statement, but it won't cause any exceptions.
I find that it is also a good way to organize long println() statements.
Komodo Edit. In addition to its many other marvelous features, it actually wraps lines.
2 points:
Just found that wrapping is really needed if one wants to look into those damn SVG sources auto-generated when putting components from SVG palette...
I'm going to solve my current problem with seeing full SVG source by copy-paste to jEdit which is as configurable as Ultraedit (in the aspect of wrapping) and FoC!
As many have already noted, the answer is "you can't." As someone who uses Visual Studio and Eclipse-based products every day, when I am using Eclipse, I am constantly missing Visual Studio's line wrapping features, which I can turn on and off with a keystroke.
To the many people who have responded "you don't need this," stop being so condescending. Simply because you don't need a feature doesn't mean nobody else in the world does. Even if one were to religiously follow the advice "never have a line over 80 characters," you're going to need to edit code that others have composed and goes over 80 chars. And especially in the web-world, lines can get tremendously long. It's inevitable that you'll spend a lot of time looking at other people's code that goes way over 80 chars.
jEdit's line wrapping is very good. It preserves indentation and can be turned on an off very quickly. If I'm dealing with some very unwieldy long lines, I sometimes copy/paste in jEdit (which offers syntax highlighting for a myriad of languages) and use the line wrapping available there.
The new version of Netbeans supports it. See this post for instructions:
Word Wrap in Netbeans
Of course word wrap is useful for coders - what about when you're writing README.txt files and you have to stick to coding standards like http://drupal.org/node/161085 where is says there needs to be an 80 character word wrap.
In netbeans 7.3 you go to tools->options->editor->formatting, in the left menu area select the bottom most drop down that says line wrap, select your preference...done
Get a bigger monitor.
At 1920 x 1080 you don't need no steenkin word-wrap.
Update:
Wow, still getting downvotes. Maybe it's just how I said it. At least it hasn't caught up to the Eclipse answer yet.
I really thought this was a legitimate suggestion. I never thought that having a bigger monitor would make as much of a difference to coding as it has for me. If you're using a small monitor to code please consider getting a nice big new one. It does eliminate the need for word wrap in a lot of cases.

Categories