Registration is now open for the 4th edition of the Tuenti Challenge, our programming contest! Our engineers are already busy writing challenge questions for the contest that will go until May 23rd.
The programming contest has two phases. In the first, which is online, the 50 contestants who are able to solve the most problems will win a Tuenti prize pack. In the second phase here at our office, the top 10 contestants (chosen after the manual correction of answers submitted), will spend a training day alongside the best engineers on our team, and they’ll also participate in workshops, hang out at a barbeque, and win prizes. The legal terms of the Challenge are available here.
At Tuenti, we believe that talent is the foundation on which the future of any company is built, and that it has nothing to do with age or background. That’s why we believe in initiatives like this for discovering people with potential and bringing them to our team.
We’re excited to find out how contestants attempt to tackle the challenges we’re preparing for this edition. The challenge questions will be available starting on April 28th, and registration is open until May 5th on the website. You can find out more about it on our dev blog or through our Twitter account, in which we’ll be publishing more information throughout the contest. Let the games begin! ;)
On Tuesday, we had the opportunity to host the latest GoMad meeting at our Gran Via office. This time, Toni Cardenas explored how the relatively new Go language can be used to develop web applications, leveraging the use of its closer-to-the-iron world perspective. Tricks like upgrading HTTP connections to Websocket and handling thousands of connections with real parallelism can be accomplished with just a handful of lines - all this without the typical arguments about coding in C or C++, or the downfalls of other higher level languages and platforms.
It was a great pleasure to have the GoMad group in our offices and we’ll keep track of their future meetings. If you’re also interested in the language and happen to be in the Madrid area, just join their meetup page, and If you are a part of another other group and would like to organize a tech or design-related event, get in touch!
PHP is fast, how about our code? This was the topic that Daniel Ripollés chose to speak about at the third PHPMad meetup, that took place in the kitchen of our central Madrid office. He spoke about PHP performance and gave some advice on how to make our code faster. It was great and our kitchen was packed with people! Thanks to everyone who attended and spent some time with us ;)
In addition to PHPMad, we are open to hosting other user groups meetings and talks so, if you’re interested in organizing a tech or design-related event, get in touch!
While developing the Push to talk feature for the Tuenti iOS app, we found we needed a way to capture recorded audio in real time so we can apply our voice filters to it for your entertainment..
The fact that Apple does not provide an easy and convenient way to do this using a pure Objective-C wrapper led us to look for a better option than that of messing with the Core Audio API in C. That is how we got to The Amazing Audio Engine, a framework that allows you to work with audio while keeping you away from all the intricacies of the native layer.
But we like AVAudioRecorder, the high-level API provided by Apple as part of the AVFoundation framework. That is why we programmed a drop-in replacement for the AVAudioRecorder class, implemented using the Amazing Audio Engine. It is interface-level compatible with the original class, but adds a new method to specify the audio filter which should be used during the recording, setAudioFilter:
We defined a protocol TUAudioRecorder which TUAVAudioRecorder and TMAERecorder comply with. The first class is an AVAudioRecorder based implementation of an audio recorder, while the second one uses the Amazing Audio Engine. Both of them are interchangeable, so you can use one or the other depending on whether you need filters or not.
To make everything testable, all the dependencies of these objects are injected during init. A sample project which uses Typhoon framework as dependency container is provided, along with a simple reverb audio filter.
You can get them from our GitHub page.
Code injection is a powerful procedure which allows you to modify the behavior of a given method by adding code to be executed before or after its implementation, or even by replacing it altogether.
There are several scenarios in which code injection might be useful such as when adding profiling, logging or statistics to existing methods, creating partial mocks of objects, make testing easier, or implementing objects using an aspect oriented approach.
The way this is normally done is that Objective-C takes a method from a class and changes its implementation at runtime, via class method swizzling —you change the original implementation of the method with a new one while keeping the original implementation somewhere so you can restore it later. This procedure is hipster-approved, and a great way to learn about the inner workings of the Objective-C runtime.
That said, this approach has one main disadvantage: each and every one of the instances of a class with a swizzled method will inherit the new behavior. If you might want to have two different instances of the same class which behave differently at runtime so you can, for instance, log the events generated by two objects using different logging services.
In order to make this possible, we have created TMInstanceMethodSwizzler, a utility class which allows you to specify an object and one of its methods, providing a block of code which should be called on a specified moment —before, after, or in lieu of the original implementation.
A sample use case is provided: TMTimeoutManager. This is a class which allows you to expect a method to be called before a given amount of time, invoking a block of code when this occurs or another one if the provided timeout is reached.
Both classes are the result of a Hack me up, an internal contest in which Tuenti engineers are given 24 hours to develop whatever they think might be useful, funny, or worth making. You can watch a presentation of the project on the YouTube channel of its author, Rafael López Diez.