IT技术精华 http://it.taocms.org/ 聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长 2019-12-11 IT技术精华 15429 从容器外部编辑容器内部文件的方法 通常来讲,容器为了更小,是不会带编辑器的,但是,利用docker cp 命令copy出来,编辑后再copy进去显得又比较麻烦,于是:

上一个简单的脚本:docker-vim

#!/bin/bash
cname=$1
file=${2#/}
pid=$(docker inspect -f '{{.State.Pid}}' $cname)
[[ $pid == "" ]] && {
        echo $0 only use for running container; exit;
}

cd /proc/$pid/root
vim $file

用法:

docker-vim $contaner-name $file-in-container

注意:

  1. 脚本中没有直接vim /proc/$pid/root/$file  ,因为这个可以read到文件内容,但是write会失败; 所以,先cd到/proc/$pid/root ,再vim $file 这样是正常的
  2. 该方法 仅适用于运行这的容器,(通常这可能并不是问题),可能有更好的编辑文件的办法
    1. 将容器文件系统挂载到宿主机的某个位置
    2. 让容器动态挂载一个有编辑器程序的volume
    3. 做一个非常简易的无依赖的编辑器程序copy到容器里面

立即购买:淘宝网]]>
IT技术精华 2019-12-11 17:12:06
15420 强化学习框架 rlpyt:如何同时输出gaussian(高斯)和categorical(类别)的action 转载需注明出处:https://www.codelast.com/

查看关于 rlpyt 的更多文章请点击这里

rlpyt 是BAIR(Berkeley Artificial Intelligence Research,伯克利人工智能研究所)开源的一个强化学习(RL)框架。我之前写了一篇它的简介。 
本文记录 rlpyt 的一些issue提及的问题以及解决方案。

▶▶ 同时输出gaussian(高斯)和categorical(类别)的action
✔ issue链接:在这里
✔ 问题描述:一般来说,action要么是一个高斯分布(gaussian),要么是一个类别值(categorical),如何能把这二者混合起来,即同时输出gaussian和categorical的action?
✔ 我的理解:gaussian的action,指的是policy network输出的是一个action的概率分布,而不是一个确定的action(例如,有70%的可能选择action 1,有30%的可能选择action 2),此时,我们是按这个概率分布来选择一个具体的action,举个例子,对应到Python程序,你可能会用 np.random.choice(a, size=None, replace=True, p=None) 函数来在一个指定的概率分布上选择一个action,其p参数可以指定概率值。
而categorical的action,指的是policy network输出的是一个确定的action,例如它直接输出的可能是action 1,或action 2,诸如此类,而不是给出action 1,action 2的概率值再让用户去选。
这个issue的目的,就是想实现一种“非常规”的用法,输出的action同时具有这两种性质——我想像不出来应该用什么来举例。
✔ 解决方案:rlpyt 里面有一个 Composite(复合)的action space:

class Composite(Space):

可以分别实现两个action space:一个gaussian的和一个categorical的,再用一个Composite的action space把它们包在里面。和environment交互的action space,就是这个Composite的action space了。
文章来源:https://www.codelast.com/
但是要注意,algorithm(例如PPO)是不支持Composite的action space的,所以还需要对algorithm类再做一点改造:另外定义一个 distribution 类,它能根据Composite的action算出其 log probability。还是以PPO为例,它使用 self.agent.distribution 来对action space进行action的选取,此时要用自定义的 distribution 类来替换掉这个distribution,然后就OK了。


立即购买:淘宝网]]>
IT技术精华 2019-12-11 11:12:04
15408 连 v-show 都不会你还敢说熟悉 Vue 原理? 立即购买:淘宝网]]> IT技术精华 2019-12-11 01:12:12 15404 路由的错 明明服务listen了9736端口,外面访问该端口却连接失败。在服务器上tcpdump抓包发现,只有syn,并没有syn-ack,更没有rst。

难道是防火墙? Iptables都是空的;

难道有其它高级的设置?

难道网络有问题? 我已经ssh到这个机器上了(其实是从某个机器跳过来的)

灵光一闪,可能是路由问题,找不到回包路由,自然就没法回包了; ip route一下,果然没有默认路由,只有一条同网段机器的路由,我的ssh就是从同网段的其它机器上过来的。

添加默认路由后,一切ok了


立即购买:淘宝网]]>
IT技术精华 2019-12-10 17:12:05
15395 FEX 技术周刊 - 2019/12/09 深阅读

Declarative assembly of web applications from pre-defined concepts
https://blog.acolyer.org/2019/12/04/declarative-assembly-of-web-applications-from-pre-defined-concepts/
https://spderosso.github.io/onward19.pdfA new approach to web application development is presented, in which an application is constructed by configuring and composing concepts drawn from a catalog developed by experts. The platform (framework) for building these applications is called Déjà Vu, and the unit of abstraction in Déjà Vu is a Concept. Concepts are more closely aligned with application features than with e.g. class-level components. Examples are commenting, scoring, and so on.

What’s New for Node.js in 2020
https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
Every year the Node.js community has gained momentum, and 2020 shows no signs of slowing down. There are lots of interesting features being explored for the next major releases of Node.js. In this post I’ll explore some of the most significant updates the Node.js community can expect in 2020.

JavaScript, ES6, ES7, ES10 where are we?
https://medium.com/engineered-publicis-sapient/javascript-es6-es7-es10-where-are-we-8ac044dfd964
Because I believe everybody should be concerned about when we’re finally getting a replaceAll function in JS, let’s sit and have a bit of a retrospective on what is the current state of the ES-scene. What’s coming, what’s been fully integrated since the infancy of Babel and ES6? After reading this article, you will be an ES-10/10! 另附:Optional Chaining Has Reached Stage 4 at TC39, Here’s what people in tech had to say about JavaScript when it debuted in 1995.

Blockly Summit 2019: Rendering, Accessibility, and More!
https://opensource.googleblog.com/2019/12/blockly-summit-2019-rendering.html
The library provides everything an app developer needs to create rich block coding languages and is highly customizable and extensible. This means Blockly is also used by hobbyists and commercial companies alike for business logic, computer games, virtual reality, robotics, and just about anything else you can do with code.

Good code is 90% boilerplate
https://www.unitily.com/articles/boilerplate.html
Im going to stop here rather than going on to maven files, build scripts, etc, which (spoiler alert) just lead to more boilerplate. At the bottom of this article we show the complete UnitilyLang project. It’s 2106 characters. The total Java codebase is 22084 characters. So we can build the same project in UnitilyLang with 90% less code.

低代码开发会是未来吗?
https://mp.weixin.qq.com/s/M0vrPskxg0SZeQ6cmso7Qw
长期开发同一类系统的团队都会积累出一套自己的“低代码开发平台”,可能是以代码框架,代码模块,代码模板,拖拽式工具等等不同的形式体现。但这个平台不是给普通用户用的,是给专业开发人员用的,可以极大的提高开发这一类应用的速度。这也是为什么市面上的低代码开发平台产品很多是由外包团队开发出来的。然而这里的限制就是 A 团队长期开发金融类应用,积累了一套针对金融风控类需求的低代码开发平台,B 团队积累的是零售电商领域的,C 团队可能是能源监控领域的,我从来没有见过一个通用领域玩得转的低代码平台。技术的发展日新月异,特别是前端技术,基本上两三年就要换新套路。然而低代码平台很难跟得上这样的节奏,因为积累需要时间。结果就是,你看到的企业应用/政府应用,技术落后,体验差。总结而言,通用的低代码开发平台不可能实现,跟现有业务平台绑定的低代码开发会有一定的价值。

微服務設計的十個步驟
https://www.ithome.com.tw/voice/134648
我們必須先認識微服務的優缺點,評估是否需要這些優點,是否可以克服這些缺點,然後再思考是否要用微服務,這篇文章提出十步驟的方法,試圖來理出設計微服務的思路。

微信购物入口「京喜」首页跨端开发与优化实践
https://aotu.io/notes/2019/12/03/jingxi-index/index.html
随着今年的双十一落下帷幕,京喜(原京东拼购)也迎来了首捷。双十一前夕微信购物一级入口切换为京喜小程序,项目顺利通过近亿级的流量考验,在此与大家分享一点自己参与的工作。

Web Development in 2020: What You Should Learn
https://www.freecodecamp.org/news/web-development-2020/
Brad cuts through a lot of the hype you hear on social media. His advice is practical and realistic. And I agree with him on pretty much everything he recommends you learn.

Is it time to move on from Virtual DOM(ReactJS)?
https://medium.com/javascript-in-plain-english/is-it-time-to-move-on-from-virtual-dom-reactjs-2c01afbf81fb
Web Component specification enables capabilities to extend existing HTML elements. This gave rise to HTML extension model (Custom HTML elements )was picking up. However, it was nowhere close to being adopted by the browsers natively, but this inspired a new era of component-based JS frameworks, including AngularJS(by Google) and React(by Facebook).

Introducing React View, an Interactive Playground for Your Components
https://baseweb.design/blog/introducing-react-view/
React View is a set of tools that aspires to close the gap between users, developers and designers of component libraries. React View aims to make documentation more interactive and useful. It utilizes already popular tools such as babel and prettier.

Docz - It has never been so easy to document your things!
https://www.docz.site/
Docz enables you to quickly create live-reloading, seo-friendly, production-ready documentation sites with MDX and customize the look, feel and behavior when required by leveraging GatsbyJS and Gatsby theme shadowing.

A Redux Anti Pattern
https://rangle.slides.com/yazanalaboudi/deck#/
Aimed at developers already using Redux, this well presented slide-deck gives a practical example of how to structure actions in a scalable and decoupled way. On Twitter, Pablo Hoc noted that “these slides should be in the official Redux docs. So clear and concise.”

Electron’s ‘remote’ module considered harmful
https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
Since the very earliest versions of Electron, the remote module has been the go-to tool for communicating between the main and renderer processes. The basic premise is this: from the renderer process, you ask remote for a handle to an object in the main process. Then you can use that handle just as if it were a normal JavaScript object in the renderer process—calling methods, awaiting promises, and registering event handlers. All the IPC calls between the renderer and main process are handled for you behind the scenes. Super convenient! … until it isn’t. Almost every nontrivial Electron app that has used the remote module—Slack included—has ended up regretting their decision. Here’s why.

Data Transfer Project: Enabling portability of photos and videos between services
https://engineering.fb.com/security/data-transfer-project/
we are announcing a new tool on Facebook that allows people to transfer photos and videos directly from Facebook to Google Photos. We plan to expand this to other services in the near future. This tool will begin rolling out in Ireland today and will be available worldwide in early 2020.

新鲜货

All the Serverless announcements at re:Invent 2019
https://serverless.com/blog/reinvent-2019-serverless-announcements/
If last year is any indication, we expect AWS to have a long list of serverless-centered announcements and launches. If you want to keep up, you’ve come to the right place. We’re watching all the keynotes and announcements live as they happen, and compiling the “what it is” and the “why it matters” right here.

DeepSpeech 0.6: Mozilla’s Speech-to-Text Engine Gets Fast, Lean, and Ubiquitous
https://hacks.mozilla.org/2019/12/deepspeech-0-6-mozillas-speech-to-text-engine/
Our latest release, version v0.6, offers the highest quality, most feature-packed model so far. In this overview, we’ll show how DeepSpeech can transform your applications by enabling client-side, low-latency, and privacy-preserving speech recognition capabilities. 另附:Firefox 71: A year-end arrival.

W3C Recommends WebAssembly to push the limits for speed, efficiency and responsiveness
https://www.w3.org/blog/news/archives/8123
The WebAssembly Working Group has published today the three WebAssembly specifications as W3C Recommendations, marking the arrival of a new language for the Web which allows code to run in the browser.

CKEditor 5 v16.0.0 with code blocks and restricted editing
https://ckeditor.com/blog/CKEditor-5-v16.0.0-with-code-blocks-and-restricted-editing/
We are happy to announce the release of CKEditor 5 v16.0.0 that introduces two major and frequently requested features. The developers will be happy to hear that they can now insert code blocks to their WYSIWYG editor. The new restricted editing feature allows you to create templates and restrict editing to chosen areas only. But there is more — so read on!

We did it! How a comment on HackerNews lead to 4 ½ new Unicode characters
https://unicodepowersymbol.com/we-did-it-how-a-comment-on-hackernews-lead-to-4-%c2%bd-new-unicode-characters/
https://github.com/jloughry/Unicode
This is the (brief) story of how a couple of geeks added 4 new symbols to Unicode!

Elastic UI framework
https://elastic.github.io/eui/#/The Elastic UI framework (EUI) is a design library in use at Elastic to build internal products that need to share our aesthetics. It distributes UI React components and static assets for use in building web layouts.

Reactide - The first dedicated IDE for React web application development
https://medium.com/javascript-in-plain-english/reactide-the-first-dedicated-ide-for-react-web-application-development-d622c7dd2a90
Reactide is in active development. Please follow this repo for contribution guidelines and our development road map. Reactide is a cross-platform desktop application that offers a simulator, made for live reloading and quick React component prototyping. React brings an integrated suite of development tools to streamline react development.

Got - Human-friendly and powerful HTTP request library for Node.js
https://github.com/sindresorhus/got
Human-friendly and powerful HTTP request library for Node.js.

Enquirer
https://github.com/enquirer/enquirer
Stylish, intuitive and user-friendly prompts. 另附:Ervy - Bring charts to terminal.

JavaScript Algorithms and Data Structures
https://github.com/trekhleb/javascript-algorithms
Algorithms and data structures implemented in JavaScript with explanations and links to further readings.

Django 3.0 release notes
https://docs.djangoproject.com/en/3.0/releases/3.0/
What’s new in Django 3.0: MariaDB support, ASGI support, Exclusion constraints on PostgreSQL, Filter expressions, Enumerations for model field choices.

Metaflow, Netflix’s Python framework for data science, is now open source
https://metaflow.org/
https://medium.com/netflix-techblog/open-sourcing-metaflow-a-human-centric-framework-for-data-science-fa72e04a5d9
Successful data science projects are delivered by data scientists who can build, improve, and operate end-to-end workflows independently, focusing more on data science, less on engineering.

MemSQL 7.0 Now Generally Available
https://www.memsql.com/blog/7-0-release/
MemSQL is the cloud-native, operational database built for SPEED & SCALE. Realize the full potential of your business through data and redefine the limits of what’s possible.

moxie: incremental declarative UI in Rust
https://blog.anp.lol/rust/moxie-intro/
moxie is a small incremental computing runtime focused on efficient declarative UI, written in Rust. moxie itself aims to be platform-agnostic, offering tools to higher-level crates that work on specific platforms. Most applications using moxie will do so through bindings between the runtime and a concrete UI system like the web or a consumer desktop platform.

BPF: A New Type of Softwar
http://www.brendangregg.com/blog/2019-12-02/bpf-a-new-type-of-software.html
BPF (and eBPF) was originally designed to capture and filter network packets using various rules, but you can use the interface they provide with the kernel to do other things too (under what Brendan calls a ‘new model of programming’) such as intelligent load balancing, DDoS mitigation, observability, and more.

rqlite
https://github.com/rqlite/rqlite
The lightweight, distributed relational database built on SQLite

SwiftLaTeX
https://github.com/SwiftLaTeX/SwiftLaTeX
SwiftLaTeX is a Web-browser based editor to create PDF documents such as reports, term projects, slide decks, in the typesetting system LaTeX. In contrast to other web-based editors SwiftLaTeX is true WYSIWYG, What-you-see-is-what-you-get: You edit directly in a representation of the print output. You can import a LaTeX document at any stage of completeness into SwiftLaTeX. You can start a new document with SwiftLaTeX, or you can use SwiftLaTeX for final copy-editing.

Urbit - Your last computer
https://urbit.org/
Imagine that you can login from anywhere with one name and password. And when you do, your entire OS appears. Inside is your whole digital life. All of your communities, conversations, and connections. All of your biometric data and devices. Your entire personal archive in one place that’s secure, private, and designed to last forever. You own and control this OS completely. It’s yours. No one else can look at it without your permission, it can never show you ads. This is what Urbit is. Your Urbit is a simple, durable computer that belongs to you 100% and forever. Urbit is not vaporware. It’s real and it works. Two separate companies and a community of contributors are working together to build the Urbit future.

GNUnet
https://gnunet.org/
GNUnet is a new network protocol stack for building secure, distributed, and privacy-preserving applications. With strong roots in academic research, our goal is to replace the old insecure Internet protocol stack. GNUnet is typically run as an overlay network on top of the existing Internet infrastructure forming the basis of a hybrid peer-to-peer mesh and relay backbone for applications to run on. It could just as well be run independently of the Internet, over dedicated radio and cable. GNUnet is made for a free and open society: It’s a self-organizing network and it is free software as in freedom. GNUnet puts you in control of your data. You determine which data to share with whom, and you’re not pressured to accept compromises.

设计

T2020潘通年度流行色 「经典蓝」新鲜出炉!
https://www.uisdc.com/2020-classic-blue
这款被命名为为「经典蓝」(Classic Blue)的色彩沉稳耐看,隽永优雅,按照潘通官方的说法,「经典蓝」仿佛暮色四合时的天空,宁神静心,让人驻足。「经典蓝」是一种稳固可靠的色彩,给人确信感,抚慰着每一个期待稳定者的心灵。

GitLab Iconography: MVC meets visual design
https://about.gitlab.com/blog/2019/12/02/gitlab-iconography-where-mvc-meets-visual-design/
A minimum viable change approach for a key UI element

Cracking the Code to Mobile Productivity
https://medium.com/microsoft-design/microsoft365mobile-3b5b7782152c
Our global journey to rethink, redesign, and align our mobile experiences.

Get Started With UI Design With These Tips To Speed Up Your Workflow
https://www.smashingmagazine.com/2019/12/ui-design-tips-speed-up-workflow/
When you are working on a design, do you struggle with all of the possibilities, like whether to make some text block bigger or smaller, or increase (or decrease) the amount of white space around an element. And what about this color: Should it be darker, or maybe lighter? In this article, I’ll share a few tips on how to solve these common issues and how to make your design more consistent and user-friendly.

The State of UX for 2020
https://millermedia7.storychief.io/state-of-user-experience-ux-2020
We expect 2020 to be a momentous year in the space of UX design. New technology and user experience trends during the last decade have made competition across most modern industries tougher than ever before. Naturally, this motivates businesses to put even a greater focus on the user experience.

Sketch 61 — Improvements to Help You Work Faster
https://medium.com/sketch-app-sources/sketch-61-improvements-to-help-you-work-faster-e4e96e6ca6bc
The last few versions of Sketch introduced features that changed our workflow radically. Smart Layout opened us for new Symbols abilities. New Components Panel made the way we work with Styles & Symbols faster, but very different. Now Sketch Team focused on more subtle improvements but also make our work more convenient. 另附:Design more, resize less, with Auto Layout, How to find the best design-to-code tool?.

产品及其它

Reddit’s 2019 Year in Review
https://redditblog.com/2019/12/04/reddits-2019-year-in-review/
Highlighting Reddit’s top communities, topics and trends of the year.

腾讯组局,SaaS打牌
https://mp.weixin.qq.com/s?__biz=MzU5OTI0NTc3Mg==&mid=2247488982&idx=1&sn=b0e77cc79d791372ef1b806e34e8b8ce
本文采访了腾讯云副总裁答治茜、腾讯云战略投资总经理庄文磊、腾讯云SaaS生态运营总经理王琰,以及SaaS厂商道一云CEO陈侦、法大大创始人兼CEO黄翔、CODING创始人兼CEO张海龙、有赞CTO崔玉松等,试图回答:腾讯云布局SaaS生态,成色如何?在当下时点,其局限、可能性乃至后发优势又在哪里?

吴军:成大事的人,擅长做减法
https://mp.weixin.qq.com/s/foEimwvNqtxTgZN-TRjNpw
所谓格局大,就是清楚自己所在的位置,有非常明确的方向,然后用正确的方法沿着这个方向坚定的走下去。他们并不贪图步伐有多大,但是因为从来不去做(或者很少做)南辕北辙的事情,反而总是先人一步到达终点。相反,一事无成的人常常跑得很快,却在锲而不舍地兜圈子,或者受到环境的诱惑而不断改变方向,甚至干脆背道而驰,几年、十几年后回头看,又回到了起点。

对数据可视化有兴趣的可以阅读由 AntV 带来的 墨者修齐 2019-12-09·如何搜索恐怖袭击、德国低薪人的租房压力、美国移民的来源

– THE END –


立即购买:淘宝网]]>
IT技术精华 2019-12-09 14:12:05
15391 征稿启示| 让更多的NLPer看到你的文章 AINLP

认真的给AINLP公众号征个稿,之前在AINLP技术交流群分享过,现在希望更多有技术写作习惯的同学看到。

如果你平时有写技术文章的习惯并且愿意分享给更多NLPer看到,文章已经发布或者计划发布在你个人的互联网上的任何地方,譬如独立博客、知乎专栏、Github、各类博客平台,欢迎投稿给AINLP公众号,自然语言处理、机器学习、深度学习相关即可,我们会做初步的判断是否合适。

如果OK并且授权AINLP公众号原创标志,我们愿意给予一些物质感谢,包括百元稿费(或等价书籍)+ 价值20个小时1080TI的GPU云算力(也可以使用其他机器例如2080或者2080TI算力)+知识星球"AINLP芝麻街"的嘉宾身份。

如果不授权AINLP公众号原创标志,只是希望能分享给更多的人,也同样欢迎,包括或者不限于已经发布在个人公众号的NLP相关文章,其他地方的技术文章,Github个人相关项目,欢迎自荐,我们按转载模式进行操作。

关于原创标志,这是公众号保护技术原创文章的一个很好的模式,形式上就是在作者前加个原创,例如:

关于AINLP的GPU云服务,请参考:

AINLP-DBC GPU 云服务器租用平台建立,价格足够便宜

关于AINLP芝麻街,请参考:

我们建了一个免费的知识星球:AINLP芝麻街,欢迎来玩,期待一个高质量的NLP问答社区

最后,常欢迎大家来投稿,当然,我们也非常鼓励大家进行技术写作,写作能力是程序之外非常棒的一个软技能。

关于AINLP

AINLP 是一个有趣有AI的自然语言处理社区,专注于 AI、NLP、机器学习、深度学习、推荐算法等相关技术的分享,主题包括文本摘要、智能问答、聊天机器人、机器翻译、自动生成、知识图谱、预训练模型、推荐系统、计算广告、招聘信息、求职经验分享等,欢迎关注!加技术交流群请添加AINLP君微信(id:AINLP2),备注工作/研究方向+加群目的。


立即购买:淘宝网]]>
IT技术精华 2019-12-09 00:12:04