From joe at joeshaw.org Tue Oct 3 14:59:03 2017 From: joe at joeshaw.org (Joe Shaw) Date: Tue, 3 Oct 2017 14:59:03 -0400 Subject: [CentralOH] =?utf-8?q?2017-09-28_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gcmVjdXJzaXZlIHByaW1lIHNlYXJjaDsgd2F0?= =?utf-8?q?ching_refactoring=3B_coming_events?= In-Reply-To: <20170929172336.038a6643.jep200404@columbus.rr.com> References: <20170929172336.038a6643.jep200404@columbus.rr.com> Message-ID: Oooh, sharing .gitconfig aliases is my favorite. Mine: [alias] find = !sh -c 'git ls-files | grep --color=auto -i "$@" | less -FRSX' - fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" squash = "!f() { TARGET=$(git rev-parse "$1"); git commit --squash=$TARGET ${@:2} && git rebase -i --autostash --autosquash $TARGET^; }; f" ri = rebase --interactive --autosquash --autostash lt = log --graph --pretty=changes ll = log --numstat --pretty=changes ds = diff --staged dw = diff --word-diff ego = shortlog -s -n --no-merges pr = pull-request rbs = !git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ | column -t -s '*' undo = reset HEAD^ fpr = "!f() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; f" append = commit --amend --no-edit reword = commit --amend --reedit-message HEAD reauthor = commit --amend --no-edit --reset-author [pretty] changes = format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset Joe On Fri, Sep 29, 2017 at 5:23 PM, wrote: > https://github.com/joseph-albrecht/Project-Euler > https://github.com/joseph-albrecht/Project-Euler/blob/ > master/Problem%203%20-%20Largest%20Prime%20Factor.ipynb > > doj at sbc:~$ cat .gitconfig > ... > > [alias] > co = checkout > ci = commit > st = status > br = branch > hist = log --pretty=format:\"%h %ad %s%d [%an]%n%P parents%n%T > tree%n\" --graph --date=iso > hist = log --pretty=format:\"%h %ad %s%d [%an]%n\" --graph > --date=short > hist = log --pretty=format:\"%h %ad %cd %s%d [%an]%n\" --graph > --date=iso-local > hist = log --pretty=format:\"%h %ad %s%d [%an]\" --graph > --date=iso-local > hist = log --pretty=format:\"%h %ad %s%d [%an]\" --graph --date=raw > hist = log --pretty=format:\"%h %ad %cd %s%d [%an]\" --graph > --date=format-local:'%Y-%m-%d %H:%M:%S' > hist = log --pretty=format:\"%h %ad %s%d [%an]\" --graph > --date=format-local:'%Y-%m-%d %H:%M:%S' > type = cat-file -t > dump = cat-file -p > df = diff --color > dw = diff --color --word-diff > dm = difftool -t meld > dy = difftool -t meld -y > doj at sbc:~$ > > git clone https://github.com/james-prior/kraftur-math-game.git > cd kraftur-math-game > git co jep-dev > git hist --color=always | grep --color=always '([^)].*)\|$' > git hist | tac | awk 'NR > 1 {print $2}' | while read h; do git difftool > -t meld -y "$h"^ "$h" simpleMathGame.py;done > > recent notebooks: (not all are posted yet) > > http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/ > master/20170927-dojo-qtconsole-not-happy.ipynb > http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/ > master/20170928-dojo-iterating-over-dictionary-gets-keys.ipynb > http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/ > master/20170928-dojo-iter-sentinel-else.ipynb > http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/ > master/20170928-dojo-refactoring-kraftur-math-game.ipynb > http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/ > master/20170928-dojo-references-map-zip_longest-fstrings.ipynb > > wp:The Unix Programming Environment > > 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 > > V. Anton Spraul's Think Like a Programmer, Python Edition > http://www.linuxjournal.com/content/v-anton-sprauls-think- > programmer-python-edition > > Open source-based business lessons from a seasoned CEO > https://opensource.com/article/17/9/qa-evan-powell > > http://thefaradayproject.com/concept/ > > xdpyinfo | less > > Facebook Relents on React.js License Issue > http://windowsitpro.com/open-source/facebook-relents-reactjs-license-issue > > autonomous car uses Python > > Donkey Car > http://www.donkeycar.com/ > > Joint Meetup with VR Columbus: VR demo and robotics racing in the works > https://www.meetup.com/AutonomyHub/events/243521906/ > > Ohio Linuxfest 2017 > 2017-09-29 to 2017-09-30 > > Columbus Code Camp > 2017-10-14 > http://columbuscodecamp.com/ > > DevOps Days > https://www.devopsdays.org/events/2017-ohio/ > Wednesday, Nov 8, 2017 - Thursday, Nov 9, 2017 > The Bluestone > > Machine Vision with Python > openmv (open machine vision) > https://openmv.io/ > https://github.com/openmv/openmv > (opencv is too slow) > > What are the 7 stages of becoming a Python programmer? > The 7 stages of becoming a Go programmer > https://opensource.com/article/17/9/seven-stages-becoming-go-programmer > > Microsoft is Doing to ?Open Source? (OSI) What it Did to W3C > http://techrights.org/2017/09/28/osi-and-microsoft/ > > https://www.reddit.com/r/dailyprogrammer/comments/ > 6zvjre/20170913_challenge_331_intermediate_sum_of_digits/ > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dallascboys413 at gmail.com Thu Oct 5 07:23:06 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Thu, 5 Oct 2017 07:23:06 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Hello everyone, I have just started to dip my toes into python and I am looking for mentors and peers to help me learn. I am doing some free course and other material I have found online. My goal is to self teach using all these free courses and resources I have found. I would love to meet some people not only during the meetups but outside of it so I can pick your brain asking questions and other things to help me along my way. If you want to be a mentor or any advice that would be awesome. Thank you, Jacob -------------- next part -------------- An HTML attachment was scrubbed... URL: From y2k at y2kbugger.com Thu Oct 5 10:06:39 2017 From: y2k at y2kbugger.com (Zak Kohler) Date: Thu, 5 Oct 2017 10:06:39 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Where are you located? On Thu, Oct 5, 2017 at 7:23 AM, Jacob Escobedo wrote: > Hello everyone, > > I have just started to dip my toes into python and I am looking for > mentors and peers to help me learn. > > I am doing some free course and other material I have found online. My > goal is to self teach using all these free courses and resources I have > found. > > I would love to meet some people not only during the meetups but outside > of it so I can pick your brain asking questions and other things to help me > along my way. > > If you want to be a mentor or any advice that would be awesome. > > Thank you, > > Jacob > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dallascboys413 at gmail.com Thu Oct 5 10:31:28 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Thu, 5 Oct 2017 10:31:28 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Dublin area, off sawmill On Oct 5, 2017 10:19 AM, "Zak Kohler" wrote: > Where are you located? > > On Thu, Oct 5, 2017 at 7:23 AM, Jacob Escobedo > wrote: > >> Hello everyone, >> >> I have just started to dip my toes into python and I am looking for >> mentors and peers to help me learn. >> >> I am doing some free course and other material I have found online. My >> goal is to self teach using all these free courses and resources I have >> found. >> >> I would love to meet some people not only during the meetups but outside >> of it so I can pick your brain asking questions and other things to help me >> along my way. >> >> If you want to be a mentor or any advice that would be awesome. >> >> Thank you, >> >> Jacob >> >> _______________________________________________ >> 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 pybokeh at gmail.com Thu Oct 5 10:44:49 2017 From: pybokeh at gmail.com (pybokeh) Date: Thu, 5 Oct 2017 10:44:49 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: I'm in Dublin also. I can help when I can. But, if you're primarily interested in web development, I would suggest getting help from others. I only have basic knowledge in web dev. My domain knowledge is in data analysis or data science. It would help if you tell us what you want to use Python for. I understand if you don't know at this moment, but would help in narrowing the focus. Python can be used for a lot of things. - Daniel pybokeh at gmail.com On Oct 5, 2017 9:39 AM, "Jacob Escobedo" wrote: Hello everyone, I have just started to dip my toes into python and I am looking for mentors and peers to help me learn. I am doing some free course and other material I have found online. My goal is to self teach using all these free courses and resources I have found. I would love to meet some people not only during the meetups but outside of it so I can pick your brain asking questions and other things to help me along my way. If you want to be a mentor or any advice that would be awesome. Thank you, Jacob _______________________________________________ CentralOH mailing list CentralOH at python.org https://mail.python.org/mailman/listinfo/centraloh -------------- next part -------------- An HTML attachment was scrubbed... URL: From dallascboys413 at gmail.com Thu Oct 5 11:33:33 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Thu, 5 Oct 2017 11:33:33 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Yeah I'm leaning towards web development, but since I am new I'm not only focusing on that because I don't know what I enjoy doing yet. Jacob On Oct 5, 2017 10:45 AM, "pybokeh" wrote: > I'm in Dublin also. I can help when I can. But, if you're primarily > interested in web development, I would suggest getting help from others. I > only have basic knowledge in web dev. My domain knowledge is in data > analysis or data science. It would help if you tell us what you want to > use Python for. I understand if you don't know at this moment, but would > help in narrowing the focus. Python can be used for a lot of things. > > - Daniel > pybokeh at gmail.com > > > On Oct 5, 2017 9:39 AM, "Jacob Escobedo" wrote: > > Hello everyone, > > I have just started to dip my toes into python and I am looking for > mentors and peers to help me learn. > > I am doing some free course and other material I have found online. My > goal is to self teach using all these free courses and resources I have > found. > > I would love to meet some people not only during the meetups but outside > of it so I can pick your brain asking questions and other things to help me > along my way. > > If you want to be a mentor or any advice that would be awesome. > > Thank you, > > Jacob > > _______________________________________________ > 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 jep200404 at columbus.rr.com Thu Oct 5 12:44:51 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 5 Oct 2017 12:44:51 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: <20171005124451.3d038f17.jep200404@columbus.rr.com> On Thu, 5 Oct 2017 07:23:06 -0400, Jacob Escobedo wrote: > I would love to meet some people not only during the meetups but outside of > it so I can pick your brain asking questions and other things to help me > along my way. The weekly dojos are the place for exactly that. There is one tonight. See cohpy.org. From dallascboys413 at gmail.com Thu Oct 5 16:51:42 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Thu, 5 Oct 2017 16:51:42 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: <20171005124451.3d038f17.jep200404@columbus.rr.com> References: <20171005124451.3d038f17.jep200404@columbus.rr.com> Message-ID: Ok awesome I'll try to make it to all of those, unfortunately I can't tonight. Jacob On Oct 5, 2017 12:45 PM, wrote: > On Thu, 5 Oct 2017 07:23:06 -0400, Jacob Escobedo < > dallascboys413 at gmail.com> wrote: > > > I would love to meet some people not only during the meetups but outside > of > > it so I can pick your brain asking questions and other things to help me > > along my way. > > The weekly dojos are the place for exactly that. > There is one tonight. See cohpy.org. > _______________________________________________ > 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 Oct 6 01:47:52 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 6 Oct 2017 01:47:52 -0400 Subject: [CentralOH] =?utf-8?q?2017-10-05_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gaXRlcihmdW5jdGlvbiwgc2VudGluZWwpOyA4MCBj?= =?utf-8?q?haracters_per_line?= Message-ID: <20171006014752.6a2563bf.jep200404@columbus.rr.com> crowded tonight iter() with two arguments is good to know Compare cells 4 and 6 of: http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-user-input-loop-with-iter-partial-input-prompt-sentinel.ipynb http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160603-dojo-iter-second-argument.ipynb http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170928-dojo-iter-sentinel-else.ipynb max 80 characters per line to make it easy for people to read it's hard for people to read long lines my monitor can show 425 characters per line, my eyes can see it just fine but my brain has a tough time comprehending long lines newspapers chop width of paper up into narrow columns so that they are easy to read PEP 8 https://www.python.org/dev/peps/pep-0008/#maximum-line-length Limit all lines to a maximum of 79 characters. Linux kernel coding style: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings The limit on the length of lines is 80 columns and this is a strongly preferred limit Quoting Style http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html Broadly speaking, USENET articles should fit into 80 columns. A common recommendation is to keep new text wrapped at 72 columns, so that there is space for it to be quoted several times without exceeding the 80 column limit. How To Ask Questions The Smart Way http://catb.org/~esr/faqs/smart-questions.html Don't send e-mail in which entire paragraphs are single multiply-wrapped lines. (This makes it too difficult to reply to just part of the message.) Assume that your respondents will be reading mail on 80-character-wide text displays and set your line wrap accordingly, to something less than 80. what is url for zed shaw's recommendation? 3 Python web scrapers and crawlers https://opensource.com/resources/python/web-scraper-crawler 100 day coding challenge https://github.com/Kallaway/100-days-of-code Giant python attacks Indonesian man before being eaten http://www.pulse.ng/news/world/in-indonesia-giant-python-attacks-man-before-being-eaten-id7414025.html http://www.breitbart.com/news/giant-python-attacks-indonesian-man-before-being-eaten/ Adopting minimalism in your docs https://opensource.com/article/17/9/adopting-minimalism-your-docs Subutai: AirBnB for cloud computing http://www.linuxjournal.com/content/say-hi-subutai wp:Subutai 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 From jep200404 at columbus.rr.com Sun Oct 8 17:18:09 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Oct 2017 17:18:09 -0400 Subject: [CentralOH] 2017-10-19 11:30 Python Lunch at The Crest Gastropub Message-ID: <20171008171809.5ccc29ae.jep200404@columbus.rr.com> Python Lunch at The Crest Gastropub[1] October 19, 2017, 11:30 a.m. We'll be meeting at The Crest Gastropub, 2855 Indianola Ave., for good food and good company. Join us to talk Python, programming, or anything else! [1] The Crest Gastropub, 2855 Indianola Ave, Columbus, OH 43202[1] http://www.openstreetmap.org/way/389102227#map=16/40.0218/-83.0023 From miller.eric.t at gmail.com Mon Oct 9 10:53:41 2017 From: miller.eric.t at gmail.com (Eric Miller) Date: Mon, 9 Oct 2017 10:53:41 -0400 Subject: [CentralOH] PyCon 2018 CFP is Open! In-Reply-To: References: Message-ID: Hey Betsy- Are there any specific subject matter areas that the organizers are targeting for pc2018? e.g. 'we really hope to have entries for ' ? On Thu, Sep 28, 2017 at 5:06 PM, Betsy Waliszewski wrote: > Hi, > > Woohoo! The PyCon 2018 CFP is open! > > Here is a link to all the information: https://us.pycon.org/2018/speaking/ > > - Tutorial proposals ? deadline is 24 November 2017 AoE. > - Talk, Poster, and Education Summit proposals ? deadline is 3 January > 2018 AoE. > > If you know of a company who might be interested in sponsoring, feel free > to share our prospectus: https://us.pycon.org/2018/sponsors/prospectus/. > An email intro to me would be wonderful. > > Cheers, > > Betsy > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Mon Oct 9 16:29:41 2017 From: eric at intellovations.com (Eric Floehr) Date: Mon, 9 Oct 2017 16:29:41 -0400 Subject: [CentralOH] 2017-10-19 11:30 Python Lunch at The Crest Gastropub In-Reply-To: <20171008171809.5ccc29ae.jep200404@columbus.rr.com> References: <20171008171809.5ccc29ae.jep200404@columbus.rr.com> Message-ID: RSVP Here: https://www.meetup.com/Central-Ohio-Python-Users-Group/events/244064324/ On Sun, Oct 8, 2017 at 5:18 PM, wrote: > Python Lunch at The Crest Gastropub[1] > October 19, 2017, 11:30 a.m. > > We'll be meeting at The Crest Gastropub, 2855 Indianola Ave., > for good food and good company. > Join us to talk Python, programming, or anything else! > > [1] The Crest Gastropub, 2855 Indianola Ave, Columbus, OH 43202[1] > http://www.openstreetmap.org/way/389102227#map=16/40.0218/-83.0023 > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.costlow at gmail.com Mon Oct 9 20:45:45 2017 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Oct 2017 20:45:45 -0400 Subject: [CentralOH] Short term python gig available. Message-ID: I have a line on a Python project that would probably run until years end. Combination of custom Python code and Jenkins work for a CI/CD system. Contact me if interested. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.costlow at gmail.com Wed Oct 11 19:08:49 2017 From: brian.costlow at gmail.com (Brian Costlow) Date: Wed, 11 Oct 2017 19:08:49 -0400 Subject: [CentralOH] 4th Annual Columbus Tech Community Holiday Party Message-ID: Hope to see everyone there! http://columbusholidayparty.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Thu Oct 12 23:30:38 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 12 Oct 2017 23:30:38 -0400 Subject: [CentralOH] =?utf-8?q?2017-10-12_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gLnNwbGl0IC5qb2luIGFjY3VtdWxhdGUgZ2VuZXJh?= =?utf-8?q?tors_even_fibonacci_numbers_recursion?= Message-ID: <20171012233038.4b475d8e.jep200404@columbus.rr.com> git hist | tac | awk 'NR > 1 {print $2}' | while read h; do git dy "$h"^ "$h" simpleMathGame.py;done nested calls that never return many folks again tonight some code from tonight: http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20171012-dojo-splitting-and-joining-for-anki.ipynb http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20171012-dojo-generators.ipynb http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20171012-dojo-getting-attributes-of-object-by-name.ipynb Hopefully the person working on the anki stuff will post the many versions of main() that read and wrote a tab delimited file. Python's csv module is wunnerfull https://docs.python.org/3/library/csv.html#csv.DictReader wp:Project Euler https://projecteuler.net/archives problem #2: sum of even fibonacci numbers wp:Fibonacci number calculate fibonacci numbers recursively http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20150223-cohpy-memoization.ipynb http://nbviewer.jupyter.org/github/james-prior/euler/blob/master/euler-002-even-fibonacci-numbers-20130607.ipynb http://nbviewer.jupyter.org/github/james-prior/euler/blob/master/euler-002-even-fibonacci-numbers-20130729.ipynb http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/8-nested-generators-20160626-1920.ipynb wp:Shibboleth 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 git push -f -u origin master pyperclip http://pypi.python.org/pypi/pyperclip find | grep foo find -name '*.py' | grep -v '^[.]/env/' | xargs grep -H whatever wp:Stroop effect Purism Linux smartphone makes its $1.5 million crowdfunding goal http://www.zdnet.com/article/purism-linux-smartphone-makes-its-1-5-million-crowdfunding-goal/ python-hwinfo : Display Summary Of Hardware Information Using Standard Linux Utilities https://www.2daygeek.com/python-hwinfo-check-display-system-hardware-configuration-information-linux/ Connect To Wifi From The Linux Command Line https://linuxconfig.org/connect-to-wifi-from-the-linux-command-line 25 Free Books To Learn Linux For Free https://itsfoss.com/learn-linux-for-free/ compare to jupyter notebook with numpy,scipy,sympy,pandas Using Octave on Fedora 26 https://fedoramagazine.org/using-octave-fedora-26/ Mozilla pilots Cliqz engine in Firefox to slurp user browsing data Updated: Mozilla insists the pilot program will improve user privacy, not lessen it. http://www.zdnet.com/article/firefox-tests-cliqz-engine-which-slurps-user-browsing-data/ Does the last MP3 patent expire on 2017-12-30? wp:MP3#Licensing.2C_ownership_and_legislation (Using a python program to:) Working with YouTube and Extracting Audio http://www.linuxjournal.com/content/working-youtube-and-extracting-audio How would you replace the shell scripting with Python? From jep200404 at columbus.rr.com Fri Oct 20 22:24:22 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 20 Oct 2017 22:24:22 -0400 Subject: [CentralOH] =?utf-8?b?MjAxNy0xMC0yMCDnh5XmnIggTHVuY2ggUGxhY2Vt?= =?utf-8?q?at_Scribbles=3A_tcl_braces_versus_python=3B_fibonacci_versus_ha?= =?utf-8?q?mming?= Message-ID: <20171020222422.124f124b.jep200404@columbus.rr.com> more code than usual lunch: tcl braces versus python fibonacci and hamming numbers tcl without braces is painfully slow doj at sbc:~/20171026$ cat FibForXNoBraces.tcl proc Fib {n} { if {$n == 0} { set Ret_Value 0 } else { if {$n < 3} { set Ret_Value 1 } else { set PrevVal 1 set ThisVal 1 for {set y 3} {$y <= $n} {incr y} { set Ret_Value [expr $PrevVal + $ThisVal] set PrevVal $ThisVal set ThisVal $Ret_Value } } } return $Ret_Value } puts "Please enter seed value:" gets stdin x set StartTime [clock microseconds] set Answer [Fib $x] set EndTime [clock microseconds] puts "Seed $x; Result $Answer" puts "Duration [expr $EndTime - $StartTime] microseconds" doj at sbc:~/20171026$ echo 11111 | tclsh FibForXNoBraces.tcl Please enter seed value: Seed 11111; Result 515...489 Duration 129277783 microseconds doj at sbc:~/20171026$ tcl with braces is fast doj at sbc:~/20171026$ cat FibForXWithBraces.tcl proc Fib {n} { if {$n == 0} { set Ret_Value 0 } else { if {$n < 3} { set Ret_Value 1 } else { set PrevVal 1 set ThisVal 1 for {set y 3} {$y <= $n} {incr y} { set Ret_Value [expr {$PrevVal + $ThisVal}] set PrevVal $ThisVal set ThisVal $Ret_Value } } } return $Ret_Value } puts "Please enter seed value:" gets stdin x set StartTime [clock microseconds] set Answer [Fib $x] set EndTime [clock microseconds] puts "Seed $x; Result $Answer" puts "Duration [expr $EndTime - $StartTime] microseconds" doj at sbc:~/20171026$ diff FibForXNoBraces.tcl FibForXWithBraces.tcl 12c12 < set Ret_Value [expr $PrevVal + $ThisVal] --- > set Ret_Value [expr {$PrevVal + $ThisVal}] doj at sbc:~/20171026$ echo 11111 | tclsh FibForXWithBraces.tcl Please enter seed value: Seed 11111; Result 515...489 Duration 42093 microseconds doj at sbc:~/20171026$ regular Python is faster (jupy) doj at sbc:~/20171026$ cat fib.py #!/usr/bin/env python3 import sys from timeit import timeit source_code = ''' def fib(n): if n == 0: return 0 a, b = 0, 1 for _ in range(n): a, b = b, a + b return a ''' exec(source_code) def main(): for arg in sys.argv[1:]: n = int(arg) number = 1000 elapsed_time = timeit('fib(%s)' % n, setup=source_code, number=number) print( f'{elapsed_time}s total / {number} loops -> ' f'{elapsed_time / number}s per loop for fib({n}) -> {fib(n)}' ) if __name__ == '__main__': main() (jupy) doj at sbc:~/20171026$ ./fib.py 0 1 2 3 4 5 6 7 11111 0.00038148299790918827s total / 1000 loops -> 3.814829979091883e-07s per loop for fib(0) -> 0 0.0018241599900647998s total / 1000 loops -> 1.8241599900647999e-06s per loop for fib(1) -> 1 0.0020077070221304893s total / 1000 loops -> 2.0077070221304894e-06s per loop for fib(2) -> 1 0.002059810038190335s total / 1000 loops -> 2.059810038190335e-06s per loop for fib(3) -> 2 0.0022625650162808597s total / 1000 loops -> 2.26256501628086e-06s per loop for fib(4) -> 3 0.0025070849806070328s total / 1000 loops -> 2.5070849806070328e-06s per loop for fib(5) -> 5 0.0026626960025168955s total / 1000 loops -> 2.6626960025168955e-06s per loop for fib(6) -> 8 0.002945350017398596s total / 1000 loops -> 2.945350017398596e-06s per loop for fib(7) -> 13 8.536355245974846s total / 1000 loops -> 0.008536355245974845s per loop for fib(11111) -> 515...489 (jupy) doj at sbc:~/20171026$ pypy is faster yet. This is the first time that I have used pypy. (jupy) doj at sbc:~/20171026$ cat fibpypy.py #!/usr/bin/env pypy import sys from timeit import timeit source_code = ''' def fib(n): if n == 0: return 0 a, b = 0, 1 for _ in range(n): a, b = b, a + b return a ''' exec(source_code) def main(): for arg in sys.argv[1:]: n = int(arg) number = 1000 elapsed_time = timeit('fib(%s)' % n, setup=source_code, number=number) print( '{0}s total / {1} loops -> ' '{2}s per loop for fib({3}) -> {4}'.format( elapsed_time, number, elapsed_time / number, n, fib(n), ) ) if __name__ == '__main__': main() (jupy) doj at sbc:~/20171026$ diff fib.py fibpypy.py 1c1 < #!/usr/bin/env python3 --- > #!/usr/bin/env pypy 24,25c24,31 < f'{elapsed_time}s total / {number} loops -> ' < f'{elapsed_time / number}s per loop for fib({n}) -> {fib(n)}' --- > '{0}s total / {1} loops -> ' > '{2}s per loop for fib({3}) -> {4}'.format( > elapsed_time, > number, > elapsed_time / number, > n, > fib(n), > ) (jupy) doj at sbc:~/20171026$ ./fibpypy.py 0 1 2 3 4 5 6 7 11111 0.00112700462341s total / 1000 loops -> 1.12700462341e-06s per loop for fib(0) -> 0 0.00417494773865s total / 1000 loops -> 4.17494773865e-06s per loop for fib(1) -> 1 0.00802302360535s total / 1000 loops -> 8.02302360535e-06s per loop for fib(2) -> 1 0.00941896438599s total / 1000 loops -> 9.41896438599e-06s per loop for fib(3) -> 2 0.0132009983063s total / 1000 loops -> 1.32009983063e-05s per loop for fib(4) -> 3 0.011430978775s total / 1000 loops -> 1.1430978775e-05s per loop for fib(5) -> 5 0.0093469619751s total / 1000 loops -> 9.3469619751e-06s per loop for fib(6) -> 8 0.00933718681335s total / 1000 loops -> 9.33718681335e-06s per loop for fib(7) -> 13 3.84163093567s total / 1000 loops -> 0.00384163093567s per loop for fib(11111) -> 515...489 (jupy) doj at sbc:~/20171026$ It had been a long time since I had looked at tcl. I think a big virtue of tcl is its smallness. ############################################################################### making hamming numbers wp:Smooth number wp:Hamming numbers wp:Richard Hamming 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 My first version is correct, but gobbles memory like crazy, much much worse than a naive recursive fibonacci function. It starts swapping soon, at which point all hope is lost. doj at sbc:~/20171026$ cat ham1.py #!/usr/bin/env python3 import sys from itertools import islice def ham(x=1): yield x g2 = ham(2 * x) g3 = ham(3 * x) g5 = ham(5 * x) x2 = next(g2) x3 = next(g3) x5 = next(g5) while True: x = min(x2, x3, x5) yield x if x2 == x: x2 = next(g2) if x3 == x: x3 = next(g3) if x5 == x: x5 = next(g5) def nth_hamming_number(n): return list(islice(ham(), n-1, n))[0] def main(): for arg in sys.argv[1:]: n = int(arg) x = nth_hamming_number(n) print(n, x) if __name__ == '__main__': main() doj at sbc:~/20171026$ doj at sbc:~/20171026$ time ./ham1.py 1 1 1 real 0m0.057s user 0m0.044s sys 0m0.012s doj at sbc:~/20171026$ time ./ham1.py 10 10 12 real 0m0.058s user 0m0.048s sys 0m0.012s doj at sbc:~/20171026$ time ./ham1.py 100 100 1536 real 0m0.087s user 0m0.072s sys 0m0.012s doj at sbc:~/20171026$ time ./ham1.py 200 200 16200 real 0m0.429s user 0m0.384s sys 0m0.044s doj at sbc:~/20171026$ time ./ham1.py 300 300 82944 real 0m2.950s user 0m2.696s sys 0m0.244s doj at sbc:~/20171026$ time ./ham1.py 400 400 311040 real 0m12.706s user 0m11.792s sys 0m0.884s doj at sbc:~/20171026$ time ./ham1.py 500 500 937500 real 0m41.093s user 0m38.336s sys 0m2.672s doj at sbc:~/20171026$ time ./ham1.py 600 this was killed after a long time of swapping Second version tries to avoid duplication, so is much faster and uses much much less memory. Seems to be fast enough for the 1000000th hamming number. It even seems to be correct. I wonder about using a decorator to avoid having the global dictionary. doj at sbc:~/20171026$ cat ham2.py #!/usr/bin/env python3 import sys from itertools import islice already_done = set() def ham(x=1): global already_done if x in already_done: return already_done |= {x} yield x x_from_generators = {} generators = (ham(prime * x) for prime in (2, 3, 5)) for g in generators: try: x_from_generators[g] = next(g) except StopIteration: pass while x_from_generators: x_min = min(x_from_generators.values()) yield x_min for g, x in x_from_generators.items(): if x != x_min: continue try: x_from_generators[g] = next(g) except StopIteration: x_from_generators.pop(g) def nth_hamming_number(n): return list(islice(ham(), n-1, n))[0] def main(): for arg in sys.argv[1:]: n = int(arg) x = nth_hamming_number(n) print(n, x) if __name__ == '__main__': main() doj at sbc:~/20171026$ doj at sbc:~/20171026$ time ./ham2.py 1 1 1 real 0m0.055s user 0m0.036s sys 0m0.020s doj at sbc:~/20171026$ time ./ham2.py 10 10 12 real 0m0.057s user 0m0.048s sys 0m0.004s doj at sbc:~/20171026$ time ./ham2.py 100 100 1536 real 0m0.061s user 0m0.048s sys 0m0.012s doj at sbc:~/20171026$ time ./ham2.py 1000 1000 51200000 real 0m0.111s user 0m0.080s sys 0m0.028s doj at sbc:~/20171026$ time ./ham2.py 10000 10000 288325195312500000 real 0m1.115s user 0m1.080s sys 0m0.032s doj at sbc:~/20171026$ time ./ham2.py 100000 100000 290142196707511001929482240000000000000 real 0m23.579s user 0m23.332s sys 0m0.200s doj at sbc:~/20171026$ time ./ham2.py 1000000 1000000 519312780448388736089589843750000000000000000000000000000000000000000000000000000000 real 8m31.437s user 8m27.944s sys 0m2.252s doj at sbc:~/20171026$ From jep200404 at columbus.rr.com Sat Oct 21 01:11:18 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 21 Oct 2017 01:11:18 -0400 Subject: [CentralOH] =?utf-8?b?MjAxNy0xMC0yMCDnh5XmnIggTHVuY2ggUGxhY2Vt?= =?utf-8?q?at_Scribbles=3A_Simplified_Code_Making_It_More_Readable?= In-Reply-To: <20171020222422.124f124b.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> Message-ID: <20171021011118.5867fb40.jep200404@columbus.rr.com> On Fri, 20 Oct 2017 22:24:22 -0400, jep200404 at columbus.rr.com wrote: > tcl braces > versus python > fibonacci and hamming numbers I simplified the tcl and Python fibonacci programs. Readability was improved. (jupy) doj at sbc:~/20171020$ cat fib-no-braces.tcl proc fib {n} { set a 0 set b 1 for {set i 0} {$i < $n} {incr i} { set c [expr $a + $b] set a $b set b $c } return $a } puts "Please enter seed value:" gets stdin x set StartTime [clock microseconds] set Answer [fib $x] set EndTime [clock microseconds] puts "Seed $x; Result $Answer" puts "Duration [expr $EndTime - $StartTime] microseconds" (jupy) doj at sbc:~/20171020$ (jupy) doj at sbc:~/20171020$ diff FibForXNoBraces.tcl fib-no-braces.tcl 1,16c1,7 < proc Fib {n} { < < if {$n == 0} { < set Ret_Value 0 < } else { < if {$n < 3} { < set Ret_Value 1 < } else { < set PrevVal 1 < set ThisVal 1 < for {set y 3} {$y <= $n} {incr y} { < set Ret_Value [expr $PrevVal + $ThisVal] < set PrevVal $ThisVal < set ThisVal $Ret_Value < } < } --- > proc fib {n} { > set a 0 > set b 1 > for {set i 0} {$i < $n} {incr i} { > set c [expr $a + $b] > set a $b > set b $c 18,20c9 < < return $Ret_Value < --- > return $a 28c17 < set Answer [Fib $x] --- > set Answer [fib $x] (jupy) doj at sbc:~/20171020$ ########################################################################### (jupy) doj at sbc:~/20171020$ cat fib-with-braces.tcl proc fib {n} { set a 0 set b 1 for {set i 0} {$i < $n} {incr i} { set c [expr {$a + $b}] set a $b set b $c } return $a } puts "Please enter seed value:" gets stdin x set StartTime [clock microseconds] set Answer [fib $x] set EndTime [clock microseconds] puts "Seed $x; Result $Answer" puts "Duration [expr $EndTime - $StartTime] microseconds" (jupy) doj at sbc:~/20171020$ (jupy) doj at sbc:~/20171020$ diff fib-no-braces.tcl fib-with-braces.tcl 5c5 < set c [expr $a + $b] --- > set c [expr {$a + $b}] (jupy) doj at sbc:~/20171020$ ########################################################################### (jupy) doj at sbc:~/20171020$ cat fib2.py #!/usr/bin/env python3 import sys from timeit import timeit source_code = ''' def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a ''' exec(source_code) def main(): for arg in sys.argv[1:]: n = int(arg) number = 1000 elapsed_time = timeit('fib(%s)' % n, setup=source_code, number=number) print( f'{elapsed_time}s total / {number} loops -> ' f'{elapsed_time / number}s per loop for fib({n}) -> {fib(n)}' ) if __name__ == '__main__': main() (jupy) doj at sbc:~/20171020$ diff fib.py fib2.py 8,9d7 < if n == 0: < return 0 (jupy) doj at sbc:~/20171020$ ########################################################################### As expected, those changes had negligible effects on the exection times. (jupy) doj at sbc:~/20171020$ echo 11111 | tclsh fib-no-braces.tcl Please enter seed value: Seed 11111; Result 515...489 Duration 129060134 microseconds (jupy) doj at sbc:~/20171020$ ########################################################################### (jupy) doj at sbc:~/20171020$ echo 11111 | tclsh fib-with-braces.tcl Please enter seed value: Seed 11111; Result 515...489 Duration 43387 microseconds (jupy) doj at sbc:~/20171020$ ########################################################################### (jupy) doj at sbc:~/20171020$ ./fib2.py 0 1 2 3 4 5 6 7 11111 0.0012247690001458977s total / 1000 loops -> 1.2247690001458977e-06s per loop for fib(0) -> 0 0.0017716410002321936s total / 1000 loops -> 1.7716410002321935e-06s per loop for fib(1) -> 1 0.0018954030001623323s total / 1000 loops -> 1.8954030001623324e-06s per loop for fib(2) -> 1 0.002083211000353913s total / 1000 loops -> 2.0832110003539127e-06s per loop for fib(3) -> 2 0.002242174000457453s total / 1000 loops -> 2.242174000457453e-06s per loop for fib(4) -> 3 0.002450655999382434s total / 1000 loops -> 2.450655999382434e-06s per loop for fib(5) -> 5 0.002553395000177261s total / 1000 loops -> 2.5533950001772608e-06s per loop for fib(6) -> 8 0.003030005000255187s total / 1000 loops -> 3.030005000255187e-06s per loop for fib(7) -> 13 8.490469498000493s total / 1000 loops -> 0.008490469498000494s per loop for fib(11111) -> 515...489 (jupy) doj at sbc:~/20171020$ From jmknapp at gmail.com Sat Oct 21 20:23:12 2017 From: jmknapp at gmail.com (Joe Knapp) Date: Sat, 21 Oct 2017 20:23:12 -0400 Subject: [CentralOH] =?utf-8?b?MjAxNy0xMC0yMCDnh5XmnIggTHVuY2ggUGxhY2Vt?= =?utf-8?q?at_Scribbles=3A_tcl_braces_versus_python=3B_fibonacci_ve?= =?utf-8?q?rsus_hamming?= In-Reply-To: <20171020222422.124f124b.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> Message-ID: On Fri, Oct 20, 2017 at 10:24 PM, wrote: > > ############################################################ > ################### > > making hamming numbers > > wp:Smooth number > wp:Hamming numbers > wp:Richard Hamming > One to add is: wp:Regular number That deals with 5-smooth numbers specifically. I think the term was coined by someone studying Babylonian (base 60) mathematics, which only allows division by such "regular" numbers. They also come up in music theory (intervals between notes in the 'just' tuning scheme). > Second version tries to avoid duplication, > so is much faster and uses much much less memory. > Seems to be fast enough for the 1000000th hamming number. > It even seems to be correct. > ... > doj at sbc:~/20171026$ time ./ham2.py 1000000 > 1000000 519312780448388736089589843750000000000000000000000000000000 > 000000000000000000000000 > > real 8m31.437s > user 8m27.944s > sys 0m2.252s > Not sure of the state of the art, but check out this old Dr. Dobbs article (2008): http://www.drdobbs.com/architecture-and-design/hamming-problem/228700538 They report a Lisp version that took 900 seconds to generate 127 million Hamming numbers. A lot people skip trying to calculate the entire sequence up to the nth Hamming number, instead just finding the nth number alone, using an algorithm described in the Dr, Dobbs article . This page: https://rosettacode.org/wiki/Hamming_numbers ...has a lot of implementations in different languages, but most are of the "just give the nth number" variety. Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Sat Oct 21 22:50:55 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 21 Oct 2017 22:50:55 -0400 Subject: [CentralOH] One Change Too Far: Got Rid of Temporary Variable In-Reply-To: <20171021011118.5867fb40.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> <20171021011118.5867fb40.jep200404@columbus.rr.com> Message-ID: <20171021225055.1a679c71.jep200404@columbus.rr.com> On Sat, 21 Oct 2017 01:11:18 -0400, jep200404 at columbus.rr.com wrote: > set c [expr $a + $b] > set a $b > set b $c Below: One change too far: Get rid of the temporary variable c that is above. It is interesting that it can be done at all. But golly, it sure is hard to understand how the program works now. The extra calculation also makes the program slower than the one that used the temporary variable. Also uses shebang. doj at sbc:~/20171020$ cat fib-without-c.tcl #!/usr/bin/env tclsh proc fib {n} { set a 0 set b 1 for {set i 0} {$i < $n} {incr i} { set b [expr {$a + $b}] set a [expr {$b - $a}] } return $a } puts "Please enter seed value:" gets stdin x set StartTime [clock microseconds] set Answer [fib $x] set EndTime [clock microseconds] puts "Seed $x; Result $Answer" puts "Duration [expr $EndTime - $StartTime] microseconds" doj at sbc:~/20171020$ doj at sbc:~/20171020$ diff fib-with-braces.tcl fib-without-c.tcl 7,9c7,8 < set c [expr {$a + $b}] < set a $b < set b $c --- > set b [expr {$a + $b}] > set a [expr {$b - $a}] doj at sbc:~/20171020$ doj at sbc:~/20171020$ echo 11111 | time ./fib-without-c.tcl Please enter seed value: Seed 11111; Result 515...489 Duration 81068 microseconds 0.11user 0.00system 0:00.11elapsed 97%CPU (0avgtext+0avgdata 4940maxresident)k 0inputs+0outputs (0major+356minor)pagefaults 0swaps doj at sbc:~/20171020$ From jep200404 at columbus.rr.com Sat Oct 21 23:05:38 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 21 Oct 2017 23:05:38 -0400 Subject: [CentralOH] Generalized ham() to smooth() In-Reply-To: <20171020222422.124f124b.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> Message-ID: <20171021230538.0f9b19f5.jep200404@columbus.rr.com> On Fri, 20 Oct 2017 22:24:22 -0400, jep200404 at columbus.rr.com wrote: > Second version tries to avoid duplication, > so is much faster and uses much much less memory. > Seems to be fast enough for the 1000000th hamming number. > It even seems to be correct. > I wonder about using a decorator to avoid having the global dictionary. > > doj at sbc:~/20171026$ cat ham2.py The ham() generator function from ham2.py has been generalized to smooth() in ham4.py below. Also, the annoying global has been eliminated. Surprisingly, the speed is very similar to previous versions. The hamming() function is just a thin wrapper around smooth(). doj at sbc:~/20171020$ cat ham4.py #!/usr/bin/env python3 import sys from itertools import islice def smooth(x, primes, already_done): if x in already_done: return already_done |= {x} yield x x_from_generators = {} generators = ( smooth(prime * x, primes, already_done) for prime in primes ) for g in generators: try: x_from_generators[g] = next(g) except StopIteration: pass while x_from_generators: x_min = min(x_from_generators.values()) yield x_min for g, x in x_from_generators.items(): if x != x_min: continue try: x_from_generators[g] = next(g) except StopIteration: x_from_generators.pop(g) def hamming(): yield from smooth(x=1, primes=(2, 3, 5), already_done=set()) def nth_hamming_number(n): return list(islice(hamming(), n-1, n))[0] def main(): for arg in sys.argv[1:]: n = int(arg) x = nth_hamming_number(n) print(n, x) if __name__ == '__main__': main() doj at sbc:~/20171020$ doj at sbc:~/20171020$ time ./ham4.py 1 1 1 real 0m0.054s user 0m0.032s sys 0m0.020s doj at sbc:~/20171020$ time ./ham4.py 10 10 12 real 0m0.056s user 0m0.048s sys 0m0.008s doj at sbc:~/20171020$ time ./ham4.py 100 100 1536 real 0m0.058s user 0m0.048s sys 0m0.004s doj at sbc:~/20171020$ time ./ham4.py 1000 1000 51200000 real 0m0.112s user 0m0.088s sys 0m0.024s doj at sbc:~/20171020$ time ./ham4.py 10000 10000 288325195312500000 real 0m1.141s user 0m1.112s sys 0m0.020s doj at sbc:~/20171020$ time ./ham4.py 100000 100000 290142196707511001929482240000000000000 real 0m23.773s user 0m23.524s sys 0m0.200s doj at sbc:~/20171020$ time ./ham4.py 1000000 1000000 519312780448388736089589843750000000000000000000000000000000000000000000000000000000 real 8m27.888s user 8m23.132s sys 0m2.724s doj at sbc:~/20171020$ From jep200404 at columbus.rr.com Sun Oct 22 06:42:16 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 22 Oct 2017 06:42:16 -0400 Subject: [CentralOH] =?utf-8?q?2017-10-19_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gdmVyc2lvbiBzaGliYm9sZXRoOyBicmFjZXMgaW4g?= =?utf-8?q?python=3B_pyflakes=3B_jedi=3B_breaking_out_of_nested_loops=3B_a?= =?utf-8?q?scii_art=3B_recursion_palooza_ioccc=3B_jupyter_notebook=3B_avoi?= =?utf-8?q?ding_sql_injection_attacks=3B_csv=3B_recursion=3B_fibonacci?= Message-ID: <20171022064216.26290187.jep200404@columbus.rr.com> many folks tonight Python version shibboleth: '...' versus '!' doj at sbc:~$ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import __hello__ Hello world... >>> doj at sbc:~$ doj at sbc:~$ python3 Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import __hello__ Hello world! >>> doj at sbc:~$ car needs fixed versus car needs to be fixed pop versus soda versus coke http://bigthink.com/strange-maps/308-the-pop-vs-soda-map https://laughingsquid.com/soda-pop-or-coke-maps-of-regional-dialect-variation-in-the-united-states/ http://www.mappery.com/Pop-vs-Soda-US-Map Perl is 30 years old around now. It surprised me that Perl is only four years older than Python. How to use braces instead of indentation to indicate structure. Python indentation https://en.wikipedia.org/wiki/Python_syntax_and_semantics#Indentation doj at sbc:~$ python2 Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from __future__ import braces File "", line 1 SyntaxError: not a chance >>> doj at sbc:~$ doj at sbc:~$ python3 Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from __future__ import braces File "", line 1 SyntaxError: not a chance >>> doj at sbc:~$ pyflakes jedi Someone asked about breaking out of nested loops. Study: http://nbviewer.jupyter.org/github/cohpy/challenge-201605-generators/blob/master/james-prior/b-break-out-of-nested-loops.ipynb http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20160708-dojo-breaking-out-of-nested-loops-to-variable-levels.ipynb 2016-07-08 ?? Scribbles ??/??? input() from io.StringIO() csv try/except EAFP LBYL regexes xterm links scarf mitigation java ee rice libreoffice defect rate machine learning identity warranty stickers eye tracking breaking nested loops books buildozer kivy sed & awk iter(partial(input, prompt), 'quit') bash in ms windows ! in.format() loop unrolling parade https://mail.python.org/pipermail/centraloh/2016-July/002895.html 2016-07-15 ?? Scribbles ??/??? atlassian diff regex tiobe 5*7*17 try/except/break/goto kivy pylint pyflakes jedi Magnolia Thunderpussy Pok?mon Go hackerrank smell wipy iot natron indentation LBM https://mail.python.org/pipermail/centraloh/2016-July/002901.html How to use an Arduino and Raspberry Pi to turn a fiber optic neural network into wall art https://opensource.com/article/17/10/fiber-optic-neural-network-art Learn how to program in Python by building a simple dice game https://opensource.com/article/17/10/python-101 ascii art way before ascii https://upload.wikimedia.org/wikipedia/commons/7/78/Brooklyn-Daily-Eagle-1875-01-06.png wp:IOCCC august entry of 1985 http://ioccc.org/years.html#1985 recursion palooza fans of recursion should figure out the following http://ioccc.org/1985/august/august.c 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 Meet Bill Pollock, founder of No Starch Press https://opensource.com/article/17/10/no-starch https://www.nostarch.com/catalog/python The Python 3 Standard Library by Example by Doug Hellmann anki monkey patching wrap wp:"Hello, World!" program conda create --yes --name erik2 python=2 jupyter source activate erik2 jupyter notebook --browser=firefox conda create --yes --name erik3 python=3 jupyter source activate erik3 jupyter notebook --browser=firefox https://xkcd.com/327/ PEP 249 -- Python Database API Specification v2.0 https://www.python.org/dev/peps/pep-0249/ django CSV File Reading and Writing https://docs.python.org/3/library/csv.html wp:recursion wp:Fibonacci number From dallascboys413 at gmail.com Mon Oct 23 09:55:02 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Mon, 23 Oct 2017 09:55:02 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: <20171005124451.3d038f17.jep200404@columbus.rr.com> Message-ID: Hello everyone again, I wanted to see if there was anyone or multiple people that are on the web development side that would be interested or able to meet up with me this weekend for like an hr or so, so I can ask some questions and get advice . Thanks again, Jacob On Oct 5, 2017 4:51 PM, "Jacob Escobedo" wrote: > Ok awesome I'll try to make it to all of those, unfortunately I can't > tonight. > > Jacob > > On Oct 5, 2017 12:45 PM, wrote: > >> On Thu, 5 Oct 2017 07:23:06 -0400, Jacob Escobedo < >> dallascboys413 at gmail.com> wrote: >> >> > I would love to meet some people not only during the meetups but >> outside of >> > it so I can pick your brain asking questions and other things to help me >> > along my way. >> >> The weekly dojos are the place for exactly that. >> There is one tonight. See cohpy.org. >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmknapp at gmail.com Mon Oct 23 14:09:14 2017 From: jmknapp at gmail.com (Joe Knapp) Date: Mon, 23 Oct 2017 14:09:14 -0400 Subject: [CentralOH] =?utf-8?b?MjAxNy0xMC0yMCDnh5XmnIggTHVuY2ggUGxhY2Vt?= =?utf-8?q?at_Scribbles=3A_tcl_braces_versus_python=3B_fibonacci_ve?= =?utf-8?q?rsus_hamming?= In-Reply-To: <20171020222422.124f124b.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> Message-ID: Re: Hamming numbers I tried a somewhat different approach to generating the Hamming sequence, based on classifying the intervals from one number to the next, i.e., the interval from 1 to 2 is 2/1 (2.0), from 2 to 3 is 3/2 (1.5)... from 1536 (the 100th Hamming number) to 1600 is 5^2/2^3 (1.08). It turns out that there is only a very limited number of discrete intervals from one Hamming number to the next in quite a large range. E.g., for the first 1.59 trillion Hamming numbers there are only 119 different intervals, each identified by an i,j,k triple where i,j,k are positive or negative integers. The example above for the 100th-101st interval is {-3,0,2}. As the Hamming number goes up the interval to the next one tends to go down, which makes sense because there are more possibilities that some combination of i,j,k will result in a fraction close to 1.0. Anyway, here's a C header file with the table in the struct hamtab[]: https://github.com/jmknapp/hammingnumbers/blob/master/hamseq.h So given a Hamming number with exponents {i,j,k}, to find the next number just look through the table for the first entry having {p2,p3,p5} such that i+p2 > 0 && j+p3 > 0 && i+p5 > 0 (since multiplication would just be adding the exponents). Voila! At most 119 entries have to be checked and only short int additions and comparisons are involved. That goes pretty fast, but a significant speedup (about a factor of 4 or 5) can come from not necessarily searching the table from the 0th index. The second struct in the header file shows a successor table (succtab[]) that has lists of all possible successors of each entry (just found empirically by running through the sequence once). This C code along with the header file implements the algorithm: https://github.com/jmknapp/hammingnumbers/blob/master/hamseq.c compiled with: gcc -std=c99 -O3 hamseq.c -o hamseq The attached plot shows the execution time on an i7-2600 3.4GHz machine--it takes about 2 seconds to generate the first 100 million Hamming numbers and several hours for the first trillion. I was thinking of porting this to python to see how it would go, but have a learning curve there. Would be a lot slower except maybe with pypy? Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohamm.png Type: image/png Size: 16961 bytes Desc: not available URL: From amyngbedinghaus at gmail.com Mon Oct 23 12:44:31 2017 From: amyngbedinghaus at gmail.com (Amy Bedinghaus) Date: Mon, 23 Oct 2017 12:44:31 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Hi Jacob, I also want to learn Python, and I also am primarily knowledgeable about web development. I'd love to talk strategy about how to get started with you. See you this Thursday at the dojo at Smokehouse? -Amy Amy Bedinghaus, MA (864) 381-1830 On Thu, Oct 5, 2017 at 11:33 AM, Jacob Escobedo wrote: > Yeah I'm leaning towards web development, but since I am new I'm not only > focusing on that because I don't know what I enjoy doing yet. > > > Jacob > > On Oct 5, 2017 10:45 AM, "pybokeh" wrote: > >> I'm in Dublin also. I can help when I can. But, if you're primarily >> interested in web development, I would suggest getting help from others. I >> only have basic knowledge in web dev. My domain knowledge is in data >> analysis or data science. It would help if you tell us what you want to >> use Python for. I understand if you don't know at this moment, but would >> help in narrowing the focus. Python can be used for a lot of things. >> >> - Daniel >> pybokeh at gmail.com >> >> >> On Oct 5, 2017 9:39 AM, "Jacob Escobedo" >> wrote: >> >> Hello everyone, >> >> I have just started to dip my toes into python and I am looking for >> mentors and peers to help me learn. >> >> I am doing some free course and other material I have found online. My >> goal is to self teach using all these free courses and resources I have >> found. >> >> I would love to meet some people not only during the meetups but outside >> of it so I can pick your brain asking questions and other things to help me >> along my way. >> >> If you want to be a mentor or any advice that would be awesome. >> >> Thank you, >> >> Jacob >> >> _______________________________________________ >> 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 >> >> > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dallascboys413 at gmail.com Mon Oct 23 16:52:42 2017 From: dallascboys413 at gmail.com (Jacob Escobedo) Date: Mon, 23 Oct 2017 16:52:42 -0400 Subject: [CentralOH] Beginner python user In-Reply-To: References: Message-ID: Yeah definitely I will see you there. On Oct 23, 2017 2:24 PM, "Amy Bedinghaus" wrote: > Hi Jacob, I also want to learn Python, and I also am primarily > knowledgeable about web development. I'd love to talk strategy about how > to get started with you. See you this Thursday at the dojo at Smokehouse? > -Amy > > Amy Bedinghaus, MA > (864) 381-1830 > > > On Thu, Oct 5, 2017 at 11:33 AM, Jacob Escobedo > wrote: > >> Yeah I'm leaning towards web development, but since I am new I'm not >> only focusing on that because I don't know what I enjoy doing yet. >> >> >> Jacob >> >> On Oct 5, 2017 10:45 AM, "pybokeh" wrote: >> >>> I'm in Dublin also. I can help when I can. But, if you're primarily >>> interested in web development, I would suggest getting help from others. I >>> only have basic knowledge in web dev. My domain knowledge is in data >>> analysis or data science. It would help if you tell us what you want to >>> use Python for. I understand if you don't know at this moment, but would >>> help in narrowing the focus. Python can be used for a lot of things. >>> >>> - Daniel >>> pybokeh at gmail.com >>> >>> >>> On Oct 5, 2017 9:39 AM, "Jacob Escobedo" >>> wrote: >>> >>> Hello everyone, >>> >>> I have just started to dip my toes into python and I am looking for >>> mentors and peers to help me learn. >>> >>> I am doing some free course and other material I have found online. My >>> goal is to self teach using all these free courses and resources I have >>> found. >>> >>> I would love to meet some people not only during the meetups but outside >>> of it so I can pick your brain asking questions and other things to help me >>> along my way. >>> >>> If you want to be a mentor or any advice that would be awesome. >>> >>> Thank you, >>> >>> Jacob >>> >>> _______________________________________________ >>> 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 >>> >>> >> _______________________________________________ >> 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 jep200404 at columbus.rr.com Fri Oct 27 02:46:36 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 27 Oct 2017 02:46:36 -0400 Subject: [CentralOH] =?utf-8?q?2017-10-26_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gSWRpb21hdGljIExvb3BzOiBpIDwgbiB2ZXJzdXMg?= =?utf-8?q?i_=3C=3D_n_-_1=3B_json?= Message-ID: <20171027024636.21fc7bd7.jep200404@columbus.rr.com> For terminating loops, i < n is the standard idiom, not i <= n - 1. One often needs a loop to do something n times. The most common starting value for a loop variable is 0 to use as an index into arrays. Hence the value of the loop variable the last time in the body of the loop will be n - 1. The idiomatic ways of writing such a loop in Python and C are: Python: for i in range(n): C: for (i = 0; i < n; i++) tcl: for {set i 0} {$i < $n} {incr i} Notice the tests in the C and tcl versions: C: i < n tcl: $i < $n The following could be used instead: C: i <= n - 1 tcl $i < $n - 1 For brevity, I will call the i < n versions "lt" and the i <= n - 1 versions "le". The le versions require n - 1 to be calculated, whereas the lt versions can use n as is. This favors the lt versions. For signed values in C, both the lt and le versions can "do nothing" gracefully. For unsigned values in C, the lt version can "do nothing" gracefully, but the le version can not "do nothing" gracefully. Consider the two following C code fragments: lt version: unsigned n; unsigned i; for (i = 0; i < n; i++) ... le version unsigned n; unsigned i; for (i = 0; i <= n - 1; i++) ... When n is 0, the lt version will correctly execute the body of the loop zero times. When n is 0, the le version will execute the loop infinitely. When n is 0, n - 1 is not -1. Instead n - 1 is the largest possible unsigned integer (aka UINT_MAX), so i <= n - 1 will always be true, so the loop is infinite. Below is an example of this. Study the output. doj at sbc:~/20171026$ cat loop.c #include #include void do_n_times(unsigned n) { unsigned i; printf("before lt loop to be done %u times\n", n); for (i = 0; i < n; i++) printf("inside lt loop i = %u\n", i); printf("after lt loop\n"); printf("before le loop to be done %u times\n", n); for (i = 0; i <= n - 1; i++) { printf("inside le loop i = %u\n", i); if (i == 5U) /* skip over boring middle number */ i = (-i); } printf("after le loop\n"); } int main(int argc, char *argv[]) { unsigned i; unsigned n; do_n_times(1U); do_n_times(0U); } doj at sbc:~/20171026$ ./loop | head -n 30 before lt loop to be done 1 times inside lt loop i = 0 after lt loop before le loop to be done 1 times inside le loop i = 0 after le loop before lt loop to be done 0 times after lt loop before le loop to be done 0 times inside le loop i = 0 inside le loop i = 1 inside le loop i = 2 inside le loop i = 3 inside le loop i = 4 inside le loop i = 5 inside le loop i = 4294967292 inside le loop i = 4294967293 inside le loop i = 4294967294 inside le loop i = 4294967295 inside le loop i = 0 inside le loop i = 1 inside le loop i = 2 inside le loop i = 3 inside le loop i = 4 inside le loop i = 5 inside le loop i = 4294967292 inside le loop i = 4294967293 inside le loop i = 4294967294 inside le loop i = 4294967295 inside le loop i = 0 doj at sbc:~/20171026$ Eventually, one learns to normally use the i < n test idiom. When one see that some other test is being used, one has to scrutinize it. See page 12 of "The Practice of Programming" by Kernighan & Pike. ############################################################################### 3 Tools to Help You Remember Linux Commands https://www.linux.com/learn/intro-to-linux/2017/10/3-tools-help-you-remember-linux-commands More ways to examine network connections on Linux https://www.networkworld.com/article/3233306/linux/more-ways-to-examine-network-connections-on-linux.html does it matter at all? Party Like It's 1987 - PC-MOS/386 Goes Open Source https://www.lifehacker.com.au/2017/10/party-like-its-1987-pc-mos386-goes-open-source/ How to Encode Data From Python To JSON https://linuxconfig.org/how-to-encode-data-from-python-to-json wp:Facter 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 From herrold at owlriver.com Fri Oct 27 11:17:51 2017 From: herrold at owlriver.com (R P Herrold) Date: Fri, 27 Oct 2017 11:17:51 -0400 (EDT) Subject: [CentralOH] =?euc-kr?b?MjAxNy0xMC0yNiDUs+3eIFNjcmliYmxlcyDR5t/2?= =?euc-kr?b?L+TC2f4/IElkaW9tYXRpYyBMb29wczogaSA8IG4gdmVyc3VzIGkgPD0gbiAt?= =?euc-kr?q?_1=3B_json?= In-Reply-To: <20171027024636.21fc7bd7.jep200404@columbus.rr.com> References: <20171027024636.21fc7bd7.jep200404@columbus.rr.com> Message-ID: On Fri, 27 Oct 2017, jep200404 at columbus.rr.com wrote: > For terminating loops, i < n is the standard idiom, not i <= n - 1. > See page 12 of "The Practice of Programming" by Kernighan & Pike. This is probably a caveat from another era -- modern language designers noticed this, and a 'forall', or 'foreach' construct is present in perl, php, modern C++, and so forth, helping 'verifiability' of code by moving to 'all in a set' type specification (more mathematical, in the sense of 'set theory') -- Russ herrold From jep200404 at columbus.rr.com Fri Oct 27 13:54:47 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 27 Oct 2017 13:54:47 -0400 Subject: [CentralOH] tcl braces versus no braces: what does the manual say In-Reply-To: <20171020222422.124f124b.jep200404@columbus.rr.com> References: <20171020222422.124f124b.jep200404@columbus.rr.com> Message-ID: <20171027135447.191992ee.jep200404@columbus.rr.com> What does the manual say? On Fri, 20 Oct 2017 22:24:22 -0400, jep200404 at columbus.rr.com wrote: > tcl without braces is painfully slow > tcl with braces is fast > doj at sbc:~/20171026$ diff FibForXNoBraces.tcl FibForXWithBraces.tcl > 12c12 > < set Ret_Value [expr $PrevVal + $ThisVal] > --- > > set Ret_Value [expr {$PrevVal + $ThisVal}] > doj at sbc:~/20171026$ echo 11111 | tclsh FibForXWithBraces.tcl The author of that code was perplexed by why the curly braces made such a huge difference in execution speed. What does the manual say? http://www.tcl.tk/man/tcl8.5/TclCmd/expr.htm#M25 From jmknapp at gmail.com Fri Oct 27 14:48:34 2017 From: jmknapp at gmail.com (Joe Knapp) Date: Fri, 27 Oct 2017 14:48:34 -0400 Subject: [CentralOH] Collatz conjecture Message-ID: In the vein of programming exercises involving sequences (Fibonacci, Hamming), here's another problem, a mathematical conjecture, that is very simple to state but at present is classified as unsolved. Start with any natural number x = 1,2,3,... For each step: -- if the number is odd, multiply x by 3 and add 1. -- if the number is even, divide x by 2 -- stop if x reachs 1, else continue That's it for constructing the sequence. E.g., starting with x=7: 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 The conjecture is that starting from any number will eventually lead to 1. To date, the conjecture has neither been proved, nor been disproven by counterexample (a sequence that grows to inifinity, or comes around in a cycle).. Legend has it that when this problem first went around university math departments in the 1960s, work came to a standstill at Yale and the University of Chicago for a month. Everyone thought that surely they could resolve this "simple" problem. A joke went around that it was a Soviet plot to slow mathematical research in the US. Per wikipedia: -------------------------- Paul Erd?s said about the Collatz conjecture: "Mathematics may not be ready for such problems." He also offered $500 for its solution. Jeffrey Lagarias in 2010 claimed that based only on known information about this problem, "this is an extraordinarily difficult problem, completely out of reach of present day mathematics." -------------------------- Pretty easy to program and explore though. To date, the conjecture has been verified on massively parallel computers up to about 10^20. One might say, well it just has to be true if it's good up to that level, but who knows? https://en.wikipedia.org/wiki/Collatz_conjecture https://www.youtube.com/watch?v=K0yMyUn--0s&t=2s Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: