RestFB get events in Java - java

Using FQL, by means of which finds events that contain a given word. FQL works only in API version <2.1. By which I use the Graph API Explorer to display events. Eg.
search?q=york&type=event
Example of FQL
SELECT Eid, name, location, start_time, description, pic_small, creator, event venue FROM WHERE start_time> "Sun Jun 21 0:00:35 GMT 2015" AND (CONTAINS ("york")
I would like to make a search events by using RestFB not using FQL, but do not know how. The documentation is scarce.

I answered this already on github, but perhaps someone else find this useful.
Your special case is not in the documentation, but you can transfer the knowledge you find in the documentation and solve your problem: http://restfb.com/#searching
Connection<Event> eventList =
facebookClient.fetchConnection("search", Event.class,
Parameter.with("q", "york"), Parameter.with("type", "event"));
Now, you can iterate over the eventList.
Here you can find how this can be done: http://restfb.com/#fetching-connections

Related

how to read recurring events from outlook pst file using libpst

I'm using the java libpst 0.9.3 (https://mvnrepository.com/artifact/com.pff/java-libpst/0.9.3) to read calendar events from a local outlook pst file.
I struggle to get the proper information for recurring appopintments incl. exceptions.
When scanning the appointments, I use
myAppointment.getRecurrenceType()!= 0
to check whether this is an recurring event and then try to use the class
PSTAppointmentRecurrence(byte[] recurrencePattern,
PSTAppointment appt,
PSTTimeZone tz)
to create a recurrend appointment object but I fail to create an instance of this class.
I tried this:
myRecurrendAppointment= new PSTAppointmentRecurrence(myAppointment.getRecurrenceStructure(), myAppointment, ???)
??? tz= where do I get the system timezone as an instance of PSTTimeZone?
thanks in advance
Chris

How to change date in datepicker using Appium

I'm trying to change the date in a datepicker element using appium. I can't use the findElement(By.id("id"); since I'm running in version 4.2.2(API 17) and as far as i know By.id is not supported in this version. Using selendroid i can change the date like this:
driver.findElement(By.id("MONTH")).sendKeys("FEB");
In my code in appium I try to access it by the default date. For example im trying to change the month like this:
driver.findElement(By.name("Dec")).sendKeys("Jan");
It seems that although it finds the name Dec it can't send the keys Jan.
Here is the error from the Failure Trace:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Any ides on how i can change it and generally if i can use somehow the findElement(By.id("id"); in this API version?
Thanks!!
Instead of using the By.name i used By.className in order to change the month the day and the year. Here is my code:
List<WebElement> date = driver.findElements(By.className("android.widget.NumberPicker"));
date.get(0).sendKeys("Apr");
date.get(1).sendKeys("17");
date.get(2).sendKeys("1972");

How do you query sent items using gmail api?

When I use label:sent as a search query in the gmail UI it takes me to sent items but when I use a labelId of sent from the gmail API for messages (https://developers.google.com/gmail/api/v1/reference/users/messages/list) I get an error "Invalid label: sent" - just wondering how do I query for sent items from the API? Also is there a reference / examples for the type of input you can use for the "q" input parameter for the gmail API?
Thanks
If you're doing a list with "?labelId=" then use "SENT" (in upper case) as per:
https://developers.google.com/gmail/api/guides/labels
(those should probably be case insensitive but they are not.)
For the "?q=" parameter to the list methods it says on the URL you give:
Supports the same query format as the Gmail search box. For example, "from:someuser#example.com rfc822msgid: is:unread".
For more examples, I just tried searching for "gmail search queries" and got:
https://support.google.com/mail/answer/7190?hl=en
which gives lots of useful keywords, they should all work with the "q=" parameter (you may need to URL escape them, depending on language/client libraries).

Finding out the location of tweets downloaded by flume from twitter

I used some keywords and downloaded the tweets from twitter using flume.And the sample data looks like as follows
{"filter_level":"medium","contributors":null,"text":"Messi, Ozil, CR7 & Suarez Bertengger di Lamborghini t.co/SKk8xnnjl7","geo":null,"retweeted":false,"in_reply_to_screen_name":null,"possibly_sensitive":false,"truncated":false,"lang":"in","entities":{"symbols":[],"urls":[{"expanded_url":"dlvr.it/5XH5Vk","indices":[56,78],"display_url":"dlvr.it/5XH5Vk","url":"t.co/SKk8xnnjl7"}],"hashtags":[],"user_mentions":[]},"in_reply_to_status_id_str":null,"id":461450307856130048,"source":"http://dlvr.it\" rel=\"nofollow\">dlvr.it</a>","in_reply_to_user_id_str":null,"favorited":false,"in_reply_to_status_id":null,"retweet_count":0,"created_at":"Wed Apr 30 10:21:41 +0000 2014","in_reply_to_user_id":null,"favorite_count":0,"id_str":"461450307856130048","place":null,"user":{"location":"Subscribe Us","default_profile":false,"profile_background_tile":true,"statuses_count":158496,"lang":"en","profile_link_color":"006400","profile_banner_url":"pbs.twimg.com/profile_banners/251586988/1368528690","id":251586988,"following":null,"protected":false,"favourites_count":1,"profile_text_color":"333333","description":"Latest Breaking News & Software.\r\n\r\nAkun ini dijual Rp150.000","verified":false,"contributors_enabled":false,"profile_sidebar_border_color":"000000","name":"TOP NEWS","profile_background_color":"000000","created_at":"Sun Feb 13 12:54:44 +0000 2011","is_translation_enabled":false,"default_profile_image":false,"followers_count":37879,"profile_image_url_https":"pbs.twimg.com/profile_images/449966329588482048/Rb4azNrv_normal.jpeg","geo_enabled":false,"profile_background_image_url":"abs.twimg.com/images/themes/theme14/bg.gif","profile_background_image_url_https":"abs.twimg.com/images/themes/theme14/bg.gif","follow_request_sent":null,"url":"google.com","utc_offset":25200,"time_zone":"Bangkok","notifications":null,"profile_use_background_image":true,"friends_count":10,"profile_sidebar_fill_color":"DDEEF6","screen_name":"7HotNews","id_str":"251586988","profile_image_url":"http://pbs.twimg.com/profile_images/449966329588482048/Rb4azNrv_normal.jpeg","listed_count":19,"is_translator":false},"coordinates":null}
Now I have to find out the location of the tweets from where it is tweeted.Also i came across some websites in which most answers that "geo" field in above json format gives the location of tweet.But it is null for my most of the tweets.
Please,anyone help me on this...I just rolling my head for two weeks....
Thanks in Advance,
RedDevil
You have two types of locations: geo location and user location.
The user location is not reliables most of the time since users can type in anything they want.
The geo location is the best way for locating a tweet and as you have seen, most of the users do not enable their geo location.
You can use the few geo locations you have depending on what the purpose will be.

How do I filter entities by date range in odata4j?

The odata4j AppEngineConsumerExample demonstrates how to filter entities on string and numeric values with code similar to the following:
reportEntity("\nNon-discontinued product with reorderLevel > 25 (two filter predicates): " ,
c.getEntities("Product")
.filter("reorderLevel gt 25 and discontinued eq false")
.top(1)
.execute().first());
I'm fairly new to Java (my background is .NET/C#), but the above makes sense. However, I'm unsure how to do something similar for dates. The dates coming from my WCF OData service are formatted as "yyyy-MM-dd'T'HH:mm:ss".
Thanks in advance for your help!
It turns out this is a function of OData itself rather than odata4j. The string passed to the filter function in odata4j is the same expression that would be passed via a URL. I found tons of filter examples on the Netflix OData Catalog page.
To filter dates, use something like this:
reportEntity("\nProduct with order date greater than March 1, 2010: " ,
c.getEntities("Product")
.filter("OrderDate gt datetime'2010-03-01'")
.top(1)
.execute().first());

Categories