如果你打算在今年探索 Rust,请下载我们的免费 Rust 速查表,以供快速参考基础知识。
sh.rustup.rs
脚本并运行它一样简单。$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
$ less sh.rustup.sh
$ sh ./sh.rustup.rs
class
关键字。Rust 确实有 struct
数据类型,但它的作用是充当数据集合的一种模板。因此,你可以使用结构体,而不是创建一个类来表示虚拟对象:struct Penguin {
genus: String,
species: String,
extinct: bool,
classified: u64,
}
你可以像使用类一样使用它。例如,当定义完 Penguin
结构,你就可以创建它的实例,并与该实例进行交互:struct Penguin {
genus: String,
species: String,
extinct: bool,
classified: u64,
}
fn main() {
let p = Penguin { genus: "Pygoscelis".to_owned(),
species: "R adeliæ".to_owned(),
extinct: false,
classified: 1841 };
println!("Species: {}", p.species);
println!("Genus: {}", p.genus);
println!("Classified in {}", p.classified);
if p.extinct == true {
println!("Sadly this penguin has been made extinct.");
}
}
将 impl
数据类型与 struct
数据类型结合使用,你可以实现一个包含函数的结构体,并且可以添加继承和其他与类相似的特性。main
。fn
关键字声明函数,后跟函数名称和函数接受的所有参数。fn foo() {
let n = 8;
println!("Eight is written as {}", n);
}
通过参数,将信息从一个函数传递到另一个函数。例如,我已经创建了一个 Penguin
类(结构),并且我有一个 Penguin
的实例为 p
,将目标函数的参数指定为 Penguin
类型,就可把 p
的属性从一个函数传递到另一个函数。fn main() {
let p = Penguin { genus: "Pygoscelis".to_owned(),
species: "R adeliæ".to_owned(),
extinct: false, classified: 1841 };
printer(p);
}
fn printer(p: Penguin) {
println!("Species: {}", p.species);
println!("Genus: {}", p.genus);
println!("Classified in {}", p.classified);
if p.extinct == true {
println!("Sadly this penguin has been made extinct.");
}
}
fn main() {
let n = 6;
let n = 5;
}
但你可以使用关键字 mut
声明一个可变变量,因此下面这段代码可以编译成功:fn main() {
let mut n = 6;
println!("Value is {}", n);
n = 5;
println!("Value is {}", n);
}
( ↓↓ —— 未完 —— ↓↓ )
完美阅读及吐槽,请猛击:https://linux.cn/article-14563-1.html?utm_source=qqmail&utm_medium=qqmail
实现一个 WiFi 扫描器玩玩~
mdlayher/wifi
包有一个查询它们的方法,所以我可以创建一个 main.go
来实现它,具体代码如下:package main
import (
"fmt"
"github.com/mdlayher/wifi"
)
func main() {
c, err := wifi.New()
defer c.Close()
if err != nil {
panic(err)
}
interfaces, err := c.Interfaces()
for _, x := range interfaces {
fmt.Printf("%+v\n", x)
}
}
让我们来看看上面的代码都做了什么吧!首先是导入依赖包,导入后,我就可以使用 mdlayher/wifi
模块就在 main
函数中创建一个新的客户端(类型为 *Client
)。接下来,只需要调用这个新的客户端(变量名为 c
)的 c.Interfaces()
方法就可以获得系统中的接口列表。接着,我就可以遍历包含接口指针的切片(变长数组),然后打印出它们的具体信息。%+v
中有一个 +
了吗?它意味着程序会详细输出 *Interface
结构体中的属性名,这将有助于我标识出我看到的东西,而不用去查阅文档。&{Index:0 Name: HardwareAddr:5c:5f:67:f3:0a:a7 PHY:0 Device:3 Type
2P device Frequency:0}
&{Index:3 Name:wlp2s0 HardwareAddr:5c:5f:67:f3:0a:a7 PHY:0 Device:1 Type:station Frequency:2412}
注意,两行输出中的 MAC 地址(HardwareAddr
)是相同的,这意味着它们是同一个物理硬件。你也可以通过 PHY: 0
来确认。查阅 Go 的 wifi 模块文档,PHY
指的就是接口所属的物理设备。TYPE: P2P
。第二个接口名为 wpl2s0
,类型是 TYPE: Station
。wifi
模块的文档列出了 不同类型的接口,以及它们的用途。根据文档,P2P
(点对点传输) 类型表示“该接口属于点对点客户端网络中的一个设备”。我认为这个接口的用途是 WiFi 直连 ,这是一个允许两个 WiFi 设备在没有中间接入点的情况下直接连接的标准。Station
(基站)类型表示“该接口是具有控制接入点的客户端设备管理的基本服务集(BSS)的一部分”。这是大众熟悉的无线设备标准功能:作为一个客户端来连接到网络接入点。这是测试 WiFi 质量的重要接口。( ↓↓ —— 未完 —— ↓↓ )
完美阅读及吐槽,请猛击:https://linux.cn/article-14560-1.html?utm_source=qqmail&utm_medium=qqmail
毫不夸张地说,在开源方面获得的经验,帮助我在产品管理领域创造了一条成功的职业道路。
( ↓↓ —— 未完 —— ↓↓ )
完美阅读及吐槽,请猛击:https://linux.cn/article-14562-1.html?utm_source=qqmail&utm_medium=qqmail
从 Pop OS 21.10 升级到 Pop OS 22.04 LTS 的简单步骤。
sudo apt update && sudo apt upgrade
sudo apt update
sudo apt full-upgrade
pop-upgrade recovery upgrade from-release
pop-upgrade release upgrade
( ↓↓ —— 未完 —— ↓↓ )
完美阅读及吐槽,请猛击:https://linux.cn/article-14561-1.html?utm_source=qqmail&utm_medium=qqmail
消息来源:bleepingcomputer
老王点评:看来谷歌文档的语法建议工具被诗歌艺术搞晕了。
消息来源:tomshardware
老王点评:苹果芯片确实很快,但是新技术总是以你想不到的方式出现漏洞。
消息来源:cnet
老王点评:混乱的社区做的事情也是混乱的,这下鸡飞蛋打了。
完美阅读及吐槽,请猛击:https://linux.cn/article-14559-1.html?utm_source=qqmail&utm_medium=qqmail
That’s what this is and where we are: an extremely powerful and wealthy jackass on an ego trip. You can take the
bro out of the frat house but you can’t take the frat house out of the bro. In fact when you’re worth hundreds of billions of
dollars (for now…) you don’t even have to leave the frat house. You can bring it with you. This is a guy whose ideas about
speech and also the construction of syllogisms apparently culminated two joints in at a dorm room bull session in sophomore
year…
图片来自 Marcus Castro on Unsplash
每当谈到设计原则,大家仿佛认为只要将每一条原则发挥至极致,即可设计出最为卓越的产品。然而在现实中,我们时常需要在不同的原则之间进行取舍,或是处理设计原则与业务目标及技术局限之间的冲突。
设计的过程,即是在所有相关因素之间进行权衡并寻求最优体验的过程。那么,我们应该如何明智地进行权衡呢?
https://www.nngroup.com/articles/prioritization-matrices/
要弄清解决一个问题或开发一个功能可以带来的价值,我们可以问问自己:
“仅与一位用户进行测试也强于不做测试。”
—— Steve Krug,《Don’t Make Me Think》
“某些类型的心智处理工作相比于其他行动更具挑战性。”
—— Susan Weinschenk,《设计师要懂的心理学》
来源:Slack
来源:Nielsen Norman Group
第二步:将这些要素按照主题进行分组,例如“项目要素”、“功能特性”、“用户体验诉求”等等。
来源:Nielsen Norman Group
第三步:通过讨论进一步浓缩每个主题当中的要素数量,为每个要素设定一个重要度渐增的标尺;刻度的数量等同于要素的数量,且每个要素的得分互不相同,从而使团队必须制定清晰的优先级决策。
来源:Nielsen Norman Group
图片来自 Hassan Pasha on Unsplash
我是一名设计师,不过去年有将近八个月的时间里,我同时还担任着增长团队的产品经理一职。这期间的工作非常辛苦,不过也让我了解了如何在产品管理与设计工作之间寻求平衡。如今我已回归到设计岗位,在此也愿将自己在担任产品经理期间的一些所得所感分享给大家,希望能帮助更多设计师了解如何提升自己在战略层面的影响力。
或许你会觉得这些与你无关,因为未必存在转岗需求。确实,在设计师职业生涯的头几年,大家更多是聚焦于设计能力的提升。但长期道路不止于此。到了某个阶段,你需要去探索如何提升自己在产品、业务和团队方面的影响力,如何花更多时间去思考问题,而不仅是徘徊于像素之间。
图片来自 Estée Janssens on Unsplash
我在任职产品经理的日子里,同时仍要担负一部分设计师的职责,因此实际工作非常多样,包括向利益相关人进行汇报、产品路线规划、设计展望、设计执行等等。如何在这些工作当中寻求平衡,这对我来说是个重要的挑战。
作为一名曾经的教师,我很喜欢 SMART 目标管理方法(Specific,具体而明确;Measurable,可衡量;Achievable,可实现;Relevant,有相关性;Time-bound,有时限),通常会以季度和年为周期进行追踪。我的目标包含很多方面,涉及业务影响力,个人职业愿景,以及与设计相关的有意思的主题(例如全人群访问、设计文化等等)。为了实现平衡的状态,我借鉴产品经理的思维模式,对所有的目标进行优先级排序,进而确定所需投入的时间。
这一方式让我可以有策略性地关注自己的职能发展及个人成长。我可以更清晰地看到应该何时说不,何时赋权,进而在工作中找到平衡点,让自己的精力得以聚焦于最重要的事务上。具体建议:
图片来自 Nick Fewings on Unsplash
去年秋天,我们刚刚完成产品增长的路线图规划,即将开展相关工作,却发现 app 当中一个关键功能出现了问题,因此全员调动进行处理。
一周之后,我们的整个路线图都发生了变化,参与解决问题的人员数量扩张了一倍,同时还在处理后续出现的新问题。每个人都压力倍增。虽然大家都在询问接下来的方向,但团队当时真正需要的未必是具体答案,而是镇定、安心、正向的环境氛围,从而使团队重新凝聚。我也有参与创造这样环境的责任。
图片来自 Isaac Smith on Unsplash
作为设计师,我曾经非常依赖于我的跨职能合作伙伴来帮我回答定量问题。
随着我开始承担产品经理的职责,大家也开始向我询问转化率方面的问题,另外我还需要向利益相关人分享每周的数据趋势。因此我快速补习了数据分析方面的能力,并研究了我们自己的数据模型。这让我能够开始独立解决数据方面的问题,跑一些常规追踪,更深入和量化地探索用户的行为模式。我开始有针对性的在设计当中添加统计事件,并手动制作一些可视化的数据报告;这个方式在团队内逐渐铺开,并成为了改善跨职能沟通合作的有效工具。
所以我会建议大家更好地拥抱数据:
图片来自 Vista Wei on Unsplash
长期愿景非常重要,但也很容易在创造出来之后被大家遗忘。任职产品经理期间,我过于聚焦在设计开发流程当中,而没有很充分地将长期路线作为与利益相关人进行沟通的工具。
当我们的团队准备进入到项目的第二个阶段时,一些利益相关人开始对我们接下来的发展方向感到困惑。这让我意识到我们不能将自己封闭在日常的工作流程当中,否则团队将逐渐失去对长期愿景的感知和共鸣。
This 2010 prototype of the Nest thermostat wasn’t pretty. But making the thermometer beautiful would be the easy part. The circuit board diagrams point to the next step—making it round.Tom Crabtree
The big companies weren’t going to do it. Honeywell and the other white-box competitors hadn’t truly innovated in 30 years. It was a dead, unloved market with less than $1 billion in total annual sales in the United States.
The only thing missing was the will to take the plunge. I wasn’t ready to carry another startup on my back. Not then. Not alone.
Then, magically, Matt Rogers, who’d been one of the first interns on the iPod project, reached out to me. He was a real partner who could share the load. So I let the idea catch me. I came back to Silicon Valley and got to work. I researched the technology, then the opportunity, the business, the competition, the people, the financing, the history.
Making it beautiful wasn’t going to be hard. Gorgeous hardware, an intuitive interface—that we could do. We’d honed those skills at Apple. But to make this product successful—and meaningful—we needed to solve two big problems:
It needed to save energy.
And we needed to sell it.
In North America and Europe, thermostats control half a home’s energy bill—something like $2,500 a year. Every previous attempt to reduce that number—by thermostat manufacturers, by energy companies, by government bodies—had failed miserably for a host of different reasons. We had to do it for real, while keeping it dead simple for customers.
Then we needed to sell it. Almost all thermostats at that point were sold and installed by professional HVAC technicians. We were never going to break into that old boys’ club. We had to find a way into people’s minds first, then their homes. And we had to make our thermostat so easy to install that literally anyone could do it themselves.
It took around 9 to 12 months of making prototypes and interactive models, building bits of software, talking to users and experts, and testing it with friends before Matt and I decided to pitch investors.
Our testers...spent the first 30 minutes looking for tools.
Turns out we weren’t missing anything—but our testers were. They spent the first 30 minutes looking for tools—the wire stripper, the flathead screwdriver; no, wait, we need a Phillips. Where did I put that?
Once they gathered everything they needed, the rest of the installation flew by. Twenty, 30 minutes tops.
I suspect most companies would have sighed with relief. The actual installation took 20 minutes, so that’s what they’d tell customers. Great. Problem solved.
But this was going to be the first moment people interacted with our device. Their first experience of Nest. They were buying a $249 thermostat—they were expecting a different kind of experience. And we needed to exceed their expectations. Every minute from opening the box to reading the instructions to getting it on their wall to turning on the heat for the first time had to be incredibly smooth. A buttery, warm, joyful experience.
And we knew Beth. Beth was one of two potential customers we defined. The other customer was into technology, loved his iPhone, was always looking for cool new gadgets. Beth was the decider—she dictated what made it into the house and what got returned. She loved beautiful things, too, but was skeptical of supernew, untested technology. Searching for a screwdriver in the kitchen drawer and then the toolbox in the garage would not make her feel warm and buttery. She would be rolling her eyes. She would be frustrated and annoyed.
Shipping the Nest thermostat with a screwdriver "turned a moment of frustration into a moment of delight"Dwight Eschliman
So we changed the prototype. Not the thermostat prototype—the installation prototype. We added one new element: a little screwdriver. It had four different head options, and it fit in the palm of your hand. It was sleek and cute. Most importantly, it was unbelievably handy.
So now, instead of rummaging through toolboxes and cupboards, trying to find the right tool to pry their old thermostat off the wall, customers simply reached into the Nest box and took out exactly what they needed. It turned a moment of frustration into a moment of delight.