Author Archives: Juan Lao Tebar

Migration to tumblr

This blog was born with the idea of ​​being a kind of daily journal for my projects. I needed a place to keep track of my progress, annotate resource links that may be helpful or, when appropriate, publish small scripts in HTML/JS to add value to the subject.

WordPress complies well the first two requirements, but it is particularly difficult to get the third, since they forbids any javascript inclusion into the content published by the administrator of the blog. The content can’t contain <script> tags, href=”javascript:…” or onclick attributes; and iframes are not allowed, of course.

I have not studied the subject thoroughly, but my theory is that wordpress deliberaty bypasses the Same Origin Policy to maintain logged their users through the different subdomains and, to avoid XSS problems, they forbid the inclusion of javascript.

Anyway, I tried to bypass this protection with the following code:

<a href=”data:text/html;base64,PHNjcmlwdD5hbGVydCgnaGksIHRoaXMgaXMgamF2YXNjcmlwdCEnKTs8L3NjcmlwdD4=”>Click me!</a>

But, unfortunately, wordpress also forbids data URL’s.

As a last attempt, I tried to bypass it again using tinyURL but, as you can see if you use Chrome, the Google browser throws a security exception when the HTTP protocol tries to redirect to a data URL (Error 311 (net::ERR_UNSAFE_REDIRECT)).

Curiously, Google Chrome forbids HTTP redirections to data URL’s but allows HTML redirections to data URL’s through <meta> tags!

<meta http-equiv=”refresh” content=”5; url=data:text/html;base64,PHNjcmlwdD5hbGVydCgnaGksIHRoaXMgaXMgamF2YXNjcmlwdCEnKTs8L3NjcmlwdD4=” />

I sended an email to the tinyURL team asking for this feature –HTML redirections when the target is a data URL–.

While waiting the response,  a friend told me about tumblr. He said that they are less restrictive than wordpress, so I created an account.

And I found just what I was looking for: javascript on posts, javascript on themes, javascript on everything!

Goodbye wordpress, see you in Get Off My Kitchen on tumblr.

Advertisements
Tagged , , , ,

Human nutritional requirements – part 2

I learned a lot about nutrition since my last post. Now I have a clear idea about the energy contribution differences between carbohydrates, proteins and fats; why and how they iodize the table salt; how you can die of an overdose on vitamins; how difficult is to find a good source of alpha-linolenic acid and how can you have a mercury overdose consuming cod liver oil, among other interesting things.

Also, I started working on the script that generates personal Soylent recipes. At the moment, it is able to ask to the user all the necessary data (age, height, weight…) and calculate the daily recommended amount of each nutrient for your personal recipe, according to the Dietary Reference Intake (DRI).

Now I’m working on collecting ingredients and writting their nutritional facts –carbohydrate, protein, fat, vitamin and mineral amounts– in a table. With a huge database of powders and vitamin supplements, it will be easier for the script to calculate the perfect recipe.

Yesterday I discovered the list of the essential nutrients and, for my horror, it seems that the DRI forgets to include the essential amino acids in its recommendation. This means another week of ingredient search, which means another week of delay for my Soylent.

UPDATE: the necessary amounts of essential amino acids was published by the World Health Organization in this PDF, at page 150.

Tagged , , , ,

Human nutritional requirements

The first step to design the Spanish Soylent Recipe is to make a little research about the human nutritional requirements. It’s a basic thing I must know if I don’t want to kill myself with a deficient recipe.

This subject has been studied for decades in order to provide a proper and healthy diet in schools, army, hospitals, etc. After several revisions, the Institute of Medicine (IOM) of the U.S. National Academy of Sciences published the Dietary Reference Intake (DRI), a system of nutrition recommendations. Please, ignore the summarized nutrition table at the wikipedia page and check the official tables instead.

But the problem with these recommendations is that they depend on lots of factors –age, gender, lifestyle and weight among others–. The needs of a sedentary pregnant woman are different from the needs of a male athlete. This difficults the designing of a general recipe destinated to everybody.

Instead of trying to design a general recipe, I’m thinking that maybe I should make an small script to create personal recipes. People will be able to adjust their own params (gender, age, weight, height…) and the script will do all the dirty math job. Also, it can be interesting to adjust some params depending on each one’s nutritionist recommendations.

Mmm… yeah, it sounds like a better idea.

Tagged , , , ,