I am currently using the java-version of the Riot api, made by rithms,
(https://github.com/rithms/riot-api-java)
and I am trying to receive the name of a champion, as I am currently "just" able to get the id.
RankedStats rankedStats = api.getRankedStats(api.getSummonerByName("AscendedKitten").getId());
Now, when printing out the results of
rankedStats.getChampions();
it will (of course) return the Ids.
I noticed that
net.rithms.riot.dto.Champion.Champion
has a methode returning the name, but (because I am failing at reading the Documentation) I haven't found out how to cast / get an instance of the object yet.
I am sorry for the basic-question, and I hope you don't have too much trouble trying to help me :3
Thanks in advance!
Use the RiotApi class' getDataChampion(Region region, int id) method, then use the getName() method on the champion it returns.
Related
So this is not much of a "I have a bug how to fix it" question as much as "Is this really how this works?" question.
So, I am looking over my code to persist an entity into datastore, and if I try to set an attribute that is null, all hell breaks lose. I noticed that there's a setNull but is that it? I have to manually check every attribute before building it in order to call the appropriate set? Shouldn't the standard set, which is overloaded for a plethora of datatypes handle null on itself?
Here is a code piece
public void put(BatchExecution obj) {
Key key = keyFactory.newKey(obj.getId());
FullEntity<Key> incBEEntity = Entity.newBuilder(key)
.set(BatchExecution.ID, obj.getId())
.set(BatchExecution.NAME, obj.getName())
.set(BatchExecution.CREATETIME, obj.getCreateTime())
.set(BatchExecution.ELAPSEDTIME, obj.getElapsedTime()) //I break the code because elapesedTime was never set in the object
.set(BatchExecution.STATUS, obj.getStatus().name())
.build();
datastore.put(incBEEntity);
}
Am I missing something here or is this really how the API works?
Concern raised on github
https://github.com/GoogleCloudPlatform/google-cloud-java/issues/3583
Question has been closed.
I use iText 5 in Android Studio to create a PDF document but I get an error:
I also tried
p.add((Phrase)c);
but I get same error :-(
How I can get rid of this error?
"ambiguous" error comes up when u already have a file/varibale etc with same name.
for example when you make a project using entity framework , entity framework make class and dbcontext files for u. but if u add a class with same name as entity framework had made for u then this error comes up. check ur project/programe correctly and fully again...
Hope its helpfull !!
and checkout this link for ur answer Android Studio - Ambiguous method call getClass()
thanks for reply - indeed I needed help regarding why 'ambiguous' appears in this context.
But now the problem is solved - this error does not appear anymore - but I don't know exactly why.
I did some Android Studio updates last week may this helped?
Thanks anyway!
In case when we use data binding, some java files are auto-generated
The problem was occured when a getter/setter has the same name with a function.
eg
var newData
fun getNewData()
in this case, in the generated java file, the variable's getter has the same name with the function => getNewData.
So simply you have to change variable name or fuction name
I'm using the Java SDK to connect to Box. I find the root folder (this is a small dev instance so I don't mind searching from there.) I execute the search query and I get results. My problem is that the search parameters do not seem to work consistently or at all.
For example, this query
Iterator resultSet = rootFolder.search("query=NR_chewy_chic_swt_pot_app&file_extensions=jpg&content_type=name&type=file").iterator();
returns three entries.
NR_chewy_chic_swt_pot_app.jpg
NR Chewy Chicken AD02.xls
PreInvoice_M197301-3644756_NR Chewy Treats SURP.pdf
I remove the substring "&file_extensions=jpg" because it doesn't seem to do anything and save/recompile/run and I get the same three results.
I change "&type=file" to "&type=folder" and I get the same three results.
I change "query=NR_chewy_chic_swt_pot_app" to "query=NR" and I get NO results. Even though SO user Peter (who appears to work for Box) says that partial strings should match1.
I've tried rearranging the order of the search parameters to no avail. What am I missing?
Thanks,
Eric B.
Advanced search has yet to be implemented in the SDK (since it's still in beta), but it will be added in the coming weeks.
The reason why your call doesn't work is because the query method parameter is sent as the "query" URL parameter in the API call. Therefore, the ampersands in your query string are being escaped.
If you need an immediate workaround, you can use the BoxAPIRequest and BoxAPIResponse classes to make a custom search request. For example:
BoxAPIConnection api = new BoxAPIConnection("token");
URL url = new URL("https://api.box.com/2.0/search?query=NR_chewy_chic_swt_pot_app&file_extensions=jpg&content_type=name&type=file")
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
String json = response.getJSON();
Sorry that this wasn't clear. We'll update the documentation to make it more explicit that query represents the query field and not the URL query string.
I am using LinkedIn-J. My application authenticates without problem, I get data from the user - even their first name, last name etc.
Person profile = client.getProfileForCurrentUser();
profile.getFirstName();
However, when I try to get the list of educations, the Educations object returned is null:
Educations educations = profile.getEducations();
educations == null
What can be the error? Should my application ask for special permissions to be granted?
I've never used the Linkedin-j api before, but according to the LinkedIn api you get firstname, lastname, headline, and some url by default.
So I believe you need to specify that you want education returned. I don't know how to do that in LinkedIn-J though.
http://developer.linkedin.com/documents/profile-api
For example, with the rest api you'd use this uri:
http://api.linkedin.com/v1/people/id=12345:(first-name,last-name, educations)
Using the LinkedIn J library, it seems like you have to add profile fields using Set as a parameter to one of their many methods in the client.
Example of a method you could call of many (if you have a connected user):
public Person getProfileForCurrentUser(Set<ProfileField> profileFields)
ProfileField is an Enum located here:
import com.google.code.linkedinapi.client.enumeration.ProfileField;
I am a newbie trying to write a program to get a database of dress images from eBay using the finding API. I am programming in Java and using Windows 7 OS. After taking the keyword to be searched for from the user, I used the FindItemsAdvanced call for getting the list of products under that category. I want to get the attributes of each of those items like colour, sleeve length, etc. For this, I used AspectHistogramContainer to get the aspects and the values. The code snippet is below:
AspectHistogramContainer aspectContainer=new AspectHistogramContainer();
aspectContainer=advanceResponse.getAspectHistogramContainer();
aspectContainer.setDomainDisplayName(keywords);
aspectContainer.setDomainName(keywords);
List<Aspect> aspectList=aspectContainer.getAspect();
for(Aspect aspect:aspectList)
{
System.out.println(aspect.getName());
List<AspectValueHistogram> aspectValueList= aspect.getValueHistogram();
for(AspectValueHistogram aspectValue:aspectValueList)
{
System.out.println(aspectValue.getValueName());
}
}
advanceResponse is the FindItemsAdvancedResponse Object.
But the AspectHistogramContainer is always only null, i.e the items have no aspects. I gave only leaf categories as input as required by AspectHistogramContainer. I have tried all avenues but cant find the reason.Could somebody please tell me what is wrong?
Figured it out! I had to set the category Id for the GetHistogramRequest object and then use that object to get the AspectHistogramContainer. The code snippet is below:
GetHistogramsRequest abcd = new GetHistogramsRequest();
abcd.setCategoryId(CatID.toString());
GetHistogramsResponse bb = port.getHistograms(abcd);
advanceResponse.setAspectHistogramContainer(bb.getAspectHistogramContainer());
AspectHistogramContainer aspectContainer=new AspectHistogramContainer();
aspectContainer=advanceResponse.getAspectHistogramContainer();
aspectContainer.setDomainDisplayName(keywords);
aspectContainer.setDomainName(keywords);
List<Aspect> aspectList=aspectContainer.getAspect();
for(Aspect aspect:aspectList)
{
System.out.println(aspect.getName());
List<AspectValueHistogram> aspectValueList= aspect.getValueHistogram();
for(AspectValueHistogram aspectValue:aspectValueList)
{
System.out.println(aspectValue.getValueName());
}
}
CatId is the categoryId and advanceResponse is the FindItemsByAdvanceRequestObject.But this still only gives the aspects under each category. To get the specific aspect of each item under that category, aspect filter should be used. I am not sure of how to initalise the aspect values for each aspect in the aspect filter and how to associate it with a response object. Any ideas?