Get HTML file produced by JavaDocs - html

I understand that Javadoc is a documentation generator from Sun Microsystems for generating API documentation in HTML format from Java source code.
I infer that the documentation is stored onto an HTML file.
Is there a way I can access it?
If yes where is it stored?

The word Javadoc can refer to
special comments in Java source files (preceding a declaration, and of the form /** ... */)
a program which converts these comments (as well as the declarations themselves) to readable output
the output itself, usually in HTML form.
The Javadoc program is contained in Sun's (or now Oracle's) Java Development Kit (JDK).
If you have installed a JDK (which you should if you do Java development), you can call it on the command line, passing it the package names to document, or some source file names. You should also indicate the output directory, using the -d option.
I'm assuming the following directory (and package) structure in my example below:
current directory
source
de
dclj
paul
examples
HelloWorld.java [containing package de.dclj.paul.examples; and public class HelloWorld { ... }]
docs
Then you use the following command line:
javadoc -sourcpath source -d docs de.dclj.paul.examples
It will then create a the documentation in the docs directory, with an index.html which you can open in your web browser, and other files reachable from it.
For more details have a look at the documentation linked above. For an example output, have a look at the Java Standard API Javadoc.
If you are using an IDE, you likely have a generate Javadoc button there, and the IDE might even show the formatted output of documentation of single classes or methods on the fly.

Related

How to make an F# JSON type provider sample available for test project?

I am using an F# JSON type provider to create a type from a reference JSON document. The reference document "ReferenceItem.json" is part of the F# library. In addition I have a unit test project which tests the library. I am struggling with making the reference document available for the test project without duplicating it.
No matter how I mark "ReferenceItem.json" in Visual Studio (Content, None, Copy to Output etc.) my test project fails to compile because the statement JsonProvider<"ReferenceItem.json"> expects "Reference.json" to be present in the project source folder at compilation time. Including it as a linked item from the library project doesn't help: it's not copied at compile time to the test source folder. So I need to make a duplicate copy of the file in the test project.
I noticed that in F# projects I can mark files as "DesignData" or "DesignDataWithDesignTimeCreatableTypes", but I wasn't able to figure out how I can use them.
This is a tricky problem - when F# compiler references the library, it will invoke the type provider and so the type provider needs to be able to access the sample.
The easiest solution is to just always copy the sample json file so that it is in the folder from where the application is starting. This is obviously sub-optimal, and so we have another way of handling this using resources.
See the "Using JSON provider in a library" section of the documentation. The idea is that you can embed the sample document as a resource in the library and specify the resource name as an additional parameter:
type WB = JsonProvider<"../data/WorldBank.json",
EmbeddedResource="MyLib, worldbank.json">
This will then load the resource when using the library (but it still needs the file name in the original compilation mode). This is still somewhat experimental, so please open an issue on GitHub if you cannot get it to work!

Erlang: How to include libraries

I'm writing a simple Erlang program that requests an URL and parses the response as JSON.
To do that, I need to use a Library called Jiffy. I downloaded and compiled it, and now i have a .beam file along with a .app file. My question is: How do I use it? How do I include this library in my program?. I cannot understand why I can't find an answer on the web for something that must be very crucial.
Erlang has an include syntax, but receives a .hrl file.
Thanks!
You don't need to include the file in your project. In Erlang, it is at run time that the code will try to find any function. So the module you are using must be in the search path of the VM which run your code at the point you need it, that's all.
For this you can add files to your path when you start erlang: erl -pa your/path/to/beam (it exists also -pz see erlang doc)
Note that it is also possible to modify the path from the application itself using code:add_path(Dir).
You should have a look to the OTP way to build applications in erlang documentation or Learn You Some Erlang, and also look at Rebar a tool that helps you to manage erlang application (for example starting with rebar or rebar wiki)
To add to Pascal's answer, yes Erlang will search for your files at runtime and you can add extra paths as command line arguments.
However, when you build a project of a scale that you are including other libraries, you should be building an Erlang application. This normally entails using rebar.
When using rebar, your app should have a deps/ directory. To include jiffy in your project, it is easiest to simply clone the repo into deps/jiffy. That is all that needs to be done for you to do something like jiffy:decode(Data) in your project.
Additionally, you can specify additional include files in your rebar.config file by adding extra lines {erl_opts, [{i, "./Some/path/to/file"}]}.. rebar will then look for file.so using that path.

How to pass command line options to .mxml file when compiling using mxmlc?

I've a batch script which is used to build my flex project. This script sets all the necessary info required to build the project. In this script .mxml file is compiled using mxmlc.I want to add an argument which can be then read by .mxml file. This argument will be used to make runtime decisions.
Any idea on how this can be done?
The term you're looking for is called conditional compilation.
There's no point in describing how it works here, since it's pretty well covered in the Adobe docs on the subject.

How can I import JSON data from a REST API into BIRT?

I want to use BIRT to generate reports against data that comes from a JSON based REST API. How can I import this data?
The process for doing this is described at http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471, but it turns out that there are a few important steps missing. I'll fill in a few blanks here.
The original instructions describe creating a Scripted Data Source, with an "open" script that makes use of the com.actuate.json.JSONParser class. First, it is important to realise that this class is not part of BIRT, and needs to be manually added (along with any dependencies).
The download provided by the original instructions provides the com.actuate.json.JSONParser class, but leaves it up to you to source the dependencies. To make things easier I have reimplemented the JSONParser library in Maven, which will then download and package the dependencies for you. It also includes some bug fixes and enhancements like GZIP compression support. You can get the Maven project from https://github.com/mcasperson/birt-jsonparser, and to build the JSONParser library and package the dependencies, run the command
mvn clean package dependency:copy-dependencies
This will result in the birt-jsonparser-0.0.1-SNAPSHOT.jar file being created in the target directory, and all the dependencies copied into the target\dependency directory. Copy all of these JAR files into the {BIRT_INSTALL}/plugins/org.eclipse.birt.report.viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib directory to allow the JSONParser class to be accessed from within your BIRT report.
If you want to debug your report, these JAR files will also have to be referenced in the Debug profile.

Loading HTML from a .res file

Using VS2005/2008 as a resource editor, one of the options in the Add Resource dialog is HTML: it appears to allow me to embed HTML file(s) into a resource (res) file. Does anyone know how to grab the HTML (as a string) from VB6 code? The LoadResData appears to be close to what I'm looking for but the problem is there isn't a HTML format defined in the table of formats (in that documentation link).
In Win32 C headers a resource format constant is defined called RT_HTML, it has the value 23. It should be possible to load the HTML resource type. Additionally you can verify the resource type number by looking at the built exe file with Resource Hacker. It lists the resource format types and resource IDs embedded in the file.
here is a good tutorial in c++ http://www.rohitab.com/discuss/index.php?showtopic=15281
you can probably adapt the code(usually function names are the same for win32 routines search on msdn.microsoft.com for documentation) or search the website for a VB example