Author Archives: john

Cannot use npm to install packages on windows

If you installed npm on windows and got to this issue

npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system. For
more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ npm install -g @angular/cli
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

One way to resolve this is to open powershell as administrator, then type the following command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Best resources about Software Engineering

The following list was assembled by Irina Stanescu

1/ The Pragmatic Engineer by Gergely Orosz – https://lnkd.in/gQ6NfATy
Covers a variety of topics from in-depth analysis of how various companies do things to general solid advice on career growth and engineering management.

2/ Level Up Software Engineering by Caleb Mellas – https://lnkd.in/gmAhnDHW
Empathetic career development tips for software engineers looking to develop both technical and interpersonal skills.

3/ Software Design: Tidy First? by Kent Beck – https://lnkd.in/gwvWkpE8
Excellent mix of technical and non-technical advice from the author of Extreme Programming and TDD.

4/ Engineer’s Codex – https://lnkd.in/gGcf3Nax
Case studies and practical lessons from Big Tech companies.

5/ ByteByteGo Newsletter by Alex Xu – https://lnkd.in/geMg5AnP
Weekly in-depth systems design newsletter, written by the author of “Systems Design” vol 1 and vol 2.

6/ High Growth Engineer by Jordan Cutler – https://lnkd.in/giieDcyr
Practical actionable advice for ambitious engineers looking to grow in their careers.

7/ Engineering Leadership by Gregor Ojstersek – https://lnkd.in/gPHYeBN6
Engineering/Engineering Leadership topics to help you become a great engineering leader.

8/ SeattleDataGuy’s Newsletter by Benjamin Rogojan – https://lnkd.in/gnFB7J8a
The best data engineering newsletter, insightful even if you don’t work in data.

9/ Hybrid Hacker by Nicola Ballotta – https://lnkd.in/g9fMdk2k
In-depth lessons on engineering management with excellent illustrations.

10/ Wes Kao’s Newsletter – https://lnkd.in/geJNC3PN
Excellent advice on navigating work dynamics and career growth from the co-founder of Maven.

11/ System Design Newsletter by Neo K. – https://lnkd.in/gZyW5kQy
Easy-to-understand explanations of complex architectures.

12/ “The Caring Techie Newsletter” – https://lnkd.in/gYBS3EMe
Focuses on soft skills, communication, and building caring leaders .


added by me and why not ?

13/ Chris Richardson’s feed about microservices https://microservices.io/feed.xml

Surprised by Github; their RSA SSH host key has been updated in the last week of March

Trying to push some new code to github, I’ve received the following thing:

PS D:\projects\SimpleBank> git push -u origin main -v
Pushing to github.com:andonescu/tpg-simple-bank.git
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /c/Users/en_ia/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/en_ia/.ssh/known_hosts:1
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

It looks like things have changed: https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/

To overpass this locally, the solution is simple (just to remove the old key):

ssh-keygen -R github.com

Java BackPressure Example generated with ChatGPT

Trying to play with chatGPT I requested to generate a java code that uses backpressure when running high intensive tasks.

This is what I’ve received, and I find it a good start point

import java.util.concurrent.*;

public class BackPressureExample {

private static final int MAX_QUEUE_SIZE = 10;
private static final int MAX_CONCURRENT_TASKS = 4;
private static final int NUM_TASKS = 20;

public static void main(String[] args) {
// Create a bounded blocking queue with a capacity of MAX_QUEUE_SIZE
BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(MAX_QUEUE_SIZE);

// Create a new executor service with a fixed pool of MAX_CONCURRENT_TASKS threads
ExecutorService executor = new ThreadPoolExecutor(MAX_CONCURRENT_TASKS, MAX_CONCURRENT_TASKS,
0L, TimeUnit.MILLISECONDS, queue);

// Submit NUM_TASKS tasks to the executor, with backpressure
for (int i = 0; i < NUM_TASKS; i++) {
try {
// Wait until there is available space in the queue
queue.put(new Task(i));
} catch (InterruptedException e) {
System.err.println("Task submission interrupted: " + e.getMessage());
}
}

// Shutdown the executor and wait for all tasks to complete
executor.shutdown();
try {
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
System.err.println("Tasks interrupted: " + e.getMessage());
}
System.out.println("All tasks completed");
}

private static class Task implements Runnable {
private int id;

public Task(int id) {
this.id = id;
}

public void run() {
System.out.println("Task " + id + " started by thread " + Thread.currentThread().getName());
try {
// Perform some work
Thread.sleep(1000);
} catch (InterruptedException e) {
System.err.println("Task " + id + " interrupted: " + e.getMessage());
}
System.out.println("Task " + id + " completed by thread " + Thread.currentThread().getName());
}
}
}

Rancher Desktop – Is the docker daemon running?

After I’ve uninstall Docker Desktop and installed Rancher Desktop, I had the following error:

ionut@home % docker ps -a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

The way I’ve resolved this issue was to run the following command. Worked like a charm.

sudo ln -s ~$USER/.rd/docker.sock /var/run/docker.sock