【Hacker News搬运】桌面图标的硬度令人惊讶
-
Title: Desktop icons are surprisingly hard
桌面图标的硬度令人惊讶
Text:
Url: https://akselmo.dev/posts/plasma-desktop-icons-positioning-refactor/
很抱歉,作为一个文本和代码处理的AI,我无法直接访问外部链接或网页内容。因此,我无法使用JinaReader或其他工具来抓取和分析你提供的链接内容。 不过,我可以指导你如何使用JinaReader进行内容抓取和分析的步骤: 1. **安装JinaReader**: 首先,确保你已经安装了JinaReader。你可以通过以下命令安装(如果你使用的是Python环境): ```bash pip install jina
-
抓取网页内容:
使用JinaReader的API或命令行工具来抓取网页内容。以下是一个简单的示例:from jina import Document, Client # 创建一个Jina客户端 client = Client() # 使用客户端抓取网页 result = client.post( inputs=['https://akselmo.dev/posts/plasma-desktop-icons-positioning-refactor/'], output_key='content' ) # 输出抓取的内容 for doc in result: print(doc['content'])
-
分析抓取的内容:
抓取到内容后,你可以使用自然语言处理(NLP)工具来分析文本。例如,你可以进行情感分析、关键词提取或摘要生成。from jina import Document, Client # 创建一个Jina客户端 client = Client() # 使用客户端抓取网页 result = client.post( inputs=['https://akselmo.dev/posts/plasma-desktop-icons-positioning-refactor/'], output_key='content' ) # 分析抓取的内容 for doc in result: # 假设我们使用一个外部服务来进行文本分析 analysis = some_text_analysis_service(doc['content']) print(analysis)
-
翻译非中文内容:
如果抓取到的内容不是中文,你需要使用翻译服务。这里可以使用Google翻译API或其他翻译服务。以下是一个使用Google翻译API的简单示例:from googletrans import Translator translator = Translator() # 假设我们有一个非中文的文本 text = "Your non-Chinese text here." # 翻译文本 translated = translator.translate(text, dest='zh-cn') print(translated.text)
请注意,上面的代码示例是假设性的,因为实际的JinaReader使用和翻译API的具体实现可能会有所不同。你需要根据实际的API文档来调整代码。如果你需要具体的翻译结果,你需要访问实际的网页内容,并使用相应的翻译服务。
## Post by: todsacerdoti ### Comments: **lelandfe**: Title made me remember this other example of desktop icons being hard: <a href="https://randomascii.wordpress.com/2021/02/16/arranging-invisible-icons-in-quadratic-time/" rel="nofollow">https://randomascii.wordpress.com/2021/02/16/arranging-invis...</a> > **lelandfe**: 标题让我想起了桌面图标很难的另一个例子:<a href=“https:/;randomascii.wordpress.com/ 2021  16/-以二次时间排列不可见的图标”rel=“nofollow”>https:/;randomascii.wordpress.com;2021年;02■;16°F;正在安排邀请</一 **peterkos**: > It may not sound like much, but this was a lot of work. I spent days just thinking about this problem, trying to understand what is happening now and how to improve it.<p>I find these kinds of problems the most fun and the most educational! I tried building a grid layout system from scratch in SwiftUI, and it was similarly tricky to map out:<p>- what the "ideal" behavior one expects is,<p>- what edge cases exist,<p>- how to handle the edge cases,<p>- maintaining ideal behavior while handling edge cases.<p>(It was tricky b/c SwiftUI lays out its children, then its parent -- so the parent needs to ask its children for its view size, and iterate and set rows/columns that way.)<p>Maybe because the problem seem simple, it is that much more fun to dig into. Some good ol' time with a whiteboard. > **peterkos**: >;这听起来可能不多,但这是一项艰巨的工作。我花了几天时间思考这个问题,试图了解现在发生了什么以及如何改进它。<p>我觉得这类问题最有趣,最有教育意义!我尝试在SwiftUI中从头开始构建一个网格布局系统,但同样很难绘制出来:<p>-什么是“;理想”;人们期望的行为是,<p>-存在哪些边缘情况,<p>-如何处理边缘情况,<p>-在处理边缘情况时保持理想的行为<p> (这很棘手b/;c SwiftUI先布局其子级,然后布局其父级,因此父级需要询问其子级的视图大小,并以此方式迭代和设置行/列。)<p>也许是因为这个问题看起来很简单,所以深入研究它要有趣得多。一些好的ol;时间与白板。 **readthenotes1**: The funniest thing (to me) is not that the author doesn't like desktop icons, but that the problem had been largely solved many times for many decades... > **readthenotes1**: (对我来说)最有趣的不是作者没有;我不喜欢桌面图标,但几十年来,这个问题已经在很大程度上得到了解决。。。
-