Reading shared variables from LabView in Java/Android - java

I have a shared variable in LabView and I want to read it on my Android application written in Java. Does anybody know how could I do it?

As stated by some other users, NI's Shared Variable interface is proprietary, and is only supported through using their products. However, there are a few workarounds I can think of:
If there is a LabVIEW or TestStand instance generating the values for the shared variables, you could send the data via UDP or TCP directly to the java application, instead of, or in addition to, writing to the variables.
You are able to tie Shared Variables to OPC variables within the NI software. This requires having an OPC server to write these values to (Which NI also has-it's a re-skin of Kepware), but there are many options for reading OPC variables using Java.
Basic file I/O, as also previously mentioned, could be possible depending on the system layout.
With LabVIEW you can deploy RESTful web services which will execute specific VI's upon receiving requests. You may be able to leverage these to retrieve the values of the shared variables you are targeting.

I suggest your best bet is to write the value out to a file using LabVIEW and read it in JAVA or open an network connection/RabbitMQ pipe between the two applications.

Related

accessing java object saved in hazelcast from python

In our application, we are saving data in hz maps from a java app and down the line a python app needs to access that data. Data is saved in object form. How can we access these java objects from python module.
Thanks in advance
You need to implement one of IdentifiedSerializable or Portable serialization methods for your classes on both side.
And see this for python serialization.

Do I have to load the csv values into a DB for java web app

I'm looking to make a web that makes use of two sets of databases, given in CSV format and both are 10 MB in size. I've chosen to use Java dynamic web app with JSP, that users can use to search and sort through the data provided through the CSV.
From what I understand, the user/client sends a request to the server, the server will call upon the Java cases in the backend, which has the different sorting methods and data from the CSV that can be manipulated.
This data, that sits in the backend, is where I'm running into confusion. I know its possible to load the data to a database, and have that sitting on the server that I could call upon.
If I use a class that reads the CSV and loads the data to arrays, Would this reading work be done every time someone accesses the website causing latency or would it already be loaded into arrays in the server?
Depending on the scope you use it would be loaded in an application context, therefore one time (say in a singleton class loaded at the application startup).
But I wouldn't recommend this approach, I would recommend a proper designed database where you can put your csv data into. This way you would have the database engine to help you organize your data which would give you scalability and maintainability (although with a proper design of your classes say a DAO pattern would give you the same).
Organized data in a database would give you more flexibility to search through your data using already made SQL functions.
In order to make my case here are some advantages of a Database system over a file system:
No redundant data – Redundancy removed by data normalization
Data Consistency and Integrity – data normalization takes care of it too
Secure – Each user has a different set of access
Privacy – Limited access
Easy access to data
Easy recovery
Flexible
Concurrency - The database engine will allow you to concurrent read the data or even write to it.
I'm not listing the disadvantages since I'm making my case :)
I can read from a CSV file to build your arrays. You can then add the arrays to session scope. The CSV file will only be read at the servlet that processes it. Future usage will be retrieved from session.

Most robust way to store api keys (client side)?

I have created a java daemon program that collects data from social network accounts. I use a lot of services including Flick, S3, GeoCoding, etc. Currently I have the program set up to read all these API keys from a properties file. I also have a similarly formatted properties file in my test folder that contains different keys for testing purposes. These property files are not committed to source obviously. This collection program writes to a mongo db. I am also building a web app that also works with mongo and will be deployed along side the collection. During my development I am reading that it is best to store keys as environment variables on the production side. It got me think; which leads me to my question...
I am wondering if there is a better way to handle these keys in my java program (from a deployment standpoint) or some possible routes that people have tried in doing something similar to this. Can someone shed some light on this?
I would recommend a database. If you are only storing API keys for personal use, then the size of the database isn't probably a major concern. Personally, I would suggest MySQL (or alternatively SQLite) as they are both quite well-supported.
If you encrypt your keys then it shouldn't matter too much where you store your database, although of course I still wouldn't make it openly downloadable. Just pick a good encryption tool and do not try developing your own encryption algorithm!
The latest hotness (in a world of containers) is to use zookeeper, etcd or consul as a distributed configuration store. The confd tool is capable of ensuring that application configuration files are kept in sync with changes to configuration.
My personal preference is Consul which has a similar template tool called consul-template, and another called envconsul if you would prefer your program to consume environment variables.
Finally Hasicorp, the makers of consul, have an encryption product called vault. It works well with consul and is also supported by consul-template.

Java <-> Python: share objects

I have an embedded system using a python interface. Currently the system is using a (system-local) XML-file to persist data in case the system gets turned off. But normally the system is running the entire time. When the system starts, the XML-file is read in and information is stored in python-objects. The information then is used for processing. My aim is to edit this information remotely (over TCP/IP) even during process. I would like to use JAVA to get this done, and i have been thinking about something to share the objects. The problem is, that I'm missing some keywords to find the right technologies to get this done. What i found is SOAP, but i think it is not the right thing for this case, is that true? I'm grateful for any tips.
As I understand, you are using XML file to store start up configuration
And my assumptions on your interface between Java & Python apps
You want your Java application to retrieve objects over Python interface
And process them locally and send it back to Python interface to reload config ?
So, depending on your circumstances, you can workout something with the following
Jython
Pickle (if you have no restriction on startup config file format or can afford to do conversion)
https://pypi.python.org/pypi/Pyro4
Also you can get some ideas from here:
Sharing a complex object between Python processes?
You should ask your python application to open a XML-RPC socket which clients can connect on. This could let an outside application to execute an endpoint, which would manipulate your python object values in someway. There are several good choices for Java XML-RPC libraries, including the amazing org.apache.xmlrpc library.

How to access Clarion Tables from Java

I have this client with this system coded in Clarion. He is needing an webservice in Java to public some APIs from their system.
Does anyone know the best approach to access and modify any given clarion table ( .dat file) ?
You can use Capesoft's Nettalk or Clarion Handy Tools to create a SOAP server that accesses .dat, .tps or any other data Clarion is capable of accessing. The examples provided make it quite simple and these servers perform well.

Categories