From eric at intellovations.com Fri Jul 1 09:44:27 2016 From: eric at intellovations.com (Eric Floehr) Date: Fri, 1 Jul 2016 09:44:27 -0400 Subject: [CentralOH] 2016-07-06 11:30 Wednesday Python Lunch at Bar 145 In-Reply-To: <20160630201359.68e96dbd.jep200404@columbus.rr.com> References: <20160630201359.68e96dbd.jep200404@columbus.rr.com> Message-ID: RSVP Here: http://www.meetup.com/Central-Ohio-Python-Users-Group/events/232302823/ On Thu, Jun 30, 2016 at 8:13 PM, wrote: > Wednesday Python Lunch at Bar 145 > > July 6, 2016, 11:30 a.m. > > Bar 145[1] > 955 West Fifth Ave, Columbus, OH 43212[2] > > We'll be meeting for good food and good company. Join us to talk Python, > programming, or anything else! > > [1] http://bar145columbus.com/ > [2] http://www.openstreetmap.org/search?query=955 West Fifth Ave, > Columbus, OH 43212#map=19/39.98806/-83.03156 > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Fri Jul 1 22:32:11 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 1 Jul 2016 22:32:11 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-01_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gbGF0ZSBuaWdodCBjb2ZmZWUgc2hvcCBkYXRhIGFu?= =?utf-8?q?alysis_cockroachdb_tornado_logbook_behave_nuvinci_docopt_nash_e?= =?utf-8?q?quilibrium?= Message-ID: <20160701223211.7c3b93b1.jep200404@columbus.rr.com> What's a good all night coffee shop in Cowtown where one can hang-out with a laptop? data analysis mining credit card info health care info trading http://trading-shim.org/ talk python to me podcast.init wp: prefix means Wikipedia To get good answers, consider following the advice in the links below. http://catb.org/~esr/faqs/smart-questions.html http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html wp:Ben Darnell wp:Cockroach Labs wp:FriendFeed wp:Tornado (web server) https://pypi.python.org/pypi/tornado logbook https://pypi.python.org/pypi/Logbook much easier than using the python logging module Adam Englander bdd with behave for beginners http://adamknowsstuff.com/ wp:NuVinci Continuously Variable Transmission docopt https://pypi.python.org/pypi/docopt/ wp:Nash equilibrium From jep200404 at columbus.rr.com Wed Jul 6 18:03:04 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Wed, 6 Jul 2016 18:03:04 -0400 Subject: [CentralOH] =?utf-8?q?2016-06-27_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IEdlbmVyYXRvcnBhbG9vemEgSTogbmVzdGVkIGxv?= =?utf-8?q?op_word_counting_nested_generators_verbose_regexes_=27C=3A=5Cne?= =?utf-8?q?w=5Ctest=27_project_euler_=231_refactoring_primes_continue_stat?= =?utf-8?q?ement_recursive_permutations_gcd_in_musical_round__364_twelve_d?= =?utf-8?q?ays_of_christmas_hypothesis?= Message-ID: <20160706180304.7895bf1f.jep200404@columbus.rr.com> Todo: register with PyOhio! July 7th is last day to get T-shirts. Generatorpalooza! This month focused on generators. Code is posted on https://github.com/cohpy/challenge-201605-generators. Three Pythonistas submitted code. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # James Prior presented: A technique for breaking out of nested loops by using a generator to yield tuples of values. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/b-break-out-of-nested-loops.ipynb Someone from Pillar mentioned another way of breaking out of nested loops by using a return statement. A word counting program rewritten to use generators instead of appending to lists. lists: https://github.com/cohpy/challenge-201605-generators/blob/master/james-prior/wordpop.py.0-lists.2e522fe748e20ee031749cbd504f0c46600b480d (copy of https://github.com/folkengine/whats-the-frequency-kenneth/blob/master/wordpop.py) A typical function pattern for lists was: def foo(lines): ... new_stuff = [] for line in lines: new_stuff.append(bar(line)) ... return new_stuff generators: https://github.com/cohpy/challenge-201605-generators/blob/master/james-prior/wordpop.py.1-gen.0d534ed5a17f41b36939f14a658736d015e085f9 Oddly, most of the functions used "yield from" statements, not mere "yield" statements. A classic form was shown in the following function: def get_words_from_lines(lines): for line in lines: yield from line.lower().split() One function was particularly tricky: def strip_header(lines): for line in lines: if line.startswith(TEXT_BOUNDARY): yield from lines The trickiness is that lines is referred to twice, first as the iterable in the for statement, then as the iterable in the yield from statement. The yield from lines statement yields lines that have not already been iterated through in the for statement. Is this _too_ tricky, or is an idiom that one should master? Using shell pipe syntax for nested generators. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/8-nested-generators-20160626-1920.ipynb First showed how one ugly, complicated, hard-to-read generator was split into three simple generators that each do one thing well. But nesting of generators can be hard to read. Reading of nested generators is generally backwards, i.e., from right to left, with matching of parameters needing ones eyes to search back and forth. "This is not a pipe." Showed alternative syntax similar to that of UNIX shell. Showed code to do it. Compare with http://coconut-lang.org/ There is a whole 'nuther thing. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Travis Risner presented on regular expressions (regexes) in Python as a dry run for presenting at PyOhio. He showed the verbose mode of coding regular expressions. https://docs.python.org/3/library/re.html#re.VERBOSE verbose mode is nifty Compare: filename = 'C:\new\test' filename = r'C:\new\test' Study: cohpy at forge:~$ python3 Python 3.4.3 (default, Oct 14 2015, 20:33:09) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> s = 'C:\new\test' >>> len(s) 9 >>> s = r'C:\new\test' >>> len(s) 11 >>> cohpy at forge:~$ Study by searching for "raw" in https://docs.python.org/3/reference/lexical_analysis.html. For filenames in Microsoft Windows, avoid the backslash issues by not using them.. Python groks the following just fine in Microsoft Windows: for line in open('C:/new/test') Raw strings are still handy for regular expressions. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Joe Friedrich presented his code which solves Problem #1 of Project Euler: https://github.com/cohpy/challenge-201605-generators/tree/master/joefriedrich Travis showed his solutions for the same problem, using a variety of techniques. Then Jim showed his solutions for the same problem, using even more techniques, including one that directly calculated the answer and and was smoking fast, even for extremely large numbers. Look at the output of the last cell in http://nbviewer.jupyter.org/url/colug.net/python/all-ipython-notebooks/euler-001-multiples-of-3-and-5-20150220.ipynb Search for euler-001 on http://colug.net/python/all-ipython-notebooks/. You will find other versions. Joe, Travis, and Jim all reinvented the wheel many times in solving Problem #1 of Project Euler. That's fine. It's good for learning. When you do not have an itch to scratch, the Project Euler problems are good to practice on. Many of the problems, especially the early ones, are well known to many. So they can be discussed and compared. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # back to James Prior Refactoring of a function that calculated December meeting dates. The refactored code happened to have one generator function and two functions that returned generator expressions. original code: https://github.com/cohpy/challenge-201605-generators/blob/master/james-prior/cell01-original.py pretty refactored code: https://github.com/cohpy/challenge-201605-generators/blob/master/james-prior/cell53-pretty.py distilled essence of nastiness code: https://github.com/cohpy/challenge-201605-generators/blob/master/james-prior/cell65-nasty.py step by step refactoring: http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/5-dojo-20160429-2016-Mar-COhPy_Challenge_Rough-20160625-1612.ipynb This refactors the code, changing one little thing at a time. This shows each little step in great detail. This is for novices to study. primes Reviewed how continue statement can be used to reduce need for indenting code. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/2-primes.ipynb Optimization with square root applies to sieve of eratosthenes also. That was missing from the above code. permutations The interesting part was that it was recursive. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/3-permutate.ipynb pythagorean triples The interesting part were the three versions of gcd() (greatest common divisor) The gcd() in cell #5 is interesting for not copying any data. wp:Three Blind Mice wp:Round (music) and use of reduce() to apply gcd to three numbers. The wheel was reinvented (again). https://docs.python.org/3.5/library/math.html#math.gcd Notebook ran Python 3.4.3, so it was not available. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/4-pythagorean-triples.ipynb simple "yield from" examples Can apply yield from with just about any iterable. Applying it to open('threelines.txt') was surprising. http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/a-yield-from.ipynb Twelve Days of Christmas wp:On-Line Encyclopedia of Integer Sequences oooo aaahhhh!!! generates numerical sequences with repeat 1s count triangular numbers tetrahedral numbers 364 total gifts for Twelve Days of Christmas what is the name for the accumulation of tetrahedral numbers? oeis.org/A000332 wp:Epiphany season not presented: http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/1-range.ipynb http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/7-iter_date-revisited.ipynb not done music generator wp:David A. Jaffe wp:Music Kit wp:NeXT Staff Sergeant Christopher L. Brown Memorial Highway http://codes.ohio.gov/orc/5533.052 BoxOfMusic channel on YouTube eric stoddard??? stocker??? wp:French Republican Calendar wp:Stardate wp:Perfluorooctanoic acid Document Dump: Lawsuit Reveals Extent Of DuPont?s C8 Cover Up http://www.desmogblog.com/2016/06/19/document-dump-lawsuit-reveals-extent-dupont-s-c8-cover http://www.aboutlawsuits.com/dupont-c8/ quickcheck-ci.com shrinkage free for open source shrinkage: start with many randomly generated tests prune boring tests, concentrating on problematic ones hypothesis for python how does it compare with pytest? https://pypi.python.org/pypi/hypothesis 'I urge everyone to fight back' ? woman wins $10k from Microsoft over Windows 10 misery http://www.theregister.co.uk/2016/06/27/woman_microsoft_windows_10_upgrades/ boots of spanish leather positively fourth street Sony Settles in Linux Battle http://www.linuxjournal.com/content/sony-settles-linux-battle piperize how to make work with: generators that expect iterable as first argument generators that expect iterable as second argument generators that use send/yield does that work with things where more is yielded than consumed or vice versa? perhaps use different decorators (that are compatible with each other) @piperize_first_arg_iterable def foo(iterable, *args): ... @piperize_second_arg_iterable def goo(x, iterable, *arg): ... @piperize_send def hoo(*args): ... (where hoo() uses send) perhaps use different wrapper classes? F(foo(iterable, *args)) G(goo(x, iterable)) H(hoo(*args)) (where hoo() uses send) to maybe do: permutate: try: copy then delete chris-b redo nested generators to use shell syntax apply piperize to cell #65 of refactored joe pyflakes pylint tests pytest hypothesis????? cohpy website gmt issue From nludban at columbus.rr.com Wed Jul 6 20:58:47 2016 From: nludban at columbus.rr.com (Neil Ludban) Date: Wed, 6 Jul 2016 20:58:47 -0400 Subject: [CentralOH] =?iso-8859-1?q?2016-06-27_=3F=3F_Scribbles_=3F=3F/?= =?iso-8859-1?q?=3F=3F=3F=3A_Generatorpalooza_I=3A_nested_loop_word_counti?= =?iso-8859-1?q?ng_nested_generators_verbose_regexes_=27C=3A=5Cnew=5Ctest?= =?iso-8859-1?q?=27_project_euler_=231_refactoring_primes_continue_stateme?= =?iso-8859-1?q?nt_recursive_permutations_gcd_in_musical_round__364_twelve?= =?iso-8859-1?q?_days_of_christmas_hypothesis?= In-Reply-To: <20160706180304.7895bf1f.jep200404@columbus.rr.com> References: <20160706180304.7895bf1f.jep200404@columbus.rr.com> Message-ID: <20160706205847.3a28ed559707ea984a21efd4@columbus.rr.com> On Wed, 6 Jul 2016 18:03:04 -0400 jep200404 at columbus.rr.com wrote: > James Prior presented: > > A technique for breaking out of nested loops > by using a generator to yield tuples of values. > > http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/b-break-out-of-nested-loops.ipynb > > Someone from Pillar mentioned another way of breaking out of nested > loops by using a return statement. Yet another way: Python 2.7.9 (default, Nov 29 2015, 00:47:05) [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10 Type "help", "copyright", "credits" or "license" for more information. >>> for x,y,z in ( (x,y,z) ... for x in range(5) ... for y in range(x, 5) ... for z in range(3) ): ... print x, y, z ... if x == 2: ... break ... 0 0 0 0 0 1 0 0 2 0 1 0 0 1 1 0 1 2 0 2 0 0 2 1 0 2 2 0 3 0 0 3 1 0 3 2 0 4 0 0 4 1 0 4 2 1 1 0 1 1 1 1 1 2 1 2 0 1 2 1 1 2 2 1 3 0 1 3 1 1 3 2 1 4 0 1 4 1 1 4 2 2 2 0 >>> From jep200404 at columbus.rr.com Wed Jul 6 23:02:19 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Wed, 6 Jul 2016 23:02:19 -0400 Subject: [CentralOH] Breaking Out Of Nested Loops In-Reply-To: <20160706180304.7895bf1f.jep200404@columbus.rr.com> References: <20160706180304.7895bf1f.jep200404@columbus.rr.com> Message-ID: <20160706230219.477b433c.jep200404@columbus.rr.com> On Wed, 6 Jul 2016 18:03:04 -0400, jep200404 at columbus.rr.com wrote: > James Prior presented: > > A technique for breaking out of nested loops > by using a generator to yield tuples of values. > > http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/b-break-out-of-nested-loops.ipynb Travis Risner mentioned a technique using try and raise from "Python Pocket Reference" by Mark Lutz. I am guessing that the nested loops would be inside a try clause and a raise statement would be used instead of a break. What is the recommended exception to raise? Does putting nested loops inside a try clause rub PEP8 the wrong way? Travis, what does the book say? From jep200404 at columbus.rr.com Thu Jul 7 08:52:43 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 7 Jul 2016 08:52:43 -0400 Subject: [CentralOH] 2016-07-13 11:30 Wednesday Python Lunch at Aab Message-ID: <20160707085243.3dd10692.jep200404@columbus.rr.com> Wednesday Python Lunch at Aab July 13, 2016, 11:30 a.m. Aab India Restaurant[1] 1470 Grandview Ave[2] Columbus, OH 43212 We'll be meeting for good food and good company. Join us to talk Python, programming, or anything else! [1] http://aabindiarestaurants.com/ [2] https://www.openstreetmap.org/node/962881986#map=17/39.98795/-83.04423 From eric at intellovations.com Thu Jul 7 09:48:19 2016 From: eric at intellovations.com (Eric Floehr) Date: Thu, 7 Jul 2016 09:48:19 -0400 Subject: [CentralOH] 2016-07-13 11:30 Wednesday Python Lunch at Aab In-Reply-To: <20160707085243.3dd10692.jep200404@columbus.rr.com> References: <20160707085243.3dd10692.jep200404@columbus.rr.com> Message-ID: RSVP Here: http://www.meetup.com/Central-Ohio-Python-Users-Group/events/232443503/ On Thu, Jul 7, 2016 at 8:52 AM, wrote: > Wednesday Python Lunch at Aab > July 13, 2016, 11:30 a.m. > > Aab India Restaurant[1] > 1470 Grandview Ave[2] > Columbus, OH 43212 > > We'll be meeting for good food and good company. > Join us to talk Python, programming, or anything else! > > [1] http://aabindiarestaurants.com/ > [2] https://www.openstreetmap.org/node/962881986#map=17/39.98795/-83.04423 > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeptinker at gmail.com Thu Jul 7 22:10:26 2016 From: deeptinker at gmail.com (Travis Risner) Date: Thu, 7 Jul 2016 22:10:26 -0400 Subject: [CentralOH] Breaking Out Of Nested Loops In-Reply-To: <20160706230219.477b433c.jep200404@columbus.rr.com> References: <20160706180304.7895bf1f.jep200404@columbus.rr.com> <20160706230219.477b433c.jep200404@columbus.rr.com> Message-ID: <577F0B92.8060408@gmail.com> Hi Jim, T Python Pocket Reference book describes the function of the break statement and goes on to say "...Hint, raise and try statements can be used to exit multiple loop levels." nothing more. I wrote a program to test it out. It is available at https://github.com/deeppunster/deep-punster/blob/master/play_break.py HTH, Travis On 7/6/16 11:02 PM, jep200404 at columbus.rr.com wrote: > On Wed, 6 Jul 2016 18:03:04 -0400, jep200404 at columbus.rr.com wrote: > >> James Prior presented: >> >> A technique for breaking out of nested loops >> by using a generator to yield tuples of values. >> >> http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/b-break-out-of-nested-loops.ipynb > > Travis Risner mentioned a technique using try and raise > from "Python Pocket Reference" by Mark Lutz. > > I am guessing that the nested loops would be inside a try > clause and a raise statement would be used instead of > a break. What is the recommended exception to raise? > Does putting nested loops inside a try clause > rub PEP8 the wrong way? > > Travis, what does the book say? > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > From jep200404 at columbus.rr.com Fri Jul 8 23:06:46 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 8 Jul 2016 23:06:46 -0400 Subject: [CentralOH] Breaking Out Of Nested Loops: Multiple Techniques In-Reply-To: <20160706205847.3a28ed559707ea984a21efd4@columbus.rr.com> References: <20160706180304.7895bf1f.jep200404@columbus.rr.com> <20160706205847.3a28ed559707ea984a21efd4@columbus.rr.com> Message-ID: <20160708230646.474bf10a.jep200404@columbus.rr.com> On Wed, 6 Jul 2016 20:58:47 -0400, Neil Ludban wrote: > On Wed, 6 Jul 2016 18:03:04 -0400 jep200404 at columbus.rr.com wrote: > > A technique for breaking out of nested loops > > by using a generator to yield tuples of values. > Yet another way: > > Python 2.7.9 (default, Nov 29 2015, 00:47:05) > [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10 > Type "help", "copyright", "credits" or "license" for more information. > >>> for x,y,z in ( (x,y,z) > ... for x in range(5) > ... for y in range(x, 5) > ... for z in range(3) ): > ... print x, y, z > ... if x == 2: > ... break For the nested ranges, stackoverflow reveals a variation on your theme using itertools.product. http://stackoverflow.com/questions/25742107/how-to-break-nested-for-loop-in-python The following covers several techniques: http://stackoverflow.com/questions/653509/breaking-out-of-nested-loops try/raise (Travis Risner during meeting) StopIteration is recommended for the exception return (Pillar guy during meeting) new: slighty better than my if please_break: break else: continue break itertools.product (mentioned above) if x_loop_must_break: break (same as my technique during meeting) generator (in comments) Labeled break and continue were rejected. See PEP 3136. From jep200404 at columbus.rr.com Sat Jul 9 22:07:50 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 9 Jul 2016 22:07:50 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-08_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gaW5wdXQoKSBmcm9tIGlvLlN0cmluZ0lPKCkgY3N2?= =?utf-8?q?_try/except_EAFP_LBYL_regexes_xterm_links_scarf_mitigation_java?= =?utf-8?q?_ee_rice_libreoffice_defect_rate_machine_learning_identity_warr?= =?utf-8?q?anty_stickers_eye_tracking_breaking_nested_loops_books_buildoze?= =?utf-8?q?r_kivy_sed_=26_awk_iter=28partial=28input=2C_prompt=29=2C_=27qu?= =?utf-8?q?it=27=29_bash_in_ms_windows_!_in=2Eformat=28=29_loop_unrolling_?= =?utf-8?q?parade?= Message-ID: <20160709220750.76ad4338.jep200404@columbus.rr.com> First a question for you: How to make input() get its input from a file-like object like io.StringIO(data)? After you think about that, there is more meat than usual. someone needed to read in comma separated values and automatically convert the values to types. The initial attempt was based on regexes, but that was too difficult. Using the csv module in combination with try/except clauses was an easy solution. http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-easier-to-ask-for-forgiveness-than-permission-type-conversion.ipynb That person should go ahead and figure out how to do it with regexes, to understand what the limits of what is reasonable to do with regexes. Regexes are stupifyingly powerful for some things and terribly awkward and painful for other things. With experience one gets a feel for which things regexes are good, and for which things they are bad. Travis Risner's presentation about regexes touched on this. For validating dates in YYYY?MM?DD format, he recommended a hybrid approach. That used regexes for what they were good at and implied other validation for what regexes are not good at. He used regexes to validate and parse the basic YYYY?MM?DD format of dates. but did not try to use it for complete validation of dates. For example, for '2015-02-29', would pass his regex and parse it into year=2015, month=2, day=29. Separate validation would be required to determine that year=2015, month=2, day=29 is not a valid day. http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-date-validation-using-regex-and-try-except.ipynb 30 days in a terminal: Day 10 ? The experiment is over http://www.networkworld.com/article/3090404/linux/30-days-in-a-terminal-day-10-the-experiment-is-over.html Who needs a GUI? How to live in a Linux terminal. http://www.networkworld.com/article/3091139/linux/who-needs-a-gui-how-to-live-in-a-linux-terminal.html wp: prefix means Wikipedia To get good answers, consider following the advice in the links below. http://catb.org/~esr/faqs/smart-questions.html http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html By the way, viewing http://nbviewer.jupyter.org/* pages with links works. wp:ELinks Delhi Boy's 'Paparazzi-Proof' Scarf Is Hollywood's New Invisibility Cloak - And It Works Like Magic http://www.indiatimes.com/lifestyle/self/delhi-boy-s-paparazzi-proof-scarf-is-hollywood-s-new-invisibility-cloak-and-it-works-like-magic-257667.html What workarounds can you think of? Manually set exposure for desired subject, to avoid being fooled by reflection. Could a smart camera have a mode to avoid being fooled by bright reflections? Separate the flash from the camera by at least several feet. Scarf would reflect light back to flash, but not camera. Could mount the flash on a long pole that camera is fastened to. Could have somebody else hold flash. Could have flash triggered by radio to avoid wires. Use no flash at all. This would require long exposure times. Bewitched Bothered and Bewildered compare with Python: Java's creator and the Java EE Guardians group believe Oracle has all but abandoned the language http://www.infoworld.com/article/3082009/java/gosling-rallies-against-oracle-for-java-ee-neglect.html Java EE devotees plot to seize control from Oracle http://www.infoworld.com/article/3090528/java/java-ee-devotees-plot-to-seize-control-from-oracle.html How Oracle?s business as usual is threatening to kill Java Oracle's silence about Java EE has brought developer community distrust to a fever pitch. http://arstechnica.com/information-technology/2016/07/how-oracles-business-as-usual-is-threatening-to-kill-java/ NITTIO LED bulb E26, globe copper color http://www.ikea.com/us/en/catalog/products/10317348/ $7.99 see also: http://www.ikea.com/us/en/catalog/categories/departments/living_room/20515/ A good incandescent light bulb has 17 lumens / Watt. The LED light bulb above has only 11 lumens / Watt. Spagio open source food: Puffed Rice Cookies (peanut butter kind) 1 cup (269g) light corn syrup 1 cup (192g) sugar 1 cup (204g) peanut butter (TJ's creamy unsalted peanut butter) 6 cups (177g) puffed rice (compare to Rice Krispies) This stuff is sticky, so non-stick everything helps much. Taring the pot(s), then adding incredients by weight to pot on scale avoids getting measuring cups messy. Gently heat corn syrup and completely dissolve sugar in the corn syrup. Avoid boiling. Add in peanut butter and mix well. Gently heat to just beginning to boil. Add puffed rice and mix. Spread evenly on non-stick baking sheet with a non-stick spatula. work quickly: as it cools, it becomes hard to work. Wrap with plastic wrap and put in refrigerator to cool. After several hours of cooling, it becomes brittle. Take baking sheet of one big cookie out of refrigerator (still wrapped in plastic wrap). Flex baking sheet to get big cookie to separate from sheet. Whack the cookie (not the baking sheet) with the handle of a table knife to shatter the one big cookie into pieces. (the plastic wrap contains the little crumbs) Unwrap and put pieces on serving plate. The cookies are hygroscropic. Also, moist air will condense on cold cookies. To reduce absorption of water, rewrap with plastic wrap until serving. After wrapping the serving plate, Consolidate the crumbs left on the baking sheet for immediate "testing". LibreOffice's superlow defect rate puts proprietary software to shame http://www.infoworld.com/article/2687117/open-source-software/libreoffice-code-ten-times-better-than-proprietary.html The Windows Zealot http://fossforce.com/2016/07/the-windows-zealot/ Geek Guide: Machine Learning with Python http://www.linuxjournal.com/content/geek-guide-machine-learning-python Identity stuff http://www.linuxjournal.com/content/doing-user-space-what-we-did-kernel-space NSA classifies Linux Journal readers, Tor and Tails Linux users as "extremists" http://www.in.techspot.com/news/security/nsa-classifies-linux-journal-readers-tor-and-tails-linux-users-as-extremists/articleshow/47743699.cms wp:Elie Wiesel How Sony, Microsoft, and Other Gadget Makers Violate Federal Warranty http://motherboard.vice.com/read/warranty-void-if-removed-stickers-are-illegal http://www.meetup.com/Columbus-learntocode/ What languages and environments do they teach? Facebook: Tracking Your Web Activity Even After You Log Out? http://www.pcmag.com/article2/0,2817,2393564,00.asp Is facebook slacking by not using the following from your camera? wp:Eye tracking Breaking out of nested loops revisited yet again: (it will hurt your head) http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-breaking-out-of-nested-loops-to-variable-levels.ipynb inspired by: https://github.com/deeppunster/deep-punster/blob/master/play_break.py It is very Pythonic to try something and if it blows up, do something else. EAFP versus LBYL https://docs.python.org/3/glossary.html#term-lbyl https://docs.python.org/3/glossary.html#term-eafp http://code.activestate.com/lists/python-list/337643/ Compare EAFP versus LBYL for the following. wp:Time of check to time of use#Preventing TOCTTOU if mkdir lock_directory; then echo do something fi Learn You a Haskell for Great Good! http://learnyouahaskell.com/ https://www.nostarch.com/lyah.htm wp:The C Programming Language The first edition (aka old testament) was easier to read, but since it does not cover ANSI C, it is not recommended anymore. Kernighan & Ritchie did a superb job of writing. It is one of my benchmarks of good technical writing. The second edition (aka new testament) covers ANSI C, so it is what one should read. wp:Advanced Programming in the Unix Environment wp:W. Richard Stevens Stevens wrote unusually well. His writing was accurate, unambiguous, and comprehensive. It is not light fluffy reading. wp:The Art of Computer Programming This is hard core. wp:The Unix Programming Environment More good writing that is easy to read. Some programs it mentions are no longer relevant, but the ideas (the Unix philosophy) endures. Still worth reading in spite of bit rot. have not read and do not have an opinion about The Linux Command Line A Book By William Shotts http://linuxcommand.org/tlcl.php/ http://sourceforge.net/projects/linuxcommand/files/TLCL/13.07/TLCL-13.07.pdf/download I coulda been a contender a star is born Bill Dozer https://www.reverbnation.com/billdozer https://www.facebook.com/public/Bill-Dozer?_fb_noscript=1 compare: https://buildozer.io/ kivy wp:Nobody's Fool (1994 film) wp:True Detective (disambiguation) wp:Mulholland Drive (film) wp:Lost Highway (film) wp:Wild at Heart (film) wp:Laura Dern wp:Bruce Dern wp:Nashville (film) wp:The Great Gatsby (1974 film) wp:Robert Redford wp:Jeremiah Johnson (film) wp:Blue Velvet (film) wp:Angelo Badalamenti wp:Touch of Evil wp:The Third Man wp:The Third Man Theme wp:zither wp:Guzheng wp:Lisa Gerrard wp:Jaron Lanier wp:VPL Research wp:Oculus Rift Mastering Regular Expressions by Jeffrey Friedl is the definitive book for regular expressions http://regex.info/book.html sed & awk http://shop.oreilly.com/product/9781565922259.do for s in iter(partial(input, prompt), 'quit') http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-user-input-loop-with-iter-partial-input-prompt-sentinel.ipynb http://venturebeat.com/2016/03/30/microsoft-is-bringing-the-bash-shell-to-windows/ Have they actually done this or are they just yammering about it? .format ! def format_date(date): return '{0.year}/{0.month}/{0.day}'.format(date) (from cell #53 of http://nbviewer.jupyter.org/url/colug.net/python/all-ipython-notebooks/dojo-20160429-2016-Mar-COhPy_Challenge_Rough-20160625-1612.ipynb) wp:Lemba people wp:Y-chromosomal Aaron wp:Romani people wp:History of the Romani people#Genetic evidence wp:Wallis Simpson Fumbling toward faster fibonacci generator: http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-fibonacci-unroll-for-speed.ipynb There was a parade that went by the dojo. Video will be at colug.net/python/dojo/20160708/parade.mp4 From jep200404 at columbus.rr.com Sun Jul 10 21:16:57 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 10 Jul 2016 21:16:57 -0400 Subject: [CentralOH] input() from io.StringIO() In-Reply-To: <20160709220750.76ad4338.jep200404@columbus.rr.com> References: <20160709220750.76ad4338.jep200404@columbus.rr.com> Message-ID: <20160710211657.382d6174.jep200404@columbus.rr.com> On Sat, 9 Jul 2016 22:07:50 -0400, jep200404 at columbus.rr.com wrote: > How to make input() get its input from a file-like object > like io.StringIO(data)? I was having trouble with that in a Jupyter notebook and have not solved it in Jupyter notebook. There is no problem doing it in a standalone program such as https://github.com/james-prior/cohpy/blob/master/20160708-redirect-input-to-input-function.py Its output looks like the following. dojo at 4519_n_high:~/python$ ./20160708-redirect-input-to-input-function.py hello moby foo quit 123.456 before <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'> top inside <_io.StringIO object at 0xb719e41c> gimme: hello gimme: moby foo gimme: after <_io.StringIO object at 0xb719e41c> after restoring from backup <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'> dojo at 4519_n_high:~/python$ From jep200404 at columbus.rr.com Thu Jul 14 07:51:21 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 14 Jul 2016 07:51:21 -0400 Subject: [CentralOH] =?utf-8?q?2016-06-24_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gNC1mdW5jdGlvbiBjYWxjdWxhdG9yIGhhcnRtYW5u?= =?utf-8?q?_pipelines_sony_ps3_linux?= Message-ID: <20160714075121.37add415.jep200404@columbus.rr.com> http://thedailywtf.com/articles/OMGWTF-Finalist-01-The-Buggy-4Function-Calculator http://omg.worsethanfailure.com/Entries/Download/100043.zip (IBM) Hartmann pipelines pull instead of push Sony agrees to pay millions to gamers to settle PS3 Linux debacle http://arstechnica.com/tech-policy/2016/06/if-you-used-to-run-linux-on-your-ps3-you-could-get-55-from-sony/ From jep200404 at columbus.rr.com Thu Jul 14 08:37:59 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 14 Jul 2016 08:37:59 -0400 Subject: [CentralOH] 2016-07-13 Aab Paper Napkin Scribbles: graph theory isomorphism perspective IQ points invent future sieve of adkins faster generator testing Message-ID: <20160714083759.606b1375.jep200404@columbus.rr.com> wp:Graph theory wp:Graph isomorphism wp:Subgraph isomorphism problem Seven Bridges of K?nigsberg Leonhard Euler Project Euler Alan Kay Perspective is worth 80 IQ points. https://www.brainyquote.com/quotes/quotes/a/alankay375551.html https://mandswalks.wordpress.com/ http://michaelnielsen.org/blog/867/ A change in perspective is worth 80 IQ points. https://en.wikiquote.org/wiki/Alan_Kay People who are really serious about software should make their own hardware. http://www.folklore.org/StoryView.py?project=Macintosh&story=Creative_Think.txt The best way to predict the future is to invent it. https://en.wikiquote.org/wiki/Alan_Kay I don't know how many of you have ever met Dijkstra, but you probably know that arrogance in computer science is measured in nano-Dijkstras. https://en.wikiquote.org/wiki/Alan_Kay Even in a thoroughly mined field of interest sometimes folks come up with new stuff. Sieve of Eratosthenes Sieve of Adkins Newcomers to some field sometimes solve some problem long known by experts to be insolvable, because the newcomers don't know it's impossible. Their perspective is that they don't know it's impossible. [Computing] is just a fabulous place for that, because it's a place where you don't have to be a Ph.D. or anything else. It's a place where you can still be an artisan. People are willing to pay you if you're any good at all, and you have plenty of time for screwing around. -Alan Kay websockets xor'ing in randomness to thwart caching for testing generator speed, len(tuple(g)) -> sum(g) avoids building a big tuple in memory and blowing cache along with it Generators can be faster than building big lists, because generators can use less memory, enough less to stay in cache. Which Raymond Hettinger presentation talks about this? From jep200404 at columbus.rr.com Thu Jul 14 08:45:45 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 14 Jul 2016 08:45:45 -0400 Subject: [CentralOH] 2016-07-06 Bar145 Beverage Coaster Scribbles: excel xlwings anaconda fusion goggles2gone $1 or \1 to match previous group github passwords Message-ID: <20160714084545.5504aca2.jep200404@columbus.rr.com> bar145 good $5 hamburgers cooked to order good service Paid for $6.45 bill with $20 bill. Got $13 back. excel http://xlwings.org/ https://pypi.python.org/pypi/xlwings replace VBA with Python anaconda fusion python embedded in excel http://go.continuum.io/anaconda-fusion/ goggles2go (Los|El) Cerritos? get on mailing list, wait for an attractive sale Expired Domain Names list 2005-12-22_2 - 05-12 - ????? goggles2go.info gogh.org gogld.com Expired Domains 09/25/10 goforthechocolate.com goganocoffee.com goggles2go.com goggles4u.com? yyyy[ -/]mm[ -/]dd $1 or \1 to force second delimiter to match first delimiter wp:pcre https://duckduckgo.com/html/?q=ico8601+regex http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160706/cohpy-20160706-lunch-iso8601-regex.ipynb Did github's customers screw up? ?We encourage all users to practice good password hygiene and enable two-factor authentication to protect your account,? https://duckduckgo.com/html/?q=github+password+compromise http://venturebeat.com/2016/06/16/github-says-some-accounts-compromised-in-reused-password-attack/ .lan .net From herrold at owlriver.com Fri Jul 15 11:15:13 2016 From: herrold at owlriver.com (R P Herrold) Date: Fri, 15 Jul 2016 11:15:13 -0400 (EDT) Subject: [CentralOH] goggles2gone In-Reply-To: <20160714084545.5504aca2.jep200404@columbus.rr.com> References: <20160714084545.5504aca2.jep200404@columbus.rr.com> Message-ID: > goggles2go > (Los|El) Cerritos? > get on mailing list, wait for an attractive sale > > Expired Domain Names list 2005-12-22_2 - 05-12 > goggles2go.info gogh.org gogld.com > Expired Domains 09/25/10 > goforthechocolate.com goganocoffee.com goggles2go.com > > goggles4u.com? my fault for working from memory http://www.goggles4u.com/ probably a trade name for American Eye Vision Inc. which resolved to the same address 12611 Hiddencreek Way, Unit A/B Cerritos CA 90703 888 830 7857 --------------------- locally when I kept a downtown office, I formerly used Rinkov Optical on Gay street, but they are long out of business Then the local physical successor became: Northwest EyeCare Professionals Beth Travis, OD 2098 Tremont Center Columbus Ohio 43221 3108 (614)486-5205 and for 'mail order' specialty ANSI Z87.1+ high impact goggles http://edgeeyewear.com/ ---------------- [herrold at centos-7 pw]$ grep glasses * 2> /dev/null | grep type arlington_optical:type: glasses (a local vendor of sporting 'high impact' eyewear) edgeeyewear:type: glasses goggles4u:type: glasses northwest_optical:type: glasses From jep200404 at columbus.rr.com Sat Jul 16 17:29:59 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 16 Jul 2016 17:29:59 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-15_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gYXRsYXNzaWFuIGRpZmYgcmVnZXggdGlvYmUgNSo3?= =?utf-8?q?*17_try/except/break/goto_kivy_pylint_pyflakes_jedi_Magnolia_Th?= =?utf-8?q?underpussy_Pok=C3=A9mon_Go_hackerrank_smell_wipy_iot_natron_ind?= =?utf-8?q?entation_LBM?= Message-ID: <20160716172959.74198e8c.jep200404@columbus.rr.com> 2016-07-20 Atlassian User Group http://www.meetup.com/techlifecolumbus/events/232611358/ 6 Excellent Linux Diff Tools http://www.linuxlinks.com/article/20160709114700823/DiffTools.html Every country needs to follow Bulgaria?s lead in choosing open source software for governance http://thenextweb.com/insider/2016/07/05/every-government-needs-follow-bulgarias-lead-choosing-open-source-software/ https://github.com/osnr/horrifying-pdf-experiments regex links: https://docs.python.org/3/library/re.html http://regex.info/book.html http://shop.oreilly.com/product/9780596528126.do http://learnpython.org/en/Regular_Expressions http://www.regular-expressions.info/python.html https://www.debuggex.com/cheatsheet/regex/python http://www.tiobe.com/tiobe_index?page=index Java C C++ Python C# Zika who? UN fight for internet control lined up in Brazil http://www.theregister.co.uk/2015/11/13/un_fight_for_internet_control_lined_up_in_brazil/ Studio 595 shared workspace http://studio-595.com/ http://columbusregion.com/Start-Locate-Expand/Entrepreneur-Resources.aspx 5 hacks for landing your tech dream job https://opensource.com/business/16/7/5-hacks-for-landing-your-tech-dream-job Travis' way of breaking out of nested loops got me thinking about this bit of craziness: Is try/except the closest thing Python has to a goto statement? class CustomException(Exception): pass try: ... if whatever: raise CustomException ... except CustomException: ... It later reminded me that one of the few good uses of goto statements in C is to jump down to cleanup code after something bad happened. I.e., for error recovery, which is what try/except excels at. Try blocks should be as small as possible to avoid catching exceptions caused by other than what should really be concerned about. This is consistent with PEP8. Are custom exceptions a good technique for allowing large try blocks since the custom exceptions can not be caused accidentally by some other thing than a deliberate raise? Free Tools for Driving an Open Source Project to Success https://www.linux.com/news/free-tools-driving-open-source-project-success wp:Kivy wp:Qt (software) wp:tkinter wp:wxWidgets versus HTML5 w/websocket web app pylint checks for pep8 compliance default configuration is lousy pyflakes analyzes code and detects errors standalone or emacs or vim plugins Brandon Rhodes demonstrated this along with Jedi https://pypi.python.org/pypi/jedi brought the following books of his Python in Practive Mark Summerfield Effective Python 59 Specific Ways to Write Better Python Brett Slatkin Regular Expression Pocket Reference Tony Stublebine Regular Expressions Cookbook Jan Goyvaerts & Steven Levithan posited: One learns languages better when learning multiple languages at the same time, instead of learning one language at a time. I can do anything I want, but I can not do _everything_ that I want. http://lifehacker.com/5936303/you-can-do-anything-but-not-everything http://www.fastcompany.com/40384/you-can-do-anything-not-everything Another decided to finished learning Python before learning Ruby, Haskell, and Erlang. https://pypi.python.org/pypi/hypothesis Hypothesis is an advanced testing library for Python circleci.com Voltron Thundercats wp:Magnolia Thunderpussy https://www.facebook.com/magnoliathunder?_fb_noscript=1 wp:Pok?mon Go wp:Google Glass wp:Walking Dead ?Pokemon Go? players fall off 90-foot ocean bluff http://www.sandiegouniontribune.com/news/2016/jul/13/pokemon-go-encinitas-cliff-fall/ Missouri police say 4 teens used 'Pokemon Go' to rob people http://www.foxnews.com/us/2016/07/11/missouri-police-say-4-teens-used-pokemon-go-to-rob-people.html Former Marine Was Trying To "Catch" Pok?mon Sea Creature When He Drove Car Into Tree http://www.thesmokinggun.com/buster/car-crash/important-pokemon-go-crash-update-759302 UM police searching for suspect who robbed Pokemon Go players http://www.baltimoresun.com/news/maryland/crime/bs-md-umd-robberies-20160712-story.html http://dilbert.com/strip/2016-07-16 http://dilbert.com/strip/2016-07-15 http://dilbert.com/strip/2016-07-14 wp:HackerRank GNOME Maps Hits A Dead End, Can No Longer Display Maps http://www.omgubuntu.co.uk/2016/07/gnome-maps-dead-end-mapquest In programming, one gets a feel for bad things. Think "code smell". One can also develop a sense of situations that promote bad software. Apply that in other realms. Your instincts can save your life; listen to them! http://northeastparealestatesales.com/personal-safety-trust-your-instincts/ Nice: L.A. Dentist Saved by Israeli Girlfriend?s ?Sixth Sense? http://www.breitbart.com/california/2016/07/15/nice-california-witness/ WiPy - IOT Development Platform https://www.adafruit.com/products/3184 wp:Natron wp:Sintering wp:Egyptian faience http://www.logandaily.com/news/nelsonville-s-history-brick-by-brick/article_6504677b-1f1c-5fc7-80e9-edec9233cc61.html wp:Fourth-generation warfare wp:William S. Lind # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Looks good, but ain't. dojo at 4519_n_high:~$ cat indentation.py #!/usr/bin/env python3 import sys def main(args): for i, arg in enumerate(args): print('Argument #%s is %r' % (i, arg)) if __name__ == '__main__': main(sys.argv) dojo at 4519_n_high:~$ ./indentation.py hello world 'trojan rabbit' File "./indentation.py", line 7 print('Argument #%s is %r' % (i, arg)) ^ TabError: inconsistent use of tabs and spaces in indentation dojo at 4519_n_high:~$ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # dojo at 4519_n_high:~$ cat foo.py #!/usr/bin/env python3 a = ( 'hello' # This comment is ignored. ' ' 'world') print(a) dojo at 4519_n_high:~$ ./foo.py hello world dojo at 4519_n_high:~$ wp:Elvis wp:Graceland wp:Paul Simon http://www.sciotomile.com/event-listing/rhythm-on-the-river-7-15-2016/ The church across the street was holding its festival. From jep200404 at columbus.rr.com Sun Jul 17 16:23:28 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 17 Jul 2016 16:23:28 -0400 Subject: [CentralOH] Goggles For Searching: grep In-Reply-To: References: <20160714084545.5504aca2.jep200404@columbus.rr.com> Message-ID: <20160717162328.6b6b26c9.jep200404@columbus.rr.com> On Fri, 15 Jul 2016 11:15:13 -0400 (EDT), R P Herrold wrote: > [herrold at centos-7 pw]$ grep glasses * 2> /dev/null | grep type > arlington_optical:type: glasses (a local vendor of > sporting 'high impact' eyewear) > edgeeyewear:type: glasses > goggles4u:type: glasses > northwest_optical:type: glasses Thanks for that real-life example of what has been encouraged at the dojos: Save notes in plain text files. That makes them very easy to search. That simple technique follows several precepts as summed up by Mike Gancarz[1]: 1. Make each program do one thing well. R P Herrold used grep. grep looks for stuff. That's all it does. It does it well. 4. Choose portability over efficiency. Plain text files are remarkably portable. They work in all the common operating systems. You can put them up on the web, and everyone can read them. At worst, one might need to add a '.txt' filename ending and fuss with line endings for some operating systems. Compare that with the portability just between various versions of Microsoft Word. 5. Store data is flat text files. That makes them easy to work with and easy to debug. You don't need any special programs to look at them and there are many utilities that grok[2] plain text, but much fewer that grok non-plain text formats such as but not limited to Microsoft Word. How do you know if the format of a Microsoft Word document is messed up or not? How would you search 100 Microsoft Word documents? That is trivial with plain text files. 6. Use software levearge to your advantage. grep worked great for this. 8. Avoid captive user interfaces. Done. Imagine searching 100 documents from _within_ Microsoft Word. 9. Make every program a filter. This makes them easy to combine to do amazing stuff that individually they are not able to do. "Filter" is an artful term for a simple I/O structure for programs: Listen to (standard) input and talk to (standard) output. Unix shells allow one to easily combine simple "filter" programs to do amazing stuff. [1] https://en.wikipedia.org/wiki/The_unix_philosophy#Mike_Gancarz:_The_UNIX_Philosophy [2] http://www.merriam-webster.com/dictionary/grok From jep200404 at columbus.rr.com Tue Jul 19 10:18:05 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 19 Jul 2016 10:18:05 -0400 Subject: [CentralOH] =?utf-8?q?2016-02-19_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gdDExMHBsdXMgZmVhIHN5Zmkgcm9sbGVkIHRocmVh?= =?utf-8?q?ds_osu_open_source_club_tizen_make_sense_mess__liar=27s_poker_l?= =?utf-8?q?tcm_flash_boys_poundstone_stein_trs80_100_nec_pc-8201_writs?= Message-ID: <20160719101805.12a51e13.jep200404@columbus.rr.com> http://www.manualslib.com/manual/825339/Toshiba-T1100-Plus.html nice: http://pinout.xyz/ https://github.com/gadgetoid/Pinout2 FEA pycalculix https://sourceforge.net/projects/feval/ SyFi http://www.ondrejcertik.com/media/euroscipy2008.pdf rolled threads are stronger than cut threads https://en.wikipedia.org/wiki/Threading_(manufacturing)#Thread_forming_and_rolling UGQ9WUTmpA0 i like how the bolts get smoking hot. http://www.linuxuser.co.uk/features/100-ways-to-master-the-command-line-part-2 Manjaro Now Available for Raspberry Pi http://fossforce.com/2016/02/manjaro-now-available-raspberry-pi/ Add a battery pack to your Raspberry Pi http://www.linuxuser.co.uk/tutorials/add-a-battery-pack-to-your-raspberry-pi It seems that OSU's Open Source Club is alive. https://opensource.osu.edu/announcements/2016/02/16/vim_intermediate/ Tizen 3.0 joins growing list of Raspberry Pi Linux ports http://linuxgizmos.com/tizen-3-joins-growing-list-of-raspberry-pi-linux-ports/ How to Make Sense of Any Mess http://www.amazon.com/How-Make-Sense-Any-Mess/dp/1500615994 http://www.howtomakesenseofanymess.com/ https://opensource.com/life/16/2/book-review-how-make-sense-any-mess Liar's Poker 1989 Michael Lewis LTCM 1994-1998 When Genius Failed 2000 Roger Lowenstein invest in mundane businesses: Warren Buffett Flash Boys 2014 front running Fortune's Formula William Poundstone Bunkhouse Logic Ben Stein Dear Prudence The Beatles Toshiba 1100 PLUS http://www.toshiba-europe.com/computers/products/notebooks/t1100plus/ http://resource.toshiba-europe.com/europe/computers/flyers/classics/t1100plus_E.pdf https://en.wikipedia.org/wiki/Toshiba_T1100 http://www.manualslib.com/manual/825339/Toshiba-T1100-Plus.html TRS-80 Model 100 NEC_PC-8201 Encryption isn?t at stake, the FBI knows Apple already has the desired key http://arstechnica.com/apple/2016/02/encryption-isnt-at-stake-the-fbi-knows-apple-already-has-the-desired-key/ wp:All Writs Act Not code, per se. Just comments. Why Linux creator Linus Torvalds doesn't really care about open source http://www.techrepublic.com/article/linux-creator-linus-torvalds-doesnt-really-care-about-open-source/ From jep200404 at columbus.rr.com Sun Jul 24 10:30:49 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 24 Jul 2016 10:30:49 -0400 Subject: [CentralOH] 2016-07-27 12:00 Wednesday Python Lunch at Halwani Message-ID: <20160724103049.29db1179.jep200404@columbus.rr.com> Wednesday Python Lunch at Halwani July 27, 2016, 12:00 p.m. Halwani Cuisine 1453(B) Grandview Ave (along Ida Ave) Columbus, OH 43212 We'll be meeting for good food and good company. Join us to talk Python, programming, or anything else! Halwani has great pizza. They were the winner for best pizza for the 2015 Grandview Pizza Crawl. If Halwani is not open at noon, we will move to Mazah Eatery, two doors away at 1453 Grandview Ave. From eric at intellovations.com Sun Jul 24 16:10:03 2016 From: eric at intellovations.com (Eric Floehr) Date: Sun, 24 Jul 2016 16:10:03 -0400 Subject: [CentralOH] 2016-07-27 12:00 Wednesday Python Lunch at Halwani In-Reply-To: <20160724103049.29db1179.jep200404@columbus.rr.com> References: <20160724103049.29db1179.jep200404@columbus.rr.com> Message-ID: RSVP Here: http://www.meetup.com/Central-Ohio-Python-Users-Group/events/232850888/ On Sun, Jul 24, 2016 at 10:30 AM, wrote: > Wednesday Python Lunch at Halwani > > July 27, 2016, 12:00 p.m. > > Halwani Cuisine > 1453(B) Grandview Ave (along Ida Ave) > Columbus, OH 43212 > > We'll be meeting for good food and good company. > Join us to talk Python, programming, or anything else! > > Halwani has great pizza. > They were the winner for best pizza for the 2015 Grandview Pizza Crawl. > > If Halwani is not open at noon, > we will move to Mazah Eatery, > two doors away at 1453 Grandview Ave. > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Jul 26 11:32:30 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 26 Jul 2016 11:32:30 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-25_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IHB5b2hpby5vcmcgQ3Jpc3RpbmEgVmlkZWlyYSBM?= =?utf-8?q?opes=27_=22Exercises_in_Programming_Style=22_travis_risner_rege?= =?utf-8?q?x_automate_the_boring_stuff_al_sweigart_niel_ludban_numpy_scipy?= =?utf-8?q?_ufuncs_sinc_stem_plot_convolution?= Message-ID: <20160726113230.5a328306.jep200404@columbus.rr.com> Thanks again to Pillar and Chris Baker for hosting us at The Forge with plenty of food and beverages. Chris bought a 12' HDMI cable from Microcenter. It was the longest they had. PyOhio is this weekend. Go to pyohio.org to register. Jan is T-shirt chair PyOhio has some extra tee-shirts that they will sell off ############################################################################### Chris Baker talked a bit about the most interesting recent Python thing to him. Cristina Videira Lopes' "Exercises in Programming Style" book and Curry on presentation. The code is on github. Exercises in Programming Style http://www.ebooks.com/1520809/exercises-in-programming-style/lopes-cristina-videira/ ebook is PDF http://www.curry-on.org/ https://www.youtube.com/watch?v=JlPMOszyjjo word counting https://www.ics.uci.edu/~lopes/ https://www.ics.uci.edu/~lopes/https://github.com/christa https://github.com/crista/programming-conference.github.io https://github.com/crista/exercises-in-programming-style https://gist.github.com/folkengine/ce0eeb843c2791db44af46877a2bdc6f ############################################################################### 18:43-~19:30 travis risner presentation on regexes use regex objects as keys in a dictionary play_firewall_config.txt PlayParse.py presentation based on examples from Automate the Boring Stuff by Al Sweigart dojo has a copy of this https://automatetheboringstuff.com/ http://inventwithpython.com/ http://pyvideo.org/video/3692/automating-your-browser-and-desktop-apps Al gave the keynote at last year's PyOhio. https://github.com/deeppunster/RegEx101 None did not show up in Jupyter notebook Travis worked around that indirectly with print(mo3 == None) in cell #8 from http://nbviewer.jupyter.org/github/deeppunster/RegEx101/blob/master/RegEx 101 with answers.ipynb https://github.com/james-prior/RegEx101/commit/b8154371a155c8d7812e5e54daa1ddcd36a77f78 I need to: Need to make a little notebook about how to show None Also compare to Python prompt and standalone program. >>> repr('\n') versus repr('\n') in Jupyter Notebook versus standalone program .findall() is interesting regex = r'.at' matches 'at This that and the other.' starting at 10, not 0 to serve man wp:To Serve Man Nesting in monster verbose regex was hard to follow, so use indentation to indicate nesting (like Python does). https://github.com/james-prior/RegEx101/commit/33a457050636bdf1423aa0c04973f89deef87773 Show pictures of recommended book covers with links. Automate the Boring Stuff Mastering Regular Expressions by Jeffrey Friedl premature optimization is the root of all evil emacs versus vi https://www.xkcd.com/378/ Real Programmers ############################################################################### 19:37 Niel Ludban 1999-2000 first Python https://bitbucket.org/nludban/ https://bitbucket.org/nludban/cohpy-20160725-sigproc Pretty rendering. will show up in a couple of days need to distinguish input from output Jupyter Notebook makes that easy Forgot to ask what he thinks of bitbucket.org versus github this presentation is to show off numpy and scipy numpy and scipy are based on MATLAB smells like fortran in some places ufuncs http://docs.scipy.org/doc/numpy/reference/ufuncs.html stem plot to show emphasize (under)sampling http://matplotlib.org/examples/pylab_examples/stem_plot.html sinc function wp:Sinc function only multiple of ? that yields non-zero output is 0. sinc versus delta wp:Euler's identity j=sqrt(-1) eighth roots of i? Python ses "j" instead of "i" for square root of -1 to reduce accidents with the common variable name That's common in electrical engineering. https://en.wikipedia.org/wiki/Complex_numbers#Notation wp:Convolution used for pattern matching man on bicycle with fish shroud pictures standard hard to find image on internet http://www.phrases.org.uk/images/fish-bicycle.jpg https://fishandbicylces.files.wordpress.com/2012/06/bicycles-7.jpg From jep200404 at columbus.rr.com Tue Jul 26 11:44:50 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 26 Jul 2016 11:44:50 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-25_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IG5pZWwgLT4gbmVpbA==?= In-Reply-To: <20160726113230.5a328306.jep200404@columbus.rr.com> References: <20160726113230.5a328306.jep200404@columbus.rr.com> Message-ID: <20160726114450.40019536.jep200404@columbus.rr.com> On Tue, 26 Jul 2016 11:32:30 -0400, jep200404 at columbus.rr.com wrote: > Niel Ludban Oops: s/Niel/Neil/gi From james at atlantixeng.com Wed Jul 27 01:23:11 2016 From: james at atlantixeng.com (James Bonanno) Date: Wed, 27 Jul 2016 01:23:11 -0400 Subject: [CentralOH] Regex Parser in Python, Go Benchmark Message-ID: <9de1a4e4-de16-01fa-5d44-bd00ae3ebb56@atlantixeng.com> I have a Python3 program, containing a lexer/parser written in pure Regex's (re module) that runs in typically 50 milli-seconds for a typical file that is parses. Then I converted this program into Golang, and it typically runs in about 600 milli-seconds. I had to see what the fuss is all about. Since I use Regex's quite a bit, this has me very curious. I will say that the Python re module is quite nice, particularly the re.scanner(|.join(multiple_regex)) module that is somewhat of a hidden gem. I can't produce the same functionality in Go without hacking, and it became quite frustrating to simply try to have an iterable that contains the name,value pair of each regex obtained token in a string (or line of text.) In the end, this wasn't possible with the native Regex library in Go, because match names in named regex are a different api call versus match values of a regex. The glory of compiled languages seems to lose meaning without real world benchmarks, albeit I like how fast Go compiles in general. The re module in Python has been rugged and dependable. James From jep200404 at columbus.rr.com Thu Jul 28 23:12:54 2016 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 28 Jul 2016 23:12:54 -0400 Subject: [CentralOH] =?utf-8?q?2016-07-22_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gTmV4dCBEb2pvIEAgVGhlIEZvcmdlOyBNYWtpbmcg?= =?utf-8?q?dicts_for_str=2Etranslate=28=29=3A_nested_try/except=3B_code_go?= =?utf-8?q?lf_black_perl_variable_names_hungarian_notation_type_inferencin?= =?utf-8?q?g_jet_powershell_pareto_logbook_bisect_write_java_in_python_C?= =?utf-8?q?=23_CLR_str=2Ereplace=28=29_feynman_fortran_obfuscated_perl_con?= =?utf-8?q?test?= Message-ID: <20160728231254.15b14af5.jep200404@columbus.rr.com> Which cell of the following notebook is easiest for you to understand? How? Why? http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160722-dojo-making-translation-dictionaries.ipynb What have I missed in the following, especially starting with cell #8? http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-easier-to-ask-for-forgiveness-than-permission-type-conversion.ipynb https://github.com/cw-andrews/master_tbox/blob/master/csv_tools/__init__.py Next Friday's Dojo will NOT be at Panera. Instead it will be at The Forge. http://www.meetup.com/Central-Ohio-Python-Users-Group/events/232546325/ LOPSA scheduled an event at the same time as the next dojo/sprint :-( within a long walking distance of same. Chef and Rackspace are generously providing food and libations. https://sysadminday2016.eventbrite.com ;'' 6666,-2%{2+.2/@*\/10.3??2*+}* `50<~\; #truncate for webpage purposes -> 3141592653589793238462643383279502884197169399375 wp:Code golf wp: prefix means Wikipedia To get good answers, consider following the advice in the links below. http://catb.org/~esr/faqs/smart-questions.html http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html wp:Black_Perl#.22Black_Perl.22 wp:Hungarian notation type inferencing: (type specifying) wp:Microsoft Jet Database Engine powershell pipe of objects standardized options autocompletion dir -> get child directory structure env: wp:Pareto principle highly recommended: logbook fingerscrossedhandler dumps log if exception wp:Repo Man (film) bisect Java requires simple functions to be in classes!!! How about C#? C# is cleaned up Java. With different libraries. Compiled. CLR wp:Common Language Runtime need to study iter() and functools.partial(). http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-date-validation-using-regex-and-try-except.ipynb has a minor addition of a new cell to play with re.match.groups. 'hello, world,,'.replace(',', '') https://docs.python.org/3/library/stdtypes.html#str.replace wp:Richard Feynman wp:Surely You're Joking, Mr. Feynman! What happens if this breaks? he happened to point at something important You Can Write FORTRAN in any Language https://blog.codinghorror.com/you-can-write-fortran-in-any-language/ How Not to Write FORTRAN in Any Language http://queue.acm.org/detail.cfm?id=1039535 There?s no obfuscated Perl contest because it?s pointless. ?Jeff Polk ############################################################################### link farm Is it Pythonic to include the type of a variable in its name? https://duckduckgo.com/html/?q=variable+names+python+hungarian+notation Rocket science way way way before Python https://github.com/chrislgarry/Apollo-11 from Guido's patron https://blogs.dropbox.com/tech/2016/07/lepton-image-compression-saving-22-losslessly-from-images-at-15mbs/ Celebrate SysAdmin Day With Free, Weekly Linux Tutorials https://www.linux.com/blog/celebrate-sysadmin-day-free-weekly-linux-tutorials i7 Ways To Learn Linux In A Structured Manner http://linux.about.com/od/howtos/tp/7-Ways-To-Learn-Linux-In-A-Structured-Manner.htm Microsoft and Its Patent Minions at Nokia Still Have Patent Stacking Ambitions Against Android/Linux OEMs http://techrights.org/2016/07/17/patent-stacking-against-android/ Best Text based (Command Line) Web Browsers for Linux http://www.2daygeek.com/best-text-based-command-line-web-browser-for-linux/ A open source toolkit for building your own home https://opensource.com/life/16/7/getting-serious-about-open-source-homes Chemistry: Principles and Reactions, Seventh Edition http://bookzz.org/book/1182912/47354e/?_ir=1 Machine Learning, Deep Learning 101 http://www.ibm.com/developerworks/linux/library/l-machine-learning-deep-learning-trs/index.html?ca=drs- Top-10 Websites (Linux Blogs) to learn Linux http://www.2daygeek.com/best-websites-blogs-to-learn-linux/ Why and How to Use Ring Instead of Skype on Linux https://www.linux.com/learn/why-and-how-use-ring-instead-skype-linux The Ubuntu-powered BQ Aquaris M10 tablet: Almost amazing http://www.networkworld.com/article/3098324/linux/the-ubuntu-powered-bq-aquaris-m10-tablet-almost-amazing.html The first Ubuntu tablet is a desktop too http://www.cnet.com/products/bq-aquaris-m10-ubuntu-edition/ https://sourcemaking.com/design_patterns/singleton Singleton Design Pattern Just As We Warned: A Chinese Tech Giant Goes On The Patent Attack -- In East Texas https://www.techdirt.com/articles/20160718/06573135006/ How I use Linux for theoretical physics https://opensource.com/life/16/7/linux-theoretical-physics From ignatz at gmail.com Fri Jul 29 09:44:27 2016 From: ignatz at gmail.com (Chris Baker) Date: Fri, 29 Jul 2016 09:44:27 -0400 Subject: [CentralOH] Free Packt Python Regex Book Message-ID: Today's Packt Free Learning Ebook is Mastering Python Regular Expressions. https://www.packtpub.com/packt/offers/free-learning Good times! Chris Digital Horder -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Fri Jul 29 12:10:58 2016 From: eric at intellovations.com (Eric Floehr) Date: Fri, 29 Jul 2016 12:10:58 -0400 Subject: [CentralOH] Human Resource Machine -- game that teaches programming Message-ID: While it's not Python, there is a new game by the company that made World of Goo called Human Resource Machine that is a gentle and fun introduction to programming. If you have youngin's or even if you just want a puzzle challenge game, check it out: http://tomorrowcorporation.com/humanresourcemachine It's $10, DRM-free, and runs on Windows, Mac, and Linux. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Fri Jul 29 12:05:23 2016 From: eric at intellovations.com (Eric Floehr) Date: Fri, 29 Jul 2016 12:05:23 -0400 Subject: [CentralOH] BeeWare Sprint at PyOhio Message-ID: All, Russell Keith-Magee will be leading a sprint during PyOhio Sprints for BeeWare, which looks to be an awesome collection of Python modules and tools that follow the UNIX philosophy of doing one thing well. http://pybee.org/ Coincidentally, I just listened to a Python podcast interview of Russell where he talks about BeeWare. It's a good listen: http://podcastinit.com/russell-keith-magee-beeware.html See you at PyOhio! Info on Sprints: http://pyohio.org/sprints/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From sriveravi at gmail.com Fri Jul 29 13:44:39 2016 From: sriveravi at gmail.com (Samuel) Date: Fri, 29 Jul 2016 13:44:39 -0400 Subject: [CentralOH] embarrassingly parallel loops question Message-ID: Hello Group, So I have this embarrassingly parallel number crunching i'm trying to do in a for loop. Each iteration there is some crunching that is independent of all other iterations, so I was able to set this up pretty easy using a multiprocessing pool. (Side detail, each iteration depends on some common data structures that I make global and gives me the fastest cruch time versus passing to each thread explicitly). Takes about 30ms to run: import multiprocessing pool = multiprocessing.Pool( numCores) results = pool.map( crunchFunctionIter, xrange(len(setN))) Running on 1 core, tiny slowdown (~5ms overhead, ~35 ms to run) Running on 2 cores I get about a 2x speedup which is great and expected ( ~18ms to run). But the speedup saturates there and I can't get more juice even when upping to 4 or 6 cores. The thing is, all iterations are pretty much independent so I don't see why in theory I don't get close to a linear speedup. Or at least an (N-1) speedup. My guess is there is something weird with the memory sharing that is causing unnecessary overhead. Another colleague doing a similar embarrassingly parallel problem saw the same saturation at about 2 cores. Any thoughts on what is going on, or what I need to do to make this embarrassingly parallel thing speedup linearly? Should I just use a different library and set up my data structures a different way? Thanks, Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at joeshaw.org Fri Jul 29 14:35:36 2016 From: joe at joeshaw.org (Joe Shaw) Date: Fri, 29 Jul 2016 14:35:36 -0400 Subject: [CentralOH] embarrassingly parallel loops question In-Reply-To: References: Message-ID: Hi, If you're on Linux one thing you might want to try is the perf tool. That might give you a sense if the overhead is in the Python runtime, or if page faults or syscalls are the bottleneck. If you think it might be in the Python code itself, running with the built-in profiler might be helpful. I have no idea how either of these interact with multiprocessing, however. Lastly, cache line locality is a big deal. I don't know to what extent you can optimize memory layout in Python programs (maybe with numpy?) but if you can get data in contiguous memory you will greatly improve your L1/L2 cache hit rate and the CPU won't have to go to (comparatively much slower) RAM. Joe On Fri, Jul 29, 2016 at 1:44 PM, Samuel wrote: > Hello Group, > > So I have this embarrassingly parallel number crunching i'm trying to do > in a for loop. Each iteration there is some crunching that is independent > of all other iterations, so I was able to set this up pretty easy using a > multiprocessing pool. (Side detail, each iteration depends on some common > data structures that I make global and gives me the fastest cruch time > versus passing to each thread explicitly). Takes about 30ms to run: > > > import multiprocessing > pool = multiprocessing.Pool( numCores) > results = pool.map( crunchFunctionIter, xrange(len(setN))) > > > Running on 1 core, tiny slowdown (~5ms overhead, ~35 ms to run) > Running on 2 cores I get about a 2x speedup which is great and expected ( > ~18ms to run). > But the speedup saturates there and I can't get more juice even when > upping to 4 or 6 cores. > > The thing is, all iterations are pretty much independent so I don't see > why in theory I don't get close to a linear speedup. Or at least an (N-1) > speedup. My guess is there is something weird with the memory sharing that > is causing unnecessary overhead. Another colleague doing a similar > embarrassingly parallel problem saw the same saturation at about 2 cores. > > Any thoughts on what is going on, or what I need to do to make this > embarrassingly parallel thing speedup linearly? Should I just use a > different library and set up my data structures a different way? > > Thanks, > Sam > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bnmille at gmail.com Sat Jul 30 08:38:58 2016 From: bnmille at gmail.com (Brian) Date: Sat, 30 Jul 2016 08:38:58 -0400 Subject: [CentralOH] embarrassingly parallel loops question In-Reply-To: References: Message-ID: You will never get linear speed improvement with multi-core. There is a lot of kernel overhead needed to manage it. And the more cores, the more overhead. Also, are you running your tests on virtual machines? Due to the way multi-cores are allocated to a virtual machine, assigning more cores than necessary/needed can actually slow things down. On Jul 29, 2016 2:38 PM, "Joe Shaw" wrote: > > Hi, > > If you're on Linux one thing you might want to try is the perf tool. That might give you a sense if the overhead is in the Python runtime, or if page faults or syscalls are the bottleneck. If you think it might be in the Python code itself, running with the built-in profiler might be helpful. > > I have no idea how either of these interact with multiprocessing, however. > > Lastly, cache line locality is a big deal. I don't know to what extent you can optimize memory layout in Python programs (maybe with numpy?) but if you can get data in contiguous memory you will greatly improve your L1/L2 cache hit rate and the CPU won't have to go to (comparatively much slower) RAM. > > Joe > > On Fri, Jul 29, 2016 at 1:44 PM, Samuel wrote: >> >> Hello Group, >> >> So I have this embarrassingly parallel number crunching i'm trying to do in a for loop. Each iteration there is some crunching that is independent of all other iterations, so I was able to set this up pretty easy using a multiprocessing pool. (Side detail, each iteration depends on some common data structures that I make global and gives me the fastest cruch time versus passing to each thread explicitly). Takes about 30ms to run: >> >> >> import multiprocessing >> pool = multiprocessing.Pool( numCores) >> results = pool.map( crunchFunctionIter, xrange(len(setN))) >> >> >> Running on 1 core, tiny slowdown (~5ms overhead, ~35 ms to run) >> Running on 2 cores I get about a 2x speedup which is great and expected ( ~18ms to run). >> But the speedup saturates there and I can't get more juice even when upping to 4 or 6 cores. >> >> The thing is, all iterations are pretty much independent so I don't see why in theory I don't get close to a linear speedup. Or at least an (N-1) speedup. My guess is there is something weird with the memory sharing that is causing unnecessary overhead. Another colleague doing a similar embarrassingly parallel problem saw the same saturation at about 2 cores. >> >> Any thoughts on what is going on, or what I need to do to make this embarrassingly parallel thing speedup linearly? Should I just use a different library and set up my data structures a different way? >> >> Thanks, >> Sam >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nludban at columbus.rr.com Sun Jul 31 10:03:23 2016 From: nludban at columbus.rr.com (Neil Ludban) Date: Sun, 31 Jul 2016 10:03:23 -0400 Subject: [CentralOH] embarrassingly parallel loops question In-Reply-To: References: Message-ID: <20160731100323.23a241c9da07a3f4069d9d15@columbus.rr.com> Linear or better is possible, https://en.wikipedia.org/wiki/Speedup#Super-linear_speedup but unlikely with a high level interpreted language in only 30ms. The communication and synchronization between processes is the first thing to look at, especially if it's on a laptop with a power conserving scheduler policy. Try implementing what TBB calls grain size, ie break the list of tasks up into exactly numCores sublists to minimize the number of communications between processes. On Sat, 30 Jul 2016 08:38:58 -0400 Brian wrote: > You will never get linear speed improvement with multi-core. There is a > lot of kernel overhead needed to manage it. And the more cores, the more > overhead. Also, are you running your tests on virtual machines? Due to > the way multi-cores are allocated to a virtual machine, assigning more > cores than necessary/needed can actually slow things down. > > On Jul 29, 2016 2:38 PM, "Joe Shaw" wrote: > > > > Hi, > > > > If you're on Linux one thing you might want to try is the perf tool. > That might give you a sense if the overhead is in the Python runtime, or if > page faults or syscalls are the bottleneck. If you think it might be in > the Python code itself, running with the built-in profiler might be helpful. > > > > I have no idea how either of these interact with multiprocessing, however. > > > > Lastly, cache line locality is a big deal. I don't know to what extent > you can optimize memory layout in Python programs (maybe with numpy?) but > if you can get data in contiguous memory you will greatly improve your > L1/L2 cache hit rate and the CPU won't have to go to (comparatively much > slower) RAM. > > > > Joe > > > > On Fri, Jul 29, 2016 at 1:44 PM, Samuel wrote: > >> > >> Hello Group, > >> > >> So I have this embarrassingly parallel number crunching i'm trying to do > in a for loop. Each iteration there is some crunching that is independent > of all other iterations, so I was able to set this up pretty easy using a > multiprocessing pool. (Side detail, each iteration depends on some common > data structures that I make global and gives me the fastest cruch time > versus passing to each thread explicitly). Takes about 30ms to run: > >> > >> > >> import multiprocessing > >> pool = multiprocessing.Pool( numCores) > >> results = pool.map( crunchFunctionIter, xrange(len(setN))) > >> > >> > >> Running on 1 core, tiny slowdown (~5ms overhead, ~35 ms to run) > >> Running on 2 cores I get about a 2x speedup which is great and expected > ( ~18ms to run). > >> But the speedup saturates there and I can't get more juice even when > upping to 4 or 6 cores. > >> > >> The thing is, all iterations are pretty much independent so I don't see > why in theory I don't get close to a linear speedup. Or at least an (N-1) > speedup. My guess is there is something weird with the memory sharing that > is causing unnecessary overhead. Another colleague doing a similar > embarrassingly parallel problem saw the same saturation at about 2 cores. > >> > >> Any thoughts on what is going on, or what I need to do to make this > embarrassingly parallel thing speedup linearly? Should I just use a > different library and set up my data structures a different way? > >> > >> Thanks, > >> Sam