teleren/devto huggingface dataset:
Install a VM Instance on GCP
Tags: gcp, vm, ssh
Published: 2024-01-21 20:24:19

Having learned my lesson, I'm going through video 1.4.1 of https://github.com/DataTalksClub/data-engineering-zoomcamp in a more orderly way. First, I watched the whole video, "Setting up the Environment on Google Cloud". Now I'm going through it at half speed, taking notes. When I get to a good stopping point, I go through my notes and implement the instructions. Google cloud scares me. I can never find anything on it, so this is necessary.

To start, I go to console.cloud.google.com and make sure my project is selected in the upper left. How to set this up, I can't tell you. I set up my project two years ago. First time users can get a $300 credit. Otherwise you're going to pay. Just make sure you have a project set up, and make sure you're in it.

In the left menu, choose "Compute Engine->VM Instances". You have to click on "Enable the API".

First you have to generate an ssh key to use to log in to the instance. Go to https://cloud.google.com/compute/docs/connect/create-ssh-keys. There's a line of code there that you enter in the terminal window on your computer. Open a terminal window and type:

`ssh-keygen -t rsa -f ~/.ssh/KEY_FILENAME -C USER -b 2048`

(You should have a dot ssh directory in your home directory - create one first if you don't.)

Substitute something like gcp for KEY_FILENAME and your name for USER. Enter nothing for the passphrase. ssh-keygen will create two keys. In my case, gcp and gcp.pub. gcp is the secret secret private key that you keep on your computer. gcp.pub will now go into the settings. Type "cat gcp.pub" and copy the key. **Not gcp which is your private key.** Back to Google Cloud in the browser, navigate to settings->metadata. Choose to add an ssh key, not a metadata. Paste it into the ssh key box and hit SAVE.

Next, still in the browser, go to VM Instances. Choose: CREATE INSTANCE. You'll have to set some configuration variables. First, name the instance, and select a region. I used de-zoomcamp and US-east4.

Next, choose an instance. I chose e2-standard-4 with 4vCPU and 16GB memory. This is what the instructor used, and I'm sticking with his recommendation.

Finally, change the Boot disk. He chose Ubuntu 20.04LTS, and changed the size from 10G to 30G. I did the same for consistency. Then I hit SELECT and at the bottom, CREATE.

Once it's created, you'll see a row of data. Find External IP and copy it. Now you'll try to connect.

Back to your computer. In the terminal window, go to your home directory. Type: `$ssh -i ~/.ssh/gcp name@External IP.`

Here, you use your private key. You should connect right away. If you type `$ls`, you'll see there is nothing. We will have to provision the instance. One good thing is that we have the google cloud sdk. You can type `$gcloud --version` to see it. In my next post I'll write about adding everything we need to the Instance, so we can work from there rather than from our computers.
Avoid Over-Propping with Accessible Components in React
Tags: react, frontend, cleancode, webdev
Published: 2024-01-21 20:14:43

One of React's basics are **props**. They are used to pass data from a parent component to its child components. While they are a great way to handle flow of data, sometimes we tend to overuse them, leading to increasing code complexity and reduced readability. It may make the component harder to maintain, understand and reuse.

In this short article I'd like to propose one way to handle this problem, taking advantage of the **ARIA Attributes**.

---

## ❌ The problem

Sometimes we need to pass some props to our components for styling purposes. In this example, we need to create a **Radio Button**, which changes its border color depending of whether it's checked or not (in this case we're using styled-components).

```tsx
type ComponentProps = {
  $checked: boolean
}

const Component = styled.input<ComponentProps>`
  // Some styles...

  ${({ $checked }) =>
    $checked
      ? css`
          border-color: 1px solid blue;
        `
      : css`
          border-color: 1px solid grey;
        `
  }
`

// Some code

return 
  <>
    <Component
      $checked={!!value}
      checked={!!value}
      id="component"
      type="radio"
    />
    <label for="component">Radio input</label>
  </>
```

Since we already have the `checked` prop (html input has it natively), we'd have to **create another prop** if we wanted to apply some styles depending on it: `$checked`. We also need to type our component so Typescript knows that it has this new prop.

This technique adds a lot of unnecessary code and, moreover, it isn't accessible at all. Let's fix that.


## ✅ The solution

There are certain situations where we can avoid creating these props by ourselves. Instead, we can accomplish the same behaviour with **ARIA Attributes**.

```tsx
const Component = styled.input`
  // Some styles...
  border-color: 1px solid grey;

  &[aria-checked='true'] {
    border-color: 1px solid blue;
  }
`

// Some code

return 
  <>
    <Component
      aria-checked={!!value}
      checked={!!value}
      id="component"
      type="radio"
    />
    <label for="component">Radio input</label>
  </>
```

Notice that we're using the `aria-checked` attribute here. Not only we're **avoiding creating unnecessary props**, but also **our application is much more accessible**, keeping also the behaviour **as close to native as possible**.

Another examples where this approach might be useful:

- `aria-expanded` for a dropdown component.
- `aria-disabled` when we want to disable operations over a certain element.
- `aria-selected` for an element selected in a tablist.
- etc.


---

Take into account that, as said before, this only applies for certain situations. Some ARIA Attributes might not provide the intented utility. You must be careful and responsible, taking accessibility seriously. Use this approach wisely.

The main point of this article is to state that, most of the times, is better to remain as close to native as possible, rather than creating unnecessary code.

I hope you liked it!
Introduction to DevOps: A Beginner's Guide
Tags: devops, aws, cloud, cloudcomputing
Published: 2024-01-21 20:13:09

**Introduction**
Begin with a warm introduction to the readers. Briefly explain what DevOps is, emphasizing its importance in the modern software development lifecycle.

**What is DevOps?**
DevOps is a blend of 'Development' and 'Operations.' It’s a culture that promotes collaboration between Development and IT Operations teams to deploy code to production faster in an automated and repeatable way. The goal of DevOps is to shorten the development cycle, increase deployment frequency, and achieve more dependable releases, in close alignment with business objectives.

![DevOps Concepts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2011ip30aljdzaabaajz.png)
Image Represents various DevOps Concepts

**Why DevOps?**
In a fast-paced technological world, traditional software development methods can't keep up. That's where DevOps comes in. It brings benefits like:

- Faster Deployment: Get your product to the market quicker.
- Reduced Failure Rate: Lessened the number of deployment failures with frequent code releases.
- Improved Collaboration: Breaks down silos between teams, leading to improved innovation and productivity.

**Core Principles of DevOps**
DevOps revolves around key principles:

1. Automation: Automate everything, from code development to deployment.
2. Continuous Integration & Continuous Deployment (CI/CD): This involves regularly integrating code into a shared repository and automating the deployment process.
3. Monitoring and Feedback: Continuously monitor performance and seek feedback to improve future processes.

**Essential DevOps Tools**
Some tools integral to DevOps practices are:

**Jenkins** For automating builds and deployments.
**Docker** For containerizing applications.
**Kubernetes** For orchestrating containers.
**Ansible** For configuration management.

**Getting Started with DevOps**
Embarking on your DevOps journey? Here’s how to start:

1. Learn Version Control: Understanding Git is crucial.
2. Understand Basic Scripting: Pick up languages like Bash or Python.
3. Explore Automation Tools: Experiment with tools like Jenkins or Ansible.
4. Participate in Communities: Join forums, attend meetups, and engage with fellow DevOps enthusiasts.

**Challenges in DevOps**
Transitioning to DevOps isn't always smooth. Be prepared for challenges like cultural resistance and skill gaps. Stay patient and committed to continuous learning.

**Conclusion**
DevOps is an exciting and ever-evolving field. It requires patience, willingness to learn, and adaptability. Keep exploring, and stay tuned for more posts where we'll dive deeper into DevOps topics


![DevOps Visual Representation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xv0llrisrhnz7eejnqgl.png)
The image shows us a flowchart for Continuous Integration and Continuous Deployment (CI/CD), a Jenkins dashboard, containerization with Docker, Kubernetes symbol for container orchestration, a person learning Git, and a team collaborating in a DevOps environment.
Excel Your Career Move: 15 Must-Have AI Tools for a Successful Job Transition
Tags: career, careerdevelopment, ai, opensource
Published: 2024-01-21 20:06:05


In the rapidly evolving landscape of 2024, job searching has become more dynamic and technology-driven than ever before. To help you stay ahead of the curve, I've compiled a list of cutting-edge tools and platforms designed to streamline every aspect of your job search journey. From career exploration to interview preparation and personal branding, these resources are your secret weapons for success.

**1️⃣ Career Exploration:**
Embark on a journey of self-discovery and explore potential career paths with these intelligent career exploration tools:
- [Intelligent Career](https://www.intelligentcareer.com)
- [Prodigy](https://www.prodigy.com)
- [CareerPro](https://www.careerpro.com)
- [Kickresumer](https://www.kickresumer.com)

**2️⃣ Resume and Cover Letter Optimization:**
Crafting a standout resume and cover letter is crucial. Elevate your application with these innovative tools:
- [Jobwizard](https://www.jobwizard.com)
- [resumAI](https://www.resumAI.com)
- [Rezi](https://www.rezi.io)
- [resume worded](https://www.resumeworded.com)
- [skillroads](https://www.skillroads.com)

**3️⃣ Job Search:**
Navigate the vast sea of job opportunities efficiently using these powerful job search platforms:
- [match that role](https://www.matchthatrole.com)
- [job scan](https://www.jobscan.co)
- [careerflow.ai](https://www.careerflow.ai)
- [sonara](https://www.sonara.com)

**4️⃣ Interview Preparation:**
Boost your confidence and readiness for interviews with these top-notch preparation tools:
- [applyish](https://www.applyish.com)
- [interview igniter](https://www.interviewigniter.com)
- [huru](https://www.huru.com)
- [interviewGPT.ai](https://www.interviewGPT.ai)

**5️⃣ Interview Notes:**
Keep track of important interview details seamlessly with these note-taking solutions:
- [metaview](https://www.metaview.com)
- [chorus](https://www.chorus.com)
- [BrightHire](https://www.brighthire.com)
- [otter.ai](https://www.otter.ai)

**6️⃣ Networking & Personal Branding:**
Forge meaningful connections and build a strong personal brand using these networking tools:
- [Crystal](https://www.crystalknows.com)
- [zopto](https://www.zopto.com)
- [yourfriends.ai](https://www.yourfriends.ai)
- [wonsulting.ai](https://www.wonsulting.ai)

*Conclusion:*
In the ever-evolving landscape of job searching, staying informed and utilizing the latest tools is essential. These platforms are designed to empower you, making the job search process more efficient and effective. Save this post for later, and embark on your job search journey armed with the latest technologies and resources available in 2024. Good luck!
Facing refresh issue in deployment
Published: 2024-01-21 19:57:25

I am facing an issue with deploying a React application on an AWS server. Previously, when I deployed it on other servers, there were no problems with the deployment process. However, now, after deploying it on AWS, I am encountering a 404 error when I refresh the page. On other servers, I was able to resolve similar issues by adding a configuration file called ".htaccess". How can I solve this problem on AWS? Any leads...
Odoo : search multiple fields
Published: 2024-01-21 19:51:12

In the realm of Odoo development, tailoring search functionality to meet specific needs is crucial for seamless user interactions. While the operator attribute offers basic filtering capabilities, **filter_domain** emerges as a powerful tool to construct more versatile and adaptive search experiences. Let's dive into its essence and explore practical code examples to harness its potential effectively.

### Understanding filter_domain

**Definition**: A Python expression that evaluates to a domain, allowing you to create custom search filters based on field values.

**Flexibility**: Surpasses operator in terms of adaptability, enabling searches across multiple fields, applying intricate conditions, and incorporating context variables.
Structure: Evaluates to a list of tuples, where each tuple represents a search condition in the format (field name, operator, value).

**How it Works:**

- User Input: The user enters a search term in a designated field.
- Expression Evaluation: Odoo executes the Python expression specified within filter_domain.
- Domain Generation: The expression dynamically constructs a domain based on the user's input.
- Record Filtering: Odoo applies the generated domain to filter records, displaying only those that satisfy the criteria.

Searching Multiple Fields:
`filter_domain="[('name', 'ilike', self), ('email', 'ilike', self)]"
`
Filtering Based on a Condition:
`filter_domain="[('state', '=', 'done')]"`

Combining Multiple Domains:
`filter_domain="[('name', 'ilike', self)] + [('state', '=', 'done')]"`

Leveraging Context Variables:
`filter_domain="[('partner_id', '=', self.env.user.partner_id.id)]"
`
Filtering Related Fields:
`filter_domain="[('partner_id.name', 'ilike', self)]"`
What is Apache arrow and when to use it?
Tags: database, datascience, programming, python
Published: 2024-01-21 19:32:47

## What is Apache arrow(Bookish definition)? 🤔
Apache Arrow defines a language-independent columnar and in memory format, it also supports modern hardware like CPUs and GPUs. The Arrow memory format also supports zero-copy reads for lightning-fast data access without **serialization** overhead.
## Is it a database? 💾
No, Apache Arrow is not a database. Instead, it's a cross-language development platform for in-memory data. Arrow's primary role is to act as a "universal data language" allowing different systems and programming languages to work with large datasets more efficiently and quickly.
## Then what is Apache arrow...
My use-case for apache arrow arrived, when I wanted to create a data streaming pipeline of a very large dataset with almost zero latency for ML related processing.
- **Why not sql databases(PG, mysql etc..)**: My primary usecase is to have very low streaming latency and the transactional nature and disk-based storage of many SQL databases can introduce significant latency
- **Why not a database plus kafka or redis streams**: While this setup is good for production applications with distributed system scaling. But for developing a data streaming pipeline which will be used by a processing service for data analysis, setting up kafka and configuring it for required throughput becomes a little complex or overkill. Plus I didn't wanted data to be transferred over network between my compute nodes. So eventually I had to setup kafka on each system, thus giving me no advantage of its distributed architecture.
- **Why Apache arrow**: Apache arrow is in-memory storage and lazily loads data when iterated to it, making latency very small, and its table format storage also allows me to use simple filters. Plus it can interact with GPU memory as well for data processing. And it doesn't have any serialisation/de-serialisation overheads, as compared to redis which sores data in-memory as bytes and for my usecase it required serialisation/de-serialisation overheads.

## Conclusion 👋

In conclusion, Apache Arrow emerges as an ideal solution for specific use cases where low-latency and efficient in-memory data processing are paramount. It's particularly well-suited for scenarios, where the goal is to create a high-performance data streaming pipeline for machine learning and data analysis purposes.
Exploring Data Visualization with NumPy
Tags: postgres, apacheage, age
Published: 2024-01-21 19:27:24

Data visualization is a crucial aspect of data analysis and interpretation. It allows us to gain insights from complex datasets by representing them visually. NumPy, a powerful numerical computing library in Python, provides essential tools for creating and manipulating numerical arrays, making it a valuable asset for data visualization. In this article, we'll explore how NumPy can be used for basic data visualization tasks.

**Installing NumPy**
If you don't have NumPy installed, you can install it using the following command:

```
pip install numpy

```
**Creating NumPy Arrays**
NumPy's primary data structure is the array. Let's start by creating a simple array:

```
import numpy as np

data = np.array([1, 2, 3, 4, 5])

```
**Basic Plotting with Matplotlib**
**Matplotlib** is a popular plotting library that works seamlessly with NumPy. Let's create a basic line plot using our **NumPy** array:

```
import matplotlib.pyplot as plt

plt.plot(data)
plt.title('Basic Line Plot')
plt.xlabel('Index')
plt.ylabel('Values')
plt.show()

```
This simple example demonstrates how NumPy arrays can be visualized using Matplotlib. However, more complex visualizations often involve multidimensional arrays.

**2D Arrays and Heatmaps**
Consider a 2D NumPy array:

```
matrix = np.array([[1, 2, 3],
                   [4, 5, 6],
                   [7, 8, 9]])

```
We can use Matplotlib to create a heatmap:

```
plt.imshow(matrix, cmap='viridis', interpolation='nearest')
plt.title('Heatmap of a 2D Array')
plt.colorbar()
plt.show()

```
**Histograms with NumPy**
Histograms are useful for understanding the distribution of data. NumPy provides a convenient function to compute histograms:

```
data = np.random.randn(1000)  # Generating random data
plt.hist(data, bins=20, color='skyblue', edgecolor='black')
plt.title('Histogram of Random Data')
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.show()

```
**Scatter Plots**
Scatter plots are great for visualizing relationships between two variables. Let's create a simple scatter plot using NumPy:

```
x = np.random.rand(100)
y = 2 * x + 1 + 0.1 * np.random.randn(100)  # Adding some random noise

plt.scatter(x, y, color='orange', alpha=0.7)
plt.title('Scatter Plot')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()

```
**Conclusion**
NumPy's seamless integration with Matplotlib makes it a powerful combination for data visualization in Python. From basic line plots to more advanced visualizations like heatmaps and histograms, NumPy provides the foundational arrays necessary for effective data representation. As you delve deeper into the world of data visualization, combining NumPy with other libraries like Matplotlib and Seaborn can unlock even more sophisticated and insightful visualizations.
Using Codeium in VS Code
Tags: codeium, vscode
Published: 2024-01-21 04:08:57

Hi everybody, I've been a happy user of [Codeium](https://marketplace.visualstudio.com/items?itemName=Codeium.codeium) for a little while (I am definitely not affiliated with the developers of Codeium and I have no vested interest in promoting it, I just like it) and wanted to share why I like it.

Codeium is a free AI code assistant. You could think of it like Github Copilot, but free. I know what you might think, "if it's free you are the product", but in this case it's actually freemium. For enterprise usage there are costs, which seem definitely worth it for an enterprise, but for individuals it's free to use. They don't train on your data, either.

I like it primarily because its completions are amazing! It can often write much of a function while you're still coming up with the concept, and even better, the code is quite high-quality, with the caveat that you should _*NEVER*_ trust an AI tool to verify the accuracy or security of code. It's not always the fastest at producing a suggestion, but it's still faster than a human typing.

Codeium's function explanations are not very helpful in my opinion. They're too fine-grained and essentially just tell you what the function is doing step-by-step, which is exactly what I could read the code to figure out. What I'd prefer to have explanations do is provide a broader explanation or summary of the purposes of a function and maybe why it does something in a certain way if it's an unfamiliar coding paradigm.

Have you tried Codeium? A lot of people are anti-AI in development, a lot of people are essentially just using AI to write everything. I feel the latter is absolutely wrong and AI just isn't that trustworthy on accuracy/security. The former is probably fine, it just could be leaving efficiency on the table. Definitely don't use AI for everything, but if you want to, figure out how it can assist you. Let me know your thoughts on Codeium.
Odoo Tips : No labels are showing for the fields in the view
Tags: odoo
Published: 2024-01-21 19:19:02

If your form view XML includes fields but the labels are not displaying, and only the fields are visible, it's likely that you haven't enclosed the fields within a group. Please consider incorporating them as illustrated below.

```
<group>
 <field name="field1"/>
 <field name="field2"/>
</group>
```
problem answer
Published: 2024-01-21 19:13:32

This is a common error that occurs when you use the **connect-mongo** module to store sessions in a **MongoDB** database. It means that you are not providing the correct options to the **MongoStore** class, which is a tool that helps you store sessions in MongoDB.

According to the link you provided, you are using version **4** of the **connect-mongo** module, which requires you to provide one of the following options:

- **mongoUrl**: a string that contains the connection URL to your MongoDB database. For example: `mongoUrl: 'mongodb://localhost:27017/mydb'`.
- **clientPromise**: a promise that resolves to a MongoDB client instance. For example: `clientPromise: MongoClient.connect(mongoUrl, mongoOptions)`.
- **client**: a MongoDB client instance that is already connected to the database. For example: `client: MongoClient`.

You can find more information about these options on the [official documentation](^1^) of the **connect-mongo** module.

To fix this error, you need to choose one of these options and pass it to the **MongoStore** class. For example, if you want to use the **mongoUrl** option, you can do something like this:

```javascript
// Import the connect-mongo module
const MongoStore = require('connect-mongo');

// Use the MongoStore.create method to create a MongoStore instance
app.use(session({
  secret: 'mysecretkey',
  store: MongoStore.create({ mongoUrl: 'mongodb://localhost:27017/mydb' })
}));
```

I hope this helps you solve the problem. 😊.

Source: Conversation with Bing, 1/21/2024
(1) Error: Cannot init client | mongo-connect express-session. https://stackoverflow.com/questions/66388523/error-cannot-init-client-mongo-connect-express-session.
(2) Error: Cannot init client. Please provide correct options. https://stackoverflow.com/questions/73357256/error-cannot-init-client-please-provide-correct-options.
(3) Server tests fail due to improperly initialized mongoose ... - GitHub. https://github.com/Trustroots/trustroots/issues/2583.
(4) You must provide either mongoUrl|clientPromise|client in options. https://www.grepper.com/answers/414568/You+must+provide+either+mongoUrl%7CclientPromise%7Cclient+in+options.
(5) undefined. https://i.stack.imgur.com/AHAqb.png.