It turns out, Go (specifically gopls aka the local language server) collects telemetry, the scoundrel. Gathering some kind of anonymous data on how we code. How to disable it:
- create a file there named
mode (without an extension!)
- inside the file, write just one word:
Although, in terms of Windows telemetry, I gave up a long time ago – got tired of cleaning it up. But if there is some sort of tele-perversion that can simply be turned off once and for all – it must be done. Just so PC won’t slow down in vein.
In programming, as in construction (and everywhere else – from shearing
sheeps to hammering nails), the foundation of everything is architecture. It determines the stability and functionality of the final product. Let’s consider this process through an analogy with building a house, reflecting different levels of developers’ experience: from a shack to a stone house. Continue reading
The worst thing in Windows is the display of media file details in file explorer. Billy’s explorer likes to impose on users the type of folder (music, photos, etc.) they supposedly “need”. Changes in folder type settings are gliching. To remove this heresy abomination once and for all:
REG ADD "HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell" /V FolderType /T REG_SZ /D NotSpecified /F
Thank you for your attention.
If you are developing a complex (solo) project with many components, do not try to fully implement all these components at once. Make stub prototypes. This will save your stamina and prevent you from burning out on the project early.
Also use paper. LOTS OF PAPER. Make tables and diagrams, draw with pens and pencils. This will help you write good code.
It turns out that I forgot to share this thing, which I’ve been using for a long time…
ExplorerPatcher – allows you to rollback some elements of the terrible interface of Windows 11 to the normal classic period of ten or even seven: return the classic “Start”; adjust the taskbar, tray, explorer; remove all the idiotic features and add back useful 🙂
The link above goes to a githab, download from the releases, put it on. Then to run it, RMB click on the taskbar -> “Properties”:
I have been using version
22621.608.51.1 for a long time; it works fine. When upgrading the Windows, nothing flies off. Recently I’ve updated ExplorerPatcher itself (I’ve never done it before); works like a charm 🙂
For example, PostgreSQL does not have a data type that matches rune; There are options for storing rune:
- store in
CHAR(1) – then you will need to convert every time you unload from the database like this:
- store in
BYTEA; unload via w….
- or a slightly less obvious variant – store in the database as
INT; which is the most relevant.
By the way… It’s funny, not all emoji (unicode characters like ) can be stored in rune. Because some of them exceed the size of rune, because they use an extra Unicode selector:
- “🏘️” houses (U+1F3D8 U+FE0F)
- “⛰️” mountain (U+26F0 U+FE0F)
- “🏔️” mountain with snow (U+1F3D4 U+FE0F)
And it’s not just emoji, but just some basic Unicode characters.
So you have to be careful with rune.
I got addicted to VS Code. I’ve fallen in love with this little bastard from Microhard. It’s convenient for Go, nothing to do with it… And for this very Go, you need to constantly loop with the console to run the project via
go run . Doing it every time by hand is, of course, unkosher. So here’s what we do, Mikhalych:
Preferences: Open keyboard shortcuts
- click on icon in the right top corner
Open keyboards shortcuts (JSON)
- add there:
Learning programming from scratch can be a challenging but rewarding experience, and taking CS50 is a great way to get started. CS50 is a popular introductory computer science course offered by Harvard University that covers a wide range of programming concepts and tools. I share my experience of learning programming from virtually scratch in the CS50 course.
1) Requires password all the time when starting
pgAdmin 4 (which is irrelevant for localhost)
C:\Program Files\PostgreSQL\15\pgAdmin 4\web\
make a copy of the file
2) By setting the bin folder to PATH, you can call from the terminal
but get error: psql: error: connection to server at “localhost” (::1), port 5432 failed: FATAL: password authentication failed for user “vasya”
run from regular user
psql -U postgres
The problem is to find in an array of integers a sequence of consecutive numbers whose sum is equal to n.
Our program will read a list of integers (e.g., 5 2 3 4 6 1 4 10 1), followed by one integer n (e.g., 7). Example output:
5 2 3 4 6 1 4 10 1
5 + 2 = 7
3 + 4 = 7
6 + 1 = 7
Based on the list of dungeon raids, find the top player in the guild 🙂
Example of input:
Let’s look at some examples of slice programs in Go.
First one… The user enters two rows of numbers. Our task is to collect them in one slice, removing duplicates. As an exercise, we will not use cards, but ordinary slices.
Selection sort is a simple sorting algorithm that repeatedly selects the minimum item from the unsorted part of the list and swaps it with the first unsorted item.
Example code in Go:
О… how much is in this “Chink”-sound!.. We learned to sort by “bubble” back in school (hello, Mr.Obama!). Why not make a code for this sorting in Go? 😀 Even if it is seldom useful, it’s a good exercise for beginners.
Our program will take a string of integers separated by spaces, convert them to a slice of integers and sort the slice in ascending order… Code:
The user enters any number, letter, word, or whatever he wants, separated by a space. Let’s say he even enters card values (poker hand), such as A 3 J Q 10. Our job is to shuffle these cards.
To do this, it’s cool (and easy) to use the Fisher-Yates Algorithm. This algorithm works by iterating the array starting with the last element, and replacing the current element with a randomly chosen element. The process is repeated until the first element is reached. The result is a randomly shuffled array.
Here is my fiddly code for this “shuffle.”
Let’s write a simple console calculator that performs basic arithmetic operations. First, we give it the numbers with which we want to perform operations using the
add <number> command (we can give several numbers). Then we can use the commands
mod; to do calculations: we enter the index of the number to work with and then the operator arguments.
Show can be used to display the numbers entered earlier;
exit to exit the program.
add 42 13
Operands: 42 13
inc 0 1
mod 1 3
The most cumbersome for newcomers to golang are the interfaces. Here are some examples of code I took apart to “smoke” them, I hope they will help you too. The idea is to look at the code, then close it and from memory try to write from scratch according to this plan:
- write the code through the usual functions
- turn functions into methods
- add an interface
Example number one: