Searching txt.sour.is

Twts matching #1:
Sort by: Newest, Oldest, Most Relevant

使用 OpenTelemetry 實現 Golang 服務的可觀測系統
這篇文章中我們會討論可觀測性概念,並瞭解了有關 OpenTelemetry 的一些細節,然後會在 Golang 服務中對接 OpenTelemetry 實現分佈式系統可觀測性。Test Project我們將使用 Go 1.22 開發我們的測試服務。我們將構建一個 API,返回服務的名稱及其版本。我們將把我們的項目分成兩個簡單的文件(main.go 和 info.go)。// file: main. ⌘ Read more

⤋ Read More

你管这破玩意叫指针?
内存,通常被严谨地画成下面这个样子,一个下方是低地址上方是高地址的格子楼。

Image

但我今天换种画法,画成下面这个样子。

Image

每个格子代表内存中的 1 个字节(8 位),格子上的数字就代表内存地址,我也直接用 10 进制来表示了,免得 16 进制又算不明白了。

目前内存是完全空的,格子里没有任何内容。

试想一下,如果你忘掉所有的语法规则和编程规范,你会如何描述对这些内存格子的操作呢?

一、类型系统

很简单,往格子 3 处放个数字 29,往格子 6 处放个数字 38,就这么简单直接地描述即可。

![](https://pic3.zhimg.com/v2-d81f50bc28296aa1a5f6f4456ed4887a_ … ⌘ Read more

⤋ Read More

sqlx: 功能強大的數據庫訪問庫
sqlx[1] 是一個用於擴展標準庫 database/sql 的庫,它提供了一些額外的功能,使得在 Go 中使用 sql 更加方便。sqlx 的目標是保持 database/sql 的簡單性,同時提供更多的功能。sqlx 爲 Go 的標準 database/sql 庫提供了一組擴展。sqlx 中的 sql.Conn、sql.DB、sql.TX、sql.Stmt、sql.Rows、sql.Row ⌘ Read more

⤋ Read More

Release Candidate of iOS 17.5 & iPadOS 17.5 Available for Testing
Apple has issued release candidate builds for iOS 17.5, iPadOS 17.5, watchOS 10.5, tvOS 17.5, and visionOS 1.2. MacOS Sonoma 14.5 release candidate is not yet available. The release candidate versions arrived right after the new M4 iPad Pro debuted, and the final version of iPadOS 17.5 will almost certainly ship on that device. How … [Read More](https://osxdaily.com/2024/05/08/release-candidate-of-io … ⌘ Read more

⤋ Read More

Matter 1.3 Specification Adds Energy Reporting, Electric Vehicle Charging, Water Management Support and More
The Connectivity Standards Alliance (CSA) today announced the debut of a new Matter 1.3 specification that’s available for device makers and platforms. Matter is a smart home protocol that allows smart devices to work across multiple platforms, including HomeKit.

Image

Matt … ⌘ Read more

⤋ Read More

Go Heap Profile 怎麼了?
Go heap profile 是常常用來檢查內存泄露和內存佔用大問題的問題的手段,而且非常常用。而且,我們也經常創建兩個間隔較長的 heap profile, 獲取它們的差值來方便查看內存泄露: Hi, 使用多年的 go pprof 檢查內存泄漏的方法居然是錯的?! [1]今天,度廠的一位同學提出了一個很有意思的案例,讓我們對 heap profile 有了更深的理解。問題: heap prof ⌘ Read more

⤋ Read More

Celebrating 1 year of A11y Design Bootcamp: Takeaways and tips
A11y Design Bootcamp is a live educational program that consists of exercises, discussions, and knowledge shares to raise awareness of web accessibility best practices, the role designers play in creating accessible products, and how to advocate for accessibility with cross-functional partners.

The post [Celebrating 1 year of A11y Design Bootcamp: Takeaways and tips](https://github.blog/2024-05-02-celebrating-1- … ⌘ Read more

⤋ Read More

Erlang Solutions: Naming your Daemons
Within Unix systems, a daemon is a long-running background process which does not directly interact with users. Many similar processes exist within a BEAM application. At times it makes sense to name them, allowing sending messages without requiring the knowledge of their process identifier (aka PID). There are several benefits to naming processes, these include:

  1. Organised processes: using a descriptive and meaningful name organises the processes in the system. It cla … ⌘ Read more

⤋ Read More

Beta 4 of macOS Sonoma 14.5, iOS 17.5, iPadOS 17.5, Available for Testing
The fourth beta versions of iOS 17.5, macOS Sonoma 14.5, and iPadOS 17.5 have been released to users engaging in the beta testing programs for Apple system software. Additionally, new betas for watchOS 10.5, tvOS 17.5, and visionOS 1.2, are also available. While it’s not clear when the final versions of these system software versions … [Read More](https://osxdaily.com/2024/04/30/beta-4-of-m … ⌘ Read more

⤋ Read More

不可思議的快!加速 Docker 中構建 Golang 應用
這些天我在工作中正在進行一個 GoLang 項目。這與我們通常使用的 Java 和 Spring Boot 應用程序有很大不同, 感覺很不錯:)。和我們所有的其他組件一樣, 這個 GoLang 項目也需要被封裝在一個容器中, 才能在 Kubernetes 集羣中執行。所以我編寫了一個 Dockerfile:構建階段FROM golang:1.22.1-alpine AS buildWORKDIR ⌘ Read more

⤋ Read More

Golang 高效的切片拼接和 Go1-22 中新的拼接方法
在 Go 中,切片拼接是一種常見操作,但如果處理不當,可能會導致性能問題或意外的副作用。本文將詳細介紹幾種切片拼接的高效方法,討論它們的優缺點以及適當的使用場景。 基本的方法和其限制使用 append 函數最直接的方法是使用 append 函數,它將一個切片的元素添加到另一個切片的末尾。slice1 := []int{1, 2}slice2 := []int{3, 4}result := app ⌘ Read more

⤋ Read More

Go 語言將 PDF 轉爲 Word ,代碼怎麼實現?
將 PDF 轉換爲 Word 這是一個很常見的功能了,用 Go 語言實現,可以通過以下步驟完成:1 安裝 PDF 轉換工具庫:首先需要使用 Go 語言中的 PDF 轉換庫,比如 pdftoword 或 pdfcpu。你可以使用 Go 的包管理工具(如 go get)來安裝這些庫。2 導入依賴庫:在 Go 項目中導入你選擇的 PDF 轉換庫,並確保正確地導入了所有需要的依賴項。3 加載 PDF 文件 ⌘ Read more

⤋ Read More

使用 GitHub Actions 構建 Golang PGO
今年 2 月,我宣佈 Dolt 版本現已構建爲配置文件引導優化 (pgo) 二進制文件,利用 Golang 1.20 的強大功能將 Dolt 的讀取性能提高 5.3%。在我宣佈這一消息之前,我們的一位常駐 Golang 專家 Zach 試驗並測試了 Golang 的 pgo 功能,並寫下了他在使用 Dolt 構建後觀察到的性能提升,該配置文件首先針對 Dolt 運行我們的 Sysbench 基準測 ⌘ Read more

⤋ Read More

How Katalyst guarantees memory QoS for colocated applications
Member post originally published on Katalyst’s blog In the previous post[1], we introduced Katalyst – a QoS-based resource management system that helps ByteDance improve resource efficiency through colocation of online and offline workloads. In the colocation scenario, memory… ⌘ Read more

⤋ Read More

Beta 3 of iOS 17.5, macOS Sonoma 14.5, iPadOS 17.5, Available for Testing
Apple has issued the third beta versions of iOS 17.5, macOS Sonoma 14.5, iPadOS 17.5, watchOS 10.5, visionOS 1.2, and tvOS 17.5, to all users participating in the beta testing programs for Apple system software. The new beta builds are available to both developer beta and public beta testers on any actively enrolled device, though … [Read More](https://osxdaily.com/2024/04/24/beta-3-of-ios- … ⌘ Read more

⤋ Read More

Golang 異步編程方式和技巧
Golang 基於多線程、協程實現,與生俱來適合異步編程,當我們遇到那種需要批量處理且耗時的操作時,傳統的線性執行就顯得喫力,這時就會想到異步並行處理。下面介紹一些異步編程方式和技巧。作者:zvalhu一、使用方式1.1、最簡單的最常用的方式:使用 go 關鍵詞func main() { go func() {  fmt.Println(“hello world1”) }() go func( ⌘ Read more

⤋ Read More

從零到生產:Go 在 Google 的歷程 [譯]
2007 年 Go 誕生於 Google,2009 年 Google 正式對外宣佈了 Go 語言的開源!時至今日,距離 Go 開源已經過去了近 15 個年頭了 [1]!Go 在 Google 公司內部究竟是怎樣的一個狀態呢?前 Google 員工 Yves Junqueira 近期撰文從其個人所見所聞談了 Go 在 Google 的歷程 [2]!這裏簡單翻譯,供大家參考! 最近,Jeremy Ma ⌘ Read more

⤋ Read More

Been clearing out my pod a bit and blocking unwanted domains that are basically either a) just noise and/or b) are just 1-way (whose authors never reply or are otherwise unaware of the larger ecosystem)

Let me know if y’all have any other candidates you’d like me to add to the blocked domain list?

⤋ Read More

Beta 2 of iOS 17.5, iPadOS 17.5, macOS Sonoma 14.5, Available for Testing
The second beta versions of iOS 17.5, iPadOS 17.5, MacOS Sonoma 14.5, tvOS 17.5, watchOS 10.5, and visionOS 1.2, have been made available by Apple to participants in the beta testing programs for Apple system software. Both developer and public beta testers are able to access the new builds on any enrolled device that is … [Read More](https://osxdaily.com/2024/04/18/beta-2-of-ios-17-5-ipado … ⌘ Read more

⤋ Read More

为什么我的猫看我吃螺蛳粉会以为我在吃“屎”,但我吃进去却不觉得?
因为引起螺蛳粉的臭味物质和便便的臭味物质并不是同一个。而猫对诸如螺蛳粉、榴莲等有特殊气味的食物出于嫌弃,可能会有“埋屎”行为,并不一定是认为你在吃屎。

便便的臭味是由粪臭素(3-甲基吲哚)引起的,存在于哺乳动物的粪便中,为色氨酸在消化系统中的产物。

而螺蛳粉的臭味是其中的配料酸笋发出的,近两年对广西酸笋挥发性成分的研究中发现:

1、酸笋的主要气味成分大致有10多种,主要气味特征是酸味、酸臭味和刺激性气味以及发酵香味;

Image

2、对甲苯酚和乙酸是主要的气味成分。

3、酸笋主要香气属性酸臭味主要与对甲苯酚(窖泥臭)、苯乙醇的浓度呈较好的相关性。酸味及刺激性气味与对乙基愈创木酚、3-辛醇具有较好的相关性。而发酵香味与3-辛醇、壬醛、反-2- … ⌘ Read more

⤋ Read More

Go:常見的幾種設計模式解析
在軟件工程中,設計模式是解決常見問題的一套經典解決方案。Go 語言,作爲一種強調簡潔和高效的編程語言,其設計模式同樣體現了這些理念。本文將探討 Go 語言中常見的幾種設計模式,包括單例模式、工廠模式、策略模式、觀察者模式,並用 UML 創建概念模型來直觀展示這些設計模式的結構。1. 單例模式單例模式確保一個類只有一個實例,並提供一個全局訪問點。在 Go 中,使用私有結構體和公有的獲取實例函數是實現 ⌘ Read more

⤋ Read More

如果让你来改进一座「筒子楼」,你会怎么设计?

引子

筒子楼也算是一个时代的印记了。在还不富裕的年代,以低成本、模块化方式大批量快速建造的筒子楼,对解决温饱问题中的「温」做出了巨大的贡献。就筒子楼住宅而言,它们的普及度在各个城市强弱不一,一般而言,北方城市、国有/集体经济发达的城市,筒子楼的存在感更强一些。但是另一种筒子楼,我相信无论是70后80后90后,都真真切切地接触过、并且住过不止一年,那就是: 学生宿舍

Image

筒子楼的特点

筒子楼的特点都围绕着经济性。在百废待兴、并不富裕的年代,筒子楼的这些特点都是优点,比如:

  1. 得房率高。用长长的走廊并联起许多房间。并且大部分走廊都是内廊式的,两侧都是房间。这样可以将公共面积压缩到极致,最大化可使用的面积。
  2. 户数多。筒子楼的 … ⌘ Read more

⤋ Read More

Golang 也可以寫出很棒的 GUI 應用!
今天聊點輕鬆的,這篇文章會分享一些用 Golang 開發的非常棒的 GUI 應用。 Pixyne第一個是 Pixyne,這是一個照片應用程序,允許你快速查看文件夾中的照片!以下是他們在 Fyne 頁面的鏈接 [1]。EasyLPAC接下來是 EasyLPAC,這個軟件能夠從電腦管理你的 eUICC 卡。這是項目在 GitHub 頁面的鏈接 [2]。Snap接下來是 Snap,這是一個跨平臺的工具 ⌘ Read more

⤋ Read More

Go 通過 grpc-protobuf 實現高性能用戶服務實戰,從 0 到 1 超級詳細流程!!
基礎知識準備在在代碼實戰 gRPC 之前,我們需要了解一些基礎知識:RPC(Remote Procedure Call):遠程過程調用,是一種通信協議,允許應用程序在不同的計算機上請求服務而不需要了解底層網絡細節。 gRPC:gRPC 是一種高性能、開源的遠程過程調用(RPC)框架,由 Google 開發,並基於 HTTP/2、Protocol Buffers 等技術實現。 Proto ⌘ Read more

⤋ Read More

Go 一行代碼測量函數的執行時間
Golang Tips 是翻譯的 Phuong Le @func25[1] 陸陸續續的發表的推文,目前已經發表 70 + 了。我徵得 Phuong Le 的同意後,會逐步把這些推翻翻譯過來,發佈到公衆號上。因爲是推文,可能原作者的內容比較簡單,比如第一個 tip 就一張圖片,我會相應的進行擴充,豐富其內容。 後續也會在 github 建立一個項目,大家都可以參與進行翻譯。我們可以通過 defe ⌘ Read more

⤋ Read More

專爲 Go 語言設計的函數式編程庫 fp-go
背景介紹在編程領域中,函數式編程是一種編程範式,它將計算視爲函數的評估,避免改變狀態和可變數據。然而,Go 語言並沒有內建對函數式編程的支持,這使得在 Go 語言中實現函數式編程變得困難。今天要給大家推薦一個 GitHub 開源項目 IBM/fp-go,該項目在 GitHub 有超過 1.1k Star,用一句話介紹該項目就是:“functional programming library for ⌘ Read more

⤋ Read More

使用 gofn 和 pipe 助力 Golang 函數式編程
今天要介紹的是兩個在函數式編程裏面很有用的 package,通過使用 gofn[1] 和 pipe[2] 庫讓 Go 的函數式編程更強大。Go 的函數式編程由於本質上,Go 並不像 Haskell 或 Erlang 那樣是純函數式語言,但這並不意味着我們不能應用函數式編程的概念來編寫簡潔、可讀和高效的代碼。這正是 gofn 和 pipe 發揮作用的地方。gofn 和 pipegofn:一個在 Go ⌘ Read more

⤋ Read More

灯塔之下,科学璀璨

1、 为什么要做《某科学的超级实验室》

《某科学的超级实验室》是一个“探室”主题的系列纪录片,其实在灯塔计划之前,我就已经尝试做过两期内容,

在我看来,这个项目想要展现两个方面,一个是科学家的精神面貌,另一个是我国的大科学装置。为什么要做这个主题呢?因为我们自己作为一个科研人员,对于科研人员是一种什么样的状态,什么样的表现,有着比较深入的理解。但是感觉大众对于科学家这个群体还是比较陌生的,而且会受影视作品的影响,对科学家有一些刻板印象。我希望想通过一些视频去把它展现给大众,让大家真正的去了解科学家到底是什么样子的,科研工作到底是什么样子的。

Image

球场上的科学家@中国散裂中子源

2、遥遥领先的中国大科学装置!

而这一年的探室,对我来说是大开眼界,最直观的就是我国投资建设的这些大科学装置,在探访期间,在我心里一直有一个词“遥遥领先”。我不知道、我也相信不少观 … ⌘ Read more

⤋ Read More

Golang 使用 Worker Pool 模式釋放併發性能
我們都知道 Go 具有卓越的併發特性,Worker Pool pattern(工作池模式)是一種併發設計模式,它用於管理一組工作線程以執行任務。本文用一個例子深入講解如何使用 Worker Pool 模式提升程序的併發性能。拋出問題快速計算一個數字數組中每個數字的平方,並返回結果數組(該數組只包含從 1 到 150 的整數)。Pattern 1 : N routines for N numbers ⌘ Read more

⤋ Read More

使用 Golang 構建你的 LLM API
大語言模型,像 ChatGPT, Llama 等已經席捲全球,從上圖的數據可以看出,ChatGPT 花了 5 天時間就達到了 100 萬用戶。而 Netflix 則花了近 4 年的時間。本文將使用 Gin 和 Langchain 教你快速構建一套 LLM API。GinGin[1] 是一個用於使用 GoLang 構建 API 的現代、快速的 Web 框架。它被設計爲易於使用、高效且性能出色,利用了 ⌘ Read more

⤋ Read More

MacOS Ventura 13.6.6 & Safari 17.4.1 Update Available
Apple has released macOS Ventura 13.6.6 for Mac users running Ventura, along with Safari 17.4.1 for Mac users running Ventura and Monterey. These software updates include some of the same critical security fixes that came with macOS Sonoma 14.4.1, and are aimed at users who are not running the Sonoma operating system on their Macs. … [Read More](https://osxdaily.com/2024/04/03/macos-ventura-13-6-6-safari-17-4-1-update-avail … ⌘ Read more

⤋ Read More

First Beta of iOS 17.5, macOS Sonoma 14.5, iPadOS 17.5 Released for Testing
Apple has released the first beta versions of a round of upcoming future software updates, versioned as iOS 17.5 for iPhone, macOS Sonoma 14.5 for Mac, iPadOS 17.5 for iPad, tvOS 17.5 for Apple TV, watchOS 10.5 for Apple Watch, and visionOS 1.2 for Apple Vision Pro. The betas are available now to users enrolled … [Read More](https://osxdaily.com/2024/04/02/first-beta-of-ios-17-5-macos- … ⌘ Read more

⤋ Read More

用 Go 語言實現多協程文件上傳,斷點續傳,試試!
網上很多文件基本都是多協程下載文件要麼就只有單協程的斷點續傳,這裏給大家寫一個支持有進度條的多協程下載文件,也支持斷點續傳。好了,直接看代碼就好了,小編已加上詳細的解釋與說明package mainimport ( ”fmt” ”io” ”os” ”regexp” ”strconv” ”sync” ”github.com/qianlnk/pgbar”)/* 需求:1. 多協程下載文件2.斷點續連* ⌘ Read more

⤋ Read More

iOS 16.7.7 & iPadOS 16.7.7 Released for Older iPhone & iPad Models
Apple has released iOS 16.7.7 and iPadOS 16.7.7 for select older model iPhone and iPads. The updates seem to include the same essential and applicable security fixes that iOS 17.4.1 and iPadOS 17.4.1 included. Specifically, iOS 16.7.7 is available for iPhone 8, iPhone 8 Plus, iPhone X, while iPadOS 16.7.7 is available for iPad 5th … [Read More](https://osxdaily.com/2024/04/01/ios-16-7-7-ipados-1 … ⌘ Read more

⤋ Read More