Disable Go language telemetry

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:

  1. C:\Users<user>\AppData\Roaming\go\telemetry
  2. create a file there named mode (without an extension!)
  3. inside the file, write just one word: off

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.

Posted in Go (en) | Leave a comment

Architecture in programming

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

Posted in Programming (en) | Leave a comment

[Windows] Remove different “types” of folders in Explorer

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.

Posted in Windows 10 (en), Windows 11 (en) | Leave a comment

Prototypes – key to success in programming

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.

Posted in Programming (en) | Leave a comment

Turn Windows 11 into Windows 10 (UI)

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 🙂

Posted in Windows 10 (en), Windows 11 (en) | Leave a comment

Go language. About runes (data type), PostgreSQL and JS

If you are making a Go network application that works with databases and/or javascript, you need to be careful when using the rune data type.

For example, PostgreSQL does not have a data type that matches rune; There are options for storing rune:

  1. store in CHAR(1) – then you will need to convert every time you unload from the database like this: []rune(symbolStr)[0]
  2. store in BYTEA; unload via w…. make([]byte, 4)
  3. or a slightly less obvious variant – store in the database as INT; which is the most relevant.

Plus… Javascript can’t handle runes either. I have to render the output like this: String.fromCharCode(.Icon);

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.

Posted in Go (en) | Leave a comment

VS Code – custom hotkeys for terminal

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:

    • Ctrl+Shift+p
    • Preferences: Open keyboard shortcuts
    • click on icon in the right top corner Open keyboards shortcuts (JSON)
    • add there:

Continue reading

Posted in Visual Studio Code (en) | Leave a comment

Feedback on the CS50 programming course

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.
 

Continue reading

Posted in Programming (en) | Leave a comment

Postgresql – newbie problems

1) Requires password all the time when starting pgAdmin 4 (which is irrelevant for localhost)

Solution:
go to C:\Program Files\PostgreSQL\15\pgAdmin 4\web\
make a copy of the file config.py
call it config_local.py
Change MASTER_PASSWORD_REQUIRED to False

2) By setting the bin folder to PATH, you can call from the terminal
psql
but get error: psql: error: connection to server at “localhost” (::1), port 5432 failed: FATAL: password authentication failed for user “vasya”

Solution:
run from regular user psql -U postgres 

 

Posted in Postgress (en) | Leave a comment

Golang. Sum of consecutive numbers

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
7
5 + 2 = 7
3 + 4 = 7
6 + 1 = 7

Continue reading

Posted in Go (en) | Leave a comment

Go Language. Map Exercise

Based on the list of dungeon raids, find the top player in the guild 🙂 

Example of input:

Continue reading

Posted in Go (en) | Leave a comment

Golang. Exercises for slices

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.

Code:

Continue reading

Posted in Go (en) | Leave a comment

Golang. Selection Sort

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:

Continue reading

Posted in Go (en) | Leave a comment

Golang. Bubble sorting

О… 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:

Continue reading

Posted in Go (en) | Leave a comment

Golang. Fisher-Yates algorithm

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.”

Continue reading

Posted in Go (en) | Leave a comment

Golang. Console calculator

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 inc, acc, sub, mul, div, 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.

Example output:
add 42 13
Operands: 42 13
inc 0 1
[43 13]
mod 1 3
[43 1]
exit

Continue reading

Posted in Go (en) | Leave a comment

Golang. Interfaces

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:

Continue reading

Posted in Go (en) | Leave a comment