Re: Getting someone's age from dob and current year
On Jul 31, 2011, at 12:03 AM, Warren Samples wrote: On Saturday, July 30, 2011 07:16:44 PM Roger Eller wrote: convert tToday to seconds convert tBorn to seconds It's been talked about before, but this calls for a reminder: attempting to convert a date prior to Jan 1, 1970 to seconds returns invalid date instead of a number in Windows. Don't do this if you are going to need this to work in Windows! Under Windows, you need to subtract the birthyear from the current year and determine if the current month/day is later than the birth month/day and subtract one year if necessary. Conveniently, this methods does work on all platforms. function doAge tDOB -- assumes format of m/d/yy set the itemdelimiter to / put item 3 of tDOB into DOByr put item 2 of tDOB into DOBmo put item 1 of tDOB into DOBdy put item 3 of the short date into nowYr put item 2 of the short date into nowMo put item 1 of the short date into nowDy if DOByr nowYr then -- prev century -- assumes no one with age 100 put 19 before DOByr else put 20 before DOByr end if put 20 before nowYr put nowYr - DOByr into tAge if nowMo DOBmo then return tAge if nowMo DOBmo then return tAge -1 if nowDy DOBdy then return tAge -1 return tAge end doAge -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: Getting someone's age from dob and current year
Thanks everyone. I figured the dob problem out and it's now working. Now I just need to get my substack back. Have there been stability problems with substacks? Mike On Sun, 31 Jul 2011 11:32:02 -0400, Peter Brigham MD wrote: On Jul 31, 2011, at 12:03 AM, Warren Samples wrote: On Saturday, July 30, 2011 07:16:44 PM Roger Eller wrote: convert tToday to seconds convert tBorn to seconds It's been talked about before, but this calls for a reminder: attempting to convert a date prior to Jan 1, 1970 to seconds returns invalid date instead of a number in Windows. Don't do this if you are going to need this to work in Windows! Under Windows, you need to subtract the birthyear from the current year and determine if the current month/day is later than the birth month/day and subtract one year if necessary. Conveniently, this methods does work on all platforms. function doAge tDOB -- assumes format of m/d/yy set the itemdelimiter to / put item 3 of tDOB into DOByr put item 2 of tDOB into DOBmo put item 1 of tDOB into DOBdy put item 3 of the short date into nowYr put item 2 of the short date into nowMo put item 1 of the short date into nowDy if DOByr nowYr then -- prev century -- assumes no one with age 100 put 19 before DOByr else put 20 before DOByr end if put 20 before nowYr put nowYr - DOByr into tAge if nowMo DOBmo then return tAge if nowMo DOBmo then return tAge -1 if nowDy DOBdy then return tAge -1 return tAge end doAge -- Peter Peter M. Brigham pmb...@gmail.com [1] http://home.comcast.net/~pmbrig [2] ___ use-livecode mailing list use-livecode@lists.runrev.com [3] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode [4] Links: -- [1] mailto:pmb...@gmail.com [2] http://home.comcast.net/~pmbrig [3] mailto:use-livecode@lists.runrev.com [4] 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: Getting someone's age from dob and current year
Hello all, I need to figure out someone's age. I have their date of birth and I have today's date. How do I get the end result. My math skills SUCK. Here's my code (loaded in from the database with a SELECT statement): put item 7 of myLine into dobMonth put item 8 of myLine into dobDay put item 9 of myLine into dobYear put chartonum(dobYear) into dobYearNum put the long system date into field TodayDate I figured I would subtract this year from the dobyear and get the age - am I right? How would I do this if I am? Mike ___ 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: Getting someone's age from dob and current year
On Sat, Jul 30, 2011 at 5:20 PM, Admin wrote: Hello all, I need to figure out someone's age. I have their date of birth and I have today's date. How do I get the end result. My math skills SUCK. Here's my code (loaded in from the database with a SELECT statement): put item 7 of myLine into dobMonth put item 8 of myLine into dobDay put item 9 of myLine into dobYear put chartonum(dobYear) into dobYearNum put the long system date into field TodayDate I figured I would subtract this year from the dobyear and get the age - am I right? How would I do this if I am? Mike Hey Mike, put this into a new button object. on mouseUp put the date into tToday ask Enter the date of birth as dd/mm/yy put it into tBorn convert tToday to seconds convert tBorn to seconds put (tToday - tBorn) into tAge -- in seconds -- now do the math in tAge -- to determine how many years that is answer The age is tAge seconds old. cr cr \ You didn't expect me to do all of the math, now did you? :) end mouseUp ˜Roger ___ 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: Getting someone's age from dob and current year
On Sat, Jul 30, 2011 at 5:20 PM, Admin wrote: I figured I would subtract this year from the dobyear and get the age - am I right? How would I do this if I am? Mike I gotta start reading the whole message before I reply... If you already have two 4-digit year values in variables, you can simply put their difference into another variable (or container). put (largYear - smallYear) into tAge You can also say: subtract smallYear from largeYear answer largeYear -- which now becomes the age ˜Roger ___ 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: Getting someone's age from dob and current year
Thank you. I am sure that will do it! Mike On Sat, 30 Jul 2011 20:16:44 -0400, Roger Eller wrote: On Sat, Jul 30, 2011 at 5:20 PM, Admin wrote: Hello all, I need to figure out someone's age. I have their date of birth and I have today's date. How do I get the end result. My math skills SUCK. Here's my code (loaded in from the database with a SELECT statement): put item 7 of myLine into dobMonth put item 8 of myLine into dobDay put item 9 of myLine into dobYear put chartonum(dobYear) into dobYearNum put the long system date into field TodayDate I figured I would subtract this year from the dobyear and get the age - am I right? How would I do this if I am? Mike Hey Mike, put this into a new button object. on mouseUp put the date into tToday ask Enter the date of birth as dd/mm/yy put it into tBorn convert tToday to seconds convert tBorn to seconds put (tToday - tBorn) into tAge -- in seconds -- now do the math in tAge -- to determine how many years that is answer The age is tAge seconds old. cr cr You didn't expect me to do all of the math, now did you? :) end mouseUp ˜Roger ___ use-livecode mailing list use-livecode@lists.runrev.com [1] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode [2] Links: -- [1] mailto:use-livecode@lists.runrev.com [2] 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: Getting someone's age from dob and current year
Hi all - another one: I have a path stored in a MySQL database to an image file. I have a page with a image control I know how to SELECT the imagepath info and bring it into a variable, but how do I then load that image into the image control (with proper proportions)? I tried the obvious ways and nothing worked for me. The image control is named imgCandidatePic (just a small 140x140 square). A sample path would be http://www.server.com/userfiles/bear_harry/mypic.jpg for example I need to get that picture into the image control when the card loads (so in the card script using opencard). Thanks for your help everyone. Mike ___ 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: Getting someone's age from dob and current year
The following works: put http://fake.com/fake.jpg; into k set the filename of img 1 to k To get the correct dimensions I guess you would have to find the dimensions of the online jpg, then make you img the same dimensions. Just a thought. Mike --- On Sat, 7/30/11, Admin ad...@mfelkerco.com wrote: From: Admin ad...@mfelkerco.com Subject: Re: Getting someone's age from dob and current year To: How to use LiveCode use-livecode@lists.runrev.com Date: Saturday, July 30, 2011, 7:38 PM Hi all - another one: I have a path stored in a MySQL database to an image file. I have a page with a image control I know how to SELECT the imagepath info and bring it into a variable, but how do I then load that image into the image control (with proper proportions)? I tried the obvious ways and nothing worked for me. The image control is named imgCandidatePic (just a small 140x140 square). A sample path would be http://www.server.com/userfiles/bear_harry/mypic.jpg for example I need to get that picture into the image control when the card loads (so in the card script using opencard). Thanks for your help everyone. Mike ___ 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: Getting someone's age from dob and current year
On Sat, Jul 30, 2011 at 8:38 PM, Admin wrote: Hi all - another one: I have a path stored in a MySQL database to an image file. I have a page with a image control I know how to SELECT the imagepath info and bring it into a variable, but how do I then load that image into the image control (with proper proportions)? I tried the obvious ways and nothing worked for me. The image control is named imgCandidatePic (just a small 140x140 square). A sample path would be http://www.server.com/userfiles/bear_harry/mypic.jpg for example I need to get that picture into the image control when the card loads (so in the card script using opencard). Thanks for your help everyone. Mike As long as your image size is not locked, the image container will adjust to the proportions of the original image. on mouseUp create img bear_harry set the filename of img bear_harry to http://www.skcastle.com/wp-content/uploads/2007/08/bearharry.jpg; end mouseUp ___ 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: Getting someone's age from dob and current year
On Saturday, July 30, 2011 07:16:44 PM Roger Eller wrote: convert tToday to seconds convert tBorn to seconds It's been talked about before, but this calls for a reminder: attempting to convert a date prior to Jan 1, 1970 to seconds returns invalid date instead of a number in Windows. Don't do this if you are going to need this to work in Windows! Under Windows, you need to subtract the birthyear from the current year and determine if the current month/day is later than the birth month/day and subtract one year if necessary. Conveniently, this methods does work on all platforms. Best, Warren ___ 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