There's no place like 127.0.0.1.

Understanding when to use stream() vs forEach() in Java

In Java, choosing between Stream() and ForEach() depends on what you want to do with your data. While both are used to iterate over collections, each has its own strengths.

stream()

Using stream() is powerful for complex data transformations, allowing operations like filtering, mapping, and reducing. It’s ideal for:

  • Transformations and filters: Use Stream() to apply operations like filtering, mapping, grouping, or reducing data.
  • Chained processing: Apply multiple operations in a single chain.
  • Parallel processing: For large datasets, use parallelStream() to leverage multi-core processors.
  • Immutability: Streams avoid side effects, allowing new collections to be generated without changing the original.

Example:

List<String> names = Arrays.asList("Maria", "José", "João");
List<String> filteredNames = names.stream()
.filter(name -> name.startsWith("J"))
.map(String::toUpperCase)
.collect(Collectors.toList());

The results will be a new list only with the names started with J in uppercase.

Introduction to Internet Privacy: Five Essential First Steps

Introduction to Internet Privacy: Five Essential First Steps

Privacy

We live in an era where the internet is deeply embedded in our daily lives. Whether for work, leisure, or communication, we are constantly connected. However, this continuous connection comes at a price: our privacy. In a world where data is the new gold, protecting our personal information has become crucial. Here are five essential first steps to ensure your online privacy.

Introdução à Privacidade na Internet: Cinco Primeiros Passos Essenciais

Introdução à Privacidade na Internet: Cinco Primeiros Passos Essenciais

Privacidade

Vivemos em uma era onde a internet está profundamente enraizada em nossas vidas diárias. Seja para trabalho, lazer ou comunicação, estamos constantemente conectados. No entanto, essa conexão contínua vem com um preço: nossa privacidade. Em um mundo onde dados são o novo ouro, proteger nossa informação pessoal tornou-se crucial. Aqui estão cinco primeiros passos essenciais para garantir sua privacidade online.

1. Use um Navegador Focado em Privacidade

A maioria dos navegadores populares coleta uma quantidade significativa de dados sobre seus usuários. Para minimizar essa coleta, considere usar navegadores focados em privacidade, como o Brave ou o Tor Browser. O Brave bloqueia rastreadores automaticamente e o Tor Browser anonimiza seu tráfego, tornando mais difícil para terceiros rastrearem suas atividades online.

Sudo com Touch ID no macOS

Configurar o sudo para usar o Touch ID no macOS Sonoma em apenas alguns passos é muito fácil.

Localize o arquivo /etc/pam.d/sudo_local.template e faça uma cópia conforme o exemplo abaixo:

sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local

Em seguida, edite o arquivo e remova o caractere # do início da linha 3, ele deve ficar assim:

# sudo_local: arquivo de configuração local que sobrevive a atualizações do sistema e é incluído para sudo
# descomente a linha a seguir para habilitar o Touch ID para sudo
auth sufficient pam_tid.so

Passos detalhados para editar o arquivo

Para editar o arquivo, use um editor de texto como nano ou vim. Por exemplo, com o nano:

Sudo with Touch ID on macOS

Setting up sudo for use with Touch ID on macOS Sonoma in just a few steps is very easy.

Locate the file /etc/pam.d/sudo_local.template and make a copy as shown in the example below:

sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local

Then edit the file and remove the # character from the beginning of line 3, it should look like this:

# sudo_local: local config file which survives system update and is included for sudo
# uncomment following line to enable Touch ID for sudo
auth sufficient pam_tid.so

Detailed Steps to Edit the File

To edit the file, use a text editor like nano or vim. For example, with nano:

Ferramentas para uso diário

Eventualmente me perguntam o que eu costumo usar no computador em meu dia-a-dia, então decidi escrever esse post, assim registro o que uso atualmente afim de poder comparar com o que estarei usando no futuro.

Eu sou uma pessoa de hábitos simples, então diferente de muita gente que escreve posts como esse, eu não tenho fogo no rabo e saio usando tudo que vejo pela frente, sendo assim, segue a lista.

Tools for Daily Use

Every now and then people ask me what I usually use on my computer day to day, so I decided to write this post, recording what I use right now so I can compare it with what I’ll be using in the future.

I’m a person of simple habits, so unlike a lot of people who write posts like this, I don’t have ants in my pants and go around using everything I come across. So here’s the list.

Install lxml on MacBook with Apple Silicon

pip install error when installing lxml

Today I needed to install lxml into a python project I’m working on my local machine, but I got the following errors when xmlsec, that is a library dependency, was being installed:

Building wheels for collected packages: xmlsec  
Building wheel for xmlsec (pyproject.toml) … error  
error: subprocess-exited-with-error  
× Building wheel for xmlsec (pyproject.toml) did not run successfully.  
│ exit code: 1  
╰─> [13 lines of output]  
running bdist_wheel  
running build  
running build_py  
creating build  
creating build/lib.macosx-13.0-arm64-cpython-310  
creating build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
copying src/xmlsec/py.typed -> build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
copying src/xmlsec/tree.pyi -> build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
copying src/xmlsec/**init**.pyi -> build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
copying src/xmlsec/constants.pyi -> build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
copying src/xmlsec/template.pyi -> build/lib.macosx-13.0-arm64-cpython-310/xmlsec  
running build_ext  
error: xmlsec1 is not installed or not in path.  
[end of output]  
note: This error originates from a subprocess, and is likely not a problem with pip.  
ERROR: Failed building wheel for xmlsec  
Failed to build xmlsec  
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects

So to install it, on my MacBook machine with Apple Silicon and macOS Ventura, I needed to execute the following commands:

Enabling Click and Drag on MacBook

I’m using macOS again, and of course that I’ll forget this tip, so I’ll write this post to help me another day in the future.

If you want to enable the click and drag option on MacBook, just go to: System Preferences → Accessibility → Pointer Control → Mouse and Trackpad → Trackpad Options → Enable Dragging.

Bug estranho na integração do Mac OS X com o Google

Recentemente aconteceu uma coisa esquisita.

Eu tinha 3 contas do Google configuradas em meu OS X El Capitan, a integração é bem legal porque ao integrar uma conta do Google com o OS X ele já configura o Mail, o iMessage, o Calendar, o Notes e os Contatos o que facilita bastante a minha vida.

Mas ontem todas as contas do Google que eu tinha configurado aqui, ao mesmo tempo, passaram a solicitar novamente a senha e sempre que eu tentava autenticar novamente o Internet Accounts travava conforme a tela abaixo:

Otimizando O Firefox

Para otimizar o firefox, siga os passos abaixo:

1 - Abra o Firefox

2 - digite na linha do endereço : about:config

3 - Clique com o botão direito, new / boolean.

4 - Abrirá uma caixa de diálogo.

5 - Coloque o nome da propriedade: config.trim_on_minimize

6 - Escolher o valor True.

Conforme o autor, o consumo de memória era 62Mb sendo reduzido para 18 MB.

Eu vi essa dica aqui