Sample application using AlchemyAPI - alchemyapi

I tried sample Java program to call each of below Alchemy API for a text file.
TextGetRankedNamedEntities
TextGetRankedConcepts
TextGetRankedKeywords
TextGetLanguage
TextGetCategory
TextGetTextSentiment
TextGetTargetedSentiment
TextGetRelations
TextGetCombined
TextGetTaxonomy
Individual results look good. But is there any sample Java application using these APIs? Showing how the XMLs given by AlchemyAPI will be used to deduce a meaningful business insight.

The Watson Developer Cloud Java SDK supports the AlchemyAPIs and it uses Objects instead of returning the XML so it's pretty easy to integrate with an existing Java application.
For example, the code belows uses the AlchemyVision API to recognize faces in an image.
AlchemyVision service = new AlchemyVision();
service.setApiKey("<api_key>");
File image = new File("obama.jpg");
ImageFaces faces = service.recognizeFaces(image, true);
System.out.println(faces);

Related

Why are FSGetCatalogInfo and getResourceValue giving different results?

I have a piece of file access code which uses FSGetCatalogInfo to get info about a bundle (say .xyz) which itself contains a file with extension .xyz. Because FSGetCatalogInfo has been updated, I am looking to replace it with 'getResourceValue' API from Foundation layer. However, the OSType is coming incorrect from the new API.
I have also looked into the related FSSetCatalogInfo API. Do I need to do something equivalent such that the 'getResourceValue' API will start giving correct results?

Vizrt API JSON Data integration with Graphics

I want to integrate JSON response from API on VIZRT software. Can anyone help me so as how to read the JSON response and display on the graphics or transition...
Thank you on advance.
The best and easiest way would be to use the DataPool plugins already provided in most Vizrt installations. These plugins don't require licensing and are supported in most versions of the software. There is a plugin titled DataReader which allows you to specify a file or web address to pull Excel, SQL, XML, or JSON information from and it can do this on a regular frequency (every 10 seconds, etc).
You can get a lot of info about these plugins on the documentation site.
Also, when installing make sure to do a Complete installation instead of Typical. That will make sure that all the DataPool plugins are installed.
Firstly, I would suggest for you to read the necessary sections Vizrt Documentation (It will point you to where you can find example projects etc).
There are many different ways of getting Json Feed to Viz GFX, but it all comes down to your requirements.
If you would like to use Viz Trio you could talk to the Media Sequence Engine of default port 6100 preview and 6800 program.
Or you could also communicate directly to the Viz engine using external Application using preferably .Net?
private void SetValueToDocumentByXPath(XmlDocument doc, string xpath, string value)
{
var nav = doc.CreateNavigator();
var it = nav.Select(xpath, nameSpaceManager_);
if (it.MoveNext())
{
it.Current.SetValue(value);
}
}
SetValueToDocumentByXPath(elementDoc,"//vdf:payload/vdf:field[#name='01']/vdf:value", "My new headline");
The line Above Target Tabfield 01, Setting its value to My new headline.
XMlDocument can be fetch from the MSE.

How to register a 'DataSourceFactiry' with 'Geo Server'?

If I have written my own DataSourceFactory, then how can Geo Server recognize my dataSourceFactory? As I know that if we register with org.geotools.data.DataStoreFactorySpi then automatically Geo Server recognizes our data source. But I don't know how to register with Geo Server. I am planning to create a Java project (mvn).
If you are implementing a store you can follow the tutorial at:
http://docs.geotools.org/stable/userguide/tutorial/datastore/index.html
(GeoServer expects to find GeoTools data stores).
In particular, the answer to your specific question is at the bottom of this page, you have to register it in a META-INF/services/org.geotools.data.DataStoreFactorySpi file:
http://docs.geotools.org/stable/userguide/tutorial/datastore/source.html

How to read excel file tibco activities?

I have a requirement to read excel file using tibco palettes.Can any body please throw some lights regarding this. I am basically new to this tibco BW. Please tell me what steps should I follow?
I am assuming you are not referring to CSV files, for which you could use the File Read and Parse activities of BW.
If you want to parse or render a multi-worksheet workbook, you can try publicly available API's such as Apache's POI or commercial API's such as from Aspose to cut your own Java based solution. Then you can use the Java Code or general Java activities to embed and use that code.
And then there's another ready-to-use option available from us: an Excel Plugin for TIBCO BusinessWorks, if you wish to leverage all built-in features of BW (XPath mapping, etc) when parsing or rendering your Excel.
Edit 1:
As per your comment, you can also try the following steps, if you are looking for a more homegrown solution.
Based on one of the (public/commercial) libraries above you can write generic Java Code to parse each cell of each row of each sheet of the workbook. Output should be an XML string. Then create an XSD to match your output. It is at your discretion, which information of the cell you want to read from the workbook - you already are aware of the complexity of the API, I am sure.
Create a BW (sub)process that calls your code from a Java activity, use Parse XML to parse your XML string result into you XSD structure. Configure the End activity to use your XSD and map (copy) your Parse XML result into the End activity.
Then wrap this subprocess into a Custom Activity (General Activities Palette). Create a Custom Palette and now you can re-use what you did in many other BW projects. The path to the custom palettes can be found in TIBCO Designer - Edit- Preferences - General - User Directories
If you add Error Output schemas, you will also get typed error outputs from that custom activity.
HTH,
Hendrik

How To upload a Photo To Azure Blob with SAS from a WP App?

I am able to upload photos to blob with SAS from an Azure MVC web role with the code below:
using (var WS = new HLServiceClient())
{
/* Getting a SAS Write URI */
var sasUri = WS.GetSasUriForBlobWrite(HLServiceReference.BusinessLogicMediaUsage.News, fileName);
var writeBlob = new CloudBlob(sasUri);
writeBlob.UploadFromStream(fileData.InputStream);
}
I would like to do the same thing from a WP app. But I can't figure out how to do it. I DON'T HAVE A LOT OF PROGRAMMING SKILL.
Can you tell me how to upload a photo to blob from a WP app with SAS?
There is a Windows Azure Storage Client Library for Windows Phone available on NuGet: Phone.Storage, it says "Class library for Windows Phone to communicate with Windows Azure storage services directly", I was hoping to find a simple solution using that: http://www.nuget.org/packages/Phone.Storage
I found a video tutorial on the Phone.Storage NuGet:
http://channel9.msdn.com/posts/Using-the-Windows-Phone-Storage-NuGets-for-Windows-Azure
There is also a sample application demonstrating the usage of the Phone.Storage NuGet.
http://www.nuget.org/packages/Phone.Storage.Sample
Still, though, it evades me if I can implement this in my application scenario?
First, you need to generate the SAS from a hosted service. You can use the CloudBlob.GetSharedAccessSignature method (refer to http://msdn.microsoft.com/en-us/library/windowsazure/ee772922.aspx for a sample).
On the Windows Phone side, for small files, you simply need to issue an HTTP request to the SAS URL. You can use HttpWebRequest to do that. Try to search the web, and you can find a lot of samples, such as http://blogs.msdn.com/b/devfish/archive/2011/04/07/httpwebrequest-fundamentals-windows-phone-services-consumption-part-2.aspx.
For large files (larget than 64 MB), you need to divide them into smaller pieces, upload each piece as a block, and then commit the blob list (PUT block list: http://msdn.microsoft.com/en-us/library/windowsazure/dd179467). This is a tedious but not difficult task. You need to create quite a few HTTP requests.
The Windows Azure Toolkit for Windows Phone may also help: http://watwp.codeplex.com/. It contains a library that is similar to the Windows Azure library for .NET.

Resources