Hidden Meanings in Art

I recently watched the movie I’m Thinking of Ending Things (ITOEF) - I understood none of it. I mean, it was beautiful, but I was unable to come up with any plausible interpretation of what was happening and I found the ones I read on the internet really non-obvious. This annoyed me: what’s the point of hiding the meaning so deep? If the director really wants to make an important point just make it more obvious!...

December 5, 2020

How to "listen to your body"?

It’s the middle of the afternoon and you just came back home after a run. You feel a little hungry. Do you? Maybe it is just gluttony and you really want that banana with peanut butter, although you don’t actually need it. Actually, you feel a little weak and maybe the urge to eat it’s your body telling you you need some sugar. But maybe you are self-sabotaging your low-calories goals with this rationalization?...

December 1, 2020

On Voting

Portuguese presidential elections are going to happen soon and this lead me to reflect (again) on the value of voting and of being engaged with national politics. I have an aversion of having to keep up with what’s new on national news in general and national politics in particular - things move so fast that keeping up with it would be too stressful. But with the presidential elections coming in, I felt motivated to be an exemplar citizen and do a thorough research about all the candidates so that I could make an informed decision on who to vote for....

November 28, 2020

PORDATA - Alojamentos e Condições de Vidas

(Este texto faz parte da minha exploração da PORDATA – uma base de dados relacionados com Portugal) Não tinha ideia de que a construção de casas diminuiu tanto desde 2002. Nesse ano foram construídas aproximadamente 9 vezes mais casas do que em 2019. Adoro este gráfico: A percentagem de agregados com uma arca congeladora subiu ~10% entre 2000 e 2005… e desceu outra vez ~10% até 2010. O que raios aconteceu aqui?...

November 7, 2020

PORDATA - Receitas e Despesas do Estado

(Este texto faz parte da minha exploração da PORDATA – uma base de dados relacionados com Portugal) Algumas curiosidades: O IVA é responsável por uma maior parte da receita do estado do que o IRS, que por sua vez dá mais receita que o IRC. Gráfico aqui: Os próximos dois gráficos vêm daqui. Acção e segurança social é a área onde o Estado gasta mais per capita, seguido de Saúde e Educação:...

October 31, 2020

PORDATA - Library users per year

(This is part of my explorations of PORDATA – A Portuguese open data database) This plot really really surprised me: It shows the permilage of people in Portugal who are library users. Checkout that 2003’s number. An astonishing 82.6% of the population was going to libraries! This sounds too much to me. I don’t think I know anyone who goes to libraries. But I guess that 2020 is a really different world than 2003....

October 25, 2020

PORDATA - Hours of Work Per Week

(This is part of my explorations of PORDATA - A Portuguese open data database) This surprised me: It shows the average of weekly work hours for people who work for some employer (vs. being self-employed). Since the last methodology change (that’s what those dark symbols represent) in 2011 the average diminished by 0.9 hours. There was a decrease in all jobs categories. This happens for both genders: (Dark orange are males, light orange are females)...

October 18, 2020

PORDATA - Marriages per year

(This is part of my explorations of PORDATA - A Portuguese open data database) Here is the plot of total number of marriages per year. Interesting things: Number of marriages per year decreased from ~70.000 in 1960 to ~33.000 in 2019, even though population has increased. Number of marriages per year increased by 20.000 (!) from 1974 to 1975. This is probably somehow related with the fall of the Portuguese dictatorship in 1974 that lead to the immigration of more than 300....

October 17, 2020

Scala: Using circe and newtype to decode JSON with a field with variable type

Here’s one way you can quickly decode a JSON using circe: import io.circe._ import io.circe.generic.semiauto.deriveDecoder import io.circe.literal._ case class Example(id: String, field1: String) object Example { implicit val circeDecoder: Decoder\[Example\] = deriveDecoder\[Example\] } val exampleJsonIdAsString: Json = json"""{ "id": "12345", "field1": "something" }""" val example = exampleJsonIdAsString.as\[Example\] println(example) This prints Right(Example(12345,something)). This all works well if the types of the JSON fields are predictable. But what if you’re consuming some API that you don’t control and the same field sometimes comes with different types?...

September 6, 2020

TIL: Circe JSON decoding for sealed trait hierarchies

import io.circe.generic.auto._ import io.circe.parser.decode sealed trait Thing1 case class SubThing1(a: Int) extends Thing1 decode[Thing1]("""{"SubThing1": {"a": 1}}""") // Returns Right(SubThing1(1)) decode[SubThing1]("""{"a": 1}""") // Returns Right(SubThing1(1))

August 11, 2020