[CentralOH] 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
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Sat Jul 9 22:07:50 EDT 2016
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
More information about the CentralOH
mailing list