teleren/devto huggingface dataset:
Odoo 16 - how to bring a value from another model into the current working model
Tags: odoo, python
Published: 2023-10-09 14:52:51


Odoo documentation is very limited and finding help is further scary. I am sharing a quick tip on how to get a value into the current working model from a different model 

There are two ways to access a field from a different model file in Odoo 16:

**1. Using a Many2one field:**

This is the most common way to access a field from a different model file.

For example, let's say you have two models: `Customer` and `Product`. The `Customer` model has a `product_id` field, which is a Many2one field that references the `Product` model.

To access the `product_name` field from the `Product` model in the `Customer` model, you would use the following code:

Python

```
class Customer(models.Model):
    _name = 'res.partner'

    product_id = fields.Many2one('product.product', 'Product')

    product_name = fields.Char(compute='_compute_product_name')

    @api.depends('product_id')
    def _compute_product_name(self):
        for customer in self:
            if customer.product_id:
                customer.product_name = customer.product_id.name
```

This code will create a new field called product_name on the Customer model, which will be populated with the value of the name field on the Product model.




**2. Using a Related field:**

A Related field allows you to access a field from another model without having to create a Many2one field.

For example, let's say you have the same two models as above, but you don't want to create a Many2one field on the `Customer` model.

To access the `product_name` field from the `Product` model in the `Customer` model using a Related field, you would use the following code:

Python

```
class Customer(models.Model):
    _name = 'res.partner'

    product_name = fields.Related('product_id', 'name')

```
 

This code will create a new field called `product_name` on the `Customer` model, which will be populated with the value of the `name` field on the `Product` model.

Which method you use to access a field from a different model file depends on your specific needs. If you need to be able to update the value of the field, then you should use a Many2one field. If you only need to read the value of the field, then you can use a Related field.
Hacktoberfest 2023 Pledge
Tags: hacktoberfest23, hacktoberfest
Published: 2023-10-09 14:52:27

## My Pledge

I, Zehra, pledge to participate in Hacktoberfest 2023 to the best of my ability. My aim is to contribute meaningfully to the open-source community through my skills and efforts.

## Objectives

- To submit at least four pull requests to open-source repositories during the month of October 2023.
- To improve the quality of projects by providing valuable code changes, documentation updates, or other types of contributions.
- To adhere to the community standards and guidelines set by the maintainers of the projects to which I contribute.

## Guidelines I Will Follow

- I will read the contributing guidelines of each repository to which I contribute and follow them diligently.
- I will be respectful and courteous in my interactions with other community members.
- I will ensure that my contributions are meaningful and add value to the project.

## Rewards

While I understand that the reward of participating in Hacktoberfest lies in the learning and the joy of contributing to open-source, I also acknowledge the additional incentives of swag and recognition provided by DigitalOcean and other sponsors.

## Conclusion

Through my participation in Hacktoberfest 2023, I aim to be a proactive and beneficial member of the open-source community. I look forward to contributing to projects that excite me and learning from the experiences of others.
ChatGPT Vision. What is it? What can it do for my business?
Tags: webdev
Published: 2024-06-28 15:45:34

---
title: ChatGPT Vision. What is it? What can it do for my business?
published: true
date: 2023-10-09 14:42:59 UTC
tags: WebDevelopment
canonical_url: 
---

OpenAI’s ChatGPT Vision (or GPT-4V) is creating a buzz in the artificial intelligence community. But what is it, and how can you tap into its potential to streamline and automate your business? In this overview, we’ll demystify ChatGPT Vision, discuss its strengths and limitations, and shed light on how to utilize it effectively. ChatGPT Vision […]

The post [ChatGPT Vision. What is it? What can it do for my business?](https://blog.nextideatech.com/chatgpt-vision-what-is-it-how-can-it-do-for-my-business/) appeared first on [Next Idea Tech Blog](https://blog.nextideatech.com).
Speed up your React application
Tags: learning, webdev, javascript, react
Published: 2023-10-09 14:38:45

![](https://cdn-images-1.medium.com/max/2000/0*_e3CcxnmdtyG5d5m.jpg)

We are known that [React](https://react.dev/) is not focusing on performance. **In new React Server Component architecture nobody is talking about re-renders and optimizing client rendering.** When everything will be rendered and streamed from the server it doesn’t matter anymore. 

But is it true? No, ongoing and mature project won’t switch to RSC for a long time. Maybe even they will never be on RSC architecture. So how to speed up your project?

## *Million enters the chat*

[Million](https://million.dev/) is a project that can help you speed up your application. Compiler that will let you gain of performance up to 70%. 

![[Web frameworks benchmarks](https://krausest.github.io/js-framework-benchmark/current.html)](https://cdn-images-1.medium.com/max/2000/1*95eY_AHsHx1atxIwdtBGQQ.png)

## How does it work?

It’s wrapping our component in special block() function that is supposed to make rendering this component significantly faster. It’s doing so by optimizing and fine-tuning Virtual DOM. Virtual DOM is responsible for rendering and discovering changes in our application. 

Learn more about [how is Million working under the hood](https://million.dev/blog/virtual-dom). 

### Rules of Blocks

There are some rules that we need to know. Using Million is not plug-n-play. We need to prepare our code — but we can do it incremental. Apply block() to the place where we will benefit from it.

Rules that you need to know:

* You must assign block() to variable

* You must call block() on function reference rather than JSX element

* .map() functions must be switched to use <For /> element

* You must use deterministic returns — no conditional returns in component

* Spreading attributes that are not immutable — this you shouldn’t be doing this at all

Also, Million [is not well suited with UI Component libraries](https://million.dev/docs/rules#ui-component-libraries-%EF%B8%8F). For some projects this will be no-go.

You can [see all the rules here](https://million.dev/docs/rules). It’s worth noting that these rule can change in the feature. Some of them can be mitigated by using compiler. Speaking of which…

## Million’s compiler

For most of the user there is an automatic mode with a compiler that will determine what components should be wrapped in block() function for you. 

There are installation instruction for most of the popular frameworks. It supports also RSC clients component if you want extra speed in Next.js new architecture.

## Summary

Million.js is great library with little to no installing effort. Every app can benefit from using it. It could be event 70% performance boost. [Try it yourself](https://million.dev/) and share your results!
Payload 2.0: Headless CMS released
Tags: webdev, payloadcms, headless, cms
Published: 2023-10-09 14:27:06

**Payload 2.0** is a major new release of the Payload Headless CMS that introduces significant updates and new features.

- It includes **support for Postgres** in addition to MongoDB, full migration support with TypeScript migrations, and transaction support.

- The admin interface has been updated with features like collapsible sidebars and **improved editing views**. 

- **Live preview** functionality allows editing content directly on the frontend. 

- Image uploads now support **cropping and focal point selection**. 

- A **new rich text editor based on Lexical** replaces Slate, offering improved customization and the ability to directly embed Payload blocks. 

- **Performance** has also been enhanced.

Payload is now a monorepo for improved development. The developers outlined future plans like visual editing, multiplayer editing, additional database support, and integrating AI features into Payload.

You can find more information about this major update on the [official blog](https://payloadcms.com/blog/payload-2-0).

{% embed https://www.youtube.com/watch?v=EQXGDWejt9w %}

Did you work with Payload CMS in the past or do you plan to try it out with version 2.0? Let me know!
UPCOMING RUBY CONFERENCES
Tags: ruby, conference, rails, community
Published: 2023-10-09 14:21:18

**UPCOMING RUBY CONFERENCES**

**[Ruby Retreat 2023](https://retreat.ruby.nz/)**
October 27–30, 2023 Mount Cheeseman, Aotearoa New Zealand

**[Kaigi on Rails 2023](https://kaigionrails.org/)**
October 27–28, 2023 Tokyo, Japan

**[RubyWorld Conference 2023](http://2023.rubyworld-conf.org/en/)**
November 9–10, 2023 Matsue, Japan @rubyworldconf

**[RubyConf 2023](https://rubyconf.org/)**
November 13–15, 2023 San Diego, CA @rubyconf

**[Helvetic Ruby 2023](https://helvetic-ruby.ch/)**
November 24, 2023 Bern, Switzerland @helvetic_ruby

**[RubyConf Taiwan 2023](https://2023.rubyconf.tw/)** 
December 15–16, 2023 Taipei, Taiwan @rubyconftw

**[Sin City Ruby 2024](https://www.sincityruby.com/)**
March 21–22, 2024 Las Vegas, NV

**[Tropical Ruby](https://www.tropicalrb.com/)**
April 4–5, 2024 São Paulo, Brazil

**[RailsConf 2024](https://www.railsconf.com/)**
May 7–9, 2024 Detroit, MI @railsconf

**[RubyKaigi 2024](https://rubykaigi.org/)**
May 15–17, 2024 Naha, Okinawa, Japan @rubykaigi

**[RubyDay 2024](https://2024.rubyday.it/)**
May 31, 2024 Verona, Italy @rubydayit

**[Brighton Ruby 2024](https://brightonruby.com/)**
June 28, 2024 Brighton, UK @brightonruby 

[RubyOnRails.ba](www.RubyOnRails.ba)
How to Allow Custom-Routing-Traffic in AWS Global Accelerator with Terraform
Tags: aws, terraform, globalaccelerator
Published: 2023-10-09 14:15:16

By intelligently routing traffic, AWS Global Accelerator improves the availability and performance of applications. However, there is currently no Terraform AWS resource available to allow custom traffic routing to specific destinations in the subnet endpoint. I'll demonstrate a Terraform workaround in this post to enable this in AWS Custom Routing Global Accelerator.

## Workaround Using Terraform
To allow custom routing traffic in AWS Global Accelerator, I'll leverage Terraform along with a null resource. Here's how you can do it:
**1. Create a null resource in your Terraform code:**
```terraform
resource "null_resource" "allow_custom_routing_traffic" {

  triggers = {
    endpoint_group_arn = aws_globalaccelerator_custom_routing_endpoint_group.endpoint_group.id
    endpoint_id        = aws_subnet.Endpoint_Subnet.id
  }

  provisioner "local-exec" {
    command = "aws globalaccelerator allow-custom-routing-traffic --endpoint-group-arn ${self.triggers.endpoint_group_arn} --endpoint-id ${self.triggers.endpoint_id} --allow-all-traffic-to-endpoint --region us-west-2"
  }
}
```
**2. Apply your configuration:**
`terraform apply -auto-approve`
```
null_resource.allow_custom_routing_traffic: Creating...
null_resource.allow_custom_routing_traffic: Provisioning with 'local-exec'...
null_resource.allow_custom_routing_traffic (local-exec): Executing: ["cmd" "/C" "aws globalaccelerator --region us-west-2 allow-custom-routing-traffic --endpoint-group-arn arn:aws:globalaccelerator::1234:accelerator/1234/listener/f1234/endpoint-group/1234 --endpoint-id subnet-1234 --allow-all-traffic-to-endpoint"]
null_resource.allow_custom_routing_traffic: Creation complete after 8s [id=1234]
```
The null resource is used to apply the aws-cli config.
For the triggers, it's assumed you already have those resources defined in your code. Also, this trigger block ensures that the null_resource will be triggered and execute the provisioner whenever either the endpoint_group_arn or the endpoint_id changes.

## Conclusion
While Terraform AWS Provider does not currently provide a direct Terraform AWS resource for allowing custom routing traffic, you can work around this limitation by using a Terraform null resource, as demonstrated in this blog post. This approach allows you to gain more control over how your traffic is routed in AWS Global Accelerator, enhancing the performance and availability of your applications. 
s/o to [Andres Montalban](https://www.linkedin.com/in/andresmontalban) for assisting me in this.
Como começar a programar em Elixir?
Tags: elixir, learn4elixir, programacao
Published: 2023-10-09 14:11:44

Uma dúvida comum entre pessoas que descobrem a existência da linguagem de programação Elixir, criada pelo brasileiro [José Valim](https://pt.wikipedia.org/wiki/Jos%C3%A9_Valim), é: "Qual é o ponto de partida para aprender Elixir?" e "Como devo me preparar para conquistar meu primeiro estágio ou emprego na área de programação?"

Iniciar no mundo da programação geralmente envolve o uso de um computador (desktop ou laptop) para desenvolver e testar programas. A prática desempenha um papel fundamental para consolidar o conhecimento adquirido por meio de diversos recursos, como livros, artigos em blogs, vídeos, podcasts e outros.

Atualmente, para começar a aprender Elixir você não precisa instalar nada em seu computador. Você pode, por exemplo, usar uma instância de [Livebook](https://livebook.dev/) rodando no Fly.io ou no HuggingFace. E, claro, você pode também instalar Livebook no seu computador. Se quer saber como, acesse a parte [Instalando Elixir e Livebook](https://github.com/Universidade-Livre/Learn4Elixir/#instalando-elixir-e-o-livebook) do repositório [Learn4Elixir](https://github.com/Universidade-Livre/Learn4Elixir/).

Depois disso, é só seguir o material de aprendizado de sua escolha. Se você escolher o Learn4Elixir e tem alguma dúvida, assista a este vídeo sobre o Capítulo 1 do Learn4Elixir:

{% youtube xcYO5G0sthg %}.

Há também um vídeo sobre o Capítulo 2:

{% youtube ObTPNEbdvkM %}

E há o vídeo de lançamento do Learn4Elixir, uma iniciativa da [Universidade Brasileira Livre (UBL)](https://ulivre.dev/):

{% youtube 9DjlSB_RfPo %}

Se  você ainda tiver alguma dúvida, entre no [Discord da [UBL](https://discord.com/invite/dsvMraVaca). 

E se quer saber como se preparar para conquistar seu primeiro estágio ou emprego na área de programação usando Elixir, entre na comunidade [Elixir Brasil no Telegram](https://t.me/elixirbr), sem esquecer de responder ao CAPTCHA!

Inspirado no post [Por onde começar, de Os Programadores](https://osprogramadores.com/blog/2019/03/12/por-onde-comecar/).

Leia também este post anterior: [Como começar a aprender a linguagem de programação Elixir?](https://dev.to/elixir_utfpr/como-comecar-a-aprender-a-linguagem-de-programacao-elixir-26o5).
Hacktoberfest 2023 : The Good -The Bad -The Ugly
Tags: hacktoberfest, coding
Published: 2023-10-09 14:01:24


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

Hacktoberfest means different things to different people.  The short of it is that Hacktoberfest was created for good intended purposes.  However, like most things, good things can quickly go wrong when exploited.

I enjoy coding but I don't get to code that often.  Hacktoberfest gives me that opportunity to keep my skills relevant.  As the old cliche goes:  Don't use it, you loose it.

Sadly, however, I attempted Hacktoberfest last year, and found that that every project I contributed to, was excluded.  I was fairly annoyed because I had spent some time writing code with a focus on a fun outcome. I ended up just giving up.  It is really frustrating to put some time in and then find your time was worth nothing.  Surely the Hacktoberfest team created a page with 'excluded projects' on it??

This year, I decided to give it another go.  Once again, I am faced with 'excluded'.  No once, but several times.  Of course, some of the projects you question. You think to yourself:  "Is this a trap".  After a while you think all of the projects are a trap.  And when I say trap, I mean the projects that ask you to add a photo, add your personal information etc. 
 
This year, before I committed to any project I completed a quick background check.  Some of them have been on GitHub for some time.  Their profile was very well crafted and it left me thinking: "Surely not".  But sadly it was "Surely: yes".

I am not sure about you, but it is frustrating.  If you found a project which fits all the Hacktoberfest guidelines and PR requests are acceptable which ultimately makes the 'waiting list', could you share in the commentary below. 

#thanks
How to use Dynamic Variables with Tailwind
Tags: tailwindcss, webdev, css, vue
Published: 2023-10-09 13:50:39

Have you ever wanted to do `p-[${someDynamicValue}]` in tailwind? Or maybe the more complicated `after:content-[${someDynamicValue}]`? Here's a better solution than resorting to a style tag.

---

Tailwind cannot have dynamic values in it's classes because the stylesheets are compiled at build time, neither the class name nor the value can be made up of dynamic variables for this to work.

This can be a bit of a pain in certain situations. One obvious solution is to move back to a style tag, but this means now the styles aren't all in one place, the main selling point of tailwind.

For certain situations, like `p-[${someDynamicValue}]` we can fallback to the style property:

```vue
<!-- I'm using vue here, but all frameworks have a way to do this. -->
<div
	:style="`padding:${someDynamicValue}`"
></div>
```


But this is not always the case. Take `after:content[${someDynamicValue}]`. **Style tags cannot target psuedo-elements**, we have to resort to a style tag, or do we?

**Style tags *can* have inline css variables.** So we can actually do this:

```vue
<div
	class="after:p-[var(--customPadding)]"
	:style="`--customPadding:${someDynamicValue}`"
></div>
```

Tailwind can now happily compile the class, it's name is no longer dynamic, it's `.after\:p-\[var\(--customPadding\)\]` and it's value is no longer dynamic, it's `var(--customPadding)`. The part of the outputted css that we care about looks like this, here's a link to a [demo on the playground](https://play.tailwindcss.com/RcEotAgwA9?file=css). 

```
.after\:p-\[var\(--customPadding\)\]::after {
	padding: var(--customPadding)
	//...
}
```

And we can change the css variable to whatever we need. It's also very easy to find where the custom value was declared.
Huge Stable Diffusion XL (SDXL) Text Encoder (on vs off) DreamBooth training comparison
Tags: sdx, dreambooth, stablediffusion, ai
Published: 2023-10-09 13:45:51

U-NET is always trained.

All images are 1024x1024 so download full sizes. Each grid image full size are 9216x4286 pixels.

Public tutorial hopefully coming very soon to SECourses (https://www.youtube.com/SECourses). I am still experimenting to find best possible workflow and hyper parameters.

I made a short tutorial for how to use currently shared config files : https://youtu.be/EEV8RPohsbw

PNG info shared in captions of images

For full size images with alt tags please check this reddit thread: https://www.reddit.com/r/StableDiffusion/comments/173qn0b/huge_stable_diffusion_xl_sdxl_text_encoder_on_vs/
Does Status Code `405` occur during a `GET` request?
Tags: httpstattuscode, statuscode, 405, getrequest
Published: 2023-10-09 13:30:58

## TLDR

- Status Code 405: It indicates that the HTTP method used in the request is not allowed for the requested resource.
- GET Requests: A 405 status code should not occur during a standard HTTP GET request, as GET is meant for retrieving resources and is widely supported by web servers.
- Exceptions: Server behavior can vary, so there might be situations where a GET request receives a 405 status code due to server configuration or resource constraints.
- Advice: If you encounter a 405 status code for a GET request, investigate server configuration and consult API documentation to ensure correct usage.

## What does status code 405 mean?

[A status code of 405 typically indicates that the HTTP method used in the request is not allowed for the requested resource.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405) In most cases, it's associated with HTTP methods like POST, PUT, DELETE, or PATCH being used on a resource that only allows GET requests.

## Does Status Code `405` occur during a `GET` request?

For a standard HTTP GET request, a status code of 405 should not occur unless there's a misconfiguration or an unusual server setup. GET requests are typically used for retrieving resources and are widely supported by web servers for most resources.

However, it's important to note that server behaviour can vary, and there might be situations where a specific server or API returns a 405 status code for a GET request due to its configuration or the specific constraints of the resource. In such cases, it's essential to consult the API documentation or server documentation to understand the reasons for this response and how to use the API correctly.

## Wrap-Up!

Typically RESTful APIs and web services, a 405 status code for a GET request is not expected behaviour. If you encounter such a situation, it's a good idea to investigate the server configuration and consult the API documentation to ensure that you are making the correct request.
Does Status Code `405` occur during a `GET` request?
Tags: httpstattuscode, statuscode, 405, getrequest
Published: 2023-10-09 13:30:31

## TLDR

- Status Code 405: It indicates that the HTTP method used in the request is not allowed for the requested resource.
- GET Requests: A 405 status code should not occur during a standard HTTP GET request, as GET is meant for retrieving resources and is widely supported by web servers.
- Exceptions: Server behaviour can vary, so there might be situations where a GET request receives a 405 status code due to server configuration or resource constraints.
- Advice: If you encounter a 405 status code for a GET request, investigate server configuration and consult API documentation to ensure correct usage.

## What does status code 405 mean?

[A status code of 405 typically indicates that the HTTP method used in the request is not allowed for the requested resource.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405) In most cases, it's associated with HTTP methods like POST, PUT, DELETE, or PATCH being used on a resource that only allows GET requests.

## Does Status Code `405` occur during a `GET` request?

For a standard HTTP GET request, a status code of 405 should not occur unless there's a misconfiguration or an unusual server setup. GET requests are typically used for retrieving resources and are widely supported by web servers for most resources.

However, it's important to note that server behaviour can vary, and there might be situations where a specific server or API returns a 405 status code for a GET request due to its configuration or the specific constraints of the resource. In such cases, it's essential to consult the API documentation or server documentation to understand the reasons for this response and how to use the API correctly.

## Wrap-Up!

Typically RESTful APIs and web services, a 405 status code for a GET request is not expected behaviour. If you encounter such a situation, it's a good idea to investigate the server configuration and consult the API documentation to ensure that you are making the correct request.