NewsToday2: What it is & How to Disable NewsToday2 on Mac
Some Mac users have discovered a process named “NewsToday2” running on their Mac, typically found after they’ve noticed a slowdown on their machine, or if they’re browsing through active processes running in MacOS. We’re going to dive into the NewsToday2 process in MacOS, discuss what it is, and show you how to stop it from … Read More ⌘ Read more
最具研讀價值的 Go 源碼之一:context 包
前言你瞭解 Context 中的回溯鏈和樹結構嗎?想知道 Context 如何觸發級聯取消嗎?本文將換個角度聊一聊 golang 中的 context,讓你真正理解什麼是 Context。context 包中的代碼雖然只有 600 多行,但已經成爲了併發控制、超時控制的標準做法,可以說是真正的短小而精悍,是十分值得研讀的 Go 源碼之一。本文首先從整體的視角解析了 context 的主要接口和函數 ⌘ Read more
一文帶你完整了解 Go 語言 IO 基礎庫
作者 | 百度小程序團隊 導讀 introduction對於剛接觸 Golang 學習的同學,估計比較難掌握的知識點之一就是文件 IO 處理,光在基礎庫裏會發現 golang 除了 io 包提供文件處理外,os 包,http 包,embed 包都有提供類似的處理,由於 Golang 的繼承表達採用的是隱式的表達, 所以他們之間有什麼關係?能否相互轉換處理?是非常難一眼看出來的。本文就幫大家完整地 ⌘ Read more
John Wall didn’t own a sampler until he was 40. Life can go ways, it’s good to remember.
About death
I’m on a train again. This time I’m going home from Hudiksvall after a
grueling weekend.
I went from Malmö on Thursday morning and worked the entire day on
trains. I arrived in Ljusdal after close to nine hours. I checked in
at the only hotel in town again and, after a quick meal and glass of
wine, went over to a very sad dad with a bottle of Macallan. We didn’t
empty it but we sure tried. I got back to the hotel pretty late.
Wasn’t able to sleep much.
The day after it was my dad’s wife’s funeral. Met up at dad’s … ⌘ Read more
go 中更加強大的 traces
原文地址:More powerful Go execution traces 原文作者:Michael Knyszek 本文永久鏈接: https://github.com/gocn/translator/blob/master/2024/w12morepowerfulgoexecutiontraces.md 譯者:小超人 Go 版本: 1.22+ ru ⌘ Read more
OpenTelemetry Go 語言教程
本教程將演示如何在 Go 中使用 OpenTelemetry,我們將手寫一個簡單的應用程序,並向外發送鏈路追蹤和指標數據。準備示例應用程序——–創建一個扔骰子的程序。在本地新建一個dice目錄,並進入該目錄下。mkdir dicecd dice執行 go mod 初始化。go mod init dice在同一目錄下創建 main.go 文件,並添加以下代碼。package mainimp ⌘ Read more
Go 語言的宕機恢復,如何防止程序奔潰
Recover 是一個 Go 語言的內建函數,可以讓進入宕機流程中的 goroutine 恢復過來,recover 僅在延遲函數 defer 中有效,在正常的執行過程中,調用 recover 會返回 nil 並且沒有其他任何效果,如果當前的 goroutine 陷入恐慌,調用 recover 可以捕獲到 panic 的輸入值,並且恢復正常的執行。通常來說,不應該對進入 panic 宕機的程序做任何 ⌘ Read more
Base: 4.50 miles, 00:09:41 average pace, 00:43:35 duration
was not sure if i was going to be able to get a run in or not. felt a bit rushed but overall it was a good one.
#running #treadmill
Pinellas County - Base: 4.76 miles, 00:09:04 average pace, 00:43:07 duration
good run with no pain. legs were still sore but no big deal. i think i was going a bit too fast and needed to slow it down by about ~30 seconds, but the body did not seem like it was pushing too much either.
#running
Go 語言的雙向鏈表、list 操作和雙向循環鏈表- 這些誰認識?
雙向鏈表1)雙向鏈表的結構雙向鏈表結構中元素在內存中不是緊鄰空間,而是每個元素中存放上一個元素和後一個元素的地址第一個元素稱爲(頭)元素,前連接(前置指針域)爲 nil 最後一個元素稱爲 尾(foot)元素,後連接(後置指針域)尾 nil 雙向鏈表的優點在執行新增元素或刪除元素時效率高,獲取任意一個元素,可以方便的在這個元素前後插入元素 充分利用內存空間,實現內存靈活管理 ⌘ Read more
更強大的 Go 執行跟蹤能力
runtime/trace 包 1] 包含了一個強大的工具, 可用於理解和調試 Go 程序。該功能允許我們在一段時間內對每個 goroutine 的執行進行跟蹤。使用 go tool trace 命令 [2), 我們就可以可視化和探索這些跟蹤數據。跟蹤的魔力在於, 它可以輕鬆揭示程序中一些通過其他方式很難發現的問題。例如, 大量 goroutine 在同一個 channel 上阻塞導致的併發瓶頸, ⌘ Read more
使用 mapstructure 高效解析 Go 語言中的動態數據結構
在處理數據流(如 JSON、Gob 等)過程中,我們可能不知道底層數據的結構,這時mapstructure庫就能大顯身手了。這款 Go 語言庫可以將通用 map 值解碼爲 Go 本地結構,也可執行反向操作,並提供有用的錯誤處理功能。今天,我們就深入瞭解這個庫,並列舉一些豐富的示例來幫助你掌握它的使用方法。簡介–mapstructure是一款 Go 庫,允許開發者將map[string]inter ⌘ Read more
Proprietary video stream; wealthy company lighting expensive candles
Big rocket go brrr
Go 錯誤處理:用 select-case 來解決這個歷史難題?
大家好,我是煎魚。日常看 Go 社區的一些新動態,發現大家對於錯誤處理的新提案是很積極。上次分享了一篇想要用 switch-case 來解決現狀的新提案,不少同學認爲不可行。沒想到 Go 社區的同學腦洞還是很大的,這幾天又整出來個 select-case 的新提案的方式來解決錯誤處理。今天基於此給大家分享一下社區裏的新腦洞。快速背景—-本節的背景主要是給不瞭解的同學拉通一下。如果已經知道的可以 ⌘ Read more
Go state machine patterns
1 points posted by John Doak ⌘ Read more
Go 中的高速數據包處理: 從 net-Dial 到 AF_XDP
推進 Go 的極限: 從 net.Dial 到系統調用、AFPACKET 和極速 AFXDP。數據包發送性能的基準測試。最近, 我編寫了一個 Go 程序, 向數百萬個 IP 地址發送 ICMP ping 消息 [1]。顯然, 我希望這個過程能儘可能快速高效地完成。因此, 這促使我研究各種與網絡棧交互和快速發送數據包的各種方法。這是一個有趣的旅程, 所以在本文中, 我將分享一些學習成果, 並記錄 ⌘ Read more
寶藏級 Go 語言開源項目——教你自己動手開發互聯網搜索引擎
DIYSearchEngine 是一個能夠高速採集海量互聯網數據的開源搜索引擎,採用 Go 語言開發。Github 地址: https://github.com/johnlui/DIYSearchEngine 運行方法 首先,給自己準備一杯咖啡。把本項目下載到本地 編譯:go build -o ese *.go 修改配置文件:cp .env.example .env,然後把裏面的 ⌘ Read more
Fruit, veg growers say biggest customer ‘is the rubbish bin’, as millions of tonnes of food is wasted
Fresh produce growers scramble to meet “forecast” supply deals with supermarkets, but every year millions of dollars of surplus food goes to waste. So what’s going on? ⌘ Read more
Go: And Leave Your Java Factories Behind
1 points posted by John Doak ⌘ Read more
4 秒處理 10 億行數據! Go 語言的 9 大代碼方案,一個比一個快
編譯 | 核子可樂、凌敏來自 | InfoQ2024 年開年,Java “十億行挑戰”(1BRC)火爆外網。該挑戰賽要求開發者編寫一個 Java 程序,從一個包含十億行信息的文本文件中檢索溫度測量值,並計算每個氣象站的最小、平均值和最高溫度。“十億行挑戰” 的目標是爲這項任務創建最快的實現,同時探索現代 Java 的優勢。這項挑戰聽起來很簡單。但十億行代碼實際是一項龐大的工程,如果以每個數字 3 ⌘ Read more
Go arena 民間庫來了,可以手動管理內存!
大家好,我是煎魚。上年我們有討論過關於 Go arena 手動管理內存的相關提案。一開始還高歌猛進,但沒想到後面由於嚴重的 API 問題(想把 arena 應用到其他的標準庫中,但會引入大問題):Go 核心團隊中途咕咕咕到現在,沒有新的推動和突破性進展,實屬尷尬。最近有社區的大佬有了新的動作,來自 Grafana 的 @Miguel Ángel Ortuño 開源了一個新的第三方庫 ortuman ⌘ Read more
slog 終極指南
在本文中,我們將探討 Go 中的結構化日誌記錄,並特別關注最近推出的 log/slog[1] 軟件包, 這個軟件包旨在爲 Go 帶來高性能、結構化和分級的日誌記錄標準庫。該軟件包起源於由 Jonathan Amsterdam 發起的 GitHub 討論 [2], 後來專門建立了一個提案 [3] 細化設計。一旦定稿,它在 Go v1.21 版本中發佈。在以下各節中,我將全面呈現 slog 的功能, ⌘ Read more
Look At This Thing Go! ⌘ Read more
Go 爲什麼不支持從 main 包中導入函數?
大家好,我是煎魚。作爲一個維護過許多有一定歷史沉澱的 Go 項目的人,在歷史債務下和奇葩需求下,會遇到一些迫於業務需求的技術訴求。訴求上是希望引用多項目,會出現從 main 包(package)中導入相關函數的這種使用訴求。爲了將多 Go 工程合併到一個大單體中使用。問題案例—-具體的使用案例如下。我們有一個 Go 應用,目錄結構如下:demo1├── go.mod├── main.go└── ⌘ Read more
Going to have to reinstall my Yunohost server one of these days as the packages no longer seem to be updateable.
深入探究 Go log 標準庫
Go 語言標準庫中的 log 包設計簡潔明瞭,易於上手,可以輕鬆記錄程序運行時的信息、調試錯誤以及跟蹤代碼執行過程中的問題等。使用 log 包無需繁瑣的配置即可直接使用。本文旨在深入探究 log 包的使用和原理,幫助讀者更好地瞭解和掌握它。使用先來看一個 log 包的使用示例:package mainimport “log”func main() { log.Print(“Print”) ⌘ Read more
Go 併發編程 —— I-O 聚合優化(動畫講解)
背景提要在存儲系統中,在確保功能不受損的前提下,儘量的減少讀寫 I/O 的次數是優化的一個重要方向,也就是聚合 I/O 的場景。讀寫操作雖然都有聚合 I/O 的需求,但各自的重點和實現方法卻有所不同。接下來,我們將分別探討讀和寫請求的聚合優化方法。讀請求的聚合以讀操作中,緩存優化是一種常見的優化手段。具體做法是將讀取的數據存儲在內存中,並通過一個唯一的 Key 來索引這些數據。當讀請求來到時,如果 ⌘ Read more
Nitro Engine Bicycle?.. Should Go FAST! ⌘ Read more
Skyway 10km: 6.28 miles, 00:08:28 average pace, 00:53:09 duration
went in with no expectations. did not go all out but still put in a good effort. there were a lot of people (8,00 in total) and the majority were walking which is not a big deal but did mean a lot of weaving through trying to find opening. it was a great production and would do it again if i had someone who wanted to run it with me.
#running #race
You can’t catch the kill signal. Should this be syscall.SIGTERM instead of os.Kill, xuu? https://git.sour.is/sour-is/go-paste/src/branch/main/main.go#L21
You are totally right.. i think i was going for SIGTERM and SIGQUIT
獲取請求 IP,nginx 配置方案,gin 框架,2024 版,go 語言
在使用 Gin 框架時,獲取用戶請求的真實 IP 地址涉及到多種情況,尤其在使用代理服務器(如 Nginx)時。本文將詳細介紹如何使用 Gin 自帶方法和其他方式獲取用戶 IP,以及在面對 Nginx 轉發時如何準確獲取客戶端 IP,同時討論與 IP 相關的安全問題及處理方法。第一章:概述——1.1 獲取用戶真實 IP 的重要性獲取用戶的真實 IP 地址是許多應用中必不可少的功能,用於識別 ⌘ Read more
Economic hardship in Dunkley will see votes ‘spray in a myriad of directions’
Redbridge Group Director Simon Welsh says the “personal stuff” is what sticks with him in the aftermath of focus groups in the Dunkley electorate.
“It is the stories of the economic hardship – particularly that northern half of the electorate,” he told Sky News Australia.
“I think that is going to be so volatile.
“I don’t think it necessarily … ⌘ Read more
China wine tariffs expected to be gone by end of March after trade minister meets with Chinese counterpart
The ABC understands that China will lift wine tariffs it had placed on Australian at the end of March, after Trade Minister Don Farrell met with his Chinese counterpart Wang Wentao overnight. ⌘ Read more
Creepy spot you can only visit on Google
There are some places that just don’t belong on a travel itinerary; but that’s not to say you can’t go there. ⌘ Read more
‘I’m not taking the word of any politician’: Andrew Forrest on nuclear energy push
Fortescue Chairman Andrew Forrest has rubbished the Coalition’s push for nuclear energy.
Mr Fortescue told Sky News Australia how he spoke with General Energy about the costs of implementing nuclear energy and the timeframe required.
“If I order one, when do I get one? And they said, ‘mate, look, 15 years’,” he said.
“I’m not going to … ⌘ Read more
Thousands of academic workers at York University go on strike
Some students at Toronto’s York University are worried about falling behind on their school work after a union representing 3,000 academic workers said the university didn’t meet their demand to “address the affordability crisis” and the workers went on strike. Dozens of union members including contract faculty, teaching and graduate assistants, research assistants and part-tim … ⌘ Read more
Who from your club is a SuperCoach lock?
We ask the some of the league’s skippers the biggest question going around. Who from their club is a SuperCoach lock? ⌘ Read more
Here’s how Toronto’s new one-fare program works
GTA commuters will now be reimbursed their single-ride TTC fare when transferring to and from GO Transit as part of the city’s one-fare program. As CBC’s Patrick Swadden reports, the province has committed to funding the new program until March 2026. ⌘ Read more
How to Recover Unsaved Word Documents on Mac with AutoRecovery
While you should get in the habit of frequently saving your documents as you work in them, including in Microsoft Word, things don’t always go as planned. Many modern Mac apps will automatically save progress as you work in them, and Microsoft Word is one of them. Thanks to a feature called AutoRecovery, which saves … [Read More](https://osxdaily.com/2024/02/26/how-to-recover-unsaved-word-documents-on-mac-wit … ⌘ Read more
Iranians urged to vote in first elections since wave of protests
Voters in Iran are being urged to go to the polls as the country gears up for its first elections since Iran was rocked by nationwide protests over the death of Iranian Kurd Mahsa Amini, 22, after her arrest for allegedly violating the strict dress code for women. Surveys showed most voters don’t intend to take part in the poll. ⌘ Read more
Concept of gender pay gap is a ‘load of nonsense’: Caleb Bond
Sky News host Caleb Bond says the concept of gender pay gap is a “load of nonsense”.
Mr Bond said it “denies the biological reality” of women going off to have children.
“Which necessarily affects their lifetime earnings, because they tend to take more time out.
“Women tend to work in what you might call caring positions.
“Like nursing or teaching, that tend to be paid less … ⌘ Read more
Albanese wants to ‘hold on’ to younger voters: PM spotted going to Taylor Swift concert
The Australian’s National Editor Dennis Shanahan says Prime Minister Anthony Albanese wants to “hold on” to younger voters after he was spotted going to a Taylor Swift concert.
Mr Shanahan joined Sky News host Peta Credlin to discuss Mr Albanese’s reputation after attending the concert.
“Well the Prime Minister is constantly … ⌘ Read more
Klopp MASTERCLASS & Chelsea Fan *RANT*
Football Today Podcast - Episode 20, Monday February 26 - Klopp MASTERCLASS & Chelsea Fan RANT.
The Football Today Podcast debates their signature Yeah/Nah’s on if VAR is ruining the game and segments of performance, bellend, save and goal of the week in the EPL over the weekend.
The panel go through EPL Matchweek 26 match with the game of the weekend Arsenal vs Newcastle, Villa dominating and Fulham creating histor … ⌘ Read more
淺聊 Go 分佈式鏈路追蹤
在現代複雜的分佈式系統環境中,對應用或系統進行性能診斷,這是一個極具挑戰性的任務。有時候,微服務的問題可能會影響到整個系統的鏈路,引發一系列難以追蹤的問題。對於使用 Go 語言的開發者來說,我們有幸的是,對於鏈路追蹤,我們有強大的工具——Go 的鏈路追蹤。什麼是鏈路追蹤?——–鏈路追蹤是一種性能優化策略,通過跟蹤和管理請求在應用環境中的路徑,我們可以更好地理解系統的行爲、性能瓶頸等問題。 ⌘ Read more
Status 2024-02-25
Status report again!
Sitting in front of the wood stove in my country cottage. It’s nice
and quiet. Meanwhile it seems NordicFuzzCon is going on in Malmö.
4,000 furries. I had no idea! That seems fun!
On the other hand I just read that at least 10,000 were protesting in
Malmö today against the Israel-Palestine conflict. I’ve seen the much
smaller protest … ⌘ Read more
The way things are going, we’re never going to make it to Alpha Centauri.
Farmers still toiling to fix infrastructure months after Cyclone Jasper flooded the Far North
Daintree farmers have been working for two months to fix infrastructure damaged by Tropical Cyclone Jasper floods, but say there are many more months to go before they will get on top of the repairs. ⌘ Read more
Experimenting with going out at night and doing nothing much is a tentative success so far.
Golang 數據結構性能優化實踐
僅僅通過對 struct 字段重新排序,優化內存對齊方式,就可以獲得明顯的內存和執行效率提升。原文: How to Speed Up Your Struct in Golang[1]如果你有 Golang 開發經驗,一定定義過 struct 類型。但可能你不知道,通過簡單的重新排序 struct 字段,可以極大提高 Go 程序的速度和內存使用效率!是不是難以置信?我們一起來看一下吧!簡單 De ⌘ Read more