Call a jar file function in VB6.0 - function

I have a jar file lets say a.jar and I have also a VB6.0 application called b.exe. So I want to use the functions of a.jar in the b.exe application. Please what would be the syntax to implement it. If you have any reference please share with me.
Can I call this jar file same as we call .dll files in vb6.0?

VB cannot directly interact with Java. But it can talk to VC++. VC++ can talk to Java. You need to use JNI (Java Native Interface) for this. So, write VC++ DLL that interacts with java and let the VB invoke the VC++ DLL functions. Hundreds of examples are available on the net for JNI.
http://docs.oracle.com/javase/7/docs/technotes/guides/jni/

Related

Add TCL binding to a fairly large C++ code base

I have a C++ project whose source files are distributed over several trees. Currently each is built into a static library and finally the main() function is compiled and linked with all those libraries through static link.
Now I am using SWIG to add TCL binding to the project. The examples I can find all are simple, just one C++ source.
My understanding is, I need to re-compile each library to be shared libraries, compile the SWIFT binding code to a shared library and link all these libraries into one. In TCL, I load that final one.
For example, here is my source tree:
dir1: s1.c
dir2: s2.c
dir3: swig_binding.c
My action plan to the above source tree is:
Update the Makefiles so that I have
dir1: libs1.so
dir2: libs2.so
dir3: libswig_binding.so
Link the 3 .so files into one, libswig_binding.so
Inside TCL, load libswig_binding.so
Do you see if I miss anything?

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.