Brief history of time

en in tech

In case you want to learn something what is not easy to read, but interesting in the same time, I can recommend book Brief history of time by Stephen Hawking. I learned a lot about our universe and time. And even more I learned how much we don't know.

It's amazing how philosophers could philosophize about the meaning of life and so, because science was simple. There was us, on the planet, flying around the Sun, in some galaxy.

Now, now it's a lot of math. As Hawking wrote in the book, nowadays only a few people can understand that complicated math in the background of everything, without simple explanation for the rest of us. It will take time to find still missing ultimate theory which can be simplified for all of us.

There is very good quote:

If you can't explain it simply, you don't understand it well enough.

-- Albert Einstein

The best scientist still struggles. And this book is the best you can get to understand at least little bit what scientists are trying to achieve.




Relationships and salsa

en in dance

Salsa is a special place. Non-dancing people have problems to understand that. They are afraid their dancing soul mate is cheating on them. I don't blame them. :-)

Not because we do. Well, of course, there will always be someone like that. But because we act like we do.

I was kind of flirting with all girls I was dancing with. And many of them were flirting with me as well. I didn't tell them anything about whom I'm dating and girls didn't tell me neither.

All my friendships were very weak based on that innocent flirting. Supposedly to help keep friends around to have many people to dance with.

Do you recognize yourself in that as well? :-)

I remember once how my girlfriend kissed me before we entered the party in Paris saying “last kiss so you are not embarrassed and can dance with anybody”. Or something like that.

Well… now I understand it wasn't for me, but for her! Now, because I stopped being afraid to admit I have a girlfriend. Guess what happened. All girls told me after that they have a boyfriend as well.

I think for some girls it has to be a big relief. For me it was amazing. Thanks to that I can discuss with my friends anything and it's more honest. Friendship then can be better. :-) At least mine is.

It's better, but I will not tell you who is my girlfriend anyway. Because, statistically, men don't dance much with a girl when they know she has a boyfriend (edit: mostly on festivals than local parties as I heard that from friends on festivals). Not sure if it's because of habits or absence of sex opportunity for that night…

I know one thing, guys can be honest with a profit. Girls have harder situation and I wish we could dance without a need to flirt all the time.




Nginx X-Accel explained

en in code

My team was working on CMS solution based on Django and we needed to have private files. Those files are also video files which we would like to stream to HTML5 player. Problem was, Django is not nginx or apache. It's even wrong to want it. We were sad our private files are served slowly without streaming feature and actually not working in every browser.

Because of the last issue, we were forced to look for a solution and we were surprised it has been fixed long time ago with a very sexy solution! In nginx, it's called X-Accel, but usually you can find it as X-Sendfile.

Because I didn't know about it before and wasn't able to set it up correctly for the first time, I decided to share it with you. :-)


It's just new section in nginx and special header in your application. Usually without this feature, you would set up a handler in your app, check permission and return data directly. With X-Accel, you don't return data, but special header.

Let's say you want to have two URL in your app, /media for public media and /smedia for private media. Then in your nginx you will need usual section for public media, and two new sections for private ones. /smedia is visible outside and headed to your app and /pmedia is visible only internally thanks to internal configuration.

location /media/ {
    alias /data/media/public/;
}

location /smedia/ {
    include /etc/nginx/uwsgi_params;
    uwsgi_pass unix:/var/run/app/uwsgi.sock;
}

location /pmedia/ {
    internal;
    alias /data/media/private/;
}

Now you need only to update your app to not return actual data, but header with /pmedia location. When nginx finds in the response X-Accel-Redirect header, it will use this new location. Because this new location is returned from the (internal) app, it will allow to use also internal locations.

For example, in Python with a Flask it could look like:

@app.route('/<file_id>')
def serve_private_media(file_id):
    # check access to the file
    response = make_response()
    response.headers['X-Accel-Redirect'] = '/pmedia/path/to/file'
    return response

Note that path is starting with /pmedia and then the path is relative to the root of the directory with private data, in our example to /data/media/private/.

And that's it!




T. G. Masaryk

en in life

I read mostly educational books which I don't read cover to cover, word by word. My reading is probably more scanning than reading. It's very good for this kind of books (as you only read when you don't understand or it doesn't match what you expect to be there), but it's a very bad habit for any other types of books.

I don't remember the last time I enjoyed reading every word of the book. It has to be a long time. But finally it happened again with a book Talks With T. G. Masaryk. Not sure if it's so good in English as well, but I want to let know also people outside the Czech Republic because not only the form of writing is good, content is very good as well.

It perfectly describes how it looked like here, in Czech Republic, before and during the First Czechoslovak Republic. Actually, not only here, but also around. At least the relationships between countries and people.

It's not uncommon to hear people complaining how bad it is nowadays. How it was better before. Well…

A lot is better now. We have plenty food. Books. Books in our language. All available in our pockets. We don't know what is war.

And much more is the same. Many times I heard it's better to travel these days, but people were traveling a lot before as well. Even 100 years ago people were complaining about cities and that countryside is better. Problems with the equivalence of women are the same, kind of.

But sure, something is worse as well. Looks like people knew more languages than today.

For me is also interesting how he saw America or Russia. Americans had practical optimism. Russians had disgusting politics, but very kind people. Masaryk said we should learn from everyone. Including ourselves and our history. Well, the same can be seen today and we learned nothing!

Or the importance of religion; how church and traditions helped to country life. Also politics; why we have so many parties when America have only two. Thoughts about communism and where it can be used (only in family or small friendly town).

And about life. How important is to have a life rich of events and inner progress. So read this book as this one is really good. :-)

BTW about the First Chechoslovak Republic exists great encyclopedia! (This one only in Czech, sorry.)




Cute features

en in code

I produced a lot of code. A lot. I tried very hard to make all that code nice. Several times I was doing some cute features. Parts of the code which are not needed for the required result, but feels right. Or cool. Many times in those cases I regretted that after.

The cute feature could be:

Today isn't New Year, but I'm taking resolution regardless:

I will not do any cute feature again!

Only constant is that requirements mutates. I will try harder to keep the code easy to change, not overengineer stuff, and not trying to make it nice as much as possible.

I recommend you the same but I understand you need to come to this point alone. :-)




Tale of Two Brains

en in life

I wanted to be alone. But one girl disagree with me. She is trying very hard so I can love her. She is using a lot of dark magic! Many of them are explained in the following seminar. It's very good seminar. I'm not sure why she wanted to watch it together as I know now her secrets. :-) Anyway, I learned a lot and I recommend it to anybody. Doesn't matter if you are single or not. <3

(In case video is not available, search for Mark Gungor, Tale of Two Brains.)


It's fun, find a time to watch it. No excuses. If you have excuses anyway, or you want to remind what's there, there are my notes:


Yeah… my notes are intentionally boring. Watch the seminar!




Rewrite stuff

en in code

If you want to learn a programming language or concept or framework, rewrite stuff. It's simple as that.

I started with HTML. Then I discovered CSS, I rewrote my stuff. Then I learned PHP, I rewrote it again. PHP imports, again. Database. JavaScript. JavaScript prototypes. Python, whohooo, happyily to do it again! Python classes, again! Python metaclasses! I tried Ruby. I rewrote it to Python again. Haskell. Functional world is different then I thought, again. Monads. Monads are cool! And so on.

I learned everything by trying new language or concept, fail to do it right and then do it again, more properly.

In the last weeks, one colleague wanted some small help to learn pytest. I gave him some basic ideas first. I didn't think of all the details properly, my mistake, and the result wasn't perfect. He had to rewrite it again. But he was glad as he could understand pytest much better!

Also, I have new colleague learning to be a computer programmer. I let her to write some code in very basic Python and then I showed her tips how to improve the code. So she can better understand what higher level does. Hopefully. :-)

So, don't be afraid. Rewrite stuff.

In the end, writers do the same thing! Without that hardly anything would be readable.


Hm. I didn't rewrite this post. Well, don't listen to me! :-D




Let's dance during the day

en in dance

Last week I wrote about the need for new types of salsa events to have better diversity. To have more amazing places to learn and even more awesome places for social dancing. Problem is, it's not going to happen anytime soon. When I discuss this topic with friends, it's something really missing. I would love to have some “social weekend” without waiting. Also, I want to have proof it can be really good.

Well… let's do it now!

All my friends (and future ones as well), let's sabotage the night parties at festivals where is social during the day.

For example, I'm going to Šibenik, Berlin marathon and Heidelberg marathon in next few months…

In Šibenik I purchased parties, but I will try to not attend them. I will start with a lunch, swimming and then I will be available at the hot spot. After hot spot I will go again into the water or take a shower and have a dinner. After dinner some fun and I will go sleep soon. In the morning I will get up at half past six, eat a little bit and attend end of the night party which will be already outside. And repeat again.

At followings marathons I will come early, be there the whole day, not leaving after dinner (to sleep as many people usually does to be able to dance during the night), and will leave before midnight to sleep normally. I will dance same amount of hours as others, but without salsa lag, with more space and with the slower songs (as is usual during the day).

My friend Anne (hi!) already does that. My girlfriend Lenka (hi!) began that during the last Prague's marathon and she was more than happy! Other friends promised me they will do that with us as well.

Will you join us?

I have mostly girls on board. We need some men as well. :-)

Let's prove it's possible!

If it will go well, I will try harder to convince someone to prepare salsa event like we like it. Would be great if you would do that with me as well, but with organizers around you.

Or, hell, I will do a social weekend myself!





Cyborgs

en in tech

I was thinking how I could help the World if I would be sent back in time. Let's say I would invent a time machine by accident and send myself 100 years back. Or 200 years. Or even a thousand years back. Would I be even able to survive at least for a day or two?

I don't know. I know that I know many things. But almost all of them are not much relevant for a year 1018. It's useless to know how to create web apps when I'm not able to create whole computer and network.

And it's ok. We are living in a time when everything is in books and on the Internet. That Internet is with us everywhere. Instead of learning all details we need to learn only how to analyze the problem and know how to find answers in sooo many available resources.

Thanks to all that knowledge and improvement in technology, we can live in cities and enjoy many possibilities. We can enjoy the life without need to know all details and without hard work on the field. At least those who can release themselves from the technology, paradoxically.

Maybe you don't want to accept it, but we are changing a lot because of that. I believe many of us would have a lot of challenges just by going to live back outside the city, to the country. We are adapting to the city life with the Internet available everywhere.

But… we are not able to keep up. Everything is changing rapidly. There are many things happening around. Not mentioning our body. Our body is not meant to live forever. Healthcare helped a lot to prolong our life, but we are hitting the limits.

Many people say AI will rise and replace us. Well, I don't think so. It's a very long way away. Sooner we will be able to fight back. Kind of. Because sooner we are going to be cyborgs. It's not going to be AI vs. humans. It's going to be marriage.

Actually, it's already happening. Many scientists are exploring many ways how to extend our body. There is also the first person who can feel mechanical leg. Well, cyborg.

Many companies are trying to come up with a good AI for many problems. The biggest fields probably right now are autonomous cars and voice assistants. It's just a matter of time when this still primitive AI (but with great capabilities anyway) is going to be used in mechanical parts of our bodies.

To sum it up: we were not able to live without books. Then we were unable to live without cities. Not long ago we added to the list the Internet. And soon we will not be able to live without body enhancement. Doesn't feel like natural progress, but looks to me like inevitable progress.

You know, we are on this planet only very small fraction of the time. It makes sense we are evolving to match a new enviroment. Hell, maybe one day our bodies will have a port to be able to connect to the mother nature board like in Avatar!

Then it will be even harder to go back in time. Maybe that's the reason why nobody came back. At least we don't know about it. But I suspect Leonardo da Vinci is from the future. I'm always amazed what he was able to achieve in his time! He had to cheat! :-)




We need new types of salsa events

en in dance

Not long ago I wrote about how I see salsa community. It's a good idea to read it first if you haven't already. I will wait. :-)


I said on2 community is kind of serious competitive VIP community. In a feedback, few people agreed, more had some issue. Mostly because it's different in their location. As I said, I'm located in Europe, specifically in central Europe, and I have experience mostly from festivals in Europe, with trips to Russia and New York (which was very different, but also brief).

Anyway, I think one of the problems is lack of good salsa events for people seeking to enjoy the dance and the music. In Europe are many festivals, but almost all of them are not very good for social lovers. I'm not saying all those festivals are bad. In the end, everyone of us has different taste. I want to say, we need to improve diversity.

First, I will try to make a list of what a social dancer (like me and my friends) likes:

Just to be sure: if you like, for example, to dance from 3 till 8 am and drink a lot of alcohol, it's all right. Visit almost any festival and you are fine. Not everybody does, though.

So, let's begin with…

Relay race

We have marathons which meets everything but late hours. We don't want to have salsa lag. So why not to try relay race. Those who love to dance during the night can dance during the night, I will happily dance during the day!

Ok, this is a crazy idea. :-) Now, really…

Sprint

I heard this one from a friend of a friend. Just one or two hour long party and dance as much as possible. Another response to marathons. Ok, again, this one is not meant to be serious. :-D

Anyway, I tried this concept lately at after party of Prague's salsa marathon. Also at regular local party as I have a lot of other things to do as well lately. It's a lot of gym. A lot. But it was also fun. It could work sometime!

TBA

I don't have the name for this one. It could be a day marathon. Or half marathon. Probably I prefer social weekend. Social fun could also be the name.

The concept is this: it starts in the morning, sometime like 10am, and the last beat of the last song ends at midnight (or even sooner! definitely not later). It would be partly inside and partly outside so dancers could have fresh air during the dance. Cocktails with umbrellas. Water. No rush.

Sorry, I started to dream about salsa festival in Šibenik, two years ago, with a tent, during the day instead of night. Yeah, that would be perfect!


Soo… I think event of type TBA (Todos los Bailes con Amor? :-)) is concept missing right now. From my point of view, it's the future. We need to have more of “marathons” and unlock them for everybody. We need to share our joy of dancing with anybody. Not just with each other.

Non-dancing people don't understand to all night long dancing and all day long sleeping. New faces have to be allowed to experience this joy of dancing as well. We shouldn't hand pick dancers. Maybe it can work in tango marathons, but salsa is different. Let's share our passion. Then our salsa community can grow again.

We have a lot of festivals focused on learning fast and complicated patterns and for the night animals. That's good. Also, there is Mamboland, a great new concept for learning. But now we need also places to dance. Socially dance. With a smile. Having fun.


To sum it up, standard festivals are fine, but both workshops and parties are mostly average. We need more festivals like Mamboland to have amazing places to learn amazing stuff. And more festivals like marathons to have the best social dancing possible. Even better to see some “social weekends”.



P.S.: If you want to use some ideas, please do! I don't have the capacity to create my vision of salsa weekends. At least now. Feel free to organize something like that and feel free to use my ideas for the name. Computer programming have the term open source, this is open dance! But don't forget to invite me. That's the only rule! :-)