#

nostrblog

(7 articles)

Polypack: A Smart Database That Understands Meaning

Imagine you have a filing cabinet full of documents. You can search by title, by date, by keyword. That works fine if you know exactly what you are looking for. But what if you could search by meaning instead? What if you could ask your filing cabinet to find everything "related to machine learning" without ever typing those exact words, and it just knew what you meant? That is the idea behind Polypack. It is a graph database -- a smart way of storing and connecting information -- that runs directly in your web browser or on a server. Unlike traditional databases that only match exact keywords, Polypack understands conceptual relationships between pieces of data. It has been under intense development recently, with the project jumping from version 1.1.0 to 2.3.0 in just a few days. Here is why you might want to take a closer look. **What Makes Polypack Different** Most databases work like a spreadsheet. You have rows and columns, and you search for rows where a column matches a value. Polypack works more like a brain. It stores things as nodes (think of them as ideas, people, documents or products) and edges (the connections between them, like "Alice wrote this document" or "this product is similar to that product"). The real magic is in something called vector similarity search. Every piece of data can have a vector -- a mathematical fingerprint that captures its meaning. When you search, Polypack compares these fingerprints to find things that are conceptually close, not just textually matching. It compares meanings, not words. If you search for "gardening tips" in a traditional database, you only get results that contain those exact words. Polypack will also find articles about composting, pruning and soil health, because it recognises they are about the same topic. **What Has Changed Recently** The project's creator has been shipping improvements at a furious pace. Here are the highlights. Lightning fast search at scale. The latest version includes something called an HNSW index. It is a clever mathematical structure that makes approximate nearest neighbour searches incredibly fast, even when you have hundreds of thousands of items. In plain English, searching by meaning used to slow down as your dataset grew. Now it stays fast no matter how much data you throw at it. Proper storage that survives a crash. Earlier versions of Polypack relied on IndexedDB, the browser's built in storage system. The new BinaryStoreAdapter uses a write-ahead log -- like a transaction journal -- that keeps your data safe. If your browser crashes or your computer loses power, your data is not corrupted. This is the kind of reliability you expect from a serious database. Meaning from text without downloading AI models. One of the coolest recent additions is built-in text embeddings. Polypack can take a piece of text and generate a mathematical representation of its meaning entirely on its own, using a technique called feature hashing. You do not need to download a machine learning model, sign up for an API, or send your data to a cloud service. It just works, right there in the browser. Real time sync. If you have ever used a notes app that sometimes loses changes when you switch devices, you know how frustrating that can be. Polypack now includes a real time synchronisation layer that handles acknowledgements, retries, deduplication and reconnection after a dropped connection. Multiple browser tabs or devices can stay in sync without stepping on each other. More room to work. The hot cache -- the set of data held in active memory -- has been bumped from 10,000 nodes to 50,000 nodes. That means you can work with much larger datasets without hitting performance bottlenecks. **Why Try It Now** The timing is good. Polypack has matured quickly and the recent changes address the three biggest concerns developers have when choosing a database: speed, reliability and ease of use. For a non-technical audience, the appeal is simpler. Polypack lets you build applications that feel smart. Applications that understand context, that surface related content without being told exactly what to look for, that work offline and sync when they come back online. All of that without needing to run a server or manage infrastructure. It is also free. Polypack is released under the MIT license, which means you can use it for personal projects, commercial products or anything in between. There is no catch, no pricing tier, no data limit. **Where to Find It** Polypack lives on GitHub at [github.com/imattau/polypack] (https://github.com/imattau/polypack). The changelog, API documentation and contributing guidelines are all there. If you just want to use it in a project, the npm package is called @0xx0lostcause0xx0/polypack and installs with a single command. The project is young and moving fast, but that is part of the fun. It is being built in the open, responding to real world use, and it is only going to get better. If you have been looking for a database that thinks a little more like you do, give it a try.

narr +webkit2 web-based RSS 阅读nostr长文

## 什么是narr? 今天翻 fiatjaf 仓库 竟然发现了这个宝贝 narr和我最进做的 nostrbook.com有交集。 >? 交集在哪里呢? narr (not another rss reader) is a web-based RSS and Nostr long-form feed aggregator which can be used both as a desktop application and a personal self-hosted server. 1. long-form ,也就是30023. 2. desktop application 这两点足够对我有吸引力。 下载,运行 界面不错。 继续! ![图片](https://cdn.nostrcheck.me/fd06f542bc6c06a39881810de917e6c5d277dfb51689a568ad7b7a548d6d54cd/62a4e0375a7a718581aea182dd196be7b3898718d11bcb0f2edd4fe4b11eef78.webp){.user-img} 不过这个是需要 自己通过浏览器浏览的。并没有独立打包成一个app。那么问题来了,不够阿。 顺着他的介绍,The app is a single binary with an embedded database (SQLite), it is based on yarr. ## yarr 我去看了看yarr 是可支持gui的,不过Linux支持的不够,我平时基本就是Linux。 怎么办? ## webkit 用webkit套一个吧。 ```go package main /* #cgo linux pkg-config: webkit2gtk-4.1 gtk+-3.0 #include <gtk/gtk.h> #include <webkit2/webkit2.h> static void initAndShow(GtkWidget **window, const char *url) { // 必须初始化 GTK gtk_init(NULL, NULL); *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(*window), "nostrbook.com"); gtk_window_set_default_size(GTK_WINDOW(*window), 1024, 600); // 创建 WebView GtkWidget *webview = webkit_web_view_new(); gtk_container_add(GTK_CONTAINER(*window), webview); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview), url); // 显示窗口 gtk_widget_show_all(*window); } */ import "C" import ( "unsafe" ) func main() { var window *C.GtkWidget url := C.CString("http://127.0.0.1:7049") defer C.free(unsafe.Pointer(url)) // 调用 C 函数初始化 C.initAndShow(&window, url) // 进入 GTK 主循环 C.gtk_main() } ``` ## 什么是下一步呢? 继续研究吧,看看go + webkit 能不能打包 这个 http server ? 再看看 有没有可以编辑的 md ide 用simple 也可以的。 等等看吧。

如何用nostrbook搭建一个免费的 电子书系统?

## 什么是电子书系统? 目前电子书系统非常多,gitbook,mkdocs,vitepress。但是这些系统都有一个问题,就是你需要 静态存储你的markdown文件, 而且不能在线编写。 现有的电子书系统,你需要用一个 第三方编辑器 制作好一个一个的md文件,并且编排好目录结构,然后用上面列举的 软件生成 一个website。 ## 现有电子书的缺点是什么? 1. 空间问题,你需要存书的空间; 2. 编写不方便 写好以后需要手动上传; 3. 登录到服务器更新写好的新文件; 4. 不支持交互和评论; 5. 再重启服务器,(有些可能不需要重启,自己能监控); 以上过程太繁琐了。 ## nostrbook如何解决这个问题? * nostrbook采用的在线编辑; * 用户无须任何空间,内容存储到第三方服务器,你也可以用自己的服务器; * 免费,开源; * 发布轻松,写好点"提交"就发布了,不需要过多的动作; * 无须其他的维护成本; * 支持 评论和点赞; * 可以私有部署,到自己服务器,或者部署在本机都可以。 ## 搭建过程 ### 环境依赖 * nodejs ### 安装过程 ``` git clone https://github.com/nostrbook/nostrbook cd nostrbook npm install npm run dev ``` ### 定制化配置 ``` 修改这个文件 https://github.com/nostrbook/nostrbook/blob/main/src/lib/config.ts export let booktag="createbook"; export let blogtag="createblog"; export let chaptertag="bookchapter"; ``` 修以上3个参数,就可以成为你自己的 电子书和blog了。 你要你的系统安装了nodejs,就可以了。 Windows,Linux ,macos都可以。 系统支持 电子书和blog,你可以搭建 私有 日志系统也可以。

nostrbook 的blog功能今日更新

## 今天主要是更新了seo优化: * 增加了 blog页面的预加载内容,这样搜索引起抓取blog页面的时候,能够看到的是渲染好的 blog 列表; * 增加里 blog/[blogid] 页面的 显示原文静态链接,这个链接主要是给搜索引擎使用,他根据原文可以抓取content内容 * 在+page.svelte页面 增加了 raw 数据显示,用户也可以看到和搜索引擎一样的内容,这个取决于 svelte的页面访问路由机制,她发现是api访问就会调用 server.ts返回数据,她发现是浏览器访问就会返回+page.svelte渲染的内容。 这个设计让搜索引擎和 浏览器看到的有区别。所以我两个都做了。 ## 接下来的工作计划 * 增加 blog的评论和点赞功能? * 美化页面? * 做一个electron的客户端? * 给用户做一个 通过blog定制化自己的主页? ## 关于nostrbook的 想法 用户其实可以通过nostrbook 搭建自己的blog系统,或者写书系统。在公司内网或者自己的服务器上。 修改config.ts的面的三个配置就可以了。 ```js export let booktag="createbook"; export let blogtag="createblog"; export let chaptertag="bookchapter"; ``` 我也是通过这个开关测试了线上和测试的开发的内容区分开的。 ## 昨天发现的bug 就是 30023 update问题,虽然可以通过dtag可以实现替换。但是部分服务器没有update到最新的。所以他会返回老的。 是不是通过服务器之间的同步可以解决呢?