Setting up Twitter API, getting the last few Tweets

So you REALLY don’t want to do this client-side anymore. (Just went through numerous docs, and devs suggest to do all oAuth server-side) What you need to do: First: sign up on https://dev.twitter.com, and make a new application. Second: NOTE: Your Consumer Key / Secret along with Access Token / Secret Third: Download Twitter OAuth … Read more

Incorrect string value: ‘\xF0\x9F\x8E\xB6\xF0\x9F…’ MySQL

I was finally able to figure out the issue. I had to change some settings in mysql configuration my.ini This article helped a lot http://mathiasbynens.be/notes/mysql-utf8mb4#character-sets First i changed the character set in my.ini to utf8mb4 Next i ran the following commands in mysql client SET NAMES utf8mb4; ALTER DATABASE dreams_twitter CHARACTER SET = utf8mb4 COLLATE … Read more

TwitteR, ROAuth and Windows: register OK, but certificate verify failed

I had received the error you described above in the past, but this has worked for me. #======================================================================================= ## ON windows, we need to dowload the certificate for OAUTH ## NOTE: you will need to setup an app on Twitter ## dev.twitter.com <- get your KEY/SECRET #======================================================================================= ########################################################################## ## Load packages ########################################################################## library(twitteR) library(ROAuth) ## … Read more

Best HashTag Regex

If you are pulling statuses containing hashtags from Twitter, you no longer need to find them yourself. You can now specify the include_entities parameter to have Twitter automatically call out mentions, links, and hashtags. For example, take the following call to statuses/show: http://api.twitter.com/1/statuses/show/60183527282577408.json?include_entities=true In the resultant JSON, notice the entities object. “entities”:{“urls”:[{“expanded_url”:null,”indices”:[68,88],”url”:”http:\/\/bit.ly\/gWZmaJ”}],”user_mentions”:[],”hashtags”:[{“text”:”wordpress”,”indices”:[89,99]}]} You can use … Read more

twitter integration on android app

This is how I do it First i made a Dialog for the webview Twitter_Dialog.java public class Twitter_Dialog extends Dialog { static final int BLUE = 0xFF6D84B4; static final float[] DIMENSIONS_DIFF_LANDSCAPE = { 20, 60 }; static final float[] DIMENSIONS_DIFF_PORTRAIT = { 40, 60 }; static final FrameLayout.LayoutParams FILL = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); static final … Read more

regex for Twitter username

(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9-_]+) I’ve used this as it disregards emails. Here is a sample tweet: @Hello how are @you doing @my_friend, email @000 me @ whats.up@example.com @shahmirj Matches: @Hello @you @my_friend @shahmirj It will also work for hashtags, I use the same expression with the @ changed to #.

Is there a way to get an user’s email ID after verifying his/her Twitter identity using OAuth?

The user’s email address can not be retrieved via the API. This is a deliberate design decision by the API team. UPDATE 2015.08.18: It is possible to request an email address from users, but it requires your app to be whitelisted. See https://dev.twitter.com/rest/reference/get/account/verify_credentials for details of the API call and this form to request whitelisting … Read more

{” was not expected.} Deserializing Twitter XML

Either decorate your root entity with the XmlRoot attribute which will be used at compile time. [XmlRoot(Namespace = “www.contoso.com”, ElementName = “MyGroupName”, DataType = “string”, IsNullable=true)] Or specify the root attribute when de serializing at runtime. XmlRootAttribute xRoot = new XmlRootAttribute(); xRoot.ElementName = “user”; // xRoot.Namespace = “http://www.cpandl.com”; xRoot.IsNullable = true; XmlSerializer xs = new … Read more

tech