Donation to Open Broadcaster Software

Two days ago I donated to a project called Open Broadcaster Software aka OBS and I’ll tell you really quickly the story behind my donation.

A few of my friends told that I should record and publish videos of me playing Blizzard’s Heroes Of The Storm. After a while, I decided to try it out but I had no idea how to record the videos.

One of them told me about Shadowplay and the fact that it is supported on Nvidia cards. Since I have one I decided to try it out but unfortunately, it’s not available for my GeForce GTX 560 Ti.

He proposed another solution, which would be to use FRAPS. I had never heard of Shadowplay or FRAPS before but apparently they are well known solutions to the recording problem.

FRAPS

I downloaded FRAPS but the free version only allowed me to record 30 seconds and a game of HOTS is usually around 20min, sometimes 30 if the game is really balanced.

I knew I had to buy FRAPS or find a cracked version. Since I’m a developer myself, I respect my profession and usually try to support projects.

I tried FRAPS but it was super slow! I usually play HOTS with ultra quality graphics and I had to drop to low quality to be able to have 30fps. Also, another thing is that FRAPS doesn’t do real-time compression of the video, so you get HUGE output files of the recording.

My friend’s suggestion was… “Time to upgrade your computer.”

Since I’m a developer and I like algorithms I wondered why a software like FRAPS would be to slow? I would assume that the overhead would be writing the frames to a hard drive but since I have an SSD, that should be a problem.

I have a 1680×1050 resolution screen with True Color 32-bit. Doing the math, 1680x1050x32=56448000 bits for each frame or 7056000 bytes, or 6891 kbytes or 6.7Mbytes per frame. Since I wanted to record 30fps we have to multiply 6.7MB by 30 to get 200MB per second.

Solid-state drive on Wikipedia states the following:

At Cebit 2009, OCZ Technology demonstrated a 1 terabyte (TB) flash SSD using a PCI Express ×8 interface. It achieved a maximum write speed of 654 megabytes per second(MB/s) and maximum read speed of 712 MB/s.

That’s 2009 data but it tells us that our SSD drive should be able to handle 200MB/s easily. I actually have no idea about the writing speed of my SSD and could get that checked but I assumed it was fast enough.

By going to the FRAPS website, they say that they don’t do real-time compression of the video to avoid any extra computation and make it even slower. Sounds fair enough to me.

Anyway, I thought that the algorithms they were using were probably bad or the implementation of those algorithms was bad.

I wanted to prove me wrong anyway because I don’t understand anything about this whole video stuff and was probably missing something.

This is how I find OBS.

Open Broadcaster Software

Since I’m an open source supporter, I Googled for open source fraps alternative and I looked into the first entry “Open Broadcaster Software”. Never heard of it before either.

I downloaded it, checked a YouTube video to learn how to use it really quickly and tried it.

I was AMAZED! Super fast, no lag at all while I was playing and it compressed the video with H.264 and audio with AAC by default.

End result? A full game recording at full resolution and 30fps was around 200MB.

Donation

After recording several videos I thought that the OBS project deserves the price that I was going to pay anyway for FRAPS, so I donated them 33 Euros, the price of FRAPS to help them pay the domain, hosting and hopefully a beer or two.

On the next day I got this e-mail:

Just wanted to say thank you!  You’re absolutely awesome.  Feel free to
email me any time!

I felt really happy to have contributed to someone else’s happiness and I’m blogging about it because sometimes you can make someone happy for a while with small gestures like this one.

Final words

Support the projects you like. 😉

Learning Go

I started learning Go just for fun and since I wanted to blog about the experience I wanted to approach my learning more or less the same way that I learned how to program in C.

I learned C with a book called Elementos de Programação com C by Pedro Guerreiro, which I still consider the best C programming book if you’re looking for something in Portuguese from Portugal. I actually don’t know if the book is available in Brazil.

The most significant difference between the teaching method of this book and other that I’ve seen is that it is “problem solving” oriented instead of just giving you the syntax and really basic examples.

The book starts with a problem like this, translated to English:

We want a program to calculate the score board of drivers of the World Championship of F1, after each grand prize, given the score board before the race and the arrival order of each car after the race. The “before” score board comes in a text file, where each line contains three things: the name of the pilot, the name of the team and the number of already obtained points. The three fields are separated by a comma and there is no extra space. In the score board, all the drivers are present that are enrolled in the championship, even those with zero points so, you can be sure that if a driver is in the race, he’s name will be on the file. The lines are ordered in descending order by the number of points.

As an example, here are the first six lines of the score file before Europe’s Grand Prix 2004:

Michael Schumacher,Ferrari,50
Rubens Barrichello,Ferrari,38
Jenson Button,BAR-Honda,32
Jarno Trulli,Renault,31
Juan Pablo Montoya,William-BMW,23
Fernando Alonso,Renault,21

In each race, the first wins 10 points, the second 8, the third 6, the fourth 5, the fifth 4, the sixth 3, the seventh 2 and the eighth 1 and all others don’t win points.

To avoid problems entering data at the end of each race, instead of inputting the name of the pilot, the number of the car is entered. So, it is necessary to have a mapping between the car number and the driver and for that there is a second file, previously prepared that in each line, contains that information. First the number of the car, followed by a space and then the name of the driver. This file comes ordered by the starting grid so, on the first line, the pilot on the first position, etc. As an example, here are a few lines of that file:

1 Michael Schumacher
10 Takuma Sato
7 Jarno Trulli

The output file with the score after the race has the same format as the initial file. In case two or more drivers have the same number of points, the initial order they had before the race is maintained.

Initial thoughts

It’s actually really uncommon to start a programming book with this style, using what seems to be a problem from those programming contests.

It would be really hard for someone that never did any programming to solve this problem so he starts with a sub-problem of that one, which is to calculate the number of points given the place where the driver finished the race and this is the solution to the problem in Go adapted from the C solution.

// Points in a F1 race; first version

package main

import "fmt"

func main() {
	var place int
	fmt.Printf("Which place? ")
	fmt.Scanf("%d", &place)
	if place == 1 {
		fmt.Printf("Won 10 points.\n") 
	} else if place == 2 {
		fmt.Printf("Won 8 points.\n")
	} else if place == 3 {
		fmt.Printf("Won 6 points.\n")
	} else if place == 4 {
		fmt.Printf("Won 5 points.\n")
	} else if place == 5 {
		fmt.Printf("Won 4 points.\n")
	} else if place == 6 {
		fmt.Printf("Won 3 points.\n")
	} else if place == 7 {
		fmt.Printf("Won 2 points.\n")
	} else if place == 8 {
		fmt.Printf("Won 1 point.\n")
	} else {
		fmt.Printf("Didn't win points.\n") 
	}
}

If you’re familiar with mainstream imperative programming languages you’ll probably immediately notice the absence of semicolons and parenthesis around the if conditions.

Avoiding repetition

From a software craftsmanship point of view, that solution has some room for improvement. The first one that is mentioned and the one that probably comes to your mind also is the duplication of Printf statements, just because the number of points changed.

Even though this looks like a simple problem, a really complex piece of software is composed of a lot of smaller pieces of code and it’s very important that those small pieces are simple enough because sometimes those small pieces get too big and not understandable. If you practice with small examples like this and figure out the patterns that will emerge over and over again, you’re on a better path to improving your software craftsmanship skills.

The way the author removes the duplication of the Printf statements is by introducing the reader to the concept of an assignment statement and then the second version comes out like this:

func main() {
	var place int
	var pts int
	fmt.Printf("Which place? ")
	fmt.Scanf("%d", &place)
	if place == 1 {
		pts = 10	
	} else if place == 2 {
		pts = 8	
	} else if place == 3 {
		pts = 6
	} else if place == 4 {
		pts = 5
	} else if place == 5 {
		pts = 4
	} else if place == 6 {
		pts = 3
	} else if place == 7 {
		pts = 2
	} else if place == 8 {
		pts = 1
	} else {
		pts = 0 
	}

	if pts > 1 {
		fmt.Printf("Won %d points.\n", pts)
	} else if pts == 1 {
		fmt.Printf("Won 1 point.\n")
	} else {
		fmt.Printf("Didn't win points.\n")
	}
}

The main function is bigger now, but at least we don’t have all those Printf statements.

Handling multiple cases

The next step is to teach the reader that there is a statement that should be used for handling this multiple cases scenario, which is the switch statement, available also in Go but a bit more flexible. And a third version is presented like this and adapted to Go would be something like this:

func main() {
        var place int
        var pts int
        fmt.Printf("Which place? ")
        fmt.Scanf("%d", &place)

        switch place {
        case 1:
                pts = 10
        case 2:
                pts = 8
        case 3:
                pts = 6
        case 4:
                pts = 5
        case 5:
                pts = 4
        case 6:
                pts = 3
        case 7:
                pts = 2
        case 8:
                pts = 1
        default:
                pts = 0
        }

        if pts > 1 { 
                fmt.Printf("Won %d points.\n", pts)
        } else if pts == 1 {
                fmt.Printf("Won 1 point.\n")
        } else {
                fmt.Printf("Didn't win points.\n")
        }
}

If you know C, you immediately notice the absence of the break statement. The reason for this is that Go’s switch statement doesn’t have fall through by default but instead, if you want fall through you have to use the fallthrough statement, which is much cleaner in my opinion.

Functions

Even though it looks much better now, there is still room for improvement. Right now, the main functions is doing too many things: getting user input calculating the points and outputting the result. You should aim for having really small functions. For example, there is a core concept in the main function that could be refactored: the calculation of points. As the writer of the main function, you don’t need to know how the points are calculated, you just need to know there is a function somewhere that, given a place, returns the number of points.

The author introduces the reader to the concept of functions and refactors the code like this:

func main() {
        var place int
        var pts int
        fmt.Printf("Which place? ")
        fmt.Scanf("%d", &place)

        pts = points(place)

        if pts > 1 {
                fmt.Printf("Won %d points.\n", pts)
        } else if pts == 1 {
                fmt.Printf("Won 1 point.\n")
        } else {
                fmt.Printf("Didn't win points.\n")
        }
}

func points(place int) int {
       switch place {
        case 1:
                return 10
        case 2:
                return 8
        case 3:
                return 6
        case 4:
                return 5
        case 5:
                return 4
        case 6:
                return 3
        case 7:
                return 2
        case 8:
                return 1
        default:
                return 0
        }
}

Look much better now! Definitely an improvement that you can apply to all your software, over and over again.

Reducing the number of cases

Another improvement is the number of cases themselves. Whenever you come across a pattern like this, you should spend some time trying to figure out a pattern that will reduce you the number of cases.

We clearly see that 6, 5, 4, 3, 2, 1 pattern, which could be reduced to 9 – place and looking at those 10 and 8 we can say that it can be reduced

2 * 1 = 2 and 2 * 2 = 4
12 – 2 = 10 and 12 – 4 = 8

so, we can reduced those two also to 12 – 2 * place.

This implies that we should refactor the points() function to this:

func points(place int) int {
       switch place {
        case 1:   
                fallthrough
        case 2: 
                return 12 - 2 * place
        case 3:
                fallthrough
        case 4:
                fallthrough
        case 5:
                fallthrough
        case 6:
                fallthrough
        case 7:
                fallthrough
        case 8:
                return 9 - place
        default:
                return 0
        }
}

Those fallthrough look really ugly but we need them here since we don’t have fallthrough by default.

Fortunately enough, Go’s switch statement is much more flexible than it’s C counterpart and we can actually write it like this, which is much, much cleaner!

func points(place int) int {
       switch {      
        case 1 <= place && place <= 2:
                return 12 - 2 * place
        case 3 <= place && place <= 8:
                return 9 - place
        default:
                return 0
        }
}

The book goes even further by taking advantage of some features of C, like the ternary conditional operator and the fact the there is no boolean type in C, but rather 0 is false and anything else is true but those are not available in Go so we’ll stop here.

Conclusion

I think this example was good enough to see how you can approach learning a language by trying to solve a problem with that language.

The next chapter of the book teaches how to deal with multiple drivers and we’ll have a look on future article.

 

Learning Haskell with Project Euler Problem 1

If you have seen Project Euler before you immediately notice that there are a lot of mathematical problems. Since I want to learn Haskell for being a functional programming language, I think that using it to solve some Project Euler’s problems is a good approach. So, if I find a problem that I might think that I don’t know how to solve it in Haskell, it’s a good candidate to learn a bit more.

The first problem goes like this:

Multiples of 3 and 5
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

First problem: how do we create a list of all natural numbers below 10?

After doing the first lesson in the tutorial on the Haskell website I learned that I can do it like this: [1, 2, 3, 4, 5, 6, 7, 8, 9]

I wish that Java would have syntactic sugar like this! 😀

If I type that on the tutorial’s environment I get:

λ [1, 2, 3, 4, 5, 6, 7, 8, 9]
[1,2,3,4,5,6,7,8,9]:: Num t => [t]

Looks good but we can’t type that until 1000 so there must be a better way. Hopefully we’ll find out soon enough.

Nice, on lesson 3 I learned that there is actually more syntactic sugar for lists and I can type [1..9] to do the same thing. So doing [1..999] will help us find a solution for our problem.

I also learned that there is a filter function that can filter elements from a list. So, now we have the problem of knowing which function can tell us the remainder of a division and how we specify the or operator since we want to say that a number is multiple of 3 OR 5.

A quick Google search tell us that is it rem and the or operators is || which really works:

λ rem 6 3
0:: Integral a => a

So, now we need to create a function that returns true or false depending on a number being multiple of 3 and use it in the filter function.

After doing the tutorial I know that I can do it like this:

λ let multipleOf3Or5 n = rem n 3 == 0 || rem n 5 == 0 in
filter (multipleOf3Or5) [1..9]

[3,5,6,9]:: Integral a => [a]

Which matches what we are expecting. Now we just have to add everything together, which should give us 23.

Searching the documentation, there is this sum function that should work for us.

So, we just need to apply our sum function to the result of our filter.

λ let multipleOf3Or5 n = rem n 3 == 0 || rem n 5 == 0 in
sum (filter (multipleOf3Or5) [1..9])

23:: Integral a => a

Awesome! We got 23 as expected. Now, for the final solution I’ll leave that for you. Should be pretty straight-forward from here. 😉

Lazy Evaluation

Now, one would think that this approach is really crappy since we’re creating a list of 999 numbers just to do this. It’s much more efficient with the imperative approach even though the solution comes out instantly. The memory usage is O(n), which doesn’t make sense for a problem like this, should be O(1). If you’re not familiar with Big-O notation, read a bit on Wikipedia.

The thing is that Haskell uses lazy evaluation, so it doesn’t actually create the whole list, it gives you the elements when you need them. Something like an iterator. So, if you do something like [1..9], it doesn’t create the list of 9 elements but instead will be just an iterator that gives you back numbers from 1 to 9.

 

Code Retreat

Last Saturday I did a Code Retreat for the first time. I had no idea what I was going for and it was actually very nice.

I checked later that day when I arrived home the website coderetreat.org and saw that all code retreats are similar.

The focus of the whole event is to showcase Test-Driven Development and Pair Programming.

Everything circles around solving Conway’s Game of Life using pair programming and TDD.

Since I’m already used to TDD and pair programming, I didn’t learn much for that process but what was amazing was actually the social experience.

Pair Programming

So many different people with different backgrounds there! Some of them just started learning programming and told me that they were fascinated with this TDD and PP thing! It’s crazy to see how the Internet completely changed the interaction and spread of knowledge between programmers.

Test-Driven Development

Every time I talk about TDD to someone they always ask “How can you test something that doesn’t exist.” and my reply is usually something around “You test it assuming that it exists to make sure that it will do what you expect. It will fail at first, since you don’t have code and then you make the test pass with the least amount of code possible. After that you refactor to remove any code duplication, making sure that the test still passes.”

Of course I also had the same idea before knowing about TDD, but October 7th 2009 I bought a book called Test-Driven Development by Example written by Kent Beck and when I started reading it I was all like…

Holy Shit!

Unfortunately, for reasons that I can’t remember, I didn’t finish reading the book at that time, but finished it last month. It’s definitely worth reading!

Pair Programming

Regarding Pair Programming, the first reaction I’ve seen is always the same.

Why would you waste two programmers on the same computer when they can both do code much faster on their own computer?

I also thought the same but after reading Kent Beck’s Extreme Programming Explained – Embrace Change I can say that I’ve seen the light. I think I came across that book thanks to my teacher Vasco Vasconcelos at university when I was invited to do research in compilers in 2004. I don’t remember exactly but I’m almost sure it was him.

The key thing is the word faster. What do we mean by faster? Typing faster? Of course you can produce a lot more typed code with two people on two different keyboards but do we actually want more typed code or quality features delivered to our clients? Since we spend a lot more time actually reading code than writing it, focusing on speed of typing is probably not the way to go.

Summary

If you want to experience TDD and PP, do yourself a favour and join a code retreat near you. You’ll meet a lot of interesting people and hopefully learn a lot in the process.

 

Third month fitness results

A bit delayed, but here are my measurements from June 1st.

May was a terrible month. Very little exercise and I only went to the gym 3 times! Awful! :(

I don’t have much to write this time, the results were almost the same as the last month.

I haven’t been going to the gym still but at least I’ve started doing some workouts at home and running outside. I really think it will help me improve a lot for the measurements of July 1st.

Also, regarding food, this month I have the challenge to eat vegetarian or vegan every day at lunch, including weekends, which will contribute to my path to veganism. Regarding that, I’m a little bit concerned about how my weight will be since I’m not eating meat and of course, the amount of plant based food that I have to eat to compensate for the amount of meat is much higher. I’m really curious about my weight and body fat on my next measurements.

Weight, body fat, etc at June 1st.
BMI, muscle %, etc at June 1st.

Stay tuned!

 

 

Summation of primes – Problem 10 – Project Euler

Today I tried to solve some Project Euler problems just for fun and a really interesting one appeared. I haven’t solved many problems yet but it’s clear that the Project Euler community are fans of prime numbers related problems and mathematical problems in general.

This is one of the problems that really shows that naive implementations of algorithms, even if they solve the problem, might not be that useful.

The problem is the following:

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.

Of course, I immediately thought about creating a sum_primes_below(n) function which would rely on a isPrime(n) function.

It correctly outputted the value 17 for sum_primes_below(10) so my implementation was correct.

I then tried to calculate sum_primes_below(2000000), which took a long time. And by long time I mean, enough time to cook lunch and get back just to find that the output wasn’t ready yet.

I was implementing the solver in Groovy and I was thinking… “Is Groovy slow?”. Since I know C as well, I wrote the solver in C and the solution came after 23m57.324s. I submitted the solution to Project Euler and it was correct.

As a software engineer, I’m not happy with a solution popping out after 24min so I thought about what could be going on since my algorithm was feeling all like…

 

Since the sum_primes_below() function was so simple, clearly, the bottleneck was in the isPrime() function.

My implementation was super straightforward without much thought put into it since it worked perfectly for previous problems that required working with prime numbers.

If you search Google for prime numbers you immediately get the following:

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number.

So, my function was just going through all the numbers from 2 to n-1 checking if the remainder of the division was zero or not.

Clearly, that wasn’t a good algorithm so I read a little bit more about it.

This is what I learned:

If a number n is not prime, then it can be written as a product of two numbers a and b bigger than 1, like n = ab (of course I knew this, but didn’t think about it).

What was really surprising was the following secret that I really didn’t think about. Of course it’s not a secret, but you need to call something a secret to grab the readers attention even if something is known by a lot of people out there. 😀

If n is a natural number, then lets say that x is the square root of that number and if x is the square root of n, we can write n = ab as xx = ab.

Now, only three things can happen:

  • if a = x then b = x (pretty obvious)
  • if a > x then b < x
  • if a < x then b > x

How can this help us? It tells us that either a or b must be less than or equal to the square root of n.

This proves that we’re guaranteed to find a factor of n just by searching until x.

Is this that relevant? I’m an engineer so I need numbers…

Coding the isPrime(n) using sqrt(n) as a limit instead of going until n-1 reduced the running time of the algorithm from 24min to ~3 seconds.

#perfmatters

 

Conclusion

That thing called square root that we learned when we were kids can actually be used for something!

Teaching of math is completely disconnected from its actual application so it makes people usually hate it for its complexity and apparent irrelevant importance.

Hopefully one day, math will be taught along side programming and real world problems. :)

 

7 Day Yoga Challenge

Two or three weeks ago I came across the Sara Beth’s YouTube channel and started doing some routines once in a while. I saw that she had a 7 Day Yoga Challenge which consisted of 15 minutes routines, one for each day of the week.

The reason why I started doing Yoga is because I have hyperlordosis, spend many hours per day seated in front of the computer and I usually commute by bike. My flexibility is the worst ever. Something like -10 from 0 to 100.

I tried doing the challenge, starting on a Sunday but failed on Wednesday and didn’t continue doing it. The next Sunday I started again and was able to finish the challenge yesterday. I’m very happy that I could do the 15 minutes of Yoga every day for 7 days in a row.

Now I’m feeling all like…

Depending on your flexibility, you’ll find different days easier or harder. For me, most of them were hard, specially Friday and Saturday.

The reason why it was so hard is that the mat I was using is very think and spongy and super slippery on my laminate floor. Which means that in postures were you need to stand on one foot it gets really unstable and, because of the laminate floor, when you have to flow those postures, it gets really hard because the mat is always slipping.

I actually bought a new mat which is much better and I’m going to write about that in a future post since I realized that you should really buy a decent mat because it might make your Yoga experience completely different.

Sunday – Slow Strech Restorative Yoga Routine

Monday – Morning Vinyasa Yoga Routine

Tuesday – Heart Opening Hatha Yoga Routine

Wednesday – Power Yoga Workout

Thursday – Twists & Rinse Vinyasa Yoga Routine

Friday – Feel Good Hip Opening Hatha Yoga Routine

Saturday – Strong & Balanced Power Yoga Routine

Let me know in the comments below if you did the challenge and what you thought about it. It’s really improving my posture in general and my back is definitely improving!

The Path to Veganism

Yesterday a friend of mine sent me a video of this guy called Gary Yourofsky. I had never heard of this guy before and I still haven’t done any research on him yet.

The video has Brazilian Portuguese subtitles but the talk itself is in English. If the subtitles annoy you, feel free to find a version without subtitles.

Last year I did a course on health and nutrition on Coursera called Nutrition, Health, and Lifestyle: Issues and Insights. I finished the course and I felt that I learned a lot about nutrition and health in general, specially since the course is based on scientific evidence with references to the scientific resources. If you want proof that I finished the course, here it is.

After doing that course I learned that there is a lot of scientific evidence that shows that eating meat is not good for humans, specially red meat.

Because of that course, on my new year resolutions I’ve set the goal of trying to eat one vegetarian meal per week for the whole January 2015 and if I was successful I would increase one meal per week each month.

In January I succeeded with my goal, on February I was going to try 2 meals per week but I failed. The reason why I failed is because I eat meat on almost every meal and I actually forgot about my goal. I tried harder in March and did it and, as of today, I’m being able to keep my 4 veggie meals per week goal. :)

Since I did that nutrition course and after seeing that talk yesterday, I believe that going Vegan makes 100% sense but, at least for me, it will take a long time to achieve it. I’m not radical and my cooking skills are very basic so moving straight to veganism from one day to the next would for sure make me lose a lot of weight, which is not my goal and would put me in a lot of nutrient deficiency. I prefer to take it slowly and step after step remove animal products from my diet.

No Cow Milk
One of the things that I achieved last month was stopping drinking cow milk. I started the goal of not drinking cow milk after reading this article, it didn’t even had anything to do with veganism. It was 7 week process. Each week I added another day without milk. I actually felt much better without milk since I felt much less bloated, which, from the research that I’ve done until now, it means that I might have some degree of lactose intolerance, which affects 50% of Hispanic people (I’m from Portugal) according to that same article. Since I felt much better without milk but didn’t know if it was just a coincidence, I added milk again every day to my diet as was usual and the bloating started again so I assumed it was because of the milk so I stopped milk completely and I never felt bloated again.

Usually, like most people, I don’t think about the suffering that is caused to cows during the extraction of milk and all associated procedures. That talk made me think more about it and made me more concerned about them. So, I feel better that I’m not contributing anymore to the cow milk industry but I’m not a hypocrite to walk around saying that I care about animals because, most of the time, I don’t think about it. I always get up to kill that mosquito that is bothering me at night and I vacuum the little spiders and their webs. I consider hypocrisy those people that are against bull fighting because of animal suffering for example, which is very traditional in Portugal and Spain for example and they continue to drink cow milk and eat cow meat and have leather bags, which were also achieved through animal suffering most probably, but I totally understand that ignorance is bliss and people prefer not to think about where things come from if it tastes good or makes them feel good.

No Vegan Label

One of the things that I won’t put in myself is the Vegan label even if I achieve that ultimate goal. Just like those people that turn vegan and try to convert everyone because suddenly it’s the cool thing, just like Crossfit for example, and the combination of both is like…

Goals for the future

So, on my path to veganism, I first prefer to achieve vegetarianism. I’ll continue removing more meat from my diet and find appropriate replacements which will make me feel healthier and give me enough energy for my workouts and life in general.

 

 

Portal 2

In on of my previous posts I wrote about Portal and now I’m writing about the sequel, Portal 2.

I think Portal 2 is the best game I’ve played so far. It’s amazing and super original! It has a 10/10 rate on Steam, which is not to be discarded. If you’ve never played this game, stop every game you’re playing now and play it.

Even though I only played it a couple of months ago, it’s a 2011 game. The game mechanics are similar to Portal but with some new environment changes in some levels. It’s a much longer game than Portal, much, much longer! Let’s say that Portal 2 is a proper game and Portal feels more like a demo.

Chell in Portal 2
Chell in Portal 2

In Portal 2 we continue playing as Chell trying to solve our way through the puzzles. I hate spoilers so I won’t spoil you either about Portal 2. If you want spoilers you can easily find them on YouTube or Wikipedia.

You’ll find very challenging puzzles to solve in this sequel and new interesting things added to them that will make puzzle solving super fun!

Cooperative game

Portal 2 has a cooperative mode, which I have never tried but some of my friends told me that it’s super fun! Basically, you can play with someone else to try to solve the puzzles together. Maybe I’ll try that some day.

What’s next?

Gordon Freeman in Half-Life
Gordon Freeman in Half-Life

Since Aperture Science was competing against Black Mesa in portal technology, now I have to drop Chell and become Gordon Freeman and try to solve the puzzles in Half-Life. The game is very old but I still want to finish the game. Actually, I’ve finished Diablo again early this year and it’s a game from 1996. I could actually write about that too.

 

I’ll let you know once I finish playing Half-Life. It will probably take a while since I usually play online Heroes of the Storm with my friends from Portugal.

See you next time!

 

Second month fitness results

It has been two months since I got back to fitness and been trying to improve my overall health.

Today I want to share with you my second month results and some thoughts about what I believe I did right and wrong and some of the changes I made and I believe I have to make.

So, first of all, here is the picture I took this morning to the values on the scale. If you compare those to the values of April 1st, there are some improvements that deserve to be analysed.

Measurements after two months
Measurements after two months

Weight went up from 78.3Kg to 79.6Kg, which is not very good but it’s an improvement. I actually weighted 80.3Kg one week ago but I didn’t eat properly in the last couple of days so my body reacted really quickly to that. But, as I usually say, a small improvement is better than no improvement. Continuous small improvements over time add up really quickly. Even if I gained just 1Kg per month every month, after 12 months I would have 12Kg more, which is a really big body transformation. I believe that small but consistent is better than quick and not sustainable. I don’t care about quick results, I want to gradually change my daily habits so that all this fitness stuff becomes natural to me.

Let us analyse what happened to see where that weight came from.

Measurement analysis

Body fat went down from 20.7% to 17.8%. What does that mean?

20.7% of 78.3Kg = 16.2Kg
17.8% of 79.6Kg = 14.2Kg

Which means that I’ve lost 16.2Kg – 14.2Kg = 2Kg of body fat.

Weight went up and I’ve lost 2Kg of body fat? I must be Neo bending the Matrix and defying the laws of physics!

Matrix

This is the main reason why it is so important to know your body fat percentage! And I can’t stress this enough!

Even with all the information out there it is very strange to see so many people (specially women) worried and getting crazy about their weight when they should be caring about their body fat.

Do you think a girl with 157cm tall, 56Kg with 30% body fat will look the same as a girl with exactly the same height and weight with 18% body fat will look the same? They’ll look completely different!

I can give you an example of a friend of mine which I’m trying to motivate to lose weight. He was 151.1Kg three weeks ago and after one week he was 151.0Kg and he was very disappointed with his results since he’s trying to lose weight. I immediately asked him what was his body fat % and what’s it now. He replied that it was 53.5% and now it was 51.5%. So, if you do the math, he lost 3Kg of body fat! Losing 3Kg in one week is not bad at all! He immediately felt much better since 3Kg is much better than 100g. Last week he was already below 150Kg and I’m really happy for him. In one year he’ll be all like…

Iron Man

Am I really bending the Matrix? Someone might argue that I’m not, but I’m an engineer so I need numbers.

Let us analyse the water in my body, specially since I’m using creatine, which increases the amount of water in the muscles. I can talk about creatine in a future article.

57.9% of 78.3Kg = 45.3Kg
60.0% of 79.6Kg = 47.8Kg

So, I went from having 45 liters of water in the body to having 48 liters, which is a 3Kg increase. Gained 3Kg of water, lost 2Kg of fat so, in the end, I just gained 1Kg in water, which makes sense to me since I’ve been drinking more water, even though not as much as I should.

It looks like I’m not bending the Matrix after all. Physics laws are still valid.

Cat drinking water

 

Workout

What was my workout at the gym? None! It’s a shame that I didn’t go to the gym a single time! :(

I actually went there to pay for another year and, just out of curiosity I asked the girl “Can you check when was the last time I was here?” and she checked in the computer and replied “In September! That’s bad!!!”

Basically I continued with my body weight workouts that I mentioned in my Back to Fitness article and I’m already on the 5th week feeling A LOT stronger that I used to be when I started. Week 5 of all the workouts is really, really hard! And thinking that I’ll be able to do 200 squats, crunches, or any of the challenges makes me feel all like…

Impossibru

Today I’m going to create workout plan for me and let’s see if it works out. I’ll write about it on my next article next month.

Health changes

I read something about this MIT study were cow milk is not good for humans. I don’t remember if it was really MIT but I’ll find out and update this if I find the link.

I used to drink cow milk every single day. At some times even 1 liter per day since I had free milk at the office.

I started a gradual process of stopping to drink milk. One week with one day without milk, next week, two days, etc, until I didn’t drink any milk for the whole week. It was a seven week process and one thing that I felt was that I started feeling less bloated. I know that feeling bloated is completely normal but maybe that’s only because people in general are doing the wrong thing and even if something is not good, if it happens to everyone, it becomes normal.

I actually didn’t feel the need for any milk and I realized that for me it’s just a convenient liquid to have at home to eat cereals with for example.

I started drinking cow milk again and the bloating effect came back. I can’t tell you if it’s just a coincidence or if it’s really the milk. I might be even lactose intolerant for example and I don’t even know about it.

Conclusion, no more cow milk for me.

Eating less meat

I did a nutrition course in Coursera and one of the things that was obvious from that course is that there are a lot of scientific studies that show that eating red meat is not very healthy and should be avoided.

I used to eat meat twice a day, both lunch and dinner, every single day. An occasional fish from time to time but I wanted to try to see what happened if I decreased my meat consumption.

I started in January with the goal of eating one vegetarian meal per week. Success. I tried two meals per week in February and failed. I’m so used to eating meat that I didn’t remember about my veggie goal! In March I tried two meals again and succeeded and this month I tried three meals, also with success.

My general opinion about the results is that I feel a lot less sleepy after lunch, which is good since I want to be as productive as I can be at work. The bad thing is that I get hungry a lot faster, probably because the food is much lighter and digests much faster. Having fruit around helped me a bit to remove the hungry feeling but I need to improve on that.

Conclusion

This is getting kind of long and I think I should have split this up is several articles so I’ll stop now and just summarize the main changes.

  • Weight increase from 78.3Kg to 79.6Kg
  • Body fat decrease from 20.3% to 17.8%
  • Cow milk might not be good for me (I’ll research this further)
  • Vegetarian meals make me feel much better after lunch
  • Should drink even more water!