When casting a tab from chrome, the receiver registers a new sender with an id like this:
18:client-69832
However, when the chrome tab is reloaded, a call to castReceiverManager.getSenders() now contains two entries and continues to increase every time the page is reloaded
castReceiverManager.getSenders() -> 18:client-69832
RELOAD
castReceiverManager.getSenders() -> 18:client-69832, 18:client-78542
RELOAD
castReceiverManager.getSenders() -> 18:client-69832, 18:client-78542, 18:client-84557
etc...
The first part 18:client seems to remain consistent across reloads. Can we rely on this to uniquely identify the device? If not, how can we uniquely identify the device?
When you say unique, what is the scope that you have in mind If you are looking for something that persists between sessions, then that number s not unique. If you want something unique across sessions, one approach is to have each sender create such uid and communicate that to the receiver (if receiver needs to know).
Related
I am working on Email client App and using GMAIL IMAP condstore capability for syncing label,read and unread changes.
My application flow looks like below.
1) Initially Selecting the "Gmail/All Mail"
2) Fetching the changes from the server since last sync with last modseq like
FETCH 1:* (X-GM-LABELS) (CHANGEDSINCE highestmodseq)
Here IMAP server returns the messages for which label,read and unread changes detected since last sync.
Suppose I have label "A" and it has got 100 emails. Now if Label A is deleted then server returns 100 messages as changes,it works as expected.
But in case if label "A" is renamed to Label "B" then server should return 100 messages as changes but it won't.
Can you please suggest how to sync messages which are under Label A previously and got renamed to Label B
PS: According to IMAP server standards uniqueness of a label is identified based on label name and uid validity.
Gmail labels are retrieving with 'LIST "" "*"'.
Suppose if Label is renamed to some thing else then how to find whether it was newly created label or the renamed label
Thanks
Subbi Reddy
PS: According to IMAP server standards uniqueness of a label is identified based on label name and uid validity.
This is not true. The IMAP protocol does not define a "label". It defines what a "mailbox" is, and that each message has a set of "flags" or "keywords".
When GMail decided to implement IMAP, they made an unfortunate choice to shoehorn their concept of labels on top of the mailboxes instead of reusing the existing flags metadata. (They had some reasons for that, some of them are valid, some of them are not, and that discussion is out-of-scope for stackoverflow.)
But in case if label "A" is renamed to Label "B" then server should return 100 messages as changes but it won't.
This understanding certainly makes sense. The fact that GMail behaves differently is disappointing from the IMAP client's perspective. I suggest to bring this up to GMail's developers; they do read the ietf-imapext mailing list.
You're correct that a label rename seems like it should result in updates to the MODSEQ of all messages whose label set was affected by the rename. But it doesn't. So you're going to have to fetch the list of folders/labels and correlate the old label list with the new one.
As you know, you get the list of Gmail labels by issuing a LIST command:
A001 LIST "" "*"
What happens when the response to this command differs from the previous set of folders that you knew about? Unfortunately, IMAP doesn't give you a folder identifier that you can use to track an individual folder through renames. Fortunately, Gmail kinda sorta does.
(NOTE: THIS SOLUTION IS NOT SANCTIONED BY GMAIL, BUT IT APPARENTLY WORKS, SO THERE'S THAT.)
Every IMAP folder has a UIDVALIDITY value associated with it. It's generally there to let you know if somethin has happened on the server such that the UID-to-message mapping you've cached is no longer valid. According to the IMAP RFC,
3) If the [folder] is deleted and a new [folder] with the
same name is created at a later date, the server must
either keep track of unique identifiers from the
previous instance of the [folder], or it must assign a
new UIDVALIDITY value to the new instance of the
[folder].
4) The combination of [folder] name, UIDVALIDITY, and UID
must refer to a single immutable message on that server
forever.
Every folder exposed by Gmail IMAP happens to have a distinct UIDVALIDITY value. When you rename a folder, its UIDVALIDITY does not change. So if you notice that the set of folders has changed and you grab the UIDVALIDITY for every label-folder in the Gmail store, you can match up folders from your old snapshot and from the current store by finding which ones have matching UIDVALIDITY values.
# before, label "blurdybloop" had UIDVALIDITY 32
A002 STATUS "mylabel" (UIDVALIDITY)
* STATUS "mylabel" (UIDVALIDITY 32)
A002 OK Success
# this indicates that "blurdybloop" has been renamed to "mylabel"
If you want to be extra-careful, you may want to do a STATUS on every label folder even if the folder list hasn't changed just to catch circular renames like A -> B, C -> A, B -> C (which results in swapping the names of labels A and C). But that's probably overkill.
No, You can't do this with the IMAP language. Gmail labels are exclusively handled with http(s) API produced by Google.
IMAP has been designed to be used a set of commands send over TCP port 143.
You can check the list of the available commands.
Every tab in google chrome has an id that is unique for that browsing session, even across windows. The id is automatically assigned by chrome's internals when you call chrome.tabs.create(). Can this value ever be set to zero?
My reason for this question is that I would like to do a boolean test based on the id and I need a truthy value when there is an id.
No, tab IDs start at 1 and go up from there (they're stored as SessionID instances). -1 may also be returned in some cases.
I have an application where I want to use node.js and now.js to share the state of an object within a nowjs "group" across any number of clients.
As an example of what I'm trying to do, let's say that within the multiroom chat example that comes with now.js, there could be any number of rooms, with the ID chosen by the user. If the user knows the ID, they can enter (or be the first to "create") that room. There is a "history" object that is maintained for each room once it is created and communication starts happening. The history object contains a property or two, and an array of comment objects, each with a user property, a comment property, and a datetime property. When a new user connects, they should immediately have access to the history.
Is there a way to store a group-scoped object variable on the server to sync with? Am I thinking about this in the wrong way? Am I crazy or a little slow?
OK...I got it.
I have a new function createHistory(groupid) on the server side, which returns a new history object if it doesn't already exist when the user enters the room(group). This would occur if this user just created the room.
This history object employs add, remove and list methods. Since I need to get at the list from the client, it's important that I use a callback like the following:
api.get = (callback) ->
callback(_history)
I assign the result:
everyone.getGroup(this.now.groupid).now.history = createHistory(this.now.groupid)
Now I can add history at the server:
api.add = (time,user,text) ->
_history.items.push {time:time, user:user,text:text}
And get to it from my client:
now.history.get (history) ->
for item in history
#do something...
The only drawback is once the room is empty, the history evaporates...I think. Although I suppose you could check for the last disconnect and persist it somewhere if you wanted.
since the emails loads dynamically how do you find a specific email that contains a button back to your site. This is like signing up at a site. Customer receives email to confirm.
Thanks for the support
BigD
OWA, bless MS's little hearts (at least in the circa 2003 version I'm looking at here) uses frames, so first of all brush up on that or you are gonna be hating life. The list of incoming messages is in a frame named 'viewer' The message summaries are contained in a table lacking any useful means to identify it that is in a div of class 'msgViewerCont" and an ID of dvContents. So to see if a message exists you want to look to see if you can find a row in that table which contains the subject you expect to see.
(be careful using ID values on OWA.. apparently nobody in the group that developed it read the part of the HTML standard that specifies that ID values are supposed to be unique.. the re-use them all over that page.)
Presuming you know the subject of the message you are about to receive, and also that you keep that mail account cleared out so that it will be the ONLY message there with that subject line, then you can check to see if it exists usng
subject = regex.new("subject you are looking for")
browser.frame(:name, 'viewer').div(:id, dvContents).table(:index, 1).row(:text, subject).exists?
to click on it use .click instead of exists.
once you've clicked it, OWA will refresh the PreviewPane iframe.. inside that iframe is another one that has the message body in it.
all those frames, are nested inside the viewer frame. welcome to nested frame hell. hope you enjoy your stay. (like I said, bone up on frames, you're in for a fun ride)
I have a scenario. I have a list of user id's displayed on the windows form. As soon as I click one of the user id's I go and get the user details from the DB. To retain the responsiveness of the application, on selection changed event of the listbox, I create new BackgroundWorker(BW) objects and hit the DB. I show 'Searching user 'abc'...' in the status bar.
Now, if the user moves between the user ids using arrow keys (4-5 times), by above design I have created multiple BW objects to make the request. But finally when the data comes back for particular user (which may not be the one where user is currently selected in the listview), since it was async call, I still end up displaying all the users in the status bar.
What I would like to do is, I want to go and get the details only for the last user. Till that time I want to display 'Searching user...' only.
Please let me know solution for this...
When the user switches users, you can cancel the worker processes that are currently running (check to make sure they are running). I believe that would accomplish what you are after.
How about waiting for a second or two before you start your Background Worker?
Once the user clicks on a user id, start a timer with 1 second interval and after that one second, start your BackgroundWorker. If user clicks on a different user id, reset the timer. This way, if user keeps clicking on different user ids in quick succession, you won't do anything. Once user has taken a break, you start your background worker.
One option would be to keep a string field in the form containing the user ID. In the background worker, after you hit the DB, check that this field is still equal to the user ID that it got passed in, EDIT: and, if it's different, make the result null. Manipulate the field using the methods on the Interlocked class to avoid the need to lock. That's wrong; reference types can be read and written atomically with Interlocked.
2nd EDIT: You could also return the original user ID from the background worker along with the result, and check that it's the most recent one clicked in your Completed handler.
Alternatively, if you're keeping references to all of the BackgroundWorkers, you could use their cancellation support.
I've used this to cancel BackgroundWorkers before and it worked great.
public void cancelWorker( BackgroundWorker worker )
{
if (worker != null)
{
if (worker.IsBusy)
{
worker.CancelAsync();
while (worker.IsBusy)
{
Application.DoEvents();
}
}
}
}
I've heard controversy over using Application.DoEvents(); but I had problems with endless loops if I used Thread.sleep or other.
You might want to use polling of some sort so you don't end up with backgroundWorkers fumbling over eachother - especially if the callback ends up calling something like the UI on a separate thread so they can actually cause race conditions.