CyberSpy

Rantings from a guy with way too much free time

Channel Your Inner Gopher

2017-12-13 programming Rob Baruch
Channeling your Inner Gopher - (Literally) Reflecting upon Channels Many gophers are likely familiar with the communication paradigm, channels. An elegant solution to communicate (uni or bidirectionally) typed information among go-routines. In it’s simplest form, we declare as type-valued channel variable, make it, and then send and receive data through it. Easy enough! package main import ( "fmt" ) func main() { var simpleChan chan int = make(chan int) go func(c chan int) { // send important data to the channel c <- 42 close(c) }(simpleChan) // receive data num := <-simpleChan fmt. Continue reading

Once Upon a Reflection: Looking Deeper into Golang reflection

I often reflect upon my code… One of the coolest features of the Golang programming language is the reflect package. As the package documentation states at the onset of the package: Package reflect implements run-time reflection, allowing a program to manipulate objects with arbitrary types. The typical use is to take a value with static type interface{} and extract its dynamic type information by calling TypeOf, which returns a Type. Continue reading

Wanna learn you some Go? Tutor up over here!

Rob

Go Get Interfaced: Enums in Golang

Golang, Interfaces, and Enums So here’s a nice golang idiom that I ran across years ago that I found generally useful. Golang, unlike languages like c doesn’t natively support enumerations. Instead, constants typically are used when creating a list of enumerations. But, go is a strongly-typed language, so we can do better than simply using constants - we can type our enumeration with the use of a type declaration. type DogState uint By defining a type for our enumeration, we can consistently pass and return typed-values among our functions operating on our enumeration. Continue reading

Gogo

Here we gogo! Years ago, I wrote an interesting article that I thought might be worth re-posting (and revising) here on my blog. For a while I got into programming in golang and in the early going (pun-alert!), there were a lot of idioms that were not well understood by a noob. One of those paradigms was channels, go-routines, and signals used simultaneously. Taken separately, they are more easily understood. But when taken together, there can be some confusion. Continue reading
The soundcloud player can not be loaded with disabled JavaScript.
The following title is embedded here:
https://soundcloud.com/user-338167339/sabreras-etude-11-book-2

Sagreras Book 2, Lesson 11

2017-11-28 music etudes Rob Baruch
Etude Sagreras Lesson 11 Here’s my first cut at recording Sagreras Etude #11. Although the etude feels like it’s easy to play, recording it reveals an altogether unsatisfying experience when played back to the ear. My goal is to show how the exercise evolves over time when practicing it with the intention of not just playing it as a site-reading piece, but rather practicing it with the intention of recording it with more attention beyond mere site-reading. Continue reading
Older posts Newer posts