Interactivity where are you gone? - java

I have been browsing around your many sites about BIRT and specially for Interactivity or scripting related subjects.
But (it would be sooo nice to live in a flawless world) trying to perform some examples (like this one http://kickjava.com/src/org/eclipse/birt/chart/examples/api/interactivity/InteractivityCharts.java.htm) which is supposed to make interactive charts I get nothing ... well yes I get something : charts (very nice ones by the way ;p) but I have searched for the interactivity aaaaaand it's gone ... may be to the swimming pool or at the laundry but certainely not there ... If you want I can send you the code I used to display the charts or anything you'd like but I really need to make my charts interactives and feel quite helpless and distraught (I'd prefer dazed and confused ...).

The easiest path to interactivity for BIRT-based content is the Interactive Viewer. Have a look at the specs here: http://www.birt-exchange.com/be/products/birt-report-viewers/actuate-interactive-viewer/features/

right after declaring your IDeviceRenderer
you must
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, anyclass that implements IUpdateNotifier );
Then you have plenty of documentations on
http://www.birt-exchange.org/documentation/BIRT_220/ChartJavadoc/chart/api/org/eclipse/birt/chart/device/IUpdateNotifier.html
And forever Google is your friend ^^

Related

Is it possible to create a custom screen GUI in Bukkit?

I'm wondering if it's possible to add some custom screen GUI's to my Bukkit server. So I can display a lot of text on someone's screen. Or do I need to find another option to do this?
Thanks!
The only practical way is to use an Inventory using blocks with name and lore for users to click on as can be seen here
As Cole Nelson mentioned, a custom inventory with lore displayed might work. A good guide for that can be found on the bukkit forums, and although it's a bit outdated it should still provide useful information.
Another possibility would be to utilize title screens; obviously those can't hold a ton of information, but the player is pretty much guaranteed to notice them immediatly.
I recommend using Title Api, as it's a bit tedious to directly work with packets.
Once you added the jar to your project and set the dependency, simply use:
TitleAPI.sendTitle(player,fadeIn,stay,fadeOut,"Title","Subtitle");
to send a title with all corresponding attributes.
Example result:

'Search engine' on local database

I have a webapp with multiple objects with multiple Strings I'd like to search through. I would like to sort 'matches' by the best 'match'. Example: searching for 'stackoverflow is great'.
"Stackoverflow is a great website".
"This website has a great community".
"Stackoverflow".
"This website is good". // Here you could even consider 'is' as not being a match
Since I feel this would be reinventing the wheel, I'm searching for a library that's configurable though not monsterous. Since I don't know how this would be positioned in the application (using JPA or just a normal class), I think it's worth mentioning I'm using JSF and JPA.
Do you know of any library for this, configurable to which fields to search et cetera?
I've personally never used an API for this before, but I recommend lucene.
My friends used it and they didn't have any problems with it.
It has best result functions and everything, multi-platform and is open source.
I hope this is what you need.

Recognizing colors/patterns in webpage

I want to try to create a learning chess application as a school project. My first plan was to simply pit this AI against itself, but to really show if it has been succesful it needs to be able to show how well it progresses. In order to do this, i want it to play rated games on sites such as chess.com. However, they do not (yet) have a public API, i believe.
Therefore, i wanted to make a program in java that recognizes colors and images. It keeps an internal 2-dimensional array of all the positions, and recognizes the pieces on the board. I think i have found a way to do this in a window using something like the Java Robot Class.
What i would like it to do, however, is to open this webpage in an internal window and keep doing this in the background. Is there a way to recognize colors within the own window, without needing to be in the foreground?
Edit: I'm planning on using this browser component i just found. I noticed that it is possible to create a full-page snapshot of the page and save it as a BufferedImage(?). Would this make it easier to do this?
Edit 2: I just read that 'Outside assistance from other people, computers/chess engines, or endgame tablebases is entirely prohibited'. I suppose letting a computer do all the playing does certainly include in that. So i might try using another site, so answers that are specific for chess.com won't cut it!
I don't know it it helps but may be you can have a look at the Sikuli project.
http://sikuli.org/
Sikuli is a program (and an API) to handle the interactions with the User Interface. For instance, you can write a script to click on an image or a button in certain conditions.
Especially interesting for you, there is a Java integration: http://sikuli.org/docx/faq/030-java-dev.html
Here is an extract of the website to give you an idea of the code you can write.
EDIT: in this code it is important to notice that you are defining new Patterns with the images. Sikuli will be able to find matching patterns.
import org.sikuli.script.*;
public class TestSikuli {
public static void main(String[] args) {
Screen s = new Screen();
try{
s.click("imgs/spotlight.png", 0);
s.wait("imgs/spotlight-input.png");
s.type(null, "hello world\n", 0);
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
You should consider playing on a chess server where an API is avaible and chess engines are allowed. There is The Internet Chess Club (ICC) where you must pay to have a human account and then you can get a free computer account for your engine. There is also the Free Internet Chess Server (FICS) where you and your engine can get free accounts.
The ICC is usually prefered because the level of players is higher there with lots of international masters and chess masters playing there.
The best way to Interface with theses sites is to implement the xboard protocol. This will allow your engines to play through the Winboard or XBoard interface (among others) and theses interface can be used to connect on FICS or ICC and automatically play there.
I hope this help, even if it does not directly answer the question.
I'm not sure what your input is but you have two options:
You can work an a PNG image. Load the image into a BufferedImage (docs) object and examine it there. You can use a screen shot tool to create those.
It seems chess.com uses HTML with JavaScript. You can download the HTML using HttpComponents and examine it to see where the pieces are. This has the additional benefit that you don't have to guess which piece goes where since the HTML contains the source information.

Odontogram code

I need to add an odontogram to my webpage.
It looks like this:
I would like to know if there is already some kind of open source odontogram.
I am using spring-mvc so it has to be in java
If it's web based I'd think you'd just want to return an SVG from a servlet.
If it must be interactive, I'd do this as an Applet or JWS application, with each tooth represented by an instance extending JComponent and containing five Polygons. The latter would make filling and hit testing relatively easy. A simple data model containing surface (proximal, distal, lingual, labial, occlusal) and color-code would also be useful. See also ImageTooth.
Addendum: You may want to plan on consulting a subject matter expert regarding the clinical correlation of the numbers, colors and locations.

How to webscrape scholar.google.com in Java?

I want to write a Java func grabTopResults(String f) such that grabTopResults("automata theory") returns me a list of the top 100 cited papers on scholar.google.com for "automata theory".
Does anyone have suggestions for what libraries will make my life easy?
Thanks!
As I'm sure Google can afford the bandwidth, I'll ignore the question of whether this is immoral/illegal/prohibited by Google's T&C
First thing you need to do is figure out what HTTP request (or requests) you need to issue in order to obtain the page with the data you need. Once you've figured this out, use HttpClient to issue the same request from Java code. The previous link shows example code that explains how to do this.
Once you've downloaded the content of the relevant page, you'll need to use a HTML parser to extract the data you're interested in. The Jericho parser suggested by peperg is a good choice.
If the Google police come knocking, you've never heard of me, OK?
I use http://jericho.htmlparser.net/docs/index.html . Google Scholar doesn't have API ( http://code.google.com/p/google-ajax-apis/issues/detail?id=109 ). Of course it is not allowed by Google (read terms of use. Automatic requestr are forbidden).
Below is a bit of example code which gets the titles on the first page using the open source product TestPlan. It is a standalone product, but if you really need it I could help you integrated it into your Java code (it is written in Java itself).
GotoURL http://scholar.google.com/
SubmitForm with
%Params:q% automate theory
end
set %Items% as response //div[#class='gs_r']
foreach %Item% in %Items%
set %Title% as selectIn %Item% h3
Notice %Title%
end
This produces output like the below (my IP is Germany, thus a german response). Obviously you could format it however you like, or write it to a file; this is just a rough test.
00000000-00 GOTOURL http://scholar.google.com/
00000001-00 SUBMITFORM default
00000002-00 NOTICE [ZITATION] Stochastic complexity in statistical inquiry theory
00000003-00 NOTICE AUTOMATED THEORY FORMATION IN MATHEMATICS1
00000004-00 NOTICE Constraint generation via automated theory formation
00000005-00 NOTICE [BUCH] Automated theorem proving: after 25 years
00000006-00 NOTICE [BUCH] Introduction to the Theory of Computation
00000007-00 NOTICE [ZITATION] Computer-controlled systems: theory and design
00000008-00 NOTICE [BUCH] … , randomness & incompleteness: papers on algorithmic information theory
00000009-00 NOTICE [BUCH] Automatic control systems
00000010-00 NOTICE [BUCH] VLSI physical design automation: theory and practice
00000011-00 NOTICE Singular Control Systems.

Categories

Resources