teleren/devto huggingface dataset:
Adjust Odoo Error Codes with monkey patching
Tags: python, odoo
Published: 2023-07-29 07:34:12

In API integration scenario, Odoo error codes may not be satisfactory. In Odoo the default error code of json request is `200`. you could handle such case by overriding `_handle_exception` method found in the following path: [https://github.com/odoo/odoo/blob/9d6095da7b2508193ce42cc951ffdd2d3adf5856/odoo/http.py#L649](https://github.com/odoo/odoo/blob/9d6095da7b2508193ce42cc951ffdd2d3adf5856/odoo/http.py#L649)

an example of such code would be as following:

```python
import logging
import werkzeug

import odoo
from odoo.http import AuthenticationError, JsonRequest, serialize_exception, SessionExpiredException

_logger = logging.getLogger(__name__)


def _handle_exception(self, exception):
    """Called within an except block to allow converting exceptions
       to arbitrary responses. Anything returned (except None) will
       be used as response."""
    try:
        return super(JsonRequest, self)._handle_exception(exception)
    except Exception:
        if not isinstance(exception, SessionExpiredException):
            if exception.args and exception.args[0] == "bus.Bus not available in test mode":
                _logger.info(exception)
            elif isinstance(exception, (odoo.exceptions.UserError,
                                        werkzeug.exceptions.NotFound)):
                _logger.warning(exception)
            else:
                _logger.exception("Exception during JSON request handling.")
        error = {
            'code': 400,
            'message': "Odoo Server Error",
            'data': serialize_exception(exception),
        }
        if isinstance(exception, werkzeug.exceptions.NotFound):
            error['http_status'] = 404
            error['code'] = 404
            error['message'] = "404: Not Found"
        if isinstance(exception, AuthenticationError):
            error['code'] = 100
            error['message'] = "Odoo Session Invalid"
        if isinstance(exception, SessionExpiredException):
            error['code'] = 100
            error['message'] = "Odoo Session Expired"
        if isinstance(exception, werkzeug.exceptions.UnprocessableEntity):
            error['code'] = 422
            error['message'] = "422 Unprocessable Entity"
        return self._json_response(error=error)


JsonRequest._handle_exception = _handle_exception

```
you could see in line 40 that you could add a new error code which is in Odoo before. also note line 46 which apply the monkey patching. so you have to make sure that your module is loaded before any module overriding such method by adjusting module dependency.
Integrating ChatGPT in WhatsApp on Android: A Step-by-Step Guide by Ben Mejja
Tags: mlimavirtual, chatgpt, python
Published: 2023-07-29 07:18:43

It functions conversationally, can challenge incorrect premises, answer follow-up questions, reject inappropriate requests, and admit mistakes. It provides detailed responses based on instructions.

To turn your app idea into reality, you need to hire mobile app developers. Look for a trusted android app development company with experienced developers who can help you achieve your goals.

Chat GPT is a new AI chatbot that can answer questions and write essays. It has attracted significant investment from the IT sector.

**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfdrti41052fooaemeuz.jpeg)** 

**Benefits of using a chatbot:**

1. Supports customers 24/7
2. Improves workflow and productivity
3. Scales without adding much overhead
4. Generates and qualifies leads automatically
5. Solves problems faster and more innovatively
6. Enhances customer experience
7. Balances automation with a human touch
8. Increases conversion rates
9. Uses ready-to-use templates to assist customers.

**You can customize Chatbot to fit your business needs, and it can help increase online ordering while reducing serving costs.

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

To integrate ChatGPT with WhatsApp on Android, follow these steps:
**
1. Sign up for WhatsApp Business API beta service and provide necessary information about your business.
2. Design a chat flow to handle open and directed conversations.
3. Use a database host and a chatbot builder, like Chat Compose, to create your personalized WhatsApp chatbot with dialogue flows and response templates.
4. Test your WhatsApp Chatbot and analyze customer feedback to improve its performance.
5. Once approved, install the API chatbot on your WhatsApp number, providing a name, icon, contact information, and connecting it with the chat builder.

**By following these steps and working with an android app development company, you can create an interactive user experience with ChatGPT in WhatsApp on Android.**
Run Docker from WSL
Tags: docker, wsl
Published: 2023-07-29 07:12:50

**Introduction**

This article is a complete guide on how to setup WSL on windows and run docker, Kafka, Kubernetes commands directly from GitBash console without having to open WSL.

Additionally I have added the setup to use Java Test Containers.

The whole purpose is for anyone who wants to migrate to a new distribution or to change machines, or has to fix a broken WSL, in just a few steps the environment is prepared rapidly without the need to investigate the internet on each particular problem.

**Preparing WSL with docker**

First part is preparing windows to use docker from WSL without Docker Desktop.

**Adding Java Test Containers**

I observed that I can also automate the part to add Java Test Containers so this is the second part. So that anytime WSL gets broken or I want to switch to a new linux distribution or to change laptops, I can allway run the same commands and expect it works. 

**Setting up Kubernetes**

Third part is how I setup Kubernetes through WSL.

**Kafka setup**

I will add setting up Kafka soon. Currently I am looking to change the whole approach to using just Kubernetes.

**Note:** I have removed scripts to enable docker on Powershell and CMD as I have never used them and find them redundant.

[On Github](https://github.com/hackus/wsl-scripts/tree/master) 

TBC
Publish a message from an SNS in one AWS account to an SQS in a different AWS account
Published: 2023-07-29 07:02:38

Suppose you have AWS SNS in Account A and you want to publish a message to AWS SQS in Account B. Here's how you can do it.

Account A : 
- Create a new standard SNS topic and add the following policy to allow an SQS from another account to subscribe

```
{
   "Effect":"Allow",
   "Principal":{
      "AWS":"<ID_OF_ACCOUNT_B>"
   },
   "Action":"sns:Subscribe",
   "Resource":"arn:aws:sns:<REGION>:<ID_OF_ACCOUNT_A>:<TOPIC_NAME>"
}
```


Account B :
1. Create a new IAM user with permission to read message to SQS. Also create access key for IAM user. access key will be used by consumer for reading message from SQS.
2. Create a new KMS and allow IAM user to encrypt and decrypt message by choosing IAM user from 1.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rps3iv89v0ze9j5f8ekk.png)
3. Add the following policy to KMS from 2. to allow SNS from account A to be able to send encrypt message to SQS 
```
        {
            "Sid": "Allow use of the key from another account",
            "Effect": "Allow",
            "Principal": {
                "Service": "sns.amazonaws.com",
                "AWS": "arn:aws:iam::{ACCOUNT_OF_SNS}:root"
            },
            "Action": "kms:*",
            "Resource": "*"
        }
```
4. Create a new SQS with SSE KMS


References : 
- https://www.youtube.com/watch?v=Von_VgswnJU
Code Talk: Which Languages Speak to Your Developer Soul?
Tags: codenewbie, beginners, discuss, career
Published: 2023-07-29 07:00:00

_Welcome to "Discover Your Code," guided by our official DEV moderator, Sloan the Sloth 🦥. This series is designed to help aspiring coders and students explore the coding universe, ignite their passion, and find their ideal career paths._

Today's question is: 

> From a plethora of languages, which ones resonate with your coding style and interests?

Responses from newbies and experienced devs alike are encouraged in order to broaden our horizons and showcase different POVs.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
How Is C# Evolving to Adapt to Modern Dev Trends?
Tags: discuss, csharp
Published: 2023-07-29 07:00:00

As a .NET developer, how do you see C# evolving to accommodate modern development trends and challenges?

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
How to Write Maintainable JavaScript Code?
Tags: javascript, codenewbie, adventofcode
Published: 2023-07-29 06:59:27


![How to Write Maintainable JavaScript Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgdtccntddpqasjgybx0.jpg)
## Introduction
JavaScript is a powerful language that can be used to create dynamic and interactive web pages. However, it can also be difficult to write maintainable JavaScript code.

This is because JavaScript is a dynamically typed language, which means that the types of variables and expressions are not checked at compile time. This can lead to errors and bugs that can be difficult to track down.

In this article, we will discuss some tips on how to write maintainable JavaScript code. We will cover topics such as:

1. Using meaningful variable names
2. Writing clear and concise code
3. Using comments
4. Avoiding code duplication
5. Using functions
6. Using modules
7. Testing your code

Let’s get on with it.

## Use meaningful variable names:
One of the most important things you can do to write maintainable JavaScript code is to use meaningful variable names. This means using names that accurately reflect the purpose of the variable.

For example, instead of using a variable named x, you could use a name like productQuantity or userInput.

## Write clear and concise code:
Your code should be easy to read and understand. This means using clear and concise language, and avoiding complex or confusing code.

For example, instead of writing a long, nested if statement, you could break it up into multiple smaller statements.

## Use comments:
Comments can help to explain your code and make it easier to understand. However, it is important to use comments sparingly and only when they are actually helpful.

For example, you could use a comment to explain the purpose of a particular function or to provide a brief explanation of a complex piece of code.

## Avoid code duplication:
If you find yourself copying and pasting code, it is a good sign that you need to refactor your code. Refactoring is the process of improving the structure of your code without changing its functionality.

This can help to make your code more maintainable by reducing the amount of duplicate code.

## Use functions:
Functions are a great way to break your code into smaller, more manageable pieces. This can help to make your code more maintainable by making it easier to understand and modify.

## Use modules:
Modules are a way of grouping related code together. This can help to make your code more maintainable by making it easier to find and reuse code.

## Test your code:
Testing your code is essential for ensuring that it is working correctly. There are many different ways to test your code, but the most important thing is to make sure that you are testing all of the different cases.

## Conclusion
By following these tips, you can write maintainable JavaScript code that is easy to read, understand, and modify.

This will make your code more reusable and easier to maintain, which will save you time and frustration in the long run.
How to write a Impressive resume?
Tags: resume, beginners, developer
Published: 2023-07-29 06:53:31

Crafting an effective resume requires presenting your qualifications clearly and concisely, strategically showcasing your skills & work experience.

It should highlight what you can achieve professionally and how you can benefit employers. Keep your resume updated and modern to boost your job search success. Follow these do's and don'ts for writing a great resume.

## Resume Writing Do's

✅ Keep your resume clear and concise: An employer takes an average of 30 seconds to skim a resume. You want them to see right away that you are qualified for the position.

✅ Limit your resume to two pages: Place the emphasis of your resume on your most recent experience. Older jobs and experience that are more than 15 years old should either be cut out or minimized. This way, the employer can focus on more relevant information.

✅ Use simple words and action verbs: The person reading your resume might not always be the employer. Resumes can be reviewed by recruiters or Human Resources specialists who may not be familiar with your specific field.

## Resume Writing Don'ts

❌ Don't include unnecessary personal information: It is best to leave out any personal details such as age, weight, height, marital status, religious preference, political views, or any other personal attributes that could be controversial. This will prevent any potential bias. Most importantly, never include your Social Insurance Number in your resume.

❌ Don't use too many bullets: Make your resume easy to read by limiting each resume section or sub section to 5–7 bullet points. This will make it easier for the employer to scan your resume and identify your potential. Each bullet point should be used wisely by keeping the information relevant and concise.

❌ Don't include reasons for leaving previous jobs: The main purpose of your resume is to promote you, your skills, experience and achievements. It should be entirely positive, and therefore should not include reasons for leaving as it does not add any value to you as a candidate.

❌ Don't include references: An employer only requires references if they are seriously considering hiring you. Keep references on a separate sheet and provide them only when they are specifically requested.

---

✨ Download the free resume template from [here](bit.ly/3Ki297c)

Follow https://instagram.com/coding_dev_
Support: https://www.buymeacoffee.com/coding_dev_
Building an Efficient Todo List App: A Step-by-Step Guide
Tags: webdev, beginners, html, css
Published: 2023-07-29 06:45:16

Hey Dev Community! 👋

I hope you're all doing great! Today, I want to share my journey of creating an efficient Todo List app that has significantly improved my productivity and organization. 🚀

In this step-by-step guide, I'll walk you through the entire process, from conceptualization to deployment. We'll be using cutting-edge technologies like React for the frontend, Node.js and Express for the backend, and MongoDB for the database. Don't worry if you're new to any of these technologies; I'll make it beginner-friendly!

Here's what we'll cover:

Setting up the project and creating a simple frontend interface with React.
Building the backend with Node.js and Express to handle Todo data and requests.
Integrating MongoDB to store and manage our Todo items efficiently.
Implementing features like adding, updating, and deleting Todos.
Styling the app with CSS for a clean and polished look.
Deploying the app to share your productivity tool with the world!
By the end of this tutorial, you'll have your very own Todo List app, ready to boost your productivity and keep you organized in style.

Are you excited? I sure am! Let's embark on this coding journey together. 🚀

Stay tuned for the first part, where we'll set up our project and create the frontend interface. Feel free to leave any questions or suggestions in the comments, and let's make this a fantastic learning experience for everyone!

Happy coding! 😊💻

[Checkout](http://todolist.sadiqmagbul.host20.uk/)
90phut TV - Trực tiếp bóng đá hôm nay chuẩn tại 90phut link
Published: 2023-07-29 06:41:24

https://haiphongioc.vn/ 90phut - Website phát trực tiếp bóng đá miễn phí✔️ full HD✔️ có BLV tiếng việt chuẩn✔️ không quảng cáo✔️ Xem trực tiếp bóng đá hôm nay tại 90phut TV✔️✔️✔️
62 Võ Thị Sáu, Ngô Quyền, Hải Phòng
90phuttv@gmail.com
#90phut #90phuttv #90phutlink
https://www.hackathon.io/users/413972
https://www.last.fm/user/tivi90phut
https://www.last.fm/user/tivi90phut
https://www.metooo.io/u/90phuttivi
https://www.mixcloud.com/90phuttivi/
✨Nuôi Lô Cặp Khung 3 Ngày - Hướng Dẫn Cách Nuôi Lô Mới Nhất
Tags: vf555, nhacaivf555, vf555casino, nuoilocapkhung3ngay
Published: 2023-07-29 06:37:35

[✨Nuôi Lô Cặp Khung 3 Ngày - Hướng Dẫn Cách Nuôi Lô Mới Nhất
](https://vf555.ltd/nuoi-lo-cap-khung-3-ngay/)✨Nuôi lô cặp khung 3 ngày là gì?
✨Cách nuôi lô cặp khung 3 ngày
✨Mẹo chơi lô cặp khung 3 ngày hiệu quả
✨Tỷ lệ thắng cược cao
🌐Website : [https://vf555.ltd/nuoi-lo-cap-khung-3-ngay/](https://vf555.ltd/nuoi-lo-cap-khung-3-ngay/)
🌐Fanpage: [https://www.facebook.com/vf555ltd](https://www.facebook.com/vf555ltd)
👉Địa chỉ: 37 Đường Số 2, Bình Hưng Hoà A, Bình Tân, Thành phố Hồ Chí Minh, Việt Nam
📱Sdt: +84921215045
📧Email: [vf555ltd@gmail.com](vf555ltd@gmail.com)
#vf555 #nhacaivf555 #vf555casino #vf555club #nuoilocapkhung3ngay
👨‍💻 𝗗𝗼𝘁𝗡𝗲𝘁 𝗖𝗼𝗱𝗶𝗻𝗴 𝗖𝗼𝗻𝘃𝗲𝗻𝘁𝗶𝗼𝗻𝘀 𝗳𝗼𝗿 𝗖𝗹𝗲𝗮𝗻𝗲𝗿 𝗖𝗼𝗱𝗲!
Tags: javascript, beginners, programming, webdev
Published: 2023-07-29 06:34:40

👨‍💻 𝗗𝗼𝘁𝗡𝗲𝘁 𝗖𝗼𝗱𝗶𝗻𝗴 𝗖𝗼𝗻𝘃𝗲𝗻𝘁𝗶𝗼𝗻𝘀 𝗳𝗼𝗿 𝗖𝗹𝗲𝗮𝗻𝗲𝗿 𝗖𝗼𝗱𝗲!
I highly recommend following Microsoft's official C# coding conventions, which are designed to help us write clean, readable, and efficient code. 🎯

1️⃣ Naming: Microsoft suggests using PascalCase for class names, methods, and properties. For parameters and local variables, we should use camelCase. Choosing descriptive names is vital to enhance code comprehension.
2️⃣ Brace Placement: Microsoft's convention uses the next-line style for braces. The opening brace is placed on a new line, aligned with the method or class declaration, while the closing brace is on a separate line, aligned with the beginning of the method or class.
3️⃣ Indentation: Consistent indentation is crucial for code readability. Microsoft advises using four spaces for indentation, making the code structure clear and easy to follow.
4️⃣ Comments and Documentation: Clear and concise comments are encouraged to explain complex logic or any potential gotchas. For public APIs, XML documentation should be provided to assist other developers using your code.
5️⃣ Error Handling: Properly handle exceptions and avoid catching general exceptions unless necessary. Microsoft recommends catching specific exceptions and providing meaningful error messages.
6️⃣ Code Organization: Follow the recommended project structure and namespace conventions to keep the codebase organized and maintainable as it grows.
7️⃣ Avoid Magic Numbers: Assign meaningful constants or enumerations instead of using magic numbers, as it enhances code readability and maintainability.
8️⃣ Null Checks: Validate inputs and handle null values appropriately to avoid unexpected runtime errors.
9️⃣ LINQ Usage: Embrace Language-Integrated Query (LINQ) when working with collections to write concise and expressive code for data manipulation.
Setting Up Kafka on MacOS M1 using Homebrew
Tags: kafka, m1, brew, webdev
Published: 2023-07-29 06:25:30

## Introduction
This guide provides a step-by-step walkthrough of installing Apache Kafka on a MacOS M1 system. However, before we can install Kafka, we need to ensure Homebrew is installed on your system.

## Homebrew Installation
Homebrew is a package manager for MacOS that simplifies the installation of software. To install Homebrew, open Terminal and run the following command:

```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
This will install Homebrew on your machine. For more information about Homebrew and how to use it, check out the official [Homebrew documentation](https://brew.sh/).

## Kafka Installation
With Homebrew installed, we can now install Java and Kafka. Run the following commands in your Terminal:

```
brew install java
brew install kafka
```
These commands install both Java and Kafka on your system.

## Running Kafka and Zookeeper
To start Kafka, we need to run Kafka and Zookeeper services separately. Open two Terminal windows for this purpose.

Start Zookeeper:

```
zookeeper-server-start /opt/homebrew/etc/kafka/zookeeper.properties
```
Start Kafka:

```
kafka-server-start /opt/homebrew/etc/kafka/server.properties
```
Make sure that both services are running successfully before proceeding.

## Creating a Kafka Topic
Before interacting with Kafka using any producer or consumer API, you need to create a Kafka topic. A topic is essentially a category or feed name to which records get published. Here is how to create a topic named '**foobar**':

```
kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic foobar
```
Note: We no longer use the --zookeeper flag because newer Kafka versions for MacOS do not require it.

## Testing Kafka Producer and Consumer APIs
To validate your Kafka setup, let's test the Kafka producer and consumer APIs:

Open two new Terminal windows.

In the first terminal, initialize a producer console for the '**foobar**' topic and send some test messages:

```
kafka-console-producer --broker-list localhost:9092 --topic foobar
> foo
> bar
```
In the second terminal, initialize a consumer console for the 'foobar' topic. This will listen to the bootstrap server on **port 9092** and the 'foobar' topic:

```
kafka-console-consumer --bootstrap-server localhost:9092 --topic foobar --from-beginning
foo
bar
```
If you see these outputs, congratulations! Kafka is now set up and running smoothly on your MacOS M1 system.

## Conclusion
Setting up Kafka on a MacOS M1 system is a straightforward process, especially with the help of Homebrew. With Kafka properly installed, you can now use it to manage real-time data pipelines and streams. Happy streaming!
Latest Newsletter: Alternative Dev Culture (Issue #125)
Tags: javascript, tech, webdev, discuss
Published: 2023-07-29 06:08:00

---
title: Latest Newsletter: Alternative Dev Culture (Issue #125)
published: true
description: Loads of stuff: DevTools, Aliens, On prem infra, history of student protests in France, layer2 infinite scalability, and travel podcasting
tags: javascript, tech, webdev, discuss
---

Alternative Dev Culture (Issue #125)

Loads of stuff: DevTools, Aliens, On prem infra, history of student protests in France, layer2 infinite scalability, and travel podcasting

https://markjgsmith.substack.com/p/mark-smiths-newsletter-23-07-2023

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)

Update: URL in todays newsletter issue has the wrong date in it. Just realised. Too late now, it’s been published and sent out. You’ll just have to deal with it. I apologise to the world on behalf of the world. Had the world been less angry perhaps this tragedy wouldn’t have happened.