Este conteúdo não está disponível na sua linguagem... Então se você não entende a linguagem... bem, você pelo ou menos pode apreciar as imagens da postagem, né?

If your PostgreSQL instance is randomly going into recovery mode... Have you checked if your disk is full?

2022-04-26 13:22:24.962 UTC [382] LOG: database system was not properly shut down; automatic recovery in progress

In the past, if my PostgreSQL LXC container disk was full, PostgreSQL would throw I/O errors when trying to write new data to it, so when my instance was randomly going into recovery, I was stumped, what is causing this?

Until by accident I noticed that my disk was dangerously close to full, so I've decided to check if the disk being full could be culprit of why it was going into recovery, and, fortunately, it was!

My theory is that this was a change made in newer PostgreSQL versions. If the disk is full, fsync fails, which causes PostgreSQL to consider that the data is now unreliable and starts restoring the database state from WAL files. Previous PostgreSQL versions were using fsync incorrectly, then changing how it works so, if fsync fails, PostgreSQL will automatically shut down and initiate recovery mode.

Or maybe it is because I migrated my LXC container from a EXT4 partition to ZFS, who knows!

But if your free disk space is suspiciously low after a recover, and you want to be sure that this is what triggered recovery: Create a large file that fits in your free disk space, wait until PostgreSQL tries doing any I/O, and check if PostgreSQL crashes and starts automatic recovery. If yes, then your disk being full is what could have triggered recovery mode!

However, you may be wondering...

If the issue was that there wasn't any free space, how PostgreSQL was able to successfully recover and start up again?

When PostgreSQL finishes its recovery process, a bunch of free space was cleared up, this may be because PostgreSQL was reading data from WAL files, applying them to the tables' data, and then deleting the WAL files, which ends up freeing disk space, and that allows PostgreSQL to continue working until the disk fills up again.

Anyhow, if your PostgreSQL is randomly going into recovery for no apparent reason, don't forget to check your available free disk space!


Este conteúdo não está disponível na sua linguagem... Então se você não entende a linguagem... bem, você pelo ou menos pode apreciar as imagens da postagem, né?

Trying to figure out how to list files from a Java Resources folder is hard, there are tons of solutions on StackOverflow, however most of them are weird hacks and they only work when executing your app via your IDE, or when executing your app via the command line, not both.

Joop Eggen's answer is awesome, however it can only do one of two things:

  • Read the resources content when running from a IDE
  • Read the resources content when running the JAR via the command line

So here's an example (Kotlin, but it should be easy to migrate it to Java) that allows you to have both: Reading the resources content when running from a IDE or via the command line!

    val uri = MainApp::class.java.getResource("/locales/").toURI()
    val dirPath = try {
        Paths.get(uri)
    } catch (e: FileSystemNotFoundException) {
        // If this is thrown, then it means that we are running the JAR directly (example: not from an IDE)
        val env = mutableMapOf<String, String>()
        FileSystems.newFileSystem(uri, env).getPath("/locales/")
    }

    Files.list(dirPath).forEach {
        println(it.fileName)
        if (it.fileName.toString().endsWith("txt")) {
            println("Result:")
            println(Files.readString(it))
        }
    }

StackOverflow Post: https://stackoverflow.com/a/67839914/7271796


Carteiras Recomendadas da Itaú Corretora

Publicado às 19/08/2022 10:20 • #stocks

A Itaú Corretora, como a maioria das corretoras que existem por aí, possui carteiras recomendadas que podem ser acessadas pelo Home Broker deles, assim dando um incentivo para a pessoa a continuar a usar o sistema de corretagem deles e continuar a fazer a pessoa sonhar que, algum dia, ela irá se tornar rica com ações.

Enquanto algumas carteiras, como a Top Five, Small Caps e Dividendos estão apenas disponíveis ao estar conectado na sua conta na corretora, outras estão disponíveis para qualquer um ver e apreciar as ações recomendadas.

É possível encontrar o link dessas carteiras vasculhando pelo Google, mas para facilitar, aqui estão elas!

Carteira URL
Carteira de BDRs https://itaucorretora.com.br/carteira-de-bdrs.aspx
Carteira de BDRs Eleven https://itaucorretora.com.br/assessoria/carteira-de-bdrs-eleven.aspx
Carteira do Grafista https://itaucorretora.com.br/assessoria/carteira-do-grafista.aspx
Carteira Renda com Imóveis - Fundos Imobiliários https://itaucorretora.com.br/carteira-renda-com-imoveis---fundos-imobiliarios.aspx
Carteira de ETFs e Fundos Indexados https://itaucorretora.com.br/carteira-de-etfs-e-fundos-indexados.aspx
Carteira Recomendada - Incentivadas - Debêntures e CRAs https://itaucorretora.com.br/carteira-recomendada---incentivadas---debentures-e-cras.aspx

Este conteúdo não está disponível na sua linguagem... Então se você não entende a linguagem... bem, você pelo ou menos pode apreciar as imagens da postagem, né?

I needed to reload my network interface on the machine where my PostgreSQL database is hosted and, after doing that, my thread got forever blocked on the getNotifications(...) call.

"Loritta PostgreSQL Notification Listener" #261 daemon prio=5 os_prio=0 cpu=48.89ms elapsed=62372.91s tid=0x00007f45f806a460 nid=0xf08b5 runnable  [0x00007f45d6dfc000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.Net.poll([email protected]/Native Method)
        at sun.nio.ch.NioSocketImpl.park([email protected]/NioSocketImpl.java:181)
        at sun.nio.ch.NioSocketImpl.timedRead([email protected]/NioSocketImpl.java:285)
        at sun.nio.ch.NioSocketImpl.implRead([email protected]/NioSocketImpl.java:309)
        at sun.nio.ch.NioSocketImpl.read([email protected]/NioSocketImpl.java:350)
        at sun.nio.ch.NioSocketImpl$1.read([email protected]/NioSocketImpl.java:803)
        at java.net.Socket$SocketInputStream.read([email protected]/Socket.java:966)
        at sun.security.ssl.SSLSocketInputRecord.read([email protected]/SSLSocketInputRecord.java:478)
        at sun.security.ssl.SSLSocketInputRecord.readHeader([email protected]/SSLSocketInputRecord.java:472)
        at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket([email protected]/SSLSocketInputRecord.java:70)
        at sun.security.ssl.SSLSocketImpl.readApplicationRecord([email protected]/SSLSocketImpl.java:1455)
        at sun.security.ssl.SSLSocketImpl$AppInputStream.read([email protected]/SSLSocketImpl.java:1059)
        at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161)
        at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128)
        at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113)
        at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
        at org.postgresql.core.PGStream.receiveChar(PGStream.java:453)
        at org.postgresql.core.v3.QueryExecutorImpl.processNotifies(QueryExecutorImpl.java:789)
        - locked <0x0000000621293410> (a org.postgresql.core.v3.QueryExecutorImpl)
        at org.postgresql.jdbc.PgConnection.getNotifications(PgConnection.java:1107)
        at net.perfectdreams.loritta.cinnamon.pudding.utils.PostgreSQLNotificationListener.run(PostgreSQLNotificationListener.kt:29)
        at java.lang.Thread.run([email protected]/Thread.java:833)

So I went out and tried figuring out if this could be reproduced, and found out that someone had already reported this issue, but it was closed due to "lack of feedback". Anyhow, here's my investigations and explanations to anyone else wondering why their PostgreSQL getNotifications call is not receiving new notifications, even tho it is blocked on the getNotifications call!



Muitas pessoas me perguntam se é possível fazer um bot para o Discord apenas usando um celular... então eu descobri uma maneira de rodar bots feitos em várias linguagens, como JavaScript, Python, Java, entre outros, tudo pelo seu celular!

Perfeito se você quer fazer o seu bot do jeito que bots são feitos pelo computador, como também você não precisa gastar dinheiro para manter o seu bot online... exceto o gasto com energia para deixar o seu celular ligado né rsrs.

Enquanto o vídeo mostra eu rodando um bot feito usando o discord.js pelo Termux, nada impede de você rodar bots feitos em Python, Java, ou em outras linguagens. Basta instalar o pacote necessário da linguagem no Termux, copiar os arquivos da linguagem e rodar!


Muitas pessoas querem um sistema música na Loritta para que possam escutar músicas no Discord sem que precisem adicionar outro bot... mas hoje em dia existem várias limitações e problemas que impedem a Loritta de ter um sistema de música.


Slash Commands: Muitos amam, enquanto outros odeiam e preferem comandos por texto... Mas será que as pessoas que odeiam slash commands são pessoas que usam o Discord para Android?


Se você quer crescer e melhorar o seu bot para o Discord, então você veio ao vídeo certo! Venha ver e aprender os segredos e dicas sobre criação de bots com o Criador da Loritta!

Não se esqueçam de ativar as legendas do YouTube! Enquanto o áudio está em inglês, eu legendei todo o vídeo em português, então não se preocupe se você não sabe inglês. :)

Obrigado a iara e ao resto da equipe do top.gg por terem me convidado ao Bot Developer Panel deles. :3



Aceitar imagens de estranhos não é fácil, você precisa tomar algumas providências antes de editar ela para que o seu bot não trave por falta de memória!

O vídeo foi gravado ao vivo no meu canal na Twitch (https://twitch.tv/mrpowergamerbr) para estreiar o novo ESCRITÓRIO DA FIRMA, me siga lá para acompanhar outras lives (se acabar tendo novas, né rsrs).

Se deseja ver como foi a live de hoje: https://youtu.be/o3MHhjL4rNw