teleren/devto huggingface dataset:
Programming books I'm working on
Tags: javascript, programming, books, learning
Published: 2024-02-01 15:00:53

Hello there, I'm a developmental editor at [The Pragmatic Bookshelf](https://pragprog.com/). Some of the books I've been working on lately include:

**_[Charged Bodies](https://pragprog.com/titles/tmbodies/charged-bodies/)_** by Tom Mahon
A reprint of his award-winning 1984 book about the rise of the semi-conductor industry in Silicon Valley with an afterword by the author about where we are now and why this book is relevant today. I really enjoy Tom's story-telling style and the approach. He talks with artists, VCs, engineers, and even environmentalists. The ebook was released Feb 14, 2024. The print book will be available later in 2024.

**_[Mockito Made Clear](https://pragprog.com/titles/mockito/mockito-made-clear/)_** by Ken Kousen
This book is about using Mockito for testing Java apps. It's short, sweet, and to the point. It has been out for a year now, but I wanted to mention it for a few of reasons. One, I really like Ken and his highly entertaining newsletter ([Tales from the Jarside](https://substack.com/@talesfromthejarside)). Two, I want to convince him to do another book with me. Three, _Mockito Made Clear_ is a really good book, but it seems like not many Java devs have heard about it yet.

_[**Text Processing with JavaScript**](https://pragprog.com/titles/fkjavascript/text-processing-with-javascript/)_ and _[**JavaScript Brain Teasers**](https://pragprog.com/titles/fkjsbrain/javascript-brain-teasers/)_, both by Faraz Kelhini. Faraz is on a roll with short, useful JavaScript books. I worked with him in 2021 on _[Modern Asynchronous JavaScript](https://pragprog.com/titles/fkajs/modern-asynchronous-javascript/)_ and he had such a good experience he decided to come back for two more. He's one of the hardest-working developers I know, and he earnestly wants to share his knowledge. Faraz just made a move from Dubai to Hong Kong earlier this year. Talk about culture shock. The Text Processing book was just published this month. The Brain Teasers book is available in beta and will be out soon-ish in print.

_[**Effective Go Recipes**](https://pragprog.com/titles/mtgo/effective-go-recipes/)_ by Miki Tebeka
I started working with Miki on this book in 2021, shortly after we published his three [Brain Teaser](https://pragprog.com/search/?q=tebeka) books. This Go programming book follows a cookbook style with a problem, solution, and discussion. We organized it in (hopefully) logical segments loosely following a  release cycle. During the writing, life happened, things got busy, and the book stalled a couple of times. I always believed in Miki and the book, and we finally got it finished and out in beta late 2023. It should be in print sometime in the first quarter of 2024.

I also handle proposals at The Pragmatic Bookshelf, so if you are an aspiring tech book author with an idea, hit me up.
A Comprehensive Guide to Taints, Tolerations, Logging, and Monitoring
Tags: kubernetes, taints, logging, monitoring
Published: 2024-02-01 14:55:42

Taints (on nodes) and Tolerations (on pods)
Understanding Taints on Nodes
To inspect taints on a specific node, use the following command:


```
kubectl describe node <node-name> | grep -i "taint"

```
Tainting a Node
Create a taint on a node with a specific key, value, and effect:

```
kubectl taint node <node-name> spray=mortein:NoSchedule

```
`spray`: Key of the taint.
`mortein`: Value associated with the key.
`NoSchedule`: Effect that defines the behavior of pods that do not tolerate this taint.

Tolerations on Pods

When deploying pods, use tolerations to allow them to tolerate specific node taints. In the pod specification, add a tolerations section under spec with properties like key, operator, value, and effect:

```
#yaml

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  tolerations:
  - key: "spray"
    operator: "Equal"
    value: "mortein"
    effect: "NoSchedule"
  containers:
  - name: mycontainer
    image: myimage
```
Removing Taints
To remove a specific taint from a node:


```
kubectl taint node <node-name> key=value:effect-

```
For example, to remove all taints with key 'dedicated' from node 'foo':


```
kubectl taint node foo dedicated-

```
Logging
Viewing Container Logs
Check the standard output of a container using the logs command:

```

kubectl logs -f <pod-name> <container-name> # Follow the logs
kubectl logs <pod-name> --previous # Dump pod logs for a 
previous instantiation of a container
```
Monitoring
Resource Usage Metrics
Get resource usage metrics for nodes and pods:


```
kubectl top node
kubectl top pod
```
Identifying CPU-Intensive Pod
To find the pod consuming the most CPU:

```

kubectl top pod --namespace=default | head -2 | tail -1 | cut -d " " -f1
kubectl top pod --sort-by cpu --no-headers
```
Empower your Kubernetes journey with insights into taints, tolerations, efficient logging, and real-time monitoring. 

Happy Kuberneting!
Molina Son Brick Pavers
Published: 2024-02-01 14:50:37

Molina and Son Brick Pavers was founded by Flavio Molina in 2001. Flavio raised his son Leo Molina to become knowledgeable in the Paver/Construction Industry. Leo became a foreman for his paver crew as well as a cutter/installer. He obtained his CDL license, he can operate back hoes, track hoes and tri-axle dump trucks.
[Walkway Pavers Jupiter](https://molinasonbrickpavers.com/services/walkways/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fed6p6j7bu51638oxv8u.png)
MongoDB 學習筆記 - Mac 上 用 Docker 安裝 MongoDB Community
Tags: mongodb, docker, tutorial, macos
Published: 2024-02-01 14:50:13

## 本篇要解決的問題

這陣子因為要幫朋友做一個小網站，在沒有後端的支援下，很多事情得自己來。

講到資料庫，本站比較熟悉的是 [Firebase](https://www.letswrite.tw/category/google/firebase/)，但小網站需要全部架在自己的主機上，無法對外，只能裝在本機，想了一想，跟 Firebase 相近的資料庫，學起來後又對未來有幫助的，就是 MongoDB 了。

MongoDB 這部份會是系列文，主要是看 Net Ninjia [Complete MongoDB Tutorial](https://www.youtube.com/playlist?list=PL4cUxeGkcC9h77dJ-QJlwGlZlTd4ecZOA) 的教學影片後，撰寫的筆記。

因為 Net Ninjia 用的作業系統是 Windows，而 August 用的是 Mac，還是得花時間去看文件、爬文，像是本篇如何在 Mac 上安裝，就幾乎是爬文研究出來的，所以想了一想，還是決定發佈文章。

這個系列文也不知道會走多遠多久，畢竟中間還遇到一個過年，手上在三月前也一堆事，就先走走看看。

---

## Docker 安裝 MongoDB

[官方文件](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-community-with-docker/)

之所以選用 Docker，主要是可以不用理會 MongoDB 是在哪一個 OS 下安裝，避免掉很多麻煩。

本機要先安裝 [Docker](https://www.docker.com/)。

安裝好後，開啟終端機，輸入：

```
docker run --name mongo -p 27017:27017 -d mongodb/mongodb-community-server:latest
```

安裝成功，會看到 Container 被建立，輸入以下指令可以看到：

```
docker container ls
```

如果沒有另行指定，預設 PORT 是 `27017`。

---

## 安裝 MongoDB Compass

MongoDB Compass 是一套官方出的 GUI，可以直接查看 MongoDB 的狀態。

[官方文件](https://www.mongodb.com/docs/compass/current/install/)

選好自己的 OS 後，點擊文件上的下載按鈕，進行安裝即可。

---

## MongoDB Compass 連接到 MongoDB

打開 MongoDB Compass，會看到 URI 預設就是：

```
mongodb://localhost:27017
```

![預設 URI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csh3pxg909pppavik1ob.png)


如果有另行設定 PORT，就要修改。

確認 PORT 後，按下 Connect，就會連結到 MongoDB 了。

---

## 安裝 MongoDB Shell

[官方文件](https://www.mongodb.com/docs/mongodb-shell/install/)

這邊直接使用 Brew 安裝：

```
brew install mongosh
```

安裝成功，終端機輸入 `mongosh`，會看到 DB 訊息。

![安裝 MongoDB Shell 成功](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4a09b3b9oqp89w4v4in1.png)
Unleashing Kubernetes: The Power of Service Accounts
Tags: kubernetes, ckad, serviceaccount, devops
Published: 2024-02-01 14:45:50

In Kubernetes, Service Accounts play a pivotal role in governing permissions and authentication for applications running within pods. Let's dive into key commands and concepts related to Service Accounts.

## Service Account Operations
Create a Service Account
Create a new Service Account:


```
kubectl create sa <sa-name>

```

View Service Accounts
List all Service Accounts in the current namespace:


```
kubectl get sa
```
Describe a Service Account
Get detailed information about a specific Service Account:


```
kubectl describe sa <sa-name>

```
Fetch Token from Service Account
Retrieve the token associated with a Service Account:

```

kubectl describe sa <sa-name>  # provides the associated secret name
kubectl describe secret <secret-name>  # fetches the token stored in the secret
```
Create a Pod with a Service Account
Run a pod using a specific Service Account:

```

kubectl run nginx --image=nginx --serviceaccount=myuser --dry-run=client -o yaml > pod.yaml
kubectl apply -f pod.yaml
```
When a Service Account is used inside a pod, the secret for that Service Account is mounted as a volume inside the pod.

Pod-level Service Account
Specify the Service Account at the pod level:

```

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  serviceAccountName: myuser
  containers:
  - name: mycontainer
    image: myimage
```
User vs. Service Account
A user makes requests to the API server through kubectl using their user account.
A process running inside a container makes requests to the API server using a Service Account.
Both user accounts and Service Accounts have associated permissions.

> Remember: Service Accounts are injected into the pod and can be set at both the pod and deployment levels.

Harness the power of Service Accounts to enhance security and control within your Kubernetes environment. 

Happy Kuberneting!
Sum of the diagonals of a matrice
Tags: javascript, beginners, tutorial, programming
Published: 2024-02-01 14:19:43

*Prepare your favorite cup of coffee* because we are about to enter the fantastic world of **Matrices**.

## What is a matrice?

**A matrice is a data structure that has rows and columns**. Each element will have its location made up of two numbers, the first referring to the row and the second referring to the column.

Let's learn how to calculate the sum of the diagonals of a matrice using JavaScript.

```js
const matrice = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];
```

The main diagonal of the matrice is made up of the elements that are in the same row and column, those where `row = column`

```js
console.log(matrice[0][0]); // 1 (first row, first column)
console.log(matrice[1][1]); // 5 (second row, second column)
console.log(matrice[2][2]); // 9 (third row, third column)
```

To calculate the main diagonal, we will iterate over the elements of the matrice and add those that are in the same row and column.

```js
// Function to calculate the main diagonal
const mainDiagonalSum = (matrice) => {
    // Variable that will store the sum
    var sum = 0;

    // Iterating over all elements of the matrice
    for (var i = 0; i < matrice.length; i++) {
        // Sum of diagonal elements
        sum += matrice[i][i];
    }

    // Returns the final sum
    return sum;
}

console.log(mainDiagonalSum(matrice)); // 15 (1 + 5 + 9)
```

The secondary diagonal of the matrice is formed by the elements where `column = matrice size - 1 - row`

```js
console.log(matrice.length); // 3

console.log(matrice[0][3 - 1 - 0]); // 3 (first row, third column)
console.log(matrice[1][3 - 1 - 1]); // 5 (second row, second column)
console.log(matrice[2][3 - 1 - 2]); // 7 (third row, first column)

// Function to calculate the secondary diagonal
const secondaryDiagonalSum = (matrice) => {
    // Variable that will store the sum
    var sum = 0;

    // Iterating over all elements of the matrice
    for (var i = 0; i < matrice.length; i++) {
        // Sum of the elements of the secondary diagonal
        sum += matrice[i][matrice.length - 1 - i];
    }

    // Returns the final sum
    return sum;
}

console.log(secondaryDiagonalSum(matrice)); // 15 (3 + 5 + 7)
```

*Share the code, spread knowledge and build the future!* 😉
2 Great Newsletter groups for Techies (Newsletters Part 1)
Tags: watercooler
Published: 2024-02-01 14:18:33

These are some great newsletters for tech fans that want to know what’s going on in the tech world and the real world as well!
[Note: The Brew Family newsletters are referral links, so they support me, but they are free signup anyway so nothing is different, and of course my newsletter supports me.]
**1. The Brew Family**
The Brew Family of newsletters are newsletters that can appeal to basically anybody, which is pretty cool. I personally read Morning Brew (their main newsletter), which is daily and has all the news of the previous day but it’s actually entertaining and interesting to read! Sign up (while supporting me) at [this link](morningbrew.com/daily/r/?kid=8d71dcb8). Next, Tech Brew is a tri-weekly (Monday, Wednesday, Friday) newsletter that covers all of the news about tech in general and interesting tech advances around the world. They describe it this way: “Tech Brew informs business leaders about the latest innovations, automation advances, policy shifts, and more to help them make smart decisions.” Sign up now (while supporting me) for free at [this link](emergingtechbrew.com/r/?kid=8d71dcb8). Finally, IT Brew, which I can only describe in their words: “From cybersecurity and big data to software development, IT Brew delivers the latest news and analysis of trends shaping the IT industry, like only The Brew can.“ It covers _SO_ much, and is easily one of my favorite newsletters. I love reading it, and I recommend you do too, so sign up while supporting me at [this link](itbrew.com/r/?kid=8d71dcb8).
**NOTE, ALL OF THESE ARE MY HONEST OPINION, AND I AM NOT GETTING ANYTHING OUT OF THIS EXCEPT FOR A SMALL PACK OF STICKERS :)**

**2. CNN Family**
The CNN family of newsletters is another one of my favorites, even though it’s not quite tech. It gives, in the morning, 5 news stories about the day previous. Business Nightcap highlights what happened in business the day before, as it comes at night. They are literally AMAZING, and I read them every time I get them. They are Brew-tier and some of my favorites. Sign up for those two and other CNN Newsletters at [this link](https://www.cnn.com/newsletters).

Also, for another upcoming newsletter that isn’t out yet, check out MY newsletter that is out soon at thatcomputerguy.beehiiv.com/subscribe and expect an issue in a few weeks.

I am planning to continue this into a series soon enough, but for now, happy reading!
Navigating Open Source Projects with Tublian
Tags: opensource, tublian, emergingdevelopers, softwareengineering
Published: 2024-02-01 14:17:44


**Introduction**

Embarking on a journey into the vast landscape of open source projects can be daunting, especially for newcomers. However, there's a secret weapon that makes this seemingly complex path surprisingly navigable — enter Tublian!

In this blog post I have shared my experience about one of my very first code contributions in the world of open source, with the assistance of Tublian. Wanna know how? Read on!

**Finding My Project: Tublian's Open Source Internship**

![Tublian](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ht54qfadczvw0phset57.jpg)

In the heart of my initiation into the open source realm was Tublian's Open Source Internship, an opportunity that proved to be a game-changer. 

The fourth week of the internship marked a pivotal moment when participants were tasked with their first code contributions. Tublian, with its vibrant developer community on Discord, played a crucial role in guiding me to a project aligned with my tech stack.

[Project repo](https://github.com/synthAI-Labs/WebClient-OpenEdu)

**Beyond Human Assistance: Tublian's AI Copilot**

Ever wished for a personal assistant that could pinpoint issues and guide you through the resolution process? That's Tublian's AI Copilot for you! 

Tasked with enhancing the UI of the profile page of the project, the Copilot provided a detailed brief on the issue, offering a comprehensive overview. This brief not only shed light on the intricacies of the problem but also laid out a step-by-step process, providing a road map for effortlessly overcoming the challenges at hand.

**Confronting Challenges and Crafting Solutions**

No journey is without its hurdles. The initial challenge surfaced when I encountered authentication issues while attempting to sign in as a test user. The project maintainer's gracious support and guidance proved invaluable in overcoming this obstacle.

The second challenge involved the UI enhancement. Collaborating with the maintainer, we discussed the desired UI improvements, and I meticulously built upon the provided suggestions. The result? A successful pull request, and a celebratory "Yay!" moment :D

**Conclusion**

As I conclude this blog, it's essential to understand how Tublian played a pivotal role in facilitating my contribution to the project and how it continues to be an indispensable ally. From fostering an inclusive community of _emerging developers_ to deploying the AI Copilot for seamless guidance, Tublian has undeniably streamlined the open source contribution process.

Throughout this whole journey I learned a lot and up skilled myself about open source, all thanks to Tublian.

Thank you for investing your time in reading this blog. Your thoughts and comments are immensely valued – feel free to share your own experiences and insights!

Follow me on: [LinkedIn](https://www.linkedin.com/in/subham-mani-048731288/), [Github](https://github.com/iSubhamMani), [Twitter](https://twitter.com/manisubham09)
Mastering Kubernetes Components: Namespace, ConfigMap, and Secrets
Tags: kubernetes, namespace, configmap, secret
Published: 2024-02-01 14:09:55

In Kubernetes, effective management of namespaces, ConfigMaps, and Secrets is crucial for maintaining a well-organized and secure environment. Let's explore key commands and concepts related to these components.

## Namespace Operations
View Namespaces
List all namespaces in the current cluster:


```
kubectl get ns
```
Create a Namespace
Create a new namespace, either imperatively or declaratively:

```

kubectl create ns <namespace-name>
kubectl apply -f <namespace.yaml>
```
View Pods in a Namespace
Check pods in a specific namespace:


```
kubectl get po -n kube-system

```
Describe a Namespace
Get detailed information about a specific namespace:


```
kubectl describe ns <namespace-name>

```
Delete a Namespace
To delete a specific namespace:


```
kubectl delete ns <namespace-name>

```
Switch Namespace Permanently
Set the current context to a specific namespace:


```
kubectl config set-context $(kubectl config current-context) --namespace=<namespace-name>

```
View Pods in All Namespaces
List all pods across all namespaces:


```
kubectl get po -A
```
Create a Pod in a Specific Namespace
Run a pod in a designated namespace:


```
kubectl run redis --image=redis -n <namespace-name>

```
Create Namespace Declaratively
Create a namespace from a YAML file:

```

kubectl create ns <namespace-name> --dry-run=client -o yaml > namespace.yaml
kubectl apply -f namespace.yaml
```

## ConfigMap Operations
View ConfigMaps
List all ConfigMaps in the current namespace:


```
kubectl get cm
```
Describe a ConfigMap
Get detailed information about a specific ConfigMap:


```
kubectl describe cm <cm-name>

```
Create a ConfigMap
Create a ConfigMap from files or literals:


```
kubectl create cm <cm-name> --from-file=<path to file>
kubectl create cm <cm-name> --from-literal=<key1>=<value1> --from-literal=<key2>=<value2>
kubectl apply -f cm.yaml
```

## Secret Operations

View Secrets
List all secrets in the current namespace:


```
kubectl get secrets
```
Describe a Secret
Get detailed information about a specific Secret:

```
kubectl describe secret <secret-name>

```
Create a Secret
Create a Secret from files or literals:


```
kubectl create secret generic <secret-name> --from-file=<path to file>
kubectl create secret generic <secret-name> --from-literal=<key1>=<value1> --from-literal=<key2>=<value2>
```
Encoding and Decoding Secrets

Use base64 for encoding and decoding secrets:


```
echo -n 'string' | base64
echo -n 'encoded string' | base64 --decode
```

Ensure proper management of namespaces, ConfigMaps, and Secrets to achieve effective resource isolation, configuration management, and sensitive data protection in your Kubernetes cluster.

Happy Kuberneting!
A Deep Dive into Augmented and Virtual Reality
Published: 2024-02-01 14:05:42

In a world constantly evolving with technological innovations, Augmented Reality (AR) and Virtual Reality (VR) have emerged as transformative technologies, reshaping the way we perceive and interact with the digital and physical worlds. Let's embark on a journey to unravel the wonders of AR and VR and explore the diverse landscapes they create.

**Augmented Reality: Bridging the Gap Between Real and Virtual**

Augmented Reality enhances our real-world experiences by overlaying digital information onto the physical environment. From mobile applications to wearable devices, AR is seamlessly integrating digital content into our daily lives.

**Applications of Augmented Reality:**

1. _Retail and E-Commerce_:

- Visualize products in your home before making a purchase.
- Try on virtual clothes or accessories through AR-enabled mirrors.

2. _Education and Training_:

- Interactive learning experiences through AR-enhanced textbooks.
- Simulated training scenarios for medical professionals, engineers, and more.

3. _Navigation and Wayfinding_:

- AR navigation apps providing real-time directions and information.
- Augmented reality markers guiding users in large spaces like airports or museums.

**Virtual Reality: Immersing Ourselves in Alternate Realities**

Virtual Reality, on the other hand, transports users to entirely new, computer-generated environments, providing a fully immersive experience. VR is not just limited to gaming; it's making waves across various industries.

**Applications of Virtual Reality:**

1. _Gaming and Entertainment_:

- Dive into virtual worlds with immersive gaming experiences.
- VR cinema and storytelling, transforming the way we consume content.

2. _Healthcare and Therapy_:

- Virtual reality simulations for medical training and surgery practice.
- VR therapy for treating phobias, PTSD, and anxiety disorders.

3. _Architecture and Design_:

- Walk through virtual architectural designs before construction.
- Collaborative virtual spaces for design and planning.

**Challenges and Future Horizons:**

While AR and VR promise groundbreaking innovations, they also present challenges. Issues such as motion sickness, hardware limitations, and ethical considerations must be addressed. Looking ahead, advancements in hardware, 5G connectivity, and AI are set to propel AR and VR into new realms of possibility.

In conclusion, Augmented and Virtual Reality are not just technologies; they're gateways to new dimensions of human experience. Whether it's enhancing the way we shop, learn, or play, or immersing ourselves in entirely new worlds, AR and VR are at the forefront of the digital revolution, reshaping the way we perceive and interact with our surroundings. The journey into the immersive realms has just begun, and the possibilities are as boundless as our imagination.