c4se記:さっちゃんですよ☆

.。oO(さっちゃんですよヾ(〃l _ l)ノ゙☆)

.。oO(此のblogは、主に音樂考察Programming に分類されますよ。ヾ(〃l _ l)ノ゙♬♪♡)

音樂は SoundCloud に公開中です。

考察は現在は主に Scrapbox で公表中です。

Programming は GitHub で開發中です。

Golang

作ってよかった graceful shutdown ライブラリ

qiita.comの 12/12 (火) です。 去る 12/2 (土) に Go Conference mini 2023 Winter IN KYOTO で「作ってよかったgraceful shutdownライブラリ」と云ふ事を喋りました。 event report は以下。 scrapbox.io ここでは喋った事を紹介します。 speakerdeck.com …

#golang §69 Exercise: Web Crawler

A Tour of Go 69 Exercise: Web Crawler In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel without fetching the same URL twice. Example package main import …

#golang §67,68 Exercise: Equivalent Binary Trees

A Tour of Go chapter 67, 68 Exercise: Equivalent Binary Trees There can be many different binary trees with the same sequence of values stored at the leaves. For example, here are two binary trees storing the sequence 1, 1, 2, 3, 5, 8, 13.…

#golang §59 Exercise: Rot13 Reader

A Tour of Go chapter 59 Exercise: Rot13 Reader A common pattern is an io.Reader that wraps another io.Reader, modifying the stream in some way. For example, the gzip.NewReader function takes an io.Reader (a stream of gzipped data) and retu…

#golang §58 Exercise: Images

A Tour of Go chapter 58 Exercise: Images Remember the picture generator you wrote earlier? Let's write another one, but this time it will return an implementation of image.Image instead of a slice of data. Define your own Image type, imple…

#golang §57 Exercise: HTTP Handlers

A Tour of Go chapter 57 Exercise: HTTP Handlers Implement the following types and define ServeHTTP methods on them. Register them to handle specific paths in your web server. type String string type Struct struct { Greeting string Punct st…

#golang §56 Exercise: Errors

A Tour of Go chapter 56 Exercise: Errors Copy your Sqrt function from the earlier exercises and modify it to return an error value. Sqrt should return a non-nil error value when given a negative number, as it doesn't support complex number…

#golang §46 Advanced Exercise: Complex cube roots

A Tour of Go chapter 46 Advanced Exercise: Complex cube roots Let's explore Go's built-in support for complex numbers via the complex64 and complex128 types. For cube roots, Newton's method amounts to repeating: z = z - (z ** 3 - x) / (z *…

#golang §45 Exercise: Fibonacci closure

A Tour of Go chapter 45 Exercise: Fibonacci closure Let's have some fun with functions. Implement a fibonacci function that returns a function (a closure) that returns successive fibonacci numbers. Example package main import "fmt" // fibo…

#golang §44 Exercise: Slices

A Tour of Go chapter 44 Exercise: Slices Implement Pic. It should return a slice of length dy, each element of which is a slice of dx 8-bit unsigned integers. When you run the program, it will display your picture, interpreting the integer…

#golang §43 Exercise: Maps

A Tour of Go chapter 43 Exercise: Maps Implement WordCount. It should return a map of the counts of each “word” in the string s. The wc.Test function runs a test suite against the provided function and prints success or failure. You might …

#golang §42 Exercise: Loops and Functions

A Tour of Go capter 42 Exercise: Loops and Functions As a simple way to play with functions and loops, implement the square root function using Newton's method. In this case, Newton's method is to approximate Sqrt(x) by picking a starting …