Archive for the ‘Information Technologies’ Category

Programa a tua vida

Quinta-feira, Março 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.

No display, no go

Terça-feira, Setembro 11th, 2012

In a recent telemetry project, I selected a very small form factor, low power consumption computer to tackle the task of sending data from a factory to another. Since Raspberry Pis and look-alikes are still difficult to source quickly, I went with an industrial solution (an Advantech ARK 1120).

Since the machine was to stay put doing it’s job 24/7/365 on a Windows network, connected to the SCADA environment, I decided to go with Debian as the OS. But since the machine only had a 4GB CF card as mass memory, I wasn’t able to install a simple Netinst image, selecting only the Desktop environment “package”. That’s because ticking that simple choice brings the system requirements to 4.4GB. Yes, 4.4GB minimum.

I must be getting old; I seem to remember a time when doing a simple install of Debian was a cool experience. One in which you selected exactly what you wanted to install, over a very simple and small base system. The base system is still there (command-line based, of course). But the next notch up the scale weighs in at a mammoth 4.4GB.

I must admit the requirements for this project were almost begging for a Windows machine (the client wanted the machine to have a desktop system, and to be accessible via TeamViewer), but I feared for it’s health. So I preferred a Debian-based machine, but 4.4GB for a “basic” desktop environment system?

Ok then, let’s do this the hard way. I knew I was in for a treat, because my Linux skills have been used superficially for the last half-decade. Still, I thought installing a basic Debian-XFCE system and a couple of accompanying utility packages couldn’t be too hard. So, let’s install:

- Debian from a USB memory stick
- XFCE
- unzip, sudo, nano, SSH, Samba, text editor (NEdit), file manager, IceWeasel… they weren’t kidding when they labelled it “basic”…
- TeamViewer
- x11vnc
- JRE
- my app
- edited inittab and .bash_profile to configure autologin on boot
- created an autostart script in XFCE, starting up my app on boot

1.5GB on disk, that’s cool. The resulting system is quick and nimble, apears to work great.

But alas, when I remove the (VGA) display, keyboard and mouse, the machine does not startup properly! No SSH, no VNC, no XFCE autostart scripts (obviously). It seems to be related to the desktop manager not finding the display. Doh! I confess I don’t ever recall booting a Linux box (with desktop environment) without a display, but I wasn’t expecting this behaviour. I’ll try it out at home and see if it’s a common thing on Linux (I’m pretty sure my RaspberryPi does boot without a TV, and Windows boots whether it has a screen or not).

On a different note, I was expecting a lot more included on a basic system by default (Samba, SSH, vim/nano, unzip…), but I guess the “basicness” can be considered good to start a system configuration (that’s exactly what I love about TinyCoreLinux, for example). Still, I believe the next step (desktop environment: 4.4GB!) is waaaaaaay off the charts! The sweet spot, in my opinion, would be a CD-based desktop Debian system, with all the basic utilities one usually need on an OS (Samba, FTP, SSH, VNC, archiver, text editor, basic music/video player, basic browser, etc), but no full-fledged applications at all (no Office apps, no games, no graphics apps, no creative apps, etc). I believe you could keep it under 2GB easily.

I’m sure a distro like this exists. If you’re reading this and know such a distro, please comment! :)

Servers ahoy!

Domingo, Junho 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! :)

Hot Swap

Sábado, Janeiro 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.

SAPO Codebits V

Segunda-feira, Novembro 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).

VirtualBox and greater screen resolution on the Guest

Terça-feira, Julho 12th, 2011

If you’re in the automation field and work with Siemens WinCC software, you have most certainly got projects with different screen resolutions; and screen resolutions are chosen and fixed on the design side. Wich means that if you have to work on a project in a computer with a smaller resolution, you simply can’t see all of the WinCC runtime screen.

Nowadays, I work from my MacBookPro and virtualize Windows and Linux everytime I need them for testing. This is also a very confortable way of dealing with these Windows-only situations like WinCC, but if you’re on VirtualBox and need a higher resolution to work with WinCC (1280×1024 in my case), you’re in trouble. That’s because by default VirtualBox does not allow the guest Windows to pick a resolution greater than the host OS’s.

There is a simple solution, although a bit burried in the manual: just copy-paste this into the terminal:

VBoxManage setextradata global GUI/MaxGuestResolution any

, and suddenly (well, after a guest OS reboot) you can pick humongous resolutions if you want. Then, activate the Scale Mode (Host key + G) and away you go!

The quick brown fox…

Quinta-feira, Fevereiro 10th, 2011

In your home, when you touch a button, you expect the associated lamp to light immediately. For example, if you open the door to your basement, you need light right now to go down the stairs safely. Waiting a couple of seconds for the lamp to light is not expected, nor desirable. After all, the most basic and primitive lighting controls work directly on the power source, and act immediately, so when you have a state-of-the-art home automation system installed you expect the very same performance.

But, from a developer point-of-view, when you have a network of almost 20 nodes, you need to pay close attention to your data paths if you want to achieve lightning-fast response times. I’m working on the near-realtime domain, but I need to be as close as possible to real-time.

So, I’ve been finetuning my home automation’s data subsystem. I think is it of the utmost importance that the controls feel immediate, quick and nimble. And the physical controls (wall buttons) need to behave real-time, or very, very close to it. The HMI (geared towards touch panel use) needs to behave accordingly, and flow at least as fast as your mind can move your finger. That’s why I’ve developed my home automation’s HMI to be that fast.

Usability is a heavily studied subject, but a historically highly neglected one (although nowadays things seem to be improving). Thankfully I’ve had some training on the subject (and I must thank my University teacher that introduced my to the art, she was inspiring), and you can be sure it won’t be neglected.

I’ve had to tweak the data gatherer thread on the server application, adapt the nodes’ firmware, and scatter data polling in the time domain. Talking in numbers, I reached a half-second (median) response time in the physical control buttons, which seems to be perfectly acceptable. This performance is on a 500Mhz AMD K6-III CPU, 196MB RAM, still running under Windows XP. The final target machine will outperform this test-bed in every aspect (and it will not normally run Windows, but a very light Linux distro, AmigaOS, or MacOS X), so I’m quite happy with the results so far.

Obviously, I have a plan B to accelerate this even further if needs be. It involves bypassing each nodes’ polling overhead, by centralizing data in the header node and fetching in one go (asynchronously). Heck, I even have a plan C to respond in the minimum time possible, involving a full duplex protocol on the header node. Plan C will eventually get implemented (once I sort out the asynchronous communication arbitration between nodes), since it is the best way to do it.

Onwards! :)

A iluminação Pública sobre outra luz

Terça-feira, Dezembro 7th, 2010

Não é meu costume, mas aqui vai um link para um video que demonstra como a iluminação pública devia ser:

ArquiLED

Espero que neste país comecem a investir mais em coisas que valham a pena, e não apenas a esbanjar dinheiro em coisas estúpidas, que parecem ser “inventadas” só para encher os bolsos a determinados amiguinhos (como os painéis de aviso dos preços dos combustíveis nas auto-estradas, ou ainda pior, os sinais que avisam com 8 km de antecedência que os painéis vão aparecer… ).

See you later, Codebits!

Sábado, Novembro 13th, 2010

Because I will definitely be there again, next year!

I loved everything about the experience: the spirit, the adrenalin, the retro-area the sharing of knowledge, coding on unknown languages and platforms… against the clock! Yes, even the pizza, hamburgers, Vitamin Water, the fruit, the salads… there was a lot of variety this year, and that can only be a great thing.

I didn’t get a chance to taste the infamous Nuclear Nachos, but from what I saw it was kind of better this way… ;)

Our project (Fun-netix) was great fun, everything worked in the end, the presentation itself was very bad, but I think people got it and even liked it!

Roll on Codebits 2011!

Notes and ideas: capturing the æther

Quarta-feira, Outubro 20th, 2010

I’m in search of a note-taking software. Here are my notes :) on what I’d like the software to do (aka features):

* Keep text-based notes, with a flexible editor (embbed/link images, video, PDFs, spreadsheets, etc).

* Video note-taking (aka Flink’s Help Files :) ), with automatic speech-to-text processing (creates a text document associated to the video with the extracted speech, so that is it easier to search for stuff I talk about in the videos).

* A powerfull search engine, capable of going down to PDFs, text on images, spoken content on videos, spreadsheets, etc.

* An open and easy to store data model; access, backup and recovery of the database should be trivial. Software only lasts so long, data should last forever.

* Having access (at least in read-only form) to my notes everywhere with a simple browser.

* Having the possibility to “upload” a new note in a trivial way (via email or a simple web page).

* Having the possibility to mark notes as public (to share with the World) or private (not everything I do is interesting to everyone, trust me).

In the past, I’ve setup and used a wiki on my server (Flink’s realm). It was a good experience, I stopped using it because of lack of time and server re-arrengement, but still is one of my possibilities. The other one is using a note-taking software (like Evernote or Notebook), but I can’t find anything that seems to support video (even without the speech-recognition-for-searching part).

If I can’t be satisfied, writing my own is a possibility (not just now, I’ve got a lot on my hands right now). Any suggestions?