From cmeyer at helvella.org Tue Nov 8 10:52:57 2011 From: cmeyer at helvella.org (Colin Meyer) Date: Tue, 8 Nov 2011 10:52:57 -0800 Subject: SPUG: November 2011 Seattle Perl Users Group (SPUG) Meeting Message-ID: November 2011 Seattle Perl Users Group (SPUG) Meeting ==================================================== Topic: Pegex and Acmeism Speaker: Ingy d?t Net Meeting Date: Tuesday, 15 November 2011 Meeting Time: 6:30 - 8:30 p.m. Location: Marchex - 520 Pike Street Cost: Admission is free and open to the public Info: http://seattleperl.org/ ==================================================== Tuesday, November 15, is the next meeting of the THE SEATTLE PERL USERS GROUP. This Month's Talk ----------------- Acmeism (http://acmeism.org) is the ability to think about and express one's creative ideas, beyond language borders. In programming, this means creating things that benefit multiple languages and communities. Perl is effectively one great community with 2 great languages (Perl 5 and Perl 6). Acmeism is essential to mongers, but kindly extends to pythonistas, brigadiers and nodelings as well. Pegex is an Acmeist parsing language. Think of it as Perl 6 Rules and Regexp::Grammars for all programmers. Write One Grammar, Parse Everywhere. This makes Pegex the quintessential tool in the Acmeist's belt. Pegex.pm is fully functional in Perl 5, and working it's way across the Acmeist landscape. About Ingy d?t Net ------------------- http://ingy.net/ Inventor of YAML and father of Acmeism, Ingy has been a Perl hacker and a member of SPUG since the early days. Pre-Meeting =========== If you are so inclined, please come to the pre-meeting at the nearby Elephant & Castle pub on 5th & Union (see map link below). Come enjoy some friendly conversation and perhaps a favorite beverage (they have a full restaurant too). We can usually be found at the back under the TV near the rear entrance that goes up into the hotel (if you enter through the front doors, just go straight back past the bar). We'll be there from 5:00 pm to 6:19 pm. Meeting Location ================ Marchex 520 Pike Street, Suite 1800 Seattle, WA 98101 The building is just East of Westlake Center. Enter from Pike Street. http://bit.ly/jGI364 Due to all of the shopping around us there is plenty of parking available in garages, but it can be hard to find street parking in the evening. There is also a parking garage in the building, but check the rates and closing time (subject to change due to downtown events)! Attendees will need to wait near the elevators in the lobby and a Marchex employee will provide access to the 18th floor where the meeting room is located. If no one shows up to let you in, call (425) 533-2964 to let them know you're in the lobby. See you there! From cmeyer at helvella.org Mon Nov 14 08:04:49 2011 From: cmeyer at helvella.org (Colin Meyer) Date: Mon, 14 Nov 2011 08:04:49 -0800 Subject: SPUG: November 2011 Seattle Perl Users Group (SPUG) Meeting In-Reply-To: References: Message-ID: Reminder: the next SPUG meeting is tomorrow (Tuesday, 11/15). -Colin. On Tue, Nov 8, 2011 at 10:52 AM, Colin Meyer wrote: > ? ?November 2011 Seattle Perl Users Group (SPUG) Meeting > ? ?==================================================== > > ? ?Topic: Pegex and Acmeism > ? ?Speaker: Ingy d?t Net > ? ?Meeting Date: Tuesday, 15 November 2011 > ? ?Meeting Time: 6:30 - 8:30 p.m. > ? ?Location: Marchex - 520 Pike Street > > ? ?Cost: Admission is free and open to the public > ? ?Info: http://seattleperl.org/ > > ? ?==================================================== > > Tuesday, November 15, is the next meeting of the THE SEATTLE PERL USERS GROUP. > > This Month's Talk > ----------------- > > Acmeism (http://acmeism.org) is the ability to think about and express > one's creative ideas, beyond language borders. In programming, this means > creating things that benefit multiple languages and communities. Perl is > effectively one great community with 2 great languages (Perl 5 and Perl 6). > Acmeism is essential to mongers, but kindly extends to pythonistas, brigadiers > and nodelings as well. > > Pegex is an Acmeist parsing language. Think of it as Perl 6 Rules and > Regexp::Grammars for all programmers. Write One Grammar, Parse Everywhere. This > makes Pegex the quintessential tool in the Acmeist's belt. Pegex.pm is fully > functional in Perl 5, and working it's way across the Acmeist landscape. > > > About Ingy d?t Net > ------------------- > > http://ingy.net/ ?Inventor of YAML and father of Acmeism, Ingy has been a Perl > hacker and a member of SPUG since the early days. > > > Pre-Meeting > =========== > > If you are so inclined, please come to the pre-meeting at the nearby Elephant > & Castle pub on 5th & Union (see map link below). Come enjoy some friendly > conversation and perhaps a favorite beverage (they have a full restaurant > too). We can usually be found at the back under the TV near the rear entrance > that goes up into the hotel (if you enter through the front doors, just go > straight back past the bar). We'll be there from 5:00 pm to 6:19 pm. > > > Meeting Location > ================ > > Marchex > 520 Pike Street, Suite 1800 > Seattle, WA ?98101 > > The building is just East of Westlake Center. Enter from Pike Street. > > ? http://bit.ly/jGI364 > > Due to all of the shopping around us there is plenty of parking available in > garages, but it can be hard to find street parking in the evening. There is > also a parking garage in the building, but check the rates and closing time > (subject to change due to downtown events)! > > Attendees will need to wait near the elevators in the lobby and a Marchex > employee will provide access to the 18th floor where the meeting room is > located. If no one shows up to let you in, call (425) 533-2964 to let them > know you're in the lobby. > > See you there! > _____________________________________________________________ > Seattle Perl Users Group Mailing List > ? ? POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > ? ?MEETINGS: 3rd Tuesdays > ? ?WEB PAGE: http://seattleperl.org/ > From baronmog at gmail.com Tue Nov 15 21:38:21 2011 From: baronmog at gmail.com (=?UTF-8?Q?Noah_R=C3=B8mer?=) Date: Tue, 15 Nov 2011 21:38:21 -0800 Subject: SPUG: Perl hacker lurking for work. Message-ID: Got mentally side-tracked by Ingy's pegex talk and lurked through the meeting, so I'll raise my hand for the virtual "who's looking for work" call? I'm a Perlish hacker with known web (Catalyst+Formbuilder+TT), kernel/driver and automation tendencies. Have recently played around in cluster devel (Pacemaker + Heartbeat). Not an SQL/DB expert, but I'm far from shy around such beasts (MySQL/PostgreSQL). Although Perl is usually my first resort, I'm a firm believer in using whichever tool will get the job done best. Currently located Kirkland, open to opportunities in Seattle, the Eastside and of a telecommute nature. If that sounds potentially useful, my LinkedIn page is http://www.linkedin.com/pub/noah-romer/4/79b/a9 and I'm happy to send a copy of my resume, as well. -- It's difficult to get a man to understand something when his salary depends on him not understanding it. - Upton Sinclair From amitsett at gmail.com Wed Nov 23 09:24:53 2011 From: amitsett at gmail.com (Amit Sett) Date: Wed, 23 Nov 2011 09:24:53 -0800 Subject: SPUG: Rounding error Message-ID: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> Hi, I wrote some code to calculate how much change to give to a customer. Other than simply calculating the difference between the balance and the change tendered, the program also calculates how many of each bill and coin type to give. The program works well except for some cases where it short changes a customer by 1 penny. I have attached the code and two examples below (one with and the other without the rounding issue). Any help to find out why the rounding error happens and/or suggest a better way to write the code would be appreciated. Regards, Amit ------------------------------------------- example 1 (No rounding error): ------------------------------------------- Enter the Bill Amount: 262.57 Enter the Paid Amount: 500.00 Bill total is : $262.57 Paid amount is : $500.00 ------------------------ Change comes to: $237.43 2 hundred dollar bills, 1 twenty dollar bill, 1 ten dollar bill, 1 five dollar bill, 2 one dollar bills, 1 quarter, 1 dime, 1 nickel, and 3 pennys. --------------------------------------- example 2 (Rounding error): --------------------------------------- Enter the Bill Amount: 262.99 Enter the Paid Amount: 500.00 Bill total is : $262.99 Paid amount is : $500.00 ------------------------ Change comes to: $237.01 2 hundred dollar bills, 1 twenty dollar bill, 1 ten dollar bill, 1 five dollar bill, and 2 one dollar bills. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CalculateChange.pl Type: text/x-perl-script Size: 1605 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From m3047 at m3047.net Wed Nov 23 09:48:20 2011 From: m3047 at m3047.net (Fred Morris) Date: Wed, 23 Nov 2011 10:48:20 -0700 Subject: SPUG: Rounding error In-Reply-To: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> References: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> Message-ID: <201111231048.21179.m3047@m3047.net> On Wednesday 23 November 2011 10:24, Amit Sett wrote: > [...] The program works well except for some cases where it short > changes a customer by 1 penny [...] Try doing things in pennies, e.g. a dollar is 100 pennies. Do you know what a repeating decimal is, and do you know what causes them? Basically any time you divide 1 by a prime number not in your number base you get a repeating decimal. For instance in base 10 (2 * 5) if you divide by 3, 7, 11, 13, etc. you get a repeating decimal. In base 2, dividing by 3, 5, 7, 11, etc does the same thing. If you divide by 100 (2 * 2 * 5 * 5) you get a repeating decimal, or in other words there is rounding error. ObMathNote: 0.9999999... actually is provably equal to 1. ;-) -- Fred From amitsett at gmail.com Wed Nov 23 10:10:14 2011 From: amitsett at gmail.com (Amit Sett) Date: Wed, 23 Nov 2011 10:10:14 -0800 Subject: SPUG: Rounding error In-Reply-To: <201111231048.21179.m3047@m3047.net> References: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> <201111231048.21179.m3047@m3047.net> Message-ID: Thanks Fred. I did things in pennies and it worked. -Amit On Wed, Nov 23, 2011 at 9:48 AM, Fred Morris wrote: > On Wednesday 23 November 2011 10:24, Amit Sett wrote: > > [...] The program works well except for some cases where it short > > changes a customer by 1 penny [...] > > Try doing things in pennies, e.g. a dollar is 100 pennies. > > Do you know what a repeating decimal is, and do you know what causes them? > Basically any time you divide 1 by a prime number not in your number base > you > get a repeating decimal. > > For instance in base 10 (2 * 5) if you divide by 3, 7, 11, 13, etc. you > get a > repeating decimal. > > In base 2, dividing by 3, 5, 7, 11, etc does the same thing. If you divide > by > 100 (2 * 2 * 5 * 5) you get a repeating decimal, or in other words there is > rounding error. > > ObMathNote: 0.9999999... actually is provably equal to 1. ;-) > > -- > > Fred > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelrwolf at att.net Wed Nov 23 19:49:49 2011 From: michaelrwolf at att.net (michaelrwolf at att.net) Date: Wed, 23 Nov 2011 19:49:49 -0800 (PST) Subject: SPUG: Rounding error In-Reply-To: References: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> <201111231048.21179.m3047@m3047.net> Message-ID: <1322106589.92883.YahooMailRC@web181402.mail.ne1.yahoo.com> Heck, there's been more than 500% inflation since the penny was useful. Do it in nickels. Or dimes. My personal opinion (worth 2 of the things I think are useless) is that the penny should have gone the way of the lira when the dollar coin came out, and do a hardware register shift right (register as in cash register), leaving the nickel as the smallest coin in the till. Heck, they should have done it twice, and gotten a $2 coin (or $5), and done away with the nickel. It was interesting (to my penny-ante-mind) how they made change in Italy (30 years ago) when they still had the lira. It was difficult to get a 50 lira bill that was structurally sound enough to hold itself together so most transactions rounded to 100-ish lira. Mas o minas, to go polyglot on you. All this US-anal-retentive-penny-retentive accounting is a waste of time, and time is money. Riddle me this, joker... If it takes you more than a penny's time to account for a penny, what's that called? Amit... Hope the "don't use fractions" design pattern helped. My rant was independent of that. I really *do* hope that you're dealing with a business where the more important aspect is do you have enough bits to hold that many pennies! Michael R. Wolf ____MichaelRWolf at att.net ________All mammals learn by playing. ________________________________ From: Amit Sett To: Fred Morris Cc: SPUG Sent: Wed, November 23, 2011 10:10:14 AM Subject: Re: SPUG: Rounding error Thanks Fred. I did things in pennies and it worked. -Amit On Wed, Nov 23, 2011 at 9:48 AM, Fred Morris wrote: On Wednesday 23 November 2011 10:24, Amit Sett wrote: >> [...] The program works well except for some cases where it short >> changes a customer by 1 penny [...] > >Try doing things in pennies, e.g. a dollar is 100 pennies. > >Do you know what a repeating decimal is, and do you know what causes them? >Basically any time you divide 1 by a prime number not in your number base you >get a repeating decimal. > >For instance in base 10 (2 * 5) if you divide by 3, 7, 11, 13, etc. you get a >repeating decimal. > >In base 2, dividing by 3, 5, 7, 11, etc does the same thing. If you divide by >100 (2 * 2 * 5 * 5) you get a repeating decimal, or in other words there is >rounding error. > >ObMathNote: 0.9999999... actually is provably equal to 1. ;-) > >-- > >Fred > >_____________________________________________________________ >Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org >SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjuran at gmail.com Sat Nov 26 03:57:41 2011 From: jjuran at gmail.com (Joshua Juran) Date: Sat, 26 Nov 2011 03:57:41 -0800 Subject: SPUG: Rounding error In-Reply-To: <1322106589.92883.YahooMailRC@web181402.mail.ne1.yahoo.com> References: <04C55BE6-1CCF-4A68-836C-AB0420345E54@gmail.com> <201111231048.21179.m3047@m3047.net> <1322106589.92883.YahooMailRC@web181402.mail.ne1.yahoo.com> Message-ID: On Nov 23, 2011, at 7:49 PM, michaelrwolf at att.net wrote: > If it takes you more than a penny's time to account for a penny, > what's that called? 'Penny-wise and pound-foolish'? See also 'thrashing'. Josh