How to use Cache Headers to speed up your website with Django and CloudFlare

Since I started working at bigger startups, like MinbilDinbil, I had to face the problem of providing pages to a larger amount of users every day. For this reason, it is really important to use a CDN service like CloudFlare, in order to provide a good user experience on our website: we don’t want our clients wait too much to load the homepage! How do we do that? The author of GNU grep once said:

The key to making programs fast is to make them
 do practically nothing

Mike Haertel, Sat Aug 21 2010. Source

So I decided to integrate our django servers with CloudFlare, improving the cache. According to their documentation, to enable the cache, the backend needs to provide specific headers in the HTTP response, like Cache-Control, Expires and others: by using these headers both the browsers and the CloudFlare servers will cache the file for a specific amount of time.

cf-logo-v-rgb

For this purpose, I created an open source customizable middleware to provide cache headers in a smart way. It is called django-smartcc (standing for “smart cache control”). Once installed, it will start considering not authenticated requests as public and disabling the cache when the user is logged in. You can read here the instructions to install it too:

pip install -U django-smartcc

Continue reading

I wish you a private and secure 2015

During the 2014 I’ve learned how much privacy and security are important. Apart from my “nerdy needs“, I started observing my habits, considering who reads what and where my important information are stored online. My bank accounts, passwords, email and some private conversations should stay private and encrypted. Some other information should still be available to somebody as other documents could be read by anyone.

Sometimes we need to keep secrets, secret.
Sometimes we need to keep secrets, secret.

I discovered and I got annoyed by the fact that, in order to provide a “spam-free inbox” or other advertisement service, all my emails are read and scanned by Gmail. I also got rid of Dropbox because after thousand of passwords leaked, I felt bad that some of my documents were stored in a not-really-safe service. So, when I am communicating or sharing things with others, I decided to switch to secure and private channels when needed… including those services that are considering encryption as a serious thing and not just a joke as SSL. So I wrote down a list of suggestions to improve the privacy and the security. Continue reading

My Bitcoin Experience: Wallets and Debit Card

I am in the world of bitcoin since 2012 when I opened my first bitcoin wallet on blockchain.info… and a lot of things changed since that moment: new services, growing communities, new alternative crypto currencies, ATMs, Credit-Debit cards, and a larger diffusion of people accepting bitcoin in their shops.

Xapo Bitcoin Debit Card

After those two years I can see a better view of what Bitcoin means to me and the innovation behind that technology, including Xapo debit card… and some of my friends are tired of me talking about bitcoins :)

How I choose a wallet

Using simple words: the wallet is a collection of addresses and their private keys. The address, that is used to receive the money, is a group of letters and numbers generated by the private key, that is required to send money.

Because you must have the private key of your address in order to sing a transaction, the security level where this value is stored must be high. The default bitcoin client provides a wallet, but is really slow and it must be synchronized and it will take some days…

Continue reading

Impossible means: “harder to make it possible”

Several times, I have heard my grandparents saying “that is impossible” when they are comparing what the young generations do to what they were used to do. According to the dictionary, what is impossible, is “not possible, unable to be, exist, happen, unable to be done…“, but for what I have noticed and experienced, is just a matter of points of view.

Today I saw on this video, comparing the new generation of MacBook Pro with Macintosh Portable, and we can see clearly the difference between those two models, but the main difference is the release date. You have all the rights to say me that I am talking about a trivial thing, but it’s really good to introduce the thought I have in my mind.

The Macintosh Portable, yes that big-plastic-“90’s gray”-heavy thing, was released on the September 20th 1989. At that time the technologies were totally different than today, and now we can almost say “obsolete“. Nevertheless, that piece of cold engineering became really obsolete few years later. On the February 11th of the amazing 1991, that heavy guy started being “a piece of history“.

I may think about “future” things, but they will always appear as “impossible” to my practical eyes. I may say “people take flying cars in the future”, maybe they will, maybe they will not. I really believe that what I see as impossible is still possible, but the effort to make it real, so to make it possible, is higher. What is impossible for me could be possible to somebody else or in another time of the history. It’s just a matter of points of view.

Macintosh Portable battery

The main reason behind this choice by Apple was its battery. Technically you can read more about that on Wikipedia, but the battery problem is important to understand my idea: If we could travel back in time and go on Semptember 20th of 1989 with the concept of the modern MacBook Pro, or just even with the concept of the modern batteries, how do you think people and engineers will react?

Probably they may say that the MacBook Pro is an impossible concept, even thinking from the technical prospective of that time. It took almost 20 years to make the right battery and screen for the MacBook Pro… Or even the MacBook Air. Steve Jobs, as many others determinate people, took his entire life to create Apple’s products, that in the 80s were considered as “impossible”.

That’s also why I think that if you have a concept that may appear impossible, you can push to make it possible: steps by steps, goals by goals, everybody can change the world somehow, and make their dreams come true! That’s why from my point of view, what it is “impossible” is just harder to be possible.

Needs and happiness with Maslow’s pyramid

Maybe I should write this blog post on my personal and secret diary, but I would like to share this using my blog. This time I am not going to talk about technology or startup, but what happiness is to me and how Maslow’s pyramid helped me to realize that.

Before moving to Denmark, when I was in Italy, I was focusing all my attention on the main actions to get material things and physical welfare: I was happy only when I was able to achieve my goals. The truth is that I was able to achieve my goals, but as soon as I got stuff done, after a short period of happiness, I had the same feeling when the tv series I am watching is over, and there are no more episodes to watch: looking for something to re-fill that feeling of nothingness.

Maslow's hierarchy of needs

So I reminded that Tommaso Grotto, once told me about his own version of the Maslow’s hierarchy of needs and I decided to think about that, redrawing and thinking from scratch what happiness means to me. I am not a psychologist and just for fun, I created my own Maslow’s pyramid, based on the needs I can satisfy to be happy and on my life goals.

I created a new pyramid made by needs connected to specific life-goals and actions: At the bottom of it there are needs that I can satisfy easily, (like eating junk food) and on the top the needs that require a bigger effort (like found another company). I don’t want to share it here, because is really personal and I am sorry, but I hope you get the idea: I really suggest everybody to create their own Maslow’s pyramid.

To really use my “pyramid” I started comparing it with my every-day whims: by asking myself  “where should I put this whim inside the pyramid?” I understand what priority and if that whim makes me really happy. If it fits or is connected to some of the pyramid levels, I will perform the actions to satisfy the need behind that whim. This helped me to distinguish things that really matter and things that doesn’t, like for example, my decision of not buying a new phone at the beginning of this year: there was something more important to do than spend some money for something that I don’t really need.

Even If I live in the happiest country in the world, I think that this is really personal and probably there is not a single way to see the Maslow’s pyramid. I am not a psychologist but I think everybody should build a pyramid… and listen to the happy song :P It helped me to clear my mind from stupid whims.

Does Money mean Trust? [Spoiler: Yes]

Finally, I moved my blog to wordpress.com. The reason is really simple: time. I have a blog that had been for years and years hosted on my own server. This helped me a lot, because is cheaper and it allows me to use custom plugin and design my own theme. But everything is fine until you get hacked! …and sadly I don’t have enough time to find a solution to this… by paying!

Money by Mukumbura

Shortly: I found that 2 months ago, exactly on the 5th of May, somebody injected some PHP code in my wordpress installation on my server.  The way to fix this is to restore some backups and upgrade everything to the latest version… but I don’t have time for this. So I decided to spend 99$ and buy the WordPress.com Plan in order to have my old blog, in my old domain ( blog.setale.me ), with a horrible theme and the trust that wordpress.com will take care of the security of my thoughts.

I have a strange feeling of security when I pay that. Probably this feeling of security is caused by the trust I give when I pay those 99 dollars. I am not a psychologist, but I can say that maybe this is the base for some business models mostly in the share economy or every peer-to-peer business model… Continue reading

Communication techniques for lovers.

During the last months, I fell in love with different people. My real problem was that my mind was “acting like a child”, dividing work from loving affairs as two magnets with the same poles attract themselves (hint: they don’t). That’s good, but what happens if you bring “communication techniques” into love affairs? So I realized that, when I am in love, I was not that good in communicating as I am doing while working every day… then I decided to write down some suggestion about the “communication techniques for lovers“.

Communication for lovers (Photo by MartinodF)

I decided to write some simple suggestions based on what happened to me, to remind me to communicate better. I want to apply some communication techniques that I’ve learned from the experience of working in teams, to my future love story, just because I failed in the past.

The fact that we pretend other people to read our needs is really stupid. Is really important that we understand that nobody will ever be able to read clearly what we are thinking, our needs or our interests. Nobody is called Steve Jobs or Jeff Bezos, and only few people are able to understand or create needs in other people. I believe this is the basic problem that brings us to communicate with other people in the wrong way. Continue reading