Elixir Weekly #142

原文: ElixirWeekly - Elixir Community Newsletter, one email every Thursday. Visual Programming with Elixir: Learning to Write Binary Parsers by @elixirstatus 这周不老药 This week in Elixir Function/Method 查找在 Elixir/Ruby Edison thought GenServer function injections were done through inheritance and discovered the inner workings of defoverridable! (是也乎: 这还用比较嘛? 海量 end 堆起来比括号要恶心多了… ) 使用Elixir进行可视化编程:学习编写二进制解析器 Kyle writes about what makes Elixir an unexpected front-runner for learning and prototyping binary protocols. Teamweek正在寻找远程Elixir后端开发人员 It’s a fully remote job and 100% Elixir even though the title says Ruby as well. According to Teamweek, it’s simply easier to find Ruby devs that want to learn Elixir ;-) (是也乎: 倾向找到在学 Elixir 的 Rubista .. ) More Readable Repos with the Ecto Filter Pattern Tyler writes about a great pattern for Ecto query composition he’s come across at work. 构建小型分布式 Elixir 应用程序 Keeping state consistency while running an Elixir application on many servers. (是也乎: 日常技巧… +——————–+ | APP SUPERVISOR | +———+———-+ | | +———v———-+ +———–+ +———–+ | WORKER SUPERVISOR +———> WORKERS | + <——–> DATABASE | +——————–+ +———–+ | | +———–+ +————+ | +————-+ ) TIL Ecto 约束 vs. 验证 ElixirSchool shows us how Ecto can put validations and constraints onto specific fields to ensure data integrity. 📆🐍 社区 Even more from around the Elixir community ...

2019-03-28 · 2 min · 603 words · ZoomQuiet

Issue 361

原文: PyCoder’s Weekly - Issue #361 Python 中的线程介绍 REAL PYTHON In this intermediate-level tutorial, you’ll learn how to use threading in your Python programs. You’ll see how to create threads, how to coordinate and synchronize them, and how to handle common problems that arise in threading. (是也乎: 真蟒, 系列插图, 真香… ) Python 到底是 Pass-By-Reference 或 Pass-By-Value? (2014) ROBERT HEATON A great explanation of Python’s argument-passing semantics. (是也乎: 参数传递的一次嗯哼… 手绘万岁… ) ...

2019-03-28 · 3 min · 1292 words · ZoomQuiet

Issue 360

原文: PyCoder’s Weekly - Issue #360 如何使用 wxPython 构建 Python GUI 应用 REAL PYTHON In this step-by-step tutorial, you’ll learn how to create a cross-platform graphical user interface (GUI) using Python and the wxPython toolkit. A graphical user interface is an application that has buttons, windows, and lots of other widgets that the user can use to interact with your application. 简化您的 Python 开发环境 MASON EGGER • Shared by Mason Egger How three tools (pyenv, pipx, pipenv) make for smooth, isolated, reproducible Python developer and production environments. (是也乎: 这,是非常重要的常用嗯哼哪… 只是, 一点儿也不简单..因为 Python 中一直就没有一个合理的工具一致性解决所有阶段的开发环境问题: 本地开发时的版本和模块依赖管理 测试时高速部署依赖模块 运行时自动化同步版本和依赖模块版本 Docker 是一把将所有阶段的环境问题用虚拟机解决了, 只是带来空间无法控制, 以及必须理解并忍受越来越多的专用工具; 所以, 先用已有工具组合为一个合理可理解的工具箱来完成是好的: pyenv 进行本地/测试/生产 的运行时版本和模块依赖树隔离 在 pyenv 之下.. conda 负责部分大型编译型模块的预编译管理 pipenv 进行模块的依赖/版本管理 嗯哼, 就是缺少一环: 可以高速冻结本地模块依赖树, 并能自动化同步模块树镜像到任意指定主机上; 以便从本地安装模块,而不依赖可怜的墙外网速… 再次感叹: dh-virtualenv, 已经解决了这一环的问题… ...

2019-03-21 · 4 min · 1940 words · ZoomQuiet

Issue 359

原文: PyCoder’s Weekly - Issue #359 用 PEP 8 撰写真正 Pythonic 代码 REAL PYTHON video Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you make a great impression when sharing your work with potential employers and team mates. Learn how to make your code PEP 8 compliant with these bite-sized lessons. (是也乎: 没那么简单, 团队习惯兼容的配置又能有用, 太难 ) 在Python中实施单一责任原则(SRP) NIKITA SOBOLEV The Single Responsibility Principle (or SRP) is an important concept in software development. The main idea of this concept is: all pieces of software must have only a single responsibility. Nikita’s article guides you through the complex process of writing simple code with some hands-on refactoring examples. You’ll use callable classes, SRP, dependency injection, and composition to write simple Python code. Nice read! (是也乎: Python 是个橡皮泥, 嘦愿意, 总是能嗯哼成喜欢的样子… ) 如何使用测试 CI 和代码覆盖率设置 Python 项目以取得成功 JEFF HALE How to add tests, CI, code coverage, and more. Very detailed writeup. (是也乎: 非常详细…以致难以简单的向团队交付… Install Black Create .pycache Install pytest Create Tests Sign up for Travis CI and Configure Create .travis.yaml Test Travis CI Add Code Coverage Add Coveralls Add PyUp 看起来步骤不多…但是,,,, ) 用 Python 和 OpenCV 检测真/假面孔 ADRIAN ROSEBROCK Learn how to detect liveness with OpenCV, Deep Learning, and Keras. You’ll learn how to detect fake faces and perform anti-face spoofing in face recognition systems with OpenCV. 用 pyenv 管理多个 Python 版本 REAL PYTHON In this step-by-step tutorial, you’ll learn how to install multiple Python versions and switch between them with ease, including project-specific virtual environments, even if you don’t have sudo access with pyenv. (是也乎: 其实 PyEnv 比 pipenv 灵活就在, 不仅仅是将运行时版本进行了管理, 而且可以简便的将 Python 版本环境, 工程模块依赖环境, 在本地自由结合到任意工程目录上. 就是缺少一个一键将当前环境所有依赖模块冻结为压缩文件, 并能简洁的传送到远方主机, 一键完成再安装配置的工具… 毕竟, 总是有些模块是依赖外部 GCC 之类工具现场编译的. ) 2005 年以来 Python 包的增长 PYDIST.COM “The Python ecosystem has been steadily growing [since 2005]. After the first few years of hyper growth as PyPI gained near-full adoption in the Python community, the number of packages actively developed each year—meaning they had at least one release or new distribution uploaded—has increased 28% to 48% every year.” (是也乎: 每年 28%~48% 的增长, 比中国 GDP 高, 但是远远小于 node.js 的. ) 讨论 Discussions ...

2019-03-13 · 4 min · 1694 words · ZoomQuiet