Oauth and Jtwitter - twitter

I am trying to use Oauth with jTwitter.. and get an exception while creating the Oauth signpostclient
String JTWITTER_OAUTH_KEY="GDdmIQH6jhtmLUypg82g";
String JTWITTER_OAUTH_SECRET="9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8";
OAuthSignpostClient client = new OAuthSignpostClient(JTWITTER_OAUTH_KEY, JTWITTER_OAUTH_SECRET,"oob");
throws the following exception
Exception in thread "main" java.lang.NoSuchMethodError: oauth.signpost.AbstractOAuthConsumer.(Ljava/lang/String;Ljava/lang/String;)V
at winterwell.jtwitter.OAuthSignpostClient$2.(OAuthSignpostClient.java:182)
at winterwell.jtwitter.OAuthSignpostClient.init(OAuthSignpostClient.java:182)
at winterwell.jtwitter.OAuthSignpostClient.(OAuthSignpostClient.java:144)
at jay.twitter.HelloTwitter.main(HelloTwitter.java:16)
What am I doing wrong? Can anyone help pls.

You need to download the signpost oauth jar and add it to your classpath/project.
JTwitter works with a few different oauth libraries, but the download doesn't include any of them.
By the way, itls a good idea to get your own key & secret by registering at dev.twitter.com.

download signpost.jar
add it to your class path/project
Hope will get solution

You probably has no OAuth library.
There is a number of libraries available, but I recommend using signpost.
If you are using eclipse, you should do this by:
right clicking on the project -> Build Path -> Configure Build Path
And then click "Add Jar" if the signpost jar is in within your files or "Add External Jar" if it is somewher else.
Finally, you should have an twitter app in order to twitter talk to yout app and have the strings for . In order to do this, you should sign up your twitter account as developer in developer.twitter.com and then create your app on twitter. And then you will have your own values for JTWITTER_OAUTH_KEY and JTWITTER_OAUTH_SECRET (if you don't have yet).

Related

How to use swagger file locally?

Hi I have a swagger file written for my API and I could not test the paths of my API since I am getting: ERROR Server not found or an error occurred because my paths are all localhost, so how can i use swagger locally? thank you
I found a solution which is using the building from source way in swagger-editor
Assuming you are developing within Visual studio click the green play looking button to build & run your solution , a browser should now pop up. ignore whatever it comes up with and type localhost/swagger and it should provide you with the interface. Let me know what happens or if you require any assistance

Building Passbook Passes

I've been working on integration of Passbook for some of my apps. Right now, I've used Ray Wenderlich's tutorial on this, and it is quite frankly a pain to build even one Pass. I have to get the icon files all in place, program the JSON file, get the manifest file filled in with all the SHA1 values, and run a few lines in terminal to sign it, and then another line to zip it. Are there any online services or programs that can be used to save a pkpass file to computer, that I can then upload to my server?
There are also quite some developer tools that help you to create passes, you can find a list on wikipedia.
We provide an Objective-C SDK and a free cloud service that lets you create templates and generate passes. You can find the SDK on github (Sample App is included).
There are a number of services that can be used to generate passess. Take a look on wikipedia for a comprehensive list of providers, tools and projects.
If you want to update passes, then you will need to build a Passbook Web Service. When a pass is updated, the web service sends a new .pkpass bundle to the device. Therefore, your web service must also be capable of signing passes unless you want to manually create and upload them to your server before sending out a push request.
Using our service, PassKit, you can create a template using WSIYWIG editor then create a pass directly on your server via a simple API call. You can also update passes and push updates to passes via our API. If you just want to get hold of the .pkpass bundle, then you can append /d to the pass URL (the one beginning with r.pass.is), or use PassKit API in your User Agent string.
you should also check out Apple's Passbook Support Materials here:
https://developer.apple.com/passbook/
They have a simple XCode project called SignPass that you can use to easily create your own Passes.
Note: you need to be a member of Apple's Developer program to access these materials ..
There's lots more Passbook related info here:
http://www.flonsolutions.com
Andrew

Google oAuth example

I'm looking for a worked example of how to call into Googles oAuth service with a view to simply uploading a txt file. On googles docs I have the followed the example
http://code.google.com/p/google-api-java-client/wiki/OAuth2
but it won't compile .... CalendarScopes.CALENDAR is the problem and I can't see what Jar contains this class. I imported every Jar in the google-oauth-java-client-1.12.0-beta download (Also every jar in google-api-java-client-1.12.0-beta ) I dobn't understand the diff between these but that is for another day.
Any pointers would be welcome.
CalendarScopes.CALENDAR that you mentioned is not a part of a jar file but a scope for Calendar API provided by Google. For a sample to show how to implement that, here is one.
In the meanwhile, I would also suggest going over the following links to develop an understanding of the OAuth and how to use it with the different APIs.
OAuth Playground - This is very helpful when trying to learn about different API and permissions relating to those.
OpenID Connect Official Documentation
Hope this helps.

Launch intellij via URL

Would it be possible to register some protocol
and then launch IntelliJ via an URL. I am
thinking of submitting the URL via Desktop.browse()
from within a JVM.
My idea is that the URL would consists of
a file name parameter and a line number parameter.
And IntelliJ would then open this file name and
scroll to the given line number. Here is an
example:
intellij:/mypath/myfile#99
Has this already been done?
Bye
P.S.:
java.awt.Desktop Class
http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html
Check IDEA-65879 for existing workarounds or vote for the issue so that it's available out of the box in the future versions.
One of the suggested solutions is the Remote Call plug-in.
You could use IntelliJ Platform REST API.
Example to check: http://localhost:63342/api/about
Use Postman to send these requests.
For me, it works on IntelliJ Idea but unfortunately, on Android Studio it doesn't work.
Asked this question about it.

Twitter APIs for blackberry implementation

I am trying to implement the blackberry application which will help the user to update his status through application.
Its like user will enter the username, password and status it will update his status on twitter.
I have seen Twitter API docs but didnt understood how to start. It has many things like application registration and OAuth process which i felt very ambiguity.
I have also tried to use some external jar for blackberry but some of its classes/packages is not supported
twitter4j-core-2.1.1-SNAPSHOT.jar ----> Error preverifying class twitter4j.TwitterBase
java/lang/NoClassDefFoundError: java/io/Serializable
jtwitter.jar ---> VERIFIER ERROR org/json/Test.main([Ljava/lang/String;)V:
Cannot find class java/io/StringWriter
signpost-core-1.2.1.1.jar ---> Error preverifying class oauth.signpost.http.HttpParameters
java/lang/NoClassDefFoundError: java/util/Map
Please friends help me with how to start. it will be appreciated if any link or jar which support on blackberry can shared.
For a 10,000 mile view, you first need to preverify your jar files using the preverify.exe tool in the bin directory of your simulator.
You then need to create a new project, change the project type from CDLC -> Library and add your twitter4j-*.jar to it. Set this project as a reference (right click your main project and it's somewhere in the properties) to your main project. Next, configure build path for the main project and add twitter4j-* to your build path.
A detailed view with screenshots for eclipse is provided for a different library at -
http://www.craigagreen.com/index.php?/Blog/blackberry-and-net-webservice-tutorial-part-1.html
More info -
http://supportforums.blackberry.com/t5/Java-Development/Tutorial-How-To-Use-3rd-Party-Libraries-in-your-Applications/m-p/177543
If it's a simple tweet, you might be better of just doing a HTTP POST with the appropriate parameters.
Check URLEncodedPostData and HTTPConnection for more info about HTTP Post requests.

Resources