[CentralOH] 2017-03-27 會議 Scribbles 落書/惡文?: max morlocke memory leaks; jim prior named groups in regular expressions and f-strings; tessel 2
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Thu Apr 6 18:55:08 EDT 2017
Thanks to Pillar Technology and Paul Schwendenman for their generous
hospitality. They gave us pizza, cookies, salad, and beer.
Be sure to respond to meetup so Pillar they how much pizza to order.
(don't forget to add cohpy and techlife columbus counts)
out of town
came from Dayton
came from Tiffin
(he should bring Brandon!)
announcements
give back hack
givebackhack.com
Brian
designers, business people, and developers
build some kind social enterprise that would benefit society
starting friday night at CCAD's campus
2017-03-31 through 2017-04-02
meals and t-shirts provided
$10k seed money for any new ventures started
IGS is sponsor
10% discount for "python" code
in past, buy one, give one for bags for foster kids
to haul their stuff in between foster homes
max morlocke will present again next month
wp:steelpan
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
Young Coders program needs a community partner
started by Katie Cunningham
PyOhio
contact Brian Costlow brian.costlow at gmail.com
community partner
provides students
hauls them to and from pyohio
students need to be at pyohio at about 8am (the saturday)
students leave around 4 or 5pm
Eric: pyohio is looking for sponsors
costs about $25k to put on pyohio for 400 to 500 attendees
>>> list(map(lambda f: f(1027), (int, hex, oct, bin, )))
[1027, '0x403', '02003', '0b10000000011']
>>>
Brazenhead
1027 W Fifth
0x403 W Fifth
0o2003 W Fifth
0b10000000011 W 101th
###############################################################################
Memory Leaks
Max Morlocke
Head of Engineering at Mineralsoft
https://github.com/kedlav
Mineralsoft
Austin, TX
kedlav at gmail.com
https://github.com/kedlav/presentations/blob/master/memory_leaks.pdf
some tricky ways that memory can leak
- mutable default parameters are usually a bug than can also gobble memory
- unhandled traceback keeping stack frame alive
- cyclic references
does not like gdb (because he does not have neck beard ala Pat Rothluss?)
wp:Patrick Rothfuss
https://www.goodreads.com/author/show/108424.Patrick_Rothfuss
someone else
has no problem using gdb
nonetheless, maybe gdb is wrong tool for interpreted language such as Python
(thinking and prints work just fine for many folks)
objgraph
https://mg.pov.lt/objgraph/
statsd
graphite
grafana
beware of overriding __del__ method.
use __enter__ and __exit__ methods with context manager
instead of open and close
pdflib
http://www.pdflib.com/
likes it, uses it much
commercial product
lxml.element.Etree
Tracking Down a Freaky Python Memory Leak
https://benbernardblog.com/tracking-down-a-freaky-python-memory-leak/
DebuggingWithGdb
https://wiki.python.org/moin/DebuggingWithGdb
weak references
will not keep an object from being garbage collected
https://docs.python.org/3/library/weakref.html
http://stackoverflow.com/questions/2436302/when-to-use-weak-references-in-python
study once a year:
Common Gotchas
http://docs.python-guide.org/en/latest/writing/gotchas/
plumber is nice paid subscription
what is URL for it?
focused on java developers
can be expensive
then switch to statsd
are there any linters that will flag suspect code,
such as mutable default arguments?
https://pylint.readthedocs.io/en/latest/reference_guide/features.html
dangerous-default-value (W0102):
Dangerous default value %s as argument Used when a mutable value as
list or dictionary is detected in a default value for an argument.
it can not possibly be my code
max will give presentation next month on security
he will send a synopsis paragraph to eric
###############################################################################
Jim Prior gave a presentation on using Named Groups in Regular Expressions
to improve readability.
http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170327-cohpy-named-groups.ipynb
https://github.com/james-prior/cohpy/blob/master/20170327-cohpy-named-groups.ipynb
###############################################################################
Jim Prior gave a presentation on using f-strings to improve readability,
since there was still some time left over.
http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170327-cohpy-fstrings.ipynb
https://github.com/james-prior/cohpy/blob/master/20170327-cohpy-fstrings.ipynb
No one complained about bug in Jupyter notebook that showed wrong syntax
highlighting for f-strings. That bug has since been fixed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Earlier today, he wondered how to defer evaluation of f-strings.
Imagine have a dictionary of f-strings.
date_formats = {
'iso': f'{year}-{month}-{day}',
'us': f'{month}/{day}/{year}',
'other': f'{day} {month} {year}',
}
The f-strings would be evaluated when the dictionary is created,
not when the values are fetched later.
Then he realized that lambdas could be used to defer evaluation.
http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170327-cohpy-defer-fstring-evaluation.ipynb
https://github.com/james-prior/cohpy/blob/master/20170327-cohpy-defer-fstring-evaluation.ipynb
So there is a good use for Zak's (aka y2kbugger) crazy f-string lambdas.
http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170130-cohpy-fstrings.ipynb
https://github.com/james-prior/cohpy/blob/master/20170130-cohpy-fstrings.ipynb
What drawbacks are there? Scoping issues?
How can one evaluate or convert a regular string as an f-string?
How about eval('f%r' % s), lambda: eval('f%r' % s)?
Why is %r used instead of %s or %a?
What other ways are there?
http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170327-cohpy-regular-string-to-fstring.ipynb
https://github.com/james-prior/cohpy/blob/master/20170327-cohpy-regular-string-to-fstring.ipynb
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
might give a presentation on how to evaluate a regular string as an
f-string or on pycrypto.
###############################################################################
big crane taking up half of parking lot
open-source microcontroller
tessel 2 $45
TM-12-07
tessel.io
https://github.com/tessel
Made with love by The Tessel Project
580 MHz Mediatek MT7620n
64 MB DDR2 RAM & 32 MB flash
48MHz Atmel SAMD21 coprocessor
microUSB power and programming port
ethernet port
two USB ports
two tessel ports (kinda Arduino compatible)
analog inputs
badly soldered (not hot enough long enough?)
wifi 802.11bgn
bluetooth?
default: runs javascript (on top of linux)
use npm (node package manager) to install software
option: runs rust
2017-07-13 (a thursday) Pillar Plugged In:
beginning Arduino
blink two LEDs
max 50 people, 10 kits, 5 people per kit
bring a scope!
###############################################################################
how to run meeting
show cohpy.org on screens until presentation begins
show meeting schedule on screens:
6:00 pm to 6:30 pm: eat, socialize
6:30 pm to 8:00 pm:
introductions and announcements,
then presentations
8:00 pm hard stop for presentations
8:00 pm adjourn to Brazenhead
18:30:
thank hosts for pizza and beer
free pizza and beer on tap
anything is fridge is free
mention that
when you're done,
please throw away your trash,
put plates in sink (or beside sink)
ask host where to put glasses, forks, and knives?
Be sure to respond to meetup so Pillar knows how much pizza to order.
(don't forget to add cohpy and techlifecolumbus counts)
mention cohpy.org and technical mailing list
who is here for first time, please raise your hand
others introduce yourself to people with hands raised
who is here from out of town?
have three first timers and three repeat attendees introduce themselves to
group
ask for folks who have announcement about events
announce next meeting.
May meeting will be next to last monday to avoid memorial day. 2017-05-22
work
who is looking for work?
who is looking for workers?
then presentations
then adjourn by 8:00pm to brazenhead
More information about the CentralOH
mailing list