rust

2019开发者调查:Python 或成赢家,Java 最不赚钱?

杀马特。学长 韩版系。学妹 提交于 2020-05-09 19:19:15
云栖号资讯:【 点击查看更多行业资讯 】 在这里您可以找到不同行业的第一手的上云资讯,还在等什么,快来! Stack Overflow 年度开发者调查是面向全球开发者进行的规模最大、最全面的调查。调查涵盖了从开发者喜爱的技术到工作偏好等内容。2019 年是 Stack Overflow 发布年度开发者调查报告的第九年,有近 90000 名来自世界各地的开发者参与了这个约花费 20 分钟的调查。 Stack Overflow 作为全世界最流行、最顶级的技术问答社区,其广泛的影响力毋庸置疑,虽然调查结果不能代表开发者社区中的每个人,但相信这些极具价值的数据有重大的参考意义。 废话不多说,先看看今年的调查结果有哪些亮点: Python 是「流行度」增长最快的主流编程语言,不止在本次调查中再次上榜,并在流行度方面超越了 Java,还成为了第二大最受开发者喜爱的语言(仅次于 Rust)。所以 Python 成最大赢家? 超过一半的受访者表示在他们十六岁左右写下了第一行代码,当然这种经历因国家和性别而异。 DevOps 专家和可靠性工程师是薪酬最高、经验最丰富的开发者,他们对工作最满意,并且正在寻找面向更底层业务的新工作。 在进行调查的主要国家中,中国开发者最乐观,他们相信当下出生的人将拥有比父母更好的生活。而法国和德国等西欧国家的开发者对未来最不乐观。 在考虑阻碍生产力的因素时

RUST 机器学习的现状

拥有回忆 提交于 2020-05-09 16:22:12
https://main.run/p/121 每隔一段时间,这个话题就出现在社交媒体或Rust用户频道上。 我想简要介绍一下我所看到的事情的历史,以及有关机器学习/深度学习框架的现有变化以及最近的主要趋势的一些信息。 BRIEF HISTORY AND WHERE ARE WE NOW? 现有的 ML/DL 生态系统非常庞大,因为它们是高性能计算、数学优化、系统和编译器工程等的组合。 因此,为了简单起见,如果我们将ML划分为传统ML和DL(包括重叠),然后我们可以看到 rusty-machine , rustlearn 和 leaf 。他们做了非常有趣和大胆的发展, 特别是当时的 leaf 。最终,他们大多放弃了,因为创建一个完整的开源ML/DL框架需要大量的工作: 语言和库的支持 (稍后会介绍) 基本成熟的线性代数和统计学方面的库 一个由ML专家组成的社区,他们碰巧知道Rust并愿意做出贡献 主流的现有ML库(主要使用Python/Cython或c++)都是在这些支持下开发的,Rust也不例外。 语言和库的支持 之前,Gonzalo 列出了一份 HPC 清单,到目前为止,我可以说 Rust 通过语言(稳定/不稳定)特性和 crates 支持了其中大多数条目,希望到今年年底我们能看到越来越多的支持。 但是 constant-generics (更好的数组支持), 稳定的 std:

How can I access a function's calling location each time it's called?

放肆的年华 提交于 2020-05-09 09:48:42
问题 I would like to write a function that accesses the file and line number of the location in which it gets called. It would look like this: fn main() { prints_calling_location(); // would print `called from line: 2` prints_calling_location(); // would print `called from line: 3` } fn prints_calling_location() { let caller_line_number = /* ??? */; println!("called from line: {}", caller_line_number); } 回答1: RFC 2091: Implicit caller location adds the track_caller feature which enables a function

How can I access a function's calling location each time it's called?

给你一囗甜甜゛ 提交于 2020-05-09 09:47:44
问题 I would like to write a function that accesses the file and line number of the location in which it gets called. It would look like this: fn main() { prints_calling_location(); // would print `called from line: 2` prints_calling_location(); // would print `called from line: 3` } fn prints_calling_location() { let caller_line_number = /* ??? */; println!("called from line: {}", caller_line_number); } 回答1: RFC 2091: Implicit caller location adds the track_caller feature which enables a function

How can I access a function's calling location each time it's called?

血红的双手。 提交于 2020-05-09 09:46:30
问题 I would like to write a function that accesses the file and line number of the location in which it gets called. It would look like this: fn main() { prints_calling_location(); // would print `called from line: 2` prints_calling_location(); // would print `called from line: 3` } fn prints_calling_location() { let caller_line_number = /* ??? */; println!("called from line: {}", caller_line_number); } 回答1: RFC 2091: Implicit caller location adds the track_caller feature which enables a function

Python监控Linux系统(2)<psutil,Process,pids,pid_exists>

余生颓废 提交于 2020-05-09 08:45:43
一、使用开源库监控Linux 在这一小节,我们将介绍一个在Python生态中广泛使用的开源项目,即psutil。随后,我们将使用psutil重构前一小节编写的监控程序。另外,还会简单介绍psutil提供的进程管理功能。 1、psutil介绍 psutil = process and system utilities psutil是一个开源且跨平台的库,其提供了便利的函数用来获取操作系统的信息,比如CPU,内存,磁盘,网络等。此外,psutil还可以用来进行进程管理,包括判断进程是否存在、获取进程列表、获取进程详细信息等。而且psutil还提供了许多命令行工具提供的功能,包括:ps,top,lsof,netstat,ifconfig, who,df,kill,free,nice,ionice,iostat,iotop,uptime,pidof,tty,taskset,pmap。 psutil是一个跨平台的库 ,支持Linux、Windows、OSX、FreeBSD、OpenBSD、NetBSD、Sun Solaris、AIX等操作系统。同时,psutil也支持32位与64位的系统架构,支持Python2.6到Python3.x之间的所有Python版本。 psutil具有简单易用、功能强大、跨平台等诸多优点,广泛应用于开源项目中,比较有名的有glances

Is the resource of a shadowed variable binding freed immediately?

99封情书 提交于 2020-05-09 06:49:28
问题 According to the Rust book, "when a binding goes out of scope, the resource that they’re bound to are freed". Does that also apply to shadowing? Example: fn foo() { let v = vec![1, 2, 3]; // ... Some stuff let v = vec![4, 5, 6]; // Is the above vector freed here? // ... More stuff } // Or here? 回答1: No, it is not freed immediately. Let's make the code tell us itself: struct Foo(u8); impl Drop for Foo { fn drop(&mut self) { println!("Dropping {}", self.0) } } fn main() { let a = Foo(1); let b

How to share immutable configuration data with hyper request handlers?

一世执手 提交于 2020-05-09 06:38:07
问题 I am trying to develop a hyper based server application in Rust. There is an INI file holding configuration like binding IP, database and so on. I don't want to parse the INI file on each request and it is OK to keep the configuration data until server restart. How can I give a struct of already parsed data to the request handler? I have tried several approaches like using std::sync::Arc , but the only thing working so far is to use a static , but I want to avoid unsafe blocks. Here is a

Why can a Rust struct be defined without a semicolon?

[亡魂溺海] 提交于 2020-05-09 06:26:45
问题 I'm learning Rust and the chapter for structs gives an example of a struct without a ; at the end. It compiles but I have no idea why this is allowed. fn main() { struct User { username: String, email: String, sign_in_count: u64, active: bool, } } ... same question goes for functions, actually. 回答1: As Shepmaster said in the comment, the "reason" is that Rust defines so. Here I will explain the rules behind it. Basically you can omit ; when it ends with } . This will answer your question.

Why can a Rust struct be defined without a semicolon?

懵懂的女人 提交于 2020-05-09 06:26:08
问题 I'm learning Rust and the chapter for structs gives an example of a struct without a ; at the end. It compiles but I have no idea why this is allowed. fn main() { struct User { username: String, email: String, sign_in_count: u64, active: bool, } } ... same question goes for functions, actually. 回答1: As Shepmaster said in the comment, the "reason" is that Rust defines so. Here I will explain the rules behind it. Basically you can omit ; when it ends with } . This will answer your question.