I want to use twitter data for temporal database, but I need the time that the tweet was created.
CreatedAt() only giving the details of account creation date.
Is there any API for getting tweet's time?
You might want to look at created_at. See the twitter dev page:
created_at
String
UTC time when this Tweet was created.
Example:
"created_at":"Wed Aug 27 13:08:45 +0000 2008"
Related
I have a table (react/Nodejs) which reads the entries from db and list it in the table. All entries in db are UTC, however depending on the user time zone the table is showing different data. For example in the attached snapshot our week on header is from Sep 19 to Sep 25 but the table shows Sep 26 entry which is outside of the range. That only happens with users on (UTC-xxx) time and not for user on (UTC+xxx). Your help is appreciated? Table Image
Use a timezone library to render it with a specific timezone
The problem is caused when formatting the object to be rendered in the UI, so probably the method you are using is as you say taking into account the users timezone and not a specific one that you set.
To achieve this, you can use a library like moment timezone. Or a variant compatible with your libraries.
Hope it helps.
Using the latest Twitter API is there a way to get your followers handles? I don't know the correct term for this but I am referring to their name with that # symbol. For example: #MyTwitterHandle
The code I am looking for would do this.
///Necessary Twitter Code
Outputs:
Your followers are:
1. #IFollowYou
2. #MyTwitterHandle
etc...
35k more followers etc...
The most efficient way to do it is a two-step process:
Get all user IDs with followers/ids. This lets you get 5000 at a time.
Perform a users/lookup, which will give you the screen_name. This gives you 180 requests every 15 minutes for 100 users at a time.
This will take you about a half hour if everything is working well. The alternative, using followers/list, will take you over 3 hours because you only get 200 users in a 30 minute window (for app-only auth).
I'm having this use case I'm not figuring out by the soundcloud documentation page: I fetch the last 10 most recent tracks. In 2 hours, I want to see if there are new tracks. So technically, I want to ask "give me the tracks with created_at greater than the created_at of my last fetched track". How can I do that using the current Soundcloud API spec?
You can send created_at[from] parameter in the request which will allow you to set a minimum creation date for your query.
For example
/users/x/tracks.json?created_at[from]=2012-11-01%2016%3A02%3A00
For more info check the filters heading underneath each resource :)
I'm trying to create a search with Splunk that will allow me to have only the results during non working ours. I mean, Splunk to filter out from the logs all the events that occur from 8am to 5am.
Currently, the query I'm using is: earliest=-1mon so I get all the events from last month, but I only need those events that occurred outside working hours.
Is it possible?
There are probably multiple ways of doing this in Splunk. Below is one. I am extracting the hour field (24 hour format) into c_time and then limiting my results to ones that are between 8p and 5a. You can specify other filters like earliest and latest to be more specific. Hope this helps.
... | convert timeformat="%H" ctime(_time) AS c_time | search c_time>= 20 c_time<= 05
-Neeraj.
UPDATE:
Copied from comment made below:
I thought about using a web service against IP address for each visitor to the site but then I wondered about users looking at meetings in locations that span timezones so the timezone has to be associated with the location of the meeting being viewed, not where the user themselves are at that moment in time. I need a user to be able to see a list of meetings (with times and locations) and the times shown are the actual meeting times but the WHERE clause of the SELECT to list the meetings needs to take into account the timezone of each meeting location.
I've looked around and there are plenty of questions asked about using timezones with a rails app.
The issue lies in the fact that the app needs to know which timezone a user is in for it to properly be able to run queries against the database to check for datetimes in the future, for instance.
I don't want regular visitors to my site to need to login for it to work correctly for them so I'm thinking along the following lines:
Admin users login to post an item for a particular location and datetime
When saving the item it uses the [lat,lng] of the location to call the Timezone gem to capture the timezone for the location
I think I need this timezone to be added to an extra field on the same model as the [lat,lng] and the datetime (which rails saves as UTC) ( https://stackoverflow.com/a/2533323 )
I need my model to combine the UTC datetime with its respective timezone so that when a regular user comes to the site the webpage selects items where the UTC+timezone datetimes are in the future
Does that sound possible/correct?
If it sounds confusing just say in a comment and I'll try to reword it a bit better if I can.
Can someone offer any code for the model to create a virtual attribute (I think) that combines UTC datetime with a timezone field?
Thanks
Won't it be better to have the list of countries and their timezones? When user comes to site determine from what country he is and than trying to use native rails timezone methods.
For example I have User and Table models that have created_at params:
Time.zone => (GMT+00:00) UTC
User.last.created_at => Mon, 25 Jun 2012 21:17:25 UTC +00:00
Table.last.created_at => Mon, 16 Jul 2012 14:08:17 UTC +00:00
Time.zone = 'Moscow' => "Moscow"
Time.zone => (GMT+04:00) Moscow
User.last.created_at => Tue, 26 Jun 2012 01:17:25 MSK +04:00
Table.last.created_at => Mon, 16 Jul 2012 18:08:17 MSK +04:00
How to determine the country you should look for gems or some services. I think it will be the service that determine the user country by his IP address.