Skip to content

Tag: ubuntu

JavaFX 1.1 for Linux workaround

Download

javafx4linux.tar.bz2 (~ 36Mb).

Installing

1) Extract the javafx4linux.tar.bz2 file. In this example I’m placing it on my Desktop. After the installing process you can remove it.

javafx linux ubuntu extract

2) Open your NetBeans 6.5 and go at Tools → Plugins and go to Downloaded tab. In a plain and new NetBeans installation there will be no plugin in this tab yet.

netbeans javafx linux step01

netbeans javafx linux step02

netbeans javafx linux step03

3) Click on the Add Plugins button and head to the directory you extracted the file and select all .nbm files.

netbeans javafx linux step 04

4) You will see a list of 22 plugins selected. Click on the Install button.

netbeans javafx linux step 05

5) Just keep clicking on the Next button.

netbeans javafx linux step 6

6) Check the license agreement accept box.

netbeans javafx linux step 7

7) You’ll see a warning because the Linux pluggin is not signed. Don’t worry, just click Continue.

netbeans javafx linux step 8

8) Click on Finish to restart NetBeans.

netbeans javafx linux step 9

9) Now we can test it. Go at File → New Project, select the JavaFX on Categories and JavaFX Script Application on Projects.

netbeans javafx linux step 10

10) Put some code and run it. There is. JavaFX on Linux.

netbeans javafx linux step 11

Considerations

This is not a official of JavaFX for Linux! This solution was tested on Ubuntu 9.04 “Jaunty Jackalope” with Java 6 update 13 and NetBeans 6.5.1, but should also work with others Linux distributions and Java versions greater than 5.

Known bugs

As a non official workaround for JavaFX for Linux you may notice some drawbacks. Some parts of the JavaFX runtime rely on native implementations on the specific operational system. You may not use some multimedia capabilities as video playback, JavaFX Mobile emulator and some performance issues in some effects. Despite that, is perfectly possible to develop applications using JavaFX on NetBeans.

Thanks

I’d like to thanks some guys around the world. Weiqi Gao’s original post on JavaFX on Linux, HuaSong Liu article on DZone and Kaesar Alnijres post.

Ubuntu Jaunty: má performance gráfica

ubuntu glass logo

Nas versões anteriores do Ubuntu, inclusive no 8.04 que eu utilizava anteriormente, não havia do que me queixar. Porém com a mudança para o 9.04 (Jaunty Jackalope) de imediato foi possível reparar uma queda drástica na performance da aceleração gráfica 3D.

Minha placa gráfica no meu notebook, um Amazon FL31.

silveira@fl31:~$ lspci -nn | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller [8086:27a2] (rev 03)

Na release desta versão do Ubuntu havia um aviso de possível regreção na performance em placas de vídeo da Intel onde há a indicação de algumas soluções provisórias.

Regressão do Driver

Eu experimentei uma solução mais drástica que foi alternar o driver de vídeo para a versão anterior. O desempenho melhorou bastante, mas ainda senti uma boa diferença para os padrões que eu estou habituado. Além disso continuava impossível rodar alguns jogos, as texturas eram carregadas nos lugares errados e poucos quadros por segundo. Eu acabei por retornar os drivers para o default do Jaunty e descartar essa opção.

Atualização do Driver

Uma solução alternativa que eu me deparei foi atualizar os drivers para uma versão mais nova. Como root execute os comandos abaixo para adicionar os repositórios a lista do APT, adicionar suas chaves e atualizar as informações de pacote e instalar os novos drivers:

echo “deb http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu jaunty main” >> /etc/apt/sources.list.d/intel.list

sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 165d673674a995b3e64bf0cf4f191a5a8844c542

aptitude update && aptitude safe-upgrade

A performance ainda não está tão boa quanto já foi mas está completamente suave e usável.

JavaFX SDK 1.0 on Linux

JavaFX 1.0 is out and is absolutely amazing. You guys did really a great work on it.

As I really need a working SDK on Linux to continue to study and I don’t have any Windows/Mac near me, I’m using the Weiqi Gao’s workaround. I tried to simplify a little bit more the process for those who need JavaFX SDK working on Linux right now.

Download javafxsdk_linux_unofficial.tar.bz2 (~18Mb).

And then

tar -xjvf javafxsdk_linux_unofficial.tar.bz2
sudo cp javafx /opt/javafx
echo “PATH=\$PATH:/opt/javafx/bin” >> ~/.profile
echo “JAVAFX_HOME=/opt/javafx” >> ~/.profile
source ~/.profile

Now you can call javafx, javafxc, javafxdoc and javafxpackager from your terminal. Don’t forget that you need Java 1.6 or greater installed.

Here’s a video showing the SDK working, I’m compiling and running two sample applications. Remeber that as a temporary unofficial port for Linux, there’s not native video support nor hardware acceleration.

Compiling Inkscape

Inkscape running

Inkscape is a Open Source vector graphics editor that works with SVG (Scalable Vector Graphics) format, Inkscape works with transparency, gradients, node editing, pattern fills, PNG export, and more. It also runs on Linux, Windows and OSX, those three are officially supported, but also runs in a broad list of Operational Systems. Is a software that I work daily and frequently is featured here in my blog.

You can download Inkscape or directly install it via some package system like Apt:

sudo apt-get install inskcape

But sometimes we need some special feature that is not available yet in the repositories or we want gain speed by having special binaries for our platforms or we want to help developing a new feature. In those cases we need to compile the software by ourself.

Those tips are valid for Ubuntu 8.04 but some part of them can be applied in others distributions. The Inkscape compiled here is the version 0.46+devel so newest versions can have compiling procedures slightly different.

Getting sources via APT.The easiest way to compile Inkscape on Ubuntu is

sudo su
apt-get build-dep inkscape
apt-get source inkscape
cd inkscape
./autogen.sh
./configure
make
make install

This will get a version of inkscape, compile it and install. If the first step doesn’t work well, you can try install all necessary packages by yourself using:

sudo apt-get install autotools-dev fakeroot dh-make build-essential autoconf automake intltool libglib2.0-dev libpng12-dev libgc-dev libfreetype6-dev liblcms1-dev libgtkmm-2.4-dev libxslt1-dev libboost-dev libpopt-dev libgsl0ldbl libgsl0-dev libgsl0-dbg libgnome-vfsmm-2.6-dev libssl-dev libmagick++9-dev libwpg-dev

Getting sources via SVN. The recipe I showed above will compile a stable version of Inkscape but not the last version of Inkscape. For that we need to grab the source directly from the Subversion repositories and so compile it.

At your home folder:

sudo apt-get install subversion
svn checkout https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk inkscape

A alternative way to subversion is getting sources from here. Those are tarballs built every hour after someone change something in the development repositories. Download a tarball, and decompress it on your home folder.

Install all tools we need to compile Inkscape, this should fits:

sudo apt-get install autotools-dev fakeroot dh-make build-essential autoconf automake intltool libglib2.0-dev libpng12-dev libgc-dev libfreetype6-dev liblcms1-dev libgtkmm-2.4-dev libxslt1-dev libboost-dev libpopt-dev libgsl0ldbl libgsl0-dev libgsl0-dbg libgnome-vfsmm-2.6-dev libssl-dev libmagick++9-dev libwpg-dev

Enter in the directory with the Inkscape source and do:

./autogen.sh
mkdir build
cd build
../configure
make
sudo make install

In both cases, grabbing sources via svn or via apt, or can set the place where the software will be installed so it not cause conflicts with you already installed version of Inkscape. You can do that replacing the ./configure step with something like:

./configure –prefix=/home/yourname/inkscape

If you had some trouble in one of those steps, consider reading some of those other tutorials:

ps: thanks guys from the inkscape-devel@lists.sourceforge.net specially heathenx.

Câmera Microdia no Ubuntu 8.04

Eu já havia postando anteriormente como fazer funcionar câmeras Microdia usando um driver proprietário e cheio de restrições. Boas novas. Agora desenvolvedores se uniram para construir um driver livre para essa série de câmeras e o driver livre já está bem melhor que o proprietário!

Câmera integrada

Antes de mais nada, nesse post eu estou usando o Ubuntu 8.04, seguindo de perto os passos do blog de Indra Gunawan, um notebook Amazon PC FL 31, a minha câmera é essa da foto acima e ela é lista em um lsusb como:

Bus 005 Device 002: ID 0c45:624f Microdia

Os números 0c45: já indicam que essa é uma câmera Microdia. No momento em que eu escrevo, o driver livre suporta as câmeras Microdias 6242, 624e, 624f, 6270, 627b, 62bb, 145f:013d e 045e:00f4. Para uma lista mais atualizada dê uma olhada no site oficial do driver livre.

Então o primeiro passo é você abrir um terminal e dar um lsusb e observar a saída. Outra coisa importante para você saber é a versão do seu Kernel. Dê um uname -a no terminal e observe a saída. Essa é a minha:

2.6.24-16-generic

Se essa não é sua versão do Kernel, não há alarde, é possível que também funcione com você, mesmo se com outra versão do Kernel ou mesmo outro sabor de Linux.

Vamos precisar de alguns pacotes adicionais, use o seu gerenciador de pacotes (no meu caso o APT) para instalar alguns pacotes que vamos precisar. A partir daqui você precisará estar logado como root.

apt-get install git-core gitk git-gui git-doc curl ctags build-essential

Se você também quiser compilar a documentação do driver, adicione o doxygen à lista. Agora baixamos a última versão do driver usando o git. De preferencia execute esse comando no seu diretório home, pois ele vai criar um diretório microdia que você pode querer preservar.

git clone http://repo.or.cz/r/microdia.git

Se você não recebeu nenhuam mensagem de erro e todo o código-fonte foi baixado, entre no diretório microdia e simplesmente digite:

make

Se tudo deu certo o código-fonte será compilado e você encontrará entre outras coisas um arquivo microdia.ko. Se você teve algum erro, provavelmente foi por algum pacote que você não tinha, baixe esse pacote tente compilar novamente.

Vamos carregar o módulo, como root:

modprobe videodev
insmod microdia.ko

Depois disso, dê um dmesg |grep Microdia -i.

[   39.799824] microdia: Microdia USB2.0 webcam driver startup
[   39.799873] microdia: Microdia USB2.0 Webcam – Product ID 624F.
[   39.799876] microdia: Release: 0100
[   39.799878] microdia: Number of interfaces : 1
[   39.801100] microdia: Microdia USB2.0 Camera is now controlling video device /dev/video0
[   39.801133] usbcore: registered new interface driver usb_microdia_driver
[   39.801138] microdia: v0.0.0 : Microdia USB Video Camera

Se você teve uma saída assim, então as coisas vão indo bem. Você já pode testar sua câmera. Você pode usar um software específico para isso como o Camorama ou usar o próprio Mplayer:

mplayer tv:// -tv driver=v4l:width=640:height=480:device=/dev/video0 -vo x11

Eu sugiro testar primeiro o Camorama porque esses parâmetros do Mplayer funcionam comigo e eu não posso garantir que vão funcionar também com a sua câmera. Principalmente, por conta da resolução que eu usei.

Mas não vá embora agora, quando você reiniciar o computador tudo isso vai pelo espaço. Vamos fazer para que esse módulo seja carregado sempre que você ligar o computador. Vamos cópiar o arquivo .ko para o diretório de módulos do kernel.

cp microdia.ko /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/

Se você executou a algusn passos atrás o insmod, então limpe o driver da memória com um rmmod microdia. Agora rode depmod -a para gerar um novo modules.dep e mapear os arquivos no diretório de módulos.

Para terminar, adicione o módulo ao kernel com um

modprobe microdia

Agora o módulo vai ser carregado sempre que você iniciar o computador.

Agora alguns outros e brincadeiras úteis para você fazer com sua webcam. :-D

Espelho: muito útil no dia-a-dia, vale a pena criar um atalho na barra de tarefas ou no seu Desktop. Para usar o Mplayer como um espelho:

mplayer tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:noaudio -x 800 -y 600 -vf-add pp=hb:a/vb:a,hqdn3d,mirror

Effectv: O effectv é o melhor brinquedo para quem tem uma webcam. E agora ele já está disponível nos repositórios do Ubuntu:

apt-get install effectv

Para usa-lo, aqui eu chamo assim:

effectv -device /dev/video0 -size 640×480

Use as teclas para baixo ou para cima para mudar os efeitos. A tecla espaço reseta o efeito. As teclas numéricas acionam variações. Tab inverte horizontalmente, como em um espelho. Aqui alguns efeitos legais.

Edgeblurtv

HolographicTv

OpTv

SimuraTv

MatrixTv