Composing the ‘n!’ sound

 

There is always a moment in my daily life at itnig when a startup asks for a video. Sometimes it’s an ad, sometimes an event, sometimes it’s just a tutorial, but no matter what it is, it comes with the need of creating a sound that represents the company and can be played at the start of the video along with the appearance of their corporate logo.

This short sound must represent their essence, it has to have their DNA reflected somehow: a representation of their values, their culture or maybe even something related to their name or logo. It is mainly an artistic process that requires inspiration but in some cases the startup name and culture is geeky enough to allow some rational thinking into the music composition process. Last week I crafted the sound for our startup Factorial, inspired by the mathematical operation their name represents.

Assigning values to notes and choosing the first note

Putting a mathematical operation into sound requires a bit of imagination as well as a set of rules to get started. The first step was assigning values to notes. I decided to assign C4 the value 1. It is the middle key in a piano and also the middle C according to the International Pitch Notation so it seamed and appropriate value for that key.
Piano keys, notes and assigned values
Now we had to decide which factorial operation to represent. That is, choosing an x to which we would perform x! and represent it. Being the startup name Factorial and given that it starts with an F, it made sense to perform the operation on F4, the first F we would find after C4.

Performing the n! operation

Now that we had chosen to start at F4 we just had to assign notes to the operands in the operation and put them in the score.

4! = 4*3*2*1 = F4 E4 D4 C4

Now we had a simple downwards scale without much musical interest but how could we enrich the melody and still make it part of the factorial operation?

Making the middle operations sound too

As we manually start to calculate the factorial operation of a number and before we get the result, we obtain partial operands that are part of the process. How would the melody sound if we added those partcial numbers to the score?

The size of the partial operands makes the need to place them on a staff above obvius. Also because of the sequentiality of the operation we put the partial operands once we have been able to obtain the result, that is after the first note and while the second note is playing.

The first partial operand is obtained after multiplying F4 and E4 wich is the same as 4*3 which equals 12 that represents a G5 if we check the keyboard note to number assignation.

F4 * E4 * D4 = G5 * D4 = 12 * 2 = 24 = E7

If we keep calculating we obtain the note E7, which is the result of multiplying F4 * E4 * D4.

Finally, we obtain the same E7 after multiplying the previous result by C4, which has the value 1.

Final result

If you are curious to listen to how this mathematical representation of the factorial operation sounds like, play the video below.

Breaking VIM’s unbreakable «learning wall»

First of all, let’s make things clear. VIM does not stand for Very Intuitive Magic. It’s not easy to learn and it’s like going to the gym. You have to be consistent and use it daily to see the results and keep in shape once you are fit.

But why is it so confusing for most of the people? It is a modal editor, and every mode has its own key bindings. By default VIM opens in «normal mode», which won’t allow you to type. You have to get into «insert mode» pressing the «i» key to be able to insert text, but you could also place the cursor on a character and press «r» to replace it with whatever you typed next, or you could press «o» to create a new line and enter «insert mode» at the same time, etc. You have to remember what every key does in every mode, and you’ll only achieve this with practice. That’s what makes VIM different.

Why bother?

So why would anyone try to break the learning wall and master VIM? Some will say it’s just to prettend you are cool, but they couldn’t be more wrong. There are some features that make the VIM user objectively faster than any other editor user.

No mouse

The first one is the fact that you don’t have to use the mouse for anything. Think about how many times you use the mouse to move around a document in any other editor and sum all those precious miliseconds. It’s a lot at the end of the year.

Changing an “IF” condition and adding an “IF” in 10 seconds

Hands always in standard position

It’s not only that you don’t use the mouse, but you actually don’t have to move your hands out of the standard position, meaning that you don’t need to use arrow keys, or other keys outside the normal reach.

Preinstalled

It comes preinstalled in almost every decent operative system, so you don’t have to go through the hassle of downloading it every time you change your computer or want to edit something somewhere else.

Runs in Console/Terminal

It runs GUIless, in a Terminal or Console, so if you are working on a development project running servers, scripts and commands, you don’t have to switch context. You can feel at home even when editing files in remote servers. This means you can even access and use VIM from a smartphone with an SSH app.

Editing the itnig website in a Mac, with and iPad, through SSH

Lightweight and fast

It’s lightweight and fast, super responsive and never crashes. It takes 60ms for it to open a file containing the 131843 lines of the Holly Bible.

100% Customizable

If there is something you don’t like just change it. The .vimrc config file lets you customize the behaviour of your editor and confortably replicate your settings between setups. If there is something missing, just install it as a plugin.

Macros and scripts

You can actually record your commands to automatise repetitive tasks. Imagine you have a data file you want to make JSON compliant. By recording what you want just once, you can replicate it as many times as you need.

Making a data set JSON compliant by recording and playing a macro

And if that’s not enough for you, you can write scripts using VIM Script and customize your VIM even more.

How fast can you type all IP’s in a local network in your editor?

With just a few lines you can for example create your custom syntax highlighting toggle, and use a shortcut to activate it.

VIM syntax toggling script https://www.ibm.com/developerworks/library/l-vim-script-1/

Breaking the wall

The best way for learning VIM is using it for everything. From writing documetation to typing code in every project you have. Start with the basic commands: i, :wq, dd, p, hjkl.

You can try this awesome Zelda-like game to learn how to use VIM.

Keep using it, because you’ll never feel you know it enough.

I hope this gave you the essentials to start exploring the eternal possibilities of VIM. Feel free to comment below if you have experience using it yourself, the more tips the better. When you master VIM, I can guarantee that you’ll never use any other editor again. Enjoy!

 

Fast, simple and reliable: Jekyll

When we decided we needed to redo the itnig website from scratch we managed to synthesize our needs in three words.

Fast, simple and reliable.

Is there anything faster, simpler and more reliable than static html? Writing a static html page in the dynamic world we live in was out of the question but we needed something that would allow us to do so in an easy way. That’s when we found Jekyll.

Jekyll lets you generate a static html site from dynamic components such as templates, partials, liquid code, markdown, etc.

Data structure

Data classes are structured in Collections, each collection being a folder where each instance is represented by a file. Each one of these files starts with what they call Front Matter a header where all the instance attributes are defined. This Front Matter is what allows relationships between classes, filtering, querying, etc.

Classes that don’t need an html page representation are stored using Data Files (a typical CSV file) instead of being represented by a file in a collection. In our case, we use them to store people working at our startups.

Data Sourcing

We could manually create a file in the _jobs collection every time we have a new job offer, or a new file in the _events collection every time we have a new event, but we love optimising our time, and we already update our job offers on Workable and our events on Meetup, so why not using their APIs? Well that’s exactly what we do. We periodically run a script that retrieves all jobs from Workable creating a file for each one that is then stored in the _jobs collection. We do the same for the upcoming events and we also use the Google Drive API to retrieve the latest version of the people CSV file.

Design

Once the structure is defined and some data is created you can start working on the design. You can define some properties and attributes on any file using the Front Matter, and obtain and play with your previously created data using Liquid (a templating engine created by Shopify), to finally show it using HTML.

Conclusions

After working on and maintaining a Jekyll site for a couple months I can say it meets our expectations, but there are a couple drawbacks you should take into account before jumping into adopting it.

The first one is precisely what makes it fast an reliable, that is, the lack of a backend. Before choosing Jekyll you’ll have to ask yourself if your project is simple enough to avoid user registration and complex class and DB modelling. If it is, go ahead.

The second one is the lack of a “backoffice” for non-tech people. Whenever we manually update the content of a file (adding for example the video url of an event once it is online) it needs to be synced with the repository using git, and deployed to the server where the site is hosted. This might look simple and clean from the developer’s perspective, but when the content has to be updated by non technical users, this can be a problem. You’ll have to make sure your content manager knows or is willing to learn git.