domingo, 25 de janeiro de 2026

Guide: Installing many pythons in Ubuntu without uv or pyenv

 Run  the commands to install:

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update

sudo apt install python3.9 python3.10 python3.11

After that, configure the uptade-alternatives:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 9

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 10

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.11 11

Then to use, just choose the default, choose the alternative:

sudo update-alternatives --config python 

At the end, if you want to use venv in any project, just create the virtual env like this:

python3.xx -m venv .venv

source .venv/bin/activate 

If the first command raises error, maybe you need to install:

sudo apt install python3.xx-venv

Solução para: Laptop Vaio FE16 Linux sem Wifi

O notebook Vaio FE16 com Linux vem com um Policorp Linux (Linux Policorp 6.10.8-policorp-amd64) e o Wifi não consegue ser identificado. Antes de formatar e colocar um Ubuntu mais recente eu quis pesquisar se eu conseguiria resolver o problema via software ou se seria um problema de hardware. Depois de muito pesquisar e tentar corrigir o driver da placa de rede RTL8852BE através de instalações de drivers de diversos tipo, eu desisti e resolvi fazer uma restauração do sistema através do menu de boot. Após a restauração o wifi foi identificado.

Então é isso: Restaure o sistema.

Solucionado eu pude instalar o Ubuntu 24.04. Inclusive, eu poderia logo de inicio ter testado no Ubuntu Live se ele conectaria, pois sim, ele conectou.

sábado, 27 de dezembro de 2025

Deno "Error: illegal value for flag --max-old-space-size=4096 --expose-gc of type size_t"

 I'm using an old version of Deno (version 1.38.4) and when trying to use the --v8-flags= parameter on the command line, with more than one flag, I get this error:

Error: illegal value for flag --max-old-space-size=4096 --expose-gc of type size_t


The solution is trivial: Just use comma:

example:

--v8-flags="--flag-1=xpto,--flag-2"



quarta-feira, 22 de outubro de 2025

How to exclude fields from pydantic submodels model_dump()

 Everybody knows that using .model_dump() with exclude parameter we can exclude some attributes from the output. But if your model contains attributes that are other pytdantic models, and you want to hide some attributes of this submodel, the best solution, that are not so explicit in the pydantic documentation is define the attribute with annotated to be excluded, like this:

from pydantic import BaseModel, Field
from typing import Annotated

class MySubmodel(BaseModel):
      not_hidden_attr: str
      hidden_attr: Annotated[str, Field(exclude=True)]

class MyModel(BaseModel)
      attr_of_submodel: MySubmodel



quinta-feira, 25 de setembro de 2025

segunda-feira, 7 de julho de 2025

Solution to "TypeError: error sending request for url (https://...) error trying to connect: invalid peer certificate: UnknownIssuer" in Deno

This error occurs for me when running Deno locally. My Deno version is older, 1.38.4:

Example error:

error: (in promise) TypeError: error sending request for url (https://esm.sh/dd-trace@5.36.0&pin=v135&no-dts/package.json): error trying to connect: invalid peer certificate: UnknownIssuer 
const response = await fetch("https://esm.sh/dd-trace@5.36.0&pin=v135&no-dts/package.json");

 Solution, export this environment variable:

DENO_TLS_CA_STORE=system


terça-feira, 13 de maio de 2025

Solution to "ImportError: cannot import name 'GrowthBookClient' from 'growthbook'"

If you're using version 1.2.1 of the GrowthBook Python library, you may have seen in the documentation on GitHub or PyPI that the GrowthBookClient should be imported like this:

from growthbook import GrowthBookClient

 However, this results in the following error:

api/feature_flag_service.py", line 1, in <module>

    from growthbook import GrowthBookClient, Options, UserContext

ImportError: cannot import name 'GrowthBookClient' from 'growthbook'

The fix is simple: instead of following the documentation, use the correct import path based on the actual library structure:

from growthbook.growthbook_client import GrowthBookClient