Is there an API to draw a B-TREE? - java

That's a simple question: is there an API to draw a B-tree in Java? I just dont want to spend much time reinventing the wheel. I am not having trouble with the algorithm per si, mine works perfectly fine after a lot of reading (specially Lafore's Data Structures & Algorithms in Java), I just dont know how to print a B-tree in a good way.
Thanks in advance.

You've got a couple of options to "render" a graph to screen -
Graphviz has a Java API (Edit: an addon called LJV which gives the API).
I think you ought to be able to use the free version of JGraph to do the same.

I know people have had success with daVinci (now uDraw). I haven't used it since 2003, but from what I remember, you have to generate a bracketed text file for your tree and the program parses it. You should be able to output your text by doing a simple tree traversal.

Have a look at yEd. I'm pretty sure, licensing yFiles just for an API to display tree structures is a bit exaggerated, but the graph editor is free of license costs and you can use it to render your trees. I usually dump my raw graph data in one of the supported file formats, open the output file with yEd and let it do the layout.

Related

tree structure visualization

I have an AST (abstract syntax tree) structure that I need to visualize. What to use for such visualization? I have heard about eclipse gmf, but after a short look on all that models and code generation I think that it is too complex for this problem.
My task is only show tree structure with some basic interactive functions: I need to show popup window with some additional information and that is all.
Do you think that eclipse Draw2D is enough? Moreover may be there are some out of the box solutions for visualizing a tree structure?
Try GraphViz. It's an open source graph visualization software that can be used to generate images (SVG, PNG, JPEG,etc) from graph structures (including ASTs).
You can find a Java-based alternative in Eclipse Zest, a group of visualization components for Eclipse
It's not particularly sexy, but if you're looking for a low barrier of entry, a swing JTree is pretty easy to get started with. The Swing Tutorials have several examples.

video Image processing , how can i?

So Here is the situation.
I have a video that contain some objects that moves (contract to be more accurate),
I'm trying to write a code to calculate these movements in matter of
Frequency of movements (how many contractions per minute)
How far does the contraction goes in mm.
How can this be done ?? :D!
I use Matlab now to to blot amplitude difference between each frame but its not giving very nice results so far.. (very buggy)
Any tips ? language i should use best, or is there already something exist that can compare different images and plot difference ?
Thanks
You should try Processing using one of these libraries.
Keywords to search for: Blob detection, Computer Vision
The best library for tracking moving objects is OpenCV, which can be used from within Processing, too. Tracking faces for example works like a charm there, but for more abstract shapes you should try another library like BlobDetection!
OpenCV is a great library if you plan to write into C/C++ (or wrapped into JavaCV if you prefer Java). Matlab is a great tool too, especially if you are working on a proof of concept you may want to work with something more friendly and "lighthearted" than C.
If you plan to measure positions or distances I suggest you to use some calibration toolbox to consider intrinsic/extrinsic parameters and eventually camera defects, it will give you more precise results. It is builtin into OpenCV, or take a look here if you plan to use Matlab.
so i'm not expert on this but if you want write something in php you probably would use gd library or imagemagick library also imagemagick utility on linux contains some comparing tool according this http://www.imagemagick.org/script/compare.php

Getting an image from a game model

So I'm not 100% sure if it's possible, but what I'd like to do is take a model that someone has created for a game, say in Blender or something similar, in various formats, and from that create an image to show on a website.
Are there any Java libraries around that could help me with that? Java3D maybe? Or even something in Flash? Ideally you'd be able to rotate the model in some embedded flash app, but I'd settle for a plain old image.
It depends on how far you want to go. Most models are going to be in a standard format- or can easily be converted to be - and most 3D Apis are able to load these formats in.
It would be a little unusual to do this on a server - you may even need to have OpenGL installed on it - but it should be quite easy to load a model in to a 3D environment and take a snapshot or a series of snapshots quite easily. Possibly even use these to create a short video clip of a complete turn around the model. If you're using Java take a look at some of the things people are working on over at http://www.javagaming.org/ - I don't know that Java3D is in use much still but there are other good 3D java environments around. JMonkeyEngine looked most interesting last time I was exploring that area.
Alternatively you probably can set up a way of loading the model into a clientside environment - I don't know if Flash can do 3D stuff now, but Shockwave certainly can ( although it's horrible to work with ) and I believe the Silverlight stuff likewise. Of course unless you are pregenerating your animations you are likely to be passing the model to your display logic on the client and a savvy user could intercept that, but the risk is probably reasonably low and from your question it's not clear whether that would be a problem to you.
Take a look into this post:
http://techblog.floorplanner.com/2010/01/25/introducing-asblender/
"Enter ASBlender, a library I slapped together in a few days to read Blender’s .blend file format and parse it to AS3."
lucky you! ;)
EDIT: added link for the project:
http://github.com/timknip/asblender
EDIT2: With the asblender library you can parse directly the .blend file (this is the working file, not a exported file format). Once you have the file inside the flash application you can use Papervision (I believe you do the same with other 3d libraries) to render the model, this way you can do a single image of the model or you can let user to see the model rotating. Beware that any of this libraries won't give the same render quality that a 3D application like blender is capable of. The good thing about this library is the capability of reading all the info in the scene, so you can match cameras and lights to be as close as possible to the original .blend file.
Alternatively there are also other parsers like Ase, Collada , DAE, KMZ, Max3DS, MD2, Sketchup, SketchupCollada... all of this inside papervision library.

Convert a table based layout to divs with Java

I've recently been charged with creating a Android & iphone app for work. That being said, I'm a css/php designer-developer with a bit of javascript in the mix.
I need to write a bit of Java (not javascript) that will convert a table based layout into a div based layout so that I can then have control over positioning, padding, and what not.
I see many similar post, but these post involve more "designer" oriented goals rather than functional control over positioning, layout and so on.
A good resource would be greatly appreciated as I can't seem to google an appropriate search string. My searches tend to yield more "free javascript code", "Java tutorials about making flashing banners", "How to make fading menus" and countless other rabbit holes that lead to wonderland.
Oh, Currently using eclipse with Android SDK & ADT plugins installed.
It would be much more easier if you have predefinied a set of rules how the conversion should actually be taken place. There is namely fairly a lot which needs to be taken into account. This is really not going to be a bit of Java.
If you're looking for an existing tool, in Adobe Dreamweaver you can do that by Modify > Convert > Tables to AP divs. But still, I question if those kind of tools provides exactly that what you need. As said, there's fairly a lot which needs to be taken into account and it's shooting in the dark without a clear set of rules/requirements.
you may have to write more than a bit of java. you will need parse the html (http://www.benmccann.com/dev-blog/java-html-parsing-library-comparison/) and walk the dom (How to search in a HTML file for some tags?). that's fairly straightforward (assuming that your html is well formed), but i suspect that turning each table element into a div will require a moderate amount of code.
as BalusC pointed out, there may be tools that can get you part of the way, so you might try to do it in two passes.

Generating and visualising a decision tree

I wonder if anyone is able to help or advise with the following; I have to be able to take data from a data source and to be able to visualise that data as a decision trees on a web page all. This will be a single process which is seamless to an end user.
This will be done using JSPs and Java servlets but what concerns me are the underlying products. I'm thinking of passing the data to a Weka classifier and then doing something with the .dot file it creates, i.e. maybe feeding it to GraphViz or trying to use the Google Visualization API to present an interactive display.
But, can anyone tell me if this is a viable approach or suggest alternatives?
Thanks
Martin O'Shea.
I've had a lot of success creating data flow graphs with graphviz (I uploaded them with a script to a MoinMoin wiki and used the graphviz plugin). That plugin even allowed to have links in the graphs, so we could keep the individual graphs small.
For the UI we have added the JS stuff from http://www.mxgraph.com/ to display larger graphs to the user.
Your approach is viable however. GraphViz is a good tool.

Categories

Resources