Alcides Fonseca

40.197958, -8.408312

Swift Language

At its core, the [Swift] language is designed to eliminate bugs, but not in the academic way that, say, Haskell eliminates bugs by preventing normal people from writing code in it.

Swift Impressions


350 bolsas não são suficientes

O governo voltou atrás e vai lançar apoiar mais bolsas individuais num acréscimo de 300 a 350 bolsas..

A ABIC reclama que o número não é suficiente, e apenas os que pedirem reavaliação serão considerados.

Para mim isto não é suficiente. O problema de fundo continua por resolver.

Continua a não haver uma transparência na política científica em Portugal. Não se fazem remendos como estes. Definem-se áreas em que apostar, calendarização para calls nos diferentes tipos de apoio.

Os centros de investigação, empresas e universidades não estão a ser consultados para determinação dessa política de investimento.

Tirando os felizes 350 contemplados, o sistema científico nacional continua desnorteado e dependente sobretudo de fundos europeus e não nacionais. O que não seria um problema tão grande, se a regulamentação de bolsas e do estatuto bolseiro não fosse da responsabilidade da FCT e do Governo.

Tech Startups in 2014

Everyone and their dog in the Startup world should read this:

Waffle’s 2014

Venture Capital and their eagerness to own the next Facebook has made them blind. They are throwing away money at stupid ideas, or event at cool domains without ideas.

Please make your idea work without any funding at first. In Computer Businesses, things are cheap to make. VCs, please focus on things that have real value, and not only in the VC Round A, Series B bubble world.

Surface Blades

Three weeks before launching its new line of products, the Surface design team took a trip to Pasadena, CA, where they held a 3 day workshop with renowned design school Art Center College of Design.

The group of 11 students chosen for the workshop were the first people outside of Microsoft to see a new accessory the design team has been working on: a music attachment that clicks into a Surface and allows users to easily remix music. They asked the students: what else would you want to attach to a Surface? They code named these attachments blades.

Don't Drive and Glass

Lawmakers seek to ban google glass on the road

This is relevant and huge. While google is pushing legislation to allow for self-driven cars, lawmakers are trying to avoid google glasses on drivers. Which I guess it’s an improvement over text-and-driving, since Google Glass can filter those for you, and has a text-to-speech system, like siri or some cars.

Fix encodings in MySQL Database

Before you start: backup your database. Even if you are not experience any issue.

When migrating a redmine database between two servers, the encodings got screwed even though both databases were using UTF-8 (the lingua franca of the web that was supposed to avoid this kind of problems).

Anyway, the trick is to make sure you have every table defined as UTF-8.

The problem is that the content of the database is still fucked up. To solve this, you can use the following script that uses triple convert (latin1 -> binary -> utf8) on every column of every table in the database.

Downton Abbey, Upstairs/Downstairs and Parade's End

I usually follow American TV shows to the point that I have the dates and times of their airing on my calendar. Lately there have been some British productions that have caught my eye, and these three are all in the same period, something that might be in vogue over there.

Downton Abbey is a drama about an aristocrat family and their servants facing the new century and the new British social structure and lifestyle. Things like the automobile, the telephone, WWI and the Irish revolution are some of the events that the family has endured through the show. I usually don’t like these kind of dramas, but after one or two episodes I wanted to know more about the characters that I ended up watching the two first seasons in two days.

Upstairs Downstairs is also about the difference between aristocrats and their servants in the same period. Despite considering it a Downton copycat, being more fast-paced, I ended up enjoying the show.

Parade’s End is also set in the same period as the other two, but focus on the matrimonial (and extra-matrimonial) affairs of Mr and Mrs Tietjens (Benedict Cumberbatch and Rebecca Hall). Rebecca Hall plays a hell of a character, and was the reason I made it though the first episode. I don’t regret watching the rest of the show.

The difference between Computer Science and Computer Engineering

This is very important to coordinate systems used to map the height of the ground, because the idea of quantified ‘height’ implies that there is a level surface somewhere below us which has zero height. Even statements about relative height imply extended level surfaces. When we casually say ‘Point A is higher than point B’, what we really mean is ‘The level surface passing through point A, if extended, would pass above point B’ So to accurately quantify the height difference between A and B, we would need to know the shape of the level surface passing through point A. In fact we choose a general ‘reference level surface’ of zero height covering the whole country to which we can refer all our measured heights. This reference level surface is not flat!

A guide to coordinate systems in Great Britain

On 24 January 1918 Lenin signed a decree that moved the brand-new Soviet Union from the Julian to the Gregorian calendar. In order to bridge the 14-day gap between Julian and Gregorian, 1-13 February 1918 were omitted, so that 31 January was directly followed by 14 February.


In “I scanned %g directories”, you’d expect “directories” to be in the accusative case (since it is the direct object in the sentnce) and the plural number, except where $directory_count is 1, then you’d expect the singular, of course. Just like Latin or German. But! Where $directory_count % 10 is 1 (“%” for modulo, remember), assuming $directory count is an integer, and except where $directory_count % 100 is 11, “directories” is forced to become grammatically singular, which means it gets the ending for the accusative singular.

A Localization Horror Story: It Could Happen To You

People whose names break my system are weird outliers. They should have had solid, acceptable names, like 田中太郎.

Falsehoods Programmers Believe About Names

Montain Lion

For those of you without an iPad, a recent iPhone and without iCloud, here are the useful new features of Mountain Lion:

  • Being able to use two (or more) harddrives as Time Machine.

Yep, that’s the only new interesting thing.

Make me CEO of RIM for one day

I am making myself available to fill in the shoes of RIM CEO’s for one day. Here’s what I would do:

I would drop the development of the QNX OS and all related systems. The following would be bad for me as a customer, but it makes all sense for RIM. Just fork the Android source tree into a new distribution (but keep updating with upstream) and focus on what RIM is known for:

  • Security.
    • Make storage and communication encrypted.
    • Replace google’s services (Gmail, Google Calendar, ...) with RIM’s services, and allow for companies to host them.
    • Make Storage automatically backed up on the RIM/Hosted cloud. Even better: make shared folders like dropbox. Everything encrypted again.
  • Administrative tasks
    • Give admins great tools to manage hundreds of blackberrydroids easily.
    • Create a BBAppStore in which apps must be signed by RIM and must follow some standards like encryption, no external communication, etc… (Apps would not be bought individually for $0.99, but rather in bulk for several android terminals at once)
  • Communication
    • Make the phones a really damn good email machine. Add a physical keyboard, improve the UI, but make email really easy on the phone. Just like IM.
    • Integrate VOIP really well as if there was no difference between the GSM and VOIP/Skype whatever. This would be a major selling point for companies.
  • Office Integration
    • Develop great office suite apps (Word, Excel, Calendar, Mail)
    • Make a great printer (or adapter) that makes printing Documents really easy.
    • Same for scanning. Maybe using the camera and OCR.
    • Integrate well with a projector. People should be able to present with a tablet/phone and no cables.

Today is a sad day for the Open Web

Today Google discontinued their Social Graph API. For those who didn’t know it, you gave it an url that represented someone (my website, my twitter or facebook account) and it returned all your other URLs (my blog,, openid, youtube, among many other services) and also URLs for all my friends from all those social networks.

Social Graph API was a way of getting all your presences in the internet and also your friends. This was important for instance, when you signed up for a new account on a yet-another-social-network, it could import all your friends without asking for any permission. Games could suggest your friends as opponents. And services could get updates from all your accounts.

Technically, this was achieved using XFN (a micro-format), FOAF and a few other technologies. This is still possible to do today, but the service provided by Google had the advantage of using their super-duper-make-everything-fast-cache and actually query several URLs in useful time.

But I do understand why Social Graph API didn’t caught up. In 2007, everyone had 1001 profiles. Their photos were on Flickr, videos on Youtube, blogs on wordpresses/blogspot, microblogs on twitter, and so on. Social networks were popping up for everything thing you could think of.

And then Facebook became popular. In one page, you can have your photos, status updates, videos, games you play, and so on. And with a good permission system. I can share some photos with my friends, but not the world. This gave control to the user, and removed information from the public knowledge, and therefore from Social Graph API’s reach.

Users want control over what they share, and I am totally on board with that1. I am just sorry that all services are being provided by one company and it increases our dependency on Facebook. I wonder how long will it take for someone to improve the experience and create a new exodus from Facebook to a new platform with other advantages. An no, it won’t be Google Plus.

1Although one should never forget that your trusted contacts can share what you did with the world.

Reading the Source

There has some buzz about Reading the source code on the interwebz lately.

As someone who teaches Computer Science, I find that most students finish their degrees without having read a single line of code that was not written by themselves, group partner or professor. And given the huge amount of good-quality open source code on the internet this is a very disappointed fact.

In fact, when they find an error on a 3rd party software (being a dependency, middleware or just a library) they simply block and cannot advance. For instance, when debugging a stack-trace in a Java project, once the methods reach out of the scope of their project and belong to something else, they stop debugging and don’t try to understand what is happening underneath.

And in my experience situations where the answer is not in the documentation, but in the source code, happen at least once a month. In fact, I have up reading the documentation for most libraries in Python or Ruby. I end up just browsing the source to learn how to work with them, it’s must faster for me. Unless they have some really complex algorithm, and then the documentation is a pre-requisite to the source code.


I do miss the excitement you used to get when buying a new machine; these days (post-SSD) new purchases are more often about adjusting to a new set of compromises than getting something objectively better.

Phil Hagelberg’s The Setup

This is exactly why I downgraded to a Macbook Air. And why a lot of folks are downgrading to iPads.

Implicações do Copismo na Suécia.

A notícia recente de que o “Copismo” é uma religião oficial da Suécia surpreendeu-me. Na Suécia o movimento pirata e defensor dos direitos dos consumidores contra copyrights tem sido pioneiro no mundo e até bastante sóbrio. Esta notícia chega um pouco ao ridículo.

Até que li o artigo de Rick Falkvinge, o fundador do partido pirate. A ideia é usar a lei relativa ao sigilo profissional, nomeadamente à confessão religiosa. Todas as partes envolvidas numa cópia ou remix de obras passa a ter o estatuto de sigilo.

Isto faz com que qualquer site/tracker/isp que releve dados de utilizadores à polícia, não só anula esse material como prova em tribunal. E vai ainda mais longe: relevar dados sobre utilizadores a fazer cópias passa a ser crime.

Por um lado acho que foi bem jogado esta acção de forma a usar os bylaws para proteger aquilo em que acreditam (quase como se fosse uma religião). Por outro lado, mostra algo em que acredito: a legislação deve ignorar a religião, não a deve considerar nem para novas regras nem para excepções a regras.

Carta aberta aos Grupos Parlamentares sobre a Proposta de Lei da Cópia Privada

Exmos(as) Srs(as) Deputados(as),

Venho por este meio mostrar a minha posição relativa à Proposta de Lei da Cópia Privada, e que certamente é partilhada por inúmeros outros cidadãos que se encontram na mesma situação que eu. Abordarem primeiro as minhas preocupações mais gerais, e depois em particular nos casos que o mereçam.

No texto introdutório da mesma proposta referem que o surgimento de equipamentos que permitam a reprodução em massa veio por em causa os direitos de autor e a devida compensação. Gostaria de relembrar que esses mesmo equipamentos (sejam fotocopiadoras, dispostivos de armazenamento, computadores, leitores de música, etc…) são também usados para reproduzir e armazenar material cujo direito de reprodução não está protegido.

Gostaria de convidar os senhores deputados a fazer uma visita a diversas empresas e verão que o armazenamento digital é usado sobretudo para guardar bases de dados com dados de clientes, produtos, facturas, correspondência, tabelas de preços, documentos internos, etc. As fotocopiadoras usadas são usadas para cópia de documentos internos e externos à empresa que não são comercializáveis.

Ora o que a proposta de lei pretende fazer é aplicar uma taxa a todos os equipamentos de reprodução e armazenamento, independentemente do uso. Eu interpreto que estão a aplicar uma coima pelo uso indevido para cópias ilegais de obras protegidas a todos os cidadãos e entidades colectivas, independentemente se praticam o crime ou não. Considero então esta medida anti-constituicional, na medida em que todo o cidadão é inocente até julgado em contrário, e não deve ser punido por algo que não foi julgado. Certamente os Srs Deputados quererão repensar esta medida a partir da raiz.

Gostaria então de abordar alguns pontos que corroboram o quão pouco esta proposta faz sentido e se enquadra na realidade portuguesa.

1) As taxas a aplicar em materiais digitais é fixa por Gigabyte ou hora de armazenamento. Gostaria de os apontar para este gráfico [1], nomeadamente para a escala logarítmica da capacidade. Tendo em conta que a capacidade de armazenamento aumenta exponencialmente ao longo dos anos, também as taxas propostas iriam. No entanto os preços dos materiais de armazenamento tem ficado na mesma ordem de grandeza. Isto fará com que em poucos anos as taxas sejam superiores ao custo dos materiais. Este ponto apenas mostra como os autores da proposta claramente não têm noção da realidade nestes assuntos.

2) O artigo 5º determina que a compensação equitativa e autores e afins é inalienável e irrenunciável, sendo nula qualquer cláusula contratual em contrário. Este ponto não faz qualquer sentido. Eu como autor tenho o direito de transmitir os materiais da minha autoria gratuitamente. Porque me querem tirar esse direito?

Ainda pior, com a disseminação das tecnologias de gravação de obras (sejam gravadores de audio, vídeo, fotografia ou texto), qualquer pessoa é um autor. Todos os portugueses que tenham actividade na internet sobre a forma de escrita de texto, fotografia ou vídeo (e uma grande maioria o faz nas redes sociais) é um autor. Como é que são recompensados pelas suas obras, da qual não podem impedir que estas taxas sejam cobradas? Quem os representa?

3) No artigo 6º definem a isenção para estas compensações, e na alínea a) referem que estão isentas as pessoas que tenham como objecto de actividade a comunicação audiovisual ou produção de fonogramas e de videogramas, exclusivamente para as suas produções. Ora eu concordo que para as suas produções, ou produções cujos direitos lhe tenham sido oferecidos qualquer pessoa esteja isenta. E não apenas as empresas com esse objecto de actividade. Ora uma empresa de móveis terá de pagar compensações por guardar e copiar um vídeo gravado pela própria empresa sobre os próprios móveis? Esta excepção está claramente muito limitada a um grupo de pessoas mais representados pelos autores da proposta, do que a maioria das pessoas individuais e colectivas portuguesas.

Gostaria ainda de comentar que na eventual possibilidade de esta proposta ser aprovada, tanto eu como várias outras pessoas que usam armazenamento digital vamos passar a adquirir material a outros países. E com a facilidade que existe hoje em dia para adquirir material de fontes estrangeiras e do baixo custo de porte, estariam a prejudicar a economia portuguesa, ao tentar cobrar uma compensação de violação de direitos a alguém que não viola os mesmos direitos.

Para terminar gostaria que reformulassem a proposta, mesmo a partir do zero e que a baseiem na verdadeira realidade portuguesa. Não o façam castigando quem não viola a protecção de direito de autor. Se apenas estão em contacto com empresas do meio audiovisual e se estão apenas a ouvir a parte dos autores de obras comerciais, eu estou disponível, tanto para partilhar a realidade dos utilizadores de meios de armazenamento e reprodução audiovisual, como para indicar personalidades que o façam melhor que eu, e com mais credibilidade.

Agradecido pela atenção prestada, e disponível para ajudar nesta proposta,

Alcides Fonseca


Start Menu of the Internet

Google has just announced the next version of their “google bar”. The Google Menu is what I consider to be the “Start Menu” of the internet. And this really aligns with the Chrome OS vision of Google, where all devices are dumb clients.

The Success of Apple Stores

... the staff isn’t focused on selling stuff, it’s focused on building relationships and trying to make people’s lives better. That may sound hokey, but it’s true. The staff is exceptionally well trained, and they’re not on commission, so it makes no difference to them if they sell you an expensive new computer or help you make your old one run better so you’re happy with it. Their job is to figure out what you need and help you get it, even if it’s a product Apple doesn’t carry. Compare that with other retailers where the emphasis is on cross-selling and upselling and, basically, encouraging customers to buy more, even if they don’t want or need it…

— Ron Johnson, former VP of retail at Apple.

You can read the whole article on the lessons he learnt with the Apple stores.