Re: It is almost never safe to assume your code is perfect

2013-10-05 Thread Kay C Lan
On Fri, Oct 4, 2013 at 10:48 PM, Geoff Canyon gcan...@gmail.com wrote: The switch to send in (1 - (the long seconds mod 1)) seconds was a very unexpected and exceedingly clever hack. Sorry, I still don't get it. In the msg box: the long seconds mod 1 always returns 0 --seems right.

Re: It is almost never safe to assume your code is perfect

2013-10-05 Thread J. Landman Gay
On 10/5/13 9:30 PM, Kay C Lan wrote: On Fri, Oct 4, 2013 at 10:48 PM, Geoff Canyon gcan...@gmail.com wrote: The switch to send in (1 - (the long seconds mod 1)) seconds was a very unexpected and exceedingly clever hack. Sorry, I still don't get it. In the msg box: the long seconds mod 1

Re: It is almost never safe to assume your code is perfect

2013-10-05 Thread Kay C Lan
Ah ha, Now I do feel foolish. I'm sure I typed 'the long seconds mod 1' into the message box but when I went back with the history feature I'd only typed the seconds. Now that is very very clever. I'll defintely be storing that one away. On Sun, Oct 6, 2013 at 10:55 AM, J. Landman Gay

Re: It is almost never safe to assume your code is perfect

2013-10-05 Thread J. Landman Gay
On 10/5/13 10:11 PM, Kay C Lan wrote: Ah ha, Now I do feel foolish. I'm sure I typed 'the long seconds mod 1' into the message box but when I went back with the history feature I'd only typed the seconds. Nah, that's just muscle memory taking over. That doesn't count. Now that is very very

Re: It is almost never safe to assume your code is perfect

2013-10-04 Thread Kay C Lan
Hi Geoff, I'm not sure what the original context was, so I guess there was a need for 'the long seconds', but I just created two clock faces and ran one against your original code, and the other with the 2 references to the long seconds removed, i.e it just updates every second. The outputs are

Re: It is almost never safe to assume your code is perfect

2013-10-04 Thread Geoff Canyon
Ha! I just noticed a bug in the above that causes the hour hand to be updated 6x as often as it should be. The below (I think) updates the second hand once per second, the minute hand 360 times per hour, and the hour hand 360 times per 12 hours. The long time was to check if the correct time was

It is almost never safe to assume your code is perfect

2013-10-03 Thread Geoff Canyon
Back in 2005(!) Malte came up with the brilliant idea of using oval graphics with their arcangle set to 0 in order to easily create the hands of a clock. Interestingly, the rendering of oval graphics seems to have changed since then -- setting the arcangle to 0 now doesn't draw the angle itself,