Wednesday, July 28, 2010

Merging Subtitles in Video Files with DivXConverter

I recently discovered this cool program, DivXConverter, which I didn't find in my Ubuntu distribution (you can download the .deb file, though, and install the required dependencies), but that's really useful and easy to use.

"DivX converter is a simple Mencoder frontend to Produce DivX Player Compatible AVI video format with the ability to merge subtitles . It support many video and audio filters and many presets."
Now, the interesting features I've just used is the ability of merging a subtitle file (typically .srt) into a corresponding AVI file.

Here's what to do (see also the following screenshot):
  1. Add the avi file (and select the output folder and the compression, I left the default Normal compression)
  2. Make sure to select Xvid in the "Video Filters" tab to make sure the resulting avi is compatible with dvd/divx readers (at least the with ones I own)
  3. You can leave the default settings for Audio
  4. Select the subtitle file (I set ASCII as the encoding)
  5. Go back to the main window
  6. Press "Convert" and enjoy the resulting AVI file




Friday, July 09, 2010

mounting none on /dev failed: No such device

If you're experiencing this error message at boot in Linux (e.g., after you recompiled the kernel in Ubuntu Lucid)

mounting none on /dev failed: No such device

don't be scared, the boot will continue and there'll be no problem (at least, I read in some posts); I never experienced problems even with this error at boot.
But if you want to get rid of it, just make sure that you have

CONFIG_DEVTMPFS=y

in your .config file of your kernel source directory.

Wednesday, July 07, 2010

mSoma a Qt client for SomaFM

Andrea Grandi proposed me a few weeks ago to try and develop a client for SomaFM, a streaming radio with near 16 different channels, available for free. Indeed we wanted to try to develop an application for our cool Nokia N900 smartphone. Since this phone is now based on my beloved Qt framework, I accepted with much pleasure.

The really cool thing was that, by relying on the qt-mobility APIs (new Qt APIs for mobile application developers), we could enjoy cross-platform developing: all the code that I wrote for this player was tested and debuged on my computer, as a desktop application. Then, we deployed on the Nokia N900 and tried it there (and it worked seamlessly).

For instance, this are some screenshots of msoma running as a desktop application (in Linux in this case):


And this is a screenshot of the application running in the N900 (taken from Andrea's blog post):


Which is just a recompilation targeting Maemo (with this respect, the Nokia Qt SDK, based on QtCreator, is really helpful when developing).

Of course, this is the very first version of this application, and surely the UI should be different in the desktop application with respect to the cellphone version (in order to be more usable in the mobile devices). But, as it is, it's already enjoyable (but I may be biased ;)

Source code is available on Gitorious and it's always updated with latest version we're working on. If someone want to test the application, it's available in extras-devel repository ("msoma" under Multimedia section) of N900.

In case you want to use it as a desktop application, please remember that you need qt-mobility. I blogged about the installation of qt-mobility in Linux.

We really want to thank, Rusty Hodge, SomaFM's founder, who provided so many details about SomaFM for developing our application (and of course we thank him also for SomaFM itself :)

We look forward to receiving feedback, patches, suggestions, and help! :)

Our maemo profiles:

Friday, June 18, 2010

Building Qt-Mobility in Ubuntu

Lately I started to try to develop applications for the Nokia N900, and the Maemo platform uses my beloved framework Qt :)

In particular, Nokia started to develop the Qt-Mobility Framework. Quoting from their white paper:

The Qt Mobility Project presents a collection of related software frameworks and interfaces. The objective being to deliver new Qt APIs for mobile application developers. Using these new APIs, developers will be able to create cross-platform applications targeting Maemo, Symbian and other platforms. This suite of features also has components that will be desirable to all users, not just those with mobile devices, so Mobility has advantages even for the desktop user.
Thus, I wanted to try this project also on my Desktop (after all the intent of this framework is cross-platform development), and tried to compile qt-mobility on my Ubuntu/Kubuntu desktop. Unfortunately, I experienced many problems which now I seem to have solved, thus I'd like to share the steps to build qt-mobility from sources.

First of all, when installing qt-mobility after compilation, some files will be created in your current Qt installation. Thus, since I wouldn't want to spoil my qt installation from ubuntu packages, which is installed in system path, I downloaded the new qt framework 4.6.3 from the Nokia download site, and installed it in a path of my home: ~/usr/local/Trolltech/qtsdk-2010.03.

Then, I installed some packages that are useful to build qt-mobility and to enjoy media contents such as mp3 and videos, relying on gstreamer (not all these packages may be necessary, but after some tests, at least these packages will make things work):
sudo apt-get install libasound2-dev libbluetooth-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev network-manager-dev libxv-dev gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-ffmpeg w32codecs ubuntu-restricted-extras gstreamer0.10-plugins-good freeglut3-dev
Then, you need to get the sources of qt-mobility, and I got them from the git repository
git clone git://gitorious.org/qt-mobility/qt-mobility.git

However, you may want to get the stable sources (e.g., from qt-mobility download).
Since I'm a big fan of "shadow builds" which won't spoil your source directory, I built qt-mobility in another directory of my home, separate from the directory where I have the sources of qt-mobility (in this example the sources are in ~/install/qt-mobility): ~/build/qt-mobility/qt-4.6.3 (I specified the qt version I'm building qt-mobility with, since I may want to experiment with different qt versions):
  • cd ~/build/qt-mobility/qt-4.6.3
  • PATH=~/usr/local/Trolltech/qtsdk-2010.03/qt/bin:$PATH ~/install/qt-mobility/configure -examples -prefix ~/usr/local/Trolltech/qt-mobility > output.txt
Note that I temporarily change the PATH environment variable so that the configure script will use my local qt installation; I specify that I want to build the examples, and I redirect the output in a text file. This will also allows you to see possible errors during the configuration step (e.g., missing packages). Note also that I will install (once built) qt-mobility in my home directory in ~/usr/local/Trolltech/qt-mobility.

Once the configuration step is successful, you can start building qt-mobility and then install it:
  • make
  • make install
During the installation, if you take a look at the output, you will note that some files will be added to your qt installation, e.g.,
  • install -m 644 -p /home/bettini/build/qt-mobility/qt-4.6.3/features/mobility.prf /home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/mkspecs/features/
  • install -m 644 -p /home/bettini/build/qt-mobility/qt-4.6.3/features/mobilityconfig.prf /home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/mkspecs/features/
This way qt-mobility will be integrated in your qt framework (at least, this is what I presume).

Now, you can test your qt-installation by running an example (which was built and installed), for instance the player demo or the weather demo:
  • ~/usr/local/Trolltech/qt-mobility/bin/player
  • ~/usr/local/Trolltech/qt-mobility/bin/weatherinfo_with_location


Now, let's try to see whether we're able to use qt-mobility in our programs.

We'll try to compile a very simple qt program using a class from the qt-mobility framework (QVideoWidget), though we won't do anything with that (just to see whether we can build the application).

here's the files of our project

myvideowidget.pro




QT       += core gui

TARGET = myvideowidget
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += mainwindow.h

CONFIG += mobility
MOBILITY = multimedia

mainwindow.h




#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class QVideoWidget;
class QMediaPlayer;

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);

private:
QVideoWidget *videoWidget;
QMediaPlayer *player;
};

#endif // MAINWINDOW_H

mainwindow.cpp




#include <QMediaPlayer>
#include <QVideoWidget>
#include <QTextEdit>

#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
videoWidget = new QVideoWidget(this);

setCentralWidget(videoWidget);
}



main.cpp





#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}


now, you should run the qmake of your qt installation you've used to build qt-mobility, thus
  • ~/usr/local/Trolltech/qtsdk-2010.03/qt/bin/qmake myvideowidget.pro
and then run make, hopefully you should get no error. Note that we haven't named our qt-mobility installation directory anywhere here; there's no need to, since your qt installation was modified by qt-mobility, so that qmake will set all the variables for include files and libraries also for the qt-mobility path! In fact, you should see these compilation command lines:
  • g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/mkspecs/linux-g++ -I../../myvideowidget -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/include/QtCore -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/include/QtNetwork -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/include/QtGui -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/include/QtOpenGL -I../../../../usr/local/Trolltech/qtsdk-2010.03/qt/include -I/home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/include/QtMultimediaKit -I../../../../usr/local/Trolltech/qt-mobility/include -I../../../../usr/local/Trolltech/qt-mobility/include/QtMultimediaKit -I/usr/X11R6/include -I. -I../../myvideowidget -I. -o mainwindow.o ../../myvideowidget/mainwindow.cpp
  • g++ -Wl,-O1 -Wl,-rpath,/home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/lib -Wl,-rpath,/home/bettini/usr/local/Trolltech/qt-mobility/lib -o myvideowidget main.o mainwindow.o moc_mainwindow.o -L/home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/lib -L/usr/X11R6/lib -L/home/bettini/usr/local/Trolltech/qt-mobility/lib -lQtMultimediaKit -lQtOpenGL -L/home/bettini/usr/local/Trolltech/qtsdk-2010.03/qt/lib -L/usr/X11R6/lib -lQtGui -lQtNetwork -lQtCore -lGLU -lGL -lpthread
Now you can enjoy qt-mobility in your desktop :)

Tuesday, May 11, 2010

Eclipse internal Web Browser in Ubuntu Lucid

After switching to Ubuntu Lucid I noted that in my eclipse php installation the internal web browser was not working anymore since it was lacking some mozilla libraries.

In that case, it is enough to install the current xulrunner:

sudo apt-get install xulrunner-1.9.2

and the internal web browser in eclipse will work again! :)

Wednesday, May 05, 2010

PhpBibliography 1.0 - using CakePhp

The brand new release of PhpBibliography is out!

PhpBibliography allows you to publish your bibliography online (and to edit it via web).
It is implemented in Php 5 and uses MySql 5 (however, it might work also with Php 4, and also with MySql 4, but I'm not testing this).

This is a complete rewriting using CakePhp, the old version site is available here.

CakePhp is really a wonderful framework and I really enjoyed using it for PhpBibliography.

Hopefully, PhpBibliography is now more stable, relying on many mechanisms offered by CakePhp, and it looks nicer (in my opinion at least).

In the near future, I'm also planning to allow customization of the look by relying on CakePhp themes.

If you have an already installed version of PhpBibliography (earlier than version 1.x) you will need to follow the instructions you find at this link.

PhpBibliography now comes with a web based installation procedure which should minimize the efforts of the user who installs it (hopefully).


These are the main features provided by PhpBibliography:

  • Automatic generation of bibtex for papers (unless a manual bib item is specified when editing the paper).
  • For each paper two files can be uploaded and two links can be specified.
  • Papers can be searched with criteria about their fields.
  • Besides standard fields, new attributes can be specified for papers; attributes can be selectable, i.e., the logged user can choose among a(n extensible) set of values and multiple, i.e., a paper can be given several values for that attribute; an example of selectable/single attribute is "Publisher", an example of selectable/multiple attribute is "Keyword", and an example of non-selectable attribute is "DOI".
  • Papers can be specified as private (visible only to logged users).
  • Reports can be generated by filtering by author, by value and by grouping up to two levels (e.g., show only papers of a given authors, grouped by year and by paper type).
  • RSS feeds are available for search results, reports and paper lists.
  • Lists of papers, and results of reports and searches can be included in other webpages (by using the bare layout).
  • Papers can be imported from DBLP.
  • Searches for possible duplicate papers.
  • Papers can be inserted through bibtex items and bibtex files.
And here are some screenshots of the new interface:

The main paper view


Recently modified papers


Let's generate a report...


...and this is the result.


The administrative interface (for logged users)


Papers shown in a table ready to be edited or deleted.


The view of a paper


The co-authors of an author

Monday, May 03, 2010

Package php-doc missing in Ubuntu Lucid

After installing the new Ubuntu Lucid I discovered that the package php-doc is not available anymore. Since I often work offline, having the php documentation installed to be browsed offline is a must for me.

It looks like for the moment that package is not available due to build failures.

Fortunately, the package for karmic can be installed without any problem, and you can download it from here. :)