Tomas Heed

Writer • Musician • Entrepreneur

Page 2 of 9

Hella Marathon Nacht, Rostock 2017 – Here I come!

There are some things I would like to do before I die. Some things I just want to see – The Sydney opera house, the pyramids and the mountain city Petra to mention a few. Some things I would like to experience, like flying in a supersonic aircraft, own a Porsche and publish a book. Another thing on my bucket list is to run a marathon.

The returning reader of my blog may know that I already ran Médoc Marathon, but that competition was mostly about having fun and drinking wine. I would like to run a full marathon and feel the sensation of reaching the finish line after 4 hours of hard work. That’s why I have decided to run Hella Marathon Nacht in Rostock.


Continue reading

How to publish music on Spotify

Now my first song ever, Stockholm vs Göteborg is finally finished, and it’s almost time to let you listen to it. It’s really fun and exciting, but at the same time a bit strange and self-exposing that the whole world will take part of my creation. Well, here I am with a .wav-file with my song. How can I insert it into Spotify?

Is there a cost involved and to whom do I turn?

In this blog post I will try to find out what to do next. Come along!


Continue reading

Coding games for beginners – the for loop

Welcome to part two of Tomas Heed’s amateur programming school™ – coding games for beginners. This is where I try to teach my children how to create a game. Last time we talked about how to create sprites and moving figures. This week we will learn about the for loop. To illustrate how the for loop is used we will create a for game.

The for loop

There are a couple of fundamental building blocks that you need to master when you are programming. Today, we will speak about one of the most important – the for loop. With the for loop, you can make the program to do the same thing over and over multiple times.

for(var i = 0; i < 5; i++){
console.log(i + '-your name- is the best!')

The code above will output that you’re the best 10 times in your web browsers console. The console is a small area in the developer tools that you will reach in most web browsers by pressing the F12 button.

Go ahead and try it! Press F12, find the Console tab and copy the text above. Press enter to run the code. Don’t forget to insert your name!

How to use a for loop?

If we examine the for loop a bit closer, we see that it has three vital pars.

for( Initialization of variable; Condition to continue; Increment of variable)

Initialization of variable: Here we create a temporary variable that exists as long as the for loop is running. It can be a string or anything, but in 99 % of the cases it’s an int, short for integer.The declaration var in the example will make the variable an int.

Condition to continue: This is where you tell the for loop how many times it will execute. As long as the condition to continue is fulfilled the for loop will continue to run. You have to be careful when you create your condition, or the for loop will go on forever.

Increment of variable: This is a command that is executed every time the for loop has completed a cycle. The increment is performed before the condition to continue is evaluated. Most of the time, you just increase the value of the integer that was initialized in the first part. But you can do whatever you want here, like add an exclamation mark to a string.

So, our example above:

for(var i = 0; i < 5; i++)


for (start from zero, continue five times, count up);

If you want to take it to the extreme, you can write like this. Skip the initialization and add an exclamation mark to a string until the string is 30 characters long.

var s = '-your name- is the best';
for(; s.length < 30; s=s+'!');

Break and continue

On occasions you want to interrupt the for loop before it’s done all the iterations. Then you use the command break. Break invalidates the condition to continue and tells the for loop to stop running. The following code will write the text three times only.

for(var i = 0; i < 5; i++){    
if(i >= 3) break;
console.log(i +  '-your name- is the best')

You can also make the loop skip ahead until the next iteration by writing continue. (Note that I have turned the logic around here. We ar counting backwards from 5 to 0). The following code will write the text 4 times. The value 2 is never written.

for(var i = 5; i > 0; i--){
if(i == 2 ) continue;
console.log(i +  '-your name- is the best')

Coding games for beginners – the for game

By now, my children will start telling me to stop talking. They want some action, and I suspect that you do as well. Let’s look at the for game.

Anyone who has played the fantastic board game RoboRally can imagine what the game is all about. Me and my kids has drawn one Pacman sprite each. Your job is to help the Pacman figure to reach the prize by programming for loops. If you succeed you will get a visual surprise!

The gray plus to the left will add a new row. Press one of the arrow one or multiple times to move the Pacman figure that number of steps. You can also change how many steps the figure will move by clicking the plus or minus button to the right.

Press the Go button when you think you’re ready. You can try as many times as you want!

Good luck!

Quick weight loss diet plan – 10 kg in 7 weeks

I’m finally done dieting! It took me 46 days – just below seven weeks – to loose 10 kilos.

Follow my quick weight loss diet plan and you will get the same results!

Continue reading

Programming games for kids – part 1 – Sprites

The one thing that my children like to do above all else is to play video games. They can sit for hours in front of their iPad or computer and play. When they don’t play themselves they like to watch other people playing on Youtube.

The other day I asked the children if they wanted me to teach them how to create their own game. That really got them started and they wanted to get going straight away! I must admit that I didn’t expect that enthusiasm, so I hadn’t really prepared anything for them. But now I have!

This is part one of Tomas Heed’s game school of programming games for kids. Join in, and you will also soon be able to create games with HTML5 and JavaScript.

Continue reading

Weight report week 6

Yet another week has passed of my diet. I’ve got a feeling that it’s harder and harder to be strict about my diet the closer I get to my goal. So far, I have managed to keep away from sugar. But I have to admit that I have downed a couple of beers during the week-end.

This week I’m going all in. The goal is to loose the remaining 1½ kg during this week.

Continue reading

Weight loss during marathons – Live experiment

Today I have performed a marathon. That’s 42 kilometers. I didn’t run all of it, but the energy needed to move a body is about the same regardless of the speed. So, the question is. How big is the weight loss during marathons?

I have the answer!

Continue reading

Search engine optimize yourself

My name is Tomas Heed and I have a blog that’s all about me. This would probably make me a narcissist, but wait. There is more! Sometimes I google my name.

I write on my blog in an expectancy that I will succeed in all the three areas where I aim – Writer, Musician and Entrepreneur. Since I haven’t done any progress in any of those areas thus far, it’s no wonder that my site isn’t that highly ranked on Google. But there is one thing that bothers me. I have created a blogg that is about me. The site has my name, All the texts are about me. Most of the images has my face on it. But still as I google my name, I only end up in seventh place! (Hey! In the English version I’m actually on row number three)

I have to get to the bottom with this to see if I can get to the top. Let’s try to find how you can search engine optimize yourself.


Continue reading

Weight Report Week 5

I’ve just concluded another week of my diet. To be completely honest, I haven’t been all that zealous this week. I mentioned in my first post about my ascetic diet that I don’t want to be too picky about what I eat when I’m invited to someone. Well, since this was Easter week, we were invited to friends and family no less than three nights in a row. Furthermore, an evil cold efficiently prevented me from performing my exercising duties.

Despite all this I actually convinced the scale to show some negative numbers!

Continue reading

Home Automation with Tellstick Duo, Raspberry Pi

So, I’ve finally entered the home automation area with Tellstick Duo, Raspberry Pi and OpenNetHome.

We have a mobile broadband modem at home with a 4G sim card which works perfectly. We have a stable connection of 25 megabit down speed which is good enough for the family. But once in a while the modem looses it’s connection to the Internet. When it does, we need to walk up the stairs, unplug it, and the replug it.

But not any more! With my new home automation setup I have solved this so that the modem reboots itself, one minute after it looses it’s connection. Read on to see how I did it.


Continue reading

« Older posts Newer posts »

© 2017 Tomas Heed