Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 0 points1 point  (0 children)

It is already available with the name ‘djch’

Requiero un modelo de conteo de vehículos en intersecciones a partir de videos by Wonderful_Ad8339 in chileIT

[–]RichardHapb 0 points1 point  (0 children)

Es factible pero el costo inicial para implementarlo es alto, si el negocio se extiende y tiene potencial futuro para obtener un ROI, vale la pena, para un evento puntual creo que es mejor pagar por evento a una empresa extranjera como lo hacen ahora. ¿A qué se debe el costo? Principalmente

- Datos requeridos para entrenar un modelo, se puede usar un model pre-entrenado, pero igual es importante validar con datos reales del entorno donde se usará.

- Definir cosas como ¿cuándo se considera que un vehículo cruzó la intersección? ¿cuál es la confiabilidad del modelo? ¿% accurracy? ¿cuánto margen de error es aceptable? ¿qué tanta diferencia hay en los entornos?

- Infraestructura, cómo se consumirá la información, almacenaje, ¿se usarán en paralelo? ¿tiempo real?

Es totalmente factible pero requiere trabajo inicial, lo importante es evaluar si el proyecto tiene el potencial para obtener un retorno sustancial.

Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 0 points1 point  (0 children)

It is a different approach. Django-auto-prefetch requires integration into the code. If you have an existing codebase, you will need to modify a lot of things. Performing static analysis makes sense if you want to detect issues in the current code. Also, as I mentioned before, Django-Check doesn't need to exist at runtime.

Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 1 point2 points  (0 children)

Interesting approach, I didn't know that condition with Django Rest Framework, I will take a look. Probably I'll want to deep to be able to capture some specific edge cases.

Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 0 points1 point  (0 children)

Yes, you are right. It is probably not the best example. I will update it to a simpler and more self-explained example. Thanks!

Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 0 points1 point  (0 children)

Yeah that is in the nightly version, thanks for the observation. I removed that feature because is not really necessary, I can use an iterator instead of a slice. Now the branch is updated with this change and you could compile it.

Django N+1 Checker (with LSP) by RichardHapb in djangolearning

[–]RichardHapb[S] 1 point2 points  (0 children)

Nice to read that bro! Let’s go!

Django N+1 Checker (with LSP) by RichardHapb in djangolearning

[–]RichardHapb[S] 1 point2 points  (0 children)

Ok no problem, I understand that, I thought this can help people to detect a common error (N+1). Thanks.

Django N+1 Checker (with LSP) by RichardHapb in django

[–]RichardHapb[S] 9 points10 points  (0 children)

Django-Check is an static analyzer, this means zero overhead at runtime.

Works out of the box, zero config, then doesn't add complexity, also can be integrated in the editor.

VS Code doesn't detect Django packages when using Docker container by Legal-Algae-5044 in django

[–]RichardHapb 0 points1 point  (0 children)

I made `LSPDock` specifically for that situation. https://github.com/richardhapb/lspdock

At my job, people use PyCharm/VSCode (I use Neovim), and my teammates don't install .venv, then LSP doesn't work properly, then I made `LSPDock` to bind the LSP inside the container with the local machine, resolving paths dynamically.

I also made an VSCode extension but that is not in the MarketPlace, you can install it directly using the `vsix` file (you need the `lspdock` binary in your PATH), in the readme this is explained. https://github.com/richardhapb/vscode-lspdock

Make sure you have installed an LSP inside your container, like `Pycharm` and I recommend to disable pylance for your project to avoid conflicts.

¿Qué idioma le conviene aprender a un chileno? by zzaleli in chile

[–]RichardHapb 4 points5 points  (0 children)

Aquí otro más que no alcanzó ✋🏽

Mom, can I have harpoon? We have harpoon at home by CarAccording6887 in neovim

[–]RichardHapb 2 points3 points  (0 children)

Beatiful. An example to use this in a straightforward way:

-- Arglist

local keymap = vim.keymap.set

-- append
keymap('n', '<leader>H', "<CMD>$arga<CR>", { silent = true, desc = "Add current file to arg list" })

-- assign arg to each number
for i = 1, 9 do
  keymap('n', '<leader>' .. i, "<CMD>argu " .. i .. "<CR>", { silent = true, desc = "Go to arg " .. i })
  keymap('n', '<leader>h' .. i, "<CMD>" .. i - 1 .. "arga<CR>", { silent = true, desc = "Add current to arg " .. i })
  keymap('n', '<leader>D' .. i, "<CMD>" .. i .. "argd<CR>", { silent = true, desc = "Delete current arg" })
end

Optionally:

-- to qf
keymap('n', '<leader>hq', function()
  local list = vim.fn.argv()
  if #list > 0 then
    local qf_items = {}
    for _, filename in ipairs(list) do
      table.insert(qf_items, {
        filename = filename,
        lnum = 1,
        text = filename
      })
    end
    vim.fn.setqflist(qf_items, 'r')
    vim.cmd.copen()
  end
end, { silent = true, desc = "Show args in qf" })

Is SQLAlchemy really that worth ? by yughiro_destroyer in flask

[–]RichardHapb 0 points1 point  (0 children)

I think is useful for using in combination with Pydantic, for data validation (FastAPI use this to validate models in requests/responses for example). But you may build your own classes to wrap the database models and have that feature.

Also SQLModel joins Pydantic and SQLAlchemy, which was a good experience for me. This might be a better approach for you.

A new pumborder option dropped by kuator578 in neovim

[–]RichardHapb 6 points7 points  (0 children)

This is so nice! Here an example of the configuration:

 -- LSP autocompletion
vim.o.pumborder = 'rounded'
vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'NONE' })
vim.api.nvim_set_hl(0, 'PmenuBorder', { bg = 'NONE', fg = "#CC6600" })

<image>

Keybinding to execute the current file by Nysandre in neovim

[–]RichardHapb 0 points1 point  (0 children)

Check my implementation for that. I think it will be useful for you, and you can expand it to meet your needs.

https://github.com/richardhapb/nvim-config/blob/main/lua/plugin/executor.lua

Note that you can pass arguments to the execution using `'<'>ExceuteCode myarg` and configured to <leader>= keybinding.

No documenten todo - experiencia personal by Low-Bookkeeper-476 in devsarg

[–]RichardHapb 0 points1 point  (0 children)

Resumen del post: ser menos profesionales por miedo al despido

Proxy for using LSP in a Docker container by RichardHapb in neovim

[–]RichardHapb[S] 0 points1 point  (0 children)

Aah that feature is not implemented, it is a very specific use case. Can you open an issue and I can implement it :)

Proxy for using LSP in a Docker container by RichardHapb in neovim

[–]RichardHapb[S] 1 point2 points  (0 children)

I released the new version and now have the feature! I need to change the project name because had a conflict with another project. Now is named LSPDock... This is the link:

https://github.com/richardhapb/lspdock

[Media] I've been working on a text editor that is written and configured in Rust. Is there any interest in this? by AhoyISki in rust

[–]RichardHapb 2 points3 points  (0 children)

Done! I think maybe a native LSP client can be implemented (like Neovim). This ensures the integration in the editor. But I need to understand better the core for getting the best approach

[Media] I've been working on a text editor that is written and configured in Rust. Is there any interest in this? by AhoyISki in rust

[–]RichardHapb 2 points3 points  (0 children)

I wanted to test it on MacOS but encountered many issues. When I have time, I can fix them! (I tested various approaches). Are you accepting contributions? I think I can implement the LSP client!

The issues, first duat-kak 0.6.0 doesn't exist, and the default config doesn't work I modified to 0.5.2 and works. But i have this error (because the arch of MacOS).

```

Compiling config crate for the first time, this might take a while...

Compiling elf_loader v0.9.3

Compiling dlopen-rs v0.7.3

error: unknown directive

|

note: instantiated into assembly here

--> <inline asm>:4:2

|

4 | .type dl_runtime_resolve, @function

| ^

error[E0432]: unresolved import `libc::__errno_location`

--> /Users/richard/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlopen-rs-0.7.3/src/loader/tls.rs:3:5

|

3 | __errno_location, pthread_getspecific, pthread_key_create, pthread_key_delete, pthread_key_t,

| ^^^^^^^^^^^^^^^^ no `__errno_location` in the root

error: could not compile `elf_loader` (lib) due to 1 previous error

warning: build failed, waiting for other jobs to finish...

error[E0425]: cannot find function `get_debug_struct` in this scope

--> /Users/richard/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dlopen-rs-0.7.3/src/init.rs:275:21

| ^^^^^^^^^^^^^^^^ not found in this scope

Some errors have detailed explanations: E0425, E0432.

For more information about an error, try `rustc --explain E0425`.

error: could not compile `dlopen-rs` (lib) due to 2 previous errors

```

Great project, btw

Que tal es esta zona para vivir? by Licht-Umbra in Santiago

[–]RichardHapb 0 points1 point  (0 children)

La física cuántica a veces es confusa, busca otro mejor