[TIP] Cách đơn giản để tạo XML Xpath chính xác trong Odoo cùng PyCharm IDE

Khi cần điều chỉnh thuộc tính của 1 field trong view đã có sẵn, ta cần dùng xpath để chọn đối tượng cần chỉnh sửa.

Đối với form đơn giản, ví dụ:

<record id="some_view_id" model="ir.ui.view">
  <field name="name">demo.view.form</field>
  <field name="model">demo.model</field>
  <field name="arch" type="xml">
    <form>
          <sheet>
              <group>
                     <field name="user_id"/>
                     <field name="demo_field"/>
                </group>
          </sheet>
        </form>
</record>

gunicorn vs uvicorn notes

TLTR: gunicorn for WSGI app (like Flask), uvicorn for ASGI app (like FastAPI)

Tài liệu Viettel Data Center và Cloud Infrastructure (DCCI) Summit Light 2023

Tài liệu hội thảo ngày 22/06/2023 tại HCM

[Ubuntu] Add or remove a systemctl (systemd) service

An example to add or remove a service on system with systemd

[Python] Search value in list of dictionary benchmark

This is a test how fast we can search value in a very large list of dict by various way

[Python] Graceful stop FFMPEG recording process on Windows

Problem

When we want to stop ffmpeg stream recording on Windows programmatically, these sollution will not work:

# asume p is the subprocess.Popen command call ffmpeg
os.kill(p.pid, signal.CTRL_C_EVENT)  # parent process get kill too, recording file is not playable
# or 
p.terminate()  # not good, recording file is not playable
# or
p.send_signal(signal.CTRL_C_EVENT) # parent process get kill too, recording file is not playable

[Learning] Should I define methods on values or pointers?

Stack Overflow: https://stackoverflow.com/questions/25382073/defining-golang-struct-function-using-pointer-or-not

Can someone explain to me why appending to an array works when you do this:

func (s *Sample) Append(name string) {
    d := &Stuff{
        name: name,
    }
    s.data = append(s.data, d)
}

But not when you do this:

func (s Sample) Append(name string) {
    d := &Stuff{
        name: name,
    }
    s.data = append(s.data, d)
}

Is there any reason at all why you would want to use the second example.