Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ECB97C05A for ; Mon, 30 Apr 2012 17:40:10 +0000 (UTC) Received: (qmail 94748 invoked by uid 500); 30 Apr 2012 17:40:08 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 94718 invoked by uid 500); 30 Apr 2012 17:40:08 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 94709 invoked by uid 99); 30 Apr 2012 17:40:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2012 17:40:08 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of samalgorai@gmail.com designates 209.85.212.178 as permitted sender) Received: from [209.85.212.178] (HELO mail-wi0-f178.google.com) (209.85.212.178) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2012 17:40:03 +0000 Received: by wibhq7 with SMTP id hq7so2327748wib.7 for ; Mon, 30 Apr 2012 10:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Xlbhh5oKhzatKhsRyDmNvuZ47aZ4kwraF2HVu2Uao34=; b=EHSqBZi7M/t3DtROhBTJIlrk3K+raoX7qCfjRuSd1wOkn8g5gWdy9bZ82sOYLVw8ya hwtbOVNcerd5CPaimvhxfXh1QpKgsrk62hw8z5PhFpDnLpVAUnhbGfPGuhOLT1nOBWtp 2TexjspXkLMtNDWt9+YIo9XQd9FEHSQjrEvbWf5b3bvV4UjPPbe3ZB0RSoyJo2NXil70 2tmXdbWDUc2piZmLbW5Ygus5adXUCVes+lQqRpU6y1leXRs0ae2bezIedbVmu/7b2o8Q 9BB0tUy7Es1fxkW9vNTDdzNh1VY9cucvKhwP2FE1ygC/8tF+iFqATFNvNJ3j5Mj6vPZO vvAg== MIME-Version: 1.0 Received: by 10.180.81.166 with SMTP id b6mr11357996wiy.0.1335807582426; Mon, 30 Apr 2012 10:39:42 -0700 (PDT) Received: by 10.223.106.207 with HTTP; Mon, 30 Apr 2012 10:39:42 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 Apr 2012 23:09:42 +0530 Message-ID: Subject: Re: timezone time series data model From: samal To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=f46d0442811e70566d04bee8f04c X-Virus-Checked: Checked by ClamAV on apache.org --f46d0442811e70566d04bee8f04c Content-Type: text/plain; charset=UTF-8 thanks I didn't noticed. run script for 5 minutes => divide seems to produce result ,modulo is still changing. If divide is ok will do the trick. I will run this script on Singapore, East coast server, and New delhi server whole night today. ====================== unix => 1335806983422 unix /1000 => 1335806983.422 Divid i/86400 => 15460.728969907408 Divid i/86400 INT => 15460 Modulo i%86400 => 62983 ====================== ====================== unix => 1335806985421 unix /1000 => 1335806985.421 Divid i/86400 => 15460.728993055556 Divid i/86400 INT => 15460 Modulo i%86400 => 62985 ====================== ====================== unix => 1335806987422 unix /1000 => 1335806987.422 Divid i/86400 => 15460.729016203704 Divid i/86400 INT => 15460 Modulo i%86400 => 62987 ====================== ====================== unix => 1335806989422 unix /1000 => 1335806989.422 Divid i/86400 => 15460.729039351852 Divid i/86400 INT => 15460 Modulo i%86400 => 62989 ====================== ====================== unix => 1335806991421 unix /1000 => 1335806991.421 Divid i/86400 => 15460.7290625 Divid i/86400 INT => 15460 Modulo i%86400 => 62991 ====================== ====================== unix => 1335806993422 unix /1000 => 1335806993.422 Divid i/86400 => 15460.729085648149 Divid i/86400 INT => 15460 Modulo i%86400 => 62993 ====================== ====================== unix => 1335806995422 unix /1000 => 1335806995.422 Divid i/86400 => 15460.729108796297 Divid i/86400 INT => 15460 Modulo i%86400 => 62995 ====================== ====================== unix => 1335806997421 unix /1000 => 1335806997.421 Divid i/86400 => 15460.729131944445 Divid i/86400 INT => 15460 Modulo i%86400 => 62997 ====================== ====================== unix => 1335806999422 unix /1000 => 1335806999.422 Divid i/86400 => 15460.729155092593 Divid i/86400 INT => 15460 Modulo i%86400 => 62999 ====================== On Mon, Apr 30, 2012 at 10:44 PM, Tyler Hobbs wrote: > getTime() returns the number of milliseconds since the epoch, not the > number of seconds: http://www.w3schools.com/jsref/jsref_gettime.asp > > If you divide that number by 1000, it should work. > > > On Mon, Apr 30, 2012 at 11:28 AM, samal wrote: > >> I did it with node.js but it is changing after some interval. >> >> >> setInterval(function(){ >> var d =new Date().getTime(); >> console.log("====================== "); >> console.log("unix => ",d); >> i=parseInt(d) >> console.log("Divid i/86400=> ",i/86400); >> console.log("Modulo i%86400=> ",i%86400); >> console.log("====================== "); >> },2000); >> >> >> Am I doing wrong? >> >> >> On Mon, Apr 30, 2012 at 9:54 PM, Tyler Hobbs wrote: >> >>> Correct, that's exactly what I'm saying. >>> >>> >>> On Mon, Apr 30, 2012 at 10:37 AM, samal wrote: >>> >>>> thanks tyler for reply. >>>> >>>> are you saying user1uuid_*{ts%86400}* would lead to unique day bucket >>>> which will be timezone {NZ to US} independent? I will try. >>>> >>>> >>>> On Mon, Apr 30, 2012 at 8:25 PM, Tyler Hobbs wrote: >>>> >>>>> Don't use dates or datestamps as the buckets for your row keys, use a >>>>> unix timestamp modulo whatever size you want your bucket to be instead. >>>>> Timestamps don't involve time zones or any of that nonsense. >>>>> >>>>> So, instead of having keys like "user1uuid_30042012", the second half >>>>> would be replaced the current unix timestamp mod 86400 (the number of >>>>> seconds in a day). >>>>> >>>>> >>>>> On Mon, Apr 30, 2012 at 1:46 AM, samal wrote: >>>>> >>>>>> Hello List, >>>>>> >>>>>> I need suggestion/ recommendation on time series data. >>>>>> >>>>>> I have requirement where users belongs to different timezone and they >>>>>> can subscribe to global group. >>>>>> When users at specific timezone send update to group it is available >>>>>> to every user in different timezone. >>>>>> >>>>>> I am using GroupSubscribedUsers CF where all update to group are push >>>>>> to "Each User" time line, and key is timelined by useruuid_date(one day >>>>>> update of all groups) and columns are group updates. >>>>>> >>>>>> GroupSubscribedUsers ={ >>>>>> user1uuid_30042012:{//this user belongs to same timezone >>>>>> timeuuid1:JSON[group1update1] >>>>>> timeuuid2:JSON[group2update2] >>>>>> timeuuid3:JSON[group1update2] >>>>>> timeuuid4:JSON[group4update1] >>>>>> }, >>>>>> user2uuid_30042012:{//this user belongs to different timezonewhere date has changed already to 1may but 30 april is getting update >>>>>> timeuuid1:JSON[group1update1] >>>>>> timeuuid2:JSON[group2update2] >>>>>> timeuuid3:JSON[group1update2] >>>>>> timeuuid4:JSON[group4update1] >>>>>> timeuuid5:JSON[groupNupdate1] >>>>>> }, >>>>>> >>>>>> } >>>>>> >>>>>> I have noticed this approach is good for single time zone when >>>>>> different timezone come into picture it breaks. >>>>>> >>>>>> I am thinking of like when user pushed update to group ->get user who >>>>>> is subscribed to group->check user timezone->push time series in user time >>>>>> zone. So for one user update will be on 30april where as other may have on >>>>>> 29april and 1may, using timestamps i can find out hours ago update came. >>>>>> >>>>>> Is there any better approach? >>>>>> >>>>>> >>>>>> Thanks, >>>>>> >>>>>> >>>Samal >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Tyler Hobbs >>>>> DataStax >>>>> >>>>> >>>> >>> >>> >>> -- >>> Tyler Hobbs >>> DataStax >>> >>> >> > > > -- > Tyler Hobbs > DataStax > > --f46d0442811e70566d04bee8f04c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable thanks I didn't noticed.
run script for 5=C2=A0 minutes =3D> divi= de seems to produce result ,modulo is still changing. If divide is ok will = do the trick.
I will run this script on Singapore, East coast server, an= d New delhi server whole night today.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
= unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 =3D>=C2=A0=C2=A0 1335806983422
unix /1000=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806983.422
Divid i/8640= 0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15460.728969907408
Divid i= /86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0=C2=A0 = =3D>=C2=A0=C2=A0 62983
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
unix=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =3D>=C2=A0=C2=A0 1335806985421
unix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806985.421
Divid i/86400=C2=A0= =C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15460.728993055556
Divid i/86400 = INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 62985
=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2= =A0=C2=A0 1335806987422
unix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 1335806987.422
Divid i/86400=C2=A0=C2=A0=C2= =A0=C2=A0 =3D>=C2=A0=C2=A0 15460.729016203704
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62987
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806989422
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806989.422
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.729039351852
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62989
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806991421
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806991.421
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.7290625
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62991
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806993422
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806993.422
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.729085648149
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62993
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806995422
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806995.422
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.729108796297
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62995
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806997421
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806997.421
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.729131944445
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62997
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D
unix=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 1335806999422
u= nix /1000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 133= 5806999.422
Divid i/86400=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0=C2=A0 15= 460.729155092593
Divid i/86400 INT =3D>=C2=A0=C2=A0 15460
Modulo i%86400=C2=A0=C2=A0= =C2=A0 =3D>=C2=A0=C2=A0 62999
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
=C2=A0

On= Mon, Apr 30, 2012 at 10:44 PM, Tyler Hobbs <tyler@datastax.com>= wrote:
getTime() returns the number of milliseconds= since the epoch, not the number of seconds: http://www.w3schools.com/j= sref/jsref_gettime.asp

If you divide that number by 1000, it should work.


On Mon, Apr 30, 2012 at 11:28 AM, samal <samalgorai@gmail.com> wrote:
I did it with node.js but it is changing after some interval.

<co= de>
setInterval(function(){
=C2=A0 var d =3Dnew Date().getTime();<= br>=C2=A0 console.log("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D ");
=C2=A0 console.log("unix=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D>=C2=A0 ",d);
=C2=A0 i=3DparseInt(d)
=C2=A0 console.log("Divid i/86400=3D>=C2= =A0 ",i/86400);
=C2=A0 console.log("Modulo i%86400=3D> &quo= t;,i%86400);
=C2=A0 console.log("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ");
},2000);

</code>=
Am I doing wrong?


On Mon, Apr 3= 0, 2012 at 9:54 PM, Tyler Hobbs <tyler@datastax.com> wrote:=
Correct, that's exactly what I'm saying.=


On Mon, Apr 30, 2012 at 10:37 = AM, samal <samalgorai@gmail.com> wrote:
thanks tyler for reply.

are you sayin= g=C2=A0 user1uuid_{ts%86400} would lead to unique day bucket which will b= e timezone {NZ to US} independent? I will try.


On Mon, Apr 30, 2012 at 8:25 PM, Tyler Hobbs= <tyler@datastax.com> wrote:
Don't use dates or datestamps as the buckets for your row keys, use a u= nix timestamp modulo whatever size you want your bucket to be instead.=C2= =A0 Timestamps don't involve time zones or any of that nonsense.
So, instead of having keys like "user1uuid_30042012", the second= half would be replaced the current unix timestamp mod 86400 (the number of= seconds in a day).


On Mon, Apr 30, 2012 at 1:46 AM, samal <= samalgorai@gmail.com> wrote:
//this user belongs to same timezone
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid1:JSON[group1update1]
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid2:JSON[group2update2]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid3:JSON[group1up= date2]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid4:JSON[group4update1]=C2=A0=C2=A0 },
=C2=A0 user2uuid_30042012:{//this user belo= ngs to different timezone where date has changed already=C2=A0 to = 1may but=C2=A0 30 april is getting update
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid1:JSON[group1updat= e1]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid2:JSON[group2upda= te2]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid3:JSON[group1upda= te2]
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid4:JSON[group4update1]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeuuid5:JSON[groupNupdate1= ]
=C2=A0=C2=A0 },

}

I have noticed=C2=A0 this approach is good = for single time zone when different timezone come into picture it breaks. <= br>
I am thinking of like when user pushed update to group ->get user= who is subscribed to group->check user timezone->push time series in= user time zone. So for one user update will be on 30april where as other m= ay have on 29april and 1may, using timestamps i can find out hours ago upda= te came.

Is there any better approach? =C2=A0=C2=A0
=C2=A0=C2=A0

Tha= nks,

>>>Samal





--
Tyler Hobbs
DataStax
<= br>




= --
Tyler Hobbs
DataStax
<= br>




--
Tyl= er Hobbs
DataStax
<= br>

--f46d0442811e70566d04bee8f04c--