单元测试原则 

Background   背景

I learned about the Unit Testing book through Saša Jurić’s Clarity talk. The entire talk was brilliant but the last 15 minutes especially, when he turned the discussion to testing, were eye-opening. Jurić attributed his style of testing units of behavior instead of units of code to Vladimir Khorikov’s Unit Testing book, so I decided to buy a copy.
我通过 Saša Jurić的 Clarity 演讲了解到这本单元测试的书。整个演讲都非常精彩,尤其是最后 15 分钟,当他把讨论转向测试时,让我大开眼界。Jurić将他的测试行为单元而不是代码单元的风格归功于 Vladimir Khorikov 的《单元测试》一书,因此我决定买一本。

继续阅读

数据

https://www.themoviedb.org/movie/62568-chi-luo-tian-shi
<?php
   $WPD = new WPD_Douban();
   echo $WPD->render_template(['music', 'book', 'game', 'movie'],'card');
?>
<?php
   $WPD = new WPD_Douban();
   echo $WPD->render_template(['music', 'book', 'game', 'movie'],'card');
?>
<?php
   $WPD = new WPD_Douban();
   echo $WPD->render_template(['music', 'book', 'game', 'movie'],'card');
?>

Show HN: 可视化探索推荐 / 热门科幻书籍(及其他类型)

Hi all, creator here 🙂
大家好,我是创作者 🙂

I launched Shepherd.com (https://shepherd.com/) on HN in 2021 and have added a ton since then! Here is the original Show HN (https://news.ycombinator.com/item?id=26871660).
我在 2021 年在 Hacker News 上发布了 Shepherd.com(https://shepherd.com/),并且从那时起添加了很多内容!这是最初的 Show HN(https://news.ycombinator.com/item?id=26871660)。

What did we add?  我们添加了什么?

We just shipped a monster update for bookshelves! Try the science fiction bookshelf as an example:
我们刚刚为书架发布了大幅更新!以科幻书架为例:

https://shepherd.com/bookshelf/science-fiction

You can visually explore science-fiction books in a ton of different ways.
你可以用很多种不同的方式直观地探索科幻书籍。

The most recommended of all time (or by decade): https://shepherd.com/bookshelf/science-fiction
所有时间最推荐的(或按年代推荐): https://shepherd.com/bookshelf/science-fiction

Trending science fiction books: https://shepherd.com/bookshelf/science-fiction/trending
热门科幻书籍:https://shepherd.com/bookshelf/science-fiction/trending

The most recommended new sci-fi (pub in last 3 years): https://shepherd.com/bookshelf/science-fiction/new
最近三年出版的新科幻推荐: https://shepherd.com/bookshelf/science-fiction/new

Filter sci-fi by subgenre, topics, and more (for example this filter shows books with AI): https://shepherd.com/bookshelf/science-fiction/book-dna?topi…
按子类型、主题等筛选科幻(例如这个筛选显示 AI 相关的书籍): https://shepherd.com/bookshelf/science-fiction/book-dna?topi…

Our sci-fi book recommendation lists by authors: https://shepherd.com/bookshelf/science-fiction/book-lists
按作者推荐的科幻书单: https://shepherd.com/bookshelf/science-fiction/book-lists

And, we’ve got these for 3,000+ bookshelves…
而且,我们还有超过 3,000 个书架…

Space opera: https://shepherd.com/bookshelf/space-opera
太空歌剧:https://shepherd.com/bookshelf/space-opera

Hard science fiction: https://shepherd.com/bookshelf/hard-science-fiction
硬科幻: https://shepherd.com/bookshelf/hard-science-fiction

Military science fiction: https://shepherd.com/bookshelf/military-science-fiction
军事科幻: https://shepherd.com/bookshelf/military-science-fiction

History: https://shepherd.com/bookshelf/history
历史: https://shepherd.com/bookshelf/history

Nonfiction: https://shepherd.com/bookshelf/nonfiction
非虚构: https://shepherd.com/bookshelf/nonfiction

Biology: https://shepherd.com/bookshelf/biology
生物学:https://shepherd.com/bookshelf/biology

World War 1: https://shepherd.com/bookshelf/world-war-1
第一次世界大战:https://shepherd.com/bookshelf/world-war-1

Math: https://shepherd.com/bookshelf/math
数学:https://shepherd.com/bookshelf/math

Astrophysics: https://shepherd.com/bookshelf/astrophysics
天体物理学:https://shepherd.com/bookshelf/astrophysics

Philosophy: https://shepherd.com/bookshelf/philosophy
哲学:https://shepherd.com/bookshelf/philosophy

Travel: https://shepherd.com/bookshelf/travel
旅行:https://shepherd.com/bookshelf/travel

Fantasy: https://shepherd.com/bookshelf/fantasy
奇幻:https://shepherd.com/bookshelf/fantasy

Books for 8-year-olds: https://shepherd.com/bookshelf/8-year-olds
8 岁孩子的书:https://shepherd.com/bookshelf/8-year-olds

You can browse for any genre, topic, or age group in the search bar, too.
你还可以在搜索栏中浏览任何类型、主题或年龄段的书籍。

Where does the data that drives this come from?
这些驱动数据来自哪里?

We’ve done mini-interviews with 12,000+ authors to get their favorite books. We also conduct an annual survey of readers/authors to find their 3 favorite reads of the year (https://shepherd.com/bboy/2024). I’m working to bring in more reader data and expand our book database using Open Library.
我们与 12,000 多位作者进行了小型访谈,以获取他们最喜欢的书籍。我们还每年进行一次读者/作者的调查,以找出他们最喜欢的三本书(https://shepherd.com/bboy/2024)。我正在努力引入更多读者数据,并使用 Open Library 扩展我们的书籍数据库。

What do we use to build this?
我们用什么来构建这个?

Python, Django, Heroku, Postgres, Cloudflare, NLP/ML for Wikipedia topic IDs via Wikifier (https://wikifier.org), Nielsen’s book API database (publisher data + Library of Congress data), and Cloudinary.
Python、Django、Heroku、Postgres、Cloudflare、用于 Wikipedia 主题 ID 的 NLP/ML(通过 Wikifier,https://wikifier.org)、Nielsen 的图书 API 数据库(出版社数据+国会图书馆数据),以及 Cloudinary。

What’s next?  接下来是什么?

I’m working to launch a full app for readers that will be like Goodreads but smarter, more personalized, and focused on private notes. I’ve got some early mockups here and more info:
我正在开发一款面向读者的完整应用程序,它将像 Goodreads 一样,但更智能、更个性化,并专注于私人笔记。这里有一些早期的模型图,更多信息:

My email is ben@shepherd.com if you want to share ideas or suggestions 🙂
如果想要分享想法或建议,我的邮箱是 ben@shepherd.com 🙂

Thanks, Ben  谢谢,本

重新开放恶魔岛?土著人民说这不仅仅是疯狂——这是历史的抹杀

When Donald Trump pledged to reopen the notorious Alcatraz prison as a detention center for immigrants and violent offenders, the idea was met with contempt and mockery. San Francisco leaders have called it Trump’s “stupidest idea yet” and threatened to cut off the island’s sewage and garbage services if the president acts on his carceral ambitions.
唐纳德·特朗普承诺重新开放臭名昭著的恶魔岛监狱作为移民和暴力罪犯的拘留中心时,这个想法遭到了蔑视和嘲笑。旧金山领导人称这是特朗普“迄今为止最愚蠢的想法”,并威胁说,如果总统实现他的监禁野心,他将切断岛上的污水和垃圾服务。

继续阅读

读书笔记

比如拒绝做知识的搬运工,必须用自己的话写下来;比如需要记录的是知识,而非信息;比如不需要进行机械分类,而是让关系慢慢地自动生长出来等。让你能够从另外一个角度重新看待“做笔记”这件事背后蕴藏的深层思考。

卡片盒笔记写作法

第一类是主题索引。当某个主题的内容积累得足够丰富,卢曼就会做一张主题索引卡,对这个主题进行概览。主题索引卡上会汇集所有相关笔记的编码或链接,每条笔记会用一两个词或一个短句简要说明核心内容。这类索引,相当于给了你一个进入某一主题的入口。


第二类与主题索引类似,只不过不是对某一主题的概览,而是针对盒子里相近位置的卡片所涉及的所有不同主题进行概览。


第三类是在当前卡片上做索引,标明这条笔记逻辑上的前一条是什么、后一条是什么(这些卡片在盒子里的位置可能并不挨着)。


第四类,也是最常用的索引形式,就是简单的“笔记-笔记”连接。两条笔记可能完全没有关系,把它们关联在一起,往往会产生出乎意料的新思路。

在卡片盒中添加笔记后,我们需要确保它可以再次被找到。这就是建索引的作用。