Searching txt.sour.is

Twts matching #typing
Sort by: Newest, Oldest, Most Relevant
In-reply-to » @movq Non-ASCII characters were broken. Like U+2028, degrees (°), etc.

Now WTF!? Suddenly, @falsifian@www.falsifian.org’s feed renders broken in my tt Python implementation. Exactly what I had with my Go rewrite. I haven’t touched the Python stuff in ages, though. Also, tt and tt2 do not share any data at all.

By any chance, did you remove the ; charset=utf-8 from your Content-Type: text/plain header, falsifian?

Image

⤋ Read More
In-reply-to » Hmmmm, I somehow run into an encoding problem where my inserted data end up mangled in the database. But, both SQLite and Go use UTF-8. What's happening here? :-?

@movq@www.uninformativ.de Non-ASCII characters were broken. Like U+2028, degrees (°), etc.

Turns out I used a silly library to detect the encoding and transform to UTF-8 if needed. When there is no Content-Type header, like for local files, it looks at the first 1024 bytes. Since it only saw ASCII in that region, the damn thing assumed the data to be in Windows-1252 (which for web pages kinda makes sense):

// TODO: change default depending on user's locale?
return charmap.Windows1252, "windows-1252", false

https://cs.opensource.google/go/x/net/+/master:html/charset/charset.go;l=102

This default is hardcoded and cannot be changed.

Trying to be smart and adding automatic support for other encodings turned out to be a bad move on my end. At least I can reduce my dependency list again. :-)

I now just reject everything that explicitly specifies something different than text/plain and an optional charset other than utf-8 (ignoring casing). Otherwise I assume it’s in UTF-8 (just like the twtxt file format specification mandates) and hope for the best.

⤋ Read More

There is a bug in yarnd that’s been around for awhile and is still present in the current version I’m running that lets a person hit a constructed URL like

YOUR_POD/external?nick=lovetocode999&uri=https://socialmphl.com/story19510368/doujin

and see a legitimate-looking page on YOUR_POD, with an HTTP code 200 (success). From that fake page you can even follow an external feed. Try it yourself, replacing “YOUR_POD” with the URL of any yarnd pod you know. Try following the feed.

I think URLs like this should return errors. They should not render HTML, nor produce legitimate-looking pages. This mechanism is ripe for DDoS attacks. My pod gets roughly 70,000 hits per day to URLs like this. Many are porn or other types of content I do not want. At this point, if it’s not fixed soon I am going to have to shut down my pod. @prologic@twtxt.net please have a look.

⤋ Read More

PSA: There’s New Character Bug That Can Cause iPhones to Crash
There is a new character bug that can result in a respring on the iPhone or iPad, reports TechCrunch. Typing “”:: in the search field after swiping over to the App Library will cause the Springboard to reset, dropping you back at the ‌iPhone‌’s Lock Screen. A respring is not a full reset, and it only … ⌘ Read more

⤋ Read More

chronod on Mac – High CPU Use & Network Access Requests Explained
Some Mac users occasionally discover the ‘chronod’ process in MacOS is either consuming a large amount of system resources, or is requesting access to network connections. Sometimes chronod is flagged by overly zealous anti-virus apps as well. While there are plenty of people who ignore this kind of thing, another curious type of Mac user … [Read More](https://osxdaily.com/2024/07/25/chronod-on-m … ⌘ Read more

⤋ Read More

So dissatisfied and disappointed with the Fairphone 4’s audio issues where during phone calls, the receiver only gets half of the messages due to noise cancellation problems, that we’re considering iPhone as a valid “it just works” replacement. Especially since the iPhone15 now also has the USB Type C port.

⤋ Read More

Go singlefight 源碼詳解
寫在前面 通俗的來說就是 singleflight 將相同的併發請求合併成一個請求,進而減少對下層服務的壓力,通常用於解決緩存擊穿的問題。詳解基礎結構—-golang.org/x/sync/singleflight singleflight 結構體:type call struct { wg sync.WaitGroup // 這些字段在 WaitGroup 結束前寫入一次 // 只有在 W ⌘ Read more

⤋ Read More

** The story of life **
Or at least the story of life as I implemented it in swift recently as a little learning project because I haven’t written any swift since walking away from mobile dev a few years ago (no regrets)!

First there was the universe! Well, first there was some requisite boilerplate, but then there was the universe! A 2 dimensional grid, an array of 10 columns and 10 rows.

”`hljs swift
import Foundation

let rows: IntRead more”`

⤋ Read More

在 Go 中如何讓結構體不可比較?
最近我在使用 Go 官方出品的結構化日誌包 slog 時,看到 slog.Value 源碼中有一個比較好玩的小 Tips,可以限制兩個結構體之間的相等性比較,本文就來跟大家分享下。在 Go 中結構體可以比較嗎?在 Go 中結構體可以比較嗎?這其實是我曾經面試過的一個問題,我們來做一個實驗:定義如下結構體:type Normal struct { a string B int}使用這個結構體分別聲明 ⌘ Read more

⤋ Read More

Go: 深入探究 uintptr 類型
Go 語言作爲一種靜態類型、編譯型語言,其獨特的類型系統爲編程提供了強大的支持。在衆多類型中,uintptr 是一個較爲特殊的類型,它用於存儲指針值的整數表示。本文將詳細介紹 uintptr 的概念、使用場景及其與普通指針類型的區別。uintptr 的定義與特性在 Go 語言中,uintptr 是一個無符號整數類型,其大小足以存儲任意指針的位模式。具體來說,uintptr 的定義如下:type u ⌘ Read more

⤋ Read More

Apple’s Phone App Finally Supports T9 Dialing in iOS 18
T9 dialing, or Text on 9 keys, is a predictive text technology that emerged in the 90s to make it easier to type text messages on devices with limited input options, such as traditional mobile phones with numeric keypads. Each number key (2-9) on a T9 keypad is mapped to a set of letters. For example, the key “2” corresponds to “ABC,” “3” to “DEF,” and so on.

![](https://images.macrumors.com/article-new/2024/06/t9-dialing-phone-keypad-ios- … ⌘ Read more

⤋ Read More

I just typed something that took me a while to enter, hit post, and lost everything because I was logged out. Can that be disabled? Let me be logged in for as long as I want (or for a very long time), unless I hit logout, or account for the previously entered text, and present it (or run the post action), after having to re-login?

⤋ Read More

Go 中空結構體的用法,我幫你總結全了!
在 Go 語言中,空結構體 struct{} 是一個非常特殊的類型,它不包含任何字段並且不佔用任何內存空間。雖然聽起來似乎沒什麼用,但空結構體在 Go 編程中實際上有着廣泛的應用。本文將詳細探討空結構體的幾種典型用法,並解釋爲何它們在特定場景下非常有用。空結構體不佔用內存空間首先我們來驗證下空結構體是否佔用內存空間:type Empty struct{}var s1 struct{}s2 := E ⌘ Read more

⤋ Read More

全面解析 Go 語言 Channel:面試必備知識點
一、channel 的整體結構圖1、channel 結構圖 channel 本質是一個 hchan 這個結構體 type hchan struct { buf unsafe.Pointer // points to an array of dataqsiz elements sendx uint // send index recvx uint ⌘ Read more

⤋ Read More
In-reply-to » Fire-proof safes are generally designed so the internal temperature stays at or below ~350°F. Is there a computer medium I can write that's likely to survive an extended stay around that temperature? Storage size doesn't matter too much; a CD would be plenty (although an actual CD would presumably turn to soup).

There are apparently dedicated “fireproof” external hard drives available that do this, and this coincidentally-timed piece suggests I might be able to get closer to what I was thinking in the not-too-distant future: https://www.pcgamer.com/hardware/ssds/researchers-have-developed-a-type-of-flash-memory-storage-that-can-withstand-temperatures-higher-than-the-surface-of-venus/

⤋ Read More

Go 線程同步
線程同步—-通常在 Go 語言中有兩種方法可以用來做線程同步sync.Cond channel channel 的很好理解,當我們從一個 channel 中接收數據的時候,如果裏面沒有數據,那我們直接就阻塞在那裏了;在這篇文章中就來看看怎麼使用 sync.Cond 完成同步sync.Cond———「定義結構體和方法」type BlueberryInt struct { ⌘ Read more

⤋ Read More

DSGW-130: A Voice-Control Enabled Touchscreen Control Panel for Smart Homes
DSGW-130: A Voice-Control Enabled Touchscreen Control Panel for Smart Homes
The DSGW-130 Zigbee Touch Screen Control Panel by Dusun is a compact device designed for smart home automation. Measuring 86mm by 86mm, it fits into an 86-type junction box, replacing traditional wall switches. It supports Zigbee 3.0, facilitating the integration and management of Zigbee devices into smart homes. ⌘ Read more

⤋ Read More

Gorm 源碼解析
我們先通過一張圖來看 Gorm 核心主流程。gorm 主流程1. 初始化 DB 連接—————-使用 database.sql 初始化連接。我們平時所說的數據庫驅動其實就是每個數據庫對 DSN 不同的解析方式,最終底層都是使用的 TCP 建立起數據庫連接。type Connector interface { Connect(context.Context) (Conn, err ⌘ Read more

⤋ Read More

PEP 746: Type checking Annotated metadata
This PEP proposes a mechanism for type checking metadata that uses the typing.Annotated type. Metadata objects that implement the new __supports_type__ protocol will be type checked by static type checkers to ensure that the metadata is valid for the given type. ⌘ Read more

⤋ Read More

What do Blue Underlines on Text Mean in Microsoft Edge?
If you use Microsoft Edge as your web browser, whether for free GPT 4 access or and DALL-E use, for cross-platform syncing, or any other reason, you may have noticed that you will often see blue underlined text when you’re typing within the browser. If you’re like me, you’re probably wondering what on earth the … Read MoreRead more

⤋ Read More

What’s a PXM File & How Do You Open It?
File types and file formats can be a bit of a mystery, especially when you stumble into a file that you don’t necessarily recognize. One such case that you may come across is a file that has a .pxm file extension, and if you haven’t heard of a PXM file before you understandably might be … Read MoreRead more

⤋ Read More

Decoding your daily typing habits with GreptimeDB and Streamlit
Member post originally published on Greptime’s blog by Tison Nowadays, typing is a nearly daily occurrence for most people. Interestingly, your typing habits may vary significantly from what you might assume. Below, you’ll find a dashboard that provides… ⌘ Read more

⤋ Read More

深入 Go interface: Duck Typing 和多態
Duck Typing鴨子類型(Duck Typing)是一種編程概念,關鍵在於根據對象的行爲來確定其類型。通常的解釋是通過一個巧妙的例子:根據對象的行爲來判斷它是否是一隻鴨子。如果它游泳像鴨子、嘎嘎叫像鴨子,那麼它就可以被認爲是一隻鴨子。動態語言如 Python 和 JavaScript 自然支持這種特性,但與靜態語言相比,動態語言缺乏重要的類型檢查。Go 語言的接口設計與鴨子類型概念密切相關, ⌘ Read more

⤋ Read More

The Best Way to Clean a MacBook Air Keyboard: Microfiber Cloth & KeyboardCleanTool
Cleaning the keyboard on a MacBook Air is an essential task, but it can be challenging if you’re trying to avoid unintended keypresses. If you don’t want to type out a bunch of nonsense gibberish from cleaning the keyboard, or accidentally activated a mystery keystroke, then consider using a Mac app to lock down the … [Read More](https://osxdaily.com/2024/04/13/best-way-clean-macbook-ke … ⌘ Read more

⤋ Read More

How to Use the Apple Watch Keyboard: Typing on Apple Watch Directly, & with Dictation, or iPhone
The Apple Watch may be small and on your wrist, but believe it or not the Apple Watch also has a keyboard. Yes, even with the small screen, you can use a full size QWERTY keyboard on Apple Watch to type things out, whether it’s a quick response to a message, or an email. In … Read MoreRead more

⤋ Read More

I’m this close to making an Android app for managing a shopping list.

I just accidentally deleted the wrong list in the app that I’m currently using, and now there’s no way to get it back. Recreating it is a major pain, because typing on a phone sucks ass. Fuck.

Maybe I should just go back to using pen and paper …

⤋ Read More

Amy Schumer Reveals Cushing syndrome Diagnosis Following Fan Discourse on Puffier Face | THR News Video
Amy Schumer revealed she has been diagnosed with Cushing syndrome following social media comments about her recent appearance. Schumer revealed the news in journalist Jessica Yellin’s newsletter ‘News Not Noise.’ The actress said, “I feel reborn…There are a few types of Cushing. Some that … ⌘ Read more

⤋ Read More

How to Automatically Fill SMS Passcodes & Security Codes on iPhone, iPad, Mac
Messages for iPhone, Mac, and iPad all contain a really handy feature that autofills security codes that are sent to you via text message. You know the type, as these text message verification codes are often required for signing into financial institutions or many other things that use it as a method of identity and … [Read More](https://osxdaily.com/2024/02/20/how-to-automatic … ⌘ Read more

⤋ Read More

The soundworld of the river in February is pretty different from August. There are so many sloshy water-type sounds right now. I suspect some of it is actually fishes vocalizing. So hard to tell!

⤋ Read More

iOS 17.3.1 Update Released to Fix Overlapping Text Bug on iPhone & iPad
Apple has released iOS 17.3.1 as an update for iPhone, along with iPadOS 17.3.1 for iPad. The small software update includes a bug fix for an issue where text may duplicate or overlap while typing. There do not appear to be any other changes or security fixes in this update. Separately, macOS Sonoma 14.3.1 and … [Read More](https://osxdaily.com/2024/02/08/ios-17-3-1-update-released-to-fix … ⌘ Read more

⤋ Read More

PEP 742: Narrowing types with TypeNarrower
This PEP proposes a new special form, TypeNarrower, to allow annotating functions that can be used to narrow the type of a value, similar to the builtin isinstance(). Unlike the existing typing.TypeGuard special form, TypeNarrower can narrow the type in both the if and else branches of a conditional. ⌘ Read more

⤋ Read More

Status 2024-01-29
Friday is my day off from work, as usual. So when I’m typing this I’m
in front of the hackstation (not a battlestation, obviously) with my
third cup of coffee, writing an update again.

I’ve been doing these status updates on my Gemini log, but I’m
increasingly aware of the dropping amounts of traffic, so I’m thinking
about doing them on the blog instead, but see below for some thoughts
on Gemini.

Abstract

In which I speak about an intense week, feeling good(?), spending … ⌘ Read more

⤋ Read More

Fix Step Count in Health App Updating Slowly on iPhone
If you’re the type of person who likes to keep track of their daily step count by using iPhone as a step counter, it is frustrating when the iPhone Health app step counter does not update as frequently as you’d like. Additionally, there are some challenges that are linked to specific step counts, and many … Read MoreRead more

⤋ Read More

Cost-efficient $39.90 Travel Router with Dual GbE Ports and Flexible Storage Options
Recently, SeeedStudio introduced the LinkStar-H28K-0408, a compact, pocket-sized router that offers advanced connectivity options. This device is equipped with Dual Gigabit Ethernet ports for high-speed internet access and includes a versatile USB Type-C port with Power Delivery support, enhancing its usability and convenience for various applications. Differing from the LinkS … ⌘ Read more

⤋ Read More

Go 運行時的併發原語
這篇文章我們來了解一下隱藏在 Go 運行時中的一些併發原語, 因爲運行時是底座和包循環依賴等原因,運行時中很少使用標準庫中的併發原語,它有自己的併發原語。mutex在 runtime/runtime2.go[1] 定義了一個互斥鎖,它的定義如下:type mutex struct { lockRankStruct key uintptr}它可是運行時中的大紅人了,在很多數據結構中都被廣泛的使用,凡 ⌘ Read more

⤋ Read More

How to Disable Inline Text Predictions on iPhone & iPad
The latest versions of iPhone and iPad system software include a feature that offers predictive typing, with typing suggestions shown inline as light gray words that are ahead of your cursor as you type. For example, if you’re typing “how ar” you might see the inline prediction suggest “how are you” as a way to … Read MoreRead more

⤋ Read More

How to Disable Inline Text Predictions on iPhone & iPad
The latest versions of iPhone and iPad system software include a feature that offers predictive typing, with typing suggestions shown inline as light gray words that are ahead of your cursor as you type. For example, if you’re typing “how ar” you might see the inline prediction suggest “how are you” as a way to … Read MoreRead more

⤋ Read More

How to Disable Inline Predictive Text Typing on Mac
The latest versions of MacOS offer an inline predictive text feature, which attempt to predict what you may want to type text. You’ll see this appear when typing in many Mac apps as there are words appearing in lighter gray in front of what you are presently typing, which you can complete typing of by … Read MoreRead more

⤋ Read More

Why this year’s bumper berry crop is benefitting buyers but not necessarily growers
Several wet years and this month’s cooler, spring-type temperatures have been ideal for raspberries, blackberries, and blueberries, but as prices drop at the supermarket there’s a real fear expenses will overtake profits for growers. ⌘ Read more

⤋ Read More

go-elasticsearch 使用指南
本文是 go-elasticsearch 庫的使用指南。go-elasticsearch 是 Elasticsearch 官方提供的 Go 客戶端。每個 Elasticsearch 版本會有一個對應的 go-elasticsearch 版本。官方會維護最近的兩個主要版本。go-elasticsearch 提供了 Low-level 和 Fully-typed 兩套 API。本文以 Fully-ty ⌘ Read more

⤋ Read More

Go 反射機制揭祕:輕鬆獲取結構體成員類型
*概述Go 語言的反射機制提供了強大的工具,使得在運行時獲取結構體的成員類型成爲可能。本文將介紹如何用反射實現結構體成員類型的獲取,包括結構字段的遍歷、按名稱訪問結構成員、處理匿名字段及內嵌類型,以及解析字段標籤元信息的方法。一、結構字段遍歷值對象及類型對象package mainimport ( “fmt” “reflect”)type User struct { ID int Na ⌘ Read more

⤋ Read More

Go 反射之 reflect-TypeOf– 和 reflect-Type
*概述在 Go 語言中,反射是一項強大的特性,它允許程序在運行時動態獲取變量的類型信息,進行類型操作與轉換,甚至能夠對結構體和函數進行反射操作。本文將探討 reflect.TypeOf() 和 reflect.Type,揭示 Go 語言 中反射的奧祕。一、reflect.TypeOf() 函數返回反射 Type 對象reflect.TypeOf() 函數用於獲取一個變量的反射 Type 對象。它接 ⌘ Read more

⤋ Read More

PEP 737: Unify type name formatting
Add new convenient APIs to format type names the same way in Python and in C. No longer format type names differently depending on how types are implemented. Also, put an end to truncating type names in C. The new C API is compatible with the limited C API. ⌘ Read more

⤋ Read More

How to Edit Messages on WhatsApp
WhatsApp now offers the ability to edit sent messages, a convenient feature for correcting typos, errors, mistakes, or hastily sent messages that you soon regret. If you’re ever in this situation and using WhatsApp, there’s no need to freak out, because you can simply edit the message, correct or modify whatever you typed or sent, … Read MoreRead more

⤋ Read More

The Best Free Clipboard History & Clipboard Manager for Mac is Maccy
Maccy is a really good free clipboard manager for the Mac, the type of software that is so good that you’re grateful it is available for free, in the classic spirit of computing and open source software. It’s fast, unobtrusive, allows for text and images, with a great set of features, and a simple to … Read MoreRead more

⤋ Read More

The Best Free Clipboard History & Clipboard Manager for Mac is Maccy
Maccy is a really good free clipboard manager for the Mac, the type of software that is so good that you’re grateful it is available for free, in the classic spirit of computing and open source software. It’s fast, unobtrusive, allows for text and images, with a great set of features, and a simple to … Read MoreRead more

⤋ Read More

Getting RCE in Chrome with incomplete object initialization in the Maglev compiler
In this post, I’ll exploit CVE-2023-4069, a type confusion in Chrome that allows remote code execution (RCE) in the renderer sandbox of Chrome by a single visit to a malicious site.

The post [Getting RCE in Chrome with incomplete object initialization in the Maglev compiler](https://github.blog/2023-10-17-getting-rce-in-chrome-with-incomplete-object-initialization-in-the- … ⌘ Read more

⤋ Read More

Erlang Solutions: Type-checking Erlang and Elixir
The BEAM community couldn’t be more varied when it comes to opinions about static type systems. For some they’re the most desired feature of other functional languages which we miss. Others shun them and choose our ecosystem exactly because, and not despite the fact that it doesn’t force the perceived overhead of types. Some others still worry whether static types could be successfully applied on the Erlang virtual machine at all.

Over the years, … ⌘ Read more

⤋ Read More

PEP 729: Typing governance process
This PEP proposes a new way to govern the Python type system: a council that is responsible for maintaining and developing the Python type system. The council will maintain a specification and conformance test suite and will initially be appointed by the Python Steering Council. ⌘ Read more

⤋ Read More

Prosodical Thoughts: Prosody 0.12.4 released
We are pleased to announce a new minor release from our stable branch.

We’re relieved to announce this overdue maintenance release containing a
number of bug fixes and also some improvements from the last few months.

Especially the prosodyctl check tool which gained some new diagnostic
checks as well as handling of configuration option types the same way
Prosody itself does.

A summary of changes in this release:

Minor changes
  • core.certmanager: Update Mozilla TLS … ⌘ Read more

⤋ Read More

PEP 727: Documentation Metadata in Typing
This document proposes a way to complement docstrings to add additional documentation to Python symbols using type annotations with Annotated (in class attributes, function and method parameters, return values, and variables). ⌘ Read more

⤋ Read More
In-reply-to » today Its my 40th birtday :)

@prologic@twtxt.net Yeah, I got some cash that I will put aside for a rainy day. I initially wanted to buy a kickbike for the dog with that, but he should not be pulling too much until next year’s fall, so I decided not to buy that now.
I’ll put the money aside for next year.
Other then that I got a new harness for me that I use for the dog, we’ve had one but this one is more solid and fits better to my size. That is super useful - and will last for many many years.
Also got a new hiking jacket, cotton jacket, green, outdoor type jacket, that is also something I really wanted, since I do not like those synthetic jackets (sweat too much in that). Also got some chocolate from my kids (Which I love). So I’m very pleased with the gifts :)

⤋ Read More
In-reply-to » Came across a twitter post claiming that there is a UFO in a building, meaning the ufo crashed, and then the building was built to cover it.

It’s the same type of antenna on both buildings, all though one is a actual building, and the other is just the antenna with a smaller building under the mesh structure.
I often fly flightsims, its my hobby, so I often work with waypoints, so I now just looked up the waypoint to find it’s information, to do that I looked up the closes airport, then looked around until I found the waypoint:
https://opennav.com/navaid/KR/SEL/ANYANG

So would they really place a navaid on a building that contains a UFO? I do not think so.
Would a UFO crash that close to Seoul without a since photo or video? I do not think so either.

⤋ Read More
In-reply-to » Question to all you Gophers out there: How do you deal with custom errors that include more information and different kinds of matching them?

So you would have:

type ErrPermissionNotAllowed []Permission
func (perms ErrPermissionNotAllowed) Is(permission Permission) bool {
    for _, p := range perms {
        if p == permission { return true }
    }
    return false
}
var err error = errPermissionNotAllowed{"is-noob"}

if errors.Is(err, ErrPermissionNotAllowed{}) { ... } // user is not allowed

var e ErrPermissionNotAllowed
if errors.As(err, e) && e.Is("a-noob") { ... } // user is not allowed because they are a noob. 

⤋ Read More
In-reply-to » Question to all you Gophers out there: How do you deal with custom errors that include more information and different kinds of matching them?

So you would have:

type ErrPermissionNotAllowed []Permission
func (perms ErrPermissionNotAllowed) Is(permission Permission) bool {
    for _, p := range perms {
        if p == permission { return true }
    }
    return false
}
var err error = errPermissionNotAllowed{"is-noob"}

if errors.Is(err, ErrPermissionNotAllowed{}) { ... } // user is not allowed

var e ErrPermissionNotAllowed
if errors.As(err, e) && e.Is("a-noob") { ... } // user is not allowed because they are a noob. 

⤋ Read More
In-reply-to » Question to all you Gophers out there: How do you deal with custom errors that include more information and different kinds of matching them?

@lyse@lyse.isobeef.org do you need to have an explicit Is function? I believe errors.Is has reflect lite and can do the type infer for you. The Is is only really needed if you have a dynamic type. Or are matching a set of types as a single error maybe? The only required one would be Unwrap if your error contained some other base type so that Is/As can reach them in the stack.

As is perfect for your array type because it asserts the matching type out the wrap stack and populates the type for evaluating its contents.

⤋ Read More
In-reply-to » Question to all you Gophers out there: How do you deal with custom errors that include more information and different kinds of matching them?

@lyse@lyse.isobeef.org do you need to have an explicit Is function? I believe errors.Is has reflect lite and can do the type infer for you. The Is is only really needed if you have a dynamic type. Or are matching a set of types as a single error maybe? The only required one would be Unwrap if your error contained some other base type so that Is/As can reach them in the stack.

As is perfect for your array type because it asserts the matching type out the wrap stack and populates the type for evaluating its contents.

⤋ Read More

Question to all you Gophers out there: How do you deal with custom errors that include more information and different kinds of matching them?

I started with a simple var ErrPermissionNotAllowed = errors.New("permission not allowed"). In my function I then wrap that using fmt.Errorf("%w: %v", ErrPermissionNotAllowed, failedPermissions). I can match this error using errors.Is(err, ErrPermissionNotAllowed). So far so good.

Now for display purposes I’d also like to access the individual permissions that could not be assigned. Parsing the error message is obviously not an option. So I thought, I create a custom error type, e.g. type PermissionNotAllowedError []Permission and give it some func (e PermissionNotAllowedError) Error() string { return fmt.Sprintf("permission not allowed: %v", e) }. My function would then return this error instead: PermissionNotAllowedError{failedPermissions}

At some layers I don’t care about the exact permissions that failed, but at others I do, at least when accessing them. A custom func (e PermissionNotAllowedError) Is(target err) bool could match both the general ErrPermissionNotAllowed as well as the PermissionNotAllowedError. Same with As(…). For testing purposes the PermissionNotAllowedError would then also try to match the included permissions, so assertions in tests would work nicely. But having two different errors for different matching seems not very elegant at all.

Did you ever encounter this scenario before? How did you address this? Is my thinking flawed?

⤋ Read More

Introduction to SELinux
SELinux is the most popular Linux Security Module used to isolate and protect system components from one another. Learn about different access control systems and Linux security as I introduce the foundations of a popular type system. ⌘ Read more

⤋ Read More

An official FBI document dated January 2021, obtained by the American association “Property of People” through the Freedom of Information Act.

This document summarizes the possibilities for legal access to data from nine instant messaging services: iMessage, Line, Signal, Telegram, Threema, Viber, WeChat, WhatsApp and Wickr. For each software, different judicial methods are explored, such as subpoena, search warrant, active collection of communications metadata (“Pen Register”) or connection data retention law (“18 USC§2703”). Here, in essence, is the information the FBI says it can retrieve:

  • Apple iMessage: basic subscriber data; in the case of an iPhone user, investigators may be able to get their hands on message content if the user uses iCloud to synchronize iMessage messages or to back up data on their phone.

  • Line: account data (image, username, e-mail address, phone number, Line ID, creation date, usage data, etc.); if the user has not activated end-to-end encryption, investigators can retrieve the texts of exchanges over a seven-day period, but not other data (audio, video, images, location).

  • Signal: date and time of account creation and date of last connection.

  • Telegram: IP address and phone number for investigations into confirmed terrorists, otherwise nothing.

  • Threema: cryptographic fingerprint of phone number and e-mail address, push service tokens if used, public key, account creation date, last connection date.

  • Viber: account data and IP address used to create the account; investigators can also access message history (date, time, source, destination).

  • WeChat: basic data such as name, phone number, e-mail and IP address, but only for non-Chinese users.

  • WhatsApp: the targeted person’s basic data, address book and contacts who have the targeted person in their address book; it is possible to collect message metadata in real time (“Pen Register”); message content can be retrieved via iCloud backups.

  • Wickr: Date and time of account creation, types of terminal on which the application is installed, date of last connection, number of messages exchanged, external identifiers associated with the account (e-mail addresses, telephone numbers), avatar image, data linked to adding or deleting.

TL;DR Signal is the messaging system that provides the least information to investigators.

⤋ Read More

An official FBI document dated January 2021, obtained by the American association “Property of People” through the Freedom of Information Act.

This document summarizes the possibilities for legal access to data from nine instant messaging services: iMessage, Line, Signal, Telegram, Threema, Viber, WeChat, WhatsApp and Wickr. For each software, different judicial methods are explored, such as subpoena, search warrant, active collection of communications metadata (“Pen Register”) or connection data retention law (“18 USC§2703”). Here, in essence, is the information the FBI says it can retrieve:

  • Apple iMessage: basic subscriber data; in the case of an iPhone user, investigators may be able to get their hands on message content if the user uses iCloud to synchronize iMessage messages or to back up data on their phone.

  • Line: account data (image, username, e-mail address, phone number, Line ID, creation date, usage data, etc.); if the user has not activated end-to-end encryption, investigators can retrieve the texts of exchanges over a seven-day period, but not other data (audio, video, images, location).

  • Signal: date and time of account creation and date of last connection.

  • Telegram: IP address and phone number for investigations into confirmed terrorists, otherwise nothing.

  • Threema: cryptographic fingerprint of phone number and e-mail address, push service tokens if used, public key, account creation date, last connection date.

  • Viber: account data and IP address used to create the account; investigators can also access message history (date, time, source, destination).

  • WeChat: basic data such as name, phone number, e-mail and IP address, but only for non-Chinese users.

  • WhatsApp: the targeted person’s basic data, address book and contacts who have the targeted person in their address book; it is possible to collect message metadata in real time (“Pen Register”); message content can be retrieved via iCloud backups.

  • Wickr: Date and time of account creation, types of terminal on which the application is installed, date of last connection, number of messages exchanged, external identifiers associated with the account (e-mail addresses, telephone numbers), avatar image, data linked to adding or deleting.

TL;DR Signal is the messaging system that provides the least information to investigators.

⤋ Read More
In-reply-to » I need to add multithreading to the desktop client, I have not done that before in c++ - so that'll be fun to figure out. I need it for the fetching of the timeline so that it happens in a separate thread. That way the GUI does not freeze while fetching the timeline. Also need to add a status bar that can show what the application is working on.

I was able to fix this now, by making a ‘default.nix’ file, and then you can open a shell that has all the stuff needed by simply typing ‘nix-shell’ in the root git directory. Pretty nice, I’m starting to enjoy this OS more and more.

⤋ Read More
In-reply-to » @prologic omg yes! They are both ultra-right-wing assholes! The worst of the worst! Please tell me you don't listen to these guys' brain poison?

Here I am, looking at my bookshelf, where the ‘12 rules for life’ book sits.
I found the way he had to be put in a coma to get off addiction to his medicine etc fascinating. It felt like the good old ‘do as I say, not as I do’ type of thing. But hey - regardless of who you are or how strong you portray yourself - there can always be hard issues to tackle in life.

⤋ Read More

Isode: Red/Black 2.0 – New Capabilities
This major release adds significant new functionality and improvements to Red/Black, a management tool that allows you to monitor and control devices and servers across a network, with a particular focus on HF Radio Systems.  A general summary is given in the white paper Red/Black Overview

Switch Device

Support added for Switch type devices, that can connect multiple devices and allow … ⌘ Read more

⤋ Read More
In-reply-to » slides/go-generics.md at main - slides - Mills -- I'm presenting this tomorrow at work, something I do every Wednesday to teach colleagues about Go concepts, aptly called go mills() 😅

So. Some bits.

i := fIndex(xs, 5.6)

Can also be

i := Index(xs, 5.6)

The compiler can infer the type automatically. Looks like you mention that later.

Also the infer is super smart.. You can define functions that take functions with generic types in the arguments. This can be useful for a generic value mapper for a repository

func Map[U,V any](rows []U, fn func(U) V) []V {
  out := make([]V, len(rows))
  for i := range rows { out = fn(rows[i]) }
  return out
}


rows := []int{1,2,3}
out := Map(rows, func(v int) uint64 { return uint64(v) })

I am pretty sure the type parameters goes the other way with the type name first and constraint second.

func Foo[comparable T](xs T, s T) int

Should be


func Foo[T comparable](xs T, s T) int

⤋ Read More
In-reply-to » slides/go-generics.md at main - slides - Mills -- I'm presenting this tomorrow at work, something I do every Wednesday to teach colleagues about Go concepts, aptly called go mills() 😅

So. Some bits.

i := fIndex(xs, 5.6)

Can also be

i := Index(xs, 5.6)

The compiler can infer the type automatically. Looks like you mention that later.

Also the infer is super smart.. You can define functions that take functions with generic types in the arguments. This can be useful for a generic value mapper for a repository

func Map[U,V any](rows []U, fn func(U) V) []V {
  out := make([]V, len(rows))
  for i := range rows { out = fn(rows[i]) }
  return out
}


rows := []int{1,2,3}
out := Map(rows, func(v int) uint64 { return uint64(v) })

I am pretty sure the type parameters goes the other way with the type name first and constraint second.

func Foo[comparable T](xs T, s T) int

Should be


func Foo[T comparable](xs T, s T) int

⤋ Read More
In-reply-to » I bought a 256GB usb a couple of weeks ago, I now want a OS on it with persistent storage. I only have 1 drive on my newest laptop at the moment, so I do not want to dualboot and such, so a os on the usb stick is a nice option. Tonight I'm testing NomadBSD - https://nomadbsd.org/index.html Will flash it in a couple of minutes, hope it boots fine with my hardware.

decided to boot it again. turns out I typed the wrong encryption password yesterday, and instead of saying that it printed that error. booted fine now :)

⤋ Read More

@prologic@twtxt.net @movq@www.uninformativ.de this is the default behavior of pass on my machine:

Image

I add a new password entry named example and then type pass example. The password I chose, “test”, is displayed in cleartext. This is very bad default behavior. I don’t know about the other clis you both mentioned but I’ll check them out.

The browser plugin browserpass does the same kind of thing, though I have already removed it and I’m not going to reinstall it to make a movie. Next to each credential there’s an icon to copy the username to the clipboard, an icon to copy the password to the clipboard, and then an icon to view details, which shows you everything, including the password, in cleartext. The screencap in the Chrome store is out of date; it doesn’t show the offending link to show all details, which I know is there because I literally installed it today and played with it.

⤋ Read More