Programa a tua vida

March 28th, 2013

O post do Pedro Cardoso sobre o vídeo que anda por aí sobre o ensino/importância da programação fez-me querer escrever sobre a minha própria experiência.

Tive o meu primeiro computador aos 4-5 anos. Era um Timex Computer 2068, um maquinão na altura! Claro que inicialmente jogava alguns jogos que o meu pai me arranjava, mas mais tarde comecei a introduzi-los à mão de listagens em revistas (principalmente a Your Sinclair) e livros. Cheguei a modificar alguns jogos, e a fazer um que tinha um boneco e umas arvores no ecra (não me lembro qual era o objectivo, se havia um 🙂 ). Foi uma coisa progressiva, e não me lembro quando nasceu a minha paixão pela programação.

O evento “abre-olhos” foi mesmo quando convenci o meu pai a comprar-me um Amiga 500. Estive um ano a chateá-lo, e ele obrigou-me a vender o Timex para comprar o Amiga! Mas aquilo era qualquer coisa de fora do comum… toda a indústria informática levou anos a apanhar o que o A500 conseguia fazer. Fiz algumas coisas pequeninas, e iniciei um jogo em BlitzBasic (o Vapour Trail). Já naquela altura programava “por objectos”, e desenhava as minhas naves e edifícios em 3D (usava o Imagine, Real3D e, mais tarde, Lightwave3D). As revistas da altura (Amiga Power e Amiga Format, ambas da Future Publishing) ajudavam bastante, e já na altura comprava software na Inglaterra (através dos anúncios das revistas).

Depois das BBSs (sim, sim, modems a 9600 bps e modo texto!), a web nos Amiga era muito utilizada (via modems também); a Aminet era o maior repositório online (e offline através dos CDs) de software com sources de Amiga, assim como o Amiga Web Directory era o nosso Google, e o pessoal era muito unido e partilhava o conhecimento de uma forma que hoje já não acontece. Bons tempos!

As coisas eram mesmo como o Pedro diz: se a vida te dá limões, faz limonada. Havia muito pouca coisa em português na altura, as revistas, livros, manuais, BBSs, websites, etc, eram quase todos em inglês; em pouco tempo eu já pensava em inglês, à noite, na cama!

Como eu tinha muito interesse pela modelação e renderização 3D, não me dediquei inteiramente à programação na altura. Queria fazer tudo: os gráficos, o som, o código. E jogar. Sim, porque os jogos no Amiga eram fantásticos, e eu tinha grandes amigos para o fazer comigo!

Com o tempo, descobri que a programação é mesmo o meu vício. A magia da tecnologia inspira-me. Hoje não tenho medo de programar nada, muito pelo contrário, é um desafio. De microcontroladores a computadores, passando por telemóveis, PLCs, marcha tudo. Acabei por ir parar à área da indústria, onde me fascina ver o meu software a controlar e supervisionar fábricas com máquinas enormes e poderosas, capazes de produções alucinantes. Às vezes fico ali no meio da fábrica, a apreciar tudo aquilo a funcionar, quase a ouvir os bits do meu software a transformarem-se em azeite. Ou vinho. Ou outra coisa qualquer que, amanhã, vai estar na tua mesa.

Mas eu acho que tive sorte. Um computador aos 5 anos, não era normal. Hoje é, mas não da forma que era antigamente, já não é preciso programar nada para utilizar bem um computador. E assim, tenho um projecto em curso de ensinar programação (e electrónica) a míudos (e graúdos também). Umas workshops de robótica, que espero eu inspirem os mais pequenos a entrar no maravilhoso mundo da ciência e tecnologia.

Assim nasceu a Intellego.

Java app bundle on OS X

February 27th, 2013





No display, no go

September 11th, 2012






– Debian from a USB memory stick
– TeamViewer
– x11vnc
– my app
– edited inittab and .bash_profile to configure autologin on boot
– created an autostart script in XFCE, starting up my app on boot





Servers ahoy!

June 10th, 2012

I’ve had Apple servers for quite some time now (actually, this MacMini is my fourth Mac doing server roles, after a G3 iBook, a dual G4 MDD PowerMac (power hog alert!) and a beautiful G4 iMac), and I’ve had an incredibly positive experience. Although people are complaining about (Mountain) Lion Server’s simplicity, I believe things have gotten better, not worse.

Still, my requirements are a bit simple; after all, this was, up until very recently, a geek’s server. It does file, web/wiki/blog, mail, and home automation server, as well as media center, my apps server, Internet and gaming machine. Nowadays, with Lion Server and our startup activities, it does a bit more: Time Machine (backup) server, contacts and calendar, VPN, and a couple of web apps.

And most of these with a simple flick of a switch.

What I like the most about it is it’s flexibility, but also it’s resilience. Remember, it’s used daily as a media center (XBMC, iTunes) and a gaming machine (native Mac games). No crashes, no down time, no perceivable performance loss, low power consumption (13W “idle”), inaudible in all tasks (except with some heavier games).

It’s just there all the time, and it Just Works®. I wish more things in life were like that! 🙂

Space Dreams

March 20th, 2012

I’ve blogged in the past about space exploration. It’s probably my most inner desire, to explore space beyond our planet.

[era uma vez o espaço]

It’s not that I want to be an astronaut, get into a spaceship and fly into space. No. What I’d like is to be part of a space exploration mission, deal with the technology aboard the spacecraft, develop software (both onboard and mission control), and give our data back to the experts to analise.

A probe like the Mars Science Laboratory would be a cool start.

But there is still so much to do! We’re just taking peeks through a small hole at our Universe. We still (apparently) need to do a lot of effort to put a spacecraft decentely into space (just look at the most recent missions, Phobos-Grunt springs to mind), when missions like these should already be under our complete control, tried and tested. We should be aiming higher, like building a bigger spaceship in Earth orbit, capable of taking a decent crew (something like 25 people), with “artificial gravity” and high-tech facilities on-board with wich we could safely travel to other planets and study them. This is what I would really like to be a part of. Something like the Enterprise from Star Trek, but obviously smaller.


Imagine getting our Enterprise on Mars orbit, and launching robotic probes like the Fobos-Grunt or MSL from the ship. A lot less things could go wrong, communications and remote control would be simpler (almost no lag, from Earth it takes 19 minutes), samples would be available in hours, and testing could be done at the onboard laboratory, with results sent to Earth.

If we could just stop wasting money on useless stuff (we see governments doing this every day) and focus on the evolution of Mankind…

Think about it for a second. Do you really believe we’re meant to be stuck on this planet? I’m certainly not going to tell you how we’re going to travel all those light-years that separate galaxies in a reasonable time-frame. But our solar system is pretty near us, and it bears a lot of answers about our Universe! Thinking it is Mankind’s fate to be stuck on Earth is, at the minimum, a very poor thought. We’ve been given the courage, the intelligence, the resources. It’s not easy, but nothing worth doing is easy.

Plus, I believe there is another reason for us to colonize other planets, moons, or space stations. Earth is a little fragile celestial body on a dangerous Universe. Imagine a catastrophe would happen to our planet; we’ve all seen movies about this (2012, Armagedon, Terminator, etc), wether it’s a meteor, Earth instability, or our plain stupidity using massively powerfull weapons and/or technologies. The Earth is really, really small when we reach this scale, and it’s imperative that we proliferate away from Earth so that Mankind has a chance to survive. Former NASA Administrator Michael D. Griffin spoke really well about this.

I’d hate to see the every-civilization-autodestroys-itself-quickly-answers-the-Fermi-paradox guys being proved right.

I’m really disappointed with our performance as space-faring creatures. I hope I can contribute one day, in any way, to our space exploration endeavours.

And don’t get me wrong, one day I’d love to go “up” there. But I’d prefer it to be a trip on the “Enterprise” to one of our Moon colonies, or to a space station orbiting Mars.

Hot Swap

January 7th, 2012

One thing I’ve been absolutely jealous of the PLC world is the ability to hotswap DataBlocks, FCs, etc. I mean, while the PLC is running and executing code, you can simply upload a modified version of an FC (basically a function) and… it just works. The PLC (once the upload is completed) changes the function pointer to the new code between cycles, and all is well.

Obviously, PLCs are rather simple functional machines, they basically work with static memory blocks (for variables and functions) and with a very rigid structure (IN/OUT image management, main cycle). So it’s very easy to achive the hotswapping of functions, and even of variable blocks (you basically refer to a variable by it’s address; if you’re not carefull changing a varible block, you might be now pointing to some address that encompasses parts of two variables… it does not complain).

When you mainly roam on Java land, like I do, the sights change dramatically. Sure, you have an immense power on your hands, but think about class hierarchies, objects, constructors, third party libraries… and it’s very far from trivial to implement hotswapping in the Java Virtual Machine.

I’m using Java to build my most important “desktop” applications (actually, it’s a server-client aproach, but the server app is 100% built by me, no third party web or app servers involved), and sometimes I’d like to have hotswapping on my development system. It really bugs me to have to bring down my server app because of a simple bug fix or improvement.

Still, after reading a bit on HotSwap, JRebel and the like, it probably is not that important. I’m not willing to add significant amounts of complexity just to gain hotswap, since I’ve developed things with a very lightweight and encapsulated structure. On recent hardware and JRE, my server app starts up in 8 seconds (database startup included), and the client app in a mere 4 seconds. Even with a full recompile and shutdown times, I’m looking at a power cycle of under 30 seconds. Not bad.

Phobos-Grunt, wake up!

November 23rd, 2011

You might be aware of a very interesting space mission launched this November: the Phobos-Grunt sample return mission.

Mission control does not have (2-way) communications with the vessel while in close Earth orbit (yes, this is apparently a planned situation), so it was expected to slingshot away from Earth autonomously. Although the launch went well, and positioned Phobos-Grunt on Earth orbit, the spacecraft has experienced a problem and did not insert into the elliptical (slingshot) orbit around Earth, as planned. So mission control has had a very hard time communicating with the vessel.

I read the ESA has finally managed to receive signals from the spacecraft. Here’s hoping they can regain contact with it, and that mission control can effectively send Phobos-Grunt to it’s intended destination: Mars.

More on this later.

SAPO Codebits V

November 14th, 2011

Este fim-de-semana, estive no SAPO Codebits, um evento criado pelo SAPO que junta centenas de programadores portugueses num ambiente fabuloso de criatividade e entre-ajuda. É difícil de categorizar este evento, mas de lá saem todos os anos alguns dos mais avançados, arrojados e tecnologicamente avançados projectos do planeta. Eu adorei a experiência; já tendo participado em outros anos posso confirmar que este ano foi claramente o melhor de todos, em todos os aspectos!

O foco principal do evento é uma competição de programação de 48h non-stop, em que várias equipas desenvolvem projectos onde a sua imaginação é o limite (para além das 48h, claro). Findas as 48h, todas as equipas se juntam no palco principal e cada equipa apresenta o seu projecto às outras em 90 segundos, ao mesmo tempo que são votados pelo resto dos programadores. Durante os 3 dias do evento, são dadas mini-palestras (talks) sobre vários tópicos de programação, últimas tecnologias, métodos alternativos, cozinha ou agricultura com muita tecnologia e geekness à mistura. Ultimamente, o inglês tem sido a língua oficial do evento, uma vez que temos já um número consideravel de estrangeiros no evento, não só a dar talks mas também a participar.

Existem muitos outros pontos de interesse, claro; este ano houve desde os famosos Nuclear Tacos (tacos feitos com Bhut Jolokia, uma pimenta muitíssimo forte) até uma workshop de cozinha molecular, passando pelo Quiz Show, um karaoke que em vez de música utiliza apresentações, uma competição de Munchkin…

Para poderem ter uma ideia melhor do evento, dêem uma vista de olhos a isto:

Uma panorâmica da sala principal (falta o lounge, a zona de entrada, e o palco principal).

– Eu com o bot (a “mascote” do Codebits).

A notícia da RTP / Daniel Catalão sobre o Codebits.

Site do SAPO Codebits (em inglês, que é a língua oficial do evento).


November 10th, 2011

Yes, I know I haven’t written on this blog as much as I’d like to, but things are starting to normalize.

Having a little newborn baby at home and trying to finish my house, along with a very intense work schedule, did not contribute to my free time at all. My personal projects have been on hold for the past year or so, but I think things will pick up from now on. The kid is already 6 months old, and by the looks of it he’ll quickly grow into a big boy (needing less time with diapers, sleep, etc). I love being with my kids, so this is invested time; I’m sure it will pay off in the long term.

Codebits V will probably mark my return to activity.

Codebits V – ignition!

November 10th, 2011

I’m on my Alfa Pendular train, heading to the Parque das Nações in Lisboa, for the Codebits V!

If you’re there, do look me up on the premises! 🙂