I'm using Maven with Java and am trying to parse JSON from Reddit but am getting a response code 492 every time. I need to change the user agent but have no idea how to do this.
I looked at this question: How can the user-agent be changed in Maven? and the link provided in the answer but this doesn't seem to work for me.
Any ideas?
Related
I have been trying for the past day to get at least google's sample code working. Every single of their sample code have dependencies issues or errors within the code (even they have stated in quick start thats a copy/pasta code to test the api - never works). I have installed all of the dependencies, I pointed the jar file to the missing imports, but no success in that..
Can anyone tell me where is the problem when my jar is in dependencies but it never finds it?
I wish they had a normal way of taking json data - via url, but they disabled this.
My goal is setting the URL for the profile picture of an existing user.
I'm using the Google Identity Toolkit Java library on App Engine.
Below is my code:
GitkitUser u = gitkitClient.getUserByLocalId(localId);
u.setPhotoUrl(profilePictureURL);
gitkitClient.updateUser(u);
where gitkitClient' is my GitKit client, already initialized with the right parameters, andlocalId' is the id of the user I'd like to update.
This code causes the following exception:
org.json.JSONException: JSONObject["localId"] not found.
Documentation is hard to find for this library. I'd be glad if someone could suggest me what I'm missing there.
Thanks for reporting the bug. It will be fixed in one or two days.
[UPDATE] It's fixed. I manually tested and verified. Please also use the newest version of java library. You can get it from here or from maven update.
I'm trying to download some code samples from the Openoffice wiki site (https://wiki.openoffice.org/wiki/API/Samples) but so far without success. I use the Tortoise SVN client and to download the code I have created a new folder on my Windows PC. I then right click on this folder and choose "SVN Checkout", add the URL of repository (in this case "https://wiki.openoffice.org/wiki/API/Samples") and click. However I get the error "Server sent unexpected return value (503 Service Unavailable) in response to".
Can anyone say what I'm doing wrong here? I know very little about Tortoise SVN and have never used it before.
First of all, the url you are using is not the correct one as Keugyeol already pointed out, but still the "official" link will not work because the host name is no longer active.
However, the following is supposed to be a mirror of that site and you should be able to get your examples downloaded from there. (https://github.com/vmiklos/lo-sdk-examples)
That's not the correct URL. If you go into that URL, you'll find the sample command under the section Checkout the sourcecode i.e. the correct URL seems in the form of svn://svn.services.openoffice.org/ooo/contrib/sdk/examples/java
I am trying to complete the StackMob hello_world tutorial for custom code found here:
https://www.stackmob.com/devcenter/docs/Getting-Started:-Custom-Code-SDK#a-register_your_method
but when I try to run the client-side iOS code it says:
{NSLocalizedRecoverySuggestion={"error":"hello_world is not an existing schema"},
I tried to do a POST request to ReadParams from their example project and that created the schema and returned correctly. Maybe GET requests don't modify schemas, but then how do they expect you to do the hello_world example?
Thanks!
[EDIT]: I got this working by making sure the package is of the correct java package form with src directory, etc. Then I changed my package name and forgot to change the pom.xml file to reflect that.
This happens when the API doesn't think there is a custom code method registered with that name yet. When you go to the settings page for the custom code module, you should see a list of the custom code methods available in the JAR which you uploaded.
If you don't see any such methods, then it is likely something went wrong trying to validate the JAR you uploaded. Feel free to contact support#stackmob.com with any questions specific to your app's custom code!
(Disclaimer: I'm a StackMob engineer)
I've been having tremendous problems with connecting my android app to the youtube API. Firstly I tried to go along the route of using the native youtube gdata java client(http://code.google.com/p/gdata-java-client/). I had read that this could then be integrated into an android app easily enough and so I set about doing that but I would stumble every time at the line
YouTubeService ytservice = new YouTubeService("AppName",Dev_Key);
I'd enter the correct details here, even have all the necessary external jars but every time I would be given a NoClassDefFoundError reporting that YouTubeService could not be found and neither could it's superclass, MediaService. (Just so you know, I had gdata-youtube-2.0.jar, gdata-client-1.0.jar, gdata-media-1.0.jar, guava.11.0.2.jar and jsr305.jar)
So then I tried which appeared to support android (http://code.google.com/p/google-api-java-client/wiki/Android). There was even a sample example where google tasks had been integrated so it looked promising. It didn't have an actual YouTube class like it did have a taskService but it did support OAuth 2.0 login which I could work with by just sending off URL requests to the youtube API with OAuth 2.0 authentication. I tried this but when the only key I could get from it in combination with android's AccountManager was an auth key token. Posting this with the URL request to google resulted in an 'authentication required' response from youtube(because i was providing an incorrect access token, it was at least twice the size of a working access token i was comparing it with).
How can I find the access token that I need for the youtube API from the AccountManager? Or even better, how can I get the YouTubeservice to work?
Thanks
rory
Edit
Amad, thanks for the answer but unfortunately that is what i am already doing:
(source: themobilelook.com)
maybe it'll help if i supply my project folder: here it's a barebones setup, literally just to test if the YouTubeService works.
using adt 20, jdk compliance level 1.6
if you manage to create a working version then itnwoild be great if you could share it
The YouTube API library/libraries must be included in the project. By going to the Project Properties > Build Path > Order and Export tab, you can tick the checkbox next to the all YouTube-API-related libraries to ensure that they will be included in the project when you export it. Make sure to clean and rebuild after doing this.
As for the access token... not totally sure. The documentation may help there. This Google Groups thread may help also.
If you get NoClassDefFoundError during Runtime, then I suspect you did not include them to work at runtime. You have to check the checkbox for each .jar like this:
(Of course you have to add them to your java build path first)