Re: Script to Generate Concurrent Times

2015-01-16 Thread Peter Haworth
If, by chance, an SQLite database is involved in your application, its
strftime() function has a lot of very powerful date adjustment/conversion
tools which might help.

Even without an SQLite database in an application, I sometimes create an in
memory database just so I can issue SELECT statements to calculate dates
and times.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Thu, Jan 15, 2015 at 7:02 PM, Brahmanathaswami bra...@hindu.org wrote:

 Roger Eller wrote:

 So that's where the old saying, your singing would bring a jersey cow to
 tears comes from.g


 LOL!

 Hmmm back on topic:

 Requirement: Generate current time list for a *future* time (for scheduled
 webinar)

 OK,  so it is easy enough to get world time from the linux system.

 and FYI: LC internet date is, happily, using the standard RFC 2822
 format  and we can invoke this also in the shell:

  -R, --rfc-2822
   output  date  and time in RFC 2822 format.  Example: Mon, 07
 Aug
   2006 12:34:56 -0600

 Check it out now

 http://dev.himalayanacademy.com/tests/dates.lc
 ---

 ?lc

 # copied the list from html source at:
 # http://www.timezoneconverter.com/cgi-bin/tzc.tzc  
 http://www.timezoneconverter.com/cgi-bin/tzc.tzc

 put url file:/home/devhap/public_html/tests/zones.txt into tZones

 repeat for each line x in tZones
  set the itemdel to /
  if (the number of items of x) = 1 then
  put x into tCity
  else
   put item 2 of x into tCity
  end if
   put x into $TZ
   put shell(date -R) into tDTstring
   put tCity  :   tDTstring  br / after tWorldTimes
 end repeat

  put tWorldTimes
 -

 but that doesn't actually meet my requirement.
 Sure: We get all the times to answer what time is it now?

 But what if I want to a future time e.g. February 1, 1:30PM HST

 and get a list of all dates/times across the globe that are concurrent
 with that future date/time?

 Maybe I'll ask that on Expert's Exchange... man timezone isn't getting me
 anything.

 I suppose one algorithm using LC native timedate conversion tools could be.

 (the future date in seconds) - (Current time in seconds local time) =
 advanceToFutureIncrement

 repeat for each concurrent time for now for all cities
 put (city[x] Time Right Now) + advanceToFutureIncrement  into
 tFutureWebinarTimeInCity[x]
 put tFutureWebinarTimeInCity[x]br / after
 tListOfNextWebinarTimes
 end repeat

 of course the above needs a bit more code, but not much more...

  Brahmanathaswami




 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-16 Thread Mark Wieder
Pete-

Friday, January 16, 2015, 9:30:21 AM, you wrote:

 Even without an SQLite database in an application, I sometimes create an in
 memory database just so I can issue SELECT statements to calculate dates
 and times.

OK - after my initial shock, I have to say that's pretty clever.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-16 Thread Brahmanathaswami
I implemented my little algorithm... it works fine with a combo of nix 
TZ look ups + LC's native convert tools
pretty straight forward. Thanks Devin!  Do nix TZ times shift for the 
Daily Light Savings times when that goes on and off in various zones?


see:

http://dev.himalayanacademy.com/tests/dates.lc

 CONVERT FUTURE TIME TO CONCURRENT FUTURE TIMES ##
# Generate a list of concurrent dates and times in other countries and 
cities

# for a declared future Hawaii (HST;  UTC1000) date and time


put url file:/home/devhap/public_html/tests/zones.txt into tTargetCities

#  Next webinar: 1:30PM in Hawaii on February 15
put Thu, 15 Feb 2015 13:30:00 -1000  into tNextWebinarInHawaii

convert tNextWebinarInHawaii to seconds

# get the current time in Hawaii

put America/Honolulu into $TZ
put shell(date -R) into tCurrentTimeInHawaii
# the -R flag fetches the RSA
convert tCurrentTimeInHawaii to seconds

# substract current from future and get the time until next webinar 
increment


put (tNextWebinarInHawaii - tCurrentTimeInHawaii) into tFutureIncrement

# get a list of times now for several cities

repeat for each line x in tTargetCities
put x into $TZ
put shell(date -R) into tDTstring
# add the increment
convert tDTstring to seconds
put (tDtstring + tFutureIncrement) into tFutureDTstring
   # back to human readable:
convert tFutureDTstring to internet date
put x  :   tFutureDTstring  br / after tTimeInOtherCities
end repeat





Peter Haworth wrote:

If, by chance, an SQLite database is involved in your application, its
strftime() function has a lot of very powerful date adjustment/conversion
tools which might help.

Even without an SQLite database in an application, I sometimes create an in
memory database just so I can issue SELECT statements to calculate dates
and times.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-15 Thread Brahmanathaswami

Roger Eller wrote:

So that's where the old saying, your singing would bring a jersey cow to
tears comes from.g


LOL!

Hmmm back on topic:

Requirement: Generate current time list for a *future* time (for 
scheduled webinar)


OK,  so it is easy enough to get world time from the linux system.

and FYI: LC internet date is, happily, using the standard RFC 2822 
format  and we can invoke this also in the shell:


 -R, --rfc-2822
  output  date  and time in RFC 2822 format.  Example: Mon, 
07 Aug

  2006 12:34:56 -0600

Check it out now

http://dev.himalayanacademy.com/tests/dates.lc
---

?lc

# copied the list from html source at:
# http://www.timezoneconverter.com/cgi-bin/tzc.tzc  
http://www.timezoneconverter.com/cgi-bin/tzc.tzc

put url file:/home/devhap/public_html/tests/zones.txt into tZones

repeat for each line x in tZones
 set the itemdel to /
 if (the number of items of x) = 1 then
 put x into tCity
 else
  put item 2 of x into tCity
 end if
  put x into $TZ
  put shell(date -R) into tDTstring
  put tCity  :   tDTstring  br / after tWorldTimes
end repeat

 put tWorldTimes
-

but that doesn't actually meet my requirement.
Sure: We get all the times to answer what time is it now?

But what if I want to a future time e.g. February 1, 1:30PM HST

and get a list of all dates/times across the globe that are concurrent with 
that future date/time?

Maybe I'll ask that on Expert's Exchange... man timezone isn't getting me 
anything.

I suppose one algorithm using LC native timedate conversion tools could be.

(the future date in seconds) - (Current time in seconds local time) = 
advanceToFutureIncrement

repeat for each concurrent time for now for all cities
put (city[x] Time Right Now) + advanceToFutureIncrement  into 
tFutureWebinarTimeInCity[x]
put tFutureWebinarTimeInCity[x]br / after tListOfNextWebinarTimes
end repeat

of course the above needs a bit more code, but not much more...

 Brahmanathaswami




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-15 Thread Simon
Then there is this;
https://www.youtube.com/watch?v=-5wpm-gesOY

Simon



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Script-to-Generate-Concurrent-Times-tp4687781p4687891.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-15 Thread William Prothero
That is hilarious, in a gruesome way.
Bill
 On Jan 15, 2015, at 8:10 PM, Simon si...@asato-media.com wrote:
 
 Then there is this;
 https://www.youtube.com/watch?v=-5wpm-gesOY
 
 Simon
 
 
 
 --
 View this message in context: 
 http://runtime-revolution.278305.n4.nabble.com/Script-to-Generate-Concurrent-Times-tp4687781p4687891.html
 Sent from the Revolution - User mailing list archive at Nabble.com.
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread J. Landman Gay

On 1/14/2015 1:22 PM, Roger Eller wrote:

Apparently on Windows the date command is used to SET the time.


That's too bad. I briefly looked for an equivalent but couldn't find 
one. I did find this though, which applies to Linux-based systems:


Valid locations for $TZ can be found here: /usr/share/zoneinfo

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread Roger Eller
Apparently on Windows the date command is used to SET the time.  The
result is:

The current date is: Wed 01/14/2015

Enter the new date: (mm-dd-yy)




On Wed, Jan 14, 2015 at 12:27 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 On 1/14/2015 10:27 AM, Devin Asay wrote:

 In your .lc script do this:

 put US/Mountain into $TZ # or whatever time zone you want to
 show
 put shell(date) into tDTstring

 Setting the $TZ variable right before called the date command returns the
 date/time the specified timezone. At least it works on the on-rev servers.


 Oh cool. It works on OS X too.

 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread Mark Wieder
Brahmanathaswami-

Wednesday, January 14, 2015, 6:15:07 PM, you wrote:

 Tomorrow we will decorate and worship our lovely New Jersey cows.

OK - I have to say that sequence of words totally blindsided me.
Did not see that coming.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread Brahmanathaswami

ha!   I meant new Jersey cows.

We retired all our crazy Holsteins to our 200 acres of guinea grass 
across the river.  I say crazy'  because Deepti was  indeed a little 
wild... quite ready to chase you in a little Ranger  and 2,000 pounds of 
white bovine rushing at you because she thinks you have a bucket of 
alfalfa cubes can be very scary...


Whereas these new Jersey's are gentle as lambs. Years ago we had one 
Jersey that was so gentle that I could take a nap in the field with my 
head on her neck (she was also laying down) and when i would sing to 
her, her ears would perk up and tears would roll out of her eyes.  I'm 
not kidding.


OK enough of this natural world stuff!
Back to $TZ manipulations!

Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



Mark Wieder wrote:

  Tomorrow we will decorate and worship our lovely New Jersey cows.


OK - I have to say that sequence of words totally blindsided me.
Did not see that coming.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread J. Landman Gay
On January 14, 2015 8:56:27 PM CST, Brahmanathaswami bra...@hindu.org wrote:
 Years ago we had one 
Jersey that was so gentle that I could take a nap in the field with my 
head on her neck (she was also laying down) and when i would sing to 
her, her ears would perk up and tears would roll out of her eyes.  
Please sing to us too. 
-- 
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread Brahmanathaswami

Devin: thanks!

 set the $TZ a perfect little gift on this Happy Makara 
Sankranti/Thai Pongal.


Big feast day in India today, sun moved into Capricorn, celebrate the 
post monsoon harvest. Tomorrow we will decorate and worship our lovely 
New Jersey cows.


see:

http://dev.himalayanacademy.com/tests/dates.lc

Sweet - linux web server Cento OS6.2)

How easy is this

?lc

# copied the list from html source at: 
http://www.timezoneconverter.com/cgi-bin/tzc.tzc

# stripped the html in BBEdit to save as plain text file
# This server lives in San Francisco and we just leave the box TZ set
# towhere it really is PST.  Other time zones are calculated from there.

put url file:/home/devhap/public_html/tests/zones.txt into tZones

repeat for each line x in tZones

# Extract the city  from each line and leave the rest

set the itemdel to /
if (the number of items of x) = 1 then
put x into tCity
else
 put item 2 of x into tCity
end if



put x into $TZ
 # or whatever time zone(s) you want to show
 # easy enough to allow the user to enter or pick their city and
 # add a little AJAX for them to fetch their own time, too...
put shell(date) into tDTstring
put tCity  :   tDTstring  br / after tWorldTimes
end repeat

put tWorldTimes

-

but now... trick will be: if you want to set a time in advance and then 
get your list from that and not from the current moment?


put another way: this list is generated for this very moment at box 
time (PST)  but if  I want to set it to Future Webinar Date/Time  and 
fetch calculated the World Times based on that future date/time...


will need to think about that...

Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



Devin Asay wrote:

In your .lc script do this:

put US/Mountain into $TZ # or whatever time zone you want to show
put shell(date) into tDTstring

Setting the $TZ variable right before called the date command returns the 
date/time the specified timezone. At least it works on the on-rev servers.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread Devin Asay

On Jan 13, 2015, at 10:21 PM, Brahmanathaswami bra...@hindu.org wrote:

 We are planning to do some webinars. I am looking for a liveCode script that 
 can read a time value on our web server and output a little array like:
 
 Honolulu: 1:30 PM Sunday Jan 16
 San Franscisco 4:30 PM Sunday Jan 16
 Chicago 6:30 PM Sunday Jan 16
 Toronto: 6:30PM Sunday Jan 16
 New York:  7:30PM Sunday Jan 16
 Rio de Janeiro: 8:30PM Sunday Jan 16
 Perth: 7:30 AM Monday Jan 16
 Sydney: 11:30 Monday Jan 16
 
 
 etc.
 
 Yes, I could probably find this as  JS/php script, but no, i don't want to do 
 that, as I'm a bit  crazy about trying to stay with LC!

Someone a few years ago showed me this; I can’t remember who.

In your .lc script do this:

put US/Mountain into $TZ # or whatever time zone you want to show
put shell(date) into tDTstring

Setting the $TZ variable right before called the date command returns the 
date/time the specified timezone. At least it works on the on-rev servers.

HTH

Devin


Devin Asay
Office of Digital Humanities
Brigham Young University


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Script to Generate Concurrent Times

2015-01-14 Thread J. Landman Gay

On 1/14/2015 10:27 AM, Devin Asay wrote:

In your .lc script do this:

put US/Mountain into $TZ # or whatever time zone you want to show
put shell(date) into tDTstring

Setting the $TZ variable right before called the date command returns the 
date/time the specified timezone. At least it works on the on-rev servers.


Oh cool. It works on OS X too.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Script to Generate Concurrent Times

2015-01-13 Thread Brahmanathaswami
We are planning to do some webinars. I am looking for a liveCode script 
that can read a time value on our web server and output a little array like:


Honolulu: 1:30 PM Sunday Jan 16
San Franscisco 4:30 PM Sunday Jan 16
Chicago 6:30 PM Sunday Jan 16
Toronto: 6:30PM Sunday Jan 16
New York:  7:30PM Sunday Jan 16
Rio de Janeiro: 8:30PM Sunday Jan 16
Perth: 7:30 AM Monday Jan 16
Sydney: 11:30 Monday Jan 16


etc.

Yes, I could probably find this as  JS/php script, but no, i don't want 
to do that, as I'm a bit  crazy about trying to stay with LC!



Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode