Upload documents to a User Model with expiry dates using Active Storage - file-upload

I need to implement a new feature for my side project -a rails 7 app- where a user can upload a bunch of documents with expiry dates on each one of them.
Right now I'm using active storage and everything is working like a charme, but I want to make the user to add an expiring date on each documents and then send them emails to remind them to upload new ones.
How can I implement this?
Thanks in advance.

Related

Dropbox API finding new/changed files

I'm trying to setup a webhook from dropbox to notify my server whenever a new file is uploaded.
There are 1000's of files being shared but < 100 everyday and I only want to find the new files of a certain type that have been added or modified since the last check.
The webhook sends the userid when the file is added but doesn't indicate a file name.
Is there anyway using the list_folder api, or using another api to find out what file has been changed since a certain date?
Dropbox webhooks only tell you that something changed, but not what specifically changed.
You can use these in conjunction with /2/files/list_folder[/continue] to see what changed. The webhooks documentation and the Content Access Guide have more information about this.
In short, the basic flow would be like this:
The user connects the app to their account, and the app saves the resulting access token for that user.
The app gets the current state of the account using /2/files/list_folder[/continue], and stores the latest returned cursor.
The user makes changes in their account.
Dropbox notifies the app of changes in the user's account using a webhook notification.
The app receives the webhook notification and looks up the corresponding access token and cursor for the specified user.
The app calls /2/files/list_folder/continue using the cursor to retrieve only what changed since it last called, and again stores the latest returned cursor.
(Repeat)

how to find out how long visitors stay on my website(duration time)

I'm making a simple analytics admin assuming I'm the owner of a shopping mall as my first project
I've looked up a lot about it but, I couldn't find any information. What I've found out so far is that most existing marketing toole uses cookie and they caclulates it in some ways like they set some cookie with current time and set another cookie when users move to another page on website.
My website is made of AJAX and expressjs with mysql and I'll send user's average duration time to my admin page
Could anyone tell me how to track duration time?
I'm definitely not distributing the idea but it is only for my team prject
This could be accomplished with a combination of localStorage (optionally) and onbeforeunload.
Set the current time when a user first gets to site
Store it in localstorage
When they are about to leave, onbeforeunload, you can save / calculate the duration
https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

Calculate Daily Active Users with Devise

Iam a RoR developer and I want to calculate DAU for my website. By DAU I mean:
DAU- Total Number of users who either came to my website and logged in or who came to the website and were already logged in.
I implemented Devise in my website because it tracks current_sign_in_at. And later found that these attributes mean as:
current_sign_in_at - The latest time the person logged in to my website.
(Using this I can get the count of people who came to my website and logged in.)
But I am missing the count of people who came to the website and were already logged in.
One of the way I found to implement it is trigger a function in delayed job which updates the timestamp whenever the root action is called and home page of my website loads. But since my website gets around 1000 - 2000 hits per minute I guess this function will become the bottleneck.
Can anyone please suggest me the best way to implement it.
Many Thanks.
Possible solutions:
Use a service like Google Analytics(custom variables), KISSmetrics(visitor identity) or Mixpanel(distinct_id) and send them the user id and you can find daily active users.
You can do something like what you mentioned, store the last active time for the user in a database each time you get a request, if you get 1000-2000 hits per minute, you might want to store it in an in memory store like redis instead. If users will be coming to your website from different paths and not just root url you could create a after_filter in the application controller which updates the redis store with the current time for the user.
If you are interesting in looking at more then just the daily active users in future, it is worthwhile to create a log for your users in another database. Again I'd suggest an before or after_filter in application_controller which queues a job to store time, user_id, any other data you might be interested in. I'm using a mongo db separate from my ActiveRecord MySQL database to do this.

Is there a way to share one master Calendar in iCloud?

I understand that I can use iCloud to sync Calendar (I'm assuming this is iCal) between multiple devices/users.
I have a requirement to have a master calendar that can be shared between users and automatically sync between those users. All users must have the ability to add/update/delete entries. And since I will be testing this, I don't want to use my personal iCal, so I need another group iCal stored on iCloud for testing, etc.
Is this possible with iOS and objective-c? If so, which APIs would I be most interested in to accomplish this?
UPDATE: each change to the "master calendar" is synced by iCloud, assuming the user devices are "registered" with iCloud. I need ONE calendar stored in ONE iCloud account, available to all "registered" users/devices. The app is going to access that calendar for back-end processing. The changes the users make to the calendar will be processed by the app when it is running (app is running during business hours, users can make changes 24/7)
Calendars and events in iOS are accessed using the Event Kit Framework. The user will have to have set up their iCloud account and calendar access/sharing separately, I don't think you can do this from within a third-party app.

API for "People" contact data

I'm working on a Win8 metro signup flow and would like to be able to seamlessly pull, using the user-provided phone #, a photo and display name from the built-in "People" app. I'm having trouble finding documentation/code outside of ContactPicker (which isn't what I need).
Couple questions:
Is there an API to pull contact data that would be present in the "People" app?
If so, is there a way to configure capabilities to avoid interrupting the user with a modal "Ok for app xyz to access your address book"?
Thanks.
Confirmed that there is no API to pull contacts programmatically.
You can't pull contacts without permission, it's a security feature. You CAN interrogate the contact data users pick via the Contact Picker though.
You therefore have to ask the user to pick contacts relevant to your task, call the single / multiple contact picker then once picked, you can interrogate the contacts as much as you want. They have phone numbers, emails, locations all the data you might want hanging off those.
As far as I can tell, there's no way to maintain a persistent link to them though, so store that data while you can.