Value, reference, and move types and semantics

I see a lot of confusion about value types and references types. Although I’m not sure how common this perspective is, here’s how I think of it. First of all, value types have value semantics and reference types have reference semantics. The semantics of a type is the behavior of variables of that type. Let’s say there are two variables, a and b, that have already been created and have the same type....

January 23, 2024

Don't put all your eggs in one account

Online accounts can be lost without warning, but making that loss less painful is easy. Full disclosure, there is one referral link marked with an asterisk (*) below that gives me account credit and gives a discount to anyone who signs up for a paid service with it. How much do you depend on the services of big tech companies like Google, Apple, or Microsoft? If one of your accounts was suddenly stolen or an algorithm decided to lock it, how devastating would that be?...

January 23, 2024

Tech literacy

There’s always room for improvements worth their time to make. Over years of extensively using computers, there are some tricks I’ve found that I don’t see others use as often as I expect. I’m not affiliated with any of the services, products, or companies mentioned here. learn about tech gradually and bravely Everyone becomes overwhelmed or frustrated by technology sometimes. People good with tech tend to: return to difficult challenges to try again after some rest reduce how often they become frustrated by spreading out challenges over time take notes to make it easier to continue where they left off after breaks not be afraid to guess and try things ask others for help If this page gets overwhelming, maybe bookmark it, close it, and read another section later....

January 21, 2024

Why does privacy matter?

Privacy is not about whether you have something to hide. It’s about whether bad people can do bad things to you, because security is impossible without privacy. If others can look over your shoulder any time, they can see all your passwords. If you couldn’t hide the key to your home in a pocket or purse, others could copy the key. If the walls of your home were glass, anyone could see your home defenses, where you keep valuables, when you’re sleeping or away, and how to disarm or unlock any alarm systems, safes, etc....

January 13, 2024

Publishing Go packages

There are many ways you can share Go code and applications. Here are a few. publishing to the Go package index (pkg.go.dev) This allows anyone with Go installed to download your package with go get or go install. go get is for getting code, and go install is for installing executables. More details on those commands are in the Go docs and this Stack Overflow discussion. Here are the official docs on publishing to pkg....

January 12, 2024

Impressive programming languages

Here’s why some languages are impressive to me. The languages are sorted alphabetically. C C is the oldest widely used language, and almost all of today’s widely used languages were heavily influenced by C (at least indirectly). It tends to have the fastest execution speed of all high-level languages and has relatively few features which makes it quick to learn. C is used in spaceships and space exploration rovers, among many other cases....

December 9, 2023

Which language should you learn first?

Don’t spend too much time choosing your first programming language. It can be a difficult choice to make, so here are some notes on what several languages are good for. If you will soon start a course, bootcamp, etc. that might choose a language for you, figure out which one and start learning ahead. It can be good to focus on just one language for a while when you’re learning your first language....

October 27, 2023

Learning Go

Here are various resources that are good to know about while learning the Go programming language. I created a list of commonly used Go packages and other dev tools at Go dev tools. getting started if you’re new to programming, check out Golang Tutorial For Beginners - YouTube A Tour of Go is probably the best way for developers with experience in another language to start learning Go Go Playground is an online Go editor and runner Tutorial: Get started with Go Go by Example Organizing a Go module Go FAQs go....

November 22, 2022

How to control the terminal's cursor

Ever wanted to move the cursor up while printing output in a program? You can. Here’s how with C++, and the same string works with any language in many terminals: cout << "\x1b[A"; That moves the cursor up one line. You can move it up by as many lines as you want; here’s how to move it up by 3 lines: cout << "\x1b[3A"; A variable works there too: int lines = 3; cout << "\x1b[" << lines << "A"; You can also move the cursor down, right, and left....

May 9, 2022

Learning recursion with C++

Every programmer should be comfortable with recursion. Recursion is a type of loop created by making a function call itself. Here’s a recursive function that loops infinitely (until the computer runs out of memory) when called: void print_stars() { cout << "*"; print_stars(); } Just like for loops and while loops, recursion can be used to do something repeatedly. Some problems are easier to solve with one kind of loop than another....

May 2, 2022