teleren/devto huggingface dataset:
Kubernetes for Scaling Docker containers
Tags: webdev, kubernetes, javascript, programming
Published: 2024-02-14 21:16:36

Scaling Docker containers using Kubernetes involves deploying and managing containerized applications across a cluster of machines. Kubernetes provides a declarative approach to specify how your applications should run and scale. Here's a basic guide to scale up Docker containers using Kubernetes:

1. **Install Kubernetes:**

   First, ensure that you have Kubernetes installed. You can use a managed Kubernetes service like Google Kubernetes Engine (GKE), Amazon EKS, or Azure Kubernetes Service (AKS), or you can set up a local Kubernetes cluster using tools like Minikube.

2. **Create Kubernetes Deployment YAML:**

   Create a YAML file describing your deployment. Below is a simple example for a Node.js application using Docker containers. Save this YAML file as `deployment.yaml`.

   ```yaml
   # deployment.yaml
   apiVersion: apps/v1
   kind: Deployment
   metadata:
     name: myapp-deployment
   spec:
     replicas: 3  # Set the desired number of replicas (scale factor)
     selector:
       matchLabels:
         app: myapp
     template:
       metadata:
         labels:
           app: myapp
       spec:
         containers:
         - name: myapp-container
           image: your-docker-image:latest
           ports:
           - containerPort: 3000
   ```

   Adjust the `image` field to point to your Docker image.

3. **Apply the Deployment:**

   Use the `kubectl apply` command to create or update the deployment based on the YAML file:

   ```bash
   kubectl apply -f deployment.yaml
   ```

4. **Check the Deployment Status:**

   Monitor the deployment status using the following command:

   ```bash
   kubectl get deployments
   ```

   Once the `DESIRED` and `CURRENT` values match, it means your desired number of replicas are running.

5. **Scale Up:**

   To scale up (increase the number of replicas), use the `kubectl scale` command:

   ```bash
   kubectl scale deployment myapp-deployment --replicas=5
   ```

   This command scales the deployment to have 5 replicas. Adjust the number as needed.

6. **Check the Scaling:**

   Verify that the scaling has taken effect:

   ```bash
   kubectl get deployments
   ```

   Ensure that the `AVAILABLE` column shows the desired number of replicas.

Kubernetes will automatically distribute the containers across the cluster, ensuring high availability and load balancing. Scaling down is similar; just adjust the replica count using the `kubectl scale` command.
Docker Desktop
Tags: docker, webdev, javascript, beginners
Published: 2024-02-14 21:07:19

In Windows, you can use Docker Desktop to pull images in a similar way to the `docker pull` command in Linux. Docker Desktop provides a graphical user interface as well as a command-line interface. Here's how you can pull the Ubuntu image using the command-line interface on Windows:

Assuming you have Docker Desktop installed and running, open a command prompt or PowerShell window, and use the following command:

```bash
docker pull ubuntu
```

This command will download the latest Ubuntu image from the Docker Hub registry. If you want a specific version or tag of Ubuntu, you can specify it in the command. For example:

```bash
docker pull ubuntu:20.04
```

This command pulls the Ubuntu 20.04 LTS (Long Term Support) image specifically.

Keep in mind that the syntax for Docker commands is similar across different operating systems, including Linux, macOS, and Windows, but the underlying Docker daemon and container behavior may differ between platforms.
Earlier Docker how to manage?
Tags: devops, docker, webdev, javascript
Published: 2024-02-14 21:02:24

If you're not using Docker, there are alternative ways to manage your software applications and dependencies. Docker is a popular containerization platform, but it's not the only option. Here are some alternatives:

1. **Virtual Machines (VMs):**
   - Use virtualization tools like VMware, VirtualBox, or Hyper-V to create virtual machines. Each VM can host a separate environment with its own operating system and dependencies.

2. **Package Managers:**
   - Utilize package managers specific to your operating system to manage software dependencies. For example, `apt` for Debian-based systems, `yum` for Red Hat-based systems, `brew` for macOS, or `chocolatey` for Windows.

3. **Environment Management:**
   - Tools like `pyenv` (Python), `rvm` (Ruby), `nvm` (Node.js), and `virtualenv` (Python) can help manage different versions of programming languages and their dependencies.

4. **Configuration Management Tools:**
   - Use tools like Ansible, Chef, or Puppet to automate the configuration and management of software on servers.

5. **Manual Management:**
   - Manually install and configure software without containerization. This involves carefully managing dependencies and configurations on each server.

6. **Application Isolation:**
   - Instead of using containers, you can isolate applications using operating system-level features like chroot or jail.

7. **Binary Distribution:**
   - Distribute pre-compiled binaries of your application along with necessary libraries, eliminating the need for complex dependency management.

8. **Version Control:**
   - Leverage version control systems like Git to manage your codebase. Include detailed documentation for setting up and configuring the environment.

9. **Serverless Architecture:**
   - Consider serverless computing platforms where you upload your code, and the platform automatically manages the execution environment.

10. **Vagrant:**
    - Use Vagrant to create and configure reproducible development environments.

Keep in mind that the best approach depends on your specific use case, team expertise, and infrastructure requirements. While Docker has become very popular due to its ease of use and portability, other methods may be more suitable for certain situations.
Angular versionning problem
Tags: angular
Published: 2024-02-14 20:35:05

Hi Folks !

I hope this post finds you well !

Actually, I am about to start learning Angular, and am so much confused about the Angular versions, what version should i learn, I feel i should learn the latest, but a question i keep asking myself, 
what if i fall with a team that use older version, that will create so many conflicts when pushing the working gihub repository, where we all share code to work together !

How can such matter be resolved ?
Thank you in advance !
Greets
Unlock the Power of LangChain: Deploying to Production Made Easy
Tags: webdev, ai, tutorial, python
Published: 2024-02-14 20:33:45


In this tutorial, Austin Vance, CEO and co-founder of Focused Labs, will guide you through deploying a PDF RAG with LangChain to production! 

{% embed https://youtu.be/CbBIwVxjdP8 %}

In this captivating video, we will dive deep into the process of deploying a rag to production, taking you on an informative and engaging step-by-step journey. Throughout this tutorial, we will explore the intricacies of transforming a local rag into a powerful and accessible resource on the digital ocean app platform. Don't miss out on this highly informative and exciting adventure - make sure to subscribe now to stay updated with all the latest content!
Don't forget to subscribe for more tutorials like this.

----
Just to remember what happened so far:

In Part One You will Learned:
- Create a new app using LangChain's LangServe
- ingestion of PDFs using unstructuredio  
- Chunking of documents via LangChain's SemanticChunker
- Embedding chunks using OpenAI's embeddings API
- Storing embedded chunks into a PGVector a vector database
- Build a LCEL Chain for LangServe that uses PGVector as a retriever
- Use the LangServe playground as a way to test our RAG
- Stream output including document sources to a future front end.

In Part 2 we will focus on:
- Creating a front end with Typescript, React, and Tailwind
- Display sources of information along with the LLM output
- Stream to the frontend with Server Sent Events

In Part 3 we will focus on:
- Deploying the Backend application to @DigitalOcean
- Deploying the frontend to @digitalocean_staff App Platform
- Use a managed Postgres Database

In Part 4 we will focus on:
- Adding Memory to the  @LangChain  Chain with PostgreSQL
- Add Multiquery to the chain for better breadth of search
- Add sessions to the Chat History

Github repo
---
https://github.com/focused-labs/pdf_rag
AWS new Public IPv4 Charges: A Guide for Users and Developers
Tags: aws, devops, developers, cloud
Published: 2024-02-14 20:30:14

**Introduction**

Effective February 1st, 2024, Amazon Web Services (AWS) introduced a new charge for public IPv4 addresses. This move has sparked discussions and concerns among users and developers. This article aims to provide a comprehensive overview of the new charges, their implications, and potential solutions for minimizing costs.

**Understanding the AWS IPv4 Charges**

Previously, AWS offered a limited pool of public IPv4 addresses for free. However, due to the scarcity of these addresses, they are now subject to a $0.005 per hour per IP charge. This applies to both in-use and idle addresses attached to various services like EC2 instances, NAT Gateways, and Load Balancers.

**Key Points to Consider**

- **AWS Free Tier**: Existing and new Free Tier users receive 750 hours of free public IPv4 address usage per month for the first 12 months.
- **BYOIP**: Addresses owned by users and brought to AWS using Bring Your Own IP (BYOIP) remain free.
- **Transparency**: AWS Cost and Usage Reports and Cost Explorer now display public IPv4 address usage for better cost management.

**Impact on Users and Developers**

The new charges raise several concerns:

- **Increased Costs**: Users with heavy reliance on public IPv4 addresses may experience significant cost increases on virtual private cloud (VPC).
- **Resource Management**: More attention is needed to optimize resource usage and minimize idle public IPs.
- **Alternative Solutions**: Exploring IPv6 adoption and NAT Gateways for cost-effective alternatives.


With this change, AWS has also released new Public IP Insight dashboard which helps you to monitor, analyse and audit your use of public IPv4 addresses. It will be free of cost.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uza66kmg825cyl1x4452.png)

**Checkout:** [The optimizations and strategies to avoid public IPv4 charges](https://codesolutionshub.com/2024/02/14/aws-public-ipv4-charges-a-guide-for-users-and-developers/)
accessing rows and columns in a 2d array and insert method(python)
Tags: python, programming, learning, tutorial
Published: 2024-02-14 20:22:00


In Python, a 2D array (or matrix) is essentially a list of lists. You can access elements, rows, and columns in a 2D array using indexing.

Here's how you can do it:

**Accessing an element**: To access an element in a 2D array, you use two indices. The first index is for the row and the second index is for the column. For example, `matrix[i][j]` will give you the element at the ith row and jth column.

**Accessing a row**: To access a row in a 2D array, you only need one index. For example, `matrix[i]` will give you the ith row.

**Accessing a column**: Accessing a column is a bit trickier because Python's list of lists structure does not have built-in support for accessing columns. You typically use a loop or a list comprehension to access a column. For example, `[row[j] for row in matrix]` will give you the jth column.

Suppose you want to access all of the items present in one row of a 2-dimensional array or a matrix and change it to some value(let's say 0 to 1), then you can do it this way:

// creating a matrix initializing 0 at all of the indices

```
matrix = [[0]*n for i in range(m)] # n = number of cells in a row or number of columns and m = number of rows

for i in range(n):
    matrix[row_number][i] = 1
```
If you want to access a particular column in the matrix, and change all the values of the column in a matrix to 1, then you can do this:

```
for j in range(m):
    matrix[j][column_number] = 1
```

**_Insert Method in python_**

```
arr.insert(i, n) #Here 'i' is the index and 'n' is any number

```
Note: When we Insert any number 'n' in the array using insert method, then it slides the remaining right side elements of the array to right

for example

```

arr = [1,2,3,4,5]

arr.insert(3, 1)

print(arr) //OUTPUT: [1,2,3,1,4,5]
```

![accessing rows and column in 2d array(python)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dez2hae7ft9j7krhevp4.gif)

If you have any feedback, then you can DM me on [Twitter](https://twitter.com/DhruvTr89566170) or [Linkedin](https://www.linkedin.com/in/dhruv-trivedi-06a767228/).
Playwright tips
Published: 2024-02-14 18:49:51

Lesson 0
Use .env file to store the constants.

Lesson 1
In .env file, `USERNAME` is a default value that cannot be overwritten. Use something else, like test_username.

Lesson 2
install the dotenv package from npm.
`npm i dotenv`

then use it
```
require('dotenv').config();
```

Lesson 3
Project dependency is good to have, for example, log in before each test.
Follow [this article](https://dev.to/playwright/a-better-global-setup-in-playwright-reusing-login-with-project-dependencies-14)

Lesson 4
Use `npx playwright test` in the Terminal runs the tests in headless mode.

Lesson 5
Learn the shortcuts of VS Code is really handy to have. I like the split view, show and hide the side menu, bottom menu etc, and Zen mode a lot.

Lesson 6
Add log after each test for better readability.

```
test.afterEach(async ({ page }, testInfo) => {
  console.log('Done with test -', testInfo.title);
  await page.close();
});
```
Read more from the [documentation](https://playwright.dev/docs/api/class-testinfo)
Web Scraping Using Image Processing
Tags: scraping, screenshot, python, automation
Published: 2024-02-14 20:14:54

My final project for my software engineering bootcamp was a web scraping site that uses image processing to scrape images from a given URL. The idea for this came when I was trying to think about a way to gather a large set of images to use as a machine learning data set. I knew that scrapping would be the way to go for this kind of collection but I was unhappy with how brittle traditional web scrapers were.

The scrapers back end uses Selenium, Pillow and the Chrome Driver to accomplish its task. The first step is Selenium opens up the page using the Chrome Driver in headless mode and injects custom css into the DOM. The custom CSS consists of a colored border around each image as well as a color key in the top left corner of the page. I also have CSS to make sure all images as well as the color key render on top of the page. As a note the color key is necessary because Pillow detects RGB values of pixels differently than how they render on the webpage. Once the CSS is injected Selenium takes a screenshot of the entire page. 

![Website screenshot with CSS injection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/poob937ynxf0u384j1z9.png)

The screenshot is then processed by the Python Pillow library where each pixel is scanned to see if it matches the color key in the top left corner. Once a pixel matches the key an algorithm checks to see if this pixel is the start of an image. If an image is detected the height and width of the image is found and then used to crop the page screenshot into the desired sub image.

The desired images are then zipped up and sent to the front end where a user can rename and download them. The images are all deleted on the back after the scrape is complete.

![Pixel Harvester front end](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/53nlmryl62f8464co6t9.png)

## Advantages
1. The biggest advantage is Pixel Harvester can work on any website that uses image tags regardless of HTML structure or css selectors. 

2. This scraper allows you to scrape the entire webpage without having to travel to each individual image link which lowers the scrapers overall footprint on the website.

3. The images that are scrapped are at the same resolution as how they appear on the website. 


## Challenges
1. The biggest challenge this web scraper faces is the challenge all web scrapers face and that is bot detection. Because many websites do not render in headless mode screenshots for those websites will be blank and there will be no images to capture. This scraper makes no attempt to subvert bot detection in order to obey the terms and service of websites that do not wish to be scraped.

2. With the wide range of how websites are coded some websites that may appear to work at first will fail to produce desired results. For example if a website utilizes the background img attribute to display images instead of using html img tags the scraper will not be able to detect those images and no results will be returned.
How Go Gained Ground in the Programming World
Tags: blog, go, programming
Published: 2024-02-15 08:42:53

---
title: How Go Gained Ground in the Programming World
published: true
date: 2024-02-14 20:12:02 UTC
tags: Blog,Go,golang,Programming
canonical_url: https://deniskisina.dev/how-go-gained-ground-in-the-programming-world/
---

![](https://deniskisina.dev/wp-content/uploads/2024/02/The_Go_Gopher.jpg)

Google’s [Go language](https://go.dev/), or [Golang](https://go.dev/), has achieved a remarkable feat: it has climbed to the eighth spot in the Tiobe index of programming language popularity after being absent from the top 10 for almost six years. The last time [Go](https://go.dev/) was in the top 10 was in July 2017, when it ranked ninth. What explains this resurgence of [Go](https://go.dev/), and what makes it a compelling choice for developers today?

[Go](https://go.dev/) was first announced by Google in November 2009 as a language that aimed to combine the simplicity and readability of Python with the performance and concurrency of C++. It quickly gained attention and popularity, winning the Tiobe Language of the Year award 2009. However, the hype faded, and Go dropped to 122nd in the Tiobe index in 2015.

[The Tiobe index](https://www.tiobe.com/tiobe-index/) measures the popularity of programming languages through a formula that evaluates the number of skilled engineers, courses, and third-party vendors for each language based on searches of Google, Bing, Wikipedia, and other websites.

But [Go](https://go.dev/) did not give up. It adopted a strict release cycle every six months, backed by Google’s support and resources. It also improved its features and syntax, making the language more expressive and powerful. [Go](https://go.dev/) also benefited from the rise of cloud computing and containerization. Go is preferred for building scalable, distributed, and microservice-based applications.

Today, [Go](https://go.dev/) is used in many software domains, such as web development, Cloud & Network Services, Command-line Interfaces (CLIs), and Development Operations & Site Reliability Engineering. It has a large and active community of developers contributing to its open-source ecosystem and libraries. It also has a reputation for being fast, reliable, and easy to learn and use. According to the Tiobe index, Go has a rating of 1.73%, which means it is used by 1.73% of all software engineers worldwide.

Go’s rise in the Tiobe index is a testament to its resilience and relevance in the modern programming world. It shows that [Go](https://go.dev/) has overcome its initial challenges and established itself as a viable and valuable language for many use cases. Go is here to stay, and it might even surpass some of the big four languages (Python, C, C++, and Java) in the near future.
Setting Up for Java on Linux.
Tags: webdev, beginners, programming, discuss
Published: 2024-02-14 20:02:25

Firstly, congratulations for using a great open source software,Linux. 
To get started I will have to explain the two main components you need to have Java up and running on your machine. You will need the Java development kit (JDK) and an IDE. Yes, Just those two (does a backflip celebration).

The JDK includes tools useful for developing and testing programs written in the Java programming language. So to install it.

1. Open your terminal
2. Run the following command


```sudo apt install default-jdk```

3. Fill in your password and voila. You should have the JDK installed

If you are super curious about JDK you can read about it [here](https://en.wikipedia.org/wiki/Java_Development_Kit) and watch this [Video](https://youtu.be/lojcuDzZXBA?si=JqShsIDUADofHAua)

Now that we have installed the JDK you may want to know version you are using run the command `java --version`
This should tell you the version of java on your machine.

Secondly getting an [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment). Well if you have been in the programming scene for a long time you may have come across multiple IDEs, vsCode and code blocks just to list a few. In my works with Vs code it really demanded for me to download alot of extensions just to run Java which i find cumbersome for beginners but If you are a person that likes a challenge then well here is the [link](https://code.visualstudio.com/docs/languages/java) to setting it up. Good luck!!!

My personal favourite IDE for java is Intellej Idea. Apart from not demanding the extra extension, It was designed special for Java and Java related languages so it runs java smoothly with great compilation time. so lets install it. Make sure you have [snap](https://snapcraft.io/) before installing it 

1. Open your terminal again and then run ```sudo snap install intellij-idea-ultimate --classic```

Note: _You will get the classic ultimate version with this one but if you want the free one you have to get the community editon by running _ ```sudo snap install intellij-idea-community --classic --edge```

After installing it give it a try and create a project.
Medical consultancy in patna
Tags: college, education
Published: 2024-02-14 19:57:03

The Tech **[Consultants](https://www.thetechconsultant.co.in/)** is one of the consultants in the field of Higher Education in Medical, Dental, Para-Medical, Nursing, Physiotherapy, Occupational Therapy, Pharmacy, Engineering and Technology,  Management, Infotech, Computer Applications, Hotel Management, Architecture, Law, Education and in setting up of Hospitals and Super Speciality Hospitals, Nursing Homes and Dispensaries.Call Us-8969442819
Lappes Bee Supply
Published: 2024-02-14 19:48:40

Lappe’s Bee Supply and Honey Farms LLC is where to buy honey bees, and you can buy your shipped bee hives & agricultural beekeeping supplies at Lappe's! Lappe's Bee Supply is one of the top beekeeping supply companies in the USA, and we are one of the best suppliers of free shipping bee keeping supplies for sale & queen honey bees for sale in the United States.

[yellow blocks of beeswax for sale](https://www.lappesbeesupply.com/)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1kdsz7dg0sd1vwygy33f.jpg)