OnTap API: How can I get volume attributes? - java

I am using OnTap API and I am talking to 7-Mode NetApp filer. I am able to get a list of volumes, but I cannot figure out how to get volume attributes. I tried to use VolumeGetIterResponse class, here is a code snippet:
VolumeGetIterRequest volumeGetIter = new VolumeGetIterRequest();
volumeGetIter.setMaxRecords(100);
List<VolumeAttributes> volAttributes = volumeGetIterResponse.getAttributesList();
for (VolumeAttributes vas : volAttributes) {
VolumeExportAttributes vs = vas.getVolumeExportAttributes();
}
When running this code, I get an error:
Unable to find API: volume-get-iter
Please help me figure out where I am going wrong. Your help is greatly appreciated.

From your error, it appears you're using the "volume-get-iter" API. This is a Cluster-Mode API. Since you're talking to a 7-mode, you will need "volume-list-info".

Related

InvalidProtocolBufferException trying to get main module package id

I'm trying to set up an app using java ledger api and based on the ping pong example. However, the method "containsModule" is throwing the exception:
InvalidProtocolBufferException.java
"Protocol message had too many levels of nesting. May be malicious. Use CodedInputStream.setRecursionLimit() to increase the depth limit."
on this line:
//parse the archive payload
DamlLf.ArchivePayload payload = DamlLf.ArchivePayload.parseFrom(getPackageResponse.getArchivePayload());
Can you please help on this?
Thanks.
Often the packages are too big for protobuf to digest. As suggested by the error, you can set the recursion limit explicitly, e.g.
CodedInputStream cos =
CodedInputStream.newInstance(getPackageResponse.getArchivePayload());
cos.setRecursionLimit(1000);
DamlLf.ArchivePayload payload = DamlLf.ArchivePayload.parser().parseFrom(cos);
We'll fix the example, thanks for pointing this out.

Can't set options to LibVLC

I have been trying to utilize the Android SDK from Maffen:
https://github.com/mrmaffen/vlc-android-sdk/ in order to stream RTSP.
So I found the following stack overflow thread:
vlc-android-sdk - cannot view RTSP live video
Which has a number of answers of how to do this.
However, the problem I am having is that when I try to set the options for LibVLC it will not allow me to do so.
For example:
ArrayList<String> options = new ArrayList<String>();
options.add("--no-drop-late-frames");
options.add("--no-skip-frames");
options.add("--rtsp-tcp");
options.add("-vvv");
videoVlc = new LibVLC(options)
When I try to run this I get the following error message in Android Studio:
"error: incompatible types: ArrayList cannot be converted to Context"
Also if I hover over the "LibVLC(options)" section of the code it comes up with the following message:
"LibVLC (android.content.Context) in LibVLC cannot be applied to (java.util.ArrayList)
I'm no Java expert, so perhaps this is an easy fix but I have been trying different sample codes from around the internet all day and every single one sets those options and I can't do it.
Any help would be much appreciated. Thank you!
EDIT:
This problem was solved using the following:
videoVlc = new LibVLC(this, options);
I had simply forgot about including the context part of the LibVLC.
I forgot to go back and edit this once I had arrived at a solution.
maffen vlc android sdk. the constructor LibVLC takes two params. context and options. option can be null. and options should be the second one. the older version may only takes one param option

TwilioRestClient for java not working

I have been trying to use the TwilioRestClient.Builder class in order to send out an sms using my Twilio number.
I have been using this piece of code within a MessageCreator class:
messageCreator = new TwilioMessageCreator(
newTwilioRestClient.Builder(credentials.getAccountSid(),credentials.getAuthToken())
.build()
);
However, when I use this piece of code in another class, I receive this exception:
java.lang.NoClassDefFoundError: org/apache/http/ProtocolVersion com.twilio.http.TwilioRestClient$Builder.<init>(TwilioRestClient.java:66)
This seems to indicate some problem with the TwilioRestClient.Builder() method, but I am unable to identify the issue.
I hope I can get an answer to this!
It is possible you are using version 6.x at the moment, the example of TwilioRestClient.Builder you are looking at is for version 7.x of the java library.
You can check here how you send messages with version 6.x: https://www.twilio.com/docs/api/rest/sending-messages
Please let me know if this helps.

Adding campaign in google AdWords

I have a problem during creating the campaign. I have test account on google Adwords. I used code from google: AddCampaigns.java
Im getting error:
[OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED # class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN, OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED # class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN]
It occurs in line:
// Add campaigns.
CampaignReturnValue result = campaignService.mutate(operations);
I found one problem this type on a google dev webpage, however the 'solution' did not help. Anyone have any idea why is it happening?
Thank you so much and have a nice day!
I solved it setting the clientCustomerId.
With Google AdWords Account you can manage several clients account with several campaigns.
Example of my c# code:
// Get the CampaignService.
CampaignService campaignService =
(CampaignService)_user.GetService(AdWordsService.v201409.CampaignService);
// Set ClientCustomerId
campaignService.RequestHeader.clientCustomerId = myClientCustomerId;

Arcgis Map : PictureMarkerSymbol

Hie everybody, i am trying to make a PictureSymbolMarker in my arcgis map..
However i am facing some problems in it. i went to esri website [ http://blogs.esri.com/esri/arcgis/2012/02/03/esri-picture-marker-symbol-generator-for-javascript-developers/ ] to get a pin url .
When i tried to implement it in my codes,
i received error .
This is how i put it together
From
`//Marker
SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED,
20, SimpleMarkerSymbol.STYLE.CIRCLE);`
To
`SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol
({"angle":0,"xoffset":0,"yoffset":12,"type":"esriPMS",
"url":"http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png",
"contentType":"image/png","width":24,"height":24});`
But after implementing that codes, i received errors. .. Anybody have face the same problem and are enable to troubleshoot it?
Thanks in Advance
your issue is that you are using JSON for a PictureMarkerSymbol and initializing a SimpleMarkerSymbol which will never work. Try to do like this.
var resultSymbol = new esri.symbol.PictureMarkerSymbol
({"angle":0,"xoffset":0,"yoffset":12,"type":"esriPMS",
"url":"http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png",
"contentType":"image/png","width":24,"height":24});
You're using JavaScript object notation (JSON) syntax in your Java code for Android. It won't work.
#azmuhak is on the right track though. You need to create a PictureMarkerSymbol instead of a SimpleMarkerSymbol. But you need to do it the Android way, not the JavaScript way.
Here's some sample code for creating a PictureMarkerSymbol, creating a GraphicsLayer, adding the GraphicsLayer to the map, and adding a new Graphic to the GraphicsLayer (run this code after the map is loaded, maybe using MapView.setOnStatusChangedListener):
PictureMarkerSymbol pms = new PictureMarkerSymbol(
"http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png");
pms.setAngle(0f);
pms.setOffsetX(0f);
pms.setOffsetY(12f);
GraphicsLayer graphicsLayer = new GraphicsLayer();
mMapView.addLayer(graphicsLayer);
graphicsLayer.addGraphic(new Graphic(new Point(12, 34), pms));
Side note: it is possible in Android to parse a JSON string to make a PictureMarkerSymbol. But in this case, my sample code is easier and less error-prone.

Categories

Resources