How to create xhtml files in an Eclipse plug-in? - eclipse

Hello I´m writting a plug-in for Eclipse and part of the work of its work is to add new xhtml files in a JSF project.
I wonder what's the best way here. Is there a particular and recommended API for this case or I just have to treat this kind of file as a non-particular one and handle all the contents by myself?

There are a number of model-to-text generators (one of them mine, in full disclosure) that can help you if there is some boilerplate you want generated around your structure. An example of this is how Eclipse can generate getters and setters for Java instance variables.
If you're not familiar with those. though, or if the file content is relatively simple then you might want to just treat your generated xhtml as simple text files and use the basic resource methods to create them.

Related

Run Tika source code from Eclipse

I have been using Apache Tika for extracting text from different document formats. Now i want to make it handle header, footer and text boxes differently. So i downloaded source code of Tika from GitHub and trying to make changes in it.
I want to run Apache Tika source code from Eclipse and debug its execution by passing an input document. How can i do that? There are so many main classes. Where do i start? I understand its a Maven project and i am new to it.
And once i make changes how can i create new jar file?
Take a look at Tika's xhtml output first, maybe it extracts headers/footers and you can use parser API to handle these parts as you wish. If it's that way, use API as examples say passing custom SAX-like handler to it.

Deploy GWT Application as Single JavaScript File

The compiled JavaScript output of a GWT application is divided into various files, for instance
*.cache.html
*.gwt.rpc
hosted.html
*.nocache.js
...
I know this is done with the purpose of minimizing the size of the JavaScript, which has to be downloaded by users. For instance so that a Firefox user does not have to load the JavaScript specifically compiled for IE6.
However, especially for small GWT applications it might often be faster to download a single file of say 500kb rather than make two sequential requests first for the 5kb *.nocache.js script and then for the rest of the app (cache.html files, etc.).
This leads me to the question: Is there any framework or procedure to bundle the output of the GWT compiler into a single JavaScript file?
First, you can merge all permutations in a single file by using so-called "soft permutations".
Then, you can inline your *.nocache.js into the HTML host page (e.g. using a JSP's #include directive) to cut one additional request (you might have to add a <meta name=gwt:property content='baseUrl=myapp'> where myapp is the subfolder where the .nocache. files are located).
AFAIK that's what Google are doing for their GWT apps.
Alternatively, you can run the permutation selection on the server-side if you can totally replace the selection script (*.nocache.js) with server-side content negotiation (based on User-Agent and Accept-Language request headers for instance) that can directly generates a <script> tag for the appropriate *.cache.js file (provided you use the xsiframe linker).
AFAIK, Google use all these techniques for their GWT apps (such as Google Groups). For a small app, though, I'm not sure it's worth the effort…
Also, the last two techniques work best when your HTML host page is already dynamic and therefore already non-cacheable; otherwise you're mostly moving the problem, not solving it.
I wonder whether the sso linker can be used when you collapse all properties and soft-permutations down to a single hard permutation.
Yes, but it's maybe not something you want. See this answer: https://stackoverflow.com/a/4453716/66416 to this stackoverflow question: Merge GWT generated files.
I found another way to accomplish this: Writing a custom Linker for GWT. Two examples for linkers which compile into a single JavaScript file are:
GwtNodeLinker.java from Gwt Node project
ServerSingleScriptLinker.java from Env.js project

Is there a way to import HTML into JavaHelp?

I'm trying to automate JavaHelp generation from a book (HTML) already on the web to bundle as a NetBeans module. Is there a way to automate the conversion into JavaHelp format?
How are you writing your book? If you're using DocBook then you can generate JavaHelp directly from it.
It appears that you can use JHelpDev to create Java Help sets from existing HTML. It looks pretty simple to use but I can't attest to it's quality.

GWT: How do I read an Excel file that is included in my src folder?

I am trying to program in GWT (using Eclipse and the GWT Designer). I would like to be able to take an Excel file that I have already imported into my source folder, read it, and process the data. The data will be both text and numbers, but I am comfortable doing the conversions from String to other types.
I have seen something about RequestBuilder, but I'm not sure how to use that to read Excel. Or, is there another/better way to do this?
I am willing to convert the Excel file into something like a CSV is that is necessary.
You'll probably want to do the processing in your servlet with something like
http://jexcelapi.sourceforge.net/
or
http://poi.apache.org/
I am not sure if this is clear enough to you, but it is not possible to process the excel file in GWT at least not directly.
You have to process it on the backend/server.
It can't be done on he client side because even if you put the excel file in your source folder it is not available to the GWT compiled javascript code on the client machine.
If you use Java on your backend/server you can use one of the libraries danb suggested to process it on the server and then use RequestFactory or RPC to transmit it to the client/browser for further processing/displaying.

Set up own DBpedia server to create new mappings

I want to extend the mappings database of DBpedia. Therefore I want to run my own extraction framework instance on my computer. Although the latter is simply done I cannot figure how to feed the framework with newly created mappings.
What I found out so far:
In "config.properties" I can define my own dump-folder.
Some output directory can be defined as well. But what exactly is stored there?
In "Configuration.scala" the url of a mappings page is defined. Does that mean that the framework expects a web page as input which will then be searched for mappings?
My goal is to define some mappings in a plain text file and then tell the extraction framework somehow to use this file as the source of all mappings.
If everything works smoothly I am going to contribute my results to the dbpedia team.
Thanks for your help!
Some output directory can be defined as well. But what exactly is stored there?
The extraction framework outputs N-Triples and N-Quads of all the extracted data, mapping-based and others (see also the files at http://dbpedia.org/Downloads).
In "Configuration.scala" the url of a mappings page is defined. Does that mean that the framework expects a web page as input which will then be searched for mappings?
The Mappings are loaded from http://mappings.dbpedia.org/ which is a wiki for creating and editing mappings. You can get an account and editor rights there and write your own mappings. They will then be loaded when you run the extraction framework (and the data using the mappings will be available in the next release).
My goal is to define some mappings in a plain text file and then tell the extraction framework somehow to use this file as the source of all mappings. If everything works smoothly I am going to contribute my results to the dbpedia team.
You could go ahead and make the framework read the wiki code of mappings from local text files, but I think it would be better to edit them directly on the wiki. Your contribution will be instantly available.