How to get total number of Tweets (just counts of tweets) - twitter4j

Is there any possibility to get total number of tweets (just count of tweets ) of particular user. If user X poster 10000 tweets then code return just total number of tweets not actually tweets with text or anything. I am looking for it in java.

If you have an User u you can use u.getStatusesCount() to get the total number of tweets

Related

Webmasters.Searchanalytics.Query rowLimit works strange

I constructed query this way:
...
val request = new SearchAnalyticsQueryRequest()
request.setStartDate(from)
request.setEndDate(to)
request.setDimensions(List("query", "page").asJava)
request.setRowLimit(5000)
request.setStartRow(0)
webmasters.searchanalytics().query(site, request)
result have 3343 rows
I tried to make paging - and for test reasons setup rowLimit at 1000
and i suggest to get 1000 then another 1000, and another 1000 and, finaly, 343 rows
from here https://developers.google.com/webmaster-tools/v3/how-tos/search_analytics
If your query has more than 5,000 rows of data, you can request data in batches of 5,000 rows at a time by sending multiple queries and incrementing the startRow value each time. Count the number of retrieved rows; if you get less than the number of rows requested, you have retrieved all the data. If your request ends exactly on the data boundary (for example, there are 5,000 rows and you requested startRow=0 and rowLimit=5000), on your next call you will get an empty response.
but i got only 559 rows !
when i set rowLimit at 100 - i got 51 rows!!!
What i doing wrong? :)
I noticed the same behavior, that looks like data sampling.
You can get more results (and then more accurate metrics) by fetching data day-by-day through multiple queries, instead of only one query ranging between two dates.
Hope, it helps!

Operation on a sliding window over streaming in Scala using reduceByKeyAndWindow()

I am writing a Spark streaming application, using Scala, where my goal is by reading the Twitter feed every second to calculate the most retweeted statuses in a window of 60 seconds.
What i conceptually want is to get the number of retweets of a status at the end of the sliding window and subtract it from the equivalent number at its start, in order to find the no. of retweets inside the window. The relevant line of code is:
val counts = tweets.filter(_.isRetweet).map { status =>
(status.getText(), status.getRetweetedStatus().getRetweetCount())
}.reduceByKeyAndWindow(*function*, Seconds(60), Seconds(1))
So, my question is what function should I use here to achieve the desired result, that is to get the maximum value that getRetweetCount() returns inside the window and subtract the minimum value from it.
Correct me if I'm wrong or making misassumptions here, but you are essentially checking the number of retweets for a status within your window of Seconds(60). To do this, you already have your filter which removes all non-retweeted tweets (filter(_.isRetweet)). Now, all you need to do is an aggregation of the retweeted statuses to determine their frequencies.
This can be achieved with the following:
val counts = tweets.filter(_.isRetweet).map { status =>
(status.getText(), null)
}.countByValueAndWindow(Seconds(60), Seconds(1))
Perhaps after this, you can order by value and gather the most retweeted tweets within that window.

crystal report summary calculation

I have a listing of clients grouped by zip code. i have only an interest in the total number of clients in each zip code grouping. I am trying to limit my report to a certain number of groups determined by the user entering a percent as a parameter. For example this is the list of zip code information
zip code c 50 clients 50% of total clients
zip code d 25 clients 25% of total clients
zip code e 10 clients 10% of total clients
zip code a 10 clients 20% of total clients
zip code b 5 clients 5% of total clients
(They have been sorted in order descending order)
Print the report listing the top 80% of total clients.
I have tried using the percentofdistinctcount summary field but I can't get the program to add the values together to meet but not exceed the percentage given as the parameter, 80% in this case. If I try to enter Sum(percentofdistinctcount(fieldname)) I get an error telling me the field can't be summarized.
thanks
To the extent you understand the problem use below solution.
You are using a parameter for the percentage and at the same time you are showing data with that input of the paramter.
In this case you need to calculate percentage for all zipcodes in the report and then conditinally supress as per the user input.
Example:
if percent value<80
then false
else true
After the supress apply your summation contion on the displayed results.
If this doesn't help you I apologize

How to obtain the total number of photos in one area using the panoramio data API?

I am trying to get the total number of photos from one specific area using the panoramio data API.
The following code
www.panoramio.com/map/get_panoramas.php?set=full&from=0&to=0&minx=-180&miny=-90&maxx=180&maxy=90&mapfilter=false
returns
{"count":72543250,"has_more":true,"map_location":{"lat":-46.647137999999998,"lon":-72.607527000000005,"panoramio_zoom":0},"photos":[]}
count should be around 100 000 000 (the total number of photos in panoramio) and not 72 543 250 and I guess the value of "has_more" should be false.
Thanks in advance.
The difference between the total number of photos according to the API and the actual total number of photos in Panoramio is that the API only returns geo-referenced photos and not all photos in Panoramio are geo-referenced.
The 100,000,000 are recent ID, because some ID are deleted, so REAL number may be lower.

Maximum number or results from a FQL query

Is there a limit to the maximum number of results (considering selecting only a field from a table - ex: uid from users) one can get with a single FQL query?
Ex: select uid from users where condition has a 1M sized results set -> how many of those 1M would be returned to the caller?
According to a blog post made by the Facebook on same issue the limit stands at 5000 results before the visibility check kicks in reducing even further the result set.